Mercurial > mplayer.hg
annotate libmpcodecs/ae.c @ 17464:6770c410f4f3
support libavcodec's new sc_factor parameter
Original idea from Michael; patch by me.
author | corey |
---|---|
date | Sun, 22 Jan 2006 21:02:14 +0000 |
parents | c23ca41ad996 |
children | d9474f04cce5 |
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 | |
15234 | 77 } |
78 | |
79 if(! ris) | |
80 { | |
81 free(encoder); | |
82 return NULL; | |
83 } | |
84 encoder->bind(encoder, stream); | |
17122 | 85 encoder->decode_buffer = malloc(encoder->decode_buffer_size); |
15234 | 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 |