[FFmpeg-devel] [PATCH] Re: How can I determine color_range from a filter?

Larry Robinson silver-dad
Wed Jan 12 18:04:20 CET 2011

On 1/10/2011 10:41 AM, Michael Niedermayer wrote:
> On Mon, Jan 10, 2011 at 10:11:45AM -0800, Larry Robinson wrote:
>> 1) For now, I will include avcodec.h in avfilter.h; if the color
>> rendering enums are moved out, only this line would need to be changed.
>> 2) I will encode color_primaries, etc. into the `args' string currently
>> being passed to the vsrc_buffer init routine, which will now expect 10
>> colon-separated arguments rather than 5.  This affects only the `buffer'
>> filter.
>> I think there is agreement to place the 5 enums into the AVFilterLink
>> structure.
> I would try to place them in AVFilterBufferRefVideoProps, if it works its
> more flexible
The attached patch places the five enums in AVFilterBufferRefVideoProps, 
initializes them in vsrc_buffer:init() and copies them to each frame in 
vsrc_buffer:request_frame() and avfilter_default_get_video_buffer(). I 
have run it through `make test' with no errors.

One downside to placing the information in AVFilterBufferRefVideoProps 
is that it is not available to the `init' or `config_props' filter 
functions, you don't really understand the input format until the first 
frame is received.  I can live with this in a DrawText filter by 
delaying setup until the first call to `start_frame', but it would be 
much cleaner to have it available in `config_props'.  Would it be 
reasonable to include:

AVFilterBufferRefVideoProps * filterBRVideoProps;

and maybe (thinking ahead):

AVFilterBufferRefAudioProps * filterBRAudioProps;

in AVFilterLInk?  Note that a DrawText filter also needs pixel_aspect to 
properly set up; and I suspect that vf_scale will need to use 
color_range in its config_props routine now that PIX_FMT_YUVJ444P etc. 
have been deprecated in favor of PIX_FMT_YUV444P and setting color_range.

Larry Robinson

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ColorEnumsInAVFilterBufferRefVideoProps.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110112/da18b46f/attachment.asc>

More information about the ffmpeg-devel mailing list