]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/swfenc.c
rtmpproto: Write correct flv packet sizes at the end of packets
[ffmpeg] / libavformat / swfenc.c
index be2e5cd7d3d5c74ff2b92bfaa23cde08bbbd0a9d..877c847acbc30a02b7128d59b82d49dfe7c4b8a2 100644 (file)
@@ -207,6 +207,7 @@ static int swf_write_header(AVFormatContext *s)
             if (enc->codec_id == AV_CODEC_ID_VP6F ||
                 enc->codec_id == AV_CODEC_ID_FLV1 ||
                 enc->codec_id == AV_CODEC_ID_MJPEG) {
+                swf->video_st  = s->streams[i];
                 swf->video_enc = enc;
             } else {
                 av_log(s, AV_LOG_ERROR, "SWF muxer only supports VP6, FLV1 and MJPEG\n");
@@ -224,8 +225,9 @@ static int swf_write_header(AVFormatContext *s)
     } else {
         width = swf->video_enc->width;
         height = swf->video_enc->height;
-        rate = swf->video_enc->time_base.den;
-        rate_base = swf->video_enc->time_base.num;
+        // TODO: should be avg_frame_rate
+        rate = swf->video_st->time_base.den;
+        rate_base = swf->video_st->time_base.num;
     }
 
     if (!swf->audio_enc)
@@ -425,7 +427,8 @@ static int swf_write_video(AVFormatContext *s,
         put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
         avio_wl16(pb, swf->sound_samples);
         avio_wl16(pb, 0); // seek samples
-        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &avio_write);
+        av_fifo_generic_read(swf->audio_fifo, pb, frame_size,
+                             (void (*)(void *, void *, int)) &avio_write);
         put_swf_end_tag(s);
 
         /* update FIFO */