[MPlayer-dev-eng] [PATCH]Support Atrac3plus

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Dec 30 13:29:31 CET 2013


Hi!

The atrac3plus decoder needs the channel layout from the demuxer, attached 
patch implements this.

Please comment, Carl Eugen
-------------- next part --------------
Index: etc/codecs.conf
===================================================================
--- etc/codecs.conf	(revision 36558)
+++ etc/codecs.conf	(working copy)
@@ -4655,6 +4655,13 @@
   driver ffmpeg
   dll "atrac3"
 
+audiocodec ffatrc3p
+  info  "FFmpeg Atrac 3plus audio"
+  status working
+  format 0xE923AABF
+  driver ffmpeg
+  dll "atrac3plus"
+
 audiocodec ffsipr
   info "FFmpeg Sipr/Acelp.net audio"
   status working
Index: libmpcodecs/ad_ffmpeg.c
===================================================================
--- libmpcodecs/ad_ffmpeg.c	(revision 36558)
+++ libmpcodecs/ad_ffmpeg.c	(working copy)
@@ -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
Index: libmpdemux/demux_audio.c
===================================================================
--- libmpdemux/demux_audio.c	(revision 36558)
+++ libmpdemux/demux_audio.c	(working copy)
@@ -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);
     }
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 36558)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -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;
Index: libmpdemux/mp_taglists.c
===================================================================
--- libmpdemux/mp_taglists.c	(revision 36558)
+++ libmpdemux/mp_taglists.c	(working copy)
@@ -98,6 +98,9 @@
     { AV_CODEC_ID_ADPCM_G722,        0x28f },
     { AV_CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D') },
     { AV_CODEC_ID_ADPCM_IMA_AMV,     MKTAG('A', 'M', 'V', 'A') },
+#if LIBAVUTIL_VERSION_MICRO >= 100
+    { AV_CODEC_ID_ATRAC3P,           0xE923AABF},
+#endif
     { AV_CODEC_ID_DTS,               0x2001 },
     { AV_CODEC_ID_DVVIDEO,           MKTAG('d', 'v', 's', 'd') },
     { AV_CODEC_ID_EAC3,              MKTAG('E', 'A', 'C', '3') },
Index: libmpdemux/stheader.h
===================================================================
--- libmpdemux/stheader.h	(revision 36558)
+++ libmpdemux/stheader.h	(working copy)
@@ -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:


More information about the MPlayer-dev-eng mailing list