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 html

1 全部名字都用下劃線而非以大小寫來區分的駱駝命名法。固然結構體和共用體的名字用駱駝命名法來命名。

2 變量和函數的命名規範

There are the following conventions for naming variables and functions: ide

  • 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. 函數

相關文章
相關標籤/搜索