1. 21 Apr, 2020 9 commits
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Cosmetics · 8a4fda02
      Andreas Rheinhardt authored
      Reindentation, removal of { } if they contain only one statement
      and moving the return statement to a line of its own in situations
      like "if (ret < 0) return ret;". Moreover, several overlong lines
      were made shorter and a camelCase variable received a name in line
      with our naming conventions.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      8a4fda02
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Redo handling of FlagDefault · e3c54b54
      Andreas Rheinhardt authored
      Up until now, the Matroska muxer would mark a track as default if it had
      the disposition AV_DISPOSITION_DEFAULT or if there was no track with
      AV_DISPOSITION_DEFAULT set; in the latter case even more than one track
      of a kind (audio, video, subtitles) was marked as default which is not
      sensible.
      
      This commit changes the logic used to mark tracks as default. There are
      now three modes for this:
      a) In the "infer" mode the first track of every type (audio, video,
      subtitles) with default disposition set will be marked as default; if
      there is no such track (for a given type), then the first track of this
      type (if existing) will be marked as default. This behaviour is inspired
      by mkvmerge. It ensures that the default flags will be set in a sensible
      way even if the input comes from containers that lack the concept of
      default flags. This mode is the default mode.
      b) The "infer_no_subs" mode is similar to the "infer" mode; the
      difference is that if no subtitle track with default disposition exists,
      no subtitle track will be marked as default at all.
      c) The "passthrough" mode: Here the track will be marked as default if
      and only the corresponding input stream had disposition default.
      
      This fixes ticket #8173 (the passthrough mode is ideal for this) as
      well as ticket #8416 (the "infer_no_subs" mode leads to the desired
      output).
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      e3c54b54
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Don't needlessly copy AVCodecParameters · 75e50c31
      Andreas Rheinhardt authored
      At the end of encoding, the FLAC encoder sends a packet whose side data
      contains updated extradata (e.g. a correct md5 checksum). The Matroska
      muxer uses this to update the CodecPrivate.
      
      In doing so, the stream's codecpar was copied. But given that writing
      a FLAC CodecPrivate does not modify the used AVCodecParameters at all,
      there is no need to do so and this commit changes this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      75e50c31
    • Andreas Rheinhardt's avatar
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Don't waste bytes on length fields · 5b6e164b
      Andreas Rheinhardt authored
      Several EBML Master elements for which a good upper bound of the final
      length was available were nevertheless written without giving an
      upper bound of the final length to start_ebml_master(), so that their
      length fields were eight bytes long. This has been changed.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      5b6e164b
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Only write Tracks if there is a track · a9844341
      Andreas Rheinhardt authored
      The Matroska muxer does not write every stream as a Matroska track;
      some streams are written as AttachedFile. But should no stream be
      written as a Matroska track, the Matroska muxer would nevertheless
      write a Tracks element without a TrackEntry. This is against the spec.
      This commit changes this and only writes a Tracks if there is a Matroska
      track.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      a9844341
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Warn that WebM doesn't support Attachments · ef45cccc
      Andreas Rheinhardt authored
      As WebM doesn't support Attachments, the Matroska muxer drops them when
      in WebM mode. This happened silently until this commit which adds a
      warning for this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      ef45cccc
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Don't use size of inexistent Cluster · 4dd63ae8
      Andreas Rheinhardt authored
      In order to determine whether the current Cluster needs to be closed
      because of the limits on clustersize and clustertime,
      mkv_write_packet() would first get the size of the current Cluster by
      applying avio_tell() on the dynamic buffer holding the current Cluster.
      It did this without checking whether there is a dynamic buffer for
      writing Clusters open right now.
      
      In this case (which happens when writing the first packet)
      avio_tell() returned AVERROR(EINVAL); yet it is not good to rely on
      avio_tell() (or actually, avio_seek()) to handle the situation
      gracefully.
      
      Fixing this is easy: Only check whether a Cluster needs to be closed
      if a Cluster is in fact open.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      4dd63ae8
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Add check for using explicit TrackNumber · 86de8647
      Andreas Rheinhardt authored
      When creating DASH streams, the TrackNumber is externally prescribed
      and not derived from the number of streams in the AVFormatContext, so
      if the number of tracks for a file using an explicit TrackNumber was
      more than one, the resulting file would be broken (it would be impossible
      to tell to which track a Block belongs if different tracks share the
      same TrackNumber). So disallow this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      86de8647
  2. 20 Apr, 2020 30 commits
  3. 19 Apr, 2020 1 commit