]> git.sesse.net Git - ffmpeg/commitdiff
lavc: factorize setting got_packet_ptr in avcodec_encode_video2()
authorAnton Khirnov <anton@khirnov.net>
Fri, 24 Feb 2012 12:06:23 +0000 (13:06 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 25 Feb 2012 06:48:46 +0000 (07:48 +0100)
libavcodec/utils.c

index 4d07c9c52ee7a4562e545ef99cb8388e394956c1..47cab4118b51198e11a77efdc6b786e660455a88 100644 (file)
@@ -1093,10 +1093,11 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
     int ret;
     int user_packet = !!avpkt->data;
 
+    *got_packet_ptr = 0;
+
     if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {
         av_init_packet(avpkt);
         avpkt->size     = 0;
-        *got_packet_ptr = 0;
         return 0;
     }
 
@@ -1105,7 +1106,6 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
 
     av_assert0(avctx->codec->encode2);
 
-    *got_packet_ptr = 0;
     ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
     if (!ret) {
         if (!*got_packet_ptr)