Commit Graph

40947 Commits

Author SHA1 Message Date
Martin Storsjö
960aff379d lavf: Use wchar functions for filenames on windows for mkdir/rmdir/rename/unlink
This makes sure that the internal utf8 path names are handled
properly - the normal file handling functions assume path names
are in the native codepage, which isn't utf8.

This assumes that the tools outside of lavf don't use the mkdir
definition. (The tools don't do the same reading of command line
parameters as wchar either - they probably won't handle all possible
unicode file parameters properly, but at least work more predictably
if no utf8/wchar conversion is involved.)

This is moved further down in os_support.h, since windows.h shouldn't
be included before winsock2.h, while io.h needs to be included before
the manual defines for lseek functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 23:36:29 +02:00
Martin Storsjö
b9d08c77a4 lavf: Don't try to update files atomically with renames on windows
On windows, rename(2) will fail if the target file exists. On
unix this trick is used to make sure that people reading the file
either will get the full previous file, or the full new version
of the file, but no intermediate version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 23:34:44 +02:00
Uwe L. Korn
40665d27e3 flvdec: Document how the duration is retrieved at the end of the file
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 23:34:30 +02:00
Martin Storsjö
fe42f94ce1 dashenc: Don't segment all video streams when one stream gets a keyframe
This makes sure that segments actually start at a keyframe (and
makes sure we don't split segments twice in a row, with one segment
consisting of only a handful of packets), when one stream uses b-frames
while another one doesn't.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 11:09:40 +02:00
Martin Storsjö
6f26f14f13 sidxindex: Write mimeType=audio/mp4 for audio-only representations
This fixes playback with dash.js, when the input is one separate
mp4 file per track.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 09:23:14 +02:00
Vittorio Giovara
208f3abb91 aacsbr: always initialize max_qmf_subbands
Fixes a wordly warning from clang -Wsometimes-uninitialized.
2014-11-24 01:30:15 +00:00
Michael Niedermayer
55b59fab88 roqaudio: Always use the frame buffer on flush
Prevent NULL dereference.

CC: libav-stable@libav.org
Bug-Id: CID 703669
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-11-24 01:30:15 +00:00
Vittorio Giovara
0562887a98 tiffenc: initialize return value
'ret' can only be used without initialization if s->height <= 0, which can
only happen if avctx->height <= 0, which is validated elsewhere. Doesn't hurt
to still initialize it though.

CC: libav-stable@libav.org
Bug-Id: CID 732296
2014-11-24 01:30:15 +00:00
Luca Barbato
299d8ab104 cook: Make sure there is enough extradata
At least 8 bytes are needed (Mono audio).

Bug-Id: CID 741418
CC: libav-stable@libav.org
2014-11-24 01:30:15 +00:00
Vittorio Giovara
30b8eb0f87 sol: simplify sol_codec_id()
Bug-Id: CID 1238993
2014-11-24 01:30:15 +00:00
Vittorio Giovara
b99ca86350 aacdec: avoid an out-of-bounds write
Also move the check in the case it is actually used.

CC: libav-stable@libav.org
Bug-Id: CID 1087090
2014-11-24 01:30:15 +00:00
Vittorio Giovara
277ff7f5dc lavu: move internal define to the only places where it is used 2014-11-24 01:30:14 +00:00
Vittorio Giovara
065923b078 mpegenc: prevent a NULL pointer dereference
CC: libav-stable@libav.org
Bug-Id: CID 29261
2014-11-24 01:30:14 +00:00
Vittorio Giovara
9c12c6ff95 motion_est: convert stride to ptrdiff_t
CC: libav-stable@libav.org
Bug-Id: CID 700556 / CID 700557 / CID 700558
2014-11-24 01:30:10 +00:00
Martin Storsjö
f856d9c2f3 dashenc: Don't require the stream bitrate to be known
Don't write any bitrate attribute if it isn't known. As long as one
doesn't want automatic bitrate switching, playback can work just
fine even if it isn't set.

If strict standard compliance is requested, this is still considered
an error, since the attribute is mandatory according to the spec.

Based on a patch by Rodger Combs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-22 22:16:37 +02:00
Martin Storsjö
eec7f032a9 lavf: Remove a redundant include of sys/stat.h
The same file already includes this header a few lines further
above.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-22 22:11:44 +02:00
Michael Niedermayer
4b68edd08a flvenc: Remove an unused variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-22 22:10:52 +02:00
Luca Barbato
cd975d5658 hevc: Spin the mv_mpv_mode calls in a stand alone function
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-11-21 23:17:37 +01:00
Vittorio Giovara
1f80742f49 qdm2: avoid integer overflow
CC: libav-stable@libav.org
Bug-Id: CID 700555
2014-11-21 12:37:50 +00:00
Luca Barbato
312daa1589 vp9: Use the correct upper bound for seg_id
And use a macro to make apparent why the value.

Bug-Id: CID 1108595
2014-11-21 12:37:05 +00:00
Luca Barbato
d466d82faa dvdsubdec: Do not leak on failure path
CC: libav-stable@libav.org
Bug-Id: CID 1198262
2014-11-21 12:36:19 +00:00
Vittorio Giovara
a42d5c861f libtwolame: prevent a NULL pointer dereference
CC: libav-stable@libav.org
Bug-Id: CID 1250330 / CID 1250335
2014-11-21 12:27:07 +00:00
Vittorio Giovara
863ee8a855 lavfi: clean memory on error in ADD_FORMAT()
CC: libav-stable@libav.org
Bug-Id: CID 1250334
2014-11-21 12:27:07 +00:00
Luca Barbato
fd9badd3cb xwma: Do not leak on failure path
CC: libav-stable@libav.org
Bug-Id: CID 1087092
2014-11-21 12:27:07 +00:00
Martin Storsjö
aa8b39d999 lavc: Move the libtwolame encoder registration to the list for external libraries
This makes sure the default behaviour of using the internal encoder
stays the same regardless if libtwolame is enabled or not (as for
any external library).

This fixes fate-lavf-mpg if libav is built with libtwolame enabled.

CC: libav-stable@libav.org
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-11-21 12:27:07 +00:00
Martin Storsjö
7fd10f66b7 hdsenc: Clear the previous codec tag when setting up the chained muxer
The chained flv muxer wants one set of tags - normally this set
could be signaled via the AVOutputFormat codec_tag field (as
smoothstreamingenc and dashenc do). hdsenc doesn't signal it, since
the FLV codec tag arrays aren't exported from flvenc.c. This can
lead to the caller keeping an original codec tag from the originating
container here, which would then be a mismatch for the FLV muxer.
Since we don't really care about what codec tag the caller might
have set, just clear it and let the lavf muxer layer set the right
one for the chained FLV muxer later instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-19 13:37:00 +02:00
Martin Storsjö
f918b8a293 hdsenc: Use the right filename in an error message
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-19 13:36:43 +02:00
Martin Storsjö
7813e6752b configure: Fix enabling memalign_hack automatically
simd_align_16 is a configure item that can be enabled or disabled,
it's not a variable containing a list of other configure items
as need_memalign previously. This was broken in eba2233b5.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-18 18:53:57 +02:00
Vittorio Giovara
2007082d2d mov: check ff_get_wav_header() return value
CC: libav-stable@libav.org
Bug-Id: CID 717497
2014-11-18 00:40:06 +01:00
Vittorio Giovara
85dc006b1a lavc: fix bitshifts amount bigger than the type
CC: libav-stable@libav.org
Bug-Id: CID 1194387 / CID 1194389 / CID 1194393 / CID 1206638
2014-11-18 00:39:23 +01:00
Vittorio Giovara
771656bd85 libvpxenc: clean memory on error
CC: libav-stable@libav.org
Bug-Id: CID 733795
2014-11-18 00:38:56 +01:00
Vittorio Giovara
a28468d0da librtmp: append the correct field to the string
Also prevent a NULL pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CID 1250329 / CID 1250331
2014-11-18 00:38:26 +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
Martin Storsjö
c302d034ba tools: Add a sidxindex tool
This tool can write an MPD file for fragmented MP4 files with
a sidx index at the start of the file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö
40ed1cbf14 movenc: Allow writing a DASH sidx atom at the start of files
This is mapped to the faststart flag (which in this case
perhaps should be called "shift and write index at the
start of the file"), which for fragmented files will
write a sidx index at the start.

When segmenting DASH into files, there's usually one sidx
at the start of each segment (although it's not clear to me
whether that actually is necessary). When storing all of it
in one file, the MPD doesn't necessarily need to describe
the individual segments, but the offsets of the fragments can be
fetched from one large sidx atom at the start of the file. This
allows creating files for the DASH ISO BMFF on-demand profile.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö
3847f3ab58 movenc: Add tfra entries for all tracks in a moof
Previously only tfra entries were added for the first track in each moof.

The frag_info array used for tfra can also be used for writing
other kinds of fragment indexes, where it's more important to
include all tracks.

When the separate_moof option is enabled (as in ismv), we write
a separate moof for each track, so this doesn't make any difference
in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö
fe5e6e34c0 lavf: Add an MPEG-DASH ISOFF segmenting muxer
This is mostly to serve as a reference example on how to segment
the output from the mp4 muxer, capable of writing the segment
list in four different ways:
- SegmentTemplate with SegmentTimeline
- SegmentTemplate with implicit segments
- SegmentList with individual files
- SegmentList with one single file per track, and byte ranges

The muxer is able to serve live content (with optional windowing)
or create a static segmented MPD.

In advanced cases, users will probably want to do the segmenting
in their own application code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö
2ded57371a movenc: Add support for writing sidx atoms for DASH segments
A flag "dash" is added, which enables the necessary flags for
creating DASH compatible fragments.

When this is enabled, one sidx atom is written for each track
before every moof atom.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:16:46 +02:00
Martin Storsjö
2d9d6afb8d movenc: Factorize adding fragment info into a separate function
By calling this after writing the moof the first time (for
calculating the moof size), we can avoid intermediate storage
of tfrf_offset in MOVTrack.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:13:02 +02:00
Martin Storsjö
0f9eb9165b movenc: Include empty tracks in iods when writing fragmented mp4
When writing fragmented streams with an empty initial moov,
we won't have any samples in any tracks when writing the
moov atom, thus trust that any tracks that are added actually
will be present.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:12:02 +02:00
Andrew Stone
c64f361511 flvenc: Send new metadata when FLAG_METADATA_UPDATED is set.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-11-17 09:28:16 +01:00
Andrew Stone
4d0cd5f58c flvenc: move metadata updates into a single function
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-11-17 09:28:06 +01:00
Anton Khirnov
8b573ddda7 hevc: remove superfluous assignments and checks 2014-11-17 09:26:45 +01:00
Anton Khirnov
eac3ac1fe0 hevc: eliminate an unneeded intermediate variable 2014-11-17 09:26:45 +01:00
Anton Khirnov
eb335f3c5c hevc: reduce variable scope
Also, collapse the array into a scalar, since only one value is needed
at a time.
2014-11-17 09:26:45 +01:00
Anton Khirnov
84c0ece5fd hevc: further reduce code duplication in hls_prediction_unit() 2014-11-17 09:25:15 +01:00
Anton Khirnov
a7b365ae19 hevc: reduce code duplication in hls_prediction_unit() 2014-11-17 09:25:12 +01:00
Anton Khirnov
de1f8ead89 hevcdsp_template: templatize transquant_bypass 2014-11-17 09:25:12 +01:00
Anton Khirnov
16c01fb434 hevc: remove an unused function parameter 2014-11-17 09:25:12 +01:00
Anton Khirnov
84b9463984 hevc: remove a redundant line
pred_mode is overwritten a few lines immediately below.
2014-11-17 09:25:12 +01:00