2017-11-10 13:15:04 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package org.webrtc;
|
|
|
|
|
|
2021-08-14 11:41:59 +09:00
|
|
|
import androidx.annotation.Nullable;
|
2018-05-21 13:45:51 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
2018-03-22 13:32:44 +01:00
|
|
|
|
2017-11-10 13:15:04 +01:00
|
|
|
public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
|
2022-11-08 10:39:36 +00:00
|
|
|
private static final String TAG = "SoftwareVideoDecoderFactory";
|
|
|
|
|
|
|
|
|
|
private final long nativeFactory;
|
|
|
|
|
|
|
|
|
|
public SoftwareVideoDecoderFactory() {
|
|
|
|
|
this.nativeFactory = nativeCreateFactory();
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-22 13:32:44 +01:00
|
|
|
@Nullable
|
2017-11-10 13:15:04 +01:00
|
|
|
@Override
|
2022-11-08 10:39:36 +00:00
|
|
|
public VideoDecoder createDecoder(VideoCodecInfo info) {
|
|
|
|
|
return new WrappedNativeVideoDecoder() {
|
|
|
|
|
@Override
|
|
|
|
|
public long createNativeVideoDecoder() {
|
|
|
|
|
return nativeCreateDecoder(nativeFactory, info);
|
|
|
|
|
}
|
|
|
|
|
};
|
2017-11-10 13:15:04 +01:00
|
|
|
}
|
2018-05-21 13:45:51 +02:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public VideoCodecInfo[] getSupportedCodecs() {
|
2022-11-08 10:39:36 +00:00
|
|
|
return nativeGetSupportedCodecs(nativeFactory).toArray(new VideoCodecInfo[0]);
|
2018-05-21 13:45:51 +02:00
|
|
|
}
|
|
|
|
|
|
2022-11-08 10:39:36 +00:00
|
|
|
private static native long nativeCreateFactory();
|
2022-09-29 18:13:07 +02:00
|
|
|
|
2022-11-08 10:39:36 +00:00
|
|
|
private static native long nativeCreateDecoder(long factory, VideoCodecInfo videoCodecInfo);
|
2018-05-21 13:45:51 +02:00
|
|
|
|
2022-11-08 10:39:36 +00:00
|
|
|
private static native List<VideoCodecInfo> nativeGetSupportedCodecs(long factory);
|
2017-11-10 13:15:04 +01:00
|
|
|
}
|