Skip to content

Commit

Permalink
formats/fmp4, formats/mpegts: force codecs to be pointers (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Jan 23, 2024
1 parent b8889df commit a9e1582
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 52 deletions.
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_ac3.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ func (CodecAC3) IsVideo() bool {
return false
}

func (CodecAC3) isCodec() {}
func (*CodecAC3) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_av1.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func (CodecAV1) IsVideo() bool {
return true
}

func (CodecAV1) isCodec() {}
func (*CodecAV1) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_h264.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func (CodecH264) IsVideo() bool {
return true
}

func (CodecH264) isCodec() {}
func (*CodecH264) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_h265.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ func (CodecH265) IsVideo() bool {
return true
}

func (CodecH265) isCodec() {}
func (*CodecH265) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_lpcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ func (CodecLPCM) IsVideo() bool {
return false
}

func (CodecLPCM) isCodec() {}
func (*CodecLPCM) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_mjpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func (CodecMJPEG) IsVideo() bool {
return true
}

func (CodecMJPEG) isCodec() {}
func (*CodecMJPEG) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_mpeg1_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func (CodecMPEG1Audio) IsVideo() bool {
return false
}

func (CodecMPEG1Audio) isCodec() {}
func (*CodecMPEG1Audio) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_mpeg1_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func (CodecMPEG1Video) IsVideo() bool {
return true
}

func (CodecMPEG1Video) isCodec() {}
func (*CodecMPEG1Video) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_mpeg4_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ func (CodecMPEG4Audio) IsVideo() bool {
return false
}

func (CodecMPEG4Audio) isCodec() {}
func (*CodecMPEG4Audio) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_mpeg4_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func (CodecMPEG4Video) IsVideo() bool {
return true
}

func (CodecMPEG4Video) isCodec() {}
func (*CodecMPEG4Video) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_opus.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func (CodecOpus) IsVideo() bool {
return false
}

func (CodecOpus) isCodec() {}
func (*CodecOpus) isCodec() {}
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/codec_vp9.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ func (CodecVP9) IsVideo() bool {
return true
}

func (CodecVP9) isCodec() {}
func (*CodecVP9) isCodec() {}
1 change: 1 addition & 0 deletions pkg/formats/mpegts/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ import (
type Codec interface {
IsVideo() bool

isCodec()
marshal(pid uint16) (*astits.PMTElementaryStream, error)
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_ac3.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ type CodecAC3 struct {
ChannelCount int
}

// IsVideo implements Codec.
func (CodecAC3) IsVideo() bool {
return true
}

func (*CodecAC3) isCodec() {}

func (c CodecAC3) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeAC3Audio,
}, nil
}

// IsVideo implements Codec.
func (CodecAC3) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_h264.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
// CodecH264 is a H264 codec.
type CodecH264 struct{}

// IsVideo implements Codec.
func (CodecH264) IsVideo() bool {
return true
}

func (*CodecH264) isCodec() {}

func (c CodecH264) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeH264Video,
}, nil
}

// IsVideo implements Codec.
func (CodecH264) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_h265.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
// CodecH265 is a H265 codec.
type CodecH265 struct{}

// IsVideo implements Codec.
func (CodecH265) IsVideo() bool {
return true
}

func (*CodecH265) isCodec() {}

func (c CodecH265) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeH265Video,
}, nil
}

// IsVideo implements Codec.
func (CodecH265) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_mpeg1_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
// CodecMPEG1Audio is a MPEG-1 Audio codec.
type CodecMPEG1Audio struct{}

// IsVideo implements Codec.
func (CodecMPEG1Audio) IsVideo() bool {
return true
}

func (*CodecMPEG1Audio) isCodec() {}

func (c CodecMPEG1Audio) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeMPEG1Audio,
}, nil
}

// IsVideo implements Codec.
func (CodecMPEG1Audio) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_mpeg1_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import (
// CodecMPEG1Video is a MPEG-1/2 Video codec.
type CodecMPEG1Video struct{}

// IsVideo implements Codec.
func (CodecMPEG1Video) IsVideo() bool {
return true
}

func (*CodecMPEG1Video) isCodec() {}

func (c CodecMPEG1Video) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
Expand All @@ -15,8 +22,3 @@ func (c CodecMPEG1Video) marshal(pid uint16) (*astits.PMTElementaryStream, error
StreamType: astits.StreamTypeMPEG2Video,
}, nil
}

// IsVideo implements Codec.
func (CodecMPEG1Video) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_mpeg4_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ type CodecMPEG4Audio struct {
mpeg4audio.Config
}

// IsVideo implements Codec.
func (CodecMPEG4Audio) IsVideo() bool {
return false
}

func (*CodecMPEG4Audio) isCodec() {}

func (c CodecMPEG4Audio) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeAACAudio,
}, nil
}

// IsVideo implements Codec.
func (CodecMPEG4Audio) IsVideo() bool {
return false
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_mpeg4_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
// CodecMPEG4Video is a MPEG-4 Video codec.
type CodecMPEG4Video struct{}

// IsVideo implements Codec.
func (CodecMPEG4Video) IsVideo() bool {
return true
}

func (*CodecMPEG4Video) isCodec() {}

func (c CodecMPEG4Video) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
ElementaryStreamDescriptors: nil,
StreamType: astits.StreamTypeMPEG4Video,
}, nil
}

// IsVideo implements Codec.
func (CodecMPEG4Video) IsVideo() bool {
return true
}
12 changes: 7 additions & 5 deletions pkg/formats/mpegts/codec_opus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ type CodecOpus struct {
ChannelCount int
}

// IsVideo implements Codec.
func (CodecOpus) IsVideo() bool {
return false
}

func (*CodecOpus) isCodec() {}

func (c CodecOpus) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
return &astits.PMTElementaryStream{
ElementaryPID: pid,
Expand All @@ -32,8 +39,3 @@ func (c CodecOpus) marshal(pid uint16) (*astits.PMTElementaryStream, error) {
StreamType: astits.StreamTypePrivateData,
}, nil
}

// IsVideo implements Codec.
func (CodecOpus) IsVideo() bool {
return false
}

0 comments on commit a9e1582

Please sign in to comment.