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.
This commit is contained in:
Wim Taymans 2006-02-10 17:16:55 +00:00
parent f9d2e49e40
commit 2187906ae8
2 changed files with 45 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2006-02-10 Wim Taymans <wim@fluendo.com>
* 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.
2006-02-10 Wim Taymans <wim@fluendo.com> 2006-02-10 Wim Taymans <wim@fluendo.com>
* gst/rtp/README: * gst/rtp/README:

View file

@ -22,6 +22,9 @@
#include "gstrtpmp4vpay.h" #include "gstrtpmp4vpay.h"
GST_DEBUG_CATEGORY (rtpmp4vpay_debug);
#define GST_CAT_DEFAULT (rtpmp4vpay_debug)
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_rtp_mp4vpay_details = { static GstElementDetails gst_rtp_mp4vpay_details = {
"RTP packet parser", "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->set_caps = gst_rtp_mp4v_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_mp4v_pay_handle_buffer; gstbasertppayload_class->handle_buffer = gst_rtp_mp4v_pay_handle_buffer;
GST_DEBUG_CATEGORY_INIT (rtpmp4vpay_debug, "rtpmp4vpay", 0,
"MP4 video RTP Payloader");
} }
static void static void
@ -192,9 +199,40 @@ static gboolean
gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps) gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
{ {
GstRtpMP4VPay *rtpmp4vpay; GstRtpMP4VPay *rtpmp4vpay;
GstStructure *structure;
const GValue *codec_info;
rtpmp4vpay = GST_RTP_MP4V_PAY (payload); 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", gst_basertppayload_set_options (payload, "video", TRUE, "MP4V-ES",
rtpmp4vpay->rate); rtpmp4vpay->rate);