rtpdec_jpeg: Write the DHT section properly

Currently the size header of the generated DHT section is
incorrect, making the mjpeg decoder just skip it. Since the
written huffman tables are the default ones, this failure had
gone undetected.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Merge two if statements

This makes the code more readable and robust.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Simplify writing of the jpeg header

Generalize writing of any number of qtables. Don't manually write
16 bit values in two separate calls.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Don't needlessly use a bitstream writer for the header

Everything written with this bitstream writer is 8/16 bit units
(except for a pair of 4 bit values), so using a bitstream writer
isn't necessary.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Don't use a bitstream writer for the EOI marker

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Clarify where the subsampling magic numbers come from

Write out the numbers the way they are constructed, not just the
final values.

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Add more comments about the fields in the SOF0 section

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Simplify the calculation of the number of qtables

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Store and reuse old qtables for q values 128-254

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Fold the default qtables case into an existing if statement

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Disallow using the reserved q values

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpdec_jpeg: Error out on other unsupported type values as well

Signed-off-by: Martin Storsjö <martin@martin.st>
img2dec: always close AVIOContexts

Zero sized files would cause the contexts to leak away.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
file: Add an avoption for disabling truncating existing files on open

Signed-off-by: Martin Storsjö <martin@martin.st>
Add a smooth streaming segmenter muxer

This muxer splits the output from the ismv muxer into individual
files, in realtime.

The same can also be done by the standalone tool ismindex, but this
muxer is needed for doing it in realtime (especially for live
streams that need extra handling for updating the lookahead fields
in the fragment headers).

Using this muxer, one can deliver live smooth streaming from a
normal static file web server. (Using ismindex, one can deliver
premade smooth streaming files from a static file web server,
or prepare files for serving with IIS.)

Signed-off-by: Martin Storsjö <martin@martin.st>
mpegts: check substreams before discarding

Allow to extract the AC3 core from TrueHD with the "copy" codec.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
lavu/audioconvert: add a second low frequency channel.

Can be used by DTS-HD, TrueHD and E-AC-3, among others.

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
mlp_parser: avoid mapping multiple disctinct TrueHD channels to the same Libav channel.

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
lavr/audio_mix_matrix: acknowledge the existence of LFE2.

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
ac3: move ac3_downmix() from dsputil to ac3dsp

Signed-off-by: Mans Rullgard <mans@mansr.com>