new data information box

This commit is contained in:
Martin Riedl 2024-11-14 18:42:41 +01:00
parent 24f5686c98
commit 65eb9ae5c1
Signed by: martinr92
GPG key ID: FB68DA65516A804C
4 changed files with 45 additions and 1 deletions

2
Box.go
View file

@ -40,6 +40,8 @@ const (
BoxTypeHandlerReference = "hdlr" BoxTypeHandlerReference = "hdlr"
// BoxTypeMediaInformation Media Information Box // BoxTypeMediaInformation Media Information Box
BoxTypeMediaInformation = "minf" BoxTypeMediaInformation = "minf"
// BoxTypeDataInformation Data Information Box
BoxTypeDataInformation = "dinf"
// BoxTypeMovieFragment Movie Fragment Box // BoxTypeMovieFragment Movie Fragment Box
BoxTypeMovieFragment = "moof" BoxTypeMovieFragment = "moof"
// BoxTypeMovieFragmentHeader Movie Fragment Header Box // BoxTypeMovieFragmentHeader Movie Fragment Header Box

40
DataInformationBox.go Normal file
View file

@ -0,0 +1,40 @@
// 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 []interface{}
}
// ParseDataInformationBox creates a new data information box struct based on bytes
func ParseDataInformationBox(filePosition uint64, headerSize uint32, content []byte) (*DataInformationBox, error) {
box := &DataInformationBox{Box: &Box{filePosition, headerSize}}
// parse child boxes
var err error
box.ChildBoxes, err = box.parseChildBoxes(filePosition, content)
return box, err
}

View file

@ -124,6 +124,8 @@ func parseNextBox(reader io.Reader, filePosition uint64) (box interface{}, endPo
box = ParseHandlerReferenceBox(filePosition, boxHeaderSize, boxContentBytes) box = ParseHandlerReferenceBox(filePosition, boxHeaderSize, boxContentBytes)
case BoxTypeMediaInformation: case BoxTypeMediaInformation:
box, err = ParseMediaInformationBox(filePosition, boxHeaderSize, boxContentBytes) box, err = ParseMediaInformationBox(filePosition, boxHeaderSize, boxContentBytes)
case BoxTypeDataInformation:
box, err = ParseDataInformationBox(filePosition, boxHeaderSize, boxContentBytes)
case BoxTypeMovieFragment: case BoxTypeMovieFragment:
box, err = ParseMovieFragmentBox(filePosition, boxHeaderSize, boxContentBytes) box, err = ParseMovieFragmentBox(filePosition, boxHeaderSize, boxContentBytes)
case BoxTypeMovieFragmentHeader: case BoxTypeMovieFragmentHeader:

View file

@ -44,7 +44,7 @@ Implementation progress
| 8.6.4 Independent and Disposable Samples Box | sdtp | - | | 8.6.4 Independent and Disposable Samples Box | sdtp | - |
| 8.6.5 Edit Box | edts | - | | 8.6.5 Edit Box | edts | - |
| 8.6.6 Edit List Box | elst | - | | 8.6.6 Edit List Box | elst | - |
| 8.7.1 Data Information Box | dinf | - | | 8.7.1 Data Information Box | dinf | 100% |
| 8.7.2 Data Reference Box | dref, url, urn | - | | 8.7.2 Data Reference Box | dref, url, urn | - |
| 8.7.3 Sample Size Boxes | stsz, stz2 | - | | 8.7.3 Sample Size Boxes | stsz, stz2 | - |
| 8.7.4 Sample To Chunk Box | stsc | - | | 8.7.4 Sample To Chunk Box | stsc | - |