changeset 36469:4eb54147c488

Set audio channel_layout from container when using FFmpeg decoder. This will be needed for the Atrac 3 Plus decoder.
author cehoyos
date Wed, 01 Jan 2014 22:17:01 +0000
parents 8f0fd63eca7f
children 0ce8d148cf64
files libmpcodecs/ad_ffmpeg.c libmpdemux/demux_audio.c libmpdemux/demux_lavf.c libmpdemux/stheader.h
diffstat 4 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Wed Jan 01 22:13:47 2014 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Wed Jan 01 22:17:01 2014 +0000
@@ -126,6 +126,7 @@
 	lavc_context->block_align = sh_audio->wf->nBlockAlign;
 	lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample;
     }
+    lavc_context->channel_layout = sh_audio->channel_layout;
     lavc_context->request_channels = audio_output_channels;
     lavc_context->codec_tag = sh_audio->format; //FOURCC
     lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
--- a/libmpdemux/demux_audio.c	Wed Jan 01 22:13:47 2014 +0000
+++ b/libmpdemux/demux_audio.c	Wed Jan 01 22:17:01 2014 +0000
@@ -533,6 +533,8 @@
       }
       stream_read(s,(char*)(w + 1),w->cbSize);
       l -= w->cbSize;
+      if (w->cbSize >= 22)
+          sh_audio->channel_layout = av_le2ne16(((WAVEFORMATEXTENSIBLE *)w)->dwChannelMask);
       if (w->wFormatTag == 0xfffe && w->cbSize >= 22)
           sh_audio->format = av_le2ne16(((WAVEFORMATEXTENSIBLE *)w)->SubFormat);
     }
--- a/libmpdemux/demux_lavf.c	Wed Jan 01 22:13:47 2014 +0000
+++ b/libmpdemux/demux_lavf.c	Wed Jan 01 22:17:01 2014 +0000
@@ -295,6 +295,7 @@
             codec->codec_tag = mp_codec_id2tag(codec->codec_id, codec->codec_tag, 1);
             wf->wFormatTag= codec->codec_tag;
             wf->nChannels= codec->channels;
+            sh_audio->channel_layout = codec->channel_layout;
             wf->nSamplesPerSec= codec->sample_rate;
             wf->nAvgBytesPerSec= codec->bit_rate/8;
             wf->nBlockAlign= codec->block_align ? codec->block_align : 1;
--- a/libmpdemux/stheader.h	Wed Jan 01 22:13:47 2014 +0000
+++ b/libmpdemux/stheader.h	Wed Jan 01 22:17:01 2014 +0000
@@ -55,6 +55,7 @@
   int samplerate;
   int samplesize;
   int channels;
+  int channel_layout;
   int o_bps; // == samplerate*samplesize*channels   (uncompr. bytes/sec)
   int i_bps; // == bitrate  (compressed bytes/sec)
   // in buffers: