133 lines
4.2 KiB
Go
133 lines
4.2 KiB
Go
package dcp
|
|
|
|
import "encoding/xml"
|
|
|
|
const (
|
|
CompositionPlaylistNamespaceIOP = "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#"
|
|
CompositionPlaylistNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-7/2006/CPL"
|
|
)
|
|
|
|
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 (cpl CompositionPlaylist) IsIOP() bool {
|
|
return cpl.XMLName.Space == CompositionPlaylistNamespaceIOP
|
|
}
|
|
|
|
func (cpl CompositionPlaylist) IsSMPTE() bool {
|
|
return cpl.XMLName.Space == CompositionPlaylistNamespaceSMPTE
|
|
}
|
|
|
|
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 (r Reel) Assets() (assets []ReelAsset) {
|
|
if r.MainPicture != nil {
|
|
assets = append(assets, *r.MainPicture)
|
|
}
|
|
if r.MainSound != nil {
|
|
assets = append(assets, *r.MainSound)
|
|
}
|
|
if r.MainSubtitle != nil {
|
|
assets = append(assets, *r.MainSubtitle)
|
|
}
|
|
if r.ClosedCaption != nil {
|
|
assets = append(assets, *r.ClosedCaption)
|
|
}
|
|
if r.MainClosedCaption != nil {
|
|
assets = append(assets, *r.MainClosedCaption)
|
|
}
|
|
return assets
|
|
}
|
|
|
|
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 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 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"`
|
|
}
|
|
|
|
// Luminance The screen luminance at which the content was authored. see https://pub.smpte.org/latest/st429-16/index.html#sec-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"`
|
|
}
|