tt

package
v0.0.0-...-6810fd9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package tt enables a user to create a minimal ST 428-7 Subtitle XML Document in accordance with SMPTE Public CD of SMPTE RP 428-22 1ED - D-Cinema Distribution Master – Minimal Timed Text XML Requirements as per requirements stipulated in RDD 52 - SMPTE DCP Bv2.1 Application Profile available at 10.5594/SMPTE.RDD52.2020.

Written by Jack Watts for SMPTE Standards TC 27C Community.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Text identifies that the Subtitle Text profile is to be used.
	Txt bool
	// Image identifies that the Subtitle Image profile is to be used.
	Img bool
	// Track signals that an MXF track file is to be created when using the CreateXML() function.
	Track bool
	// Encrypt is to be used in accordance with 'Track' as it signals that the resulting MXF is
	// to be encrypted.
	Encrypt bool
	// Reel is the reel number and shall be a positive integer reflecting the reel number the XML is to be used for
	Reel int
	// Duration is a positive integer value that maps to the ContainerDuration entry of the resulting MXF track file.
	Duration int
	// Display identifies what DisplayType value to be used. 0 = MainSubtitle, >= 1 = ClosedCaption.
	Display int
	// Framerate results in the EditRate of the Subtitle XML file and also translates to the TimeCodeRate element.
	Framerate string
	// Template is to be used when wanting to use an existing XML document to template the XML's general properties.
	Template string
	// Title is the value that populates the ContentTitleText element.
	Title string
	// Language is the RFC 5646 compliant subtag as per the IANA subtag registry.
	Language string
	// Output is the target output directory.
	Output string
)

The proceeding list of exported variables are to be used when calling either CreateXML() or CreateXMF() functions.

Functions

func CreateMXF

func CreateMXF(encrypt bool, frameRate, output, filename string, reel, duration int) error

CreateMXF creates a D-Cinema track file using pre-defined asdcp-wrap command line arguments. It expects asdcp-wrap to be present at yout system's $PATH.

func CreateXML

func CreateXML(Txt, Img, Track, Encrypt bool, Reel, Display, Duration int, FrameRate, Language, Title, Template, Output string) error

CreateXML creates a St 428-7 compliant minimal XML document.

Types

type Font

type Font struct {
	ID           string      `xml:"ID,attr,omitempty"`
	Weight       string      `xml:"Weight,attr,omitempty"`
	Size         string      `xml:"Size,attr,omitempty"`
	Color        string      `xml:"Color,attr,omitempty"`
	Effect       string      `xml:"Effect,attr,omitempty"`
	EffectColor  string      `xml:"EffectColor,attr,omitempty"`
	EffectSize   string      `xml:"EffectSize,attr,omitempty"`
	Italic       string      `xml:"Italic,attr,omitempty"`
	Underline    string      `xml:"Underline,attr,omitempty"`
	AspectAdjust string      `xml:"AspectAdjust,attr,omitempty"`
	Spacing      string      `xml:"Spacing,attr,omitempty"`
	Feather      string      `xml:"Feather,attr,omitempty"`
	Subtitle     []*Subtitle `xml:"Subtitle"`
}

Font as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Font

type Image

type Image struct {
	XMLName   xml.Name `xml:"Image"`
	Image     string   `xml:",chardata"`
	ImageType string   `xml:"ImageType,omitempty"`
	Halign    string   `xml:"Halign,attr,omitempty"`
	Hposition string   `xml:"Hposition,attr,omitempty"`
	Valign    string   `xml:"Valign,attr,omitempty"`
	Vposition string   `xml:"Vposition,attr,omitempty"`
	Zposition string   `xml:"Zposition,attr,omitempty"`
	VariableZ string   `xml:"VariableZ,attr,omitempty"`
}

Image as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Image

type LoadFont

type LoadFont struct {
	ID   string `xml:"ID,attr"`
	Font string `xml:",chardata"`
}

LoadFont as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#LoadFont

type NestedFont

type NestedFont struct {
	ID           string `xml:"ID,attr,omitempty"`
	Weight       string `xml:"Weight,attr,omitempty"`
	Size         string `xml:"Size,attr,omitempty"`
	Color        string `xml:"Color,attr,omitempty"`
	Effect       string `xml:"Effect,attr,omitempty"`
	EffectColor  string `xml:"EffectColor,attr,omitempty"`
	EffectSize   string `xml:"EffectSize,attr,omitempty"`
	Italic       string `xml:"Italic,attr,omitempty"`
	Underline    string `xml:"Underline,attr,omitempty"`
	AspectAdjust string `xml:"AspectAdjust,attr,omitempty"`
	Spacing      string `xml:"Spacing,attr,omitempty"`
	Feather      string `xml:"Feather,attr,omitempty"`
	Text         string `xml:",chardata"`
}

NestedFont as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#NestedFont

type Rt

type Rt struct {
	Size         string `xml:"Size,attr"`
	Position     string `xml:"Position,attr"`
	Offset       string `xml:"Offset,attr"`
	Spacing      string `xml:"Spacing,attr"`
	AspectAdjust string `xml:"AspectAdjust,attr"`
}

Rt as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Rt

type Ruby

type Ruby struct {
	Rb string `xml:"Ruby>Rb,omitempty"`
	Rt *Rt    `xml:"Ruby>Rt,omitempty"`
}

Ruby as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Ruby

type Subtitle

type Subtitle struct {
	SpotNumber   string      `xml:"SpotNumber,attr,omitempty"`
	TimeIn       string      `xml:"TimeIn,attr"`
	TimeOut      string      `xml:"TimeOut,attr"`
	FadeUpTime   string      `xml:"FadeUpTime,attr,omitempty"`
	FadeDownTime string      `xml:"FadeDownTime,attr,omitempty"`
	Text         []*Text     `xml:"Text,allowempty"`
	Image        []*Image    `xml:"Image,omitempty"`
	Font         *NestedFont `xml:"Font,omitempty"`
}

Subtitle as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Subtitle

type SubtitleReel

type SubtitleReel struct {
	XMLName          xml.Name  `xml:"SubtitleReel"`
	Xmlns            string    `xml:"xmlns,attr,omitempty"`
	ID               string    `xml:"Id"`
	ContentTitleText string    `xml:"ContentTitleText,omitempty"`
	IssueDate        string    `xml:"IssueDate"`
	ReelNumber       int       `xml:"ReelNumber"`
	Language         string    `xml:"Language"`
	EditRate         string    `xml:"EditRate"`
	TimeCodeRate     string    `xml:"TimeCodeRate"`
	StartTime        string    `xml:"StartTime"`
	DisplayType      string    `xml:"DisplayType"`
	LoadFont         *LoadFont `xml:"LoadFont,omitempty"`
	SubtitleList     *Font     `xml:"SubtitleList>Font"`
	Filename         string    `xml:",omitempty"`
}

SubtitleReel as per http://www.smpte-ra.org/schemas/428-7/2014/DCST

type Text

type Text struct {
	Text      string      `xml:",chardata"`
	Halign    string      `xml:"Halign,attr,omitempty"`
	Hposition string      `xml:"Hposition,attr,omitempty"`
	Valign    string      `xml:"Valign,attr,omitempty"`
	Vposition string      `xml:"Vposition,attr,omitempty"`
	Direction string      `xml:"Direction,attr,omitempty"`
	Zposition string      `xml:"Zposition,attr,omitempty"`
	VariableZ string      `xml:"VariableZ,attr,omitempty"`
	Font      *NestedFont `xml:"Font,omitempty"`
	Ruby      []*Ruby     `xml:"Ruby,omitempty"`
}

Text as per http://www.smpte-ra.org/schemas/428-7/2014/DCST#Text

type Timecode

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

Timecode struct.

func NewTimecode

func NewTimecode(frameRate float64) (*Timecode, error)

NewTimecode initialises a new timecode type from a given framerate.

func (*Timecode) GetTimeCode

func (tc *Timecode) GetTimeCode() string

GetTimeCode method generates a SMPTE timcode when called against type Timecode.

func (*Timecode) SetFrames

func (tc *Timecode) SetFrames(frameCount int)

SetFrames sets the frame count in type Timecode.

Jump to

Keyboard shortcuts

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