fix mpeg1 playback

Original commit message from CVS:
fix mpeg1 playback
This commit is contained in:
Ronald S. Bultje 2002-12-29 22:59:45 +00:00
parent d1c169e6ad
commit 2d397aeedf
2 changed files with 19 additions and 14 deletions

View file

@ -163,9 +163,9 @@ GST_PAD_TEMPLATE_FACTORY(sink_templ,
"gstffmpeg_sink_mpeg", "gstffmpeg_sink_mpeg",
"video/mpeg", "video/mpeg",
"systemstream", GST_PROPS_BOOLEAN(FALSE), "systemstream", GST_PROPS_BOOLEAN(FALSE),
"mpegversion", GST_PROPS_INT(1), "mpegversion", GST_PROPS_INT(1) /*,
"width", GST_PROPS_INT_RANGE (16, 4096), "width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096) "height", GST_PROPS_INT_RANGE (16, 4096)*/
), ),
GST_CAPS_NEW ( GST_CAPS_NEW (
"gstffmpeg_sink_jpeg", "gstffmpeg_sink_jpeg",
@ -288,18 +288,21 @@ gst_ffmpegdecall_connect (GstPad *pad, GstCaps *caps)
return GST_PAD_CONNECT_REFUSED; return GST_PAD_CONNECT_REFUSED;
} }
/* set caps on src pad based on context.pix_fmt && width/height */ if (ffmpegdec->context.width > 0 && ffmpegdec->context.height > 0) {
newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO, /* set caps on src pad based on context.pix_fmt && width/height */
&ffmpegdec->context); newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO,
if (!newcaps) { &ffmpegdec->context);
GST_DEBUG(GST_CAT_PLUGIN_INFO, if (!newcaps) {
"Failed to create caps for other end (pix_fmt=%d)", GST_DEBUG(GST_CAT_PLUGIN_INFO,
ffmpegdec->context.pix_fmt); "Failed to create caps for other end (pix_fmt=%d)",
return GST_PAD_CONNECT_REFUSED; 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 static void

View file

@ -719,8 +719,10 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
} }
if (video && context) { if (video && context) {
gst_caps_get_int(caps, "width", &context->width); if (gst_caps_has_property(caps, "width"))
gst_caps_get_int(caps, "height", &context->height); 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* */ /* framerate (context->frame_rate)? but then, we'd need a GstPad* */