]> rtime.felk.cvut.cz Git - frescor/demo.git/blobdiff - build/recorder/ffmpeg.c
Flush frames buffered during format probing
[frescor/demo.git] / build / recorder / ffmpeg.c
index 259863ea7a1dd595339a2b9cbe268026cdb14b72..c413cbaf7e6a93c3f6e90cae40e3e7dcf6b2b3c7 100644 (file)
@@ -4085,6 +4085,16 @@ int frsh_stuff()
 }
 #endif /* CONFIG_FFMPEG_WITH_FRSH */
 
+void flush_buffered_frames(AVFormatContext *s)
+{
+    AVPacketList *pktl;
+    while ((pktl = s->packet_buffer)) {
+       av_free_packet(&pktl->pkt);
+       s->packet_buffer = pktl->next;
+       av_free(pktl);
+    }
+}
+
 int main(int argc, char **argv)
 {
     int i;
@@ -4118,6 +4128,9 @@ int main(int argc, char **argv)
            opt_output_file("stream.mp4");
     }
 
+    for (i=0; i<nb_input_files; i++)
+       flush_buffered_frames(input_files[i]);
+
     ti = getutime();
 #if CONFIG_FFMPEG_WITH_FRSH    
     if (frsh_stuff() < 0)