Several chunked formats (AIFF, IFF,DSF) store ID3 metadata within an 'ID3 '
chunk tag. If such chunks are stored sequentially, it is possible for the
ID3v2 parser to confuse the chunk tag for the ID3 magic number. e.g.
[1st chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]
[2nd chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]
Fixes ticket #3530.
Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This ensures stream[0] is always the audio stream (an assumption made
in dsf_read_packet).
Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '32d05934abc7427bb90380a4c1ab20a15fd7d821':
mp3dec: decode more data from Info header
Conflicts:
libavformat/mp3dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'fbd8e042107ec63e0ddf155588c59dcb76007641':
mp3dec: move XING/Info and VBRI parsing into their own functions
Conflicts:
libavformat/mp3dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This adds a function to export raw replaygain values (i.e. in the (u)int32_t
form). It first checks whether AV_PKT_DATA_REPLAYGAIN side data is present, in
which case it does nothing.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
After this commit applications needs to call av_format_inject_global_side_data()
or handle AVStream side data by some other means if they want it not to be lost.
This fixes a API incompatibility with libav.
libav API does not allow the data to be passed through AVPackets
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '6477139721f559b26eafd415e23e13ea2b0c27e1':
rtmpproto: Make sure to pass on the error code if read_connect failed
Merged-by: Michael Niedermayer <michaelni@gmx.at>
In all other cases where ff_rtmp_packet_read is used, the packet returned
is passed to rtmp_parse_result more or less immediately. In this single
case, the content of the packet was required to be a connect packet.
Some clients, e.g. Open Broadcaster Software, send a chunk size packet
before the connect packet. If the first packet is a chunk size packet,
handle it and read another one, requiring this to be a connect packet
instead.
Signed-off-by: Martin Storsjö <martin@martin.st>
Previously, if read_connect failed, the ret variable was unmodified
and had the value 0, indicating success, which then was returned from
the rtmp_open function, even though it actually failed.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
bits_per_coded_sample and block_align are calculated again at end of if() block
Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Instead of using a fixed bitrate_idx, calculate a matching bitrate for
the XING header.
Using a fixed bitrate_idx causes tools such as file(1) and mediainfo(1)
to report wrong bitrate and bitrate mode when using CBR.
Bug-Id: https://bugs.debian.org/736088
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Provides API to query device capabilities.
Each device must implement callbacks to benefit from this API.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ffurl_seek() will not work even when it should be a no-op, so do not
call it on crypto protocol.
Also replace use of ffurl_size() for the same reason.
Reported-by: Michael Schenk <Michael.Schenk@albistechnologies.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Calling avformat_free_context() right after avformat_alloc_output_context2()
leaved option's default values not freed.
Options were freed only in av_write_trailer().
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* cehoyos/master:
Fix a typo in amr.c.
Remove an unneeded include of avassert.h from amr.c.
Do not allow writing invalid wav channel layouts by default.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Avoids a warning with gcc 4.7 and -Wtype-limits. Albeit
superfluous (At least gcc 4.8 didnt consider this been
a problem).
Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Also add reason phrases from http://www.ietf.org/rfc/rfc2326.txt
and macro to translate.
Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Since we are basically seeking the AVIOContext under the subdemuxer, we
need to flush the subdemuxer to avoid old packets from being read from
the packet queue after the seek.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Properly take stream_index into account so that a keyframe will be
looked for in the specified stream_index only.
Similarly, only check timestamp validity against the specified
stream_index.
Also remove code for stream_index == -1 case which does not actually
happen as it is handled by generic code.
This is based on an initial patch by James Deng.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Do not try to delay opening newly required playlists until a segment
switch. Applications expect that newly selected undiscarded streams are
available immediately, especially with alternative rendition streams
(selectable audio/subtitle tracks).
One might think that delaying variant stream switch until a segment
switch would allow a "seamless" switch without us having to download a
specific segment from two different variant playlists. However, that is
not the case, since the application would have to keep the previous
stream available (undiscarded) until the first packet of the newly
selected stream arrives, but by that time the demuxer would have already
downloaded the next segment of both variants.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
As per spec 3.4.3 ("A client MUST NOT assume that segments with the same
sequence number in different Media Playlists contain matching content.")
we cannot use sequence numbers for packet ordering.
This can be seen e.g. in the subtitle streams of
bipbop_16x9_variant.m3u8 that have considerably longer segments and
therefore different numbering.
Since the code now exclusively syncs using timestamps that may wrap, add
some additional checking for that.
According to the HLS spec all the timestamps should be in 33-bit MPEG
format and synced together.
v2: cleaner wrap detection
v3: further wrap detection improvements
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
While selecting a packet to return to caller in read_packet(), the code
corrects the timestamps for starting timestamps.
However, this is wrong, since for live streams the initial timestamps
might differ just because of the time delay between the retrieval of the
various Media Playlists.
Fortunately, spec 6.2.4 mandates that all variant streams must have
matching timestamps, so we do not need to correct for initial
timestamps.
Drop the correction code.
Note that ID3 timestamps were previously ignored, so this code was
previously actually needed.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Check if the playlist is still needed just before requesting the next
segment instead of after exhausting the previous segment.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Improve selection of the segment sequence number when restarting the
reception of a playlist after it was suspended due to being unneeded
(due to discard flags).
The current code assumes that each playlist contains matching data with
the same sequence number, while spec 3.4.3 specifically says that that
is not the case. Often subtitle playlists also have longer target
durations as well, causing the selection to be completely wrong.
Instead prefer using the playlist segment duration information for
non-live playlists, and other means if that is not possible.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Seeking needs to be tracked on a per-playlist basis, since the resyncing
code in hls_read_packet() has to sync each playlist to the seek
timestamp instead of stopping after the first playlist has reached it.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
HLS provides MPEG TS timestamps via ID3 tags in the beginning of each
segment of elementary audio streams.
v2: fix issues with streams that have multiple ID3 tags
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Add support for EXT-X-BYTERANGE added in HLS protocol v4.
v2: Better comment explaining ffurl_seek call and fix cur_seg_offset not
being updated.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Even if we returned AVERROR_EOF previously due to playlist no longer
being needed, we may still be called again, and we do not want to
trigger a segment download in that case.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
HLS protocol version 4 added alternative renditions to the
specification (e.g. alternative audio tracks).
The EXT-X-MEDIA tags can also contain metadata for "renditions" (i.e.
tracks) of the main Media Playlist.
Add support for those.
Note that the same rendition (AVStream) may be associated with multiple
variants (AVPrograms).
Alternative subtitle tracks will require additional work and are
therefore not enabled yet.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>