Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpegts: prevent wrong results in codec comparisons #167

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_h264.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecH264 is a H264 codec.
type CodecH264 struct{}
type CodecH264 struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecH264) IsVideo() bool {
Expand Down
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_h265.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecH265 is a H265 codec.
type CodecH265 struct{}
type CodecH265 struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecH265) IsVideo() bool {
Expand Down
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_mpeg1_audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecMPEG1Audio is a MPEG-1 Audio codec.
type CodecMPEG1Audio struct{}
type CodecMPEG1Audio struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecMPEG1Audio) IsVideo() bool {
Expand Down
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_mpeg1_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecMPEG1Video is a MPEG-1/2 Video codec.
type CodecMPEG1Video struct{}
type CodecMPEG1Video struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecMPEG1Video) IsVideo() bool {
Expand Down
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_mpeg4_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecMPEG4Video is a MPEG-4 Video codec.
type CodecMPEG4Video struct{}
type CodecMPEG4Video struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecMPEG4Video) IsVideo() bool {
Expand Down
7 changes: 6 additions & 1 deletion pkg/formats/mpegts/codec_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
)

// CodecUnsupported is an unsupported codec.
type CodecUnsupported struct{}
type CodecUnsupported struct {
// in Go, empty structs share the same pointer,
// therefore they cannot be used as map keys
// or in equality operations. Prevent this.
unused int //nolint:unused
}

// IsVideo implements Codec.
func (CodecUnsupported) IsVideo() bool {
Expand Down