Revision 4c362a52

View differences:

doc/developer.texi
23 23

  
24 24
@end itemize
25 25

  
26
@section Integrating libavcodec or libavformat in your program
27

  
28
You can integrate all the source code of the libraries to link them
29
statically to avoid any version problem. All you need is to provide a
30
'config.mak' and a 'config.h' in the parent directory. See the defines
31
generated by ./configure to understand what is needed.
32

  
33
You can use libavcodec or libavformat in your commercial program, but
34
@emph{any patch you make must be published}. The best way to proceed is
35
to send your patches to the Libav mailing list.
26
@section Integrating libav in your program
27

  
28
Shared libraries should be used whenever is possible in order to reduce
29
the effort distributors have to pour to support programs and to ensure
30
only the public api is used.
31

  
32
You can use Libav in your commercial program, but you must abide to the
33
license, LGPL or GPL depending on the specific features used, please refer
34
to @url{http://libav.org/legal.html} for a quick checklist and to
35
@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv2},
36
@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv3},
37
@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv2.1},
38
@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv3} for the
39
exact text of the licenses.
40
Any modification to the source code can be suggested for inclusion.
41
The best way to proceed is to send your patches to the Libav mailing list.
36 42

  
37 43
@anchor{Coding Rules}
38 44
@section Coding Rules
......
129 135
   an "or any later version" clause is also acceptable, but LGPL is
130 136
   preferred.
131 137
@item
132
   You must not commit code which breaks Libav! (Meaning unfinished but
133
   enabled code which breaks compilation or compiles but does not work or
134
   breaks the regression tests)
135
   You can commit unfinished stuff (for testing etc), but it must be disabled
136
   (#ifdef etc) by default so it does not interfere with other developers'
137
   work.
138
   All the patches MUST be reviewed in the mailing list before they are
139
   committed.
140
@item
141
   The Libav coding style should remain consistent. Changes to
142
   conform will be suggested during the review or implemented on commit.
143
@item
144
   Patches should be generated using @code{git format-patch} or directly sent
145
   using @code{git send-email}.
146
   Please make sure you give the proper credit by setting the correct author
147
   in the commit.
138 148
@item
139
   You do not have to over-test things. If it works for you, and you think it
140
   should work for others, then commit. If your code has problems
141
   (portability, triggers compiler bugs, unusual environment etc) they will be
142
   reported and eventually fixed.
149
   The commit message should have a short first line in the form of
150
   @samp{topic: short description} as header, separated by a newline
151
   from the body consting in few lines explaining the reason of the patch.
152
   Referring to the issue on the bug tracker does not exempt to report an
153
   excerpt of the bug.
154
@item
155
   Work in progress patches should be sent to the mailing list with the [WIP]
156
   or the [RFC] tag.
157
@item
158
   Branches in public personal repos are advised as way to
159
   work on issues collaboratively.
160
@item
161
   You do not have to over-test things. If it works for you and you think it
162
   should work for others, send it to the mailing list for review.
163
   If you have doubt about portability please state it in the submission so
164
   people with specific hardware could test it.
143 165
@item
144 166
   Do not commit unrelated changes together, split them into self-contained
145 167
   pieces. Also do not forget that if part B depends on part A, but A does not
......
147 169
   Keeping changes well split into self-contained parts makes reviewing and
148 170
   understanding them on the commit log mailing list easier. This also helps
149 171
   in case of debugging later on.
150
   Also if you have doubts about splitting or not splitting, do not hesitate to
151
   ask/discuss it on the developer mailing list.
152
@item
153
   Do not change behavior of the programs (renaming options etc) or public
154
   API or ABI without first discussing it on the libav-devel mailing list.
155
   Do not remove functionality from the code. Just improve!
156

  
157
   Note: Redundant code can be removed.
158
@item
159
   Do not commit changes to the build system (Makefiles, configure script)
160
   which change behavior, defaults etc, without asking first. The same
161
   applies to compiler warning fixes, trivial looking fixes and to code
162
   maintained by other developers. We usually have a reason for doing things
163
   the way we do. Send your changes as patches to the libav-devel mailing
164
   list, and if the code maintainers say OK, you may commit. This does not
165
   apply to files you wrote and/or maintain.
166
@item
167
   We refuse source indentation and other cosmetic changes if they are mixed
168
   with functional changes, such commits will be rejected and removed. Every
169
   developer has his own indentation style, you should not change it. Of course
170
   if you (re)write something, you can use your own style, even though we would
171
   prefer if the indentation throughout Libav was consistent (Many projects
172
   force a given indentation style - we do not.). If you really need to make
173
   indentation changes (try to avoid this), separate them strictly from real
174
   changes.
175

  
176
   NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
177
   then either do NOT change the indentation of the inner part within (do not
178
   move it to the right)! or do so in a separate commit
179
@item
180
   Always fill out the commit log message. Describe in a few lines what you
181
   changed and why. You can refer to mailing list postings if you fix a
182
   particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
183
@item
184
   If you apply a patch by someone else, include the name and email address in
185
   the log message. Since the libav-commits mailing list is publicly
186
   archived you should add some SPAM protection to the email address. Send an
187
   answer to libav-devel (or wherever you got the patch from) saying that
188
   you applied the patch.
172
@item
173
   Patches that change behavior of the programs (renaming options etc) or
174
   public API or ABI should be discussed in depth and possible few days should
175
   pass between discussion and commit.
176
   Changes to the build system (Makefiles, configure script) which alter
177
   the expected behavior should be considered in the same regard.
189 178
@item
190 179
   When applying patches that have been discussed (at length) on the mailing
191 180
   list, reference the thread in the log message.
192 181
@item
193
    Do NOT commit to code actively maintained by others without permission.
194
    Send a patch to libav-devel instead. If no one answers within a reasonable
195
    timeframe (12h for build failures and security fixes, 3 days small changes,
196
    1 week for big patches) then commit your patch if you think it is OK.
197
    Also note, the maintainer can simply ask for more time to review!
198
@item
199
    Subscribe to the libav-commits mailing list. The diffs of all commits
200
    are sent there and reviewed by all the other developers. Bugs and possible
201
    improvements or general questions regarding commits are discussed there. We
202
    expect you to react if problems with your code are uncovered.
182
    Subscribe to the libav-devel and libav-commits mailing list.
183
    Bugs and possible improvements or general questions regarding commits
184
    are discussed on libav-devel. We expect you to react if problems with
185
    your code are uncovered.
203 186
@item
204 187
    Update the documentation if you change behavior or add features. If you are
205
    unsure how best to do this, send a patch to libav-devel, the documentation
206
    maintainer(s) will review and commit your stuff.
188
    unsure how best to do this, send an [RFC] patch to libav-devel.
207 189
@item
208
    Try to keep important discussions and requests (also) on the public
209
    developer mailing list, so that all developers can benefit from them.
190
    All discussions and decisions should be reported on the public developer
191
    mailing list, so that there is a reference to them.
192
    Other media (e.g. IRC) should be used for coordination and immediate
193
    collaboration.
210 194
@item
211 195
    Never write to unallocated memory, never write over the end of arrays,
212 196
    always check values read from some untrusted source before using them
213
    as array index or other risky things.
197
    as array index or other risky things. Always use valgrind to doublecheck.
214 198
@item
215 199
    Remember to check if you need to bump versions for the specific libav
216 200
    parts (libavutil, libavcodec, libavformat) you are changing. You need
......
223 207
    Incrementing the third component means a noteworthy binary compatible
224 208
    change (e.g. encoder bug fix that matters for the decoder).
225 209
@item
226
    Compiler warnings indicate potential bugs or code with bad style. If a type of
227
    warning always points to correct and clean code, that warning should
228
    be disabled, not the code changed.
229
    Thus the remaining warnings can either be bugs or correct code.
210
    Compiler warnings indicate potential bugs or code with bad style.
230 211
    If it is a bug, the bug has to be fixed. If it is not, the code should
231 212
    be changed to not generate a warning unless that causes a slowdown
232 213
    or obfuscates the code.
214
    If a type of warning leads to too many false positives, that warning
215
    should be disabled, not the code changed.
233 216
@item
234 217
    If you add a new file, give it a proper license header. Do not copy and
235 218
    paste it from a random place, use an existing file as template.
......
237 220

  
238 221
We think our rules are not too hard. If you have comments, contact us.
239 222

  
240
Note, these rules are mostly borrowed from the MPlayer project.
223
Note, some rules were borrowed from the MPlayer project.
241 224

  
242 225
@section Submitting patches
243 226

  
244
First, (@pxref{Coding Rules}) above if you did not yet.
245

  
246
When you submit your patch, try to send a unified diff (diff '-up'
247
option). We cannot read other diffs :-)
227
First, read the (@pxref{Coding Rules}) above if you did not yet, in particular
228
the rules regarding patch submission.
248 229

  
249
Also please do not submit a patch which contains several unrelated changes.
230
As stated already, please do not submit a patch which contains several
231
unrelated changes.
250 232
Split it into separate, self-contained pieces. This does not mean splitting
251 233
file by file. Instead, make the patch as small as possible while still
252 234
keeping it as a logical unit that contains an individual change, even
......
256 238
Use the patcheck tool of Libav to check your patch.
257 239
The tool is located in the tools directory.
258 240

  
259
Run the regression tests before submitting a patch so that you can
260
verify that there are no big problems.
241
Run the @pxref{Regression Tests} before submitting a patch in order to verify
242
it does not cause unexpected problems.
261 243

  
262 244
Patches should be posted as base64 encoded attachments (or any other
263 245
encoding which ensures that the patch will not be trashed during
......
266 248

  
267 249
It also helps quite a bit if you tell us what the patch does (for example
268 250
'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant
269
and has no lrint()')
251
and has no lrint()'). This kind of explanation should be the body of the
252
commit message.
270 253

  
271 254
Also please if you send several patches, send each patch as a separate mail,
272 255
do not attach several unrelated patches to the same mail.
273 256

  
257
Use @code{git send-email} when possible since it will properly send patches
258
without requiring extra care.
259

  
274 260
Your patch will be reviewed on the mailing list. You will likely be asked
275 261
to make some changes and are expected to send in an improved version that
276 262
incorporates the requests from the review. This process may go through
277
several iterations. Once your patch is deemed good enough, some developer
278
will pick it up and commit it to the official Libav tree.
263
several iterations. Once your patch is deemed good enough, it will be
264
committed to the official Libav tree.
279 265

  
280 266
Give us a few days to react. But if some time passes without reaction,
281 267
send a reminder by email. Your patch should eventually be dealt with.
......
301 287
    even if it is only a decoder?
302 288
@item
303 289
    Did you add a rule to compile the appropriate files in the Makefile?
304
    Remember to do this even if you're just adding a format to a file that is
305
    already being compiled by some other rule, like a raw demuxer.
290
    Remember to do this even if you are just adding a format to a file that
291
    is already being compiled by some other rule, like a raw demuxer.
306 292
@item
307 293
    Did you add an entry to the table of supported formats or codecs in
308 294
    @file{doc/general.texi}?
......
312 298
    If it depends on a parser or a library, did you add that dependency in
313 299
    configure?
314 300
@item
315
    Did you "git add" the appropriate files before committing?
301
    Did you @code{git add} the appropriate files before committing?
316 302
@end enumerate
317 303

  
318 304
@section patch submission checklist
......
323 309
@item
324 310
    Does @code{make checkheaders} pass with the patch applied?
325 311
@item
326
    Is the patch a unified diff?
327
@item
328 312
    Is the patch against latest Libav git master branch?
329 313
@item
330
    Are you subscribed to ffmpeg-dev?
331
    (the list is subscribers only due to spam)
314
    Are you subscribed to libav-devel?
315
    (@url{https://lists.libav.org/mailman/listinfo/libav-devel}
316
     the list is subscribers)
332 317
@item
333 318
    Have you checked that the changes are minimal, so that the same cannot be
334 319
    achieved with a smaller patch and/or simpler final code?
......
344 329
    tools/trasher and the noise bitstream filter. Your decoder or demuxer
345 330
    should not crash or end in a (near) infinite loop when fed damaged data.
346 331
@item
347
    Is the patch created from the root of the source tree, so it can be
348
    applied with @code{patch -p0}?
349
@item
350 332
    Does the patch not mix functional and cosmetic changes?
351 333
@item
352 334
    Did you add tabs or trailing whitespace to the code? Both are forbidden.
......
381 363
@item
382 364
    Lines with similar content should be aligned vertically when doing so
383 365
    improves readability.
384
@item
385
    Did you provide a suggestion for a clear commit log message?
386 366
@end enumerate
387 367

  
388 368
@section Patch review process
......
401 381
We will review all submitted patches, but sometimes we are quite busy so
402 382
especially for large patches this can take several weeks.
403 383

  
404
When resubmitting patches, please do not make any significant changes
405
not related to the comments received during review. Such patches will
406
be rejected. Instead, submit  significant changes or new features as
407
separate patches.
408

  
409
@section Regression tests
410

  
411
Before submitting a patch (or committing to the repository), you should at least
412
test that you did not break anything.
384
When resubmitting patches, if their size grew or during the review different
385
issues arisen please split the patch so each issue has a specific patch.
413 386

  
414
The regression tests build a synthetic video stream and a synthetic
415
audio stream. These are then encoded and decoded with all codecs or
416
formats. The CRC (or MD5) of each generated file is recorded in a
417
result file. A 'diff' is launched to compare the reference results and
418
the result file. The output is checked immediately after each test
419
has run.
387
@anchor{Regression Tests}
388
@section Regression Tests
420 389

  
421
The regression tests then go on to test the FFserver code with a
422
limited set of streams. It is important that this step runs correctly
423
as well.
390
Before submitting a patch (or committing to the repository), you should at
391
least make sure that it does not break anything.
424 392

  
425
Run 'make test' to test all the codecs and formats. Commands like
426
'make regtest-mpeg2' can be used to run a single test. By default,
427
make will abort if any test fails. To run all tests regardless,
428
use make -k. To get a more verbose output, use 'make V=1 test' or
429
'make V=2 test'.
393
If the code changed has already a test present in FATE you should run it,
394
otherwise it is advised to add it.
430 395

  
431
Run 'make fulltest' to test all the codecs, formats and FFserver.
396
Improvements to codec or demuxer might change the FATE results. Make sure
397
to commit the update reference with the change and to explain in the comment
398
why the expected result changed.
432 399

  
433
[Of course, some patches may change the results of the regression tests. In
434
this case, the reference results of the regression tests shall be modified
435
accordingly].
400
Please refer to @file{doc/fate.txt}.
436 401

  
437 402
@bye

Also available in: Unified diff