avcodecmap: Only append values to the video/audio format lists if we don't have them already

This commit is contained in:
Sebastian Dröge 2013-10-02 12:57:36 +02:00
parent 3c77754524
commit 3e154333de

View file

@ -191,7 +191,10 @@ gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts)
format = gst_ffmpeg_pixfmt_to_videoformat (*fmts); format = gst_ffmpeg_pixfmt_to_videoformat (*fmts);
if (format != GST_VIDEO_FORMAT_UNKNOWN) { if (format != GST_VIDEO_FORMAT_UNKNOWN) {
g_value_set_string (&v, gst_video_format_to_string (format)); g_value_set_string (&v, gst_video_format_to_string (format));
gst_value_list_append_value (&va, &v); /* Only append values we don't have yet */
if (gst_value_list_get_size (&va) == 0
|| !gst_value_can_intersect (&v, &va))
gst_value_list_append_value (&va, &v);
} }
fmts++; fmts++;
} }
@ -452,7 +455,10 @@ gst_ffmpeg_audio_set_sample_fmts (GstCaps * caps,
format = gst_ffmpeg_smpfmt_to_audioformat (*fmts); format = gst_ffmpeg_smpfmt_to_audioformat (*fmts);
if (format != GST_AUDIO_FORMAT_UNKNOWN) { if (format != GST_AUDIO_FORMAT_UNKNOWN) {
g_value_set_string (&v, gst_audio_format_to_string (format)); g_value_set_string (&v, gst_audio_format_to_string (format));
gst_value_list_append_value (&va, &v); /* Only append values we don't have yet */
if (gst_value_list_get_size (&va) == 0
|| !gst_value_can_intersect (&v, &va))
gst_value_list_append_value (&va, &v);
} }
fmts++; fmts++;
} }