[Ffmpeg-devel] Naming conventions

Michael Niedermayer michaelni
Tue Mar 6 14:47:25 CET 2007


Hi

On Tue, Mar 06, 2007 at 01:29:37PM -0000, M?ns Rullg?rd wrote:
> 
> 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.

that would end with av_picture_size_get() not av_picture_get_size() then or?


> 
> > 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.

same hierachical ends with av_picture_size_get() not av_picture_get_size()

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070306/9b470f89/attachment.pgp>



More information about the ffmpeg-devel mailing list