// 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 []any } // BoxTypeMovie Movie Box const BoxTypeMovie = "moov" func init() { BoxDefinitions = append(BoxDefinitions, BoxDefinition{ Type: BoxTypeMovie, ParentTypes: []string{boxTypeParentFile}, Parser: ParseMovieBox, }) } // ParseMovieBox creates a new movie box struct based on bytes func ParseMovieBox(parser *Parser, filePosition uint64, headerSize uint32, content []byte) (any, error) { box := &MovieBox{Box: &Box{filePosition, headerSize}} // parse content boxes var err error box.ChildBoxes, err = box.parseChildBoxes(parser, BoxTypeMovie, filePosition, content) return box, err }