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.
This commit is contained in:
Sebastian Dröge 2009-08-08 22:43:06 +02:00
parent ea6a66b5b3
commit d181dbd7a0
3 changed files with 12 additions and 4 deletions

View file

@ -1471,7 +1471,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
* See below for usefullness * See below for usefullness
*/ */
static GstCaps * GstCaps *
gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
enum CodecID codec_id) enum CodecID codec_id)
{ {

View file

@ -101,6 +101,16 @@ gst_ffmpeg_caps_with_codectype (enum CodecType type,
GstCaps * GstCaps *
gst_ffmpeg_formatid_to_caps (const gchar *format_name); 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 * _formatid_get_codecids () can be used to get the codecIDs
* (CODEC_ID_NONE-terminated list) that fit that specific * (CODEC_ID_NONE-terminated list) that fit that specific

View file

@ -341,9 +341,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
} }
GST_DEBUG_OBJECT (ffmpegenc, GST_DEBUG_OBJECT (ffmpegenc,
"Got an official pixfmt [%d], attempting to get caps", pixfmt); "Got an official pixfmt [%d], attempting to get caps", pixfmt);
tmpcaps = tmpcaps = gst_ffmpeg_pixfmt_to_caps (pixfmt, NULL, oclass->in_plugin->id);
gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, NULL,
oclass->in_plugin->id, TRUE);
if (tmpcaps) { if (tmpcaps) {
GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out"); GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out");
if (!caps) if (!caps)