matroska

package module
v0.0.0-...-bf81c10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 13 Imported by: 0

README

Matroska

A Matroska parser written in Go.

Introduction

The Matroska Multimedia Container is a free and open container format, a file format that can hold an unlimited number of video, audio, picture, or subtitle tracks in one file.

Source: https://en.wikipedia.org/wiki/Matroska

This library is based on the 14th iteration of draft-ietf-cellar-matroska and the 10th iteration of draft-ietf-cellar-codec. None of these documents reached "Internet Standard" status yet.

The goal of this project is to create an implementation based on these documents and during the implementation provide feedback.

Production readiness

This project is still in alpha phase. In this stage the public API can change between days.

Beta version will be considered when the feature set covers most of the documents the implementation is based on, and the public API is reached a mature state.

Stable version will be considered only if enough positive feedback is gathered to lock the public API and all document the implementation is based on became "Internet Standard".

Documents

Official sites

Huge thanks to the Matroska.org for their work.

IETF Documents

Huge thanks to the IETF CELLAR Working Group for their work.

Inspiration

Inspiration for the implementation comes from the following places:

Similar libraries

Last updated: 2020-02-18

URL Status
https://github.com/at-wat/ebml-go In active development
https://github.com/ebml-go/ebml + https://github.com/ebml-go/webm Last updated on 25 Sep 2016
https://github.com/ehmry/go-ebml Archived
https://github.com/jacereda/ebml Last updated on 10 Jan 2016
https://github.com/mediocregopher/ebmlstream Last updated on 15 Dec 2014
https://github.com/pankrator/ebml-parser Last updated on 24 Jun 2020
https://github.com/pixelbender/go-matroska Last updated on 29 Oct 2018
https://github.com/pubblic/ebml Last updated on 12 Dec 2018
https://github.com/quadrifoglio/go-mkv Last updated on 20 Jun 2018
https://github.com/rrerolle/ebml-go Last updated on 1 Dec 2012
https://github.com/remko/go-mkvparse Last updated on 14 Jun 2020
https://github.com/tpjg/ebml-go Last updated on 1 Dec 2012

Documentation

Overview

Package matroska contains types and structures for parsing matroska (.mkv, .mk3d, .mka, .mks) files.

Index

Constants

View Source
const (
	CodecTypeVideo    = CodecType("Video")
	CodecTypeAudio    = CodecType("Audio")
	CodecTypeSubtitle = CodecType("Subtitle")
	CodecTypeButton   = CodecType("Button")
)
View Source
const (
	AudioCodecAAC             = "A_AAC"
	AudioCodecAAC_2LC         = "A_AAC/MPEG2/LC"
	AudioCodecAAC_2MAIN       = "A_AAC/MPEG2/MAIN"
	AudioCodecAAC_2SBR        = "A_AAC/MPEG2/LC/SBR"
	AudioCodecAAC_2SSR        = "A_AAC/MPEG2/SSR"
	AudioCodecAAC_4LC         = "A_AAC/MPEG4/LC"
	AudioCodecAAC_4LTP        = "A_AAC/MPEG4/LTP"
	AudioCodecAAC_4MAIN       = "A_AAC/MPEG4/MAIN"
	AudioCodecAAC_4SBR        = "A_AAC/MPEG4/LC/SBR"
	AudioCodecAAC_4SSR        = "A_AAC/MPEG4/SSR"
	AudioCodecAC3             = "A_AC3"
	AudioCodecAC3_BSID9       = "A_AC3/BSID9"
	AudioCodecAC3_BSID10      = "A_AC3/BSID10"
	AudioCodecALAC            = "A_ALAC"
	AudioCodecATRAC_AT1       = "A_ATRAC/AT1"
	AudioCodecDTS             = "A_DTS"
	AudioCodecDTS_EXPRESS     = "A_DTS/EXPRESS"
	AudioCodecDTS_LOSSLESS    = "A_DTS/LOSSLESS"
	AudioCodecEAC3            = "A_EAC3"
	AudioCodecFLAC            = "A_FLAC"
	AudioCodecMLP             = "A_MLP"
	AudioCodecMPC             = "A_MPC"
	AudioCodecMP1             = "A_MPEG/L1"
	AudioCodecMP2             = "A_MPEG/L2"
	AudioCodecMP3             = "A_MPEG/L3"
	AudioCodecMS_ACM          = "A_MS/ACM"
	AudioCodecOPUS            = "A_OPUS"
	AudioCodecPCM             = "A_PCM/INT/LIT"
	AudioCodecPCM_BE          = "A_PCM/INT/BIG"
	AudioCodecPCM_FLOAT       = "A_PCM/FLOAT/IEEE"
	AudioCodecQUICKTIME       = "A_QUICKTIME"
	AudioCodecQUICKTIME_QDMC  = "A_QUICKTIME/QDMC"
	AudioCodecQUICKTIME_QDMC2 = "A_QUICKTIME/QDM2"
	AudioCodecREAL_14         = "A_REAL/14_4"
	AudioCodecREAL_28         = "A_REAL/28_8"
	AudioCodecREAL_COOK       = "A_REAL/COOK"
	AudioCodecREAL_SIPR       = "A_REAL/SIPR"
	AudioCodecREAL_RALF       = "A_REAL/RALF"
	AudioCodecREAL_ATRC       = "A_REAL/ATRC"
	AudioCodecTRUEHD          = "A_TRUEHD"
	AudioCodecTTA             = "A_TTA1"
	AudioCodecVORBIS          = "A_VORBIS"
	AudioCodecWAVPACK4        = "A_WAVPACK4"

	VideoCodecAV1            = "V_AV1"
	VideoCodecAVS2           = "V_AVS2"
	VideoCodecAVS3           = "V_AVS3"
	VideoCodecDIRAC          = "V_DIRAC"
	VideoCodecFFV1           = "V_FFV1"
	VideoCodecMPEG1          = "V_MPEG1"
	VideoCodecMPEG2          = "V_MPEG2"
	VideoCodecMPEG4_ISO_AP   = "V_MPEG4/ISO/AP"
	VideoCodecMPEG4_ISO_ASP  = "V_MPEG4/ISO/ASP"
	VideoCodecMPEG4_ISO_AVC  = "V_MPEG4/ISO/AVC"
	VideoCodecMPEG4_ISO_SP   = "V_MPEG4/ISO/SP"
	VideoCodecMPEG4_MS_V3    = "V_MPEG4/MS/V3"
	VideoCodecMPEGH_ISO_HEVC = "V_MPEGH/ISO/HEVC"
	VideoCodecMSCOMP         = "V_MS/VFW/FOURCC"
	VideoCodecPRORES         = "V_PRORES"
	VideoCodecQUICKTIME      = "V_QUICKTIME"
	VideoCodecREALV1         = "V_REAL/RV10"
	VideoCodecREALV2         = "V_REAL/RV20"
	VideoCodecREALV3         = "V_REAL/RV30"
	VideoCodecREALV4         = "V_REAL/RV40"
	VideoCodecTHEORA         = "V_THEORA"
	VideoCodecUNCOMPRESSED   = "V_UNCOMPRESSED"
	VideoCodecVP8            = "V_VP8"
	VideoCodecVP9            = "V_VP9"

	SubtitleCodecDVBSUB      = "S_DVBSUB"
	SubtitleCodecHDMV_PGS    = "S_HDMV/PGS"
	SubtitleCodecHDMV_TEXTST = "S_HDMV/TEXTST"
	SubtitleCodecIMAGE_BMP   = "S_IMAGE/BMP"
	SubtitleCodecKATE        = "S_KATE"
	SubtitleCodecTEXTASCII   = "S_TEXT/ASCII"
	SubtitleCodecTEXTASS     = "S_TEXT/ASS"
	// Deprecated: use SubtitleCodecTEXTASS instead
	SubtitleCodecASS     = "S_ASS"
	SubtitleCodecTEXTSSA = "S_TEXT/SSA"
	// Deprecated: use SubtitleCodecTEXTSSA instead
	SubtitleCodecSSA        = "S_SSA"
	SubtitleCodecTEXTUSF    = "S_TEXT/USF"
	SubtitleCodecTEXTUTF8   = "S_TEXT/UTF8"
	SubtitleCodecTEXTWEBVTT = "S_TEXT/WEBVTT"
	SubtitleCodecVOBSUB     = "S_VOBSUB"
	SubtitleCodecVOBSUBZLIB = "S_VOBSUB/ZLIB"

	ButtonCodecVOBBTN = "B_VOBBTN"
)
View Source
const (
	ChapterTranslateCodecMatroskaScript = 0
	ChapterTranslateCodecDVDMenu        = 1
)
View Source
const (
	TrackTypeVideo    = 1
	TrackTypeAudio    = 2
	TrackTypeComplex  = 3
	TrackTypeSubtitle = 17
	TrackTypeButtons  = 18
	TrackTypeControl  = 32
	TrackTypeMetadata = 33
)
View Source
const (
	TrackTranslateCodecMatroskaScript = 0
	TrackTranslateCodecDVDMenu        = 1
)
View Source
const (
	FlagInterlacedUndetermined = 0
	FlagInterlacedInterlaced   = 1
	FlagInterlacedProgressive  = 2
)
View Source
const (
	FieldOrderProgressive  = 0
	FieldOrderTff          = 1
	FieldOrderUndetermined = 2
	FieldOrderBff          = 6
	FieldOrderBffSwapped   = 9
	FieldOrderTffSwapped   = 14
)
View Source
const (
	StereoModeMono                                   = 0
	StereoModeSideBySideLeftEyeFirst                 = 1
	StereoModeTopBottomRightEyeIsFirst               = 2
	StereoModeTopBottomLeftEyeIsFirst                = 3
	StereoModeCheckboardRightEyeIsFirst              = 4
	StereoModeCheckboardLeftEyeIsFirst               = 5
	StereoModeRowInterleavedRightEyeIsFirst          = 6
	StereoModeRowInterleavedLeftEyeIsFirst           = 7
	StereoModeColumnInterleavedRightEyeIsFirst       = 8
	StereoModeColumnInterleavedLeftEyeIsFirst        = 9
	StereoModeAnaglyphCyanRed                        = 10
	StereoModeSideBySideRightEyeFirst                = 11
	StereoModeAnaglyphGreenMagenta                   = 12
	StereoModeBothEyesLacedInOneBlockLeftEyeIsFirst  = 13
	StereoModeBothEyesLacedInOneBlockRightEyeIsFirst = 14
)
View Source
const (
	AlphaModeNone    = 0
	AlphaModePresent = 1
)
View Source
const (
	OldStereoModeMono     = 0
	OldStereoModeRightEye = 1
	OldStereoModeLeftEye  = 2
	OldStereoModeBothEyes = 3
)
View Source
const (
	DisplayUnitPixels             = 0
	DisplayUnitCentimeters        = 1
	DisplayUnitInches             = 2
	DisplayUnitDisplayAspectRatio = 3
	DisplayUnitUnknown            = 4
)
View Source
const (
	AspectRatioTypeFreeResizing    = 0
	AspectRatioTypeKeepAspectRatio = 1
	AspectRatioTypeFixed           = 2
)
View Source
const (
	MatrixCoefficientsIdentity                          = 0
	MatrixCoefficientsITURBT709                         = 1
	MatrixCoefficientsUnspecified                       = 2
	MatrixCoefficientsReserved                          = 3
	MatrixCoefficientsUSFCC73682                        = 4
	MatrixCoefficientsITURBT470BG                       = 5
	MatrixCoefficientsSMPTE170M                         = 6
	MatrixCoefficientsSMPTE240M                         = 7
	MatrixCoefficientsYCoCg                             = 8
	MatrixCoefficientsBT2020NonConstantLuminance        = 9
	MatrixCoefficientsBT2020ConstantLuminance           = 10
	MatrixCoefficientsSMPTEST2085                       = 11
	MatrixCoefficientsChromaDerivedNonConstantLuminance = 12
	MatrixCoefficientsChromaDerivedConstantLuminance    = 13
	MatrixCoefficientsITURBT21000                       = 14
)
View Source
const (
	ChromaSitingHorzUnspecified    = 0
	ChromaSitingHorzLeftCollocated = 1
	ChromaSitingHorzHalf           = 2
)
View Source
const (
	ChromaSitingVertUnspecified   = 0
	ChromaSitingVertTopCollocated = 1
	ChromaSitingVertHalf          = 2
)
View Source
const (
	RangeUnspecified                 = 0
	RangeBroadcastRange              = 1
	RangeFullRangeNoClipping         = 2
	RangeDefinedByMatrixCoefficients = 3
	RangeTransferCharacteristics     = 3
)
View Source
const (
	TransferCharacteristicsReserved                         = 0
	TransferCharacteristicsITURBT709                        = 1
	TransferCharacteristicsUnspecified                      = 2
	TransferCharacteristicsReserved2                        = 3
	TransferCharacteristicsGamma22CurveBT470M               = 4
	TransferCharacteristicsGamma28CurveBT470BG              = 5
	TransferCharacteristicsSMPTE170M                        = 6
	TransferCharacteristicsSMPTE240M                        = 7
	TransferCharacteristicsLinear                           = 8
	TransferCharacteristicsLog                              = 9
	TransferCharacteristicsLogSqrt                          = 10
	TransferCharacteristicsIEC6196624                       = 11
	TransferCharacteristicsITURBT1361ExtendedColourGamut    = 12
	TransferCharacteristicsIEC6196621                       = 13
	TransferCharacteristicsITURBT202010Bit                  = 14
	TransferCharacteristicsITURBT202012Bit                  = 15
	TransferCharacteristicsITURBT2100PerceptualQuantization = 16
	TransferCharacteristicsSMPTEST4281                      = 17
	TransferCharacteristicsARIBSTDB67HLG                    = 18
)
View Source
const (
	PrimariesReserved                      = 0
	PrimariesITURBT709                     = 1
	PrimariesUnspecified                   = 2
	PrimariesReserved2                     = 3
	PrimariesITURBT470M                    = 4
	PrimariesITURBT470BGBT601625           = 5
	PrimariesITURBT601525SMPTE170M         = 6
	PrimariesSMPTE240M                     = 7
	PrimariesFILM                          = 8
	PrimariesITURBT2020                    = 9
	PrimariesSMPTEST4281                   = 10
	PrimariesSMPTERP4322                   = 11
	PrimariesSMPTEEG4322                   = 12
	PrimariesEBUTech3213EJEDECP22Phosphors = 22
)
View Source
const (
	ProjectionTypeRectangular     = 0
	ProjectionTypeEquirectangular = 1
	ProjectionTypeCubemap         = 2
	ProjectionTypeMesh            = 3
)
View Source
const (
	EmphasisNoEmphasis      = 0
	EmphasisCDAudio         = 1
	EmphasisReserved        = 2
	EmphasisCCITJ17         = 3
	EmphasisFM50            = 4
	EmphasisFM75            = 5
	EmphasisPhonoRIAA       = 10
	EmphasisPhonoIECN78     = 11
	EmphasisPhonoTELDEC     = 12
	EmphasisPhonoEMI        = 13
	EmphasisPhonoColumbiaLP = 14
	EmphasisPhonoLONDON     = 15
	EmphasisPhonoNARTB      = 16
)
View Source
const (
	TrackPlaneTypeLeftEye    = 0
	TrackPlaneTypeRightEye   = 1
	TrackPlaneTypeBackground = 2
)
View Source
const (
	ContentEncodingScopeBlock   = 1
	ContentEncodingScopePrivate = 2
	ContentEncodingScopeNext    = 4
)
View Source
const (
	ContentEncodingTypeCompression = 0
	ContentEncodingTypeEncryption  = 1
)
View Source
const (
	ContentCompAlgoZlib            = 0
	ContentCompAlgoBzlib           = 1
	ContentCompAlgoLzo1X           = 2
	ContentCompAlgoHeaderStripping = 3
)
View Source
const (
	ContentEncAlgoNotEncrypted = 0
	ContentEncAlgoDES          = 1
	ContentEncAlgo3DES         = 2
	ContentEncAlgoTwofish      = 3
	ContentEncAlgoBlowfish     = 4
	ContentEncAlgoAES          = 5
)
View Source
const (
	ContentSigAlgoNotSigned = 0
	ContentSigAlgoRSA       = 1
)
View Source
const (
	ContentSigHashAlgoNotSigned = 0
	ContentSigHashAlgoSHA1160   = 1
	ContentSigHashAlgoMD5       = 2
)
View Source
const (
	AESSettingsCipherModeAESCTR = 1
	AESSettingsCipherModeAESCBC = 2
)
View Source
const (
	ChapterSkipTypeNoSkipping     = 0
	ChapterSkipTypeOpeningCredits = 1
	ChapterSkipTypeEndCredits     = 2
	ChapterSkipTypeRecap          = 3
	ChapterSkipTypeNextPreview    = 4
	ChapterSkipTypePreview        = 5
	ChapterSkipTypeAdvertisement  = 6
)
View Source
const (
	ChapProcessTimeDuringTheWholeChapter     = 0
	ChapProcessTimeBeforeStartingPlayback    = 1
	ChapProcessTimeAfterPlaybackOfTheChapter = 2
)
View Source
const (
	BlockFlagReserved  uint8 = 0b11110000
	BlockFlagInvisible uint8 = 0b00001000
	BlockFlagLacing    uint8 = 0b00000110
	BlockFlagNotUsed   uint8 = 0b00000001

	SimpleBlockFlagKeyframe    uint  = 0b10000000
	SimpleBlockFlagReserved    uint  = 0b01110000
	SimpleBlockFlagInvisible   uint  = 0b00001000
	SimpleBlockFlagLacing      uint8 = 0b00000110
	SimpleBlockFlagDiscardable uint8 = 0b00000001
)
View Source
const DocType = "matroska"

Variables

View Source
var (
	IDSegment                     schema.ElementID = 0x18538067
	IDSeekHead                    schema.ElementID = 0x114d9b74
	IDSeek                        schema.ElementID = 0x4dbb
	IDSeekID                      schema.ElementID = 0x53ab
	IDSeekPosition                schema.ElementID = 0x53ac
	IDInfo                        schema.ElementID = 0x1549a966
	IDSegmentUUID                 schema.ElementID = 0x73a4
	IDSegmentFilename             schema.ElementID = 0x7384
	IDPrevUUID                    schema.ElementID = 0x3cb923
	IDPrevFilename                schema.ElementID = 0x3c83ab
	IDNextUUID                    schema.ElementID = 0x3eb923
	IDNextFilename                schema.ElementID = 0x3e83bb
	IDSegmentFamily               schema.ElementID = 0x4444
	IDChapterTranslate            schema.ElementID = 0x6924
	IDChapterTranslateID          schema.ElementID = 0x69a5
	IDChapterTranslateCodec       schema.ElementID = 0x69bf
	IDChapterTranslateEditionUID  schema.ElementID = 0x69fc
	IDTimestampScale              schema.ElementID = 0x2ad7b1
	IDDuration                    schema.ElementID = 0x4489
	IDDateUTC                     schema.ElementID = 0x4461
	IDTitle                       schema.ElementID = 0x7ba9
	IDMuxingApp                   schema.ElementID = 0x4d80
	IDWritingApp                  schema.ElementID = 0x5741
	IDCluster                     schema.ElementID = 0x1f43b675
	IDTimestamp                   schema.ElementID = 0xe7
	IDSilentTracks                schema.ElementID = 0x5854
	IDSilentTrackNumber           schema.ElementID = 0x58d7
	IDPosition                    schema.ElementID = 0xa7
	IDPrevSize                    schema.ElementID = 0xab
	IDSimpleBlock                 schema.ElementID = 0xa3
	IDBlockGroup                  schema.ElementID = 0xa0
	IDBlock                       schema.ElementID = 0xa1
	IDBlockVirtual                schema.ElementID = 0xa2
	IDBlockAdditions              schema.ElementID = 0x75a1
	IDBlockMore                   schema.ElementID = 0xa6
	IDBlockAdditional             schema.ElementID = 0xa5
	IDBlockAddID                  schema.ElementID = 0xee
	IDBlockDuration               schema.ElementID = 0x9b
	IDReferencePriority           schema.ElementID = 0xfa
	IDReferenceBlock              schema.ElementID = 0xfb
	IDReferenceVirtual            schema.ElementID = 0xfd
	IDCodecState                  schema.ElementID = 0xa4
	IDDiscardPadding              schema.ElementID = 0x75a2
	IDSlices                      schema.ElementID = 0x8e
	IDTimeSlice                   schema.ElementID = 0xe8
	IDLaceNumber                  schema.ElementID = 0xcc
	IDFrameNumber                 schema.ElementID = 0xcd
	IDBlockAdditionID             schema.ElementID = 0xcb
	IDDelay                       schema.ElementID = 0xce
	IDSliceDuration               schema.ElementID = 0xcf
	IDReferenceFrame              schema.ElementID = 0xc8
	IDReferenceOffset             schema.ElementID = 0xc9
	IDReferenceTimestamp          schema.ElementID = 0xca
	IDEncryptedBlock              schema.ElementID = 0xaf
	IDTracks                      schema.ElementID = 0x1654ae6b
	IDTrackEntry                  schema.ElementID = 0xae
	IDTrackNumber                 schema.ElementID = 0xd7
	IDTrackUID                    schema.ElementID = 0x73c5
	IDTrackType                   schema.ElementID = 0x83
	IDFlagEnabled                 schema.ElementID = 0xb9
	IDFlagDefault                 schema.ElementID = 0x88
	IDFlagForced                  schema.ElementID = 0x55aa
	IDFlagHearingImpaired         schema.ElementID = 0x55ab
	IDFlagVisualImpaired          schema.ElementID = 0x55ac
	IDFlagTextDescriptions        schema.ElementID = 0x55ad
	IDFlagOriginal                schema.ElementID = 0x55ae
	IDFlagCommentary              schema.ElementID = 0x55af
	IDFlagLacing                  schema.ElementID = 0x9c
	IDMinCache                    schema.ElementID = 0x6de7
	IDMaxCache                    schema.ElementID = 0x6df8
	IDDefaultDuration             schema.ElementID = 0x23e383
	IDDefaultDecodedFieldDuration schema.ElementID = 0x234e7a
	IDTrackTimestampScale         schema.ElementID = 0x23314f
	IDTrackOffset                 schema.ElementID = 0x537f
	IDMaxBlockAdditionID          schema.ElementID = 0x55ee
	IDBlockAdditionMapping        schema.ElementID = 0x41e4
	IDBlockAddIDValue             schema.ElementID = 0x41f0
	IDBlockAddIDName              schema.ElementID = 0x41a4
	IDBlockAddIDType              schema.ElementID = 0x41e7
	IDBlockAddIDExtraData         schema.ElementID = 0x41ed
	IDName                        schema.ElementID = 0x536e
	IDLanguage                    schema.ElementID = 0x22b59c
	IDLanguageBCP47               schema.ElementID = 0x22b59d
	IDCodecID                     schema.ElementID = 0x86
	IDCodecPrivate                schema.ElementID = 0x63a2
	IDCodecName                   schema.ElementID = 0x258688
	IDAttachmentLink              schema.ElementID = 0x7446
	IDCodecSettings               schema.ElementID = 0x3a9697
	IDCodecInfoURL                schema.ElementID = 0x3b4040
	IDCodecDownloadURL            schema.ElementID = 0x26b240
	IDCodecDecodeAll              schema.ElementID = 0xaa
	IDTrackOverlay                schema.ElementID = 0x6fab
	IDCodecDelay                  schema.ElementID = 0x56aa
	IDSeekPreRoll                 schema.ElementID = 0x56bb
	IDTrackTranslate              schema.ElementID = 0x6624
	IDTrackTranslateTrackID       schema.ElementID = 0x66a5
	IDTrackTranslateCodec         schema.ElementID = 0x66bf
	IDTrackTranslateEditionUID    schema.ElementID = 0x66fc
	IDVideo                       schema.ElementID = 0xe0
	IDFlagInterlaced              schema.ElementID = 0x9a
	IDFieldOrder                  schema.ElementID = 0x9d
	IDStereoMode                  schema.ElementID = 0x53b8
	IDAlphaMode                   schema.ElementID = 0x53c0
	IDOldStereoMode               schema.ElementID = 0x53b9
	IDPixelWidth                  schema.ElementID = 0xb0
	IDPixelHeight                 schema.ElementID = 0xba
	IDPixelCropBottom             schema.ElementID = 0x54aa
	IDPixelCropTop                schema.ElementID = 0x54bb
	IDPixelCropLeft               schema.ElementID = 0x54cc
	IDPixelCropRight              schema.ElementID = 0x54dd
	IDDisplayWidth                schema.ElementID = 0x54b0
	IDDisplayHeight               schema.ElementID = 0x54ba
	IDDisplayUnit                 schema.ElementID = 0x54b2
	IDAspectRatioType             schema.ElementID = 0x54b3
	IDUncompressedFourCC          schema.ElementID = 0x2eb524
	IDGammaValue                  schema.ElementID = 0x2fb523
	IDFrameRate                   schema.ElementID = 0x2383e3
	IDColour                      schema.ElementID = 0x55b0
	IDMatrixCoefficients          schema.ElementID = 0x55b1
	IDBitsPerChannel              schema.ElementID = 0x55b2
	IDChromaSubsamplingHorz       schema.ElementID = 0x55b3
	IDChromaSubsamplingVert       schema.ElementID = 0x55b4
	IDCbSubsamplingHorz           schema.ElementID = 0x55b5
	IDCbSubsamplingVert           schema.ElementID = 0x55b6
	IDChromaSitingHorz            schema.ElementID = 0x55b7
	IDChromaSitingVert            schema.ElementID = 0x55b8
	IDRange                       schema.ElementID = 0x55b9
	IDTransferCharacteristics     schema.ElementID = 0x55ba
	IDPrimaries                   schema.ElementID = 0x55bb
	IDMaxCLL                      schema.ElementID = 0x55bc
	IDMaxFALL                     schema.ElementID = 0x55bd
	IDMasteringMetadata           schema.ElementID = 0x55d0
	IDPrimaryRChromaticityX       schema.ElementID = 0x55d1
	IDPrimaryRChromaticityY       schema.ElementID = 0x55d2
	IDPrimaryGChromaticityX       schema.ElementID = 0x55d3
	IDPrimaryGChromaticityY       schema.ElementID = 0x55d4
	IDPrimaryBChromaticityX       schema.ElementID = 0x55d5
	IDPrimaryBChromaticityY       schema.ElementID = 0x55d6
	IDWhitePointChromaticityX     schema.ElementID = 0x55d7
	IDWhitePointChromaticityY     schema.ElementID = 0x55d8
	IDLuminanceMax                schema.ElementID = 0x55d9
	IDLuminanceMin                schema.ElementID = 0x55da
	IDProjection                  schema.ElementID = 0x7670
	IDProjectionType              schema.ElementID = 0x7671
	IDProjectionPrivate           schema.ElementID = 0x7672
	IDProjectionPoseYaw           schema.ElementID = 0x7673
	IDProjectionPosePitch         schema.ElementID = 0x7674
	IDProjectionPoseRoll          schema.ElementID = 0x7675
	IDAudio                       schema.ElementID = 0xe1
	IDSamplingFrequency           schema.ElementID = 0xb5
	IDOutputSamplingFrequency     schema.ElementID = 0x78b5
	IDChannels                    schema.ElementID = 0x9f
	IDChannelPositions            schema.ElementID = 0x7d7b
	IDBitDepth                    schema.ElementID = 0x6264
	IDEmphasis                    schema.ElementID = 0x52f1
	IDTrackOperation              schema.ElementID = 0xe2
	IDTrackCombinePlanes          schema.ElementID = 0xe3
	IDTrackPlane                  schema.ElementID = 0xe4
	IDTrackPlaneUID               schema.ElementID = 0xe5
	IDTrackPlaneType              schema.ElementID = 0xe6
	IDTrackJoinBlocks             schema.ElementID = 0xe9
	IDTrackJoinUID                schema.ElementID = 0xed
	IDTrickTrackUID               schema.ElementID = 0xc0
	IDTrickTrackSegmentUID        schema.ElementID = 0xc1
	IDTrickTrackFlag              schema.ElementID = 0xc6
	IDTrickMasterTrackUID         schema.ElementID = 0xc7
	IDTrickMasterTrackSegmentUID  schema.ElementID = 0xc4
	IDContentEncodings            schema.ElementID = 0x6d80
	IDContentEncoding             schema.ElementID = 0x6240
	IDContentEncodingOrder        schema.ElementID = 0x5031
	IDContentEncodingScope        schema.ElementID = 0x5032
	IDContentEncodingType         schema.ElementID = 0x5033
	IDContentCompression          schema.ElementID = 0x5034
	IDContentCompAlgo             schema.ElementID = 0x4254
	IDContentCompSettings         schema.ElementID = 0x4255
	IDContentEncryption           schema.ElementID = 0x5035
	IDContentEncAlgo              schema.ElementID = 0x47e1
	IDContentEncKeyID             schema.ElementID = 0x47e2
	IDContentEncAESSettings       schema.ElementID = 0x47e7
	IDAESSettingsCipherMode       schema.ElementID = 0x47e8
	IDContentSignature            schema.ElementID = 0x47e3
	IDContentSigKeyID             schema.ElementID = 0x47e4
	IDContentSigAlgo              schema.ElementID = 0x47e5
	IDContentSigHashAlgo          schema.ElementID = 0x47e6
	IDCues                        schema.ElementID = 0x1c53bb6b
	IDCuePoint                    schema.ElementID = 0xbb
	IDCueTime                     schema.ElementID = 0xb3
	IDCueTrackPositions           schema.ElementID = 0xb7
	IDCueTrack                    schema.ElementID = 0xf7
	IDCueClusterPosition          schema.ElementID = 0xf1
	IDCueRelativePosition         schema.ElementID = 0xf0
	IDCueDuration                 schema.ElementID = 0xb2
	IDCueBlockNumber              schema.ElementID = 0x5378
	IDCueCodecState               schema.ElementID = 0xea
	IDCueReference                schema.ElementID = 0xdb
	IDCueRefTime                  schema.ElementID = 0x96
	IDCueRefCluster               schema.ElementID = 0x97
	IDCueRefNumber                schema.ElementID = 0x535f
	IDCueRefCodecState            schema.ElementID = 0xeb
	IDAttachments                 schema.ElementID = 0x1941a469
	IDAttachedFile                schema.ElementID = 0x61a7
	IDFileDescription             schema.ElementID = 0x467e
	IDFileName                    schema.ElementID = 0x466e
	IDFileMediaType               schema.ElementID = 0x4660
	IDFileData                    schema.ElementID = 0x465c
	IDFileUID                     schema.ElementID = 0x46ae
	IDFileReferral                schema.ElementID = 0x4675
	IDFileUsedStartTime           schema.ElementID = 0x4661
	IDFileUsedEndTime             schema.ElementID = 0x4662
	IDChapters                    schema.ElementID = 0x1043a770
	IDEditionEntry                schema.ElementID = 0x45b9
	IDEditionUID                  schema.ElementID = 0x45bc
	IDEditionFlagHidden           schema.ElementID = 0x45bd
	IDEditionFlagDefault          schema.ElementID = 0x45db
	IDEditionFlagOrdered          schema.ElementID = 0x45dd
	IDEditionDisplay              schema.ElementID = 0x4520
	IDEditionString               schema.ElementID = 0x4521
	IDEditionLanguageIETF         schema.ElementID = 0x45e4
	IDChapterAtom                 schema.ElementID = 0xb6
	IDChapterUID                  schema.ElementID = 0x73c4
	IDChapterStringUID            schema.ElementID = 0x5654
	IDChapterTimeStart            schema.ElementID = 0x91
	IDChapterTimeEnd              schema.ElementID = 0x92
	IDChapterFlagHidden           schema.ElementID = 0x98
	IDChapterFlagEnabled          schema.ElementID = 0x4598
	IDChapterSegmentUUID          schema.ElementID = 0x6e67
	IDChapterSkipType             schema.ElementID = 0x4588
	IDChapterSegmentEditionUID    schema.ElementID = 0x6ebc
	IDChapterPhysicalEquiv        schema.ElementID = 0x63c3
	IDChapterTrack                schema.ElementID = 0x8f
	IDChapterTrackUID             schema.ElementID = 0x89
	IDChapterDisplay              schema.ElementID = 0x80
	IDChapString                  schema.ElementID = 0x85
	IDChapLanguage                schema.ElementID = 0x437c
	IDChapLanguageBCP47           schema.ElementID = 0x437d
	IDChapCountry                 schema.ElementID = 0x437e
	IDChapProcess                 schema.ElementID = 0x6944
	IDChapProcessCodecID          schema.ElementID = 0x6955
	IDChapProcessPrivate          schema.ElementID = 0x450d
	IDChapProcessCommand          schema.ElementID = 0x6911
	IDChapProcessTime             schema.ElementID = 0x6922
	IDChapProcessData             schema.ElementID = 0x6933
	IDTags                        schema.ElementID = 0x1254c367
	IDTag                         schema.ElementID = 0x7373
	IDTargets                     schema.ElementID = 0x63c0
	IDTargetTypeValue             schema.ElementID = 0x68ca
	IDTargetType                  schema.ElementID = 0x63ca
	IDTagTrackUID                 schema.ElementID = 0x63c5
	IDTagEditionUID               schema.ElementID = 0x63c9
	IDTagChapterUID               schema.ElementID = 0x63c4
	IDTagAttachmentUID            schema.ElementID = 0x63c6
	IDSimpleTag                   schema.ElementID = 0x67c8
	IDTagName                     schema.ElementID = 0x45a3
	IDTagLanguage                 schema.ElementID = 0x447a
	IDTagLanguageBCP47            schema.ElementID = 0x447b
	IDTagDefault                  schema.ElementID = 0x4484
	IDTagDefaultBogus             schema.ElementID = 0x44b4
	IDTagString                   schema.ElementID = 0x4487
	IDTagBinary                   schema.ElementID = 0x4485
)
View Source
var ErrUnexpectedClusterElement = errors.New("unexpected Cluster")

ErrUnexpectedClusterElement means that Cluster was encountered before an Info and a Tracks Element or a SeekHead Element.

The first Info Element and the first Tracks Element MUST either be stored before the first Cluster Element or both SHALL be referenced by a SeekHead Element occurring before the first Cluster Element.

Functions

func ExtractTract

func ExtractTract(w io.Writer, s *Scanner, t TrackEntry) error

Types

type AttachedFile

type AttachedFile struct {
	FileDescription   *string
	FileName          string
	FileMediaType     string
	FileData          []byte
	FileUID           uint
	FileReferral      *[]byte
	FileUsedStartTime *uint
	FileUsedEndTime   *uint
}

type Attachments

type Attachments struct {
	AttachedFile []AttachedFile
}

type Audio

type Audio struct {
	SamplingFrequency       float64
	OutputSamplingFrequency *float64
	Channels                uint
	ChannelPositions        *[]byte
	BitDepth                *uint
	Emphasis                uint
}

type Block

type Block struct {
	Type BlockType

	TrackNumber int64
	// Relative Timestamp to Cluster timestamp, signed int16
	Timestamp time.Duration
	Duration  time.Duration
	Flags     uint8
	Data      io.Reader
}

Block implements block structure according to Section 6.2.3 of draft-ietf-cellar-matroska-07 https://datatracker.ietf.org/doc/html/draft-ietf-cellar-matroska-07#section-6.2.3

func NewBlock

func NewBlock(block []byte, tsoffset, scale, d time.Duration, t BlockType) (Block, error)

type BlockAdditionMapping

type BlockAdditionMapping struct {
	BlockAddIDValue     *uint
	BlockAddIDName      *string
	BlockAddIDType      uint
	BlockAddIDExtraData *[]byte
}

type BlockAdditions

type BlockAdditions struct {
	BlockMore []BlockMore
}

type BlockGroup

type BlockGroup struct {
	Block             []byte
	BlockVirtual      *[]byte
	BlockAdditions    *BlockAdditions
	BlockDuration     *uint
	ReferencePriority uint
	ReferenceBlock    []int
	ReferenceVirtual  *int
	CodecState        *[]byte
	DiscardPadding    *int
	Slices            *Slices
	ReferenceFrame    *ReferenceFrame
}

type BlockMore

type BlockMore struct {
	BlockAdditional []byte
	BlockAddID      uint
}

type BlockType

type BlockType uint8
const (
	BlockTypeBlock BlockType = iota
	BlockTypeSimpleBlock
)

type ChapProcess

type ChapProcess struct {
	ChapProcessCodecID uint
	ChapProcessPrivate *[]byte
	ChapProcessCommand []ChapProcessCommand
}

type ChapProcessCommand

type ChapProcessCommand struct {
	ChapProcessTime uint
	ChapProcessData []byte
}

type ChapterAtom

type ChapterAtom struct {
	ChapterAtom              *ChapterAtom
	ChapterUID               uint
	ChapterStringUID         *string
	ChapterTimeStart         uint
	ChapterTimeEnd           *uint
	ChapterFlagHidden        uint
	ChapterFlagEnabled       uint
	ChapterSegmentUUID       *[]byte
	ChapterSkipType          *uint
	ChapterSegmentEditionUID *uint
	ChapterPhysicalEquiv     *uint
	ChapterTrack             *ChapterTrack
	ChapterDisplay           []ChapterDisplay
	ChapProcess              []ChapProcess
}

type ChapterDisplay

type ChapterDisplay struct {
	ChapString        string
	ChapLanguage      []string
	ChapLanguageBCP47 []string
	ChapCountry       []string
}

type ChapterTrack

type ChapterTrack struct {
	ChapterTrackUID []uint
}

type ChapterTranslate

type ChapterTranslate struct {
	ChapterTranslateID         []byte
	ChapterTranslateCodec      uint
	ChapterTranslateEditionUID []uint
}

type Chapters

type Chapters struct {
	EditionEntry []EditionEntry
}

type Cluster

type Cluster struct {
	Timestamp      time.Duration
	SilentTracks   *SilentTracks
	Position       *uint
	PrevSize       *uint
	SimpleBlock    [][]byte
	BlockGroup     []BlockGroup
	EncryptedBlock [][]byte
}

type CodecType

type CodecType string

func CodecID

func CodecID(s string) (prefix CodecType, major, suffix string)

type Colour

type Colour struct {
	MatrixCoefficients      uint
	BitsPerChannel          uint
	ChromaSubsamplingHorz   *uint
	ChromaSubsamplingVert   *uint
	CbSubsamplingHorz       *uint
	CbSubsamplingVert       *uint
	ChromaSitingHorz        uint
	ChromaSitingVert        uint
	Range                   uint
	TransferCharacteristics uint
	Primaries               uint
	MaxCLL                  *uint
	MaxFALL                 *uint
	MasteringMetadata       *MasteringMetadata
}

type ContentCompression

type ContentCompression struct {
	ContentCompAlgo     uint
	ContentCompSettings *[]byte
}

type ContentEncAESSettings

type ContentEncAESSettings struct {
	AESSettingsCipherMode uint
}

type ContentEncoding

type ContentEncoding struct {
	ContentEncodingOrder uint
	ContentEncodingScope uint
	ContentEncodingType  uint
	ContentCompression   *ContentCompression
	ContentEncryption    *ContentEncryption
}

type ContentEncodings

type ContentEncodings struct {
	ContentEncoding []ContentEncoding
}

type ContentEncryption

type ContentEncryption struct {
	ContentEncAlgo        uint
	ContentEncKeyID       *[]byte
	ContentEncAESSettings *ContentEncAESSettings
	ContentSignature      *[]byte
	ContentSigKeyID       *[]byte
	ContentSigAlgo        uint
	ContentSigHashAlgo    uint
}

type CuePoint

type CuePoint struct {
	CueTime           uint
	CueTrackPositions []CueTrackPositions
}

type CueReference

type CueReference struct {
	CueRefTime       uint
	CueRefCluster    uint
	CueRefNumber     uint
	CueRefCodecState uint
}

type CueTrackPositions

type CueTrackPositions struct {
	CueTrack            uint
	CueClusterPosition  uint
	CueRelativePosition *uint
	CueDuration         *uint
	CueBlockNumber      *uint
	CueCodecState       uint
	CueReference        []CueReference
}

type Cues

type Cues struct {
	CuePoint []CuePoint
}

type EditionDisplay

type EditionDisplay struct {
	EditionString       string
	EditionLanguageIETF []string
}

type EditionEntry

type EditionEntry struct {
	EditionUID         *uint
	EditionFlagHidden  uint
	EditionFlagDefault uint
	EditionFlagOrdered uint
	EditionDisplay     []EditionDisplay
	ChapterAtom        []ChapterAtom
}

type Info

type Info struct {
	SegmentUUID      *[]byte
	SegmentFilename  *string
	PrevUUID         *[]byte
	PrevFilename     *string
	NextUUID         *[]byte
	NextFilename     *string
	SegmentFamily    [][]byte
	ChapterTranslate []ChapterTranslate
	TimestampScale   time.Duration
	Duration         *float64
	DateUTC          *time.Time
	Title            *string
	MuxingApp        string
	WritingApp       string
}

type MasteringMetadata

type MasteringMetadata struct {
	PrimaryRChromaticityX   *float64
	PrimaryRChromaticityY   *float64
	PrimaryGChromaticityX   *float64
	PrimaryGChromaticityY   *float64
	PrimaryBChromaticityX   *float64
	PrimaryBChromaticityY   *float64
	WhitePointChromaticityX *float64
	WhitePointChromaticityY *float64
	LuminanceMax            *float64
	LuminanceMin            *float64
}

type Projection

type Projection struct {
	ProjectionType      uint
	ProjectionPrivate   *[]byte
	ProjectionPoseYaw   float64
	ProjectionPosePitch float64
	ProjectionPoseRoll  float64
}

type ReferenceFrame

type ReferenceFrame struct {
	ReferenceOffset    uint
	ReferenceTimestamp uint
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.ReadSeeker) (*Scanner, error)

func (*Scanner) Cluster

func (s *Scanner) Cluster() Cluster

func (*Scanner) Err

func (s *Scanner) Err() error

func (*Scanner) Header

func (s *Scanner) Header() *ebml.EBML

Header returns the ebml.EBML element of the matroska document

func (*Scanner) Info

func (s *Scanner) Info() *Info

Info returns the Info element of the matroska document.

func (*Scanner) Next

func (s *Scanner) Next() bool

func (*Scanner) SeekHead

func (s *Scanner) SeekHead() (*SeekHead, bool)

SeekHead returns the SeekHead element of the matroska document or a constructed version of it. The second return value is false when it cannot be trusted because it is constructed.

func (*Scanner) Tracks

func (s *Scanner) Tracks() *Tracks

Tracks returns the Tracks element of the matroska document.

type Seek

type Seek struct {
	SeekID       schema.ElementID
	SeekPosition uint
}

type SeekHead

type SeekHead struct {
	Seek []Seek
}

type Segment

type Segment struct {
	SeekHead    []SeekHead
	Info        Info
	Cluster     []Cluster
	Tracks      *Tracks
	Cues        *Cues
	Attachments *Attachments
	Chapters    *Chapters
	Tags        []Tags
}

type SilentTracks

type SilentTracks struct {
	SilentTrackNumber []uint
}

type SimpleTag

type SimpleTag struct {
	SimpleTag        *SimpleTag
	TagName          string
	TagLanguage      string
	TagLanguageBCP47 *string
	TagDefault       uint
	TagDefaultBogus  uint
	TagString        *string
	TagBinary        *[]byte
}

type Slices

type Slices struct {
	TimeSlice []TimeSlice
}

type Tag

type Tag struct {
	Targets   Targets
	SimpleTag []SimpleTag
}

type Tags

type Tags struct {
	Tag []Tag
}

type Targets

type Targets struct {
	TargetTypeValue  uint
	TargetType       *string
	TagTrackUID      []uint
	TagEditionUID    []uint
	TagChapterUID    []uint
	TagAttachmentUID []uint
}

type TimeSlice

type TimeSlice struct {
	LaceNumber      *uint
	FrameNumber     uint
	BlockAdditionID uint
	Delay           uint
	SliceDuration   uint
}

type TrackCombinePlanes

type TrackCombinePlanes struct {
	TrackPlane []TrackPlane
}

type TrackEntry

type TrackEntry struct {
	TrackNumber                 uint
	TrackUID                    uint
	TrackType                   uint
	FlagEnabled                 uint
	FlagDefault                 uint
	FlagForced                  uint
	FlagHearingImpaired         *uint
	FlagVisualImpaired          *uint
	FlagTextDescriptions        *uint
	FlagOriginal                *uint
	FlagCommentary              *uint
	FlagLacing                  uint
	MinCache                    uint
	MaxCache                    *uint
	DefaultDuration             *uint
	DefaultDecodedFieldDuration *uint
	TrackTimestampScale         float64
	TrackOffset                 int
	MaxBlockAdditionID          uint
	BlockAdditionMapping        []BlockAdditionMapping
	Name                        *string
	Language                    string
	LanguageBCP47               *string
	CodecID                     string
	CodecPrivate                *[]byte
	CodecName                   *string
	AttachmentLink              *uint
	CodecSettings               *string
	CodecInfoURL                []string
	CodecDownloadURL            []string
	CodecDecodeAll              uint
	TrackOverlay                []uint
	CodecDelay                  uint
	SeekPreRoll                 uint
	TrackTranslate              []TrackTranslate
	Video                       *Video
	Audio                       *Audio
	TrackOperation              *TrackOperation
	TrickTrackUID               *uint
	TrickTrackSegmentUID        *[]byte
	TrickTrackFlag              uint
	TrickMasterTrackUID         *uint
	TrickMasterTrackSegmentUID  *[]byte
	ContentEncodings            *ContentEncodings
}

type TrackJoinBlocks

type TrackJoinBlocks struct {
	TrackJoinUID []uint
}

type TrackOperation

type TrackOperation struct {
	TrackCombinePlanes *TrackCombinePlanes
	TrackJoinBlocks    *TrackJoinBlocks
}

type TrackPlane

type TrackPlane struct {
	TrackPlaneUID  uint
	TrackPlaneType uint
}

type TrackTranslate

type TrackTranslate struct {
	TrackTranslateTrackID    []byte
	TrackTranslateCodec      uint
	TrackTranslateEditionUID []uint
}

type Tracks

type Tracks struct {
	TrackEntry []TrackEntry
}

type Video

type Video struct {
	FlagInterlaced     uint
	FieldOrder         uint
	StereoMode         uint
	AlphaMode          uint
	OldStereoMode      *uint
	PixelWidth         uint
	PixelHeight        uint
	PixelCropBottom    uint
	PixelCropTop       uint
	PixelCropLeft      uint
	PixelCropRight     uint
	DisplayWidth       *uint
	DisplayHeight      *uint
	DisplayUnit        uint
	AspectRatioType    uint
	UncompressedFourCC *[]byte
	GammaValue         *float64
	FrameRate          *float64
	Colour             *Colour
	Projection         *Projection
}

Directories

Path Synopsis
cmd
mkc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL