[FFmpeg-devel] [PATCH 1/4] Implement avfilter_ref_video_buffer().
Michael Niedermayer
michaelni
Tue Nov 9 19:39:16 CET 2010
On Sat, Nov 06, 2010 at 11:09:05PM +0100, Stefano Sabatini wrote:
> ---
> libavfilter/avfilter.c | 38 +++++++++++++++++++++++++++++++++++++
> libavfilter/avfilter.h | 14 +++++++++++++
> libavfilter/defaults.c | 49 ++++++++++++++---------------------------------
> 3 files changed, 67 insertions(+), 34 deletions(-)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index db85718..d80b768 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -267,6 +267,44 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
> return ret;
> }
>
> +AVFilterBufferRef *avfilter_ref_video_buffer(uint8_t *data[4], int linesize[4], int perms,
> + int w, int h, enum PixelFormat format)
> +{
> + AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));
> + AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));
> +
> + if (!pic || !picref)
> + goto fail;
> +
> + picref->buf = pic;
> + if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
> + goto fail;
> +
> + picref->video->w = w;
> + picref->video->h = h;
> +
> + /* make sure the buffer gets read permission or it's useless for output */
> + picref->perms = perms | AV_PERM_READ;
> +
> + pic->refcount = 1;
> + picref->type = AVMEDIA_TYPE_VIDEO;
> + picref->format = format;
> +
> + memcpy(pic->data, data, sizeof(pic->data));
> + memcpy(pic->linesize, linesize, sizeof(pic->linesize));
> + memcpy(picref->data, pic->data, sizeof(picref->data));
> + memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
> +
> + return picref;
> +
> +fail:
> + if (picref && picref->video)
> + av_free(picref->video);
> + av_free(picref);
> + av_free(pic);
> + return NULL;
> +}
> +
> AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
> enum SampleFormat sample_fmt, int size,
> int64_t channel_layout, int planar)
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 7cda6fc..b3ee0a1 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -649,6 +649,20 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
> int w, int h);
>
> /**
> + * Create a video buffer reference wrapped around an already allocated
> + * image.
> + *
> + * @param data pointers to the planes of the image to reference
> + * @param linesize linesizes for the planes of the image to reference
> + * @param perms the required access permissions
> + * @param w the width of the image in data
> + * @param h the height of the image in data
> + * @param format the pixel format of the image in data
> + */
> +AVFilterBufferRef *avfilter_ref_video_buffer(uint8_t *data[4], int linesize[4], int perms,
> + int w, int h, enum PixelFormat format);
that function name is nothing but bad
avfilter_given_picture_to_ref() is a random better one
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101109/7263bc42/attachment.pgp>
More information about the ffmpeg-devel
mailing list