[FFmpeg-cvslog] swfenc: use av_get_audio_frame_duration() instead of AVCodecContext. frame_size

Justin Ruggles git at videolan.org
Tue Mar 6 06:15:58 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Feb 27 03:09:44 2012 -0500| [620b88a302d522f71a6a95aff500cf7bd8520043] | committer: Justin Ruggles

swfenc: use av_get_audio_frame_duration() instead of AVCodecContext.frame_size

This way we can do stream copy without having the demuxer wait until
frame_size has been set.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=620b88a302d522f71a6a95aff500cf7bd8520043
---

 libavformat/swfenc.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index f4494cd..82ec7ff 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -187,10 +187,6 @@ static int swf_write_header(AVFormatContext *s)
         AVCodecContext *enc = s->streams[i]->codec;
         if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             if (enc->codec_id == CODEC_ID_MP3) {
-                if (!enc->frame_size) {
-                    av_log(s, AV_LOG_ERROR, "audio frame size not set\n");
-                    return -1;
-                }
                 swf->audio_enc = enc;
                 swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE);
                 if (!swf->audio_fifo)
@@ -452,7 +448,7 @@ static int swf_write_audio(AVFormatContext *s,
     }
 
     av_fifo_generic_write(swf->audio_fifo, buf, size, NULL);
-    swf->sound_samples += enc->frame_size;
+    swf->sound_samples += av_get_audio_frame_duration(enc, size);
 
     /* if audio only stream make sure we add swf frames */
     if (!swf->video_enc)



More information about the ffmpeg-cvslog mailing list