Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 34624:5d6367c875c2
Don't unnecessarily destroy audio_driver_list.
Only change the list when there is a device or driver
in the GUI configuration file.
author | ib |
---|---|
date | Mon, 13 Feb 2012 14:10:43 +0000 |
parents | 4614728cab25 |
children |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
15234 | 19 #include <stdio.h> |
20 #include <string.h> | |
21 #include <stdlib.h> | |
22 #include <inttypes.h> | |
15238 | 23 #include <unistd.h> |
15240 | 24 #include <sys/types.h> |
15234 | 25 #include <math.h> |
23640 | 26 #include "config.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
27 #include "libmpdemux/aviheader.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
28 #include "libmpdemux/ms_hdr.h" |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
29 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
30 #include "libmpdemux/muxer.h" |
32120
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
31 #include "ae_faac.h" |
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
32 #include "ae_lame.h" |
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
33 #include "ae_lavc.h" |
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
34 #include "ae_pcm.h" |
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
35 #include "ae_toolame.h" |
20bc9bdd7aa1
Skip #ifdefs around harmless ae_*.h header #includes.
diego
parents:
30702
diff
changeset
|
36 #include "ae_twolame.h" |
15234 | 37 #include "ae.h" |
38 | |
15359 | 39 |
15234 | 40 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params) |
41 { | |
42 int ris; | |
15242 | 43 audio_encoder_t *encoder; |
15234 | 44 if(! params) |
45 return NULL; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
46 |
30702 | 47 encoder = calloc(1, sizeof(audio_encoder_t)); |
15234 | 48 memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); |
49 encoder->stream = stream; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
50 |
15234 | 51 switch(stream->codec) |
52 { | |
53 case ACODEC_PCM: | |
54 ris = mpae_init_pcm(encoder); | |
55 break; | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
56 #ifdef CONFIG_TOOLAME |
15234 | 57 case ACODEC_TOOLAME: |
58 ris = mpae_init_toolame(encoder); | |
59 break; | |
60 #endif | |
32142
4614728cab25
build system: Merge all FFmpeg library checks into a single FFmpeg check.
diego
parents:
32120
diff
changeset
|
61 #ifdef CONFIG_FFMPEG |
15234 | 62 case ACODEC_LAVC: |
63 ris = mpae_init_lavc(encoder); | |
64 break; | |
65 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
66 #ifdef CONFIG_MP3LAME |
15234 | 67 case ACODEC_VBRMP3: |
68 ris = mpae_init_lame(encoder); | |
69 break; | |
70 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
71 #ifdef CONFIG_FAAC |
15259 | 72 case ACODEC_FAAC: |
73 ris = mpae_init_faac(encoder); | |
74 break; | |
75 #endif | |
27363
40057010b1fa
Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents:
27341
diff
changeset
|
76 #ifdef CONFIG_TWOLAME |
15359 | 77 case ACODEC_TWOLAME: |
78 ris = mpae_init_twolame(encoder); | |
79 break; | |
80 #endif | |
17781
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
81 default: |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
82 ris = 0; |
d9474f04cce5
add default case to encoder switch-case (maybe an error message would be good as well).
reimar
parents:
17122
diff
changeset
|
83 break; |
15234 | 84 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
85 |
15234 | 86 if(! ris) |
87 { | |
88 free(encoder); | |
89 return NULL; | |
90 } | |
91 encoder->bind(encoder, stream); | |
17122 | 92 encoder->decode_buffer = malloc(encoder->decode_buffer_size); |
15234 | 93 if(! encoder->decode_buffer) |
94 { | |
95 free(encoder); | |
96 return NULL; | |
97 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27363
diff
changeset
|
98 |
15234 | 99 encoder->codec = stream->codec; |
100 return encoder; | |
101 } |