// 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 // MovieBox movie box struct // // 8.2.1 Movie Box // Box Type: ‘moov’ // Container: File // Mandatory: Yes // Quantity: Exactly one // // The metadata for a presentation is stored in the single Movie Box which occurs at the top‐level of a file. // Normally this box is close to the beginning or end of the file, though this is not required. type MovieBox struct { *Box ChildBoxes []interface{} } // ParseMovieBox creates a new movie box struct based on bytes func ParseMovieBox(filePosition uint64, headerSize uint32, content []byte) (*MovieBox, error) { box := &MovieBox{Box: &Box{filePosition, headerSize}} // parse content boxes var err error box.ChildBoxes, err = box.parseChildBoxes(filePosition, content) return box, err }