Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 21353:a965ca17debc
reordering of #include to avoid clash with math.h and quicktime/*.h, patch by Crhis Roccati<roccati@pobox.com>
author | nplourde |
---|---|
date | Tue, 28 Nov 2006 23:13:08 +0000 |
parents | d9474f04cce5 |
children | ca9da45d13e9 |
rev | line source |
---|---|
15234 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include <stdlib.h> | |
4 #include <inttypes.h> | |
15238 | 5 #include <unistd.h> |
15240 | 6 #include <sys/types.h> |
15234 | 7 #include <math.h> |
8 #include "aviheader.h" | |
9 #include "ms_hdr.h" | |
10 #include "muxer.h" | |
11 #include "ae.h" | |
17012 | 12 #include "config.h" |
15234 | 13 |
16616
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
14 #include "ae_pcm.h" |
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
15 |
15234 | 16 #ifdef HAVE_TOOLAME |
17 #include "ae_toolame.h" | |
18 #endif | |
19 | |
20 #ifdef HAVE_MP3LAME | |
21 #include "ae_lame.h" | |
22 #endif | |
23 | |
24 #ifdef USE_LIBAVCODEC | |
25 #include "ae_lavc.h" | |
26 #endif | |
27 | |
15259 | 28 #ifdef HAVE_FAAC |
29 #include "ae_faac.h" | |
30 #endif | |
31 | |
15359 | 32 #ifdef HAVE_TWOLAME |
33 #include "ae_twolame.h" | |
34 #endif | |
35 | |
15234 | 36 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) |
37 { | |
38 int ris; | |
15242 | 39 audio_encoder_t *encoder; |
15234 | 40 if(! params) |
41 return NULL; | |
42 | |
15242 | 43 encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); |
15234 | 44 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); |
45 encoder->stream = stream; | |
46 | |
47 switch(stream->codec) | |
48 { | |
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 | |
15259 | 67 #ifdef HAVE_FAAC |
68 case ACODEC_FAAC: | |
69 ris = mpae_init_faac(encoder); | |
70 break; | |
71 #endif | |
15359 | 72 #ifdef HAVE_TWOLAME |
73 case ACODEC_TWOLAME: | |
74 ris = mpae_init_twolame(encoder); | |
75 break; | |
76 #endif | |
17781
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
77 default: |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
78 ris = 0; |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
79 break; |
15234 | 80 } |
81 | |
82 if(! ris) | |
83 { | |
84 free(encoder); | |
85 return NULL; | |
86 } | |
87 encoder->bind(encoder, stream); | |
17122 | 88 encoder->decode_buffer = malloc(encoder->decode_buffer_size); |
15234 | 89 if(! encoder->decode_buffer) |
90 { | |
91 free(encoder); | |
92 return NULL; | |
93 } | |
94 | |
95 encoder->codec = stream->codec; | |
96 return encoder; | |
97 } | |
98 | |
99 |