mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-02-17 03:44:29 +01:00
Rename VideoStreamer to Streamer, and extract a Codec interface which will also support audio codecs. PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
51 lines
1.2 KiB
Java
51 lines
1.2 KiB
Java
package com.genymobile.scrcpy;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.media.MediaFormat;
|
|
|
|
public enum VideoCodec implements Codec {
|
|
H264(0x68_32_36_34, "h264", MediaFormat.MIMETYPE_VIDEO_AVC),
|
|
H265(0x68_32_36_35, "h265", MediaFormat.MIMETYPE_VIDEO_HEVC),
|
|
@SuppressLint("InlinedApi") // introduced in API 21
|
|
AV1(0x00_61_76_31, "av1", MediaFormat.MIMETYPE_VIDEO_AV1);
|
|
|
|
private final int id; // 4-byte ASCII representation of the name
|
|
private final String name;
|
|
private final String mimeType;
|
|
|
|
VideoCodec(int id, String name, String mimeType) {
|
|
this.id = id;
|
|
this.name = name;
|
|
this.mimeType = mimeType;
|
|
}
|
|
|
|
@Override
|
|
public Type getType() {
|
|
return Type.VIDEO;
|
|
}
|
|
|
|
@Override
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
@Override
|
|
public String getMimeType() {
|
|
return mimeType;
|
|
}
|
|
|
|
public static VideoCodec findByName(String name) {
|
|
for (VideoCodec codec : values()) {
|
|
if (codec.name.equals(name)) {
|
|
return codec;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|