Fix non-default video stream from ffprobe result (#2752)

* Fix non-default video stream from ffprobe result
This commit is contained in:
peolic
2022-07-22 10:21:39 +03:00
committed by GitHub
parent 6f7cc11b86
commit b8262f5641
2 changed files with 14 additions and 3 deletions

View File

@@ -197,11 +197,21 @@ func (v *VideoFile) getVideoStream() *FFProbeStream {
} }
func (v *VideoFile) getStreamIndex(fileType string, probeJSON FFProbeJSON) int { func (v *VideoFile) getStreamIndex(fileType string, probeJSON FFProbeJSON) int {
ret := -1
for i, stream := range probeJSON.Streams { for i, stream := range probeJSON.Streams {
if stream.CodecType == fileType { // skip cover art/thumbnails
if stream.CodecType == fileType && stream.Disposition.AttachedPic == 0 {
// prefer default stream
if stream.Disposition.Default == 1 {
return i return i
} }
// backwards compatible behaviour - fallback to first matching stream
if ret == -1 {
ret = i
}
}
} }
return -1 return ret
} }

View File

@@ -1,2 +1,3 @@
### 🐛 Bug fixes ### 🐛 Bug fixes
* Fix incorrect scene metadata being set when video has cover art. ([#2752](https://github.com/stashapp/stash/pull/2752))
* Fix incorrect image being displayed when first previewing image. ([#2754](https://github.com/stashapp/stash/pull/2754)) * Fix incorrect image being displayed when first previewing image. ([#2754](https://github.com/stashapp/stash/pull/2754))