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