Commit Graph

106 Commits

Author SHA1 Message Date
Michael Niedermayer
2924514721 Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'
* commit '9deaec782810d098bca11c9332fab2d2f4c5fb78':
  lavf: move internal fields from public to internal context

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-11 02:47:54 +01:00
wm4
9deaec7828 lavf: move internal fields from public to internal context
This is not an API change; the fields were explicitly declared private
before.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-02-10 21:45:04 +01:00
Paul B Mahol
41456c7d15 avformat/mux: remove unneeded #include, there are no assert() only av_assert*
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-31 08:57:07 +00:00
Michael Niedermayer
ac08c5c0ad avformat/mux: 2 subtitle packets could have the same DTS
Fixes Ticket3514

See: ETSI EN 300 743 V1.3.1 (2006-11)
"In summary, all of the segments of a single display set shall be carried in one (or more) PES packets that have the same
 PTS value."
with PTS = DTS and remuxing of such a stream it is to be expected that sometimes
multiple packets would have the same DTS

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-29 03:57:44 +01:00
Martin Storsjö
4895aa65c6 libavformat: Allow calling av_write_trailer with a NULL AVIOContext
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-19 23:12:58 +02:00
Carl Eugen Hoyos
25ccf5df72 lavf/mux: Always call write_trailer() from av_write_trailer() to avoid a leak.
Fixes ticket #4049.
2014-11-20 10:14:51 +01:00
Michael Niedermayer
9943c5a42b Merge commit '9257692ac15eff7b07540c1f61cebde0d8823fbd'
* commit '9257692ac15eff7b07540c1f61cebde0d8823fbd':
  lavf: Only initialize s->offset once when using avoid_negative_ts make_zero

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-18 02:46:07 +01:00
Martin Storsjö
9257692ac1 lavf: Only initialize s->offset once when using avoid_negative_ts make_zero
When given a stream starting at dts=0, it would previously consider
s->offset as uninitialized and set an offset when the second packet
was written, ending up writing two packets with dts=0. By initializing
this field to AV_NOPTS_VALUE, we make sure that we only initialize it
once, on the first packet.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 23:18:55 +02:00
Michael Niedermayer
0d71e825db Merge commit '897d5c3a4296f3da80b8699d1487328ca2de8e55'
* commit '897d5c3a4296f3da80b8699d1487328ca2de8e55':
  lavf: Print a warning if failed to avoid negative timestamps when requested

Conflicts:
	libavformat/mux.c

See: ec6a5fc6cc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-07 23:22:10 +01:00
Michael Niedermayer
66e49ff3b9 Merge commit '1384df641994bf3d6cb51084290aa94752737bae'
* commit '1384df641994bf3d6cb51084290aa94752737bae':
  lavf: Add an option for avoiding negative timestamps

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

See: 3ba0dab76a
See: a89c012531
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-07 23:09:30 +01:00
Michael Niedermayer
897d5c3a42 lavf: Print a warning if failed to avoid negative timestamps when requested
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 12:11:46 +02:00
Michael Niedermayer
1384df6419 lavf: Add an option for avoiding negative timestamps
This is the same logic as is invoked on AVFMT_TS_NEGATIVE,
but which can be enabled manually, or can be enabled
in muxers which only need it in certain conditions.

Also allow using the same mechanism to force streams to start
at 0.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 12:11:35 +02:00
Michael Niedermayer
042eba52a5 Merge commit '91e8d2eb1f7bf3af949008b106ec1ca037b88b0e'
* commit '91e8d2eb1f7bf3af949008b106ec1ca037b88b0e':
  lavf: use the format context strict_std_compliance instead of the codec one

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-06 13:10:01 +01:00
Anton Khirnov
91e8d2eb1f lavf: use the format context strict_std_compliance instead of the codec one 2014-11-06 09:01:49 +01:00
Michael Niedermayer
ec6a5fc6cc avformat/mux: Fix assertion failure due to max_interleave_delta and poor input
Fixes Ticket4051

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-22 16:28:49 +02:00
Michael Niedermayer
2b37864e7f Merge commit '2d6e58497e76836604364b037df9b00ba3d75b69'
* commit '2d6e58497e76836604364b037df9b00ba3d75b69':
  lavf: switch to AVCodecContext.framerate for demuxing

Conflicts:
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-15 18:19:58 +02:00
Anton Khirnov
2d6e58497e lavf: switch to AVCodecContext.framerate for demuxing 2014-10-15 06:37:55 +00:00
Michael Niedermayer
fc6aa30459 Merge commit 'eb4f9069002e73648f6640cd054fc814cfda75b8'
* commit 'eb4f9069002e73648f6640cd054fc814cfda75b8':
  lavf: More informative error message

Conflicts:
	libavformat/mux.c

See: 30ced7e69f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 20:38:51 +02:00
Luca Barbato
eb4f906900 lavf: More informative error message
Print the timestamp values and not just the stream index.
2014-10-10 16:29:06 +02:00
James Almer
903a0acba4 avformat: remove obsolete FF_API_ALLOC_OUTPUT_CONTEXT cruft
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-05 17:10:07 -03:00
Anton Khirnov
d92550d191 lavf: eliminate ff_get_audio_frame_size()
It is basically a wrapper around av_get_audio_frame_duration(), with a
fallback to AVCodecContext.frame_size. However, that field is set only
when the stream codec context is actually used for encoding or decoding,
which is discouraged.

For muxing, it is generally the responsibility of the caller to set the
packet duration.
For demuxing, if the duration is not stored at the container level, it
should be set by the parser.

Therefore, removing the frame_size fallback should not break any
important case.
(cherry picked from commit 30e50c5027)

Conflicts:

	libavformat/utils.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 03:12:58 +02:00
Michael Niedermayer
fee982048e avformat/mux: flush after header writing, like after packets
This makes problematic unconditional flushes in mpegts redundant
And is thus part of a fix for ticket 2748

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-03 18:10:04 +02:00
Carl Eugen Hoyos
355121bcb5 lavf/mux: Fix a typo checking aspect ratios.
Fixes ticket #3813.
2014-07-30 11:03:29 +02:00
Michael Niedermayer
a06fac353c avformat/mux: ignore delayed vp8/9 packets in max_interleave_delta calculation
libvpx adds very significant delay, which appears normal and we must
buffer all other streams no matter what to interleave them correctly

Fixes Ticket3440

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 01:11:00 +02:00
Michael Niedermayer
351b22caae avformat/mux: support re-interleaving packets in ff_write_chained()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 22:39:22 +02:00
Michael Niedermayer
383a04a127 avformat/mux: keep AVPacket fields consistent in ff_write_chained()
This might have caused double frees in theory, i do not have a test case
though

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 22:33:21 +02:00
Michael Niedermayer
e5cb7795fc Merge commit '324ff59444ff5470bb325ff1e2be7c4b054fc944'
* commit '324ff59444ff5470bb325ff1e2be7c4b054fc944':
  avpacket: Check for and return errors in ff_interleave_add_packet()

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

See: 4d7c71c364
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-17 14:20:10 +02:00
Nidhi Makhijani
324ff59444 avpacket: Check for and return errors in ff_interleave_add_packet()
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-17 03:18:46 -07:00
Michael Niedermayer
c599c211fb avformat/mux: fix flush_packets flag with flushing buffers
Found-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-28 21:23:32 +02:00
Michael Niedermayer
1d54f51084 avformat/mux: simplify ff_choose_timebase()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-18 20:09:55 +02:00
Michael Niedermayer
ac293b6685 Merge commit '194be1f43ea391eb986732707435176e579265aa'
* commit '194be1f43ea391eb986732707435176e579265aa':
  lavf: switch to AVStream.time_base as the hint for the muxer timebase

Conflicts:
	doc/APIchanges
	libavformat/filmstripenc.c
	libavformat/movenc.c
	libavformat/mxfenc.c
	libavformat/oggenc.c
	libavformat/swf.h
	libavformat/version.h
	tests/ref/lavf/mkv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-18 19:49:17 +02:00
Anton Khirnov
194be1f43e lavf: switch to AVStream.time_base as the hint for the muxer timebase
Previously, AVStream.codec.time_base was used for that purpose, which
was quite confusing for the callers. This change also opens the path for
removing AVStream.codec.

The change in the lavf-mkv test is due to the native timebase (1/1000)
being used instead of the default one (1/90000), so the packets are now
sent to the crc muxer in the same order in which they are demuxed
(previously some of them got reordered because of inexact timestamp
conversion).
2014-06-18 15:12:34 +02:00
Michael Niedermayer
bfb3ed1a9d avformat/mux: Dont leave stale side data pointers in ff_interleave_add_packet()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-02 14:48:22 +02:00
Michael Niedermayer
74ece44373 avformat/mux: fix memleak of side data in flac fate tests
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-02 14:38:03 +02:00
Michael Niedermayer
9893e883ea avformat/mux: Remove localized encoder strings
Fixes muxing to end up with a encoder=Lavf... and encoder_eng=somethingelse

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-20 02:46:42 +02:00
Michael Niedermayer
999a99c865 Merge commit 'a312f71090ee620ee252f2034aef6b13e2dafe9c'
* commit 'a312f71090ee620ee252f2034aef6b13e2dafe9c':
  lavf: deprecate now unused AVStream.pts

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

mostly not merged as the code is needed for a/vsync drop handling
and what the code does is what is needed, it could maybe be moved
elsewhere or factored somehow but simply removing it would be droping
these features.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-19 18:38:10 +02:00
Anton Khirnov
a312f71090 lavf: deprecate now unused AVStream.pts 2014-05-19 07:14:24 +02:00
Anton Khirnov
ed7922faac mux: drop one of the hacks comprising compute_pkt_fields2()
All encoders should output proper timestamps now.
2014-05-19 07:14:18 +02:00
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