[FFmpeg-devel] [PATCH 4/8] lavu/opt: extend AVOptionRange by second value
Lukasz Marek
lukasz.m.luki2 at gmail.com
Sun Mar 23 15:52:49 CET 2014
On 08.03.2014 22:00, Nicolas George wrote:
> Le tridi 13 ventôse, an CCXXII, Lukasz Marek a écrit :
>> OK, I tried to make it different, we have following function:
>>
>> int av_opt_query_ranges(AVOptionRanges **, void *obj, const char
>> *key, int flags);
>>
>> AVOptionRanges is **. We can return more than one struct without any
>> changes to API.
>>
>> So querying option size will return 2 x AVOptionRanges, querying
>> color may return 3/4 x AVOptionRanges.
>
> I believe this is a very good idea.
>
>> AVOptionRanges may be extended by one filed "option_name" for example
>>
>> typedef struct AVOptionRanges {
>> AVOptionRange **range;
>> int nb_ranges;
>> char *option_name
>> } AVOptionRanges;
>>
>> So, when querying for example "window_size" it would return one
>> struct with option_name set to "window_size.width" and struct with
>> option_name set to "window_size.height".
>>
>> in general option_name param would return option name with suffix
>> that would be defined per option type. all AVoptionRanges will
>> require to return the same number of AVOptionRange structs.
>
> I do not think it is necessary: the name of the option is known by the
> caller, and the order of the components is determined by the option type.
> Parsing a string is not very convenient anyway.
>
>> av_opt_query_ranges so far returns >=0 for success, it can be
>> redefined to return number of AVOptionRanges.
>
> That seems like an obvious change.
I attached a patch that implements this.
The problem I noticed later is how to free it.
I added nb_components to AVOptionRanges, but this field is duplicated
for each component which is probably not the best.
If you have any other solution to solve freeing then give a hint.
I pushed whole working branch to my repo github.com/lukaszmluki/ffmpeg
where implementation for opengl is also available and can be tested with
tools/device_capabilities
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-opt-extend-AVOptionRange-by-extra-values.patch
Type: text/x-patch
Size: 5020 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140323/48c1ce24/attachment.bin>
More information about the ffmpeg-devel
mailing list