summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4vpay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-02-10 17:16:55 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-02-10 17:16:55 +0000
commit2187906ae855b87d667a8d75c2f8aacda00cfbf1 (patch)
tree1ae1cbd8b9aed0af7f953bb734ad16f8d180336b /gst/rtp/gstrtpmp4vpay.c
parentf9d2e49e40269dda8dc1fa7db6b7037a188e4a00 (diff)
gst/rtp/gstrtpmp4vpay.c: Don't waste time looking for a config string if we have codec_info on the incomming caps.
Original commit message from CVS: * gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_class_init), (gst_rtp_mp4v_pay_setcaps): Don't waste time looking for a config string if we have codec_info on the incomming caps.
Diffstat (limited to 'gst/rtp/gstrtpmp4vpay.c')
-rw-r--r--gst/rtp/gstrtpmp4vpay.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gst/rtp/gstrtpmp4vpay.c b/gst/rtp/gstrtpmp4vpay.c
index ce291a3c..b8af1bef 100644
--- a/gst/rtp/gstrtpmp4vpay.c
+++ b/gst/rtp/gstrtpmp4vpay.c
@@ -22,6 +22,9 @@
#include "gstrtpmp4vpay.h"
+GST_DEBUG_CATEGORY (rtpmp4vpay_debug);
+#define GST_CAT_DEFAULT (rtpmp4vpay_debug)
+
/* elementfactory information */
static GstElementDetails gst_rtp_mp4vpay_details = {
"RTP packet parser",
@@ -143,6 +146,10 @@ gst_rtp_mp4v_pay_class_init (GstRtpMP4VPayClass * klass)
gstbasertppayload_class->set_caps = gst_rtp_mp4v_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_mp4v_pay_handle_buffer;
+
+ GST_DEBUG_CATEGORY_INIT (rtpmp4vpay_debug, "rtpmp4vpay", 0,
+ "MP4 video RTP Payloader");
+
}
static void
@@ -192,9 +199,40 @@ static gboolean
gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
{
GstRtpMP4VPay *rtpmp4vpay;
+ GstStructure *structure;
+ const GValue *codec_info;
rtpmp4vpay = GST_RTP_MP4V_PAY (payload);
+ structure = gst_caps_get_structure (caps, 0);
+ codec_info = gst_structure_get_value (structure, "codec_info");
+ if (codec_info) {
+ GST_LOG_OBJECT (rtpmp4vpay, "got codec_info");
+ if (G_VALUE_TYPE (codec_info) == GST_TYPE_BUFFER) {
+ GstBuffer *buffer;
+ guint8 *data;
+ guint size;
+
+ buffer = gst_value_get_buffer (codec_info);
+
+ data = GST_BUFFER_DATA (buffer);
+ size = GST_BUFFER_SIZE (buffer);
+
+ if (size < 5)
+ goto done;
+
+ rtpmp4vpay->profile = data[4];
+ GST_LOG_OBJECT (rtpmp4vpay, "configuring codec_info, profile %d",
+ data[4]);
+
+ if (rtpmp4vpay->config)
+ gst_buffer_unref (rtpmp4vpay->config);
+ rtpmp4vpay->config = gst_buffer_copy (buffer);
+ gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
+ }
+ }
+
+done:
gst_basertppayload_set_options (payload, "video", TRUE, "MP4V-ES",
rtpmp4vpay->rate);