mp4/DataInformationBox.go
2024-12-03 19:24:00 +01:00

51 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright 2024 Martin Riedl
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package gomp4
// DataInformationBox data information box struct
//
// 8.7.1 Data Information Box
//
// Box Type: dinf
// Container: Media Information Box (minf) or Meta Box (meta)
// Mandatory: Yes (required within minf box) and No (optional within meta box)
// Quantity: Exactly one
//
// The data information box contains objects that declare the location of the media information in a track.
type DataInformationBox struct {
*Box
ChildBoxes []any
}
// BoxTypeDataInformation Data Information Box
const BoxTypeDataInformation = "dinf"
func init() {
BoxDefinitions = append(BoxDefinitions, BoxDefinition{
Type: BoxTypeDataInformation,
ParentTypes: []string{BoxTypeMediaInformation}, // TODO: add Meta Box `meta`
Parser: ParseDataInformationBox,
})
}
// ParseDataInformationBox creates a new data information box struct based on bytes
func ParseDataInformationBox(parser *Parser, filePosition uint64, headerSize uint32, content []byte) (any, error) {
box := &DataInformationBox{Box: &Box{filePosition, headerSize}}
// parse child boxes
var err error
box.ChildBoxes, err = box.parseChildBoxes(parser, BoxTypeDataInformation, filePosition, content)
return box, err
}