From 2d397aeedfaa9f0155343f96023a608f882f5213 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 29 Dec 2002 22:59:45 +0000 Subject: [PATCH] fix mpeg1 playback Original commit message from CVS: fix mpeg1 playback --- ext/ffmpeg/gstffmpegall.c | 27 +++++++++++++++------------ ext/ffmpeg/gstffmpegallcodecmap.c | 6 ++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ext/ffmpeg/gstffmpegall.c b/ext/ffmpeg/gstffmpegall.c index 23d49bb..f267b0a 100644 --- a/ext/ffmpeg/gstffmpegall.c +++ b/ext/ffmpeg/gstffmpegall.c @@ -163,9 +163,9 @@ GST_PAD_TEMPLATE_FACTORY(sink_templ, "gstffmpeg_sink_mpeg", "video/mpeg", "systemstream", GST_PROPS_BOOLEAN(FALSE), - "mpegversion", GST_PROPS_INT(1), + "mpegversion", GST_PROPS_INT(1) /*, "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096) + "height", GST_PROPS_INT_RANGE (16, 4096)*/ ), GST_CAPS_NEW ( "gstffmpeg_sink_jpeg", @@ -288,18 +288,21 @@ gst_ffmpegdecall_connect (GstPad *pad, GstCaps *caps) return GST_PAD_CONNECT_REFUSED; } - /* set caps on src pad based on context.pix_fmt && width/height */ - newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO, - &ffmpegdec->context); - if (!newcaps) { - GST_DEBUG(GST_CAT_PLUGIN_INFO, - "Failed to create caps for other end (pix_fmt=%d)", - ffmpegdec->context.pix_fmt); - return GST_PAD_CONNECT_REFUSED; + if (ffmpegdec->context.width > 0 && ffmpegdec->context.height > 0) { + /* set caps on src pad based on context.pix_fmt && width/height */ + newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO, + &ffmpegdec->context); + if (!newcaps) { + GST_DEBUG(GST_CAT_PLUGIN_INFO, + "Failed to create caps for other end (pix_fmt=%d)", + ffmpegdec->context.pix_fmt); + return GST_PAD_CONNECT_REFUSED; + } + + return gst_pad_try_set_caps(ffmpegdec->srcpad, newcaps); } - return gst_pad_try_set_caps(ffmpegdec->srcpad, newcaps); - /*return GST_PAD_CONNECT_OK;*/ + return GST_PAD_CONNECT_OK; } static void diff --git a/ext/ffmpeg/gstffmpegallcodecmap.c b/ext/ffmpeg/gstffmpegallcodecmap.c index 9f1638a..3a47db5 100644 --- a/ext/ffmpeg/gstffmpegallcodecmap.c +++ b/ext/ffmpeg/gstffmpegallcodecmap.c @@ -719,8 +719,10 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps, } if (video && context) { - gst_caps_get_int(caps, "width", &context->width); - gst_caps_get_int(caps, "height", &context->height); + if (gst_caps_has_property(caps, "width")) + gst_caps_get_int(caps, "width", &context->width); + if (gst_caps_has_property(caps, "height")) + gst_caps_get_int(caps, "height", &context->height); /* framerate (context->frame_rate)? but then, we'd need a GstPad* */ -- 2.7.4