mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix non-default video stream from ffprobe result (#2752)
* Fix non-default video stream from ffprobe result
This commit is contained in:
@@ -197,11 +197,21 @@ func (v *VideoFile) getVideoStream() *FFProbeStream {
|
||||
}
|
||||
|
||||
func (v *VideoFile) getStreamIndex(fileType string, probeJSON FFProbeJSON) int {
|
||||
ret := -1
|
||||
for i, stream := range probeJSON.Streams {
|
||||
if stream.CodecType == fileType {
|
||||
return i
|
||||
// skip cover art/thumbnails
|
||||
if stream.CodecType == fileType && stream.Disposition.AttachedPic == 0 {
|
||||
// prefer default stream
|
||||
if stream.Disposition.Default == 1 {
|
||||
return i
|
||||
}
|
||||
|
||||
// backwards compatible behaviour - fallback to first matching stream
|
||||
if ret == -1 {
|
||||
ret = i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
return ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user