]> git.sesse.net Git - ffmpeg/commitdiff
lavc: export the timestamps when decoding in AVFrame.pts
authorAnton Khirnov <anton@khirnov.net>
Sat, 19 Mar 2016 20:45:24 +0000 (21:45 +0100)
committerAnton Khirnov <anton@khirnov.net>
Tue, 21 Jun 2016 17:54:42 +0000 (19:54 +0200)
Currently it's exported as AVFrame.pkt_pts, which is also the only use
for that field. The reason it is done like this is that lavc used to
export various codec-specific "timing" information in AVFrame.pts, which
is not done anymore.

Since it is confusing to the callers to have a separate field which is
used only for decoder timestamps and nothing else, deprecate pkt_pts and
use just AVFrame.pts everywhere.

doc/APIchanges
libavcodec/libschroedingerdec.c
libavcodec/mmaldec.c
libavcodec/qsvdec.c
libavcodec/utils.c
libavcodec/version.h
libavutil/frame.c
libavutil/frame.h
libavutil/version.h

index 74316ed7c15639fe146dbf4369274b4b6a11dd1f..1caa1b75756a54b8c41df123a9e5ce4c41b5307f 100644 (file)
@@ -13,6 +13,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx - lavc 57.24.0 - avcodec.h
+  Decoders now export the frame timestamp as AVFrame.pts. It was
+  previously exported as AVFrame.pkt_pts, which is now deprecated.
+
 2016-xx-xx - xxxxxxx - lavu 55.16.0 - hwcontext.h hwcontext_qsv.h
   Add AV_HWDEVICE_TYPE_QSV and a new installed header with QSV-specific
   hwcontext definitions.
index fb0781ed5c6bf39c40f3a2dca20d3b103db8953a..f173f92f043b68605bb88742ea5e587399498a7a 100644 (file)
@@ -326,7 +326,12 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
                framewithpts->frame->components[2].length);
 
         /* Fill frame with current buffer data from Schroedinger. */
-        avframe->pkt_pts = framewithpts->pts;
+        avframe->pts = framewithpts->pts;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
+        avframe->pkt_pts = avframe->pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
         avframe->linesize[0] = framewithpts->frame->components[0].stride;
         avframe->linesize[1] = framewithpts->frame->components[1].stride;
         avframe->linesize[2] = framewithpts->frame->components[2].stride;
index 193df7e07df1d6d95be720240343628618d03dd9..69258a2eb66f960a83e7297988e2c1d1669733b5 100644 (file)
@@ -631,7 +631,12 @@ static int ffmal_copy_frame(AVCodecContext *avctx,  AVFrame *frame,
                       avctx->pix_fmt, avctx->width, avctx->height);
     }
 
-    frame->pkt_pts = buffer->pts == MMAL_TIME_UNKNOWN ? AV_NOPTS_VALUE : buffer->pts;
+    frame->pts = buffer->pts == MMAL_TIME_UNKNOWN ? AV_NOPTS_VALUE : buffer->pts;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
+    frame->pkt_pts = frame->pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     frame->pkt_dts = AV_NOPTS_VALUE;
 
 done:
index ac7a1e60b95853bf2216ef8515bbe9ebd2a0c416..0215761335b8fef05c1c9ae7aa7b01986bd46404 100644 (file)
@@ -352,7 +352,12 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
 
         outsurf = out_frame->surface;
 
-        frame->pkt_pts = frame->pts = outsurf->Data.TimeStamp;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
+        frame->pkt_pts = outsurf->Data.TimeStamp;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+        frame->pts = outsurf->Data.TimeStamp;
 
         frame->repeat_pict =
             outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_TRIPLING ? 4 :
index 8f8efecbeaa28baf0c2ff3a55baa9f7ec0d07295..bc1beee4626d339717d328c605b60bd564580447 100644 (file)
@@ -551,11 +551,21 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
 
     frame->reordered_opaque = avctx->reordered_opaque;
     if (!pkt) {
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
         frame->pkt_pts = AV_NOPTS_VALUE;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+        frame->pts     = AV_NOPTS_VALUE;
         return 0;
     }
 
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
     frame->pkt_pts = pkt->pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+    frame->pts     = pkt->pts;
 
     for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
         int size;
index 9b495e9a44bbacaea3a5f9833b4f0bfd42dfdad0..3b154f84e3df171085fd0e449f782dc0d26a72b9 100644 (file)
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 23
+#define LIBAVCODEC_VERSION_MINOR 24
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
index ae80cee06268d69165a0c459fb0685850eb23974..1c14f5f03f0942ade6674039b645afca61302ec4 100644 (file)
@@ -397,7 +397,11 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
     dst->palette_has_changed    = src->palette_has_changed;
     dst->sample_rate            = src->sample_rate;
     dst->opaque                 = src->opaque;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
     dst->pkt_pts                = src->pkt_pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     dst->pkt_dts                = src->pkt_dts;
     dst->reordered_opaque       = src->reordered_opaque;
     dst->quality                = src->quality;
index 7c55225a45385253b7e6b5edef22bfba88caf6d7..12624d797f022c6d8755f4317bb3842b178e9cae 100644 (file)
@@ -210,10 +210,14 @@ typedef struct AVFrame {
      */
     int64_t pts;
 
+#if FF_API_PKT_PTS
     /**
      * PTS copied from the AVPacket that was decoded to produce this frame.
+     * @deprecated use the pts field instead
      */
+    attribute_deprecated
     int64_t pkt_pts;
+#endif
 
     /**
      * DTS copied from the AVPacket that triggered returning this frame.
index d13794cc50258070262b7f1fe6966e3b8a04e0fe..40745da216b84605c65ff42ce7cbc6b5ef66cd47 100644 (file)
 #ifndef FF_API_VAAPI
 #define FF_API_VAAPI                    (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_PKT_PTS
+#define FF_API_PKT_PTS                  (LIBAVUTIL_VERSION_MAJOR < 56)
+#endif
 
 
 /**