Commit 6a320892 authored by aurel's avatar aurel

use common aac sample rate tables

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12671 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent a968da4e
...@@ -306,8 +306,9 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcm.o ...@@ -306,8 +306,9 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcm.o
# libavformat dependencies # libavformat dependencies
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
OBJS-$(CONFIG_OGG_MUXER) += xiph.o OBJS-$(CONFIG_OGG_MUXER) += xiph.o
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "riff.h" #include "riff.h"
#include "intfloat_readwrite.h" #include "intfloat_readwrite.h"
#include "matroska.h" #include "matroska.h"
#include "libavcodec/mpeg4audio.h"
typedef struct Track { typedef struct Track {
MatroskaTrackType type; MatroskaTrackType type;
...@@ -1997,14 +1998,10 @@ matroska_aac_profile (char *codec_id) ...@@ -1997,14 +1998,10 @@ matroska_aac_profile (char *codec_id)
static int static int
matroska_aac_sri (int samplerate) matroska_aac_sri (int samplerate)
{ {
static const int aac_sample_rates[] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000,
};
int sri; int sri;
for (sri=0; sri<ARRAY_SIZE(aac_sample_rates); sri++) for (sri=0; sri<ARRAY_SIZE(ff_mpeg4audio_sample_rates); sri++)
if (aac_sample_rates[sri] == samplerate) if (ff_mpeg4audio_sample_rates[sri] == samplerate)
break; break;
return sri; return sri;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "xiph.h" #include "xiph.h"
#include "matroska.h" #include "matroska.h"
#include "avc.h" #include "avc.h"
#include "libavcodec/mpeg4audio.h"
typedef struct ebml_master { typedef struct ebml_master {
offset_t pos; ///< absolute offset in the file where the master's elements start offset_t pos; ///< absolute offset in the file where the master's elements start
...@@ -438,10 +439,6 @@ static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecCont ...@@ -438,10 +439,6 @@ static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecCont
static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate) static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate)
{ {
static const int aac_sample_rates[] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000,
};
int sri; int sri;
if (codec->extradata_size < 2) { if (codec->extradata_size < 2) {
...@@ -454,7 +451,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int ...@@ -454,7 +451,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int
av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n"); av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n");
return; return;
} }
*sample_rate = aac_sample_rates[sri]; *sample_rate = ff_mpeg4audio_sample_rates[sri];
// if sbr, get output sample rate as well // if sbr, get output sample rate as well
if (codec->extradata_size == 5) { if (codec->extradata_size == 5) {
...@@ -463,7 +460,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int ...@@ -463,7 +460,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int
av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n"); av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n");
return; return;
} }
*output_sample_rate = aac_sample_rates[sri]; *output_sample_rate = ff_mpeg4audio_sample_rates[sri];
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment