On Sun, 20 Mar 2016 07:53:15 +0100
Anton Khirnov <[email protected]> wrote:
> 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 | 4 ++++
> libavcodec/libschroedingerdec.c | 7 ++++++-
> libavcodec/mmaldec.c | 7 ++++++-
> libavcodec/qsvdec.c | 7 ++++++-
> libavcodec/utils.c | 10 ++++++++++
> libavcodec/version.h | 2 +-
> libavutil/frame.c | 4 ++++
> libavutil/frame.h | 4 ++++
> libavutil/version.h | 3 +++
> 9 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index e0c4678..3da6aaf 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil: 2015-08-28
>
> API changes, most recent first:
>
> +2016-xx-xx - xxxxxxx - lavc 57.15.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 - lavfi 6.3.0 - avfilter.h
> Add AVFilterContext.hw_device_ctx.
>
> diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
> index cb7374c..a127ecc 100644
> --- a/libavcodec/libschroedingerdec.c
> +++ b/libavcodec/libschroedingerdec.c
> @@ -330,7 +330,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;
> diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
> index 15b887c..5afde75 100644
> --- a/libavcodec/mmaldec.c
> +++ b/libavcodec/mmaldec.c
> @@ -609,7 +609,12 @@ static int ffmal_copy_frame(AVCodecContext *avctx,
> AVFrame *frame,
> }
> }
>
> - 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:
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index 1d59e72..c839fc5 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -302,7 +302,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 :
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 7caa035..1f0bc6d 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -548,11 +548,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;
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index d247c09..87ac945 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
> #include "libavutil/version.h"
>
> #define LIBAVCODEC_VERSION_MAJOR 57
> -#define LIBAVCODEC_VERSION_MINOR 14
> +#define LIBAVCODEC_VERSION_MINOR 15
> #define LIBAVCODEC_VERSION_MICRO 0
>
> #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index ae80cee..1c14f5f 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -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;
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index a39a1ef..c72c3a2 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -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
Seems like much noise for very little gain. I think you should not
deprecate it, and just set pts too for a few years, and then deprecate
it.
(I'm seriously considering hard-disabling deprecation warnings in my
own code, because these things are so damn annoying.)
>
> /**
> * DTS copied from the AVPacket that triggered returning this frame.
> diff --git a/libavutil/version.h b/libavutil/version.h
> index fdd27e3..f21bb3b 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -102,6 +102,9 @@
> #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
>
>
> /**
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel