[FFmpeg-devel] [PATCH] Separate video specific BufferRef properties into VideoProps

Michael Niedermayer michaelni
Wed Aug 11 15:19:47 CEST 2010


On Tue, Aug 10, 2010 at 08:58:10PM -0700, S.N. Hemanth Meenakshisundaram wrote:
[...]
> index c89a8b3..58e54ce 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -684,6 +684,8 @@ static void free_subpicture(SubPicture *sp)
>  static void video_image_display(VideoState *is)
>  {
>      VideoPicture *vp;
> +#if CONFIG_AVFILTER
> +#endif

ehm


[...]
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index b7242be..468e5f7 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -49,6 +49,10 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
>  {
>      AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
>      *ret = *ref;
> +    if(ref->type == AVMEDIA_TYPE_VIDEO) {
> +        ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
> +        *ret->video = *ref->video;
> +    }
>      ret->perms &= pmask;
>      ret->buf->refcount ++;
>      return ret;
> @@ -58,6 +62,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref)
>  {
>      if(!(--ref->buf->refcount))
>          ref->buf->free(ref->buf);
> +    av_free(ref->video);
>      av_free(ref);
>  }
>  
> @@ -179,7 +184,7 @@ void ff_dprintf_picref(void *ctx, AVFilterBufferRef *picref, int end)
>              picref->data    [0], picref->data    [1], picref->data    [2], picref->data    [3],
>              picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3],
>              picref->pts, picref->pos,
> -            picref->pixel_aspect.num, picref->pixel_aspect.den, picref->w, picref->h,
> +            picref->video->pixel_aspect.num, picref->video->pixel_aspect.den, picref->video->w, picref->video->h,
>              end ? "\n" : "");
>  }
>  
> @@ -314,7 +319,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
>  
>          for(i = 0; i < 4; i ++) {
>              int planew =
> -                ff_get_plane_bytewidth(link->format, link->cur_buf->w, i);
> +                ff_get_plane_bytewidth(link->format, link->cur_buf->video->w, i);
>  
>              if(!src[i]) continue;
>  
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 3fc5e8c..e70bbc7 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -89,6 +89,21 @@ typedef struct AVFilterBuffer
>  #define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
>  
>  /**
> + * Video specific properties in a reference to an AVFilterBuffer. Since
> + * AVFilterBufferRef is common to different media formats, video specific
> + * per reference properties must be separated out.
> + */
> +
> +typedef struct AVFilterBufferRefVideoProps
> +{
> +    AVRational pixel_aspect;    ///< pixel aspect ratio
> +    int w;                      ///< image width
> +    int h;                      ///< image height
> +    int interlaced;             ///< is frame interlaced
> +    int top_field_first;        ///< field order
> +} AVFilterBufferRefVideoProps;
> +
> +/**
>   * A reference to an AVFilterBuffer. Since filters can manipulate the origin of
>   * a buffer to, for example, crop image without any memcpy, the buffer origin
>   * and dimensions are per-reference properties. Linesize is also useful for
> @@ -98,22 +113,19 @@ typedef struct AVFilterBuffer
>   */
>  typedef struct AVFilterBufferRef
>  {
> -    AVFilterBuffer *buf;        ///< the buffer that this is a reference to
> -    uint8_t *data[4];           ///< picture data for each plane
> -    int linesize[4];            ///< number of bytes per line
> -    int w;                      ///< image width
> -    int h;                      ///< image height
> -    int format;                 ///< media format
> +    AVFilterBuffer *buf;                ///< the buffer that this is a reference to
> +    uint8_t *data[4];                   ///< picture data for each plane
> +    int linesize[4];                    ///< number of bytes per line
> +    int format;                         ///< media format
>  
> -    int64_t pts;                ///< presentation timestamp in units of 1/AV_TIME_BASE
> -    int64_t pos;                ///< byte position in stream, -1 if unknown
> +    int64_t pts;                        ///< presentation timestamp in units of 1/AV_TIME_BASE
> +    int64_t pos;                        ///< byte position in stream, -1 if unknown

cosmetics -> seperate patch


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100811/f0ac2744/attachment.pgp>



More information about the ffmpeg-devel mailing list