annotate ffmpeg/doc/developer.texi @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 \input texinfo @c -*- texinfo -*-
yading@10 2
yading@10 3 @settitle Developer Documentation
yading@10 4 @titlepage
yading@10 5 @center @titlefont{Developer Documentation}
yading@10 6 @end titlepage
yading@10 7
yading@10 8 @top
yading@10 9
yading@10 10 @contents
yading@10 11
yading@10 12 @chapter Developers Guide
yading@10 13
yading@10 14 @section API
yading@10 15 @itemize @bullet
yading@10 16 @item libavcodec is the library containing the codecs (both encoding and
yading@10 17 decoding). Look at @file{doc/examples/decoding_encoding.c} to see how to use
yading@10 18 it.
yading@10 19
yading@10 20 @item libavformat is the library containing the file format handling (mux and
yading@10 21 demux code for several formats). Look at @file{ffplay.c} to use it in a
yading@10 22 player. See @file{doc/examples/muxing.c} to use it to generate audio or video
yading@10 23 streams.
yading@10 24
yading@10 25 @end itemize
yading@10 26
yading@10 27 @section Integrating libavcodec or libavformat in your program
yading@10 28
yading@10 29 You can integrate all the source code of the libraries to link them
yading@10 30 statically to avoid any version problem. All you need is to provide a
yading@10 31 'config.mak' and a 'config.h' in the parent directory. See the defines
yading@10 32 generated by ./configure to understand what is needed.
yading@10 33
yading@10 34 You can use libavcodec or libavformat in your commercial program, but
yading@10 35 @emph{any patch you make must be published}. The best way to proceed is
yading@10 36 to send your patches to the FFmpeg mailing list.
yading@10 37
yading@10 38 @section Contributing
yading@10 39
yading@10 40 There are 3 ways by which code gets into ffmpeg.
yading@10 41 @itemize @bullet
yading@10 42 @item Submitting Patches to the main developer mailing list
yading@10 43 see @ref{Submitting patches} for details.
yading@10 44 @item Directly committing changes to the main tree.
yading@10 45 @item Committing changes to a git clone, for example on github.com or
yading@10 46 gitorious.org. And asking us to merge these changes.
yading@10 47 @end itemize
yading@10 48
yading@10 49 Whichever way, changes should be reviewed by the maintainer of the code
yading@10 50 before they are committed. And they should follow the @ref{Coding Rules}.
yading@10 51 The developer making the commit and the author are responsible for their changes
yading@10 52 and should try to fix issues their commit causes.
yading@10 53
yading@10 54 @anchor{Coding Rules}
yading@10 55 @section Coding Rules
yading@10 56
yading@10 57 @subsection Code formatting conventions
yading@10 58
yading@10 59 There are the following guidelines regarding the indentation in files:
yading@10 60 @itemize @bullet
yading@10 61 @item
yading@10 62 Indent size is 4.
yading@10 63 @item
yading@10 64 The TAB character is forbidden outside of Makefiles as is any
yading@10 65 form of trailing whitespace. Commits containing either will be
yading@10 66 rejected by the git repository.
yading@10 67 @item
yading@10 68 You should try to limit your code lines to 80 characters; however, do so if
yading@10 69 and only if this improves readability.
yading@10 70 @end itemize
yading@10 71 The presentation is one inspired by 'indent -i4 -kr -nut'.
yading@10 72
yading@10 73 The main priority in FFmpeg is simplicity and small code size in order to
yading@10 74 minimize the bug count.
yading@10 75
yading@10 76 @subsection Comments
yading@10 77 Use the JavaDoc/Doxygen format (see examples below) so that code documentation
yading@10 78 can be generated automatically. All nontrivial functions should have a comment
yading@10 79 above them explaining what the function does, even if it is just one sentence.
yading@10 80 All structures and their member variables should be documented, too.
yading@10 81
yading@10 82 Avoid Qt-style and similar Doxygen syntax with @code{!} in it, i.e. replace
yading@10 83 @code{//!} with @code{///} and similar. Also @@ syntax should be employed
yading@10 84 for markup commands, i.e. use @code{@@param} and not @code{\param}.
yading@10 85
yading@10 86 @example
yading@10 87 /**
yading@10 88 * @@file
yading@10 89 * MPEG codec.
yading@10 90 * @@author ...
yading@10 91 */
yading@10 92
yading@10 93 /**
yading@10 94 * Summary sentence.
yading@10 95 * more text ...
yading@10 96 * ...
yading@10 97 */
yading@10 98 typedef struct Foobar@{
yading@10 99 int var1; /**< var1 description */
yading@10 100 int var2; ///< var2 description
yading@10 101 /** var3 description */
yading@10 102 int var3;
yading@10 103 @} Foobar;
yading@10 104
yading@10 105 /**
yading@10 106 * Summary sentence.
yading@10 107 * more text ...
yading@10 108 * ...
yading@10 109 * @@param my_parameter description of my_parameter
yading@10 110 * @@return return value description
yading@10 111 */
yading@10 112 int myfunc(int my_parameter)
yading@10 113 ...
yading@10 114 @end example
yading@10 115
yading@10 116 @subsection C language features
yading@10 117
yading@10 118 FFmpeg is programmed in the ISO C90 language with a few additional
yading@10 119 features from ISO C99, namely:
yading@10 120 @itemize @bullet
yading@10 121 @item
yading@10 122 the @samp{inline} keyword;
yading@10 123 @item
yading@10 124 @samp{//} comments;
yading@10 125 @item
yading@10 126 designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
yading@10 127 @item
yading@10 128 compound literals (@samp{x = (struct s) @{ 17, 23 @};})
yading@10 129 @end itemize
yading@10 130
yading@10 131 These features are supported by all compilers we care about, so we will not
yading@10 132 accept patches to remove their use unless they absolutely do not impair
yading@10 133 clarity and performance.
yading@10 134
yading@10 135 All code must compile with recent versions of GCC and a number of other
yading@10 136 currently supported compilers. To ensure compatibility, please do not use
yading@10 137 additional C99 features or GCC extensions. Especially watch out for:
yading@10 138 @itemize @bullet
yading@10 139 @item
yading@10 140 mixing statements and declarations;
yading@10 141 @item
yading@10 142 @samp{long long} (use @samp{int64_t} instead);
yading@10 143 @item
yading@10 144 @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
yading@10 145 @item
yading@10 146 GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
yading@10 147 @end itemize
yading@10 148
yading@10 149 @subsection Naming conventions
yading@10 150 All names should be composed with underscores (_), not CamelCase. For example,
yading@10 151 @samp{avfilter_get_video_buffer} is an acceptable function name and
yading@10 152 @samp{AVFilterGetVideo} is not. The exception from this are type names, like
yading@10 153 for example structs and enums; they should always be in the CamelCase
yading@10 154
yading@10 155 There are the following conventions for naming variables and functions:
yading@10 156 @itemize @bullet
yading@10 157 @item
yading@10 158 For local variables no prefix is required.
yading@10 159 @item
yading@10 160 For file-scope variables and functions declared as @code{static}, no prefix
yading@10 161 is required.
yading@10 162 @item
yading@10 163 For variables and functions visible outside of file scope, but only used
yading@10 164 internally by a library, an @code{ff_} prefix should be used,
yading@10 165 e.g. @samp{ff_w64_demuxer}.
yading@10 166 @item
yading@10 167 For variables and functions visible outside of file scope, used internally
yading@10 168 across multiple libraries, use @code{avpriv_} as prefix, for example,
yading@10 169 @samp{avpriv_aac_parse_header}.
yading@10 170 @item
yading@10 171 Each library has its own prefix for public symbols, in addition to the
yading@10 172 commonly used @code{av_} (@code{avformat_} for libavformat,
yading@10 173 @code{avcodec_} for libavcodec, @code{swr_} for libswresample, etc).
yading@10 174 Check the existing code and choose names accordingly.
yading@10 175 Note that some symbols without these prefixes are also exported for
yading@10 176 retro-compatibility reasons. These exceptions are declared in the
yading@10 177 @code{lib<name>/lib<name>.v} files.
yading@10 178 @end itemize
yading@10 179
yading@10 180 Furthermore, name space reserved for the system should not be invaded.
yading@10 181 Identifiers ending in @code{_t} are reserved by
yading@10 182 @url{http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html#tag_02_02_02, POSIX}.
yading@10 183 Also avoid names starting with @code{__} or @code{_} followed by an uppercase
yading@10 184 letter as they are reserved by the C standard. Names starting with @code{_}
yading@10 185 are reserved at the file level and may not be used for externally visible
yading@10 186 symbols. If in doubt, just avoid names starting with @code{_} altogether.
yading@10 187
yading@10 188 @subsection Miscellaneous conventions
yading@10 189 @itemize @bullet
yading@10 190 @item
yading@10 191 fprintf and printf are forbidden in libavformat and libavcodec,
yading@10 192 please use av_log() instead.
yading@10 193 @item
yading@10 194 Casts should be used only when necessary. Unneeded parentheses
yading@10 195 should also be avoided if they don't make the code easier to understand.
yading@10 196 @end itemize
yading@10 197
yading@10 198 @subsection Editor configuration
yading@10 199 In order to configure Vim to follow FFmpeg formatting conventions, paste
yading@10 200 the following snippet into your @file{.vimrc}:
yading@10 201 @example
yading@10 202 " indentation rules for FFmpeg: 4 spaces, no tabs
yading@10 203 set expandtab
yading@10 204 set shiftwidth=4
yading@10 205 set softtabstop=4
yading@10 206 set cindent
yading@10 207 set cinoptions=(0
yading@10 208 " Allow tabs in Makefiles.
yading@10 209 autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
yading@10 210 " Trailing whitespace and tabs are forbidden, so highlight them.
yading@10 211 highlight ForbiddenWhitespace ctermbg=red guibg=red
yading@10 212 match ForbiddenWhitespace /\s\+$\|\t/
yading@10 213 " Do not highlight spaces at the end of line while typing on that line.
yading@10 214 autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/
yading@10 215 @end example
yading@10 216
yading@10 217 For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
yading@10 218 @example
yading@10 219 (c-add-style "ffmpeg"
yading@10 220 '("k&r"
yading@10 221 (c-basic-offset . 4)
yading@10 222 (indent-tabs-mode . nil)
yading@10 223 (show-trailing-whitespace . t)
yading@10 224 (c-offsets-alist
yading@10 225 (statement-cont . (c-lineup-assignments +)))
yading@10 226 )
yading@10 227 )
yading@10 228 (setq c-default-style "ffmpeg")
yading@10 229 @end example
yading@10 230
yading@10 231 @section Development Policy
yading@10 232
yading@10 233 @enumerate
yading@10 234 @item
yading@10 235 Contributions should be licensed under the
yading@10 236 @uref{http://www.gnu.org/licenses/lgpl-2.1.html, LGPL 2.1},
yading@10 237 including an "or any later version" clause, or, if you prefer
yading@10 238 a gift-style license, the
yading@10 239 @uref{http://www.isc.org/software/license/, ISC} or
yading@10 240 @uref{http://mit-license.org/, MIT} license.
yading@10 241 @uref{http://www.gnu.org/licenses/gpl-2.0.html, GPL 2} including
yading@10 242 an "or any later version" clause is also acceptable, but LGPL is
yading@10 243 preferred.
yading@10 244 @item
yading@10 245 You must not commit code which breaks FFmpeg! (Meaning unfinished but
yading@10 246 enabled code which breaks compilation or compiles but does not work or
yading@10 247 breaks the regression tests)
yading@10 248 You can commit unfinished stuff (for testing etc), but it must be disabled
yading@10 249 (#ifdef etc) by default so it does not interfere with other developers'
yading@10 250 work.
yading@10 251 @item
yading@10 252 The commit message should have a short first line in the form of
yading@10 253 a @samp{topic: short description} as a header, separated by a newline
yading@10 254 from the body consisting of an explanation of why the change is necessary.
yading@10 255 If the commit fixes a known bug on the bug tracker, the commit message
yading@10 256 should include its bug ID. Referring to the issue on the bug tracker does
yading@10 257 not exempt you from writing an excerpt of the bug in the commit message.
yading@10 258 @item
yading@10 259 You do not have to over-test things. If it works for you, and you think it
yading@10 260 should work for others, then commit. If your code has problems
yading@10 261 (portability, triggers compiler bugs, unusual environment etc) they will be
yading@10 262 reported and eventually fixed.
yading@10 263 @item
yading@10 264 Do not commit unrelated changes together, split them into self-contained
yading@10 265 pieces. Also do not forget that if part B depends on part A, but A does not
yading@10 266 depend on B, then A can and should be committed first and separate from B.
yading@10 267 Keeping changes well split into self-contained parts makes reviewing and
yading@10 268 understanding them on the commit log mailing list easier. This also helps
yading@10 269 in case of debugging later on.
yading@10 270 Also if you have doubts about splitting or not splitting, do not hesitate to
yading@10 271 ask/discuss it on the developer mailing list.
yading@10 272 @item
yading@10 273 Do not change behavior of the programs (renaming options etc) or public
yading@10 274 API or ABI without first discussing it on the ffmpeg-devel mailing list.
yading@10 275 Do not remove functionality from the code. Just improve!
yading@10 276
yading@10 277 Note: Redundant code can be removed.
yading@10 278 @item
yading@10 279 Do not commit changes to the build system (Makefiles, configure script)
yading@10 280 which change behavior, defaults etc, without asking first. The same
yading@10 281 applies to compiler warning fixes, trivial looking fixes and to code
yading@10 282 maintained by other developers. We usually have a reason for doing things
yading@10 283 the way we do. Send your changes as patches to the ffmpeg-devel mailing
yading@10 284 list, and if the code maintainers say OK, you may commit. This does not
yading@10 285 apply to files you wrote and/or maintain.
yading@10 286 @item
yading@10 287 We refuse source indentation and other cosmetic changes if they are mixed
yading@10 288 with functional changes, such commits will be rejected and removed. Every
yading@10 289 developer has his own indentation style, you should not change it. Of course
yading@10 290 if you (re)write something, you can use your own style, even though we would
yading@10 291 prefer if the indentation throughout FFmpeg was consistent (Many projects
yading@10 292 force a given indentation style - we do not.). If you really need to make
yading@10 293 indentation changes (try to avoid this), separate them strictly from real
yading@10 294 changes.
yading@10 295
yading@10 296 NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
yading@10 297 then either do NOT change the indentation of the inner part within (do not
yading@10 298 move it to the right)! or do so in a separate commit
yading@10 299 @item
yading@10 300 Always fill out the commit log message. Describe in a few lines what you
yading@10 301 changed and why. You can refer to mailing list postings if you fix a
yading@10 302 particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
yading@10 303 Recommended format:
yading@10 304 area changed: Short 1 line description
yading@10 305
yading@10 306 details describing what and why and giving references.
yading@10 307 @item
yading@10 308 Make sure the author of the commit is set correctly. (see git commit --author)
yading@10 309 If you apply a patch, send an
yading@10 310 answer to ffmpeg-devel (or wherever you got the patch from) saying that
yading@10 311 you applied the patch.
yading@10 312 @item
yading@10 313 When applying patches that have been discussed (at length) on the mailing
yading@10 314 list, reference the thread in the log message.
yading@10 315 @item
yading@10 316 Do NOT commit to code actively maintained by others without permission.
yading@10 317 Send a patch to ffmpeg-devel instead. If no one answers within a reasonable
yading@10 318 timeframe (12h for build failures and security fixes, 3 days small changes,
yading@10 319 1 week for big patches) then commit your patch if you think it is OK.
yading@10 320 Also note, the maintainer can simply ask for more time to review!
yading@10 321 @item
yading@10 322 Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
yading@10 323 are sent there and reviewed by all the other developers. Bugs and possible
yading@10 324 improvements or general questions regarding commits are discussed there. We
yading@10 325 expect you to react if problems with your code are uncovered.
yading@10 326 @item
yading@10 327 Update the documentation if you change behavior or add features. If you are
yading@10 328 unsure how best to do this, send a patch to ffmpeg-devel, the documentation
yading@10 329 maintainer(s) will review and commit your stuff.
yading@10 330 @item
yading@10 331 Try to keep important discussions and requests (also) on the public
yading@10 332 developer mailing list, so that all developers can benefit from them.
yading@10 333 @item
yading@10 334 Never write to unallocated memory, never write over the end of arrays,
yading@10 335 always check values read from some untrusted source before using them
yading@10 336 as array index or other risky things.
yading@10 337 @item
yading@10 338 Remember to check if you need to bump versions for the specific libav*
yading@10 339 parts (libavutil, libavcodec, libavformat) you are changing. You need
yading@10 340 to change the version integer.
yading@10 341 Incrementing the first component means no backward compatibility to
yading@10 342 previous versions (e.g. removal of a function from the public API).
yading@10 343 Incrementing the second component means backward compatible change
yading@10 344 (e.g. addition of a function to the public API or extension of an
yading@10 345 existing data structure).
yading@10 346 Incrementing the third component means a noteworthy binary compatible
yading@10 347 change (e.g. encoder bug fix that matters for the decoder). The third
yading@10 348 component always starts at 100 to distinguish FFmpeg from Libav.
yading@10 349 @item
yading@10 350 Compiler warnings indicate potential bugs or code with bad style. If a type of
yading@10 351 warning always points to correct and clean code, that warning should
yading@10 352 be disabled, not the code changed.
yading@10 353 Thus the remaining warnings can either be bugs or correct code.
yading@10 354 If it is a bug, the bug has to be fixed. If it is not, the code should
yading@10 355 be changed to not generate a warning unless that causes a slowdown
yading@10 356 or obfuscates the code.
yading@10 357 @item
yading@10 358 If you add a new file, give it a proper license header. Do not copy and
yading@10 359 paste it from a random place, use an existing file as template.
yading@10 360 @end enumerate
yading@10 361
yading@10 362 We think our rules are not too hard. If you have comments, contact us.
yading@10 363
yading@10 364 @anchor{Submitting patches}
yading@10 365 @section Submitting patches
yading@10 366
yading@10 367 First, read the @ref{Coding Rules} above if you did not yet, in particular
yading@10 368 the rules regarding patch submission.
yading@10 369
yading@10 370 When you submit your patch, please use @code{git format-patch} or
yading@10 371 @code{git send-email}. We cannot read other diffs :-)
yading@10 372
yading@10 373 Also please do not submit a patch which contains several unrelated changes.
yading@10 374 Split it into separate, self-contained pieces. This does not mean splitting
yading@10 375 file by file. Instead, make the patch as small as possible while still
yading@10 376 keeping it as a logical unit that contains an individual change, even
yading@10 377 if it spans multiple files. This makes reviewing your patches much easier
yading@10 378 for us and greatly increases your chances of getting your patch applied.
yading@10 379
yading@10 380 Use the patcheck tool of FFmpeg to check your patch.
yading@10 381 The tool is located in the tools directory.
yading@10 382
yading@10 383 Run the @ref{Regression tests} before submitting a patch in order to verify
yading@10 384 it does not cause unexpected problems.
yading@10 385
yading@10 386 It also helps quite a bit if you tell us what the patch does (for example
yading@10 387 'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant
yading@10 388 and has no lrint()')
yading@10 389
yading@10 390 Also please if you send several patches, send each patch as a separate mail,
yading@10 391 do not attach several unrelated patches to the same mail.
yading@10 392
yading@10 393 Patches should be posted to the
yading@10 394 @uref{http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel}
yading@10 395 mailing list. Use @code{git send-email} when possible since it will properly
yading@10 396 send patches without requiring extra care. If you cannot, then send patches
yading@10 397 as base64-encoded attachments, so your patch is not trashed during
yading@10 398 transmission.
yading@10 399
yading@10 400 Your patch will be reviewed on the mailing list. You will likely be asked
yading@10 401 to make some changes and are expected to send in an improved version that
yading@10 402 incorporates the requests from the review. This process may go through
yading@10 403 several iterations. Once your patch is deemed good enough, some developer
yading@10 404 will pick it up and commit it to the official FFmpeg tree.
yading@10 405
yading@10 406 Give us a few days to react. But if some time passes without reaction,
yading@10 407 send a reminder by email. Your patch should eventually be dealt with.
yading@10 408
yading@10 409
yading@10 410 @section New codecs or formats checklist
yading@10 411
yading@10 412 @enumerate
yading@10 413 @item
yading@10 414 Did you use av_cold for codec initialization and close functions?
yading@10 415 @item
yading@10 416 Did you add a long_name under NULL_IF_CONFIG_SMALL to the AVCodec or
yading@10 417 AVInputFormat/AVOutputFormat struct?
yading@10 418 @item
yading@10 419 Did you bump the minor version number (and reset the micro version
yading@10 420 number) in @file{libavcodec/version.h} or @file{libavformat/version.h}?
yading@10 421 @item
yading@10 422 Did you register it in @file{allcodecs.c} or @file{allformats.c}?
yading@10 423 @item
yading@10 424 Did you add the AVCodecID to @file{avcodec.h}?
yading@10 425 When adding new codec IDs, also add an entry to the codec descriptor
yading@10 426 list in @file{libavcodec/codec_desc.c}.
yading@10 427 @item
yading@10 428 If it has a FourCC, did you add it to @file{libavformat/riff.c},
yading@10 429 even if it is only a decoder?
yading@10 430 @item
yading@10 431 Did you add a rule to compile the appropriate files in the Makefile?
yading@10 432 Remember to do this even if you're just adding a format to a file that is
yading@10 433 already being compiled by some other rule, like a raw demuxer.
yading@10 434 @item
yading@10 435 Did you add an entry to the table of supported formats or codecs in
yading@10 436 @file{doc/general.texi}?
yading@10 437 @item
yading@10 438 Did you add an entry in the Changelog?
yading@10 439 @item
yading@10 440 If it depends on a parser or a library, did you add that dependency in
yading@10 441 configure?
yading@10 442 @item
yading@10 443 Did you @code{git add} the appropriate files before committing?
yading@10 444 @item
yading@10 445 Did you make sure it compiles standalone, i.e. with
yading@10 446 @code{configure --disable-everything --enable-decoder=foo}
yading@10 447 (or @code{--enable-demuxer} or whatever your component is)?
yading@10 448 @end enumerate
yading@10 449
yading@10 450
yading@10 451 @section patch submission checklist
yading@10 452
yading@10 453 @enumerate
yading@10 454 @item
yading@10 455 Does @code{make fate} pass with the patch applied?
yading@10 456 @item
yading@10 457 Was the patch generated with git format-patch or send-email?
yading@10 458 @item
yading@10 459 Did you sign off your patch? (git commit -s)
yading@10 460 See @url{http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/SubmittingPatches} for the meaning
yading@10 461 of sign off.
yading@10 462 @item
yading@10 463 Did you provide a clear git commit log message?
yading@10 464 @item
yading@10 465 Is the patch against latest FFmpeg git master branch?
yading@10 466 @item
yading@10 467 Are you subscribed to ffmpeg-devel?
yading@10 468 (the list is subscribers only due to spam)
yading@10 469 @item
yading@10 470 Have you checked that the changes are minimal, so that the same cannot be
yading@10 471 achieved with a smaller patch and/or simpler final code?
yading@10 472 @item
yading@10 473 If the change is to speed critical code, did you benchmark it?
yading@10 474 @item
yading@10 475 If you did any benchmarks, did you provide them in the mail?
yading@10 476 @item
yading@10 477 Have you checked that the patch does not introduce buffer overflows or
yading@10 478 other security issues?
yading@10 479 @item
yading@10 480 Did you test your decoder or demuxer against damaged data? If no, see
yading@10 481 tools/trasher, the noise bitstream filter, and
yading@10 482 @uref{http://caca.zoy.org/wiki/zzuf, zzuf}. Your decoder or demuxer
yading@10 483 should not crash, end in a (near) infinite loop, or allocate ridiculous
yading@10 484 amounts of memory when fed damaged data.
yading@10 485 @item
yading@10 486 Does the patch not mix functional and cosmetic changes?
yading@10 487 @item
yading@10 488 Did you add tabs or trailing whitespace to the code? Both are forbidden.
yading@10 489 @item
yading@10 490 Is the patch attached to the email you send?
yading@10 491 @item
yading@10 492 Is the mime type of the patch correct? It should be text/x-diff or
yading@10 493 text/x-patch or at least text/plain and not application/octet-stream.
yading@10 494 @item
yading@10 495 If the patch fixes a bug, did you provide a verbose analysis of the bug?
yading@10 496 @item
yading@10 497 If the patch fixes a bug, did you provide enough information, including
yading@10 498 a sample, so the bug can be reproduced and the fix can be verified?
yading@10 499 Note please do not attach samples >100k to mails but rather provide a
yading@10 500 URL, you can upload to ftp://upload.ffmpeg.org
yading@10 501 @item
yading@10 502 Did you provide a verbose summary about what the patch does change?
yading@10 503 @item
yading@10 504 Did you provide a verbose explanation why it changes things like it does?
yading@10 505 @item
yading@10 506 Did you provide a verbose summary of the user visible advantages and
yading@10 507 disadvantages if the patch is applied?
yading@10 508 @item
yading@10 509 Did you provide an example so we can verify the new feature added by the
yading@10 510 patch easily?
yading@10 511 @item
yading@10 512 If you added a new file, did you insert a license header? It should be
yading@10 513 taken from FFmpeg, not randomly copied and pasted from somewhere else.
yading@10 514 @item
yading@10 515 You should maintain alphabetical order in alphabetically ordered lists as
yading@10 516 long as doing so does not break API/ABI compatibility.
yading@10 517 @item
yading@10 518 Lines with similar content should be aligned vertically when doing so
yading@10 519 improves readability.
yading@10 520 @item
yading@10 521 Consider to add a regression test for your code.
yading@10 522 @item
yading@10 523 If you added YASM code please check that things still work with --disable-yasm
yading@10 524 @item
yading@10 525 Make sure you check the return values of function and return appropriate
yading@10 526 error codes. Especially memory allocation functions like @code{av_malloc()}
yading@10 527 are notoriously left unchecked, which is a serious problem.
yading@10 528 @item
yading@10 529 Test your code with valgrind and or Address Sanitizer to ensure it's free
yading@10 530 of leaks, out of array accesses, etc.
yading@10 531 @end enumerate
yading@10 532
yading@10 533 @section Patch review process
yading@10 534
yading@10 535 All patches posted to ffmpeg-devel will be reviewed, unless they contain a
yading@10 536 clear note that the patch is not for the git master branch.
yading@10 537 Reviews and comments will be posted as replies to the patch on the
yading@10 538 mailing list. The patch submitter then has to take care of every comment,
yading@10 539 that can be by resubmitting a changed patch or by discussion. Resubmitted
yading@10 540 patches will themselves be reviewed like any other patch. If at some point
yading@10 541 a patch passes review with no comments then it is approved, that can for
yading@10 542 simple and small patches happen immediately while large patches will generally
yading@10 543 have to be changed and reviewed many times before they are approved.
yading@10 544 After a patch is approved it will be committed to the repository.
yading@10 545
yading@10 546 We will review all submitted patches, but sometimes we are quite busy so
yading@10 547 especially for large patches this can take several weeks.
yading@10 548
yading@10 549 If you feel that the review process is too slow and you are willing to try to
yading@10 550 take over maintainership of the area of code you change then just clone
yading@10 551 git master and maintain the area of code there. We will merge each area from
yading@10 552 where its best maintained.
yading@10 553
yading@10 554 When resubmitting patches, please do not make any significant changes
yading@10 555 not related to the comments received during review. Such patches will
yading@10 556 be rejected. Instead, submit significant changes or new features as
yading@10 557 separate patches.
yading@10 558
yading@10 559 @anchor{Regression tests}
yading@10 560 @section Regression tests
yading@10 561
yading@10 562 Before submitting a patch (or committing to the repository), you should at least
yading@10 563 test that you did not break anything.
yading@10 564
yading@10 565 Running 'make fate' accomplishes this, please see @url{fate.html} for details.
yading@10 566
yading@10 567 [Of course, some patches may change the results of the regression tests. In
yading@10 568 this case, the reference results of the regression tests shall be modified
yading@10 569 accordingly].
yading@10 570
yading@10 571 @subsection Adding files to the fate-suite dataset
yading@10 572
yading@10 573 When there is no muxer or encoder available to generate test media for a
yading@10 574 specific test then the media has to be inlcuded in the fate-suite.
yading@10 575 First please make sure that the sample file is as small as possible to test the
yading@10 576 respective decoder or demuxer sufficiently. Large files increase network
yading@10 577 bandwidth and disk space requirements.
yading@10 578 Once you have a working fate test and fate sample, provide in the commit
yading@10 579 message or introductionary message for the patch series that you post to
yading@10 580 the ffmpeg-devel mailing list, a direct link to download the sample media.
yading@10 581
yading@10 582
yading@10 583 @subsection Visualizing Test Coverage
yading@10 584
yading@10 585 The FFmpeg build system allows visualizing the test coverage in an easy
yading@10 586 manner with the coverage tools @code{gcov}/@code{lcov}. This involves
yading@10 587 the following steps:
yading@10 588
yading@10 589 @enumerate
yading@10 590 @item
yading@10 591 Configure to compile with instrumentation enabled:
yading@10 592 @code{configure --toolchain=gcov}.
yading@10 593 @item
yading@10 594 Run your test case, either manually or via FATE. This can be either
yading@10 595 the full FATE regression suite, or any arbitrary invocation of any
yading@10 596 front-end tool provided by FFmpeg, in any combination.
yading@10 597 @item
yading@10 598 Run @code{make lcov} to generate coverage data in HTML format.
yading@10 599 @item
yading@10 600 View @code{lcov/index.html} in your preferred HTML viewer.
yading@10 601 @end enumerate
yading@10 602
yading@10 603 You can use the command @code{make lcov-reset} to reset the coverage
yading@10 604 measurements. You will need to rerun @code{make lcov} after running a
yading@10 605 new test.
yading@10 606
yading@10 607 @anchor{Release process}
yading@10 608 @section Release process
yading@10 609
yading@10 610 FFmpeg maintains a set of @strong{release branches}, which are the
yading@10 611 recommended deliverable for system integrators and distributors (such as
yading@10 612 Linux distributions, etc.). At regular times, a @strong{release
yading@10 613 manager} prepares, tests and publishes tarballs on the
yading@10 614 @url{http://ffmpeg.org} website.
yading@10 615
yading@10 616 There are two kinds of releases:
yading@10 617
yading@10 618 @enumerate
yading@10 619 @item
yading@10 620 @strong{Major releases} always include the latest and greatest
yading@10 621 features and functionality.
yading@10 622 @item
yading@10 623 @strong{Point releases} are cut from @strong{release} branches,
yading@10 624 which are named @code{release/X}, with @code{X} being the release
yading@10 625 version number.
yading@10 626 @end enumerate
yading@10 627
yading@10 628 Note that we promise to our users that shared libraries from any FFmpeg
yading@10 629 release never break programs that have been @strong{compiled} against
yading@10 630 previous versions of @strong{the same release series} in any case!
yading@10 631
yading@10 632 However, from time to time, we do make API changes that require adaptations
yading@10 633 in applications. Such changes are only allowed in (new) major releases and
yading@10 634 require further steps such as bumping library version numbers and/or
yading@10 635 adjustments to the symbol versioning file. Please discuss such changes
yading@10 636 on the @strong{ffmpeg-devel} mailing list in time to allow forward planning.
yading@10 637
yading@10 638 @anchor{Criteria for Point Releases}
yading@10 639 @subsection Criteria for Point Releases
yading@10 640
yading@10 641 Changes that match the following criteria are valid candidates for
yading@10 642 inclusion into a point release:
yading@10 643
yading@10 644 @enumerate
yading@10 645 @item
yading@10 646 Fixes a security issue, preferably identified by a @strong{CVE
yading@10 647 number} issued by @url{http://cve.mitre.org/}.
yading@10 648 @item
yading@10 649 Fixes a documented bug in @url{https://ffmpeg.org/trac/ffmpeg}.
yading@10 650 @item
yading@10 651 Improves the included documentation.
yading@10 652 @item
yading@10 653 Retains both source code and binary compatibility with previous
yading@10 654 point releases of the same release branch.
yading@10 655 @end enumerate
yading@10 656
yading@10 657 The order for checking the rules is (1 OR 2 OR 3) AND 4.
yading@10 658
yading@10 659
yading@10 660 @subsection Release Checklist
yading@10 661
yading@10 662 The release process involves the following steps:
yading@10 663
yading@10 664 @enumerate
yading@10 665 @item
yading@10 666 Ensure that the @file{RELEASE} file contains the version number for
yading@10 667 the upcoming release.
yading@10 668 @item
yading@10 669 Add the release at @url{https://ffmpeg.org/trac/ffmpeg/admin/ticket/versions}.
yading@10 670 @item
yading@10 671 Announce the intent to do a release to the mailing list.
yading@10 672 @item
yading@10 673 Make sure all relevant security fixes have been backported. See
yading@10 674 @url{https://ffmpeg.org/security.html}.
yading@10 675 @item
yading@10 676 Ensure that the FATE regression suite still passes in the release
yading@10 677 branch on at least @strong{i386} and @strong{amd64}
yading@10 678 (cf. @ref{Regression tests}).
yading@10 679 @item
yading@10 680 Prepare the release tarballs in @code{bz2} and @code{gz} formats, and
yading@10 681 supplementing files that contain @code{gpg} signatures
yading@10 682 @item
yading@10 683 Publish the tarballs at @url{http://ffmpeg.org/releases}. Create and
yading@10 684 push an annotated tag in the form @code{nX}, with @code{X}
yading@10 685 containing the version number.
yading@10 686 @item
yading@10 687 Propose and send a patch to the @strong{ffmpeg-devel} mailing list
yading@10 688 with a news entry for the website.
yading@10 689 @item
yading@10 690 Publish the news entry.
yading@10 691 @item
yading@10 692 Send announcement to the mailing list.
yading@10 693 @end enumerate
yading@10 694
yading@10 695 @bye