mirror of
https://github.com/aler9/gortsplib
synced 2025-10-07 08:01:14 +08:00
write MPEG in uppercase
This commit is contained in:
4
track.go
4
track.go
@@ -67,7 +67,7 @@ func newTrackFromMediaDescription(md *psdp.MediaDescription) (Track, error) {
|
|||||||
return newTrackJPEGFromMediaDescription(control)
|
return newTrackJPEGFromMediaDescription(control)
|
||||||
|
|
||||||
case md.MediaName.Formats[0] == "32":
|
case md.MediaName.Formats[0] == "32":
|
||||||
return newTrackMpegVideoFromMediaDescription(control)
|
return newTrackMPEGVideoFromMediaDescription(control)
|
||||||
|
|
||||||
case rtpmapPart1 == "H264/90000":
|
case rtpmapPart1 == "H264/90000":
|
||||||
return newTrackH264FromMediaDescription(control, payloadType, md)
|
return newTrackH264FromMediaDescription(control, payloadType, md)
|
||||||
@@ -91,7 +91,7 @@ func newTrackFromMediaDescription(md *psdp.MediaDescription) (Track, error) {
|
|||||||
return newTrackPCMAFromMediaDescription(control, rtpmapPart1)
|
return newTrackPCMAFromMediaDescription(control, rtpmapPart1)
|
||||||
|
|
||||||
case md.MediaName.Formats[0] == "14":
|
case md.MediaName.Formats[0] == "14":
|
||||||
return newTrackMpegAudioFromMediaDescription(control)
|
return newTrackMPEGAudioFromMediaDescription(control)
|
||||||
|
|
||||||
case strings.HasPrefix(strings.ToLower(rtpmapPart1), "mpeg4-generic/"):
|
case strings.HasPrefix(strings.ToLower(rtpmapPart1), "mpeg4-generic/"):
|
||||||
return newTrackMPEG4AudioFromMediaDescription(control, payloadType, md)
|
return newTrackMPEG4AudioFromMediaDescription(control, payloadType, md)
|
||||||
|
@@ -4,15 +4,15 @@ import (
|
|||||||
psdp "github.com/pion/sdp/v3"
|
psdp "github.com/pion/sdp/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TrackMpegAudio is a MPEG-1 or MPEG-2 audio track.
|
// TrackMPEGAudio is a MPEG-1 or MPEG-2 audio track.
|
||||||
type TrackMpegAudio struct {
|
type TrackMPEGAudio struct {
|
||||||
trackBase
|
trackBase
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTrackMpegAudioFromMediaDescription(
|
func newTrackMPEGAudioFromMediaDescription(
|
||||||
control string) (*TrackMpegAudio, error,
|
control string) (*TrackMPEGAudio, error,
|
||||||
) {
|
) {
|
||||||
return &TrackMpegAudio{
|
return &TrackMPEGAudio{
|
||||||
trackBase: trackBase{
|
trackBase: trackBase{
|
||||||
control: control,
|
control: control,
|
||||||
},
|
},
|
||||||
@@ -20,18 +20,18 @@ func newTrackMpegAudioFromMediaDescription(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ClockRate returns the track clock rate.
|
// ClockRate returns the track clock rate.
|
||||||
func (t *TrackMpegAudio) ClockRate() int {
|
func (t *TrackMPEGAudio) ClockRate() int {
|
||||||
return 90000
|
return 90000
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackMpegAudio) clone() Track {
|
func (t *TrackMPEGAudio) clone() Track {
|
||||||
return &TrackMpegAudio{
|
return &TrackMPEGAudio{
|
||||||
trackBase: t.trackBase,
|
trackBase: t.trackBase,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MediaDescription returns the track media description in SDP format.
|
// MediaDescription returns the track media description in SDP format.
|
||||||
func (t *TrackMpegAudio) MediaDescription() *psdp.MediaDescription {
|
func (t *TrackMPEGAudio) MediaDescription() *psdp.MediaDescription {
|
||||||
return &psdp.MediaDescription{
|
return &psdp.MediaDescription{
|
||||||
MediaName: psdp.MediaName{
|
MediaName: psdp.MediaName{
|
||||||
Media: "audio",
|
Media: "audio",
|
||||||
|
@@ -7,21 +7,21 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTrackMpegAudioNew(t *testing.T) {
|
func TestTrackMPEGAudioNew(t *testing.T) {
|
||||||
track := &TrackMpegAudio{}
|
track := &TrackMPEGAudio{}
|
||||||
require.Equal(t, "", track.GetControl())
|
require.Equal(t, "", track.GetControl())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackMpegAudioClone(t *testing.T) {
|
func TestTrackMPEGAudioClone(t *testing.T) {
|
||||||
track := &TrackMpegAudio{}
|
track := &TrackMPEGAudio{}
|
||||||
|
|
||||||
clone := track.clone()
|
clone := track.clone()
|
||||||
require.NotSame(t, track, clone)
|
require.NotSame(t, track, clone)
|
||||||
require.Equal(t, track, clone)
|
require.Equal(t, track, clone)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackMpegAudioMediaDescription(t *testing.T) {
|
func TestTrackMPEGAudioMediaDescription(t *testing.T) {
|
||||||
track := &TrackMpegAudio{}
|
track := &TrackMPEGAudio{}
|
||||||
|
|
||||||
require.Equal(t, &psdp.MediaDescription{
|
require.Equal(t, &psdp.MediaDescription{
|
||||||
MediaName: psdp.MediaName{
|
MediaName: psdp.MediaName{
|
||||||
|
@@ -4,15 +4,15 @@ import (
|
|||||||
psdp "github.com/pion/sdp/v3"
|
psdp "github.com/pion/sdp/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TrackMpegVideo is a MPEG-1 or MPEG-2 video track.
|
// TrackMPEGVideo is a MPEG-1 or MPEG-2 video track.
|
||||||
type TrackMpegVideo struct {
|
type TrackMPEGVideo struct {
|
||||||
trackBase
|
trackBase
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTrackMpegVideoFromMediaDescription(
|
func newTrackMPEGVideoFromMediaDescription(
|
||||||
control string) (*TrackMpegVideo, error,
|
control string) (*TrackMPEGVideo, error,
|
||||||
) {
|
) {
|
||||||
return &TrackMpegVideo{
|
return &TrackMPEGVideo{
|
||||||
trackBase: trackBase{
|
trackBase: trackBase{
|
||||||
control: control,
|
control: control,
|
||||||
},
|
},
|
||||||
@@ -20,18 +20,18 @@ func newTrackMpegVideoFromMediaDescription(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ClockRate returns the track clock rate.
|
// ClockRate returns the track clock rate.
|
||||||
func (t *TrackMpegVideo) ClockRate() int {
|
func (t *TrackMPEGVideo) ClockRate() int {
|
||||||
return 90000
|
return 90000
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackMpegVideo) clone() Track {
|
func (t *TrackMPEGVideo) clone() Track {
|
||||||
return &TrackMpegVideo{
|
return &TrackMPEGVideo{
|
||||||
trackBase: t.trackBase,
|
trackBase: t.trackBase,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MediaDescription returns the track media description in SDP format.
|
// MediaDescription returns the track media description in SDP format.
|
||||||
func (t *TrackMpegVideo) MediaDescription() *psdp.MediaDescription {
|
func (t *TrackMPEGVideo) MediaDescription() *psdp.MediaDescription {
|
||||||
return &psdp.MediaDescription{
|
return &psdp.MediaDescription{
|
||||||
MediaName: psdp.MediaName{
|
MediaName: psdp.MediaName{
|
||||||
Media: "video",
|
Media: "video",
|
||||||
|
@@ -7,21 +7,21 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTrackMpegVideoNew(t *testing.T) {
|
func TestTrackMPEGVideoNew(t *testing.T) {
|
||||||
track := &TrackMpegVideo{}
|
track := &TrackMPEGVideo{}
|
||||||
require.Equal(t, "", track.GetControl())
|
require.Equal(t, "", track.GetControl())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackMpegVideoClone(t *testing.T) {
|
func TestTrackMPEGVideoClone(t *testing.T) {
|
||||||
track := &TrackMpegVideo{}
|
track := &TrackMPEGVideo{}
|
||||||
|
|
||||||
clone := track.clone()
|
clone := track.clone()
|
||||||
require.NotSame(t, track, clone)
|
require.NotSame(t, track, clone)
|
||||||
require.Equal(t, track, clone)
|
require.Equal(t, track, clone)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackMpegVideoMediaDescription(t *testing.T) {
|
func TestTrackMPEGVideoMediaDescription(t *testing.T) {
|
||||||
track := &TrackMpegVideo{}
|
track := &TrackMPEGVideo{}
|
||||||
|
|
||||||
require.Equal(t, &psdp.MediaDescription{
|
require.Equal(t, &psdp.MediaDescription{
|
||||||
MediaName: psdp.MediaName{
|
MediaName: psdp.MediaName{
|
||||||
|
@@ -47,7 +47,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
Formats: []string{"14"},
|
Formats: []string{"14"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&TrackMpegAudio{},
|
&TrackMPEGAudio{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"aac",
|
"aac",
|
||||||
@@ -226,7 +226,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
Formats: []string{"32"},
|
Formats: []string{"32"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&TrackMpegVideo{},
|
&TrackMPEGVideo{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"h264",
|
"h264",
|
||||||
|
Reference in New Issue
Block a user