summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
Commit message (Collapse)AuthorAge
* lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* dashenc: eliminate ffurl_* usageAnton Khirnov2016-02-22
| | | | | Now all IO should go through the IO callbacks and be interceptable by the caller.
* lavf: allow custom IO for all filesAnton Khirnov2016-01-24
| | | | | | | | | | | | | | Some (de)muxers open additional files beyond the main IO context. Currently, they call avio_open() directly, which prevents the caller from using custom IO for such streams. This commit adds callbacks to AVFormatContext that default to avio_open2()/avio_close(), but can be overridden by the caller. All muxers and demuxers using AVIO are switched to using those callbacks instead of calling avio_open()/avio_close() directly. (de)muxers that use the URLProtocol layer directly instead of AVIO remain unconverted for now. This should be fixed in later commits.
* dashenc: Reduce the segment duration if cutting out parts with edit listsMartin Storsjö2015-05-10
| | | | | | | | This makes sure that the time + duration of the first segment matches the start time of the next segment for e.g. AAC audio with encoder delay. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: replace attribute id with contentType for the AdaptationSet elementJames Almer2015-05-10
| | | | | | | | | | id should be an integer, not a string. It is also optional, so use contentType instead which is the proper attribute for these values. This fixes an MPD validation error. Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Add a publishTime field in dynamic manifestsMartin Storsjö2015-04-20
| | | | | | This field is mandatory in dynamic manifests. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Heuristically fill in the duration of packets that need itMartin Storsjö2015-03-19
| | | | | | | | | | | This avoids that the mp4 muxer does a similar heuristic, adjusting the timestamps in a way that the dash muxer doesn't know the actual timestamps written to the file in the end. By making sure that the mp4 muxer internal heuristic isn't applied, we know the exact timestamps written to file, so that the timestamps in manifest match the files. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Update extradata for mov muxerTimo Rothenpieler2015-03-06
| | | | | | | | | | | | The mov muxer already supports picking up extradata that wasn't present during the avformat_write_header call - we just need to propagate it. Since the dash muxer uses delay_moov, we have time up until the first segment is written to get extradata filled in. Also update the codec description string when the extradata becomes available. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Simplify code by using a local variableTimo Rothenpieler2015-03-06
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Simplify code by using a local variableMartin Storsjö2015-03-02
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Use ffio_free_dyn_buf where applicableMartin Storsjö2015-02-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Use inttypes.h macros for format strings instead of %lldMartin Storsjö2015-01-22
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Fix format string generationRodger Combs2015-01-22
| | | | | | | Previously this always used the "lld" format for all parameters, not only time parameters. Signed-off-by: Martin Storsjö <martin@martin.st>
* movenc: Enable editlists by default if delay_moov is enabledMartin Storsjö2015-01-04
| | | | | | | Being able to write editlists properly is one of the main points in the delay_moov flag. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Use pts for MPD timeline timestampsMartin Storsjö2015-01-03
| | | | | | | | | | | | | | | This should be more correct. This also should give more sensible switching between video streams with different amount of b-frame delay. The current dash.js release (1.2.0) fails to start playback of such files from the start (if the start pts is > 0), but this has been fixed in the current git version of dash.js. Also enable the use of edit lists, so that streams in many cases start at pts=0. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Use delay_moovMartin Storsjö2015-01-03
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Remove some stray double spacesMartin Storsjö2014-12-29
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Fix writing of timelines that don't start at t=0Martin Storsjö2014-12-29
| | | | | | | | When writing an explicit time, reset the cur_time variable to this value as well. This avoids writing excessive time attributes for each segment in the timeline, as long as the segments are continuous. Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Adjust the start time of a segment to the end of the previous segmentMartin Storsjö2014-12-17
| | | | | | | | | | | | | | | | This is the same adjustment that the mp4 muxer does to the start timestamp of fragments, since the timestamp of a sample in an mp4 file is implicit from the sum of earlier sample durations. This avoids gaps in the timeline (which can stop dash.js from playing it back), and makes sure the timestamp on the segmenter level matches what the mp4 muxer actually writes into the segments. This is only an issue if the AVPacket duration of the last packet of a segment doesn't point to the actual start timestamp of the next packet (the first in the next segment). Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Write segment timelines properly if the timeline has gapsMartin Storsjö2014-12-17
| | | | | | | | | | | | Write a new start time if the duration of the previous segment didn't match the start of the next one. Check that segments actually are continuous before writing a repeat count. This makes sure timestamps deduced from the timeline actually match the real start timestamp as written in filenames (if using a template containing $Time$). Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Change the duration fields to 64 bitMartin Storsjö2014-12-10
| | | | | | | | For the last_duration field, it's mostly theoretical, but the total_duration field more probably may need to actually be 64 bit. Bug-Id: CID 1254944 Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: log file output progress in verbose modeBryan Huh2014-12-10
| | | | | | | As the manifest/segments are flushed to disk, log to stderr the progress, when in verbose logging mode Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Avoid a VLA-like constructMartin Storsjö2014-11-28
| | | | | | | This fixes the build on compilers that interpreted the earlier code as a variable length array (which we intentionally disallow). Signed-off-by: Martin Storsjö <martin@martin.st>
* dashenc: Add options to make segment names configurableBryan Huh2014-11-28
| | | | | | | This allows one to specify templated segment names for init-segments, media-segments, and for the base-url in the case of single-file. Signed-off-by: Martin Storsjö <martin@martin.st>
* Revert "lavf: Don't try to update files atomically with renames on windows"Martin Storsjö2014-11-27
| | | | | | | | | This reverts commit b9d08c77a44390b0848c06f20bc0e9e951ba6a3c. After taking MoveFileEx into use, we can replace files with renames on windows as well. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: Don't try to update files atomically with renames on windowsMartin Storsjö2014-11-24
| | | | | | | | | 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>
* dashenc: Don't segment all video streams when one stream gets a keyframeMartin Storsjö2014-11-24
| | | | | | | | | 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>
* dashenc: Don't require the stream bitrate to be knownMartin Storsjö2014-11-22
| | | | | | | | | | | | | 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>
* lavf: Add an MPEG-DASH ISOFF segmenting muxerMartin Storsjö2014-11-17
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>