Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 16795:e8148dd5691c
xscreensaver --> XScreenSaver
author | diego |
---|---|
date | Tue, 18 Oct 2005 19:58:33 +0000 |
parents | d9b74d27974d |
children | 6ff3379a0862 |
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" | |
12 #include "../config.h" | |
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 | |
15234 | 77 } |
78 | |
79 if(! ris) | |
80 { | |
81 free(encoder); | |
82 return NULL; | |
83 } | |
84 encoder->bind(encoder, stream); | |
85 encoder->decode_buffer = (int*)malloc(encoder->decode_buffer_size); | |
86 if(! encoder->decode_buffer) | |
87 { | |
88 free(encoder); | |
89 return NULL; | |
90 } | |
91 | |
92 encoder->codec = stream->codec; | |
93 return encoder; | |
94 } | |
95 | |
96 |