[FFmpeg-cvslog] rawdec: g722 is always 1 channel/16kHz

Anton Khirnov git at videolan.org
Sat Sep 17 22:45:10 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Sep 14 08:55:27 2011 +0200| [d906f49aa8f36fc173cfa96580cbe29e88be5049] | committer: Anton Khirnov

rawdec: g722 is always 1 channel/16kHz

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d906f49aa8f36fc173cfa96580cbe29e88be5049
---

 libavformat/rawdec.c |    9 +++++----
 tests/fate2.mak      |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 76ab09c..f0d487b 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -51,9 +51,12 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
             st->codec->channels = 1;
 
-            if (s1->sample_rate)
+            if (id == CODEC_ID_ADPCM_G722)
+                st->codec->sample_rate = 16000;
+
+            if (s1 && s1->sample_rate)
                 st->codec->sample_rate = s1->sample_rate;
-            if (s1->channels)
+            if (s1 && s1->channels)
                 st->codec->channels    = s1->channels;
 
             st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
@@ -199,13 +202,11 @@ const AVClass ff_rawvideo_demuxer_class = {
 AVInputFormat ff_g722_demuxer = {
     .name           = "g722",
     .long_name      = NULL_IF_CONFIG_SMALL("raw G.722"),
-    .priv_data_size = sizeof(RawAudioDemuxerContext),
     .read_header    = ff_raw_read_header,
     .read_packet    = ff_raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
     .extensions = "g722,722",
     .value = CODEC_ID_ADPCM_G722,
-    .priv_class = &ff_rawaudio_demuxer_class,
 };
 #endif
 
diff --git a/tests/fate2.mak b/tests/fate2.mak
index 6a01412..0bb6654 100644
--- a/tests/fate2.mak
+++ b/tests/fate2.mak
@@ -131,7 +131,7 @@ FATE_TESTS += fate-gsm-ms
 fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav
 
 FATE_TESTS += fate-g722dec-1
-fate-g722dec-1: CMD = framecrc -ar 16000 -i $(SAMPLES)/g722/conf-adminmenu-162.g722
+fate-g722dec-1: CMD = framecrc -i $(SAMPLES)/g722/conf-adminmenu-162.g722
 
 FATE_TESTS += fate-msmpeg4v1
 fate-msmpeg4v1: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/msmpeg4v1/mpg4.avi -an



More information about the ffmpeg-cvslog mailing list