Mercurial > mplayer.hg
comparison libmpcodecs/ae_lavc.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | f2b3f28982b8 |
children | 99eda963d27a |
comparison
equal
deleted
inserted
replaced
29262:7d545a6b8aff | 29263:0f1b5b68af32 |
---|---|
40 mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8); | 40 mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8); |
41 mux_a->avg_rate= lavc_actx->bit_rate; | 41 mux_a->avg_rate= lavc_actx->bit_rate; |
42 mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec; | 42 mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec; |
43 if(lavc_actx->block_align) | 43 if(lavc_actx->block_align) |
44 mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align; | 44 mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align; |
45 else | 45 else |
46 { | 46 { |
47 mux_a->h.dwScale = (mux_a->wf->nAvgBytesPerSec * lavc_actx->frame_size)/ mux_a->wf->nSamplesPerSec; /* for cbr */ | 47 mux_a->h.dwScale = (mux_a->wf->nAvgBytesPerSec * lavc_actx->frame_size)/ mux_a->wf->nSamplesPerSec; /* for cbr */ |
48 | 48 |
49 if ((mux_a->wf->nAvgBytesPerSec * | 49 if ((mux_a->wf->nAvgBytesPerSec * |
50 lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) | 50 lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) |
51 { | 51 { |
52 mux_a->h.dwScale = lavc_actx->frame_size; | 52 mux_a->h.dwScale = lavc_actx->frame_size; |
53 mux_a->h.dwRate = lavc_actx->sample_rate; | 53 mux_a->h.dwRate = lavc_actx->sample_rate; |
54 mux_a->h.dwSampleSize = 0; // Blocksize not constant | 54 mux_a->h.dwSampleSize = 0; // Blocksize not constant |
55 } | 55 } |
56 else | 56 else |
57 mux_a->h.dwSampleSize = 0; | 57 mux_a->h.dwSampleSize = 0; |
58 } | 58 } |
59 if(mux_a->h.dwSampleSize) | 59 if(mux_a->h.dwSampleSize) |
60 mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize; | 60 mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize; |
61 else | 61 else |
62 mux_a->wf->nBlockAlign = 1; | 62 mux_a->wf->nBlockAlign = 1; |
63 mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; | 63 mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; |
64 mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; | 64 mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; |
65 | 65 |
66 switch(lavc_param_atag) | 66 switch(lavc_param_atag) |
67 { | 67 { |
68 case 0x11: /* imaadpcm */ | 68 case 0x11: /* imaadpcm */ |
69 mux_a->wf->wBitsPerSample = 4; | 69 mux_a->wf->wBitsPerSample = 4; |
70 mux_a->wf->cbSize = 2; | 70 mux_a->wf->cbSize = 2; |
71 AV_WL16(mux_a->wf+1, lavc_actx->frame_size); | 71 AV_WL16(mux_a->wf+1, lavc_actx->frame_size); |
89 else | 89 else |
90 mux_a->wf->cbSize = 0; | 90 mux_a->wf->cbSize = 0; |
91 break; | 91 break; |
92 } | 92 } |
93 | 93 |
94 // Fix allocation | 94 // Fix allocation |
95 mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); | 95 mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); |
96 | 96 |
97 encoder->input_format = AF_FORMAT_S16_NE; | 97 encoder->input_format = AF_FORMAT_S16_NE; |
98 encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; | 98 encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; |
99 encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; | 99 encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; |
100 | 100 |
101 return 1; | 101 return 1; |
102 } | 102 } |
103 | 103 |
104 static int encode_lavc(audio_encoder_t *encoder, uint8_t *dest, void *src, int size, int max_size) | 104 static int encode_lavc(audio_encoder_t *encoder, uint8_t *dest, void *src, int size, int max_size) |
105 { | 105 { |
161 | 161 |
162 int mpae_init_lavc(audio_encoder_t *encoder) | 162 int mpae_init_lavc(audio_encoder_t *encoder) |
163 { | 163 { |
164 encoder->params.samples_per_frame = encoder->params.sample_rate; | 164 encoder->params.samples_per_frame = encoder->params.sample_rate; |
165 encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; | 165 encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; |
166 | 166 |
167 if(!lavc_param_acodec) | 167 if(!lavc_param_acodec) |
168 { | 168 { |
169 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_NoLavcAudioCodecName); | 169 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_NoLavcAudioCodecName); |
170 return 0; | 170 return 0; |
171 } | 171 } |
200 if(lavc_actx == NULL) | 200 if(lavc_actx == NULL) |
201 { | 201 { |
202 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext); | 202 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext); |
203 return 0; | 203 return 0; |
204 } | 204 } |
205 | 205 |
206 // put sample parameters | 206 // put sample parameters |
207 lavc_actx->channels = encoder->params.channels; | 207 lavc_actx->channels = encoder->params.channels; |
208 lavc_actx->sample_rate = encoder->params.sample_rate; | 208 lavc_actx->sample_rate = encoder->params.sample_rate; |
209 lavc_actx->time_base.num = 1; | 209 lavc_actx->time_base.num = 1; |
210 lavc_actx->time_base.den = encoder->params.sample_rate; | 210 lavc_actx->time_base.den = encoder->params.sample_rate; |
211 if(lavc_param_abitrate<1000) | 211 if(lavc_param_abitrate<1000) |
212 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate * 1000; | 212 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate * 1000; |
213 else | 213 else |
214 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate; | 214 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate; |
215 | 215 |
216 | 216 |
217 /* | 217 /* |
218 * Special case for adpcm_ima_wav. | 218 * Special case for adpcm_ima_wav. |
219 * The bitrate is only dependent on samplerate. | 219 * The bitrate is only dependent on samplerate. |
220 * We have to known frame_size and block_align in advance, | 220 * We have to known frame_size and block_align in advance, |