Commit Graph

24 Commits

Author SHA1 Message Date
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
Diego Biurrun 29c2d06d67 cosmetics: Drop empty comment lines 2016-02-18 15:35:30 +01:00
Diego Biurrun 69a68593ce Remove stray line breaks from avpriv_{report_missing_feature|request_samples} 2015-12-26 10:28:03 +01:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Vittorio Giovara bfeb83a8b7 rtpdec_hevc: Drop extra sanity check for size of input packet
In this case len is always at least 3, since it is checked against
RTP_HEVC_PAYLOAD_HEADER_SIZE + 1 before entering the switch block.

Bug-Id: CID 1238784
2015-03-09 12:57:01 +00:00
Martin Storsjö ec96a89c3e rtpdec: Don't pass non-const pointers to fmtp attribute parsing functions
This makes it clear that the individual parsing functions can't
touch the parsed out value.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:22 +02:00
Martin Storsjö 3567b91e49 rtpdec_hevc: Share the implementation of fragmented packets with h264
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:25:28 +02:00
Martin Storsjö f3449062a8 rtpdec_hevc: Reduce indentation level by returning early on errors
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:25:21 +02:00
Martin Storsjö 8633fb47db rtpdec_hevc: Share the implementation of parsing a=framesize with h264
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:24:36 +02:00
Martin Storsjö 5956f489d0 rtpdec_hevc: Add asterisks at the start of each long comment line
This is the common style for such comments.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:24:27 +02:00
Martin Storsjö 5d8cae4573 rtpdec: Get rid of all trivial .alloc/.free functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:24:19 +02:00
Martin Storsjö 2b982e92f4 rtpdec: Set need_parsing via a handler field
This avoids implementing a full function just to set this one
field.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:22:41 +02:00
Martin Storsjö 3cd5828fc0 rtpdec: Add missing trailing commas
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 16:20:02 +02:00
Martin Storsjö fe208ca54b rtpdec_hevc: Skip 1 byte (DOND) instead of 2 (DONL) between aggregation units
Only the first aggregation unit has 2 bytes (DONL) prepended, if
such a field is in use.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-23 15:33:20 +02:00
Thomas Volkert cbdd1806ea rtpdec_hevc: Implement parsing of aggregated packets
With significant changes by Martin Storsjö, to use the shared
function instead of reimplementing it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-21 11:32:50 +02:00
Martin Storsjö b878ba03e7 rtpdec_hevc: Initialize variables to silence false positive compiler warnings
For some reason, clang didn't warn about this prior to using the
shared function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-21 11:32:47 +02:00
Martin Storsjö 10e2d8b556 rtpdec_hevc: Use a shared function for parsing parameter sets
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-21 11:32:44 +02:00
Vittorio Giovara 350ed18292 rtpdec_hevc: drop unnecessary check
len is always >=1 in that case.

Bug-Id: CID 1238784
2014-10-20 10:44:42 +01:00
Martin Storsjö ced7238cd0 rtpdec_hevc: Use av_realloc instead of av_malloc+memcpy
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 20:54:32 +03:00
Martin Storsjö 752e71e74f rtpdec_hevc: Rename a variable for clarity
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 20:54:30 +03:00
Martin Storsjö 9b7f932ee5 rtpdec_hevc: Parse out of band vps/sps/pps/sei from fmtp lines
These are assembled into extradata in the order vps/sps/pps/sei.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-15 12:12:02 +03:00
Vittorio Giovara c463dfc7e4 rtpdec_hevc: Drop a duplicated, nonstandard entry
The RFC spec draft only specifies the "H265" name - there is no
specification saying how to interpret "HEVC" (if such a packet
format is specified it could be an entirely different format).

Since this is a very new standard (still a draft), there is little
need for compatibility with existing, broken implementations. Therefore
remove the extra alias, to avoid the risk of encouraging incorrect
usage.

Intentionally keeping the ff_hevc_dynamic_handler name for the
handler, to use "hevc" consistently as name for the codec instead
of "h265" within the library internals as long as there only is one
single variant in actual use.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-09-24 10:44:14 +03:00
Thomas Volkert 95e177eeb2 rtpdec: HEVC/H.265 support
As specified in draft-ietf-payload-rtp-h265-06.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-03 02:39:24 +02:00