summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Zanelli <aurelien.zanelli@darkosphere.fr>2014-10-02 00:14:03 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-10-14 09:31:26 +0200
commitb8af6d73895a5641bef50bcd9d14eff25290b14e (patch)
tree2d4676cd4e9e67ba5928c0f859fba17222243159
parent802b59526bd76b027483be9d0926d342e5bb76bf (diff)
vorbisdec: don't reorder streams with channels count greater than eight
vorbis_reorder_map is defined for eight channels max. If we have more than eight channels, it's the application which shall define the order. Since we set audio position to none, we just interleave all the channels without any particular reordering. https://bugzilla.gnome.org/show_bug.cgi?id=737742
-rw-r--r--ext/vorbis/gstvorbisdeclib.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/ext/vorbis/gstvorbisdeclib.c b/ext/vorbis/gstvorbisdeclib.c
index cf18958b6..75f6ea798 100644
--- a/ext/vorbis/gstvorbisdeclib.c
+++ b/ext/vorbis/gstvorbisdeclib.c
@@ -81,6 +81,28 @@ copy_samples (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
#endif
}
+static void
+copy_samples_no_reorder (vorbis_sample_t * out, vorbis_sample_t ** in,
+ guint samples, gint channels)
+{
+#ifdef GST_VORBIS_DEC_SEQUENTIAL
+ gint i;
+
+ for (i = 0; i < channels; i++) {
+ memcpy (out, in[i], samples * sizeof (float));
+ out += samples;
+ }
+#else
+ gint i, j;
+
+ for (j = 0; j < samples; j++) {
+ for (i = 0; i < channels; i++) {
+ *out++ = in[i][j];
+ }
+ }
+#endif
+}
+
CopySampleFunc
gst_vorbis_get_copy_sample_func (gint channels)
{
@@ -93,9 +115,17 @@ gst_vorbis_get_copy_sample_func (gint channels)
case 2:
f = copy_samples_s;
break;
- default:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
f = copy_samples;
break;
+ default:
+ f = copy_samples_no_reorder;
+ break;
}
return f;