[FFmpeg-cvslog] r18505 - trunk/ffmpeg.c

jbr subversion
Tue Apr 14 05:48:26 CEST 2009


Author: jbr
Date: Tue Apr 14 05:48:26 2009
New Revision: 18505

Log:
Support audio sample formats than S16 when encoding a small last frame.

Modified:
   trunk/ffmpeg.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Tue Apr 14 02:20:52 2009	(r18504)
+++ trunk/ffmpeg.c	Tue Apr 14 05:48:26 2009	(r18505)
@@ -1465,8 +1465,9 @@ static int output_packet(AVInputStream *
                             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,



More information about the ffmpeg-cvslog mailing list