Use proper length specifiers in mp_msg calls, fixes the warnings:
[mplayer/greg.git] / libmpcodecs / ae.c
blobc8b3dd526a5d9d73bf17bf512868369ec111d8f2
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 "config.h"
9 #include "libmpdemux/aviheader.h"
10 #include "libmpdemux/ms_hdr.h"
11 #include "stream/stream.h"
12 #include "libmpdemux/muxer.h"
13 #include "ae.h"
15 #include "ae_pcm.h"
17 #ifdef HAVE_TOOLAME
18 #include "ae_toolame.h"
19 #endif
21 #ifdef HAVE_MP3LAME
22 #include "ae_lame.h"
23 #endif
25 #ifdef USE_LIBAVCODEC
26 #include "ae_lavc.h"
27 #endif
29 #ifdef HAVE_FAAC
30 #include "ae_faac.h"
31 #endif
33 #ifdef HAVE_TWOLAME
34 #include "ae_twolame.h"
35 #endif
37 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params)
39 int ris;
40 audio_encoder_t *encoder;
41 if(! params)
42 return NULL;
44 encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t));
45 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t));
46 encoder->stream = stream;
48 switch(stream->codec)
50 case ACODEC_PCM:
51 ris = mpae_init_pcm(encoder);
52 break;
53 #ifdef HAVE_TOOLAME
54 case ACODEC_TOOLAME:
55 ris = mpae_init_toolame(encoder);
56 break;
57 #endif
58 #ifdef USE_LIBAVCODEC
59 case ACODEC_LAVC:
60 ris = mpae_init_lavc(encoder);
61 break;
62 #endif
63 #ifdef HAVE_MP3LAME
64 case ACODEC_VBRMP3:
65 ris = mpae_init_lame(encoder);
66 break;
67 #endif
68 #ifdef HAVE_FAAC
69 case ACODEC_FAAC:
70 ris = mpae_init_faac(encoder);
71 break;
72 #endif
73 #ifdef HAVE_TWOLAME
74 case ACODEC_TWOLAME:
75 ris = mpae_init_twolame(encoder);
76 break;
77 #endif
78 default:
79 ris = 0;
80 break;
83 if(! ris)
85 free(encoder);
86 return NULL;
88 encoder->bind(encoder, stream);
89 encoder->decode_buffer = malloc(encoder->decode_buffer_size);
90 if(! encoder->decode_buffer)
92 free(encoder);
93 return NULL;
96 encoder->codec = stream->codec;
97 return encoder;