se.svt.oss.mediaanalyzer.file.VideoFile.kt Maven / Gradle / Ivy
// SPDX-FileCopyrightText: 2020 Sveriges Television AB
//
// SPDX-License-Identifier: Apache-2.0
package se.svt.oss.mediaanalyzer.file
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonTypeName
@JsonTypeName("VideoFile")
data class VideoFile(
override val file: String,
override val fileSize: Long,
override val format: String,
override val overallBitrate: Long,
override val duration: Double,
val videoStreams: List,
override val audioStreams: List = emptyList()
) : MediaContainer {
override val type: String
get() = "VideoFile"
val highestBitrateVideoStream: VideoStream
@JsonIgnore
get() = videoStreams.maxByOrNull { it.bitrate ?: 0 }
?: throw IllegalStateException("No video streams in $file!")
}