]> git.sesse.net Git - ffmpeg/blobdiff - output_example.c
Check RV30/40 slice offsets to be inside buffer.
[ffmpeg] / output_example.c
index 57588b3b59c9b4ec31ecee9ff58e202cf62270b0..bd9b7c3f6ff2ad76ce283770567aba93225ee67f 100644 (file)
@@ -35,9 +35,6 @@
 #include "libswscale/swscale.h"
 
 #undef exit
-#undef fprintf
-#undef printf
-#undef snprintf
 
 /* 5 seconds stream duration */
 #define STREAM_DURATION   5.0
@@ -159,7 +156,8 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
 
     pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);
 
-    pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
+    if (c->coded_frame->pts != AV_NOPTS_VALUE)
+        pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
     pkt.flags |= PKT_FLAG_KEY;
     pkt.stream_index= st->index;
     pkt.data= audio_outbuf;
@@ -383,7 +381,8 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
             AVPacket pkt;
             av_init_packet(&pkt);
 
-            pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
+            if (c->coded_frame->pts != AV_NOPTS_VALUE)
+                pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
             if(c->coded_frame->key_frame)
                 pkt.flags |= PKT_FLAG_KEY;
             pkt.stream_index= st->index;