typo fixes
[mplayer/greg.git] / libmpcodecs / ae.c
blob85ec1dbda205e21b146cc210cddaf6530c7a58ed
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <inttypes.h>
5 #include <unistd.h>
6 #include <sys/types.h>
7 #include <math.h>
8 #include "aviheader.h"
9 #include "ms_hdr.h"
10 #include "muxer.h"
11 #include "ae.h"
12 #include "config.h"
14 #include "ae_pcm.h"
16 #ifdef HAVE_TOOLAME
17 #include "ae_toolame.h"
18 #endif
20 #ifdef HAVE_MP3LAME
21 #include "ae_lame.h"
22 #endif
24 #ifdef USE_LIBAVCODEC
25 #include "ae_lavc.h"
26 #endif
28 #ifdef HAVE_FAAC
29 #include "ae_faac.h"
30 #endif
32 #ifdef HAVE_TWOLAME
33 #include "ae_twolame.h"
34 #endif
36 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params)
38 int ris;
39 audio_encoder_t *encoder;
40 if(! params)
41 return NULL;
43 encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t));
44 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t));
45 encoder->stream = stream;
47 switch(stream->codec)
49 case ACODEC_PCM:
50 ris = mpae_init_pcm(encoder);
51 break;
52 #ifdef HAVE_TOOLAME
53 case ACODEC_TOOLAME:
54 ris = mpae_init_toolame(encoder);
55 break;
56 #endif
57 #ifdef USE_LIBAVCODEC
58 case ACODEC_LAVC:
59 ris = mpae_init_lavc(encoder);
60 break;
61 #endif
62 #ifdef HAVE_MP3LAME
63 case ACODEC_VBRMP3:
64 ris = mpae_init_lame(encoder);
65 break;
66 #endif
67 #ifdef HAVE_FAAC
68 case ACODEC_FAAC:
69 ris = mpae_init_faac(encoder);
70 break;
71 #endif
72 #ifdef HAVE_TWOLAME
73 case ACODEC_TWOLAME:
74 ris = mpae_init_twolame(encoder);
75 break;
76 #endif
77 default:
78 ris = 0;
79 break;
82 if(! ris)
84 free(encoder);
85 return NULL;
87 encoder->bind(encoder, stream);
88 encoder->decode_buffer = malloc(encoder->decode_buffer_size);
89 if(! encoder->decode_buffer)
91 free(encoder);
92 return NULL;
95 encoder->codec = stream->codec;
96 return encoder;