Skip to content

Commit

Permalink
fmp4: check that track parameters have been provided
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Sep 26, 2023
1 parent 7ac007e commit f4b571d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/formats/fmp4/init_track.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func (track *InitTrack) marshal(w *mp4Writer) error {
height = av1SequenceHeader.Height()

case *CodecVP9:
if codec.Width == 0 {
return fmt.Errorf("VP9 parameters not provided")
}

width = codec.Width
height = codec.Height

Expand All @@ -120,16 +124,28 @@ func (track *InitTrack) marshal(w *mp4Writer) error {
height = h264SPS.Height()

case *CodecMPEG4Video:
if len(codec.Config) == 0 {
return fmt.Errof("MPEG-4 Video config not provided")

Check failure on line 128 in pkg/formats/fmp4/init_track.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: fmt.Errof

Check failure on line 128 in pkg/formats/fmp4/init_track.go

View workflow job for this annotation

GitHub Actions / test (1.20)

undefined: fmt.Errof
}

// TODO: parse config and use real values
width = 800
height = 600

case *CodecMPEG1Video:
if len(codec.Config) == 0 {
return fmt.Errof("MPEG-1/2 Video config not provided")

Check failure on line 137 in pkg/formats/fmp4/init_track.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: fmt.Errof (typecheck)

Check failure on line 137 in pkg/formats/fmp4/init_track.go

View workflow job for this annotation

GitHub Actions / test (1.20)

undefined: fmt.Errof
}

// TODO: parse config and use real values
width = 800
height = 600

case *CodecMJPEG:
if codec.Width == 0 {
return fmt.Errorf("M-JPEG parameters not provided")
}

width = codec.Width
height = codec.Height
}
Expand Down

0 comments on commit f4b571d

Please sign in to comment.