feat: initial media structs

This commit is contained in:
Derrick Hammer 2024-01-05 08:58:13 -05:00
parent 22e72da15c
commit a499dcf544
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 107 additions and 0 deletions

59
metadata/media_format.go Normal file
View File

@ -0,0 +1,59 @@
package metadata
import "git.lumeweb.com/LumeWeb/libs5-go/encoding"
type MediaFormat struct {
Subtype string
Role string
Ext string
Cid *encoding.CID
Height int
Width int
Languages []string
Asr int
Fps int
Bitrate int
AudioChannels int
Vcodec string
Acodec string
Container string
DynamicRange string
Charset string
Value []byte
Duration int
Rows int
Columns int
Index int
InitRange string
IndexRange string
Caption string
}
func NewMediaFormat(subtype string, role, ext, vcodec, acodec, container, dynamicRange, charset, initRange, indexRange, caption string, cid *encoding.CID, height, width, asr, fps, bitrate, audioChannels, duration, rows, columns, index int, languages []string, value []byte) *MediaFormat {
return &MediaFormat{
Subtype: subtype,
Role: role,
Ext: ext,
Cid: cid,
Height: height,
Width: width,
Languages: languages,
Asr: asr,
Fps: fps,
Bitrate: bitrate,
AudioChannels: audioChannels,
Vcodec: vcodec,
Acodec: acodec,
Container: container,
DynamicRange: dynamicRange,
Charset: charset,
Value: value,
Duration: duration,
Rows: rows,
Columns: columns,
Index: index,
InitRange: initRange,
IndexRange: indexRange,
Caption: caption,
}
}

View File

@ -0,0 +1,17 @@
package metadata
import "git.lumeweb.com/LumeWeb/libs5-go/encoding"
type MediaMetadataLinks struct {
Count int
Head []*encoding.CID
Collapsed []*encoding.CID
Tail []*encoding.CID
}
func NewMediaMetadataLinks(head []*encoding.CID) *MediaMetadataLinks {
return &MediaMetadataLinks{
Count: len(head),
Head: head,
}
}

View File

@ -0,0 +1,22 @@
package metadata
type MediaMetadata struct {
Metadata
Name string
MediaTypes map[string][]MediaFormat
Parents []MetadataParentLink
Details MediaMetadataDetails
Links *MediaMetadataLinks
ExtraMetadata ExtraMetadata
}
func NewMediaMetadata(name string, details MediaMetadataDetails, parents []MetadataParentLink, mediaTypes map[string][]MediaFormat, links *MediaMetadataLinks, extraMetadata ExtraMetadata) *MediaMetadata {
return &MediaMetadata{
Name: name,
Details: details,
Parents: parents,
MediaTypes: mediaTypes,
Links: links,
ExtraMetadata: extraMetadata,
}
}

View File

@ -0,0 +1,9 @@
package metadata
type MediaMetadataDetails struct {
Data map[int]interface{}
}
func NewMediaMetadataDetails(data map[int]interface{}) *MediaMetadataDetails {
return &MediaMetadataDetails{Data: data}
}