Move libVLC profile to class
This commit is contained in:
@@ -36,6 +36,7 @@ import org.jellyfin.androidtv.ui.shared.BaseActivity;
|
||||
import org.jellyfin.androidtv.util.AutoBitrate;
|
||||
import org.jellyfin.androidtv.util.DeviceUtils;
|
||||
import org.jellyfin.androidtv.util.profile.BaseProfile;
|
||||
import org.jellyfin.androidtv.util.profile.LibVlcProfile;
|
||||
import org.jellyfin.androidtv.util.profile.ProfileHelper;
|
||||
import org.jellyfin.androidtv.util.RemoteControlReceiver;
|
||||
import org.jellyfin.androidtv.util.Utils;
|
||||
@@ -570,7 +571,7 @@ public class MediaManager {
|
||||
if (DeviceUtils.is60()) {
|
||||
ProfileHelper.setExoOptions(profile, false, true);
|
||||
} else {
|
||||
ProfileHelper.setVlcOptions(profile, false);
|
||||
profile = new LibVlcProfile();
|
||||
}
|
||||
options.setProfile(profile);
|
||||
get(PlaybackManager.class).getAudioStreamInfo(apiClient.getServerInfo().getId(), options, item.getResumePositionTicks(), false, apiClient, new Response<StreamInfo>() {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jellyfin.androidtv.ui.ImageButton;
|
||||
import org.jellyfin.androidtv.ui.livetv.TvManager;
|
||||
import org.jellyfin.androidtv.util.DeviceUtils;
|
||||
import org.jellyfin.androidtv.util.profile.BaseProfile;
|
||||
import org.jellyfin.androidtv.util.profile.LibVlcProfile;
|
||||
import org.jellyfin.androidtv.util.profile.ProfileHelper;
|
||||
import org.jellyfin.androidtv.util.TimeUtils;
|
||||
import org.jellyfin.androidtv.util.Utils;
|
||||
@@ -377,8 +378,7 @@ public class PlaybackController {
|
||||
}
|
||||
vlcOptions.setSubtitleStreamIndex(transcodedSubtitle >= 0 ? transcodedSubtitle : null);
|
||||
vlcOptions.setMediaSourceId(transcodedSubtitle >= 0 ? getCurrentMediaSource().getId() : null);
|
||||
DeviceProfile vlcProfile = new BaseProfile();
|
||||
ProfileHelper.setVlcOptions(vlcProfile, isLiveTv);
|
||||
DeviceProfile vlcProfile = new LibVlcProfile(isLiveTv);
|
||||
vlcOptions.setProfile(vlcProfile);
|
||||
|
||||
VideoOptions internalOptions = new VideoOptions();
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.dlna.EncodingContext
|
||||
import org.jellyfin.apiclient.model.dlna.SubtitleDeliveryMethod
|
||||
import org.jellyfin.apiclient.model.dlna.TranscodingProfile
|
||||
|
||||
class BaseProfile : DeviceProfile() {
|
||||
open class BaseProfile : DeviceProfile() {
|
||||
init {
|
||||
name = "AndroidTV"
|
||||
maxStreamingBitrate = 20000000
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package org.jellyfin.androidtv.util.profile
|
||||
|
||||
import org.jellyfin.androidtv.constant.CodecTypes
|
||||
import org.jellyfin.androidtv.constant.ContainerTypes
|
||||
import org.jellyfin.androidtv.util.DeviceUtils
|
||||
import org.jellyfin.androidtv.util.Utils
|
||||
import org.jellyfin.androidtv.util.profile.ProfileHelper.getHevcProfile
|
||||
import org.jellyfin.androidtv.util.profile.ProfileHelper.getSubtitleProfile
|
||||
import org.jellyfin.apiclient.model.dlna.CodecProfile
|
||||
import org.jellyfin.apiclient.model.dlna.CodecType
|
||||
import org.jellyfin.apiclient.model.dlna.DirectPlayProfile
|
||||
import org.jellyfin.apiclient.model.dlna.DlnaProfileType
|
||||
import org.jellyfin.apiclient.model.dlna.ProfileCondition
|
||||
import org.jellyfin.apiclient.model.dlna.ProfileConditionType
|
||||
import org.jellyfin.apiclient.model.dlna.ProfileConditionValue
|
||||
import org.jellyfin.apiclient.model.dlna.SubtitleDeliveryMethod
|
||||
|
||||
class LibVlcProfile(
|
||||
private var isLiveTV: Boolean = false
|
||||
) : BaseProfile() {
|
||||
init {
|
||||
name = "AndroidTV-libVLC"
|
||||
|
||||
directPlayProfiles = arrayOf(
|
||||
// Video direct play
|
||||
DirectPlayProfile().apply {
|
||||
type = DlnaProfileType.Video
|
||||
|
||||
container = arrayOf(
|
||||
ContainerTypes.M4V,
|
||||
ContainerTypes._3GP,
|
||||
ContainerTypes.TS,
|
||||
ContainerTypes.MPEGTS,
|
||||
ContainerTypes.MOV,
|
||||
ContainerTypes.XVID,
|
||||
ContainerTypes.VOB,
|
||||
ContainerTypes.MKV,
|
||||
ContainerTypes.WMV,
|
||||
ContainerTypes.ASF,
|
||||
ContainerTypes.OGM,
|
||||
ContainerTypes.OGV,
|
||||
ContainerTypes.M2V,
|
||||
ContainerTypes.MPG,
|
||||
ContainerTypes.MPEG,
|
||||
ContainerTypes.MP4,
|
||||
ContainerTypes.WEBM,
|
||||
ContainerTypes.WTV
|
||||
).joinToString()
|
||||
|
||||
audioCodec = listOfNotNull(
|
||||
CodecTypes.AAC,
|
||||
CodecTypes.MP3,
|
||||
CodecTypes.MP2,
|
||||
CodecTypes.AC3,
|
||||
CodecTypes.WMA,
|
||||
CodecTypes.WMAV2,
|
||||
CodecTypes.DCA,
|
||||
CodecTypes.DTS,
|
||||
CodecTypes.PCM,
|
||||
CodecTypes.PCM_S16LE,
|
||||
CodecTypes.PCM_S24LE,
|
||||
CodecTypes.OPUS,
|
||||
CodecTypes.FLAC,
|
||||
CodecTypes.TRUEHD,
|
||||
if (!Utils.downMixAudio() && isLiveTV) CodecTypes.AAC_LATM else null
|
||||
).joinToString()
|
||||
},
|
||||
// Audio direct play
|
||||
DirectPlayProfile().apply {
|
||||
type = DlnaProfileType.Audio
|
||||
|
||||
container = arrayOf(
|
||||
CodecTypes.FLAC,
|
||||
CodecTypes.AAC,
|
||||
CodecTypes.MP3,
|
||||
CodecTypes.MPA,
|
||||
CodecTypes.WAV,
|
||||
CodecTypes.WMA,
|
||||
CodecTypes.MP2,
|
||||
ContainerTypes.OGG,
|
||||
ContainerTypes.OGA,
|
||||
ContainerTypes.WEBMA,
|
||||
CodecTypes.APE
|
||||
).joinToString()
|
||||
},
|
||||
// Photo direct play
|
||||
DirectPlayProfile().apply {
|
||||
type = DlnaProfileType.Photo
|
||||
container = "jpg,jpeg,png,gif"
|
||||
}
|
||||
)
|
||||
|
||||
codecProfiles = arrayOf(
|
||||
// HEVC profile
|
||||
getHevcProfile(),
|
||||
// H264 profile
|
||||
CodecProfile().apply {
|
||||
type = CodecType.Video
|
||||
codec = CodecTypes.H264
|
||||
conditions = arrayOf(
|
||||
ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, "high|main|baseline|constrained baseline"),
|
||||
ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoLevel, if (DeviceUtils.isFireTvStickGen1()) "41" else "51"),
|
||||
ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.RefFrames, "2")
|
||||
)
|
||||
},
|
||||
// Audio channel profile
|
||||
CodecProfile().apply {
|
||||
type = CodecType.VideoAudio
|
||||
conditions = arrayOf(
|
||||
ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "8")
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
subtitleProfiles = arrayOf(
|
||||
getSubtitleProfile("srt", SubtitleDeliveryMethod.External),
|
||||
getSubtitleProfile("srt", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("subrip", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("ass", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("ssa", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("pgs", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("pbssub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("dvdsub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("vtt", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("sub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("smi", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("idx", SubtitleDeliveryMethod.Embed)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -29,108 +29,6 @@ import static org.koin.java.KoinJavaComponent.get;
|
||||
public class ProfileHelper {
|
||||
private static MediaCodecCapabilitiesTest MediaTest = new MediaCodecCapabilitiesTest();
|
||||
|
||||
public static void setVlcOptions(DeviceProfile profile, boolean isLiveTv) {
|
||||
profile.setName("Android-VLC");
|
||||
DirectPlayProfile videoDirectPlayProfile = new DirectPlayProfile();
|
||||
|
||||
List<String> videoContainers = Arrays.asList(
|
||||
ContainerTypes.M4V,
|
||||
ContainerTypes._3GP,
|
||||
ContainerTypes.TS,
|
||||
ContainerTypes.MPEGTS,
|
||||
ContainerTypes.MOV,
|
||||
ContainerTypes.XVID,
|
||||
ContainerTypes.VOB,
|
||||
ContainerTypes.MKV,
|
||||
ContainerTypes.WMV,
|
||||
ContainerTypes.ASF,
|
||||
ContainerTypes.OGM,
|
||||
ContainerTypes.OGV,
|
||||
ContainerTypes.M2V,
|
||||
ContainerTypes.MPG,
|
||||
ContainerTypes.MPEG,
|
||||
ContainerTypes.MP4,
|
||||
ContainerTypes.WEBM,
|
||||
ContainerTypes.WTV
|
||||
);
|
||||
videoDirectPlayProfile.setContainer(Utils.join(",", videoContainers));
|
||||
List<String> audioCodecs = new ArrayList<>(Arrays.asList(
|
||||
CodecTypes.AAC,
|
||||
CodecTypes.MP3,
|
||||
CodecTypes.MP2,
|
||||
CodecTypes.AC3,
|
||||
CodecTypes.WMA,
|
||||
CodecTypes.WMAV2,
|
||||
CodecTypes.DCA,
|
||||
CodecTypes.DTS,
|
||||
CodecTypes.PCM,
|
||||
CodecTypes.PCM_S16LE,
|
||||
CodecTypes.PCM_S24LE,
|
||||
CodecTypes.OPUS,
|
||||
CodecTypes.FLAC,
|
||||
CodecTypes.TRUEHD
|
||||
));
|
||||
if (!Utils.downMixAudio() && isLiveTv) {
|
||||
audioCodecs.add(CodecTypes.AAC_LATM);
|
||||
}
|
||||
videoDirectPlayProfile.setAudioCodec(Utils.join(",", audioCodecs));
|
||||
videoDirectPlayProfile.setType(DlnaProfileType.Video);
|
||||
|
||||
DirectPlayProfile audioDirectPlayProfile = new DirectPlayProfile();
|
||||
List<String> audioContainers = Arrays.asList(
|
||||
CodecTypes.FLAC,
|
||||
CodecTypes.AAC,
|
||||
CodecTypes.MP3,
|
||||
CodecTypes.MPA,
|
||||
CodecTypes.WAV,
|
||||
CodecTypes.WMA,
|
||||
CodecTypes.MP2,
|
||||
ContainerTypes.OGG,
|
||||
ContainerTypes.OGA,
|
||||
ContainerTypes.WEBMA,
|
||||
CodecTypes.APE
|
||||
);
|
||||
audioDirectPlayProfile.setContainer(Utils.join(",", audioContainers));
|
||||
audioDirectPlayProfile.setType(DlnaProfileType.Audio);
|
||||
|
||||
DirectPlayProfile photoDirectPlayProfile = new DirectPlayProfile();
|
||||
photoDirectPlayProfile.setContainer("jpg,jpeg,png,gif");
|
||||
photoDirectPlayProfile.setType(DlnaProfileType.Photo);
|
||||
|
||||
profile.setDirectPlayProfiles(new DirectPlayProfile[]{videoDirectPlayProfile, audioDirectPlayProfile, photoDirectPlayProfile});
|
||||
|
||||
|
||||
CodecProfile h264MainProfile = new CodecProfile();
|
||||
h264MainProfile.setType(CodecType.Video);
|
||||
h264MainProfile.setCodec(CodecTypes.H264);
|
||||
h264MainProfile.setConditions(new ProfileCondition[]
|
||||
{
|
||||
new ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, "high|main|baseline|constrained baseline"),
|
||||
new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoLevel, DeviceUtils.isFireTvStickGen1() ? "41" : "51"),
|
||||
new ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.RefFrames, "2"),
|
||||
});
|
||||
|
||||
CodecProfile videoAudioCodecProfile = new CodecProfile();
|
||||
videoAudioCodecProfile.setType(CodecType.VideoAudio);
|
||||
videoAudioCodecProfile.setConditions(new ProfileCondition[]{new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "8")});
|
||||
|
||||
profile.setCodecProfiles(new CodecProfile[]{getHevcProfile(), h264MainProfile, videoAudioCodecProfile});
|
||||
profile.setSubtitleProfiles(new SubtitleProfile[]{
|
||||
getSubtitleProfile("srt", SubtitleDeliveryMethod.External),
|
||||
getSubtitleProfile("srt", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("subrip", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("ass", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("ssa", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("pgs", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("pgssub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("dvdsub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("vtt", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("sub", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("smi", SubtitleDeliveryMethod.Embed),
|
||||
getSubtitleProfile("idx", SubtitleDeliveryMethod.Embed)
|
||||
});
|
||||
}
|
||||
|
||||
public static void setExoOptions(DeviceProfile profile, boolean isLiveTv, boolean allowDTS) {
|
||||
profile.setName("Android-Exo");
|
||||
|
||||
@@ -265,7 +163,7 @@ public class ProfileHelper {
|
||||
});
|
||||
}
|
||||
|
||||
private static CodecProfile getHevcProfile() {
|
||||
protected static CodecProfile getHevcProfile() {
|
||||
CodecProfile hevcProfile = new CodecProfile();
|
||||
hevcProfile.setType(CodecType.Video);
|
||||
hevcProfile.setCodec(CodecTypes.HEVC);
|
||||
|
||||
Reference in New Issue
Block a user