Small videoplayer sample fix.
This commit is contained in:
@@ -207,8 +207,6 @@ private class AudioDecoder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with (audioCodecContext) {
|
with (audioCodecContext) {
|
||||||
var inputChannelLayout = if (channel_layout != 0L)
|
|
||||||
channel_layout else av_get_default_channel_layout(audioCodecContext.channels)
|
|
||||||
setResampleOpt("in_channel_layout", channel_layout.narrow())
|
setResampleOpt("in_channel_layout", channel_layout.narrow())
|
||||||
setResampleOpt("out_channel_layout", output.channelLayout)
|
setResampleOpt("out_channel_layout", output.channelLayout)
|
||||||
setResampleOpt("in_sample_rate", sample_rate)
|
setResampleOpt("in_sample_rate", sample_rate)
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
data class Dimensions(val w: Int, val h: Int) {
|
data class Dimensions(val w: Int, val h: Int) {
|
||||||
operator fun minus(other: Dimensions) = Dimensions(w - other.w, h - other.h)
|
operator fun minus(other: Dimensions) = Dimensions(w - other.w, h - other.h)
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
import kotlinx.cinterop.*
|
import kotlinx.cinterop.*
|
||||||
|
|
||||||
@@ -38,11 +53,10 @@ abstract class DisposableContainer : Disposable {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: It shall be inline, but crashes backend
|
inline fun <T> disposable(
|
||||||
fun <T> disposable(
|
|
||||||
message: String = "disposable",
|
message: String = "disposable",
|
||||||
create: () -> T?,
|
create: () -> T?,
|
||||||
dispose: (T) -> Unit
|
crossinline dispose: (T) -> Unit
|
||||||
): T =
|
): T =
|
||||||
tryConstruct {
|
tryConstruct {
|
||||||
create()?.also {
|
create()?.also {
|
||||||
@@ -50,13 +64,15 @@ abstract class DisposableContainer : Disposable {
|
|||||||
} ?: throw Error(message)
|
} ?: throw Error(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: It shall be inline, but crashes backend
|
inline fun <T : Disposable> disposable(create: () -> T): T =
|
||||||
fun <T : Disposable> disposable(create: () -> T): T =
|
|
||||||
disposable(
|
disposable(
|
||||||
create = create,
|
create = create,
|
||||||
dispose = { it.dispose() })
|
dispose = { it.dispose() })
|
||||||
|
|
||||||
fun <T : CPointed> sdlDisposable(message: String, ptr: CPointer<T>?, dispose: (CPointer<T>) -> Unit): CPointer<T> =
|
inline fun <T : CPointed> sdlDisposable(
|
||||||
|
message: String,
|
||||||
|
ptr: CPointer<T>?,
|
||||||
|
crossinline dispose: (CPointer<T>) -> Unit): CPointer<T> =
|
||||||
disposable(
|
disposable(
|
||||||
create = { ptr ?: throwSDLError(message) },
|
create = { ptr ?: throwSDLError(message) },
|
||||||
dispose = dispose)
|
dispose = dispose)
|
||||||
|
|||||||
Reference in New Issue
Block a user