Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 30154:772664b337f6
Add a few definitions used by FFmpeg to config.h:
CONFIG_IPV6, HAVE_SETMODE, HAVE_SYS_SELECT_H
author | diego |
---|---|
date | Mon, 04 Jan 2010 11:13:49 +0000 |
parents | 0f1b5b68af32 |
children | bbb6ebec87a0 |
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> |
23640 | 8 #include "config.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
9 #include "libmpdemux/aviheader.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
10 #include "libmpdemux/ms_hdr.h" |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
11 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
12 #include "libmpdemux/muxer.h" |
15234 | 13 #include "ae.h" |
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 |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
17 #ifdef CONFIG_TOOLAME |
15234 | 18 #include "ae_toolame.h" |
19 #endif | |
20 | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
21 #ifdef CONFIG_MP3LAME |
15234 | 22 #include "ae_lame.h" |
23 #endif | |
24 | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
23640
diff
changeset
|
25 #ifdef CONFIG_LIBAVCODEC |
15234 | 26 #include "ae_lavc.h" |
27 #endif | |
28 | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
29 #ifdef CONFIG_FAAC |
15259 | 30 #include "ae_faac.h" |
31 #endif | |
32 | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
33 #ifdef CONFIG_TWOLAME |
15359 | 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; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
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; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
47 |
15234 | 48 switch(stream->codec) |
49 { | |
50 case ACODEC_PCM: | |
51 ris = mpae_init_pcm(encoder); | |
52 break; | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
53 #ifdef CONFIG_TOOLAME |
15234 | 54 case ACODEC_TOOLAME: |
55 ris = mpae_init_toolame(encoder); | |
56 break; | |
57 #endif | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
23640
diff
changeset
|
58 #ifdef CONFIG_LIBAVCODEC |
15234 | 59 case ACODEC_LAVC: |
60 ris = mpae_init_lavc(encoder); | |
61 break; | |
62 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
63 #ifdef CONFIG_MP3LAME |
15234 | 64 case ACODEC_VBRMP3: |
65 ris = mpae_init_lame(encoder); | |
66 break; | |
67 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
68 #ifdef CONFIG_FAAC |
15259 | 69 case ACODEC_FAAC: |
70 ris = mpae_init_faac(encoder); | |
71 break; | |
72 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
73 #ifdef CONFIG_TWOLAME |
15359 | 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 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
82 |
15234 | 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 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
95 |
15234 | 96 encoder->codec = stream->codec; |
97 return encoder; | |
98 } | |
99 | |
100 |