[FFmpeg-devel] [RFC]E-AC3 in wav

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jan 10 13:21:25 CET 2014


Hi!

Attached poc allows to encode wav files with eac3 that can be played with WMP.
How should this be implemented? Particularly the first hunk...

I assume the second hunk is ok and the third can be implemented by moving the 
GUID list from riffdec.c to riff.c?

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 52640d1..b19acbc 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -413,6 +413,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
     { AV_CODEC_ID_AAC,             0x1600 },
     { AV_CODEC_ID_AAC_LATM,        0x1602 },
     { AV_CODEC_ID_AC3,             0x2000 },
+    { AV_CODEC_ID_EAC3,             0x2000 },
     { AV_CODEC_ID_DTS,             0x2001 },
     { AV_CODEC_ID_SONIC,           0x2048 },
     { AV_CODEC_ID_SONIC_LS,        0x2048 },
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 7b4b7dd..08678e4 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -70,7 +70,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
     if (!frame_size)
         frame_size = enc->frame_size;
 
-    waveformatextensible = (enc->channels > 2 && enc->channel_layout) ||
+    waveformatextensible = (1||enc->channels > 2 && enc->channel_layout) ||
                            enc->sample_rate > 48000 ||
                            av_get_bits_per_sample(enc->codec_id) > 16;
 
@@ -183,10 +183,20 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
         /* dwChannelMask */
         avio_wl32(pb, enc->channel_layout);
         /* GUID + next 3 */
+/*
         avio_wl32(pb, enc->codec_tag);
         avio_wl32(pb, 0x00100000);
         avio_wl32(pb, 0xAA000080);
         avio_wl32(pb, 0x719B3800);
+*/
+/*
+The GUID can be found in riffdec.c
+    { AV_CODEC_ID_EAC3,     { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D, 0xFB, 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } },
+*/
+        avio_wl32(pb, 0xa7fb87af);
+        avio_wl32(pb, 0x42fb2d02);
+        avio_wl32(pb, 0xcd05d4a4);
+        avio_wl32(pb, 0xdd3b8493);
     } else {
         avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */
     }


More information about the ffmpeg-devel mailing list