new media information box

This commit is contained in:
Martin Riedl 2024-10-31 20:09:11 +01:00
parent b9a3b0de78
commit 7c1d6fcf06
Signed by: martinr92
GPG key ID: FB68DA65516A804C
4 changed files with 44 additions and 1 deletions

2
Box.go
View file

@ -38,6 +38,8 @@ const (
BoxTypeMediaHeaderBox = "mdhd"
// BoxTypeHandlerReferenceBox Handler Reference Box
BoxTypeHandlerReferenceBox = "hdlr"
// BoxTypeMediaInformationBox Media Information Box
BoxTypeMediaInformationBox = "minf"
// BoxTypeMovieFragment Movie Fragment Box
BoxTypeMovieFragment = "moof"
// BoxTypeMovieFragmentHeader Movie Fragment Header Box

39
MediaInformationBox.go Normal file
View file

@ -0,0 +1,39 @@
// 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
// MediaInformationBox media information box struct
// 8.4.4 Media Information Box
//
// Box Type: minf
// Container: Media Box (mdia)
// Mandatory: Yes
// Quantity: Exactly one
//
// This box contains all the objects that declare characteristic information of the media in the track.
type MediaInformationBox struct {
*Box
ChildBoxes []interface{}
}
// ParseMediaInformationBox creates a new media information box struct based on bytes
func ParseMediaInformationBox(filePosition uint64, headerSize uint32, content []byte) (*MediaBox, error) {
box := &MediaBox{Box: &Box{filePosition, headerSize}}
// parse child boxes
var err error
box.ChildBoxes, err = box.parseChildBoxes(filePosition, content)
return box, err
}

View file

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

View file

@ -30,7 +30,7 @@ Implementation progress
| 8.4.1 Media Box | mdia | 100% |
| 8.4.2 Media Header Box | mdhd | 80% |
| 8.4.3 Handler Reference Box | hdlr | 100% |
| 8.4.4 Media Information Box | minf | - |
| 8.4.4 Media Information Box | minf | 100% |
| 8.4.5.2 Null Media Header Box | nmhd | - |
| 8.4.6 Extended language tag | elng | - |
| 8.5.1 Sample Table Box | stbl | - |