summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-10-02 13:59:04 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-10-04 13:03:49 +0200
commitd0314aebb1fc5f131e0bdfeeeed679cb90838f37 (patch)
tree4e5b0e480ca58d90d129c3e55e2025e0b92f9c94
parent050e487f0f3c4610d395e72cf9035b7da33f5f48 (diff)
avcodecmap: gst_value_can_intersect() does not do what you would think
Check for uniqueness differently now.
-rw-r--r--ext/libav/gstavcodecmap.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
index 5952484..e13627c 100644
--- a/ext/libav/gstavcodecmap.c
+++ b/ext/libav/gstavcodecmap.c
@@ -159,6 +159,22 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
return TRUE;
}
+static gboolean
+_gst_value_list_contains (const GValue * list, const GValue * value)
+{
+ guint i, n;
+ const GValue *tmp;
+
+ n = gst_value_list_get_size (list);
+ for (i = 0; i < n; i++) {
+ tmp = gst_value_list_get_value (list, i);
+ if (gst_value_compare (value, tmp) == GST_VALUE_EQUAL)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts)
{
@@ -192,8 +208,7 @@ gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts)
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
g_value_set_string (&v, gst_video_format_to_string (format));
/* Only append values we don't have yet */
- if (gst_value_list_get_size (&va) == 0
- || !gst_value_can_intersect (&v, &va))
+ if (!_gst_value_list_contains (&va, &v))
gst_value_list_append_value (&va, &v);
}
fmts++;
@@ -456,8 +471,7 @@ gst_ffmpeg_audio_set_sample_fmts (GstCaps * caps,
if (format != GST_AUDIO_FORMAT_UNKNOWN) {
g_value_set_string (&v, gst_audio_format_to_string (format));
/* Only append values we don't have yet */
- if (gst_value_list_get_size (&va) == 0
- || !gst_value_can_intersect (&v, &va))
+ if (!_gst_value_list_contains (&va, &v))
gst_value_list_append_value (&va, &v);
}
fmts++;