Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 21828:a165910dcaf7
Simplify demux_ogg to use the sub_clear_text and sub_add_text functions.
author | reimar |
---|---|
date | Sat, 06 Jan 2007 19:19:15 +0000 |
parents | ca9da45d13e9 |
children | 3c2b4a866c6a |
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" | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
17781
diff
changeset
|
10 #include "stream.h" |
15234 | 11 #include "muxer.h" |
12 #include "ae.h" | |
17012 | 13 #include "config.h" |
15234 | 14 |
16616
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
15 #include "ae_pcm.h" |
d9b74d27974d
forgotten include; patch by Jan Knutar (jknutar ad nic puntum fi)
nicodvb
parents:
15359
diff
changeset
|
16 |
15234 | 17 #ifdef HAVE_TOOLAME |
18 #include "ae_toolame.h" | |
19 #endif | |
20 | |
21 #ifdef HAVE_MP3LAME | |
22 #include "ae_lame.h" | |
23 #endif | |
24 | |
25 #ifdef USE_LIBAVCODEC | |
26 #include "ae_lavc.h" | |
27 #endif | |
28 | |
15259 | 29 #ifdef HAVE_FAAC |
30 #include "ae_faac.h" | |
31 #endif | |
32 | |
15359 | 33 #ifdef HAVE_TWOLAME |
34 #include "ae_twolame.h" | |
35 #endif | |
36 | |
15234 | 37 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) |
38 { | |
39 int ris; | |
15242 | 40 audio_encoder_t *encoder; |
15234 | 41 if(! params) |
42 return NULL; | |
43 | |
15242 | 44 encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); |
15234 | 45 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); |
46 encoder->stream = stream; | |
47 | |
48 switch(stream->codec) | |
49 { | |
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 | |
15259 | 68 #ifdef HAVE_FAAC |
69 case ACODEC_FAAC: | |
70 ris = mpae_init_faac(encoder); | |
71 break; | |
72 #endif | |
15359 | 73 #ifdef HAVE_TWOLAME |
74 case ACODEC_TWOLAME: | |
75 ris = mpae_init_twolame(encoder); | |
76 break; | |
77 #endif | |
17781
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
78 default: |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
79 ris = 0; |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
80 break; |
15234 | 81 } |
82 | |
83 if(! ris) | |
84 { | |
85 free(encoder); | |
86 return NULL; | |
87 } | |
88 encoder->bind(encoder, stream); | |
17122 | 89 encoder->decode_buffer = malloc(encoder->decode_buffer_size); |
15234 | 90 if(! encoder->decode_buffer) |
91 { | |
92 free(encoder); | |
93 return NULL; | |
94 } | |
95 | |
96 encoder->codec = stream->codec; | |
97 return encoder; | |
98 } | |
99 | |
100 |