mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-25 20:41:59 -08:00
support OBS <= 25
This commit is contained in:
parent
355c400cc8
commit
7cb1a2d6b9
1 changed files with 51 additions and 16 deletions
|
|
@ -57,27 +57,62 @@ func Metadata(conn ConnPair, readTimeout time.Duration) (
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
hasVideo := false
|
||||
if v, ok := md.GetFloat64("videocodecid"); ok {
|
||||
switch v {
|
||||
case codecH264:
|
||||
hasVideo = true
|
||||
case 0:
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unsupported video codec %v", v)
|
||||
hasVideo, err := func() (bool, error) {
|
||||
v, ok := md.GetV("videocodecid")
|
||||
if !ok {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
switch vt := v.(type) {
|
||||
case float64:
|
||||
switch vt {
|
||||
case 0:
|
||||
return false, nil
|
||||
|
||||
case codecH264:
|
||||
return true, nil
|
||||
}
|
||||
|
||||
case string:
|
||||
switch vt {
|
||||
case "avc1":
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("unsupported video codec %v", v)
|
||||
}()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
hasAudio := false
|
||||
if v, ok := md.GetFloat64("audiocodecid"); ok {
|
||||
switch v {
|
||||
case codecAAC:
|
||||
hasAudio = true
|
||||
case 0:
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unsupported audio codec %v", v)
|
||||
hasAudio, err := func() (bool, error) {
|
||||
v, ok := md.GetV("audiocodecid")
|
||||
if !ok {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
switch vt := v.(type) {
|
||||
case float64:
|
||||
switch vt {
|
||||
case 0:
|
||||
return false, nil
|
||||
|
||||
case codecAAC:
|
||||
return true, nil
|
||||
}
|
||||
|
||||
case string:
|
||||
switch vt {
|
||||
case "mp4a":
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("unsupported audio codec %v", v)
|
||||
}()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if !hasVideo && !hasAudio {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue