Commit Graph

165 Commits

Author SHA1 Message Date
Luca Barbato ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Luca Barbato 1a164e0a83 tools: Drop a stale header 2015-08-31 21:37:18 +02:00
Vittorio Giovara 87e5d8d78c ismindex: Use the correct abs() version 2015-08-31 15:24:56 +02:00
Vittorio Giovara 30dfc1dad4 cws2fws: Close file handles on error
Reported-By: infer
2015-06-12 17:02:49 +01:00
Martin Storsjö 30a041887f ismindex: Calculate the pts duration of trun atoms, not the dts duration
Since the duration is compared to the tfra durations/intervals which
are expressed in pts, calculate that here as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:22 +02:00
Martin Storsjö 470c9db11f sidxindex: Remove parsing that isn't necessary any longer
When we don't adjust the Period start time, we don't need to
parse the earliest_presentation_time from the sidx boxes either.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-01-03 01:24:30 +02:00
Martin Storsjö 5cf6bda6e2 sidxindex: Don't adjust the Period start time depending on the track start time
This was only necessary to get playback to start with dash.js 1.2.0,
it has been fixed in the git version.

The previous behaviour was incorrect - the Period's start time
is irrespective of the actual first timestamp of the contents
within the period. The Period start time only says when, within the
global timeline, this particular piece should start to be played
back.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-01-03 01:24:29 +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
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
Olivier Langlois e205429fcf tools: Use av_gettime_relative
Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:43 +03:00
Mika Raento 979932378a ismindex: use tfhd default duration if no sample duration
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-16 09:22:22 +03:00
Mika Raento 2bc220958c ismindex: handle discontinuous streams better
Read the fragment duration from the trun sample data, rather than
assuming that there are no gaps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-09 11:21:49 +03:00
Mika Raento 00431bf874 ismindex: handle time discontinuities and nonzero start time
The input file may not have consistent start times, stream durations and
chunk durations. This patch at least removes negative durations that
make chromecast unhappy, and correctly sets starting time on chunks so
that the split (or .ismf) outputs match the manifest.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-15 19:54:36 +03:00
Martin Storsjö fcf597625c ismindex: Avoid writing ismf files if no base name has been specified
Previously, this could create files named "(null).ismf", if the -ismf
parameter is specified (before an input file name), but without
specifying any base name.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-07 23:20:30 +03:00
Mika Raento b21e989a3c ismindex: produce .ismf file
This is a non-standard file that maps the MSS segment names to offsets
in the ISMV file. This can be used to build a custom MSS streaming
server without splitting the ISMV into separate files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-05 09:54:55 +03:00
Mika Raento c487972ed0 ismindex: recover from completely empty streams
This creates best-effort results from input that is missing stream
contents, there are warnings printed when this happens.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-03 12:06:40 +03:00
Mika Raento e48d1ea541 ismindex: improve diagnostics
This improves error messages for completely and somewhat broken inputs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-02 09:48:44 +03:00
Diego Biurrun 3526ab891c qt-faststart: Undefine fseeko/ftello before defining them
This avoids a number of redefinition warnings on MinGW64.
2014-08-22 18:35:20 +02:00
Gabriel Dume 4b1f5e5090 cosmetics: Write NULL pointer inequality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 05:34:13 -07:00
Martin Storsjö f920d08953 ismindex: Add an option for outputting files elsewhere than in the current directory
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-07-03 20:13:27 +03:00
Martin Storsjö 6bc4934b75 ismindex: Allow adding a path prefix to the generated .ism file
This allows storing the .ismv/.isma/.ismc files separately from
the .ism file on a server, without having to manually edit the
.ism file after generating it with the ismindex tool.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-07-03 20:13:13 +03:00
Lou Logan 700687ebe0 qt-faststart: Add a note about the -movflags +faststart feature
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:25:17 +02:00
Martin Storsjö ea7f79f937 qt-faststart: Avoid unintentionally sign extending BE_32
Without this cast, the BE_32() expression is sign extended when
assigned to an uint64_t, since the uint8_t|uint8_t expression
is promoted to an int.

Also avoid undefined behaviour when left shifting an uint8_t
by 24 by casting it to an uint32_t explicitly before shifting.

Based on a patch by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:25:08 +02:00
Michael Niedermayer bb95334c34 qt-faststart: Check offset_count before reading from the moov_atom buffer
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:25:04 +02:00
Michael Niedermayer 6384885425 qt-faststart: Check the ftello() return codes
This silences a warning in the coverity static analyzer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:25:00 +02:00
Michael Niedermayer 03c2a66fcf qt-faststart: Fix the signedness of variables keeping the ftello return values
These variables are assigned the return values of ftello, which
returns an off_t, which is a signed type. On errors, ftello returns
-1, thus make sure this error return value can be stored properly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:24:55 +02:00
Michael Niedermayer 5612244351 qt-faststart: Check fseeko() return codes
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:24:52 +02:00
Michael Niedermayer ea15a9a5d8 qt-faststart: Simplify code by using a MIN() macro
qt-faststart doesn't use the normal libav headers at all since
it's supposed to be a completely standalone tool, so we implement
the macro locally in this file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:24:47 +02:00
Martin Storsjö 3cbc7ef3d6 qt-faststart: Increase the copy buffer size to 64 KB
Copying data in chunks of 1 KB is a little wasteful.

64 KB should still easily fit on the stack, so there's no need
to allocate it dynamically.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-01 00:24:42 +02:00
Martin Storsjö 87acd33c09 aviocat: Add support for specifying the input duration
This avoids the caller having to calculate the byte rate if wanting
to push a file in a rate resembling realtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-01-17 09:32:09 +02:00
Martin Storsjö 03f2de5856 aviocat: Check the argv array length before reading element i+1
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-01-17 09:31:53 +02:00
Diego Biurrun 82c86d0b18 graph2dot: Add missing #include for av_get_channel_layout_string() 2013-11-04 23:04:10 +01:00
Diego Biurrun 48715285f6 graph2dot: Fix use of deprecated API 2013-11-04 23:04:10 +01:00
Martin Storsjö a4435f9235 ismindex: Change the duration field to int64_t
This reduces the risk for overflow in pathlogical cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-10-05 00:01:28 +03:00
Martin Storsjö 583a287f6f ismindex: Calculate the file duration among the included tracks
If the input file contains other tracks (non video/audio) that
aren't included in ismindex, the global file duration as returned
by libavformat might not be equal to the maximum of the duration
of the actual included tracks.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-10-05 00:01:18 +03:00
Martin Storsjö d347a7b248 ismindex: Use the individual stream duration instead of the global one
The stream duration is used for calculating the duration of the
last fragment easily without manually parsing anything else than
the mfra/tfra atoms. When the global file duration was used
previously, the duration of the last fragment could end up wrong
if the streams weren't equally long.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-10-05 00:01:08 +03:00
Diego Biurrun bea3d6f436 ismindex: Replace mkdir ifdeffery by os_support.h #include
os_support.h contains more precise workarounds for non-POSIX mkdir().
2013-08-05 11:38:00 +02:00
Diego Biurrun cd7b6deeaa tools: Wording and formatting cosmetics 2013-07-06 15:36:57 +02:00
Diego Biurrun a5f8873620 silly typo fixes 2013-05-03 18:26:12 +02:00
Anton Khirnov 38f0c0781a lavfi: merge avfiltergraph.h into avfilter.h
We do not support using filters without AVFilterGraph in practice
anyway, so there is no point in pretending we do.
2013-04-11 20:33:33 +02:00
Martin Storsjö 4abf6fa095 ismindex: Check the return value of allocations
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-13 20:41:25 +02:00
Martin Storsjö 7c147900b8 ismindex: Factorize code for printing chunk duration lists
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-13 20:41:19 +02:00
Martin Storsjö f05e9beb4a ismindex: Rename structs and fields from "file" to "track"
The tool nowadays supports more than one track per file,
this makes reading the code slightly less confusing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-13 20:41:11 +02:00
Diego Biurrun 88bd7fdc82 Drop DCTELEM typedef
It does not help as an abstraction and adds dsputil dependencies.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2013-01-22 18:32:56 -08:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Anton Khirnov b7f1010c8f tools: do not use av_pix_fmt_descriptors directly. 2012-10-12 12:45:38 +02:00
Diego Biurrun 11d4e92ed9 avformat: Remove non-compiling and/or silly commented-out printf/av_log statements 2012-10-01 10:24:28 +02:00
Martin Storsjö 18d8825517 trasher: Include all the necessary headers
The missing headers are required for errno and for strerror.
This fixes building of this tool on mingw32ce.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-13 23:12:54 +03:00
Martin Storsjö 21411a4102 pktdumper: Use a custom define instead of PATH_MAX for buffers
PATH_MAX is not necessarily available on all systems, e.g. it's
normally not available on MSVC, and is not guaranteed to defined
on a POSIX system either.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-31 00:44:47 +03:00
Martin Storsjö bcc44873d9 pktdumper: Use av_strlcpy instead of strncpy
This takes care of null-terminating the buffer if it is too small,
which wasn't handled properly before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-31 00:44:35 +03:00