[Ffmpeg-devel] Naming conventions

Måns Rullgård mans
Tue Mar 6 14:29:37 CET 2007

Robert Swain said:
> Michael Niedermayer wrote:
>> avpicture_get_size would that be av_picture_get_size or av_picture_size_get ?
>> i think giving functions natural english names is better
>> av_get_size_of_picture maybe?
> av_get_picture_size would make more sense to me.
>> 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() ?
>> none is strictly correct its type is timebase and related variables
> It depends what you think is more logical - hierarchical naming or grammatical
> naming.
> The grammatical seems to follow something like
> av_<action/function>_<type>_<property>

Following English grammar, yes.  Many languages, e.g. Japanese, have a
subject-object-verb order.  In this context, there is no subject, leaving
the object and verb.

> Regarding av_set_pts_info, this would suggest to me that the information being
> set pertains to pts and nothing more, that is, pts is the type and info is the
> property. I'm not sure this is what should be the case though. Similarly
> av_set_stream_timebase, the timebase is 'of' the stream, so the stream is the
> type and the timebase is the property of the thing of that type.
> My conclusion for av_set_pts_info is that if info is a subset of pts then it's
> correct, else it should probably be called av_set_info_pts.
> Also, I don't really like using 'type' in the above definition. At the risk of
> getting shot, I would be inclined to think of this as the following:
> av_<action>_<class hierarchy>_<property>
> But what do I know? :)

Very little, I'm afraid ;-)

I personally prefer a hierarchical naming scheme.  It appears more consistent
to me, the "grammatical" style having more of an ad-hoc appearance.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list