Add media filter for RTSP source #198
This commit is contained in:
@@ -101,6 +101,7 @@ func rtspHandler(rawURL string) (core.Producer, error) {
|
|||||||
if rawQuery != "" {
|
if rawQuery != "" {
|
||||||
query := streams.ParseQuery(rawQuery)
|
query := streams.ParseQuery(rawQuery)
|
||||||
conn.Backchannel = query.Get("backchannel") == "1"
|
conn.Backchannel = query.Get("backchannel") == "1"
|
||||||
|
conn.Media = query.Get("media")
|
||||||
conn.Transport = query.Get("transport")
|
conn.Transport = query.Get("transport")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,16 @@ func (c *Conn) Describe() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.Media != "" {
|
||||||
|
clone := make([]*core.Media, 0, len(medias))
|
||||||
|
for _, media := range medias {
|
||||||
|
if strings.Contains(c.Media, media.Kind) {
|
||||||
|
clone = append(clone, media)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
medias = clone
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: rewrite more smart
|
// TODO: rewrite more smart
|
||||||
if c.Medias == nil {
|
if c.Medias == nil {
|
||||||
c.Medias = medias
|
c.Medias = medias
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ type Conn struct {
|
|||||||
// public
|
// public
|
||||||
|
|
||||||
Backchannel bool
|
Backchannel bool
|
||||||
|
Media string
|
||||||
PacketSize uint16
|
PacketSize uint16
|
||||||
SessionName string
|
SessionName string
|
||||||
Transport string // custom transport support, ex. RTSP over WebSocket
|
Transport string // custom transport support, ex. RTSP over WebSocket
|
||||||
|
|||||||
Reference in New Issue
Block a user