From 5e5fe9fa15ceb0abae90c8f857f40d1791e7d2d4 Mon Sep 17 00:00:00 2001 From: don.darling Date: Mon, 24 May 2010 21:24:12 +0000 Subject: Create source caps information for MPEG-2 streams in TIVidenc1. If you don't generate this caps information, you will also get errors while encoding that look like this: (gst-launch-0.10:1580): GStreamer-CRITICAL **: gst_caps_unref: assertion `caps != NULL' failed The fact that source caps information was never generated for MPEG-2 looks like an oversight -- the static caps for TIVidenc1 already allowed MPEG-2. git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@647 24075187-2e39-4e88-bbb8-bc8aa768f540 --- diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c index 2e1fb31..9749459 100644 --- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c +++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c @@ -724,10 +724,13 @@ static gboolean gst_tividenc1_set_source_caps( gboolean ret; GstPad *pad; char *string; - GstTICodec *h264Codec = NULL, *mpeg4Codec = NULL; + GstTICodec *h264Codec = NULL; + GstTICodec *mpeg4Codec = NULL; + GstTICodec *mpeg2Codec = NULL; h264Codec = gst_ticodec_get_codec("H.264 Video Encoder"); mpeg4Codec = gst_ticodec_get_codec("MPEG4 Video Encoder"); + mpeg2Codec = gst_ticodec_get_codec("MPEG2 Video Encoder"); pad = videnc1->srcpad; @@ -754,6 +757,24 @@ static gboolean gst_tividenc1_set_source_caps( g_free(string); } + /* Create MPEG-2 source cap */ + if (mpeg2Codec && (!strcmp(mpeg2Codec->CE_CodecName, videnc1->codecName))) { + gint mpegversion = 2; + + caps = + gst_caps_new_simple("video/mpeg", + "mpegversion", G_TYPE_INT, mpegversion, + "framerate", GST_TYPE_FRACTION, videnc1->framerateNum, + videnc1->framerateDen, + "width", G_TYPE_INT, dim.width, + "height", G_TYPE_INT, dim.height, + NULL); + + string = gst_caps_to_string(caps); + GST_LOG("setting source caps to mpeg2: %s", string); + g_free(string); + } + /* Create MPEG4 source cap */ if (mpeg4Codec && (!strcmp(mpeg4Codec->CE_CodecName, videnc1->codecName))) { gint mpegversion = 4; -- cgit v0.8.3.1-30-gff3a