diff --git a/cmd/rtsp/rtsp.go b/cmd/rtsp/rtsp.go index aa910a98..21143d09 100644 --- a/cmd/rtsp/rtsp.go +++ b/cmd/rtsp/rtsp.go @@ -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) -} diff --git a/pkg/mp4/consumer.go b/pkg/mp4/consumer.go index 8d5fbf2d..777ee340 100644 --- a/pkg/mp4/consumer.go +++ b/pkg/mp4/consumer.go @@ -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