diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index c179563ccc..59c51fd9a3 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -94,7 +94,7 @@ gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass) in_plugin->id, FALSE, in_plugin); if (!srccaps) { GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name); - srccaps = gst_caps_from_string ("unknown/unknown"); + srccaps = gst_caps_from_string ("audio/x-raw"); } /* pad templates */ diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c index 91b887636d..ab596869a9 100644 --- a/ext/libav/gstavcodecmap.c +++ b/ext/libav/gstavcodecmap.c @@ -2022,15 +2022,6 @@ gst_ffmpeg_audio_set_sample_fmts (GstCaps * caps, return; } - /* Only a single format */ - if (fmts[1] == -1) { - format = gst_ffmpeg_smpfmt_to_audioformat (fmts[0]); - if (format != GST_AUDIO_FORMAT_UNKNOWN) - gst_caps_set_simple (caps, "format", G_TYPE_STRING, - gst_audio_format_to_string (format), NULL); - return; - } - g_value_init (&va, GST_TYPE_LIST); g_value_init (&v, G_TYPE_STRING); while (*fmts != -1) { @@ -2041,8 +2032,12 @@ gst_ffmpeg_audio_set_sample_fmts (GstCaps * caps, } fmts++; } - if (gst_value_list_get_size (&va) > 0) + if (gst_value_list_get_size (&va) == 1) { + /* The single value is still in v */ + gst_caps_set_value (caps, "format", &v); + } else if (gst_value_list_get_size (&va) > 1) { gst_caps_set_value (caps, "format", &va); + } g_value_unset (&v); g_value_unset (&va); } @@ -2099,14 +2094,6 @@ gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts) } /* Only a single format */ - if (fmts[1] == -1) { - format = gst_ffmpeg_pixfmt_to_videoformat (fmts[0]); - if (format != GST_VIDEO_FORMAT_UNKNOWN) - gst_caps_set_simple (caps, "format", G_TYPE_STRING, - gst_video_format_to_string (format), NULL); - return; - } - g_value_init (&va, GST_TYPE_LIST); g_value_init (&v, G_TYPE_STRING); while (*fmts != -1) { @@ -2117,8 +2104,12 @@ gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts) } fmts++; } - if (gst_value_list_get_size (&va) > 0) + if (gst_value_list_get_size (&va) == 1) { + /* The single value is still in v */ + gst_caps_set_value (caps, "format", &v); + } else if (gst_value_list_get_size (&va) > 1) { gst_caps_set_value (caps, "format", &va); + } g_value_unset (&v); g_value_unset (&va); } diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 3b6375e989..bd34f19ea2 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -173,7 +173,12 @@ gst_ffmpegviddec_base_init (GstFFMpegVidDecClass * klass) GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name); sinkcaps = gst_caps_new_empty_simple ("unknown/unknown"); } - srccaps = gst_caps_new_empty_simple ("video/x-raw"); + srccaps = gst_ffmpeg_codectype_to_video_caps (NULL, + in_plugin->id, FALSE, in_plugin); + if (!srccaps) { + GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name); + srccaps = gst_caps_from_string ("video/x-raw"); + } /* pad templates */ sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,