ffmpeg开发者文档中的命名规范

All names should be composed with underscores (_), not CamelCase. For example, ‘avfilter_get_video_buffer’ is an acceptable function name and ‘AVFilterGetVideo’ is not. The exception from this are type names, like for example structs and enums; they should always be in the CamelCase

1 所有名字都用下划线而非以大小写来区分的骆驼命名法。当然结构体和共用体的名字用骆驼命名法来命名。

2 变量和函数的命名规范

There are the following conventions for naming variables and functions:

  • For local variables no prefix is required.
  • 1 局部变量不用带前缀

  • For file-scope variables and functions declared as static, no prefix is required.
  • 2 定义为static的文件作用域内的变量和函数不用带前缀

  • For variables and functions visible outside of file scope, but only used internally by a library, an ff_ prefix should be used, e.g. ‘ff_w64_demuxer’.
  • 3 在文件作用域可见但是只在库内部使用的,使用ff_前缀

  • For variables and functions visible outside of file scope, used internally across multiple libraries, use avpriv_ as prefix, for example, ‘avpriv_aac_parse_header’.
  • 4 在文件作用域可见,同时跨多个库内部使用,使用avpriv_前缀

  • Each library has its own prefix for public symbols, in addition to the commonly used av_ (avformat_ for libavformat, avcodec_ for libavcodec, swr_ for libswresample, etc). Check the existing code and choose names accordingly. Note that some symbols without these prefixes are also exported for retro-compatibility reasons. These exceptions are declared in the lib<name>/lib<name>.v files.
  • 5 除了广泛使用的av_前缀之外,每一个库有它自己的前缀和公用符号,其中libavformat库有avformat_,libavcodec库有avcodec_,libswresample库有swr_前缀等。

Furthermore, name space reserved for the system should not be invaded. Identifiers ending in _t are reserved by POSIX. Also avoid names starting with __ or _followed by an uppercase letter as they are reserved by the C standard. Names starting with _ are reserved at the file level and may not be used for externally visible symbols. If in doubt, just avoid names starting with _ altogether.

 

你可能感兴趣的:(ffmpeg开发者文档中的命名规范)