]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mp3_header_decompress_bsf.c
pnm: Use av_pix_fmt_desc_get instead of accessing the array directly
[ffmpeg] / libavcodec / mp3_header_decompress_bsf.c
index bec38586344431af5b2a1826f4f4b9dc3d6f2637..8e086a119278b25982b6eae1b3dd2b126cff8336 100644 (file)
@@ -1,25 +1,27 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
-#include "mpegaudio.h"
+#include "mpegaudiodecheader.h"
 #include "mpegaudiodata.h"
 
 
@@ -49,10 +51,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
     lsf     = sample_rate < (24000+32000)/2;
     mpeg25  = sample_rate < (12000+16000)/2;
     sample_rate_index= (header>>10)&3;
-    sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
+    sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
 
     for(bitrate_index=2; bitrate_index<30; bitrate_index++){
-        frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
+        frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
         frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
         if(frame_size == buf_size + 4)
             break;
@@ -60,7 +62,7 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
             break;
     }
     if(bitrate_index == 30){
-        av_log(avctx, AV_LOG_ERROR, "couldnt find bitrate_index\n");
+        av_log(avctx, AV_LOG_ERROR, "Could not find bitrate_index.\n");
         return -1;
     }
 
@@ -84,15 +86,12 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
         }
     }
 
-    (*poutbuf)[0]= header>>24;
-    (*poutbuf)[1]= header>>16;
-    (*poutbuf)[2]= header>> 8;
-    (*poutbuf)[3]= header    ;
+    AV_WB32(*poutbuf, header);
 
     return 1;
 }
 
-AVBitStreamFilter mp3_header_decompress_bsf={
+AVBitStreamFilter ff_mp3_header_decompress_bsf={
     "mp3decomp",
     0,
     mp3_header_decompress,