63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package dcp
|
|
|
|
import "encoding/xml"
|
|
|
|
const (
|
|
AssetMapNamespaceIOP = "http://www.digicine.com/PROTO-ASDCP-AM-20040311#"
|
|
AssetMapNamespaceSMPTE = "http://www.smpte-ra.org/schemas/429-9/2007/AM"
|
|
)
|
|
|
|
type assetMapIOP struct {
|
|
XMLName xml.Name `xml:"http://www.digicine.com/PROTO-ASDCP-AM-20040311# AssetMap"`
|
|
AssetMap
|
|
}
|
|
|
|
type assetMapSMPTE struct {
|
|
XMLName xml.Name `xml:"http://www.smpte-ra.org/schemas/429-9/2007/AM AssetMap"`
|
|
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 (am AssetMap) IsIOP() bool {
|
|
return am.XMLName.Space == AssetMapNamespaceIOP
|
|
}
|
|
|
|
func (am AssetMap) IsSMPTE() bool {
|
|
return am.XMLName.Space == AssetMapNamespaceSMPTE
|
|
}
|
|
|
|
func (am AssetMap) GetPackingLists() (result []AssetMapEntry) {
|
|
for _, a := range am.Assets {
|
|
if a.IsPackingList() {
|
|
result = append(result, a)
|
|
}
|
|
}
|
|
return result
|
|
}
|
|
|
|
type AssetMapEntry struct {
|
|
Id string `xml:"Id"`
|
|
PackingList *string `xml:"PackingList"`
|
|
Chunks []AssetMapChunk `xml:"ChunkList>Chunk"`
|
|
}
|
|
|
|
type AssetMapChunk struct {
|
|
Path string `xml:"Path"`
|
|
VolumeIndex int `xml:"VolumeIndex,omitempty"`
|
|
Offset *int64 `xml:"Offset,omitempty"`
|
|
Length *int64 `xml:"Length,omitempty"`
|
|
}
|
|
|
|
func (e AssetMapEntry) IsPackingList() bool {
|
|
return e.PackingList != nil && *e.PackingList != "false"
|
|
}
|