[FFmpeg-devel] [PATCH]Audio support for mplayer -demuxer lavf and vivo

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Nov 29 10:16:25 CET 2012


HI!

Attached patch allows audio playback of vivo files with mplayer -demuxer lavf

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b6a4b0e..73f7f7b 100644
--- ffmpeg/libavcodec/avcodec.h
+++ ffmpeg/libavcodec/avcodec.h
@@ -284,6 +284,7 @@ enum AVCodecID {
     AV_CODEC_ID_PAF_VIDEO  = MKBETAG('P','A','F','V'),
     AV_CODEC_ID_AVRN       = MKBETAG('A','V','R','n'),
     AV_CODEC_ID_CPIA       = MKBETAG('C','P','I','A'),
+    AV_CODEC_ID_VIVO       = MKBETAG('V','I','V','O'),
     AV_CODEC_ID_XFACE      = MKBETAG('X','F','A','C'),
 
     /* various PCM "codecs" */
@@ -440,6 +441,7 @@ enum AVCodecID {
     AV_CODEC_ID_PAF_AUDIO   = MKBETAG('P','A','F','A'),
     AV_CODEC_ID_OPUS        = MKBETAG('O','P','U','S'),
     AV_CODEC_ID_TAK         = MKBETAG('t','B','a','K'),
+    AV_CODEC_ID_VIVOAUDIO   = MKBETAG('V','I','V',0xA),
 
     /* subtitle codecs */
     AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
diff --git a/libavformat/vivo.c b/libavformat/vivo.c
index e3487f6..5878275 100644
--- ffmpeg/libavformat/vivo.c
+++ ffmpeg/libavformat/vivo.c
@@ -229,6 +229,14 @@ static int vivo_read_header(AVFormatContext *s)
         vst->codec->codec_id = CODEC_ID_H263;
         ast->codec->codec_id = CODEC_ID_G723_1;
         ast->codec->bits_per_coded_sample = 8;
+        ast->codec->block_align = 24;
+        ast->codec->bit_rate = 6400;
+    } else {
+        vst->codec->codec_id = AV_CODEC_ID_VIVO;
+        ast->codec->codec_id = AV_CODEC_ID_VIVOAUDIO;
+        ast->codec->bits_per_coded_sample = 16;
+        ast->codec->block_align = 40;
+        ast->codec->bit_rate = 16000;
     }
 
     ast->start_time        = 0;
Index: libmpdemux/mp_taglists.c
===================================================================
--- libmpdemux/mp_taglists.c	(revision 35505)
+++ libmpdemux/mp_taglists.c	(working copy)
@@ -74,6 +74,7 @@
     { CODEC_ID_TWINVQ,            MKTAG('T', 'W', 'I', '2')},
 #if LIBAVUTIL_VERSION_MICRO >= 100
     { CODEC_ID_VIMA,              MKTAG('V', 'I', 'M', 'A')},
+    { AV_CODEC_ID_VIVOAUDIO,      0x112},
 #endif
     { CODEC_ID_VMDAUDIO,          MKTAG('V', 'M', 'D', 'A')},
     { CODEC_ID_WAVPACK,           MKTAG('W', 'V', 'P', 'K')},
@@ -171,6 +172,9 @@
     { CODEC_ID_WS_VQA,            MKTAG('V', 'Q', 'A', 'V')},
     { CODEC_ID_XAN_WC3,           MKTAG('W', 'C', '3', 'V')},
     { CODEC_ID_YOP,               MKTAG('Y', 'O', 'P', '1')},
+#if LIBAVUTIL_VERSION_MICRO >= 100
+    { AV_CODEC_ID_VIVO,           MKTAG('v','i','v','2')},
+#endif
     { 0, 0 },
 };
 
Index: etc/codecs.conf
===================================================================
--- etc/codecs.conf	(revision 35505)
+++ etc/codecs.conf	(working copy)
@@ -5597,11 +5597,21 @@
   driver ffmpeg
   dll "libspeex"
 
+audiocodec ffg7231
+  info "G.723.1 Audio"
+  status working
+  fourcc 7231 ; internal MPlayer FourCC
+  format 0x42
+  format 0xA100
+  driver ffmpeg
+  dll "g723_1"
+
 audiocodec vivoaudio
   info "Vivo G.723/Siren Audio Codec"
   status working
   format 0x111       ; vivo g.723
   format 0x112       ; siren
+  format 0x31333237 0x111 ; internal MPlayer FourCC 7231
   driver acm
   dll "vivog723.acm"
 
@@ -5621,15 +5631,6 @@
   driver ffmpeg
   dll "g722"
 
-audiocodec ffg7231
-  info "G.723.1 Audio"
-  status working
-  fourcc 7231 ; internal MPlayer FourCC
-  format 0x42
-  format 0xA100
-  driver ffmpeg
-  dll "g723_1"
-
 audiocodec g7231ms
   info "G.723.1 MS"
   status working


More information about the ffmpeg-devel mailing list