Commit Graph

87 Commits

Author SHA1 Message Date
Andreas Rheinhardt 9c46faaf77 avformat/matroska: Move ff_mkv_stereo3d_conv() to demuxer
It is now its only user; also make it static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:34:47 +02:00
Andreas Rheinhardt 230312b3c8 avformat/matroska: Add macro for stereomode<->AVStereo3D correspondence
It will allow to create tables for easy conversion from AVStereo3D
to stereomode and back again as well as derive the properties
of a given stereomode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:29:34 +02:00
Andreas Rheinhardt 3fc9ed8497 avformat/matroska: Move ff_matroska_video_stereo_plane to demuxer
Only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 19:26:10 +02:00
James Almer 00fde8063a avformat/matroska: add a few more Block Addition ID Type enum values
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer c73cf41f1e avformat/matroskadec: export Dynamic HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer 6def862559 avformat/matroskadec: set the default value for BlockAddIDType
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
Andreas Rheinhardt 636631d9db Remove unnecessary libavutil/(avutil|common|internal).h inclusions
Some of these were made possible by moving several common macros to
libavutil/macros.h.

While just at it, also improve the other headers a bit.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
quietvoid 05c07943b0 avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements
Adds handling of dvcC/dvvC block addition mappings.

The parsing creates AVDOVIDecoderConfigurationRecord side data.
The configuration block is written when muxing into Matroska,
if DOVI side data is present for the track.

Most of the Matroska element parsing is based on Plex's FFmpeg source code.

Signed-off-by: quietvoid <tcChlisop0@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 04:29:36 +01:00
Anton Khirnov 823ca1ba84 lavf/matroska: avoid avcodec.h dependency 2021-06-10 16:51:44 +02:00
Andreas Rheinhardt b243be85d9 avformat/matroskadec: Add support for FlagOriginal
Needs a CountedElement in order to distinguish the case of the element
not being present and the element being present with a value of zero.

(It has been argued by Ridley Combs that one should only ever use the
AV_DISPOSITION_DUB field for audio tracks. Yet given that there is no
definition for the disposition flags, one can also interpret it to mean
that e.g. a subtitle track is meant to be used with the dubbed audio
track or the original audio track. This commit interprets this flag in
this sense, which also allows to maintain it on remuxing.)

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 06:54:47 +01:00
Andreas Rheinhardt 48cf1d878c avformat/matroskadec: Add support for FlagTextDescriptions
This is the equivalent of the WebM "D_WEBVTT/DESCRIPTIONS" and is
therefore only exported for subtitles.

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-22 04:14:20 +01:00
Andreas Rheinhardt 51e1067729 avformat/matroskadec: Add support for FlagHearing/VisualImpaired
Given that our disposition flags provide no way to distinguish the
cases of "track is unsuitable for hearing impaired users" and "it is
unknown whether the track is suitable for hearing impaired users" we do
not need to use a CountedElement for these flags.

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-22 04:12:25 +01:00
Andreas Rheinhardt 18b3deee22 avformat/matroskadec: Add support for FlagCommentary
Hint: Matroska actually provides a way to distinguish the cases of
"track is no commentary track" and "it is unknown whether the track
is a commentary track", but our disposition flags do not. Therefore
we need not use a CountedElement.

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-22 04:12:02 +01:00
Andreas Rheinhardt 67e957b43a avformat/matroska: Move mime_tag lists to matroskadec
They are not used any more by the muxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-20 21:24:18 +02:00
Steve Lhomme a6e56d12a4 avformat/matroska: clean the structure formatting
Always use a comma at the end, order elements by value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-03 19:15:28 +02:00
Steve Lhomme a95351ea50 avformat/matroska: add missing Buttons track type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-25 22:24:05 +01:00
James Almer 794079e815 avformat/matroskaenc: implement AVOutputFormat.query_codec for webm
Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-26 15:17:13 -03:00
James Almer 445204cd57 avformat/matroskadec: add support for Spherical Video elements
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-07 22:40:59 -03:00
James Almer 47ee6f1a59 avformat/matroskadec: support parsing Chroma Location elements
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-18 20:39:07 -03:00
James Almer bad8bbc26a avformat/matroskadec: set aspect ratio only when DisplayWidth and DisplayHeight are in pixels
A missing DisplayUnit element or one with the default value of 0 means
DisplayWidth and DisplayHeight should be interpreted as pixels.

The current code setting st->sample_aspect_ratio is wrong when DisplayUnit
is anything else.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-15 20:42:07 -03:00
James Almer dc781459cc avformat/matroska: fix MatroskaVideoFieldOrder enum values
The spec says

9: Interlaced with bottom field displayed first and top field stored first
14: Interlaced with top field displayed first and bottom field stored first

And avcodec.h states

AV_FIELD_TB,          //< Top coded first, bottom displayed first
AV_FIELD_BT,          //< Bottom coded first, top displayed first

Reviewed-by: Dave Rice <dave@dericed.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-12 18:26:22 -03:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Derek Buitenhuis f3972b3b7d Merge commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1'
* commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1':
  matroska: Support interlaced content correctly

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-08 22:58:18 +01:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Luca Barbato 5f02266681 matroska: Support interlaced content correctly
The matroska specification now has two elements for it.
2016-03-31 18:03:21 +02:00
Neil Birkbeck bbda13a771 lavf/matroskadec: Add early support for some of the new colour elements.
Adding early support for a subset of the proposed colour elements
according to the latest version of spec:
https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&index=hIKLhMdgTMTEwUTeA4ct38h0tmE

I've left out elements for pix_fmt related things as there still
seems to be some discussion around these, and the max_cll/max_fall
are currently not propagated as there is not yet side data for them.

The new elements are exposed under strict experimental mode.

Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-04 23:11:51 +01:00
Rodger Combs cf2719abee lavf/matroska: ignore ChapCountry ID for now
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-20 20:08:01 +02:00
wm4 c4d37cd9ef matroskadec: export cover art correctly
Generally, libavformat exports cover art pictures as video streams with
1 packet and AV_DISPOSITION_ATTACHED_PIC set. Only matroskadec exported
it as attachment with codec_id set to AV_CODEC_ID_MJPEG.

Obviously, this should be consistent, so change the Matroska demuxer to
export a AV_DISPOSITION_ATTACHED_PIC pseudo video stream.

Matroska muxing is probably incorrect too. I know that it can create
broken files with an audio track and just 1 video frame when e.g.
remuxing mp3 with APIC to mkv. But for now this commit does not change
anything about muxing, and also continues to write attachments with
AV_CODEC_ID_MJPEG should the muxer application have special knowledge
that the Matroska is broken in this way.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-04-08 12:36:53 +02:00
wm4 511585ce7f matroskadec: export cover art correctly
Generally, libavformat exports cover art pictures as video streams with
1 packet and AV_DISPOSITION_ATTACHED_PIC set. Only matroskadec exported
it as attachment with codec_id set to AV_CODEC_ID_MJPEG.

Obviously, this should be consistent, so change the Matroska demuxer to
export a AV_DISPOSITION_ATTACHED_PIC pseudo video stream.

Matroska muxing is probably incorrect too. I know that it can create
broken files with an audio track and just 1 video frame when e.g.
remuxing mp3 with APIC to mkv. But for now this commit does not change
anything about muxing, and also continues to write attachments with
AV_CODEC_ID_MJPEG should the muxer application have special knowledge
that the Matroska is broken in this way.

Fixes trac #4423.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-04 02:25:56 +02:00
Michael Niedermayer 37520a91ac avformat: drop redundant MATROSKA_VIDEO_STEREO_MODE_COUNT identifier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-29 01:26:52 +02:00
Michael Niedermayer fcc3909908 Merge commit 'd4ae8ac92f619507aadd021bb67b517d39d3a36f'
* commit 'd4ae8ac92f619507aadd021bb67b517d39d3a36f':
  matroskadec: parse stereo mode on decoding

Conflicts:
	Changelog
	libavformat/matroska.c
	libavformat/matroskadec.c

See: 4c509fe305 and others
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-28 23:48:23 +02:00
Vittorio Giovara d4ae8ac92f matroskadec: parse stereo mode on decoding
Convert the Matroska stereo format to the Stereo3D format, and add a
Stereo3D side data to the stream.

Bump the doctype version supported.

Bug-Id: 728 / https://bugs.debian.org/757185
2014-08-28 12:33:26 -04:00
Paul B Mahol 6dfa70f272 Correct few "ffmpeg" typos
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2014-08-24 11:05:42 +00:00
Vignesh Venkatasubramanian 5a20656946 lavf/matroska: Add functions for WebM DASH Manifest
Add functions and logic to matroskadec for use by the WebM DASH Manifest
XML Muxer. The actual muxer is added in a future patch.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 23:56:17 +02:00
Anton Khirnov eb3b5501e8 matroskadec: read the CodecDelay element 2014-04-30 21:00:01 +02:00
James Almer 56f17407bc matroska: Add the CueDuration element
Use it only on subtitle CuePoints.
With proper demuxer/splitter support this should improve the display
of subtitles right after seeking to a given point in the stream.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 14:33:01 +02:00
Vignesh Venkatasubramanian d92b1b1bab lavf/matroska: Adding support for Opus CodecDelay
In order to represent the codec delay accurately in Matroska, a
new element CodecDelay has been introduced. It contains the
overall delay added by the codec in nanoseconds. This patch adds
support for muxing CodecDelay value in the container.
Matroska spec for CodecDelay element can be found here:
http://matroska.org/technical/specs/index.html#CodecDelay

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-10 01:45:38 +02:00
Vignesh Venkatasubramanian bb47aa5850 opus/matroska: Adding support for DiscardPadding in muxer
Support for end trimming Opus in Matroska is implemented by using
the DiscardPadding container element in the Block data. The last
chunk is stored as a Block instead of SimpleBlock and the
trimming information is stored and used to discard samples that
were padded by the Opus codec. This patch adds support for muxing
DiscardPadding element into the container with appropriate value.
Matroska spec for the DiscardPadding element can be found here:
http://matroska.org/technical/specs/index.html#DiscardPadding

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-10 01:04:06 +02:00
Matthew Heaney 818ebe930f avformat/matroskadec: add WebVTT support
WebM files now support inband text tracks, as described in the
following specification:

http://wiki.webmproject.org/webm-metadata/temporal-metadata/webvtt-in-webm

The Matroska demuxer now detects the presence of WebVTT tracks,
synthesizing WebVTT packets (having codec id AV_CODEC_ID_WEBVTT) and
pushing them downstream in the normal way.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-19 22:34:57 +02:00
Vignesh Venkatasubramanian 571efd9729 lavf/matroska: Adding the new SeekPreRoll element
In order to encapsuate Opus in Matroska, there is a new element
that has been added to the Matroska Spec, SeekPreRoll. It has the
duration in nanoseconds that has to be decoded before every seek.
Spec: http://matroska.org/technical/specs/index.html#SeekPreRoll
Proposal for encapsulateing Opus in Matroska:
http://wiki.xiph.org/MatroskaOpus

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 00:04:08 +02:00
Bernie Habermeier c5f3cc40e3 matroskaenc: implement CueRelativePosition
This is a minimal change to matroskaenc that implements CueRelativePosition in the output.
Most players will probably ignore this additional information, but it is in the
matroska spec, and it'd be nice to be able to make use of it.

Signed-off-by: Bernt Habermeier <bernt@wulfram.com>
Tested-by:  wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-24 14:08:52 +02:00
Matthew Heaney 509642b4bd WebM muxer writes WebVTT subtitle track
The Matroska muxer now allows WebVTT subtitle tracks to be written
while in WebM muxing mode.

WebVTT subtitle tracks have four kinds: "subtitles", "captions",
"descriptions", and "metadata". Each text track kind has a distinct
Mastroska CodecID and track type, as described in the temporal
metadata guidelines here:

http://wiki.webmproject.org/webm-metadata/temporal-metadata/webvtt-in-webm

When the stream has codec id AV_CODEC_ID_WEBVTT, the stream packet is
serialized per the temporal metadata guidelines cited above. The
WebVTT cue is written as a Matroska block group. The block frame
comprises the WebVTT cue id, followed by the cue settings, followed by
the cue text.  (The block timestamp is synthesized from the cue
timestamp.)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-09 03:09:12 +02:00
Michael Niedermayer 91db8ff203 Merge commit '564b7e0c0095768cd20001b28154d69462be54e7'
* commit '564b7e0c0095768cd20001b28154d69462be54e7':
  matroskadec: silently skip CodecState element.
  smacker: fix off-by-one error in palette expanding code

Conflicts:
	libavformat/smacker.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 08:04:02 +02:00
Anton Khirnov 564b7e0c00 matroskadec: silently skip CodecState element.
mkvmerge apparrently uses it for mpeg1/2 video, but it contains the same
information as CodecPrivate, so it can be ignored.
2013-05-27 21:25:53 +02:00
Frank Galligan b853103fe0 matroskadec: Add support for parsing Matroska ContentEncKeyID
This patch adds the enums for the ContentEncryption elements.
This patch also adds support for parsing the ContentEncKeyID. The
ContentEncKeyID is then base64 encoded and stored in the stream's
metadata.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-20 21:29:55 +01:00
Vignesh Venkatasubramanian ce6a8e5947 Adding AlphaMode element to Matroska Parser
Adding support for parsing AlphaMode element in the Track header
and export that information as a metadata tag. This flag indicates
presence of alpha channel data in BlockAdditional element.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 21:34:47 +01:00
Vignesh Venkatasubramanian 30c5c45b12 Adding support for parsing BlockAdditional
Matroska specification lists support for BlockAdditional element
which is not supported by ffmpeg's matroska parser. This patch
adds grammar definitions for parsing that element (and few other
related elements) and then puts the data in AVPacket.side_data
with new AVPacketSideDataType AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 00:46:28 +01:00
Clément Bœsch ca81e3b6e7 lavf/mkv: prefix video stereo arrays with ff_. 2012-09-16 02:58:40 +02:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00