Commit Graph

10137 Commits

Author SHA1 Message Date
Vittorio Giovara 4b39cc1a09 riff: support ProRes in avi (APCN fourcc) 2014-11-14 20:24:38 +01:00
Martin Storsjö 9a5ac36b69 movenc: Require samples before trying to write edts
This avoids a potential crash if writing a fragmented psp mp4
(which probably is only a hypothetical scenario).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:14:21 +02:00
Martin Storsjö 8cb7b7b461 movenc: Avoid leaking locally allocated data when returning on errors
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:14:08 +02:00
Martin Storsjö 95a449d3ce movenc: Remove an outdated comment
QuickTime does support files with an empty initial movie
these days.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:13:37 +02:00
Martin Storsjö 9cbf70fa0e movenc: Write correct presentation timestamps in tfra
Previously we wrote decoding timestamps here, while the specs
say it should be presentation timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 14:50:06 +02:00
Martin Storsjö e7d20f12c5 movenc: Remove a now redundant check
When using the new first_trun flag instead of checking the track id,
we don't need to have a special case for the separate_moof flag
any longer.

This simplifies the complicated codepath ever so slightly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 13:46:19 +02:00
Martin Storsjö 1d8a0c1b43 movenc: Allow to request not to use edit lists
In this case, shift tracks to start from zero instead (potentially
stretching the first sample in tracks that start later than the
first one).

Some software does not support edit lists at all, the adobe flash
player seems to be one of these. This results in AV sync errors when
edit lists are used to adjust AV sync.

Some players, such as QuickTime, don't respect the duration for
audio packets, so if an audio track starts later than the video
track and the first audio sample gets a duration longer than the
actual amount of data in it, the result will be out of sync.

Based on patches by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 12:11:46 +02: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
Anton Khirnov 05e59135b3 nutdec: do not set has_b_frames
It is not supposed to be set by demuxers.
2014-11-06 09:05:37 +01:00
Anton Khirnov e839de0f85 oggenc: accept only STREAMINFO extradata
The reasoning is the same as for
0097cbea69.
2014-11-06 09:04:32 +01:00
Anton Khirnov 7784f47762 lavf: stop using avpriv_flac_parse_streaminfo()
The only parameters needed by the demuxers are the sample rate and sample
count, which can be trivially extracted manually, without resorting to
an avpriv function.
2014-11-06 09:02:25 +01:00
Anton Khirnov 56dc46a189 riffenc: do not fall back on AVCodecContext.frame_size for MP3
It will not be set unless the codec context is used as the encoding
context, which is discouraged. For MP2, av_get_audio_frame_duration()
will already set the frame size properly. For MP3, set the frame size
explicitly.
2014-11-06 09:02:08 +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
Anton Khirnov 2f3fadfbe3 lavc,lavf: switch to the new vorbis parse API 2014-11-06 09:00:46 +01:00
Anton Khirnov 5e80fb7ff2 lavc: add a public API for parsing vorbis packets.
It is required by (at least) the ogg demuxer.

Mark the current semi-public apriv API for removal.
2014-11-06 08:51:25 +01:00
Anton Khirnov 6896f95b24 vorbis_parser: add an AV prefix to VorbisParseContext
This is done in preparation for making it public.
2014-11-06 08:47:54 +01:00
Martin Storsjö a490391157 rtmpproto: Ignore errors from the getStreamLength method
It is never an error if this method failed. If rt->live was
explicitly set to 0 (known to be a recorded file), print it
as a warning, otherwise print it as a debug message.

Based on a patch by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-05 09:18:22 +02:00
Martin Storsjö 2f221b6a93 movenc: Define the flag bits using shifts instead of as decimal numbers
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-03 11:43:58 +02:00
Martin Storsjö aae6b3b918 movenc: Don't write any iso brands in ismv files
We deviate slightly from the iso specs for these files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:17:00 +02:00
Martin Storsjö c55d1d382c movenc: Don't write any tfdt atom for ismv files
The tfdt atom shouldn't be needed in those cases, we already
write tfxd atoms for ismv anyway, which is roughly equivalent.

This avoids having to declare the iso6 brand for ismv files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:16:56 +02:00
Martin Storsjö 00c67fe1d0 movenc: Write a 0 duration in mdhd and tkhd for an empty initial moov
ISO/IEC 14496-12:2012/Cor 1:2013 is explicit about how this should be
handled. All zeros doesn't mean that the full file has got a zero
duration, only that the track samples described within the initial moov
have got zero duration. An all ones duration means an indeterminate
duration.

Keep writing a duration consisting of all ones for the ISM mode -
older windows media player versions won't play a file if this is
zero. (Newer windows media player versions play either version fine.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:16:50 +02:00
Martin Storsjö cf589faa5b movenc: Add a flag for using default-base-is-moof in tfhd atoms
Similarly to the omit_tfhd_offset flag added in e7bf085b, this
avoids writing absolute byte positions to the file, making them
more easily streamable.

This is a new feature from 14496-12:2012, so application support
isn't necessarily too widespread yet (support for it in libav was
added in 20f95f21f in July 2014).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:04:04 +02:00
Martin Storsjö 600d5ee6b1 movenc: Signal iso6 in compatible_brands when using tfdt
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:03:52 +02:00
Martin Storsjö 1e0b81abe8 movenc: Use a local variable consistently
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:03:45 +02:00
Martin Storsjö b2b79eca6f movenc: Don't check the custom IO flag when using faststart
The custom IO flag actually never is set for muxers, only for
demuxers, so the check was pointless (unless a user intentionally
would set the flag to signal using custom IO).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:02:02 +02:00
Martin Storsjö 573b1de2d7 movenc: Don't use track_id to decide which track is the first in a moof
If one track doesn't have any samples within a moof, no traf/trun
is written for it. When the omit_tfhd_offset flag is set, none
of the tfhd atoms have any base_data_offset set, and the implicit
offset (end of previous track fragment data, or start of the moof
for the first trun) is used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:01:27 +02:00
Vittorio Giovara 84bf64d359 bethsoftvid: simplify return handling
Fixes a double free in case of av_packet_new_side_data() failure.
2014-10-29 17:02:27 +00:00
Vittorio Giovara e9ba309831 assdec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 703626
2014-10-29 16:54:43 +00:00
Vittorio Giovara f64d7e919e mtv: improve header check and avoid division by zero
CC: libav-stable@libav.org
Bug-Id: CID 732203 / CID 732204
2014-10-29 16:54:43 +00:00
Michael Niedermayer b3d11437ca oggenc: remove unneeded null check
The code would have segfaulted before if oggstream were NULL.

CC: libav-stable@libav.org
Bug-Id: CID 732218
2014-10-29 16:54:37 +00:00
Tomas Härdin 11467ecf51 mxfdec: reduce loop bound in mxf_read_pixel_layout()
Makes coverity less confused and code more readable.

Bug-Id: CID 732262
2014-10-27 19:08:02 +00:00
Vittorio Giovara e6c66f1e4e bethsoftvid: check return value and clean memory
CC: libav-stable@libav.org
Bug-Id: CID 733777
2014-10-27 18:21:40 +00:00
Vittorio Giovara b46b233baf filmstripdec: avoid integer overflow
CC: libav-stable@libav.org
Bug-Id: CID 732246
2014-10-27 18:21:40 +00:00
Vittorio Giovara 090c67d586 matroskaenc: write correct Display{Width, Height} in stereo encoding
should be the raw amount of pixels (for example 3840x1080 for full HD side by
side) and the DisplayWidth/Height in pixels should be the amount of pixels for
one plane (1920x1080 for that full HD stream)."

So, move the aspect ratio check in the mkv_write_stereo_mode() function
and always write the embl when stereo format and/or aspect ration is set.
Also add a few comments to that function.

CC: libav-stable@libav.org
Found-by: Asan Usipov <asan.usipov@gmail.com>
2014-10-27 18:21:35 +00:00
Martin Storsjö ed6dad3737 lavf: Implement ff_brktimegm using gmtime_r
While a standalone implementation is nice, we already depend on
gmtime and gmtime_r in a number of places.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 82ee7d0dda Use gmtime_r instead of gmtime and localtime_r instead of localtime
gmtime isn't thread safe in general. In msvcrt (which lacks gmtime_r),
the buffer used by gmtime is thread specific though.

One call to localtime is left in avconv_opt.c, where thread safety
shouldn't matter (instead of making avconv depend on the libavutil
internal header).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 9dcf239721 lavf: Check the return value of strftime
If the buffer provided to strftime is too small, the buffer contents
are indeterminate - it does not guarantee actually null terminating
the buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Martin Storsjö 851ace79a3 wtv: Avoid needlessly calling gmtime twice with the same argument
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Vittorio Giovara 50dbe6b354 mov: fix assigment check
CC: libav-stable@libav.org
Bug-Id: CID 1197050
2014-10-24 23:48:57 +01:00
Tomas Härdin 7df3b426bb mxfenc: Fix possible integer overflows
None of these are likely unless the user is writing a file with two billion
streams or a duration of around two months.

CC: libav-stable@libav.org
Bug-Id: CID 700568 / CID 700569 / CID 700570 /
        CID 700571 / CID 700572 / CID 700573
2014-10-24 23:48:57 +01:00
Vittorio Giovara ad6b00d85f mxfdec: add missing break
CC: libav-stable@libav.org
Bug-Id: CID 732232
2014-10-24 23:48:57 +01:00
Vittorio Giovara 28c020d4df matroskaenc: check avio_open_dyn_buf return value
CC: libav-stable@libav.org
Bug-Id: CID 703629
2014-10-24 23:48:57 +01:00
Vittorio Giovara e0caa1eb4e matroskadec: check return values
CC: libav-stable@libav.org
Bug-Id: CID 733712
2014-10-24 23:48:51 +01:00
Vittorio Giovara 3c1199c3c4 matroskadec: fix leak on error
CC: libav-stable@libav.org
Bug-Id: CID 1026767
2014-10-24 23:43:25 +01:00
Luca Barbato 7785ce1c76 lavf: replace rename() with ff_rename()
The new function wraps errno so that its value is correctly reported
when other functions overwrite it (eg. in case of logging).

CC: libav-stable@libav.org
Bug-Id: CID 1135748
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-10-24 23:42:53 +01:00
Vittorio Giovara 0b66fb4505 flac_picture: prevent a possible out of bound write
At "mimetype[len] = 0;" mimetype is a 64 element array and len might be
equal to or greater than that.

CC: libav-stable@libav.org
Bug-Id: CID 1061055
2014-10-24 23:42:53 +01:00
Vittorio Giovara f1ed83e23a img2dec: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 1087077
2014-10-24 23:42:53 +01:00
Vittorio Giovara 1967cd4e4c audiointerleave: check av_new_packet return value
CC: libav-stable@libav.org
Bug-Id: CID 1087078
2014-10-24 23:42:53 +01:00
Anton Khirnov ef363ebd59 mp3enc: write full LAME frame
Most importantly, it contains the encoder delay and replaygain info.
2014-10-24 09:03:16 +02:00