Commit Graph

268 Commits

Author SHA1 Message Date
Michael Niedermayer f478e8500a Merge commit 'c9281a01b78cc3f09e36300a0ca3f5824d1c74cf'
* commit 'c9281a01b78cc3f09e36300a0ca3f5824d1c74cf':
  lavf: drop the zero-sized packets hack

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 19:24:19 +02:00
Michael Niedermayer eacf7d650d Merge commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52'
* commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52':
  lavf: add AVFMT_FLAG_BITEXACT.

Conflicts:
	doc/APIchanges
	libavformat/avformat.h
	libavformat/flacenc.c
	libavformat/movenc.c
	libavformat/oggenc.c
	libavformat/options_table.h
	libavformat/version.h
	tests/fate/video.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 19:16:57 +02:00
Anton Khirnov c9281a01b7 lavf: drop the zero-sized packets hack
There should not be any valid reason anymore for passing completely
empty packets to lavf.
OTOH side data-only packets can be useful.
2014-05-15 07:50:47 +02:00
Anton Khirnov 0c1959b056 lavf: add AVFMT_FLAG_BITEXACT.
Use it instead of checking CODEC_FLAG_BITEXACT in the first stream's
codec context.

Using codec options inside lavf is fragile and can easily break when the
muxing codec context is not the encoding context.
2014-05-15 07:42:07 +02:00
Lukasz Marek c9a12fdd2d lavf/mux: pass options to nested structs of priv data
This is continuation of commit 330d547e
Nested struct is set in two places.
Previous commit set nested struct only in one case.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-04 14:46:37 +02:00
Lukasz Marek 330d547ef3 lavf/mux: pass options to nested structs of priv data
This commit allows to benefit from implementing child_next
callback for muxers' AVClasses.
Without that, options cannot be set in nested structs.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-02 18:04:05 +02:00
Michael Niedermayer dc6a17cf74 avformat/mux: Check for and remove invalid packet durations
Fixes assertion failure
Fixes Ticket3575

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-23 06:55:33 +02:00
Reimar Döffinger 8cbf0827e1 Various small spelling fixes.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-04-22 20:44:31 +02:00
Michael Niedermayer a89c012531 avformat/mux: support shifting timestamps so they start at 0
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-22 22:39:49 +01:00
Nicolas George 916a79227e lavf/mux: check av_dup_packet() return value.
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-20 02:58:39 +01:00
Nicolas George 1b05ac220e lavf: add write_uncoded_frame() API. 2014-02-11 10:29:02 +01:00
Michael Niedermayer 8560fdc451 Merge commit '394fb56c29eee7f4f8f0334d8b5d30d3c54ac703'
* commit '394fb56c29eee7f4f8f0334d8b5d30d3c54ac703':
  lavf: always unref the packet passed to av_interleaved_write_frame() on error

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-10 20:30:58 +01:00
Anton Khirnov 394fb56c29 lavf: always unref the packet passed to av_interleaved_write_frame() on error 2014-02-10 15:08:06 +01:00
Michael Niedermayer 3adb5f8d8b Merge commit 'd9ae1031f5edbd25c8526b4cb51aba66d3bee931'
* commit 'd9ae1031f5edbd25c8526b4cb51aba66d3bee931':
  lavf: improve handling of sparse streams when muxing

Conflicts:
	doc/APIchanges
	libavformat/avformat.h
	libavformat/mux.c
	libavformat/options_table.h
	libavformat/version.h

See: 37ed5df5c5
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-05 03:19:22 +01:00
Luca Barbato d9ae1031f5 lavf: improve handling of sparse streams when muxing
Currently ff_interleave_packet_per_dts() waits until it gets a frame for
each stream before outputting packets in interleaved order.

Sparse streams (i.e. streams with much fewer packets than the other
streams, like subtitles or audio with DTX) tend to add up latency and in
specific cases end up allocating a large amount of memory.

Emit the top packet from the packet_buffer if it has a time delta
larger than a specified threshold.

Original report of the issue and initial proposed solution by
mus.svz@gmail.com.

Bug-id: 31
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-02-04 22:01:42 +01:00
Michael Niedermayer 073e771c9c Merge commit '33c859c142ef3f49b7a6227014ad92a680cf4d74'
* commit '33c859c142ef3f49b7a6227014ad92a680cf4d74':
  lavf: ignore attachment streams for interleaving purposes

Conflicts:
	libavformat/avformat.h
	libavformat/internal.h
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-04 15:37:05 +01:00
Michael Niedermayer 5144d91996 Merge commit '7b03b65bf0d02519c86750d2da33f413e11cf0c6'
* commit '7b03b65bf0d02519c86750d2da33f413e11cf0c6':
  lavf: do basic sanity checking on muxed packets

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-04 15:17:29 +01:00
Anton Khirnov 33c859c142 lavf: ignore attachment streams for interleaving purposes
Those streams should never get any packets by definition.
2014-02-04 11:17:06 +01:00
Anton Khirnov 7b03b65bf0 lavf: do basic sanity checking on muxed packets
Reject packets for non-existing or attachment streams.
2014-02-04 11:10:55 +01:00
Stefano Sabatini 5871ee5072 lavf: add output_ts_offset option to AVFormatContext
This option can be generally useful to set an output offset, needed when
setting an absolute index in the output.
2014-02-02 13:16:17 +01:00
Michael Niedermayer e9a26dc5bf avformat/mux: fix "no tag found" check in validate_codec_tag()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 22:30:31 +01:00
Stefano Sabatini d37d4b6e40 lavf/mux: improve feedback in case of no streams in muxer 2013-12-15 20:04:06 +01:00
James Almer 618bdb7f58 lavf/mux: Don't write "encoder" metadata tag when bitexact is requested
Since we don't write lavf's string when bitexact is requested, this will
prevent the tag from being copied from the source stream.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-06 19:33:41 +01:00
Michael Niedermayer 96e6447d62 Merge commit '596e5d4783ca951258a7c580951fd161f1785ec1'
* commit '596e5d4783ca951258a7c580951fd161f1785ec1':
  lavf: Add a flag to enable/disable per-packet flushing

Conflicts:
	libavformat/avformat.h
	libavformat/mux.c
	libavformat/version.h

This adds a 2nd API to set per packet flushing
If the user application indicates through either a non default then this non default takes
precedence over the other still default value

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-17 12:01:35 +02:00
Luca Barbato 596e5d4783 lavf: Add a flag to enable/disable per-packet flushing
This is enabled by default and can be disabled with
"-fflags -flush_packets".

Inspired by a patch from Nicolas George <nicolas.george@normalesup.org>.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:11:08 +03:00
Michael Niedermayer 20be5e0a0e Merge commit '7950e519bb094897f957b9a9531cc60ba46cbc91'
* commit '7950e519bb094897f957b9a9531cc60ba46cbc91':
  Disable deprecation warnings for cases where a replacement is available

Conflicts:
	libavcodec/avpacket.c
	libavcodec/pthread.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavfilter/avfiltergraph.c
	libavfilter/buffersrc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-03 10:08:30 +02:00
Diego Biurrun 7950e519bb Disable deprecation warnings for cases where a replacement is available 2013-08-02 19:19:02 +02:00
Stefano Sabatini 08b99be7c4 lavf/mux: rename variable cortag -> tagbuf2 in init_muxer()
Possibly enhance readibility.
2013-06-26 23:22:22 +02:00
Michael Niedermayer f48366c704 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavf: don't abort if both encoder and muxer aspect ratios are not set

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-24 11:42:42 +02:00
Rafaël Carré e21307a2b0 lavf: don't abort if both encoder and muxer aspect ratios are not set
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-06-24 08:03:26 +02:00
Michael Niedermayer 8097307bfb Merge commit '12db891dcd57b305d6e3c1e22ea8204dc26edda1'
* commit '12db891dcd57b305d6e3c1e22ea8204dc26edda1':
  avf: move ff_write_chained to mux.c

Conflicts:
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-16 23:58:59 +02:00
Luca Barbato 12db891dcd avf: move ff_write_chained to mux.c 2013-06-16 14:41:07 +02:00
Vignesh Venkatasubramanian 98c292a7a8 Adding support for encoding VP8 Alpha
This patch adds support for encoding VP8 files with alpha. The alpha channel
is encoded separately and the output is placed in AVPacket's side_data. The
muxer then muxes it into the BlockAdditional element of the matroska container.
More details on spec here: http://goo.gl/wCP1y

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-17 15:11:23 +02:00
Michael Niedermayer efc08e00cc Merge commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110'
* commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110':
  vf_aspect: use the name 's' for the pointer to the private context
  Remove commented-out debug #define cruft

Conflicts:
	libavcodec/4xm.c
	libavcodec/dvdsubdec.c
	libavcodec/ituh263dec.c
	libavcodec/mpeg12.c
	libavfilter/avfilter.c
	libavfilter/vf_aspect.c
	libavfilter/vf_fieldorder.c
	libavformat/rtmpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-16 09:56:43 +02:00
Diego Biurrun 2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Michael Niedermayer a5ba4e186b Merge commit 'e926b5ceb1962833f0c884a328382bc2eca67aff'
* commit 'e926b5ceb1962833f0c884a328382bc2eca67aff':
  avformat: Drop unnecessary ff_ name prefixes from static functions

Conflicts:
	libavformat/audiointerleave.c
	libavformat/mux.c
	libavformat/mxfenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-01 18:28:48 +02:00
Diego Biurrun e926b5ceb1 avformat: Drop unnecessary ff_ name prefixes from static functions 2013-04-30 16:16:23 +02:00
Michael Niedermayer ba323d67fa avformat/write_packet: drop disabled code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 14:57:56 +02:00
Michael Niedermayer eba33396f0 avformat/mux: set avoid_negative_ts based on flags if not overridden by user or muxer
This changes the default to avoid negative timestamps.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 14:51:47 +02:00
Michael Niedermayer 647f306b46 avformat/mux: assert that timestamps are positive after offsetting them
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 14:51:47 +02:00
Michael Niedermayer c329195a27 avformat/mux: use a local variable for offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 14:51:47 +02:00
Michael Niedermayer 060f14f493 avformat/mux: change avoid_negative_ts code to support later addition of AVStreams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 14:51:47 +02:00
Michael Niedermayer c4bf740225 Merge commit 'c2cb01d418dd18e1cf997c038d37378d773121be'
* commit 'c2cb01d418dd18e1cf997c038d37378d773121be':
  lavf: introduce AVFMT_TS_NEGATIVE

Conflicts:
	libavformat/avformat.h
	libavformat/mux.c
	tests/ref/lavf/asf
	tests/ref/lavf/mkv
	tests/ref/lavf/mpg
	tests/ref/lavf/ts
	tests/ref/seek/lavf-asf
	tests/ref/seek/lavf-mkv
	tests/ref/seek/lavf-mpg
	tests/ref/seek/lavf-ts

This commit does not change the default ts behaviour, such
change will, if its done, be done separately.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-26 10:59:45 +02:00
Luca Barbato c2cb01d418 lavf: introduce AVFMT_TS_NEGATIVE
Most formats do not support negative timestamps, shift them to avoid
unexpected behaviour and a number of bad crashes.

CC:libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-04-25 10:13:27 +02:00
Michael Niedermayer a286940da1 mux: also call avio_flush() when flushing the muxer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-08 13:31:12 +02:00
Nicolas George 4f112a8e34 lavf/mux: add the flush_packets option.
Note: a lot of muxers already do the flushing explicitly.
2013-03-24 23:19:07 +01:00
Michael Niedermayer 06a8350599 Merge commit '7b486ab13bfcfa88a7cd92586de50e49966ec292'
* commit '7b486ab13bfcfa88a7cd92586de50e49966ec292':
  lavf: remove disabled FF_API_AV_GETTIME cruft
  lavf: remove disabled FF_API_INTERLEAVE_PACKET cruft

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:37:03 +01:00
Anton Khirnov 32e5194969 lavf: remove disabled FF_API_INTERLEAVE_PACKET cruft 2013-03-11 18:23:10 +01:00
Michael Niedermayer 2653e12520 Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
  avpacket: use AVBuffer to allow refcounting the packets.

Conflicts:
	libavcodec/avpacket.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavformat/avidec.c
	libavformat/flacdec.c
	libavformat/id3v2.c
	libavformat/matroskaenc.c
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:12:03 +01:00
Anton Khirnov 1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Michael Niedermayer 46730e7a0c mux/chunked interleaver: better align duration chunks.
This code causes the chunking to tend toward more optimal
alignment between streams.
The first chunks can still be less optimal aligned
2013-01-17 15:11:02 +01:00
Michael Niedermayer 69a96f9d4c mux: de-obfuscate chunked interleaver checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 15:08:50 +01:00
Michael Niedermayer c57c1329a9 mux: simplify chunking interleaver code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 14:45:30 +01:00
Michael Niedermayer 1191db31c1 mux: fix chunked interleaver
The code did not account properly for packets that where added to
the end of the packet list. Also flags for such packets where not
set correctly leading to incorrect chunked interleaving.

Reported-by: bcoudurier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-16 20:22:58 +01:00
Michael Niedermayer cae11e4031 mux: fix chunked_duration rounding anomaly
a small value was rounded to 0 and then treated special as if
chunked_duration was 0. This led to a inconsistency that further led
to wrong interleaving

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-16 13:49:02 +01:00
Michael Niedermayer d641ee94b5 lavf: Fix assignments in if()
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-14 13:12:55 +02:00
Michael Niedermayer 1ac5a8d7e3 lavf/mux: Fix assignments in if()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 05:05:41 +01:00
Clément Bœsch 119d70db50 lavf/mux: do not pass a copy of the packet to write_packet().
Sometimes the muxer modifies the packet, like for instance lavf/mp3enc
changing pkt->destruct in order to keep a copy. These changes must be
kept, even though the muxer behaviour is questionable. Regression since
0072116.

Fixes #2124.
2013-01-08 23:21:05 +01:00
Clément Bœsch 0072116ccb lavf: split packets before muxing.
After demuxing, data and side are merged. Before decoding, they are
split. Encoder will perform with data and side split. This means that a
muxer can receive split data (after encoding) but also merged data (if
called directly after demuxing). This commit makes sure data and side
are split for the muxer.
2012-12-20 16:13:52 +01:00
Michael Niedermayer f2a7e1a62b mux: change 1 assert->av_assert1()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-07 23:31:27 +02:00
Michael Niedermayer 5e6439a125 ff_choose_timebase: only try factors upto 14
otherwise a unexpected timebase could be choosen
that is one that is thousand times more precisse than requested
which can have sideeffects.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-03 21:38:56 +02:00
Michael Niedermayer de707bc8bd mux/nut: factorize ff_choose_timebase() out of nut
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-03 21:34:43 +02:00
Michael Niedermayer dd78e1090b Merge commit '1e46c63eb72be752e044ba32257d77f35cbd9dac'
* commit '1e46c63eb72be752e044ba32257d77f35cbd9dac':
  avformat: refactor avformat_write_header

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-02 18:48:56 +02:00
Michael Niedermayer 6cbbf4a274 Merge commit '86bbdf865e04bc5ddc2021b0620e6de634375253'
* commit '86bbdf865e04bc5ddc2021b0620e6de634375253':
  avformat: refactor avformat_write_header

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-02 18:36:09 +02:00
Michael Niedermayer 513042c926 Merge commit '55f9037f38bc3beacb2f5a17408c1d24c077d7fd'
* commit '55f9037f38bc3beacb2f5a17408c1d24c077d7fd':
  avformat: split muxing functions from util.c

Conflicts:
	libavformat/internal.h
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-02 18:20:24 +02:00
Luca Barbato 1e46c63eb7 avformat: refactor avformat_write_header
Split away option settings, sanity checks and general setup.
2012-10-01 19:57:57 +02:00
Luca Barbato 86bbdf865e avformat: refactor avformat_write_header
Mostly cosmetic changes adding some intermediate to shorten the lines.
2012-10-01 19:57:57 +02:00
Luca Barbato 55f9037f38 avformat: split muxing functions from util.c 2012-10-01 19:57:57 +02:00