mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
track: expose MediaDescription()
This commit is contained in:

committed by
Alessandro Ros

parent
6f69b9bab9
commit
247571eec8
@@ -42,7 +42,7 @@ func invalidURLAnnounceReq(t *testing.T, control string) base.Request {
|
|||||||
{Timing: psdp.Timing{0, 0}}, //nolint:govet
|
{Timing: psdp.Timing{0, 0}}, //nolint:govet
|
||||||
},
|
},
|
||||||
MediaDescriptions: []*psdp.MediaDescription{
|
MediaDescriptions: []*psdp.MediaDescription{
|
||||||
track.mediaDescription(),
|
track.MediaDescription(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ func TestServerPublishSetupPath(t *testing.T) {
|
|||||||
{Timing: psdp.Timing{0, 0}}, //nolint:govet
|
{Timing: psdp.Timing{0, 0}}, //nolint:govet
|
||||||
},
|
},
|
||||||
MediaDescriptions: []*psdp.MediaDescription{
|
MediaDescriptions: []*psdp.MediaDescription{
|
||||||
track.mediaDescription(),
|
track.MediaDescription(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
track.go
3
track.go
@@ -18,7 +18,8 @@ type Track interface {
|
|||||||
getControl() string
|
getControl() string
|
||||||
setControl(string)
|
setControl(string)
|
||||||
url(*base.URL) (*base.URL, error)
|
url(*base.URL) (*base.URL, error)
|
||||||
mediaDescription() *psdp.MediaDescription
|
// MediaDescription returns structured SDP media information
|
||||||
|
MediaDescription() *psdp.MediaDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTrackFromMediaDescription(md *psdp.MediaDescription) (Track, error) {
|
func newTrackFromMediaDescription(md *psdp.MediaDescription) (Track, error) {
|
||||||
|
@@ -150,7 +150,8 @@ func (t *TrackAAC) url(contentBase *base.URL) (*base.URL, error) {
|
|||||||
return trackURL(t, contentBase)
|
return trackURL(t, contentBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackAAC) mediaDescription() *psdp.MediaDescription {
|
// MediaDescription returns the structured media information from the SDP
|
||||||
|
func (t *TrackAAC) MediaDescription() *psdp.MediaDescription {
|
||||||
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
||||||
|
|
||||||
return &psdp.MediaDescription{
|
return &psdp.MediaDescription{
|
||||||
|
@@ -49,5 +49,5 @@ func TestTrackAACMediaDescription(t *testing.T) {
|
|||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, track.mediaDescription())
|
}, track.MediaDescription())
|
||||||
}
|
}
|
||||||
|
@@ -151,7 +151,8 @@ func (t *TrackGeneric) url(contentBase *base.URL) (*base.URL, error) {
|
|||||||
return trackURL(t, contentBase)
|
return trackURL(t, contentBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackGeneric) mediaDescription() *psdp.MediaDescription {
|
// MediaDescription returns the structured media information from the SDP
|
||||||
|
func (t *TrackGeneric) MediaDescription() *psdp.MediaDescription {
|
||||||
return &psdp.MediaDescription{
|
return &psdp.MediaDescription{
|
||||||
MediaName: psdp.MediaName{
|
MediaName: psdp.MediaName{
|
||||||
Media: t.media,
|
Media: t.media,
|
||||||
|
@@ -143,7 +143,8 @@ func (t *TrackH264) SetPPS(v []byte) {
|
|||||||
t.pps = v
|
t.pps = v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackH264) mediaDescription() *psdp.MediaDescription {
|
// MediaDescription returns the structured SDP media information
|
||||||
|
func (t *TrackH264) MediaDescription() *psdp.MediaDescription {
|
||||||
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
||||||
|
|
||||||
fmtp := typ + " packetization-mode=1"
|
fmtp := typ + " packetization-mode=1"
|
||||||
|
@@ -218,5 +218,5 @@ func TestTrackH264MediaDescription(t *testing.T) {
|
|||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, track.mediaDescription())
|
}, track.MediaDescription())
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,8 @@ func (t *TrackOpus) url(contentBase *base.URL) (*base.URL, error) {
|
|||||||
return trackURL(t, contentBase)
|
return trackURL(t, contentBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TrackOpus) mediaDescription() *psdp.MediaDescription {
|
// MediaDescription returns the structured media information from the SDP
|
||||||
|
func (t *TrackOpus) MediaDescription() *psdp.MediaDescription {
|
||||||
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
typ := strconv.FormatInt(int64(t.payloadType), 10)
|
||||||
|
|
||||||
return &psdp.MediaDescription{
|
return &psdp.MediaDescription{
|
||||||
|
@@ -47,5 +47,5 @@ func TestTrackOpusMediaDescription(t *testing.T) {
|
|||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, track.mediaDescription())
|
}, track.MediaDescription())
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ func (ts Tracks) Write(multicast bool) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, track := range ts {
|
for _, track := range ts {
|
||||||
sout.MediaDescriptions = append(sout.MediaDescriptions, track.mediaDescription())
|
sout.MediaDescriptions = append(sout.MediaDescriptions, track.MediaDescription())
|
||||||
}
|
}
|
||||||
|
|
||||||
byts, _ := sout.Marshal()
|
byts, _ := sout.Marshal()
|
||||||
|
Reference in New Issue
Block a user