]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/amr.c
set bit rate for asf format, patch by Zuxy Meng, zuxy meng gmail com
[ffmpeg] / libavformat / amr.c
index 9992f09959b950334bbcef485e455b904e34c4ef..635a898fa7b7f64ccba4087dd7d1043be4878bd0 100644 (file)
@@ -91,6 +91,11 @@ static int amr_read_header(AVFormatContext *s,
 
     get_buffer(pb, header, 6);
 
+    st = av_new_stream(s, 0);
+    if (!st)
+    {
+        return AVERROR_NOMEM;
+    }
     if(memcmp(header,AMR_header,6)!=0)
     {
         get_buffer(pb, header+6, 3);
@@ -98,11 +103,6 @@ static int amr_read_header(AVFormatContext *s,
         {
             return -1;
         }
-        st = av_new_stream(s, 0);
-        if (!st)
-        {
-            return AVERROR_NOMEM;
-        }
 
         st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
         st->codec->codec_id = CODEC_ID_AMR_WB;
@@ -110,12 +110,6 @@ static int amr_read_header(AVFormatContext *s,
     }
     else
     {
-        st = av_new_stream(s, 0);
-        if (!st)
-        {
-            return AVERROR_NOMEM;
-        }
-
         st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
         st->codec->codec_id = CODEC_ID_AMR_NB;
         st->codec->sample_rate = 8000;
@@ -127,8 +121,6 @@ static int amr_read_header(AVFormatContext *s,
     return 0;
 }
 
-#define MAX_SIZE 32
-
 static int amr_read_packet(AVFormatContext *s,
                           AVPacket *pkt)
 {
@@ -140,6 +132,7 @@ static int amr_read_packet(AVFormatContext *s,
         return AVERROR_IO;
     }
 
+//FIXME this is wrong, this should rather be in a AVParset
     toc=get_byte(&s->pb);
     mode = (toc >> 3) & 0x0F;
 
@@ -180,11 +173,6 @@ static int amr_read_packet(AVFormatContext *s,
     return 0;
 }
 
-static int amr_read_close(AVFormatContext *s)
-{
-    return 0;
-}
-
 #ifdef CONFIG_AMR_DEMUXER
 AVInputFormat amr_demuxer = {
     "amr",
@@ -193,7 +181,7 @@ AVInputFormat amr_demuxer = {
     amr_probe,
     amr_read_header,
     amr_read_packet,
-    amr_read_close,
+    NULL,
 };
 #endif