From d181dbd7a0e2fa1613c4312a7e9a6320c6a3933c Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Sat, 8 Aug 2009 22:43:06 +0200 Subject: ffmpegenc: If an encoder lists the supported pixfmts use them to create the caps ...instead of creating standard caps with all pixfmts. Fixes bug #591038. --- ext/ffmpeg/gstffmpegcodecmap.c | 2 +- ext/ffmpeg/gstffmpegcodecmap.h | 10 ++++++++++ ext/ffmpeg/gstffmpegenc.c | 4 +--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index cc3eb2d..04e0677 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -1471,7 +1471,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, * See below for usefullness */ -static GstCaps * +GstCaps * gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, enum CodecID codec_id) { diff --git a/ext/ffmpeg/gstffmpegcodecmap.h b/ext/ffmpeg/gstffmpegcodecmap.h index 6c60223..f7cfa89 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.h +++ b/ext/ffmpeg/gstffmpegcodecmap.h @@ -101,6 +101,16 @@ gst_ffmpeg_caps_with_codectype (enum CodecType type, GstCaps * gst_ffmpeg_formatid_to_caps (const gchar *format_name); +/* Convert a FFMPEG Pixel Format and optional AVCodecContext + * to a GstCaps. If the context is ommitted, no fixed values + * for video/audio size will be included in the GstCaps + * + * See below for usefullness + */ + +GstCaps * +gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, enum CodecID codec_id); + /* * _formatid_get_codecids () can be used to get the codecIDs * (CODEC_ID_NONE-terminated list) that fit that specific diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index 1a67db0..db1f5d8 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c @@ -341,9 +341,7 @@ gst_ffmpegenc_getcaps (GstPad * pad) } GST_DEBUG_OBJECT (ffmpegenc, "Got an official pixfmt [%d], attempting to get caps", pixfmt); - tmpcaps = - gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, NULL, - oclass->in_plugin->id, TRUE); + tmpcaps = gst_ffmpeg_pixfmt_to_caps (pixfmt, NULL, oclass->in_plugin->id); if (tmpcaps) { GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out"); if (!caps) -- cgit v1.2.3