Skip to content

Commit

Permalink
release: fixed get STreams
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxx committed Jun 4, 2024
1 parent 4afc69f commit 66f003a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ffprobe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,23 @@ func (p *Probe) GetStreams(streamType string) []Stream {
result = append(result, v)
}
}
return nil
return result
}

func (p *Probe) GetFirstVideoStream() *Stream {
return &p.GetStreams("video")[0]
streams := p.GetVideoStreams()
if len(streams) == 0 {
return nil
}
return &streams[0]
}

func (p *Probe) GetFirstAudioStream() *Stream {
return &p.GetStreams("audio")[0]
streams := p.GetAudioStreams()
if len(streams) == 0 {
return nil
}
return &streams[0]
}

func (p *Probe) GetVideoStreams() []Stream {
Expand Down

0 comments on commit 66f003a

Please sign in to comment.