[Ffmpeg-devel] Naming conventions

Baptiste Coudurier baptiste.coudurier
Tue Mar 6 13:37:00 CET 2007


Hi

Michael Niedermayer wrote:
> Hi
> 
> On Mon, Mar 05, 2007 at 04:16:16PM +0100, Panagiotis Issaris wrote:
> [...]
>> I think all agree that all public API functions should be prefixed with
>> at least "av" and possibly "av_".
> 
> i prefer av_
> 
> 
>> Personally, I see various possibilities for structuring function names.
>>
>> The names could in some way include:
>>
>> * The name of the library: So, a prefix such as avc, avu and avf. It has
> 
> iam against avc_ avu_ avf_
> 
> 
> [...]
>> * The name of the type "it works on". Libavformat uses this for some of
>> its functions: av_parser_init, av_parser_parse, av_parser_change,
>> av_bitstream_filter_init, avpicture_alloc, avpicture_free, ...
>>
>> * And of course the actual description of what the function does, the
>> action.
>>
>> How should these possibly included parts be ordered? The previously
>> mentioned functionnames used the "type_action" order, but there also
>> appear functions which do not use this order:
>> av_init_packet, av_new_packet, av_get_packet, av_dup_packet,
>> av_free_packet, ...
>>
>>
>> _Personally_, I prefer the "type_action" type of names, and having all
>> of them prefixed with some FFmpeg specific part, so that the chance of
>> namecollisions is greatly reduced.
>>
>>
>> What do you think?
> 
> i do prefer av_get_packet over av_packet_get as its more natural
> what actually what is the advantage of type_action?

I also prefer, I assume av_get_packet is missing one word though, it
should be av_"byteio/stream/format"_get_packet, that's why
av_picture_get_size is more natural to me, also the more Im used to
functions/names, the more I tend to like it I admit.

> also based on this more significant name first policy you would end with
> names like
> 
> AVContextCodec

:/

> and what about
> 
> avpicture_get_size would that be av_picture_get_size or av_picture_size_get ?

av_picture_get_size, av_picture_fill, av_picture_pad ...

> i think giving functions natural english names is better
> 
> av_get_size_of_picture maybe?

Reasonnably shortest, av_picture_get_size, av_pict_g_sz is not reasonable.

> or lets try av_set_pts_info()
> should that become av_pts_info_set() or av_info_pts_set() or
> maybe av_stream_timebase_set() ?

av_stream_set_timebase yes.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list