Mercurial > mplayer.hg
annotate libmpcodecs/ae_lavc.c @ 36441:b75ebb89d803
Workaround VDPAU decode errors on aspect change on NVidia.
The NVidia driver seems to expect a decoder reinit on aspect
change, otherwise giving a nonsense VDP_STATUS_INVALID_SIZE
error.
Since decode and display can run out of sync, we do not in fact
know when an aspect change will happen during decode but only when
we want to display that decoded frame, and with threaded decoding
these will differ significantly.
So just catch the error and retry decoding instead, this also has
the advantage of not affecting (and possibly costing performance)
drivers without this issue.
author | reimar |
---|---|
date | Sun, 08 Dec 2013 15:07:00 +0000 |
parents | f77a74ebb95e |
children |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
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:
29673
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:
29673
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:
29673
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
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:
29673
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:
29673
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:
29673
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
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:
29673
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:
29673
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:
29673
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29673
diff
changeset
|
18 |
15234 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 #include <inttypes.h> | |
15238 | 22 #include <unistd.h> |
15234 | 23 #include <string.h> |
15240 | 24 #include <sys/types.h> |
26203 | 25 #include "config.h" |
15234 | 26 #include "m_option.h" |
17012 | 27 #include "mp_msg.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
28 #include "libmpdemux/aviheader.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
29 #include "libmpdemux/ms_hdr.h" |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
22316
diff
changeset
|
30 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
31 #include "libmpdemux/muxer.h" |
15234 | 32 #include "ae_lavc.h" |
33871
30f5e5cd3676
Move code for setting up libav* logging callbacks from vd_ffmpeg to a
reimar
parents:
33504
diff
changeset
|
33 #include "av_helpers.h" |
32017 | 34 #include "ve.h" |
15234 | 35 #include "help_mp.h" |
31589
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
36 #include "av_opts.h" |
17012 | 37 #include "libaf/af_format.h" |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24359
diff
changeset
|
38 #include "libaf/reorder_ch.h" |
15234 | 39 #include "libavcodec/avcodec.h" |
28132 | 40 #include "libavutil/intreadwrite.h" |
32142
4614728cab25
build system: Merge all FFmpeg library checks into a single FFmpeg check.
diego
parents:
32017
diff
changeset
|
41 #include "libavformat/avformat.h" |
4614728cab25
build system: Merge all FFmpeg library checks into a single FFmpeg check.
diego
parents:
32017
diff
changeset
|
42 #include "libmpdemux/mp_taglists.h" |
32907
44f4ead8fdb0
Start adding support for lavc audio encoders that use other formats
reimar
parents:
32768
diff
changeset
|
43 #include "fmt-conversion.h" |
15234 | 44 |
45 static AVCodec *lavc_acodec; | |
46 static AVCodecContext *lavc_actx; | |
47 static int compressed_frame_size = 0; | |
48 | |
49 static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) | |
50 { | |
51 mux_a->wf = malloc(sizeof(WAVEFORMATEX)+lavc_actx->extradata_size+256); | |
52 mux_a->wf->wFormatTag = lavc_param_atag; | |
53 mux_a->wf->nChannels = lavc_actx->channels; | |
54 mux_a->wf->nSamplesPerSec = lavc_actx->sample_rate; | |
55 mux_a->wf->nAvgBytesPerSec = (lavc_actx->bit_rate / 8); | |
19360
d4d72e5eea07
pass average bitrate from encoder to (lavf) muxer
michael
parents:
17855
diff
changeset
|
56 mux_a->avg_rate= lavc_actx->bit_rate; |
15234 | 57 mux_a->h.dwRate = mux_a->wf->nAvgBytesPerSec; |
58 if(lavc_actx->block_align) | |
59 mux_a->h.dwSampleSize = mux_a->h.dwScale = lavc_actx->block_align; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
60 else |
15234 | 61 { |
62 mux_a->h.dwScale = (mux_a->wf->nAvgBytesPerSec * lavc_actx->frame_size)/ mux_a->wf->nSamplesPerSec; /* for cbr */ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
63 |
15234 | 64 if ((mux_a->wf->nAvgBytesPerSec * |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
65 lavc_actx->frame_size) % mux_a->wf->nSamplesPerSec) |
15234 | 66 { |
67 mux_a->h.dwScale = lavc_actx->frame_size; | |
68 mux_a->h.dwRate = lavc_actx->sample_rate; | |
69 mux_a->h.dwSampleSize = 0; // Blocksize not constant | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
70 } |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
71 else |
21773
03bc990498fc
the avi spec does not allow random samplesize whoever wrote this should be shot
michael
parents:
21771
diff
changeset
|
72 mux_a->h.dwSampleSize = 0; |
15234 | 73 } |
21773
03bc990498fc
the avi spec does not allow random samplesize whoever wrote this should be shot
michael
parents:
21771
diff
changeset
|
74 if(mux_a->h.dwSampleSize) |
03bc990498fc
the avi spec does not allow random samplesize whoever wrote this should be shot
michael
parents:
21771
diff
changeset
|
75 mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize; |
03bc990498fc
the avi spec does not allow random samplesize whoever wrote this should be shot
michael
parents:
21771
diff
changeset
|
76 else |
03bc990498fc
the avi spec does not allow random samplesize whoever wrote this should be shot
michael
parents:
21771
diff
changeset
|
77 mux_a->wf->nBlockAlign = 1; |
15234 | 78 mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000; |
79 mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign; | |
80 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
81 switch(lavc_param_atag) |
15234 | 82 { |
83 case 0x11: /* imaadpcm */ | |
84 mux_a->wf->wBitsPerSample = 4; | |
85 mux_a->wf->cbSize = 2; | |
28132 | 86 AV_WL16(mux_a->wf+1, lavc_actx->frame_size); |
15234 | 87 break; |
88 case 0x55: /* mp3 */ | |
89 mux_a->wf->cbSize = 12; | |
90 mux_a->wf->wBitsPerSample = 0; /* does not apply */ | |
91 ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1; | |
92 ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->fdwFlags = 2; | |
93 ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign; | |
94 ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1; | |
95 ((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0; | |
96 break; | |
97 default: | |
98 mux_a->wf->wBitsPerSample = 0; /* Unknown */ | |
99 if (lavc_actx->extradata && (lavc_actx->extradata_size > 0)) | |
100 { | |
15501
7cdc07507650
wrong memcpy of extradata; 10l to whomever wrote that broken code
nicodvb
parents:
15244
diff
changeset
|
101 memcpy(mux_a->wf+1, lavc_actx->extradata, lavc_actx->extradata_size); |
15234 | 102 mux_a->wf->cbSize = lavc_actx->extradata_size; |
103 } | |
104 else | |
105 mux_a->wf->cbSize = 0; | |
106 break; | |
107 } | |
108 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
109 // Fix allocation |
15234 | 110 mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
111 |
15234 | 112 encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; |
113 encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
114 |
15234 | 115 return 1; |
116 } | |
117 | |
118 static int encode_lavc(audio_encoder_t *encoder, uint8_t *dest, void *src, int size, int max_size) | |
119 { | |
120 int n; | |
36334
c1033e9288b1
Extract audio encoding code into a separate helper function.
reimar
parents:
36172
diff
changeset
|
121 n = lavc_encode_audio(lavc_actx, src, size, dest, max_size); |
c1033e9288b1
Extract audio encoding code into a separate helper function.
reimar
parents:
36172
diff
changeset
|
122 compressed_frame_size = n < 0 ? 0 : n; |
c1033e9288b1
Extract audio encoding code into a separate helper function.
reimar
parents:
36172
diff
changeset
|
123 return compressed_frame_size; |
15234 | 124 } |
125 | |
126 | |
127 static int close_lavc(audio_encoder_t *encoder) | |
128 { | |
129 compressed_frame_size = 0; | |
130 return 1; | |
131 } | |
132 | |
133 static int get_frame_size(audio_encoder_t *encoder) | |
134 { | |
17855
4b1930c9345c
do not randomly chop up packets, this isnt allowed in almost no container
michael
parents:
17842
diff
changeset
|
135 int sz = compressed_frame_size; |
4b1930c9345c
do not randomly chop up packets, this isnt allowed in almost no container
michael
parents:
17842
diff
changeset
|
136 compressed_frame_size = 0; |
4b1930c9345c
do not randomly chop up packets, this isnt allowed in almost no container
michael
parents:
17842
diff
changeset
|
137 return sz; |
15234 | 138 } |
139 | |
15244
a8a8a4d69a1c
restore old lavc_find_atag to be used when compiling mplayer without libavformat
nicodvb
parents:
15240
diff
changeset
|
140 |
15234 | 141 int mpae_init_lavc(audio_encoder_t *encoder) |
142 { | |
143 encoder->params.samples_per_frame = encoder->params.sample_rate; | |
144 encoder->params.bitrate = encoder->params.sample_rate * encoder->params.channels * 2 * 8; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
145 |
15234 | 146 if(!lavc_param_acodec) |
147 { | |
148 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_NoLavcAudioCodecName); | |
149 return 0; | |
150 } | |
151 | |
31959
f957f330aa6d
Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
diego
parents:
31589
diff
changeset
|
152 init_avcodec(); |
15234 | 153 |
154 lavc_acodec = avcodec_find_encoder_by_name(lavc_param_acodec); | |
155 if (!lavc_acodec) | |
156 { | |
157 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LavcAudioCodecNotFound, lavc_param_acodec); | |
158 return 0; | |
159 } | |
160 if(lavc_param_atag == 0) | |
161 { | |
34155
505b49b171f4
Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents:
33935
diff
changeset
|
162 lavc_param_atag = mp_codec_id2tag(lavc_acodec->id, 0, 1); |
15234 | 163 if(!lavc_param_atag) |
164 { | |
165 mp_msg(MSGT_MENCODER, MSGL_FATAL, "Couldn't find wav tag for specified codec, exit\n"); | |
166 return 0; | |
167 } | |
168 } | |
169 | |
33935 | 170 lavc_actx = avcodec_alloc_context3(lavc_acodec); |
15234 | 171 if(lavc_actx == NULL) |
172 { | |
173 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext); | |
174 return 0; | |
175 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
176 |
29673
a3cc38ad5878
Set codec_type and codec_id in codec context for lavc encoders.
reimar
parents:
29491
diff
changeset
|
177 lavc_actx->codec_id = lavc_acodec->id; |
15234 | 178 // put sample parameters |
33500
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
179 lavc_actx->sample_fmt = AV_SAMPLE_FMT_S16; |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
180 if (lavc_acodec->sample_fmts) { |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
181 const enum AVSampleFormat *fmts; |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
182 lavc_actx->sample_fmt = lavc_acodec->sample_fmts[0]; // fallback to first format |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
183 for (fmts = lavc_acodec->sample_fmts; *fmts != AV_SAMPLE_FMT_NONE; fmts++) { |
36335
f77a74ebb95e
Quick an inefficient hack to enable planar encoding.
reimar
parents:
36334
diff
changeset
|
184 if (samplefmt2affmt(av_get_packed_sample_fmt(*fmts)) == encoder->params.sample_format) { // preferred format found |
33500
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
185 lavc_actx->sample_fmt = *fmts; |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
186 break; |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
187 } |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
188 } |
c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
reimar
parents:
33045
diff
changeset
|
189 } |
36335
f77a74ebb95e
Quick an inefficient hack to enable planar encoding.
reimar
parents:
36334
diff
changeset
|
190 encoder->input_format = samplefmt2affmt(av_get_packed_sample_fmt(lavc_actx->sample_fmt)); |
36172 | 191 if (encoder->input_format == AF_FORMAT_UNKNOWN) { |
192 mp_msg(MSGT_MENCODER,MSGL_ERR, "Audio encoder requires unknown or unsupported input format\n"); | |
193 return 0; | |
194 } | |
15234 | 195 lavc_actx->channels = encoder->params.channels; |
196 lavc_actx->sample_rate = encoder->params.sample_rate; | |
28660
0812215421d7
Set time_base to 1/samplerate, like FFmpeg does, instead of leaving it at the
diego
parents:
28132
diff
changeset
|
197 lavc_actx->time_base.num = 1; |
0812215421d7
Set time_base to 1/samplerate, like FFmpeg does, instead of leaving it at the
diego
parents:
28132
diff
changeset
|
198 lavc_actx->time_base.den = encoder->params.sample_rate; |
23957
74eb6825d332
allow to specify the audio bitrate in bits (some codecs need that ...)
michael
parents:
23121
diff
changeset
|
199 if(lavc_param_abitrate<1000) |
74eb6825d332
allow to specify the audio bitrate in bits (some codecs need that ...)
michael
parents:
23121
diff
changeset
|
200 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate * 1000; |
74eb6825d332
allow to specify the audio bitrate in bits (some codecs need that ...)
michael
parents:
23121
diff
changeset
|
201 else |
74eb6825d332
allow to specify the audio bitrate in bits (some codecs need that ...)
michael
parents:
23121
diff
changeset
|
202 lavc_actx->bit_rate = encoder->params.bitrate = lavc_param_abitrate; |
31589
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
203 if(lavc_param_audio_avopt){ |
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
204 if(parse_avopts(lavc_actx, lavc_param_audio_avopt) < 0){ |
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
205 mp_msg(MSGT_MENCODER,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_param_audio_avopt); |
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
206 return 0; |
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
207 } |
ef92321146a1
Make it possible to set all options for lavc audio encoder.
reimar
parents:
30633
diff
changeset
|
208 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28928
diff
changeset
|
209 |
15234 | 210 |
211 /* | |
212 * Special case for adpcm_ima_wav. | |
22316
f3d7a1b58a82
cosmetics: Fix some common typos, appropiate --> appropRiate,
diego
parents:
21966
diff
changeset
|
213 * The bitrate is only dependent on samplerate. |
15234 | 214 * We have to known frame_size and block_align in advance, |
215 * so I just copied the code from libavcodec/adpcm.c | |
216 * | |
217 * However, ms adpcm_ima_wav uses a block_align of 2048, | |
218 * lavc defaults to 1024 | |
219 */ | |
220 if(lavc_param_atag == 0x11) { | |
221 int blkalign = 2048; | |
222 int framesize = (blkalign - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels) + 1; | |
223 lavc_actx->bit_rate = lavc_actx->sample_rate*8*blkalign/framesize; | |
224 } | |
17842 | 225 if((lavc_param_audio_global_header&1) |
226 /*|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))*/){ | |
227 lavc_actx->flags |= CODEC_FLAG_GLOBAL_HEADER; | |
228 } | |
229 if(lavc_param_audio_global_header&2){ | |
230 lavc_actx->flags2 |= CODEC_FLAG2_LOCAL_HEADER; | |
231 } | |
15234 | 232 |
33935 | 233 if(avcodec_open2(lavc_actx, lavc_acodec, NULL) < 0) |
15234 | 234 { |
235 mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntOpenCodec, lavc_param_acodec, lavc_param_abitrate); | |
236 return 0; | |
237 } | |
238 | |
239 if(lavc_param_atag == 0x11) { | |
240 lavc_actx->block_align = 2048; | |
241 lavc_actx->frame_size = (lavc_actx->block_align - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels) + 1; | |
242 } | |
243 | |
33501
3209d6cbc393
Fix encoding to formats taking input other than 16 bits per sample.
reimar
parents:
33500
diff
changeset
|
244 encoder->decode_buffer_size = lavc_actx->frame_size * |
3209d6cbc393
Fix encoding to formats taking input other than 16 bits per sample.
reimar
parents:
33500
diff
changeset
|
245 av_get_bytes_per_sample(lavc_actx->sample_fmt) * |
3209d6cbc393
Fix encoding to formats taking input other than 16 bits per sample.
reimar
parents:
33500
diff
changeset
|
246 encoder->params.channels; |
28928
f2b3f28982b8
Avoid ridiculously small decode_buffer_size (e.g. 4 with acodec=pcm_s16le)
reimar
parents:
28660
diff
changeset
|
247 while (encoder->decode_buffer_size < 1024) encoder->decode_buffer_size *= 2; |
15234 | 248 encoder->bind = bind_lavc; |
249 encoder->get_frame_size = get_frame_size; | |
250 encoder->encode = encode_lavc; | |
251 encoder->close = close_lavc; | |
252 | |
253 return 1; | |
254 } |