[FFmpeg-devel] [PATCH 1/3] avutil/frame: add AVBufferRef for qp table
Clément Bœsch
ubitux at gmail.com
Thu Mar 14 01:49:25 CET 2013
On Thu, Mar 14, 2013 at 12:17:24AM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavutil/frame.c | 30 ++++++++++++++++++++++++++++++
> libavutil/frame.h | 7 +++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 58e77c7..b955af2 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -42,6 +42,26 @@ MAKE_ACCESSORS(AVFrame, frame, int, pkt_size)
>
> AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;};
>
> +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride) {
> + av_buffer_unref(&f->qp_table_buf);
> +
nit++: inconsistent style
> + f->qp_table_buf = buf;
> +
> + f->qscale_table = buf->data;
> + f->qstride = stride;
> +
> + return 0;
> +}
> +
> +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride)
> +{
> + if (!f->qp_table_buf)
> + return NULL;
> +
> + *stride = f->qstride;
> + return f->qp_table_buf->data;
> +}
> +
> static void get_frame_defaults(AVFrame *frame)
> {
> if (frame->extended_data != frame->data)
> @@ -311,6 +331,8 @@ void av_frame_unref(AVFrame *frame)
> av_buffer_unref(&frame->extended_buf[i]);
> av_freep(&frame->extended_buf);
> av_dict_free(&frame->metadata);
> + av_buffer_unref(&frame->qp_table_buf);
> +
> get_frame_defaults(frame);
> }
>
> @@ -431,6 +453,14 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
> av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
> }
>
> + if (src->qp_table_buf) {
> + dst->qp_table_buf = av_buffer_ref(src->qp_table_buf);
> + if (dst->qp_table_buf) {
> + dst->qscale_table = dst->qp_table_buf->data;
> + dst->qstride = src->qstride;
> + }
> + }
> +
> return 0;
> }
>
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index ec7cfa9..aebc776 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -419,6 +419,11 @@ typedef struct AVFrame {
> * - decoding: set by libavcodec, read by user.
> */
> int pkt_size;
> +
> + /**
> + * Not to be accessed from outside libavutil
> + */
not to be accessed *directly*? Both in read and write?
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130314/84cbd3ec/attachment.asc>
More information about the ffmpeg-devel
mailing list