1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

247 Commits

Author SHA1 Message Date
Anssi Hannula
3d2f636497 avformat/hls: Fix probing mpegts audio streams that use probing
Commit 04964ac311 ("avformat/hls: Fix missing streams in some
cases with MPEG TS") caused a regression where subdemuxer streams that
use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly.

This is because the codec parameters from the subdemuxer stream, once
probed, are not passed on to the main stream.

Fix that by updating the codec parameters if the codec id changes.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07 18:56:36 +02:00
Anssi Hannula
9a51cd35b8 avformat/hls: Factor copying stream info to a separate function
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2016-11-07 18:56:36 +02:00
Anssi Hannula
a6f5e25ad9 avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB
Replace uses of atoi() with strtoll() when trying to read values into
int64_t variables.

Fixes Kodi trac #16926:
http://trac.kodi.tv/ticket/16926
2016-09-24 09:46:32 +03:00
Anssi Hannula
04964ac311 avformat/hls: Fix missing streams in some cases with MPEG TS
HLS demuxer calls the subdemuxer avformat_find_stream_info() while
overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it.
However, this prevents some streams in some MPEG TS streams from being
detected properly.

Simply removing the clearing of the flag would cause the inner
avformat_find_stream_info() call to take longer in some cases, without
a way to control it.

To fix the issue, do not clear the flag but propagate it to HLS demuxer.
To avoid the above-mentioned mandatory delay, the call to
avformat_find_stream_info() is dropped except in the HLS ID3 timestamped
case. The HLS demuxer user should be calling avformat_find_stream_info()
on the HLS demuxer if it wants to find the stream info.

The main streams are now created dynamically after read_header time if
the subdemuxer uses AVFMTCTX_NOHEADER (mpegts).

Subdemuxer avformat_find_stream_info() is still called for the HLS ID3
timestamped case as the HLS demuxer needs to know the packet durations
to properly interleave ID3 timestamped streams with MPEG TS streams on
sub-segment level.

Fixes ticket #4930.
2016-07-28 01:24:57 +03:00
Anssi Hannula
83db3c84fa avformat/hls: Move stream propagation to a separate function
Creation of main demuxer streams from subdemuxer streams is moved to
update_streams_from_subdemuxer() which can be called repeatedly.

There should be no functional changes.
2016-07-28 01:24:57 +03:00
Anssi Hannula
9884f17e34 avformat/hls: Use an array instead of stream offset for stream mapping
This will be useful when the amount of streams per subdemuxer is not
known at hls_read_header time in a following commit.
2016-07-28 01:24:57 +03:00
Anssi Hannula
4d85069e5d avformat/hls: Sync starting segment across variants on live streams
This will avoid a large time difference between variants in the most
common case.
2016-07-28 01:24:57 +03:00
Anssi Hannula
9cb30f7a88 avformat/hls: Fix regression with ranged media segments
Commit 81306fd4bdf ("hls: eliminate ffurl_* usage", merged in d0fc5de3a6)
changed the hls demuxer to use AVIOContext instead of URLContext for its
HTTP requests.

HLS demuxer uses the "offset" option of the http demuxer, requesting
the initial file offset for the I/O (http URLProtocol uses the "Range:"
HTTP header to try to accommodate that).

However, the code in libavformat/aviobuf.c seems to be doing its own
accounting for the current file offset (AVIOContext.pos), with the
assumption that the initial offset is always zero.

HLS demuxer does an explicit seek after open_url to account for cases
where the "offset" was not effective (due to the URL being a local file
or the HTTP server not obeying it), which should be a no-op in case the
file offset is already at that position.

However, since aviobuf.c code thinks the starting offset is 0, this
doesn't work properly.

This breaks retrieval of ranged media segments.

To fix the regression, just drop the seek call from the HLS demuxer when
the HTTP(S) protocol is used.
2016-07-28 01:24:57 +03:00
Clément Bœsch
8df1dbd798 Merge commit '5afb94c817abffad030c6b94d7003dca8aace3d5'
* commit '5afb94c817abffad030c6b94d7003dca8aace3d5':
  Mark read-only tables as static

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 22:09:35 +02:00
Diego Biurrun
5afb94c817 Mark read-only tables as static 2016-05-05 10:48:34 +02:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Hendrik Leppkes
eae2d89bf7 hls: handle crypto in the protocol checks
Fixes issue 5248
2016-03-16 10:31:41 +01:00
Hendrik Leppkes
0d4b8a2c16 hls: read protocol options through the AVIOContext
This reverts commit 9f9ed79d4c.

The hlsopts member was never set anywhere and always NULL, furthermore
the HLS demuxer needs to retrieve the proper options from the underlying
http protocol (cookies, user-agent, etc), so a dummy context won't help.

Instead, use the AVIOContext directly to access the options.
2016-03-16 10:31:36 +01:00
Derek Buitenhuis
93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Derek Buitenhuis
9f9ed79d4c hls: Add and use a memebr of AVIOInternal rather than abuse opaque
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 20:10:11 +00:00
Derek Buitenhuis
f1e7c42f08 Merge commit '225e84e74544062706c0159ec0737b0e1d40915f'
* commit '225e84e74544062706c0159ec0737b0e1d40915f':
  hls: disallow opening nested files in child demuxers

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 15:50:32 +00:00
Anton Khirnov
9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
Anton Khirnov
225e84e745 hls: disallow opening nested files in child demuxers 2016-02-22 11:30:33 +01:00
Michael Niedermayer
58f21b6c93 avformat/hls: fix potential integer overflow
This is not a regression

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-16 21:46:00 +01:00
Derek Buitenhuis
d0fc5de3a6 Merge commit '81306fd4bdeb5c17d4db771e4fec684773b5790f'
* commit '81306fd4bdeb5c17d4db771e4fec684773b5790f':
  hls: eliminate ffurl_* usage

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 16:27:14 +00:00
Derek Buitenhuis
bc9a5965c8 Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks.

* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
  lavf: allow custom IO for all files

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-10 14:42:41 +00:00
Michael Niedermayer
fe3fed0b14 Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 04:16:50 +01:00
Michael Niedermayer
af24b1c0cd Revert "avformat/hls: Require the file extension to be m3u / m3u8 for probing to succeed"
This can cause problems with urls that have arguments after the filename

This reverts commit b0c57206d5.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-01 15:06:34 +01:00
Michael Niedermayer
cde57eee98 avformat/hls: Check that filename is not "" in probe before checking its extension
Possibly the check as a whole causes more problems than it helps, if so dont
hesitate to remove it

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-25 00:18:57 +01:00
Anton Khirnov
81306fd4bd hls: eliminate ffurl_* usage
Now all IO should go through the IO callbacks and be interceptable by
the caller.
2016-01-24 16:50:13 +01:00
Anton Khirnov
9f61abc811 lavf: allow custom IO for all files
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.
2016-01-24 16:45:32 +01:00
Michael Niedermayer
b0c57206d5 avformat/hls: Require the file extension to be m3u / m3u8 for probing to succeed
If the filename isnt set by the user application then the code behaves like before

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-19 16:46:30 +01:00
Michael Niedermayer
cfda1bea4c avformat/hls: Even stricter URL checks
This fixes a null pointer dereference at least

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 15:29:22 +01:00
Michael Niedermayer
6ba42b6482 avformat/hls: More strict url checks
No case is known where these are needed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 14:11:21 +01:00
Maxim Andreev
7145e80b4f avformat/hls: forbid all protocols except http(s) & file
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-14 00:18:00 +01:00
Joel Holdsworth
c48122d731 avformat/hls: Added http_proxy support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-27 21:44:15 +01:00
Joel Holdsworth
9cdccd404b avformat/hls: Remember to free HLSContext::headers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-27 21:44:15 +01:00
Michael Niedermayer
676a93f2d8 avformat: Add av_program_add_stream_index()
This will be used by the subsequent commit(s)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-11 22:27:25 +01:00
Hendrik Leppkes
7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
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
Anssi Hannula
9099079488 avformat/hls: add support for EXT-X-MAP
Without EXT-X-MAP support we miss the first bytes of some streams.

These streams worked by luck before byte-ranged segment support was added in
da7759b357

Fixes ticket #4797.
2015-10-15 15:04:00 +03:00
Anssi Hannula
fd74d45d51 avformat/hls: fix segment selection regression on track changes of live streams
Commit ad701326b4 ("avformat/hls: open playlists immediately when
AVDISCARD_ALL is dropped") inadvertently caused first_packet to never be
cleared, causing select_cur_seq_no() to not use the specific code for
live streams.

In practice this means that when the user selects a different audio
track during live stream (i.e. non-VOD) playback, there may be some
additional delay as the code might select an incorrect segment at first,
and we have to wait for video to catch audio (if too late segment was
selected) or to download more following audio segments (if too early
segment was selected).

Fix that by restoring the zeroing of first_packet.
2015-10-15 15:04:00 +03:00
Rodger Combs
f00ec7eb1b lavf/hls: don't convert NULL options to empty strings; fixes HTTP CRLF warnings 2015-10-09 04:12:57 -05:00
Rodger Combs
14221b2dd9 lavf/hls: allow subtitles to be read despite incomplete handling
This will give incorrect results in some cases due to not parsing segments
separately, so it currently requires -strict experimental.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-03 12:54:44 +02:00
Luca Barbato
74942685cb hls: Check av_opt_set_dict return value as well
Bug-Id: CID 1320426
2015-10-01 13:51:13 +02:00
Ganesh Ajjanagadde
db9de9b954 avformat/hls: remove unused function
Fixes -Wunused-function from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-09-26 18:44:36 +02:00
Lucas de Andrade
770dd10504 avformat/hls: Update Cookies response with Setcookie
Context cookies must be updated when a playlist response return Setcookie header.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2015-09-25 17:22:44 +02:00
Andreas Cadhalpun
f9f0b4c08e hls: only seek if there is an offset
If there is no #EXT-X-BYTERANGE specified, there is no need to seek.
Seeking fails anyway for rtmp, because this protocol does not support
url_seek.

This fixes CNN.m3u from trac ticket 4797 (i.e. Debian bug #798189).

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-09-22 21:00:01 +02:00
wm4
26eb294007 avformat/hls: fix some cases of HLS streams which require cookies
Broken by commit ba12ba859a. This only
happens with HLS streams which use encryption and require preserving
cookies sent by the server.

Fixes trac issue #4846.
2015-09-22 17:41:01 +02:00
Michael Niedermayer
4eca1939ef avformat/hls: Check for av_opt_set_dict() failure
Fixes: CID1320426

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-05 14:28:08 +02:00
Ganesh Ajjanagadde
5edf8b118d avformat/hls: correct comment for ensure_playlist()
Comment was previously slightly incorrect.
Also, it was placed in the wrong location.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-21 14:21:10 +02:00
Ronald S. Bultje
6471040f56 FF_OPT_TYPE_* -> AV_OPT_TYPE_*. 2015-08-18 11:48:49 -04:00
Michael Niedermayer
ba12ba859a Merge commit '0c73a5a53cc97f4291bbe9e1e68226edf6161744'
* commit '0c73a5a53cc97f4291bbe9e1e68226edf6161744':
  hls: Save and forward avio options

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-30 17:52:23 +02:00
Luca Barbato
0c73a5a53c hls: Save and forward avio options
Make possible to send the custom headers and override the user agent.

Reported-by: BenWonder
2015-07-30 11:21:26 +02:00
Michael Niedermayer
29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
schenk michael
b9161ef052 avformat/hls: do not iterate to next sequence number if interruption is requested
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-26 14:36:25 +02:00
Michael Niedermayer
7a27aa15ec avformat/hls: Handle read_buffer allocation failure
Fixes CID1297576

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-12 19:03:18 +02:00
wm4
e2691b8092 hls: skip to next segment if the current is unavailable
Apparently, some live streams can delete segments too early, maybe
because the client is too far behind. In this case, it's better to skip
the segment, instead of returning EOF. (Yes, the HLS demuxer actually
returns AVERROR_EOF if opening the segment returns a 404 HTTP error.)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 22:54:17 +02:00
Rodger Combs
bcf44c91c3 libavformat/hls: add an option to start from a given segment in a live stream
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-29 13:34:15 +02:00
Micah Galizia
fca0851879 avformat/hls: refactor repeated HLS option updates
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 13:01:39 +01:00
Micah Galizia
7859618aff avformat/hls: store cookies returned in HLS key response
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 01:57:01 +01:00
selsta
6c8a158989 hls: detect SAMPLE-AES encryption
SAMPLE-AES encryption is not commonly used yet, but without this patch
ffmpeg is thinking that the hls segments are not encrypted which
produces broken files.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-05 23:08:38 +01:00
wm4
4bf3fab281 hls: fix a null pointer dereference
Not allocating the pls->ctx will crash in libavformat/hls.c:1410, where
it tries to dereference the field.

Sample: http://ec24.rtp.pt/liverepeater/rtpn.smil/playlist.m3u8

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-16 19:59:04 +01:00
Michael Niedermayer
4641ae352e avformat: Add and use ff_copy_whitelists()
Fixes potential security issue in case of running out of memory

Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 19:23:23 +02:00
Michael Niedermayer
2c5ae57776 Merge commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea'
* commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea':
  lavf: Use av_gettime_relative

Conflicts:
	libavformat/hls.c

See: f78bc96b7c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 12:40:36 +02:00
Martin Storsjö
6df9d9b55d lavf: Use av_gettime_relative
The ones left using av_gettime are NTP timestamps (for RTCP,
which is specified to send the actual current realtime clock
in RTCP SR packets), and the NUT muxer timestamper, which is
documented as using wallclock time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:45 +03:00
Michael Niedermayer
24cd4e5071 avformat/hls: forward whitelists to mpegts demuxer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-23 15:26:46 +02:00
Michael Niedermayer
0026c4ecfd avformat/hls: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 04:29:27 +02:00
Reimar Döffinger
a0941c8a2b Use new av_dict_set_int helper function.
Get rid of the many, slightly differing, implementations
of basically the same thing.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-16 14:31:41 +02:00
James Almer
d34ec64a22 replace calls to url_feof() with avio_feof()
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 00:48:38 +02:00
Michael Schenk
513a431e07 avformat/hls: reduce memory usage by using dynamically allocated url/key
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-04-12 03:14:52 +03:00
Anssi Hannula
39b192b8e1 avformat/hls: do not call ffurl_seek/ffurl_size on crypto protocol
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>
2014-04-11 00:04:34 +03:00
Vladlen Y. Koshelev
cdbd9e218d avformat/hls: support for seeking on event playlists
This allows clients to seek between first played segment
and the last one in the live stream playlist with #EXT-X-PLAYLIST-TYPE:EVENT attribute.
2014-04-06 17:55:04 +03:00
Anssi Hannula
f29cb45bf2 avformat/hls: flush the subdemuxer when seeking
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>
2014-04-06 17:55:04 +03:00
Anssi Hannula
9aa0606e87 avformat/hls: properly take stream_index into account when seeking
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>
2014-04-06 17:55:04 +03:00
Anssi Hannula
ad701326b4 avformat/hls: open playlists immediately when AVDISCARD_ALL is dropped
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>
2014-04-06 17:55:04 +03:00
Anssi Hannula
05ce529a59 avformat/hls: factor identical playlist allocations out of parse_playlist
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-04-06 17:55:03 +03:00
Anssi Hannula
6b4b73e75d avformat/hls: do not use sequence numbers for packet ordering
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
8fd6875c83 avformat/hls: do not care about stream start timestamps
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
d549b0910c avformat/hls: avoid unnecessary segment retrievals
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
4e85202bcc avformat/hls: improve segment selection when restarting list reception
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
61e1a70278 avformat/hls: track seeking on a per-playlist basis
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
01b184e68d avformat/hls: parse ID3 timestamps for elementary audio streams
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>
2014-04-06 17:55:03 +03:00
Anssi Hannula
1cb8d986b8 avformat/hls: split read_from_url() out of read_data()
Useful for ID3 parsing.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-04-06 17:55:03 +03:00
Anssi Hannula
f7c7fc1369 avformat/hls: add some logging messages
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-04-06 17:55:02 +03:00
Anssi Hannula
da7759b357 avformat/hls: add support for byte-ranged segments
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>
2014-04-06 17:55:02 +03:00
Anssi Hannula
cc1162d775 avformat/hls: always return EOF for unneeded playlist streams
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>
2014-04-06 17:55:02 +03:00
Anssi Hannula
edf4406c4d avformat/hls: add support for alternative renditions
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>
2014-04-06 17:55:02 +03:00
Mikael Finstad
5846d8a91e avformat/hls: Fix cookies and user agent with encrypted HLS streams
Session data (cookies, user-agent) is not being sent on payload requests with
encrypted HLS streams This causes services like Akamai to give a 403 forbidden
when requesting the TS files, because they expect the same cookies
and user-agent on all requests
2014-01-28 18:50:58 +01:00
Anssi Hannula
9371d70bad avformat/hls: decouple playlists from variants
Not all "sub-playlists" are variant playlists (containing the same
content with a different bitrate, etc) in the current version of the HLS
specification. They can now also be alternative renditions, containing
e.g. alternative audio tracks etc.

Decouple playlists from variants to prepare for handling the new
features.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-01-03 15:05:48 +02:00
Michael Niedermayer
9c00f9ada6 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hls: Avoid reading outside of the allocated array

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 18:15:12 +01:00
Michael Niedermayer
9440e47067 Merge commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6'
* commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6':
  hls: Check whether the AVIOContext contains a new redirected URL

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 18:08:53 +01:00
Martin Storsjö
56c2337004 hls: Avoid reading outside of the allocated array
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-22 14:27:10 +02:00
Martin Storsjö
8c92909814 hls: Check whether the AVIOContext contains a new redirected URL
This allows both the main playlist itself as well as the variant
playlists to handle redirects combined with relative URLs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-22 14:27:08 +02:00
kowalsky
4684539c91 avformat/hls: fixed bug where custom http headers weren't kept for hls streams
See: https://trac.ffmpeg.org/ticket/3024
2013-11-07 12:29:45 +01:00
Michael Niedermayer
21a2b97365 avformat/hls: do not limit manifest lines to 1024 chars
Fixes Ticket2976
Debuged-by: jaimeMF
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 20:59:30 +02:00
Michael Niedermayer
95960027a5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hls: Call avformat_find_stream_info() on the chained demuxers

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-31 11:01:30 +02:00
Michael Niedermayer
9696740af7 hls: Call avformat_find_stream_info() on the chained demuxers
This allows the chained demuxer (or more precisely, the lavf
utility code) to better fill in timestamps on packets from
these, especially for cases where one stream is a raw ADTS
stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-30 12:31:08 +03:00
Michael Niedermayer
7dfe798d14 Merge commit '06205b5efdcf0bc4c5463bfdd02f09b5f79fc4cd'
* commit '06205b5efdcf0bc4c5463bfdd02f09b5f79fc4cd':
  hls: Free packets when skipping packets when seeking

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 10:26:04 +02:00
Michael Niedermayer
4971551fd2 Merge commit 'c44191039944526dd7eb6e536990b555837961f5'
* commit 'c44191039944526dd7eb6e536990b555837961f5':
  hls: Store all durations in AV_TIME_BASE

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 10:12:48 +02:00
Michael Niedermayer
5a270296cb Merge commit 'e1d5b244761cf69db655ad7ece1dbf2c13dd4fce'
* commit 'e1d5b244761cf69db655ad7ece1dbf2c13dd4fce':
  hls: Store first_timestamp in units of AV_TIME_BASE

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 10:03:02 +02:00
Martin Storsjö
06205b5efd hls: Free packets when skipping packets when seeking
This fixes memory leaks present since 2b3d041cdc.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 20:15:50 +03:00
Martin Storsjö
c441910399 hls: Store all durations in AV_TIME_BASE
Also parse segment durations as floating point, which is allowed
since HLS version 3.

This is based on a patch by Zhang Rui.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 20:15:50 +03:00
Martin Storsjö
e1d5b24476 hls: Store first_timestamp in units of AV_TIME_BASE
When first_timestamp was stored as-is, its actual time base
wasn't known later in the seek function.

Additionally, the logic (from 795d9594cf) for scaling it
based on stream_index is flawed - stream_index in the seek
function only specifies which stream the seek timestamp refers
to, but obviously doesn't say anything about which stream
first_timestamp belongs to.

In the cases where stream_index was >= 0 and all streams had the
same time base, this didn't matter in practice.

Seeking taking first_timestamp into account is problematic
when one variant is mpegts (with real timestamps) and one variant
is raw ADTS (with timestamps only being accumulated packet
duration), where the variants start at totally different timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 20:15:50 +03:00
Michael Niedermayer
994e09345e Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hls: Create an AVProgram for each variant

Conflicts:
	libavformat/hls.c

See: 23db5418ed
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 14:35:40 +02:00
Michael Niedermayer
65dcb54493 Merge commit '9d64f236292ba28018dd9afd2d57f8f944b33f81'
* commit '9d64f236292ba28018dd9afd2d57f8f944b33f81':
  hls: Respect the different stream time bases when comparing dts

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 14:18:37 +02:00
Michael Niedermayer
2f9e97b32a Merge commit 'c11e33a3d9665dd1fc5dbdecdd03a4860ac6a622'
* commit 'c11e33a3d9665dd1fc5dbdecdd03a4860ac6a622':
  hls: Set stream offset before opening a chained demuxer

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 14:11:21 +02:00
Michael Niedermayer
d31c0fcfa5 Merge commit 'cdd2d73d315ecaf19ff49e64c91923275f1bda68'
* commit 'cdd2d73d315ecaf19ff49e64c91923275f1bda68':
  hls: Don't check discard flags until the parent demuxer's streams actually exist
  hls: Copy the time base from the chained demuxer

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 14:04:27 +02:00
Michael Niedermayer
07440c9380 Merge commit 'eb33ba04e03d9f36e23fffd442510c824be709c3'
* commit 'eb33ba04e03d9f36e23fffd442510c824be709c3':
  hls: Return all packets from a previous variant before moving on to the next one

Conflicts:
	libavformat/hls.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 13:59:27 +02:00
LYF
c110cbf6b5 hls: Create an AVProgram for each variant
Without the information, an application may choose audio from one
variant and video from another variant, which leads to fetching two
variants from the network. This enables av_find_best_stream() to find
matching audio and video streams, so that only one variant is fetched.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:09 +03:00
Michael Niedermayer
9d64f23629 hls: Respect the different stream time bases when comparing dts
Also adjust the streams timestamps according to their start
timestamp when comparing. This helps getting correctly interleaved
packets if one stream lacks timestamps (such as a plain ADTS
stream when the other variants are full mpegts) when the others
have timestamps that don't start from zero.

This probably doesn't work properly if such a stream is
temporarily disabled (via the discard flags) and then reenabled,
and such streams are hard to correctly sync against the other
streams as well - but this works better than before at least.

The segment number restriction makes sure all variants advance
roughly at the same pace as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:08 +03:00
Martin Storsjö
c11e33a3d9 hls: Set stream offset before opening a chained demuxer
This makes sure we don't accidentally check discard flags
for the wrong stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:06 +03:00
Michael Niedermayer
cdd2d73d31 hls: Don't check discard flags until the parent demuxer's streams actually exist
If passing the end of one segment while initializing the
chained demuxer, the parent demuxer's streams aren't set up
yet, so we can't recheck the discard flags.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:05 +03:00
Michael Niedermayer
82bf8c8783 hls: Copy the time base from the chained demuxer
When a variant stream isn't mpegts but e.g. raw adts, the
default time base (90k) isn't correct.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:03 +03:00
Martin Storsjö
eb33ba04e0 hls: Return all packets from a previous variant before moving on to the next one
This serves as a safeguard; normally we want to use the dts
comparison to interleave packets from all active variants. If that
dts comparison for some reason doesn't work as intended, make sure
that all packets in all variants for a certain sequence number have
been returned before moving on to the next one.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 09:50:02 +03:00
Michael Niedermayer
419a3d8a43 avformat/hls: avoid floating point arithmetic
Should make things more reproducable across platforms

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 19:36:33 +02:00
Zhang Rui
2a5891bb9d avformat/hls: parse EXTINF duration as floating-point number
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 19:34:47 +02:00
Timothy Gu
a9bbf59be7 cosmetics: Fix "dont" "wont" "doesnt" typos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-29 02:31:16 +02:00
Reimar Döffinger
efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Michael Niedermayer
a12a618aa9 hls: fix timebase
Fixes Ticket1733

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-07 13:42:12 +01:00
Reimar Döffinger
88d55b827d Remove incorrect use of ctype.h functions.
As far as I can tell the code should not change behaviour
depending on locale in any of these places.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-03-03 21:44:10 +01:00
Reimar Döffinger
db6e2e848b hls: do not access pb->opaque for custom IO.
As the name indicates we can't just assume what the
"opaque" field contains.
This fixes a crash in third-party applications see e.g.:
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=2126

This fixes also FFmpeg trac #2293, which is a different
third-party application.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-02-24 19:49:06 +01:00
Michael Niedermayer
665f2d432c hls: add missing checks for accessing avoption fields
Fixes null pointer exception and probably other things

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-23 22:22:53 +01:00
Micah Galizia
d4e5d8d4c2 lavf/hls: broker HTTP options
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-01-23 19:27:14 +01:00
Diego Biurrun
511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Clément Bœsch
030db0c1dd lavf/hls: whitespace cosmetics after 23db5418. 2012-11-21 08:01:51 +01:00
LYF
23db5418ed hls: create an AVProgram for each variant
Without the information, application may choose audio from one variant
and video from another variant, which leads to fetch two variants from
network. This enables av_find_best_stream() to find matching audio and
video streams, so that only one variant is fetched from network.

Signed-off-by: LYF <yefei.li@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-21 01:24:01 +01:00
Michael Niedermayer
395caf3de8 hls: fix integer overflow
Fixes CID717892
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-19 23:00:47 +02:00
Duncan Salerno
bd2f8e8f79 Fix second use of AVOptions in HLS
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-09 22:12:34 +02:00
Duncan Salerno
5cdd3b995c hls: Disable http seekability probing
Some HLS servers return 403 when the Range header is present. Disabling http
seekability probing prevents the header from being added.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-05 05:15:55 +02:00
Michael Niedermayer
3ac754b93b hls: fix min DTS code, try #2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-21 01:52:55 +02:00
Michael Niedermayer
bf606334ad hls: fix EOF check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-21 01:52:55 +02:00
Michael Niedermayer
7123e9506b hls: use av_compare_ts() instead of comparing apples to oranges.
Fixes Ticket983

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-21 01:00:05 +02:00
Michael Niedermayer
5e3900c7a5 hls: Initialize stream_offset before find_stream_info.
find stream info causes reads that may use the offset in their callback

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-13 20:37:52 +02:00
Michael Niedermayer
cc913f7490 hls: check that the streams have been initialized before checking their discard flags.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-13 20:37:04 +02:00
Michael Niedermayer
b5da7d4c1a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avformat: Drop pointless "format" from container long names
  swscale: bury one more piece of inline asm under HAVE_INLINE_ASM.
  wv: K&R formatting cosmetics
  configure: Add missing descriptions to help output
  h264_ps: declare array of colorspace strings on its own line.
  fate: amix: specify f32 sample format for comparison
  tiny_psnr: support 32-bit float samples
  eamad/eatgq/eatqi: call special EA IDCT directly
  eamad: remove use of MpegEncContext
  mpegvideo: remove unnecessary inclusions of faandct.h
  af_asyncts: avoid overflow in out_size with large delta values
  af_asyncts: add first_pts option

Conflicts:
	configure
	libavcodec/eamad.c
	libavcodec/h264_ps.c
	libavformat/crcenc.c
	libavformat/ffmdec.c
	libavformat/ffmenc.c
	libavformat/framecrcenc.c
	libavformat/md5enc.c
	libavformat/nutdec.c
	libavformat/rawenc.c
	libavformat/yuv4mpeg.c
	tests/tiny_psnr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-30 23:28:31 +02:00
Diego Biurrun
6774247a9d avformat: Drop pointless "format" from container long names 2012-07-30 13:59:06 +02:00
Michael Niedermayer
706bd8ea19 Merge remote-tracking branch 'qatar/master'
* qatar/master: (35 commits)
  h264_idct_10bit: port x86 assembly to cpuflags.
  x86inc: clip num_args to 7 on x86-32.
  x86inc: sync to latest version from x264.
  fft: rename "z" to "zc" to prevent name collision.
  wv: return meaningful error codes.
  wv: return AVERROR_EOF on EOF, not EIO.
  mp3dec: forward errors for av_get_packet().
  mp3dec: remove a pointless local variable.
  mp3dec: remove commented out cruft.
  lavfi: bump minor to mark stabilizing the ABI.
  FATE: add tests for yadif.
  FATE: add a test for delogo video filter.
  FATE: add a test for amix audio filter.
  audiogen: allow specifying random seed as a commandline parameter.
  vc1dec: Override invalid macroblock quantizer
  vc1: avoid reading beyond the last line in vc1_draw_sprites()
  vc1dec: check that coded slice positions and interlacing match.
  vc1dec: Do not ignore ff_vc1_parse_frame_header_adv return value
  configure: Move parts that should not be user-selectable to CONFIG_EXTRA
  lavf: remove commented out cruft in avformat_find_stream_info()
  ...

Conflicts:
	Makefile
	configure
	libavcodec/vc1dec.c
	libavcodec/x86/h264_deblock.asm
	libavcodec/x86/h264_deblock_10bit.asm
	libavcodec/x86/h264dsp_mmx.c
	libavfilter/version.h
	libavformat/mp3dec.c
	libavformat/utils.c
	libavformat/wv.c
	libavutil/x86/x86inc.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-29 02:16:26 +02:00
Martin Storsjö
8ebacfb598 hls: Proceed to the next segment at any error code
Previously, we returned any error code except AVERROR_EOF to the
caller - only if AVERROR_EOF or 0 was returned, we proceeded to
the next segment.

With some setups of web servers, using Connection: close in https
and GnuTLS, we don't get a clean error code at the end of segments.
In those cases, just proceed to the next segment.

Tested-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-28 01:21:32 +03:00
Michael Niedermayer
6f6182372c hls: replace probsize=0 by noheader flag removial.
This fixes h264 timestamps in hls
Fixes ticket1572

Tested-by: crtmpserver
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-26 03:05:31 +02:00
Michael Niedermayer
3005122485 hls: call avformat_find_stream_info()
This is needed to correctly demux h264 in ts

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-25 17:40:33 +02:00
Lou Logan
b22ecbc6a5 cosmetics: various spelling fixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-06 17:08:22 +02:00
Stefano Sabatini
d9355a03f2 lavf/applehttp: add log message in case of applehttp_read_header() failure
Improve error reporting.
2012-06-29 14:50:27 +02:00
Michael Niedermayer
e847f41285 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libspeexenc: add supported sample rates and channel layouts.
  Replace usleep() calls with av_usleep()
  lavu: add av_usleep() function
  utvideo: mark interlaced frames as such
  utvideo: Fix interlaced prediction for RGB utvideo.
  cosmetics: do not use full path for local headers
  lavu/file: include unistd.h only when available
  configure: check for unistd.h
  log: include unistd.h only when needed
  lavf: include libavutil/time.h instead of redeclaring av_gettime()

Conflicts:
	configure
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/utvideo.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-22 22:34:02 +02:00
Mans Rullgard
896bb0d742 Replace usleep() calls with av_usleep()
This reduces the dependency on unistd.h which is not available
on all systems.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:36 +01:00
Michael Niedermayer
eadd4264ee Merge remote-tracking branch 'qatar/master'
* qatar/master: (36 commits)
  adpcmenc: Use correct frame_size for Yamaha ADPCM.
  avcodec: add ff_samples_to_time_base() convenience function to internal.h
  adx parser: set duration
  mlp parser: set duration instead of frame_size
  gsm parser: set duration
  mpegaudio parser: set duration instead of frame_size
  (e)ac3 parser: set duration instead of frame_size
  flac parser: set duration instead of frame_size
  avcodec: add duration field to AVCodecParserContext
  avutil: add av_rescale_q_rnd() to allow different rounding
  pnmdec: remove useless .pix_fmts
  libmp3lame: support float and s32 sample formats
  libmp3lame: renaming, rearrangement, alignment, and comments
  libmp3lame: use the LAME default bit rate
  libmp3lame: use avpriv_mpegaudio_decode_header() for output frame parsing
  libmp3lame: cosmetics: remove some pointless comments
  libmp3lame: convert some debugging code to av_dlog()
  libmp3lame: remove outdated comment.
  libmp3lame: do not set coded_frame->key_frame.
  libmp3lame: improve error handling in MP3lame_encode_init()
  ...

Conflicts:
	doc/APIchanges
	libavcodec/libmp3lame.c
	libavcodec/pcxenc.c
	libavcodec/pnmdec.c
	libavcodec/pnmenc.c
	libavcodec/sgienc.c
	libavcodec/utils.c
	libavformat/hls.c
	libavutil/avutil.h
	libswscale/x86/swscale_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-21 05:10:12 +01:00
Martin Storsjö
a4f97be1a9 hls: Reset the AVIOContext when seeking
This avoids reading any old data in the AVIOContext buffer after
the seek, and indicates to the mpegts demuxer that we've seeked,
avoiding continuity check errors.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-20 11:10:02 +02:00
Panagiotis H.M. Issaris
2b3d041cdc applehttp: Do seeking within segments, too
Enhance seeking by demuxing until the requested timestamp is
reached within the segment selected by the seek code using the
playlist info.

Some mpegts streams don't have dts set for all packets though,
this seeking method doesn't work well for that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-19 23:03:42 +02:00
Michael Niedermayer
c980be9e3a Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits)
  CDXL demuxer and decoder
  hls: Re-add legacy applehttp name to preserve interface compatibility.
  hlsproto: Rename the functions and context
  hlsproto: Encourage users to try the hls demuxer instead of the proto
  doc: Move the hls protocol section into the right place
  libavformat: Rename the applehttp protocol to hls
  hls: Rename the functions and context
  libavformat: Rename the applehttp demuxer to hls
  rtpdec: Support H263 in RFC 2190 format
  rv30: check block type validity
  ttadec: CRC checking
  movenc: Support muxing VC1
  avconv: Don't split out inline sequence headers when stream copying VC1
  rv34: handle size changes during frame multithreading
  rv40: prevent undefined signed overflow in rv40_loop_filter()
  rv34: use AVERROR return values in ff_rv34_decode_frame()
  rv34: use uint16_t for RV34DecContext.deblock_coefs
  librtmp: Add "lib" prefix to librtmp URLProtocol declarations.
  movenc: Use defines instead of hardcoded numbers for RTCP types
  smjpegdec: implement seeking
  ...

Conflicts:
	Changelog
	doc/general.texi
	libavcodec/avcodec.h
	libavcodec/rv30.c
	libavcodec/tta.c
	libavcodec/version.h
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/version.h
	libswscale/x86/swscale_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-15 01:52:14 +01:00
Alex Converse
c1df37e59b hls: Re-add legacy applehttp name to preserve interface compatibility. 2012-02-14 12:13:46 -08:00
Martin Storsjö
65cd7bf32f hls: Rename the functions and context
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-14 20:05:32 +02:00
Martin Storsjö
2772258a98 libavformat: Rename the applehttp demuxer to hls
When this demuxer was created, there didn't seem to be any
consensus of a common short name for this protocol. Now
the consensus seems to be to call it hls.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-14 20:05:31 +02:00