summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-06-06 13:59:57 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-11-12 14:23:30 +0000
commit86562f56e208d0d7360a9b5f7bc5cf13836f06a3 (patch)
tree9c1d1c868fb2f0a4a77b69000e23fb8ba7a823f0 /gst
parent3afe2b7bd1f6fa4bdae0e4589bdb40635a8b5328 (diff)
dvdlpcmdec: set channel positions using the appropriate API
https://bugzilla.gnome.org/show_bug.cgi?id=731038
Diffstat (limited to 'gst')
-rw-r--r--gst/dvdlpcmdec/gstdvdlpcmdec.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gst/dvdlpcmdec/gstdvdlpcmdec.c b/gst/dvdlpcmdec/gstdvdlpcmdec.c
index 03024b75..b0fa8500 100644
--- a/gst/dvdlpcmdec/gstdvdlpcmdec.c
+++ b/gst/dvdlpcmdec/gstdvdlpcmdec.c
@@ -246,6 +246,7 @@ gst_dvdlpcmdec_setcaps (GstPad * pad, GstCaps * caps)
GstAudioFormat format;
gint rate, channels, width;
const GstAudioChannelPosition *position;
+ GstAudioChannelPosition sorted_position[8];
g_return_val_if_fail (caps != NULL, FALSE);
g_return_val_if_fail (pad != NULL, FALSE);
@@ -288,17 +289,18 @@ gst_dvdlpcmdec_setcaps (GstPad * pad, GstCaps * caps)
break;
}
- gst_audio_info_set_format (&dvdlpcmdec->info, format, rate, channels, NULL);
if (channels < 9
&& channel_positions[channels - 1][0] !=
GST_AUDIO_CHANNEL_POSITION_INVALID) {
- dvdlpcmdec->info.flags &= ~GST_AUDIO_FLAG_UNPOSITIONED;
position = channel_positions[channels - 1];
dvdlpcmdec->lpcm_layout = position;
- memcpy (dvdlpcmdec->info.position, position,
- sizeof (GstAudioChannelPosition) * channels);
- gst_audio_channel_positions_to_valid_order (dvdlpcmdec->info.position,
- channels);
+ memcpy (sorted_position, channel_positions[channels - 1],
+ sizeof (sorted_position));
+ gst_audio_channel_positions_to_valid_order (sorted_position, channels);
+ gst_audio_info_set_format (&dvdlpcmdec->info, format, rate, channels,
+ sorted_position);
+ } else {
+ gst_audio_info_set_format (&dvdlpcmdec->info, format, rate, channels, NULL);
}
dvdlpcmdec->width = width;
@@ -411,18 +413,20 @@ parse_header (GstDvdLpcmDec * dec, guint32 header)
/* And, of course, the number of channels (up to 8) */
channels = ((header >> 8) & 0x7) + 1;
- gst_audio_info_set_format (&dec->info, format, rate, channels, NULL);
if (channels < 9
&& channel_positions[channels - 1][0] !=
GST_AUDIO_CHANNEL_POSITION_INVALID) {
const GstAudioChannelPosition *position;
+ GstAudioChannelPosition sorted_position[8];
- dec->info.flags &= ~GST_AUDIO_FLAG_UNPOSITIONED;
position = channel_positions[channels - 1];
dec->lpcm_layout = position;
- memcpy (dec->info.position, position,
- sizeof (GstAudioChannelPosition) * channels);
- gst_audio_channel_positions_to_valid_order (dec->info.position, channels);
+ memcpy (sorted_position, position, sizeof (sorted_position));
+ gst_audio_channel_positions_to_valid_order (sorted_position, channels);
+ gst_audio_info_set_format (&dec->info, format, rate, channels,
+ sorted_position);
+ } else {
+ gst_audio_info_set_format (&dec->info, format, rate, channels, NULL);
}
}