summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4gpay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-07-16 14:31:48 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-07-16 14:31:48 +0000
commitf6a274239a935b7e0ff70a227a7b61ae7e287077 (patch)
treeae433eb69216eb3d6f119265d1fa7c62773112ad /gst/rtp/gstrtpmp4gpay.c
parent4965e7c58dd34f36c58807b039fd32a82cb24c40 (diff)
gst/rtp/: Added simple generic mpeg4 depayloader.
Original commit message from CVS: * gst/rtp/Makefile.am: * gst/rtp/gstrtp.c: (plugin_init): * gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_base_init), (gst_rtp_mp4g_depay_class_init), (gst_rtp_mp4g_depay_init), (gst_rtp_mp4g_depay_setcaps), (gst_rtp_mp4g_depay_process), (gst_rtp_mp4g_depay_set_property), (gst_rtp_mp4g_depay_get_property), (gst_rtp_mp4g_depay_change_state), (gst_rtp_mp4g_depay_plugin_init): * gst/rtp/gstrtpmp4gdepay.h: * gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_class_init), (gst_rtp_mp4g_pay_parse_audio_config), (gst_rtp_mp4g_pay_setcaps), (gst_rtp_mp4g_pay_flush): Added simple generic mpeg4 depayloader. Fix generic mpeg4 payloader.
Diffstat (limited to 'gst/rtp/gstrtpmp4gpay.c')
-rw-r--r--gst/rtp/gstrtpmp4gpay.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gst/rtp/gstrtpmp4gpay.c b/gst/rtp/gstrtpmp4gpay.c
index e09195e8..3c8d804f 100644
--- a/gst/rtp/gstrtpmp4gpay.c
+++ b/gst/rtp/gstrtpmp4gpay.c
@@ -51,12 +51,12 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp, "
- "media = (string) \"video\", "
+ "media = (string) { \"video\", \"audio\", \"application\" }, "
"payload = (int) [ 96, 127 ], "
"clock-rate = (int) [1, MAX ], "
"encoding-name = (string) \"mpeg4-generic\", "
/* required string params */
- "streamtype = (string) { \"4\", \"5\" }, " /* 4 = video, 5 = audio */
+ "streamtype = (int) { \"4\", \"5\" }, " /* 4 = video, 5 = audio */
"profile-level-id = (int) [1,MAX], "
/* "config = (string) [1,MAX]" */
"mode = (string) { \"generic\", \"CELP-cbr\", \"CELP-vbr\", \"AAC-lbr\", \"AAC-hbr\" }, "
@@ -64,7 +64,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
"objecttype = (int) [1,MAX], " "constantsize = (int) [1,MAX], " /* constant size of each AU */
"constantduration = (int) [1,MAX], " /* constant duration of each AU */
"maxdisplacement = (int) [1,MAX], "
- "de-interleavebuffersize: = (int) [1,MAX], "
+ "de-interleavebuffersize = (int) [1,MAX], "
/* Optional configuration parameters */
"sizelength = (int) [1, 16], " /* max 16 bits, should be enough... */
"indexlength = (int) [1, 8], "
@@ -160,7 +160,6 @@ gst_rtp_mp4g_pay_class_init (GstRtpMP4GPayClass * klass)
GST_DEBUG_CATEGORY_INIT (rtpmp4gpay_debug, "rtpmp4gpay", 0,
"MP4-generic RTP Payloader");
-
}
static void
@@ -237,7 +236,7 @@ gst_rtp_mp4g_pay_parse_audio_config (GstRtpMP4GPay * rtpmp4gpay,
/* audio stream type */
rtpmp4gpay->streamtype = 5;
/* mode */
- rtpmp4gpay->mode = "ACC-hbr";
+ rtpmp4gpay->mode = "AAC-hbr";
/* profile (should be 1) */
rtpmp4gpay->profile = objectType - 1;
@@ -363,7 +362,7 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
GstRtpMP4GPay *rtpmp4gpay;
GstStructure *structure;
const GValue *codec_data;
- gboolean res = TRUE;
+ gchar *media_type = NULL;
rtpmp4gpay = GST_RTP_MP4G_PAY (payload);
@@ -375,6 +374,7 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
GstBuffer *buffer;
const gchar *name;
+ gboolean res;
buffer = gst_value_get_buffer (codec_data);
GST_LOG_OBJECT (rtpmp4gpay, "configuring codec_data");
@@ -384,8 +384,10 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
/* parse buffer */
if (!strcmp (name, "audio/mpeg")) {
res = gst_rtp_mp4g_pay_parse_audio_config (rtpmp4gpay, buffer);
+ media_type = "audio";
} else if (!strcmp (name, "video/mpeg")) {
res = gst_rtp_mp4g_pay_parse_video_config (rtpmp4gpay, buffer);
+ media_type = "video";
} else {
res = FALSE;
}
@@ -399,13 +401,15 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
rtpmp4gpay->config = gst_buffer_copy (buffer);
}
}
+ if (media_type == NULL)
+ goto config_failed;
- gst_basertppayload_set_options (payload, "video", TRUE, "mpeg4-generic",
+ gst_basertppayload_set_options (payload, media_type, TRUE, "mpeg4-generic",
rtpmp4gpay->rate);
gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
- return res;
+ return TRUE;
/* ERRORS */
config_failed:
@@ -503,7 +507,7 @@ gst_rtp_mp4g_pay_flush (GstRtpMP4GPay * rtpmp4gpay)
gst_adapter_flush (rtpmp4gpay->adapter, payload_len);
/* marker only if the packet is complete */
- gst_rtp_buffer_set_marker (outbuf, avail > payload_len);
+ gst_rtp_buffer_set_marker (outbuf, avail <= payload_len);
GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4gpay->first_ts;