[FFmpeg-devel] [PATCH] Pass pts values through non-delay encoders by default.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jan 22 14:39:52 CET 2012


Avoids having to duplicate the code for trivial, non-reordering
encoders.
Completely and utterly breaks almost all H.264 conformance tests,
sometimes just making the pts start with negative values, sometimes
only giving 2 instead of 20 decoded frames or failing with not
correctly ordered pts.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/utils.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a505fa5..25ad3eb 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1145,6 +1145,12 @@ int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf
         int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
         avctx->frame_number++;
         emms_c(); //needed to avoid an emms_c() call before every return;
+        if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
+            if (!avctx->coded_frame)
+                avctx->coded_frame = pict;
+            if (pict)
+                avctx->coded_frame->pts = pict->pts;
+        }
 
         return ret;
     }else
-- 
1.7.8.3



More information about the ffmpeg-devel mailing list