summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2009-04-14 03:48:26 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-04-14 03:48:26 +0000
commit22c4c3e059be50974b4af2bef7a000062737bdeb (patch)
tree137bfb20fb5f8da576371b13890917e8b23e1a81 /ffmpeg.c
parent7c8689ef5401bb462006cb7d555efc380f320b17 (diff)
Support audio sample formats than S16 when encoding a small last frame.
Originally committed as revision 18505 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 4be4b92681..ce36694892 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1465,8 +1465,9 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = 0;
/* encode any samples remaining in fifo */
if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
+ int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
int fs_tmp = enc->frame_size;
- enc->frame_size = fifo_bytes / (2 * enc->channels);
+ enc->frame_size = fifo_bytes / (osize * enc->channels);
av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,