1. 09 May, 2020 1 commit
    • Andreas Rheinhardt's avatar
      avformat/oggenc: Avoid allocating and copying when writing page data · d0bd00c8
      Andreas Rheinhardt authored
      When the Ogg muxer writes a page, it has to do three things: It needs to
      write a page header, then it has to actually copy the page data and then
      it has to calculate and write a CRC checksum of both header as well as
      data at a certain position in the page header.
      
      To do this, the muxer used a dynamic buffer for both writing as well as
      calculating the checksum via an AVIOContext's feature to automatically
      calculate checksums on the data it writes. This entails an allocation of
      an AVIOContext, of the opaque specific to dynamic buffers and of the
      buffer itself (which may be reallocated multiple times) as well as
      memcopying the data (first into the AVIOContext's small write buffer,
      then into the dynamic buffer's big buffer).
      
      This commit changes this: The page header is no longer written into a
      dynamic buffer any more; instead the (small) page header is written into
      a small buffer on the stack. The CRC is then calculated directly via
      av_crc() on both the page header as well as the page data. Then both the
      page header and the page data are written.
      
      Finally, ogg_write_page() can now no longer fail, so it has been
      modified to return nothing; this also fixed a bug in the only caller of
      this function: It didn't check the return value.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      d0bd00c8
  2. 03 May, 2020 2 commits
  3. 20 Apr, 2020 1 commit
    • Andreas Rheinhardt's avatar
      avformat/oggenc: Don't free AVStream's priv_data, fix memleak · 0fcf74f4
      Andreas Rheinhardt authored
      For FLAC, Speex, Opus and VP8 the Ogg muxer allocates two buffers
      for building the headers: The first for extradata in an Ogg-specific
      format and the second contains a Vorbiscomment. These buffers are
      reachable via pointers in the corresponding AVStream's priv_data.
      
      If an error happens during building the headers, the AVStream's
      priv_data would be freed. This is pointless in general as it would be
      freed generically anyway, but here it is actively harmful: If the second
      of the aforementioned allocations fails, the first buffer would leak
      upon freeing priv_data.
      
      This commit stops freeing priv_data manually, which allows the muxer to
      properly clean up in the deinit function.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      0fcf74f4
  4. 07 Jan, 2020 2 commits
  5. 21 Oct, 2019 1 commit
  6. 18 Dec, 2018 1 commit
  7. 22 Jun, 2017 1 commit
  8. 19 Jun, 2017 1 commit
  9. 21 Jul, 2016 2 commits
  10. 20 Jul, 2016 1 commit
  11. 12 Jul, 2016 1 commit
  12. 11 Jul, 2016 1 commit
  13. 23 Feb, 2016 1 commit
    • Anton Khirnov's avatar
      lavf: replace AVStream.codec with AVStream.codecpar · 9200514a
      Anton Khirnov authored
      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.
      9200514a
  14. 27 Aug, 2015 1 commit
  15. 09 Jun, 2015 1 commit
  16. 11 May, 2015 1 commit
  17. 15 Feb, 2015 1 commit
  18. 14 Feb, 2015 1 commit
  19. 01 Feb, 2015 2 commits
  20. 14 Dec, 2014 1 commit
  21. 03 Dec, 2014 1 commit
  22. 06 Nov, 2014 1 commit
  23. 29 Oct, 2014 1 commit
  24. 13 Oct, 2014 1 commit
  25. 23 Aug, 2014 1 commit
  26. 22 Aug, 2014 1 commit
  27. 18 Jun, 2014 1 commit
    • Anton Khirnov's avatar
      lavf: switch to AVStream.time_base as the hint for the muxer timebase · 194be1f4
      Anton Khirnov authored
      Previously, AVStream.codec.time_base was used for that purpose, which
      was quite confusing for the callers. This change also opens the path for
      removing AVStream.codec.
      
      The change in the lavf-mkv test is due to the native timebase (1/1000)
      being used instead of the default one (1/90000), so the packets are now
      sent to the crc muxer in the same order in which they are demuxed
      (previously some of them got reordered because of inexact timestamp
      conversion).
      194be1f4
  28. 06 Jun, 2014 1 commit
    • Martin Storsjö's avatar
      oggenc: Set the right AVOption size for the pref_duration option · 103243ca
      Martin Storsjö authored
      On big endian machines, the default value set via the faulty
      AVOption ended up as 2^32 times too big.
      
      This fixes the fate-lavf-ogg test which currently is broken on
      big endian machines, broken since 38313626. Since that commit,
      a final zero-sized packet is written to the ogg muxer in that test,
      which caused different flushing behaviour on little and big endian
      depending on whether the pref_duration option was handled as it
      should or not.
      
      CC: libav-stable@libav.org
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      103243ca
  29. 04 Jun, 2014 1 commit
  30. 28 May, 2014 2 commits
  31. 27 May, 2014 3 commits
  32. 15 May, 2014 1 commit
    • Anton Khirnov's avatar
      lavf: add AVFMT_FLAG_BITEXACT. · 0c1959b0
      Anton Khirnov authored
      Use it instead of checking CODEC_FLAG_BITEXACT in the first stream's
      codec context.
      
      Using codec options inside lavf is fragile and can easily break when the
      muxing codec context is not the encoding context.
      0c1959b0
  33. 04 Apr, 2014 1 commit