Move ParseQuery from rtsp to mp4 module

This commit is contained in:
Alexey Khit
2023-01-30 19:13:35 +03:00
parent 500b8720d5
commit c1d6adc189
2 changed files with 11 additions and 10 deletions
+1 -10
View File
@@ -165,7 +165,7 @@ func tcpHandler(conn *rtsp.Conn) {
conn.SessionName = app.UserAgent
conn.Medias = ParseQuery(conn.URL.Query())
conn.Medias = mp4.ParseQuery(conn.URL.Query())
if err := stream.AddConsumer(conn); err != nil {
log.Warn().Err(err).Str("stream", name).Msg("[rtsp]")
@@ -229,12 +229,3 @@ func tcpHandler(conn *rtsp.Conn) {
_ = conn.Close()
}
func ParseQuery(query map[string][]string) []*streamer.Media {
if query["mp4"] != nil {
cons := mp4.Consumer{}
return cons.GetMedias()
}
return streamer.ParseQuery(query)
}
+10
View File
@@ -24,6 +24,16 @@ type Consumer struct {
send uint32
}
// ParseQuery - like usual parse, but with mp4 param handler
func ParseQuery(query map[string][]string) []*streamer.Media {
if query["mp4"] != nil {
cons := Consumer{}
return cons.GetMedias()
}
return streamer.ParseQuery(query)
}
const (
waitNone byte = iota
waitKeyframe