mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
avdec: Improve src template caps
This commit is contained in:
parent
cb9e40ff4c
commit
21ac746f33
3 changed files with 17 additions and 21 deletions
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue