Commit Graph

373 Commits

Author SHA1 Message Date
Clément Bœsch
7c1a002c78 subtitles: introduce ASS codec id and use it.
Currently, we have a AV_CODEC_ID_SSA, which matches the way the ASS/SSA
markup is muxed in a standalone .ass/.ssa file. This means the AVPacket
data starts with a "Dialogue:" string, followed by a timing information
(start and end of the event as string) and a trailing CRLF after each
line. One packet can contain several lines. We'll refer to this layout
as "SSA" or "SSA lines".

In matroska, this markup is not stored as such: it has no "Dialogue:"
prefix, it contains a ReadOrder field, the timing information is not in
the payload, and it doesn't contain the trailing CRLF. See [1] for more
info. We'll refer to this layout as "ASS".

Since we have only one common codec for both formats, the matroska
demuxer is constructing an AVPacket following the "SSA lines" format.
This causes several problems, so it was decided to change this into
clean ASS packets.

Some insight about what is changed or unchanged in this commit:

  CODECS
  ------

  - the decoding process still writes "SSA lines" markup inside the ass
    fields of the subtitles rectangles (sub->rects[n]->ass), which is
    still the current common way of representing decoded subtitles
    markup. It is meant to change later.

  - new ASS codec id: AV_CODEC_ID_ASS (which is different from the
    legacy AV_CODEC_ID_SSA)

  - lavc/assdec: the "ass" decoder is renamed into "ssa" (instead of
    "ass") for consistency with the codec id and allows to add a real
    ass decoder. This ass decoder receives clean ASS lines (so it starts
    with a ReadOrder, is followed by the Layer, etc). We make sure this
    is decoded properly in a new ass-line rectangle of the decoded
    subtitles (the ssa decoder OTOH is doing a simple straightforward
    copy). Using the packet timing instead of data string makes sure the
    ass-line now contains the appropriate timing.

  - lavc/assenc: just like the ass decoder, the "ssa" encoder is renamed
    into "ssa" (instead of "ass") for consistency with the codec id, and
    allows to add a real "ass" encoder.

    One important thing about this encoder is that it only supports one
    ass rectangle: we could have put several dialogue events in the
    AVPacket (separated by a \0 for instance) but this would have cause
    trouble for the muxer which needs not only the start time, but also
    the duration: typically, you have merged events with the same start
    time (stored in the AVPacket->pts) but a different duration. At the
    moment, only the matroska do the merge with the SSA-line codec.

    We will need to make sure all the decoders in the future can't add
    more than one rectangle (and only one Dialogue line in it
    obviously).

  FORMATS
  -------

  - lavf/assenc: the .ass/.ssa muxer can take both SSA and ASS packets.
    In the case of ASS packets as input, it adds the timing based on the
    AVPacket pts and duration, and mux it with "Dialogue:", trailing
    CRLF, etc.

  - lavf/assdec: unchanged; it currently still only outputs SSA-lines
    packets.

  - lavf/mkv: the demuxer can now output ASS packets without the need of
    any "SSA-lines" reconstruction hack. It will become the default at
    next libavformat bump, and the SSA support will be dropped from the
    demuxer. The muxer can take ASS packets since it's muxed normally,
    and still supports the old SSA packets. All the SSA support and
    hacks in Matroska code will be dropped at next lavf bump.

[1]: http://www.matroska.org/technical/specs/subtitles/ssa.html
2013-04-18 23:23:59 +02:00
Clément Bœsch
2a7f885fe1 lavf: add libquvi demuxer. 2013-04-10 12:09:20 +02:00
Michael Niedermayer
ef7b6b489a ffmpeg/avformat: factor av_guess_frame_rate() out
This will be used in ffplay

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-29 17:40:28 +01:00
Michael Niedermayer
b2e0c9dd34 Merge commit '85a5bc054c1290699ccbf5799ba6c4e2fbcc3530'
* commit '85a5bc054c1290699ccbf5799ba6c4e2fbcc3530':
  lavf: remove disabled FF_API_R_FRAME_RATE cruft

Conflicts:
	libavformat/avformat.h
	libavformat/electronicarts.c
	libavformat/rawdec.c
	libavformat/utils.c
	libavformat/version.h

The field is in use and no semantically equivalent field is available,
thus not removed

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:55:00 +01:00
Michael Niedermayer
acbd14bc7e avformat: postpone API removials where the functions are trivial wrapers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:43:02 +01:00
Michael Niedermayer
06a8350599 Merge commit '7b486ab13bfcfa88a7cd92586de50e49966ec292'
* commit '7b486ab13bfcfa88a7cd92586de50e49966ec292':
  lavf: remove disabled FF_API_AV_GETTIME cruft
  lavf: remove disabled FF_API_INTERLEAVE_PACKET cruft

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:37:03 +01:00
Michael Niedermayer
256e1f7bdf Merge commit '435c2a31ad5eead20eda1152097f60c3bfa22847'
* commit '435c2a31ad5eead20eda1152097f60c3bfa22847':
  lavf: remove disabled FF_API_READ_PACKET cruft

Conflicts:
	libavformat/version.h

Removial postponed as wraper is trivial

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:34:06 +01:00
Michael Niedermayer
1c60956c80 Merge commit 'c7e044c61bb08b3a6e1e8063e8f4449c88b01201'
* commit 'c7e044c61bb08b3a6e1e8063e8f4449c88b01201':
  lavf: remove disabled FF_API_APPLEHTTP_PROTO cruft

Conflicts:
	libavformat/allformats.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:21:43 +01:00
Michael Niedermayer
ed80427e0e Merge commit '0a7c4daf469d4ac447fb822fe78337f62f4c04e6'
* commit '0a7c4daf469d4ac447fb822fe78337f62f4c04e6':
  lavf: remove disabled FF_API_CLOSE_INPUT_FILE cruft

Conflicts:
	libavformat/version.h

removial postponed as the wraper code is trivial

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 12:18:06 +01:00
Michael Niedermayer
a75f01d7e0 Merge commit 'd8b31be6caebd8d1321ecb754b6e7daaf81dc111'
* commit 'd8b31be6caebd8d1321ecb754b6e7daaf81dc111':
  Add the bumps and APIchanges entries for reference counted buffers changes.

Conflicts:
	Changelog
	doc/APIchanges
	libavcodec/version.h
	libavdevice/version.h
	libavfilter/version.h
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-12 15:35:39 +01:00
Anton Khirnov
85a5bc054c lavf: remove disabled FF_API_R_FRAME_RATE cruft 2013-03-11 18:23:50 +01:00
Anton Khirnov
7b486ab13b lavf: remove disabled FF_API_AV_GETTIME cruft 2013-03-11 18:23:18 +01:00
Anton Khirnov
32e5194969 lavf: remove disabled FF_API_INTERLEAVE_PACKET cruft 2013-03-11 18:23:10 +01:00
Anton Khirnov
435c2a31ad lavf: remove disabled FF_API_READ_PACKET cruft 2013-03-11 18:23:02 +01:00
Anton Khirnov
c7e044c61b lavf: remove disabled FF_API_APPLEHTTP_PROTO cruft 2013-03-11 18:22:54 +01:00
Anton Khirnov
0a7c4daf46 lavf: remove disabled FF_API_CLOSE_INPUT_FILE cruft 2013-03-11 18:22:45 +01:00
Anton Khirnov
d8b31be6ca Add the bumps and APIchanges entries for reference counted buffers changes. 2013-03-08 07:41:49 +01:00
Stefano Sabatini
d95143ec82 lavf/segment: add support to ffconcat segment list 2013-03-07 01:44:59 +01:00
Nicolas George
3ab25e4574 Revert "lavf/concatdec: define "ffcat" and "ffconcat" extensions"
This reverts commit 6cc12353a8.

Conflicts:
	libavformat/version.h

Allowing to automatically select the concat demuxer raises
security concerns, as it allows a possibly hostile file to
access any file on the system. Guessing the format based on
the file name extension does not allow to enable the safe
mode designed to avoid it.
2013-03-05 14:10:10 +01:00
Michael Niedermayer
03678a32bc Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavf: Add a fate test for the noproxy pattern matching
  lavf: Handle the environment variable no_proxy more properly

Conflicts:
	libavformat/Makefile
	libavformat/internal.h
	libavformat/tls.c
	libavformat/utils.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-28 13:13:04 +01:00
Stefano Sabatini
6cc12353a8 lavf/concatdec: define "ffcat" and "ffconcat" extensions 2013-02-28 00:16:33 +01:00
Martin Storsjö
de9cd1b173 lavf: Handle the environment variable no_proxy more properly
The handling of the environment variable no_proxy, present since
one of the initial commits (de6d9b6404), is inconsistent with
how many other applications and libraries interpret this
variable. Its bare presence does not indicate that the use of
proxies should be skipped, but it is some sort of pattern for
hosts that does not need using a proxy (e.g. for a local network).

As investigated by Rudolf Polzer, different libraries handle this
in different ways, some supporting IP address masks, some supporting
arbitrary globbing using *, some just checking that the pattern matches
the end of the hostname without regard for whether it actually is
the right domain or a domain that ends in the same string.

This simple logic should be pretty similar to the logic used by
lynx and curl.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-27 21:32:13 +02:00
Daniel Verkamp
1ecce266fa WAV muxer: add RF64 support 2013-02-12 14:50:27 +00:00
Nicolas George
f43d09cd60 lavf: add tee pseudo-muxer. 2013-02-09 20:50:11 +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
Michael Niedermayer
73b59cc1ba Merge commit '4f56e773fe8a554b8c2662650aaf799c2ece2721'
* commit '4f56e773fe8a554b8c2662650aaf799c2ece2721':
  x86: ac3: Fix HAVE_MMXEXT condition to only refer to external assembly
  rtpenc: Start the sequence numbers from a random offset

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-22 14:27:48 +01:00
Martin Storsjö
ab587f39b2 rtpenc: Start the sequence numbers from a random offset
Expose the current sequence number via an AVOption - this can
be used both for setting the initial sequence number, or for
querying the current number.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-22 00:25:38 +02:00
Michael Niedermayer
bc639dbd9b Merge commit 'a2a991b2ddf951454ffceb7bcedc9db93e26c610'
* commit 'a2a991b2ddf951454ffceb7bcedc9db93e26c610':
  srtp: Improve the minimum encryption buffer size check
  srtp: Add support for a few DTLS-SRTP related crypto suites

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 15:00:45 +01:00
Martin Storsjö
e1d0b3d875 srtp: Add support for a few DTLS-SRTP related crypto suites
The main difference to the existing suites from RFC 4568 is
that the version with a 32 bit HMAC still uses 80 bit HMAC
for RTCP packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:35 +02:00
Stefano Sabatini
d4890c1068 lavf/segment: add support to segment list file entries sliding window listing
In particular, should fix trac ticket #1842.
2013-01-19 00:22:58 +01:00
Carl Eugen Hoyos
a1a707f728 Add a new function av_codec_get_tag2().
av_codec_get_tag() may return 0 both in case a codec_tag was
found and if no codec_tag was found.
The new function does not have this ambiguity.
2013-01-17 20:44:33 +01:00
Micah Galizia
0b80a12184 lavf/http: add HTTP protocol cookie support
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-01-15 22:26:30 +01:00
Michael Niedermayer
b52925d2cd Merge commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05'
* commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05':
  lavf: Add a protocol for SRTP encryption/decryption
  rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 16:05:34 +01:00
Martin Storsjö
2f3bada63e lavf: Add a protocol for SRTP encryption/decryption
This is mostly useful for encryption together with the RTP muxer,
but could also be set up as IO towards the peer with the SDP
demuxer with custom IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 11:55:10 +02:00
Martin Storsjö
424da30830 rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)
This only takes care of decrypting incoming packets; the outgoing
RTCP packets are not encrypted. This is enough for some use cases,
and signalling crypto keys for use with outgoing RTCP packets
doesn't fit as simply into the API. If the SDP demuxer is hooked
up with custom IO, the return packets can be encrypted e.g. via the
SRTP protocol.

If the SRTP keys aren't available within the SDP, the decryption
can be handled externally as well (when using custom IO).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 11:54:40 +02:00
Michael Niedermayer
34c1c08c66 Merge commit '86d9181cf41edc3382bf2481f95a2fb321058689'
* commit '86d9181cf41edc3382bf2481f95a2fb321058689':
  rtpdec: Support sending RTCP feedback packets

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 11:48:14 +01:00
Martin Storsjö
86d9181cf4 rtpdec: Support sending RTCP feedback packets
This sends NACK for missed packets and PLI (picture loss indication)
if a depacketizer indicates that it needs a new keyframe, according
to RFC 4585.

This is only enabled if the SDP indicated that feedback is supported
(via the AVPF or SAVPF profile names).

The feedback packets are throttled to a certain maximum interval
(currently 250 ms) to make sure the feedback packets don't eat up
too much bandwidth (which might be counterproductive). The RFC
specifies a more elaborate feedback packet scheduling.

The feedback packets are currently sent independently from normal
RTCP RR packets, which is not totally spec compliant, but works
fine in the environments I've tested it in. (RFC 5506 allows this,
but requires a SDP attribute for enabling it.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-08 17:48:14 +02:00
Carl Eugen Hoyos
1ae9d2820e Support decoding AC-3 in wav.
All known samples are actually ac3-in-spdif-in-wav, so use
the spdif demuxer to get the ac3 frames.
2013-01-06 18:48:51 +01:00
Carl Eugen Hoyos
1a34103f0f mmf.c: Use LIBAVFORMAT_IDENT when writing Yamaha SMAF version information. 2013-01-05 23:39:46 +01:00
James Almer
b7d77f8e64 astenc: Enable the loop flag only when needed
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-05 17:07:42 +01:00
Michael Niedermayer
8d0b2aae71 Merge commit 'e96406eda4f143f101bd44372f7b2d542183000a'
* commit 'e96406eda4f143f101bd44372f7b2d542183000a':
  rtsp: Add support for depacketizing RTP data via custom IO

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:23:19 +01:00
Martin Storsjö
e96406eda4 rtsp: Add support for depacketizing RTP data via custom IO
To use this, set sdpflags=custom_io to the sdp demuxer. During
the avformat_open_input call, the SDP is read from the AVFormatContext
AVIOContext (ctx->pb) - after the avformat_open_input call,
during the av_read_frame() calls, the same ctx->pb is used for reading
packets (and sending back RTCP RR packets).

Normally, one would use this with a read-only AVIOContext for the
SDP during the avformat_open_input call, then close that one and
replace it with a read-write one for the packets after the
avformat_open_input call has returned.

This allows using the RTP depacketizers as "pure" demuxers, without
having them tied to the libavformat network IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:15:27 +02:00
Clément Bœsch
dc8b36746a lavf/webvtt: use ff_subtitles_read_chunk().
The FATE test is updated because the line breaks in the dialogue
rectangles are now proper CRLF.
2013-01-03 07:46:30 +01:00
Clément Bœsch
3fa642d60f subviewer: sanitize packets.
The data does not contain timing or trailing line breaks anymore. In
addition to being less idiotic, it is consistent with other codecs and
thus allows more switches between formats and codecs. It also fixes the
issue of the trailing line returns being simple \n instead of CRLF in
the ASS rectangle dialogue (this is the reason of the FATE update).
2013-01-03 07:25:47 +01:00
Nicolas George
ecda1d3cbe lavf: add data: URI scheme. 2013-01-01 19:29:04 +01:00
Michael Niedermayer
9336a980bb Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtmp: Add support for limelight authentication
  rtmp: Add support for adobe authentication

Conflicts:
	Changelog
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-01 14:04:50 +01:00
Martin Storsjö
c1ea44c54d rtmp: Add support for limelight authentication
Limelight is a not too uncommon CDN. The authentication scheme is
pretty similar to the adobe authentication, but is even closer to
normal http digest authentication (but not close enough to warrant
sharing code) than the adobe version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-31 13:39:09 +02:00
Martin Storsjö
08225d0126 rtmp: Add support for adobe authentication
This is mostly used to authenticate the client when publishing.
Tested with wowza and akamai.

Some but not all servers support resending a new connect invoke
within the same connection, so always reconnect for sending a new
connection attempt. This matches what other applications do as well.

The authentication scheme is structurally pretty similar to http
digest authentication, but uses base64 instead of hex strings.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-31 13:39:08 +02:00
Paul B Mahol
9a74282644 Sony Wave64 muxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2012-12-31 07:10:57 +00:00
Clément Bœsch
1f265f5205 microdvd: sanitize AVPackets.
Current MicroDVD AVPackets contain timing information and trailing line
breaks. The data is now only composed of the markup data. Doing this
consistently between text subtitles decoders allows to use different
codec for various formats. For instance, MicroDVD markup is sometimes
found in some VPlayer files. Also, generally speaking, the subtitles
text decoders have no use of these timings (and they must not use them
since it would break any user timing adjustment).

Technically, this is a major ABI break. In practice, a mismatching
lavf/lavc will now error out for MicroDVD decoding. Supporting both
formats requires unnecessary complex and fragile code.

FATE needs update because line breaks in the ASS file were "\n" (because
that's what is used in the original file). ASS format expect "\r\n" line
breaks; this commit fixes this issue. Also note that this "\r\n"
trailing need to be moved at some point from the decoders to the ASS
muxer.
2012-12-31 00:41:35 +01:00