diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-22 06:59:59 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-22 06:59:59 +0000 |
commit | 3faa5ea6fdf5033150b3235f20b18cd5815ff260 (patch) | |
tree | 031e2f33866350d46186edb9d59f800f075f2417 /libmpcodecs/ae.c | |
parent | aa33945a1991f66b1cc453319ba314800f71406f (diff) | |
download | mpv-3faa5ea6fdf5033150b3235f20b18cd5815ff260.tar.bz2 mpv-3faa5ea6fdf5033150b3235f20b18cd5815ff260.tar.xz |
audio encoding reworked
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15235 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ae.c')
-rw-r--r-- | libmpcodecs/ae.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c new file mode 100644 index 0000000000..6ed3deee4c --- /dev/null +++ b/libmpcodecs/ae.c @@ -0,0 +1,73 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <inttypes.h> +#include <math.h> +#include "aviheader.h" +#include "ms_hdr.h" +#include "muxer.h" +#include "ae.h" +#include "../config.h" + +#ifdef HAVE_TOOLAME +#include "ae_toolame.h" +#endif + +#ifdef HAVE_MP3LAME +#include "ae_lame.h" +#endif + +#ifdef USE_LIBAVCODEC +#include "ae_lavc.h" +#endif + +audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) +{ + int ris; + if(! params) + return NULL; + + audio_encoder_t *encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); + memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); + encoder->stream = stream; + + switch(stream->codec) + { + case ACODEC_PCM: + ris = mpae_init_pcm(encoder); + break; +#ifdef HAVE_TOOLAME + case ACODEC_TOOLAME: + ris = mpae_init_toolame(encoder); + break; +#endif +#ifdef USE_LIBAVCODEC + case ACODEC_LAVC: + ris = mpae_init_lavc(encoder); + break; +#endif +#ifdef HAVE_MP3LAME + case ACODEC_VBRMP3: + ris = mpae_init_lame(encoder); + break; +#endif + } + + if(! ris) + { + free(encoder); + return NULL; + } + encoder->bind(encoder, stream); + encoder->decode_buffer = (int*)malloc(encoder->decode_buffer_size); + if(! encoder->decode_buffer) + { + free(encoder); + return NULL; + } + + encoder->codec = stream->codec; + return encoder; +} + + |