All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.jellyfin.sdk.model.deviceprofile.DirectPlayProfileBuilder.kt Maven / Gradle / Ivy

There is a newer version: 1.5.5
Show newest version
package org.jellyfin.sdk.model.deviceprofile

import org.jellyfin.sdk.model.api.DirectPlayProfile
import org.jellyfin.sdk.model.api.DlnaProfileType

@DeviceProfileBuilderDsl
public class DirectPlayProfileBuilder {
	private val containers = mutableListOf()
	private val videoCodecs = mutableListOf()
	private val audioCodecs = mutableListOf()

	/**
	 * @see [DirectPlayProfile.type]
	 */
	public var type: DlnaProfileType = DlnaProfileType.VIDEO

	public fun container(vararg container: String) {
		containers.addAll(container)
	}

	public fun videoCodec(vararg codec: String) {
		videoCodecs.addAll(codec)
	}

	public fun audioCodec(vararg codec: String) {
		audioCodecs.addAll(codec)
	}

	public fun build(): DirectPlayProfile = DirectPlayProfile(
		type = type,
		container = containers.joinToString(","),
		videoCodec = videoCodecs.joinToString(","),
		audioCodec = audioCodecs.joinToString(","),
	)
}

@DeviceProfileBuilderDsl
public fun buildDirectPlayProfile(
	body: DirectPlayProfileBuilder.() -> Unit,
): DirectPlayProfile = DirectPlayProfileBuilder()
	.apply(body)
	.build()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy