decode

package
v0.0.0-...-a35b708 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package decode handles the MRX decoding

Index

Constants

This section is empty.

Variables

View Source
var DecodeCmd = &cobra.Command{
	Use:   "decode",
	Short: "Decode an mrx file structure into yaml form",
	Long: `The decode flag breaks down the selected mrx file into a yaml file, 
detailing the labels of its contents and the overall file structure


The yaml contains an array of partitions and their essence information in the order they were found in the mrx file. 
The file has the following fields.


The partition section contains the following information
- Partition Type identifies the essence container. e.g. Header or Body
- HeaderLength is the length of the header and any metadata it may contain.
- EssenceByteCount is the total byte length of all the essence.
- ContentPackageCount is the number of individual content packages within the partition.
- IndexTable indetifies if a index table is present in this partition showing some of the data contained within it.
- ContentPackages is an array of the contentpackage found in the partition, in the order it was found in the partition. Each conent package is an essence array.
- Warning provides a string stating any potential issues within the essence.
- skipped content is an object stating how many content packages were not included and their total byte count.
- ContentPackageStatistics contains the average, variance and standard deviation in the lengths of the content packages, as well as the longest and shortest package.


The essence array contains the following information in each element. It has the following fields.
- Key, this is the UL of the container.
- Symbol, this is the identifier of the essence type.
- Description, the description of the essence as found in the smpte register, or auto generated information where the key was not identified.
- File Offset the offset in the file for the start of the data **NOT** the start of the essence container.
- length is the length of the essence data
- Type is the resolved container key if it can be found.
- TotalByteCount is the total count of the essence including the UL and BER encoded length Bytes.  

content packages with the key "00000000.00000000.00000000.00000000" are skipped content packages, these represent an array of content packages as a single item.	`,

	RunE: decodeStructure,
}
View Source
var DecodeSaveCmd = &cobra.Command{
	Use:   "decodesave",
	Short: "Extract the essence of an mrx file and saves each essence as an individual file.",
	Long: `An mrx decoder that extracts the essence of a file and saves each essence as an individual file.

Within in the output folder, child folders named after the partition type are generated, e.g. 0000Body. Within each folder
the essence is saved in the order it is found. Under the naming prefix of 0000{{esskeytype}}.

The esskeyTypes are:
- frameText - frame text data
- clipBin - clip binary data
- clipText - clip test data
- frameBin - frame binary data

	`,

	RunE: decodeAndSave,
}

Functions

func EssenceExtractToFile

func EssenceExtractToFile(stream io.Reader, parentFolder string, flat bool, leadingZeros int) error

EssenceExtractToFile extracts the contents from an MRX and dumps it to a folder as individual files, where each file is an individual metadata entry from the file.

func ExtractEssenceType

func ExtractEssenceType(ul []byte, matches map[string]mxf2go.EssenceInformation, pos *int) mxf2go.EssenceInformation

ExtractEssenceType returns the essence information associated with a essence Key, if it a matching key found.

func FullName

func FullName(namebytes []byte) string

func MRXReader

func MRXReader(stream io.Reader, buffer chan *klv.KLV, size int) (*mrxDecoder, error)

MRXReader reads an MRX stream, then buffers through the klv channel breaking down the contents into a go struct.

func MRXStructureExtractor

func MRXStructureExtractor(mrxStream io.Reader, w io.Writer, contentPackageLimit []int, jsonFile bool) error

MRXStructureExtractor takes an MRX stream and decodes the layout to the writer.

Types

type DataFormat

type DataFormat struct {
	MRXID     string
	FrameRate string
	Data      [][]byte
}

Dataformat has the stream ID and the data within

func ExtractStreamData

func ExtractStreamData(mrxStream io.Reader) ([]*DataFormat, error)

Extract streamData takes an MRX file and extracts each metadata stream into a seperate data stream in the order it is found in the file.

Jump to

Keyboard shortcuts

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