dcp

package
v0.0.0-...-61808cf Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetMapNamespaceIOP   = "http://www.digicine.com/PROTO-ASDCP-AM-20040311#"
	AssetMapNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-9/2007/AM"
)
View Source
const (
	CompositionPlaylistNamespaceIOP   = "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#"
	CompositionPlaylistNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-7/2006/CPL"
)
View Source
const (
	PackingListNamespaceIOP   = "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#"
	PackingListNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-8/2007/PKL"
)
View Source
const (
	SubtitleEffectNone = SubtitleEffect(iota)
	SubtitleEffectBorder
	SubtitleEffectShadow
)
View Source
const (
	SubtitleAlignmentBottomLeft = SubtitleAlignment(iota)
	SubtitleAlignmentBottomCenter
	SubtitleAlignmentBottomRight
	SubtitleAlignmentCenterLeft
	SubtitleAlignmentCenterCenter
	SubtitleAlignmentCenterRight
	SubtitleAlignmentTopLeft
	SubtitleAlignmentTopCenter
	SubtitleAlignmentTopRight
)
View Source
const (
	SubtitleDirectionHorizontal = SubtitleDirection(iota)
	SubtitleDirectionVertical
)
View Source
const (
	VolumeIndexNamespaceIOP   = "http://www.digicine.com/PROTO-ASDCP-VL-20040311#"
	VolumeIndexNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-9/2007/AM"
)

Variables

View Source
var DefaultSubtitleFont = SubtitleFont{
	Color: color.RGBA{
		R: 0xFF,
		G: 0xFF,
		B: 0xFF,
		A: 0xFF,
	},
	Size:   42,
	Effect: SubtitleEffectNone,
	EffectColor: color.RGBA{
		R: 0xFF,
		G: 0x00,
		B: 0x00,
		A: 0xFF,
	},
	AspectRatio: 1,
	Italic:      false,
	Bold:        false,
	Underline:   false,
	Spacing:     0,
}

Functions

This section is empty.

Types

type AssetMap

type AssetMap struct {
	XMLName        xml.Name
	Id             string          `xml:"Id"`
	AnnotationText string          `xml:"AnnotationText"`
	VolumeCount    int             `xml:"VolumeCount,omitempty"`
	IssueDate      string          `xml:"IssueDate"`
	Issuer         string          `xml:"Issuer"`
	Creator        string          `xml:"Creator"`
	Assets         []AssetMapEntry `xml:"AssetList>Asset"`
}

func (AssetMap) GetPackingLists

func (am AssetMap) GetPackingLists() (result []AssetMapEntry)

func (AssetMap) IsIOP

func (am AssetMap) IsIOP() bool

func (AssetMap) IsSMPTE

func (am AssetMap) IsSMPTE() bool

type AssetMapChunk

type AssetMapChunk struct {
	Path        string `xml:"Path"`
	VolumeIndex int    `xml:"VolumeIndex,omitempty"`
	Offset      *int64 `xml:"Offset,omitempty"`
	Length      *int64 `xml:"Length,omitempty"`
}

type AssetMapEntry

type AssetMapEntry struct {
	Id          string          `xml:"Id"`
	PackingList *string         `xml:"PackingList"`
	Chunks      []AssetMapChunk `xml:"ChunkList>Chunk"`
}

func (AssetMapEntry) IsPackingList

func (e AssetMapEntry) IsPackingList() bool

type CompositionMetadataAsset

type CompositionMetadataAsset struct {
	XMLName xml.Name `xml:"CompositionMetadataAsset"`

	FullContentTitleText   string     `xml:"FullContentTitleText,omitempty"`
	ReleaseTerritory       string     `xml:"ReleaseTerritory,omitempty"`
	Distributor            string     `xml:"Distributor,omitempty"`
	Facility               string     `xml:"Facility,omitempty"`
	Luminance              *Luminance `xml:"Luminance,omitempty"`
	MainSoundConfiguration string     `xml:"MainSoundConfiguration,omitempty"`
	MainSoundSampleRate    string     `xml:"MainSoundSampleRate,omitempty"`
	MainPictureStoredArea  struct {
		Width  int `xml:"Width"`
		Height int `xml:"Height"`
	} `xml:"MainPictureStoredArea"`
	MainPictureActiveArea struct {
		Width  int `xml:"Width"`
		Height int `xml:"Height"`
	} `xml:"MainPictureActiveArea"`
	MainSubtitleLanguageList string `xml:"MainSubtitleLanguageList,omitempty"`
}

type CompositionPlaylist

type CompositionPlaylist struct {
	XMLName          xml.Name `xml:"CompositionPlaylist"`
	Id               string   `xml:"Id"`
	AnnotationText   string   `xml:"AnnotationText"`
	IssueDate        string   `xml:"IssueDate"`
	Issuer           string   `xml:"Issuer"`
	Creator          string   `xml:"Creator"`
	ContentTitleText string   `xml:"ContentTitleText,omitempty"`
	ContentKind      string   `xml:"ContentKind"`
	RatingList       []any    `xml:"RatingList>Rating"`
	Reels            []Reel   `xml:"ReelList>Reel"`

	Signer any `xml:"Signer"`
}

func (CompositionPlaylist) IsIOP

func (cpl CompositionPlaylist) IsIOP() bool

func (CompositionPlaylist) IsSMPTE

func (cpl CompositionPlaylist) IsSMPTE() bool

type DCP

type DCP struct {
	Path         string
	AssetMapFile string
	AssetMap     AssetMap
	// contains filtered or unexported fields
}

func Open

func Open(dcpPath string) (*DCP, error)

Open Opens a DCP. Provide path to its directory or its ASSETMAP file, which can also be an URL

func (*DCP) GetAbsoluteAssetPath

func (dcp *DCP) GetAbsoluteAssetPath(id string) (assetPath string, ok bool)

func (*DCP) GetAssetPath

func (dcp *DCP) GetAssetPath(id string) (assetPath string, ok bool)

func (*DCP) GetAssetPaths

func (dcp *DCP) GetAssetPaths() map[string]string

func (*DCP) GetCompositionPlaylist

func (dcp *DCP) GetCompositionPlaylist(id string) (cpl CompositionPlaylist, err error)

func (*DCP) GetDCSubtitle

func (dcp *DCP) GetDCSubtitle(id string) (sub *DCSubtitle, err error)

func (*DCP) GetPackingList

func (dcp *DCP) GetPackingList(id string) (pkl PackingList, err error)

func (*DCP) GetPackingLists

func (dcp *DCP) GetPackingLists() (pkls []PackingList, err error)

func (*DCP) IsIOP

func (dcp *DCP) IsIOP() bool

func (*DCP) IsSMPTE

func (dcp *DCP) IsSMPTE() bool

func (*DCP) SplitPackingList

func (dcp *DCP) SplitPackingList(id string, copyFile func(assetName string, size int64, sourcePath string) error, openWriter func(assetName string, size int64) (io.WriteCloser, error)) (err error)

type DCSubtitle

type DCSubtitle struct {
	XMLName    xml.Name `xml:"DCSubtitle"`
	SubtitleId string   `xml:"SubtitleID"`
	MovieTitle string   `xml:"MovieTitle,omitempty"`
	ReelNumber int      `xml:"ReelNumber"`
	Language   string   `xml:"Language,omitempty"`

	Offset string `xml:"Offset,attr,omitempty"`

	LoadFonts []DCSubtitleLoadFont `xml:"LoadFont"`

	Nodes []Node `xml:",any"`
}

func (DCSubtitle) SubtitleEvents

func (s DCSubtitle) SubtitleEvents() (events []SubtitleEvent, err error)

type DCSubtitleLoadFont

type DCSubtitleLoadFont struct {
	Id  string `xml:"Id,attr"`
	URI string `xml:"URI,attr"`
}

type Luminance

type Luminance struct {
	// Units can be foot-lambert or candela-per-square-metre
	// 1 foot-lambert = 3.426 candela-per-square-metre
	Units string  `xml:"units,attr"`
	Value float64 `xml:",chardata"`
}

Luminance The screen luminance at which the content was authored. see https://pub.smpte.org/latest/st429-16/index.html#sec-luminance

type Node

type Node struct {
	XMLName xml.Name
	Attrs   []xml.Attr `xml:",any,attr"`
	Content []byte     `xml:",innerxml"`
	Nodes   []Node     `xml:",any"`
}

func (*Node) Attr

func (n *Node) Attr(name string) (value string, ok bool)

func (*Node) UnmarshalXML

func (n *Node) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type PackingList

type PackingList struct {
	XMLName        xml.Name           `xml:"PackingList"`
	Id             string             `xml:"Id"`
	AnnotationText string             `xml:"AnnotationText"`
	IssueDate      string             `xml:"IssueDate"`
	Issuer         string             `xml:"Issuer"`
	Creator        string             `xml:"Creator"`
	Assets         []PackingListEntry `xml:"AssetList>Asset"`
}

func (PackingList) GetCompositionPlaylists

func (pkl PackingList) GetCompositionPlaylists(assetMapIdToAssetPath map[string]string) (result []PackingListEntry)

func (PackingList) IsIOP

func (pkl PackingList) IsIOP() bool

func (PackingList) IsSMPTE

func (pkl PackingList) IsSMPTE() bool

type PackingListEntry

type PackingListEntry struct {
	Id               string  `xml:"Id"`
	Hash             string  `xml:"Hash"`
	Size             int64   `xml:"Size"`
	Type             string  `xml:"Type"`
	OriginalFileName string  `xml:"OriginalFileName,omitempty"`
	AnnotationText   *string `xml:"AnnotationText,omitempty"`
}

func (PackingListEntry) IsCompositionPlaylist

func (e PackingListEntry) IsCompositionPlaylist(fallbackFileName string) bool

type Reel

type Reel struct {
	Id           string     `xml:"Id"`
	MainPicture  *ReelAsset `xml:"AssetList>MainPicture,omitempty"`
	MainSound    *ReelAsset `xml:"AssetList>MainSound,omitempty"`
	MainSubtitle *ReelAsset `xml:"AssetList>MainSubtitle,omitempty"`

	ClosedCaption *ReelAsset `xml:"AssetList>ClosedCaption,omitempty"`

	MainClosedCaption *ReelAsset `xml:"AssetList>MainClosedCaption,omitempty"`

	MainMarker *ReelMarker `xml:"AssetList>MainMarker,omitempty"`

	CompositionMetadataAsset *CompositionMetadataAsset `xml:"AssetList>CompositionMetadataAsset,omitempty"`
}

func (Reel) Assets

func (r Reel) Assets() (assets []ReelAsset)

type ReelAsset

type ReelAsset struct {
	XMLName xml.Name

	Id   string `xml:"Id"`
	Hash string `xml:"Hash"`

	Language string `xml:"Language,omitempty"`

	KeyId string `xml:"KeyId,omitempty"`

	IntrinsicDuration int `xml:"IntrinsicDuration"`
	EntryPoint        int `xml:"EntryPoint"`
	Duration          int `xml:"Duration"`

	EditRate          string `xml:"EditRate,omitempty"`
	FrameRate         string `xml:"FrameRate,omitempty"`
	ScreenAspectRatio string `xml:"ScreenAspectRatio,omitempty"`

	Size             int64   `xml:"Size"`
	Type             string  `xml:"Type"`
	OriginalFileName string  `xml:"OriginalFileName,omitempty"`
	AnnotationText   *string `xml:"AnnotationText,omitempty"`
}

type ReelMarker

type ReelMarker struct {
	Id string `xml:"Id"`

	IntrinsicDuration int `xml:"IntrinsicDuration"`
	EntryPoint        int `xml:"EntryPoint"`
	Duration          int `xml:"Duration"`

	EditRate string `xml:"EditRate,omitempty"`

	MarkerList []struct {
		Label  string `xml:"Label"`
		Offset int    `xml:"Offset"`
	} `xml:"MarkerList>Marker"`
}

type SubtitleAlignment

type SubtitleAlignment int

func SubtitleAlignmentFromVerticalHorizontal

func SubtitleAlignmentFromVerticalHorizontal(v, h int) SubtitleAlignment

SubtitleAlignmentFromVerticalHorizontal v 0 = left, 1 = center, 2 = right h 0 = bottom, 1 = center, 2 = top

type SubtitleDirection

type SubtitleDirection int

type SubtitleEffect

type SubtitleEffect int

type SubtitleEvent

type SubtitleEvent struct {
	Start, End      time.Duration
	FadeIn, FadeOut time.Duration

	Alignment SubtitleAlignment

	Direction SubtitleDirection

	// MarginRight MarginLeft MarginVertical float64 0-1 percentage of margin relative to width/height
	MarginRight    float64
	MarginLeft     float64
	MarginVertical float64

	Text []SubtitleText
}

type SubtitleFont

type SubtitleFont struct {
	Color color.RGBA
	Size  float64

	Effect      SubtitleEffect
	EffectColor color.RGBA

	// AspectRatio Controls the horizontal scale
	AspectRatio float64

	Italic    bool
	Bold      bool
	Underline bool

	Spacing float64
}

type SubtitleText

type SubtitleText struct {
	Font SubtitleFont
	Text string
}

type VolumeIndex

type VolumeIndex struct {
	XMLName xml.Name
	Index   int `xml:"Index"`
}

func (VolumeIndex) IsIOP

func (vi VolumeIndex) IsIOP() bool

func (VolumeIndex) IsSMPTE

func (vi VolumeIndex) IsSMPTE() bool

Jump to

Keyboard shortcuts

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