[FFmpeg-devel] [PATCH 1/3] avutil/frame: add a (private) struct_version to AVFrame
wm4
nfxjfg at googlemail.com
Tue Dec 17 15:22:12 CET 2013
On Tue, 17 Dec 2013 14:34:08 +0100
Michael Niedermayer <michaelni at gmx.at> wrote:
> This will be used to check for mixups of AVFrame allocations, like when
> multiple libavutil versions get linked in.
>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavutil/frame.c | 2 ++
> libavutil/frame.h | 6 ++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 1b44400..013e439 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -92,6 +92,7 @@ static void get_frame_defaults(AVFrame *frame)
> av_freep(&frame->extended_data);
>
> memset(frame, 0, sizeof(*frame));
> + frame->struct_version = LIBAVUTIL_VERSION_MAJOR + (sizeof(AVFrame)<<8) + ((uint64_t)MKTAG('A','V','F','r')<<32);
>
> frame->pts =
> frame->pkt_dts =
> @@ -414,6 +415,7 @@ int av_frame_make_writable(AVFrame *frame)
> return 0;
>
> memset(&tmp, 0, sizeof(tmp));
> + tmp.struct_version = frame->struct_version;
> tmp.format = frame->format;
> tmp.width = frame->width;
> tmp.height = frame->height;
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index b31cc3e..c1c2c17 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -502,6 +502,12 @@ typedef struct AVFrame {
> * Not to be accessed directly from outside libavutil
> */
> AVBufferRef *qp_table_buf;
> +
> + /**
> + * Not to be accessed from outside libavutil
> + */
> + uint64_t struct_version;
> +
> } AVFrame;
>
> /**
This is really starting to get awkward. Why not stop pretending that
libavcodec, libavutil, etc. are independent libraries instead?
More information about the ffmpeg-devel
mailing list