Skip to content

Commit

Permalink
Merge pull request #651 from nielsvanvelzen/0.11.5-cherries
Browse files Browse the repository at this point in the history
Freshly picked cherries for 0.11.5
  • Loading branch information
thornbill authored Dec 12, 2020
2 parents ef76e56 + b59e442 commit 03d5b88
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 37 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
targetSdkVersion(29)

// Release version
versionCode = 909
versionName = "0.11.4"
versionCode = 910
versionName = "0.11.5"
}

compileOptions {
Expand Down Expand Up @@ -67,7 +67,7 @@ dependencies {

// Media players
implementation("com.amazon.android:exoplayer:2.11.3")
implementation("org.videolan.android:libvlc-all:3.2.5")
implementation("org.videolan.android:libvlc-all:3.3.2")

// Image utility
implementation("com.squareup.picasso:picasso:2.3.2")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jellyfin.androidtv.ui.shared

import android.content.Context
import android.view.View
import android.view.inputmethod.InputMethodManager

class KeyboardFocusChangeListener : View.OnFocusChangeListener {
override fun onFocusChange(v : View, hasFocus : Boolean) {
(v.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).apply {
if (!hasFocus) hideSoftInputFromWindow(v.windowToken, 0)
else showSoftInput(v, 0)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,14 @@ public void onPlayerError(ExoPlaybackException error) {
mLibVLC = new LibVLC(TvApp.getApplication(), options);

mVlcPlayer = new org.videolan.libvlc.MediaPlayer(mLibVLC);
mVlcPlayer.setAudioOutput(Utils.downMixAudio() ? "opensles_android" : "android_audiotrack");
mVlcPlayer.setAudioOutputDevice("hdmi");
if(!Utils.downMixAudio()) {
mVlcPlayer.setAudioOutput("android_audiotrack");
mVlcPlayer.setAudioDigitalOutputEnabled(true);
} else {
mVlcPlayer.setAudioOutput("opensles_android");
mVlcPlayer.setAudioOutputDevice("hdmi");
}


mVlcHandler.setOnProgressListener(new PlaybackListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import org.jellyfin.apiclient.model.dto.MediaSourceInfo;
import org.jellyfin.apiclient.model.entities.MediaStream;
import org.jellyfin.apiclient.model.entities.MediaStreamType;
import org.videolan.libvlc.IVLCVout;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.interfaces.IVLCVout;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -105,6 +105,7 @@ protected void buildTextRenderers(Context context, TextOutput output, Looper out
}
}).build();


mExoPlayerView = view.findViewById(R.id.exoPlayerView);
mExoPlayerView.setPlayer(mExoPlayer);
mExoPlayer.addListener(new Player.EventListener() {
Expand Down Expand Up @@ -437,16 +438,25 @@ public void setAudioDelay(long value) {
public long getAudioDelay() { return mVlcPlayer != null ? mVlcPlayer.getAudioDelay() / 1000 : 0;}

public void setCompatibleAudio() {
if (!nativeMode) {
mVlcPlayer.setAudioOutput("opensles_android");
mVlcPlayer.setAudioOutputDevice("hdmi");
}
if (!nativeMode) {
mVlcPlayer.setAudioOutput("opensles_android");
mVlcPlayer.setAudioOutputDevice("hdmi");
}
}

public void setAudioMode() {
if (!nativeMode) {
mVlcPlayer.setAudioOutput(Utils.downMixAudio() ? "opensles_android" : "android_audiotrack");
mVlcPlayer.setAudioOutputDevice("hdmi");
setVlcAudioOptions();
}
}

private void setVlcAudioOptions() {

if(!Utils.downMixAudio()) {
mVlcPlayer.setAudioOutput("android_audiotrack");
mVlcPlayer.setAudioDigitalOutputEnabled(true);
} else {
setCompatibleAudio();
}
}

Expand Down Expand Up @@ -502,8 +512,7 @@ private void createPlayer(int buffer, boolean isInterlaced) {
TvApp.getApplication().getLogger().Info("Network buffer set to %d", buffer);

mVlcPlayer = new org.videolan.libvlc.MediaPlayer(mLibVLC);
mVlcPlayer.setAudioOutput(Utils.downMixAudio() ? "opensles_android" : "android_audiotrack");
mVlcPlayer.setAudioOutputDevice("hdmi");
setVlcAudioOptions();


mSurfaceHolder.addCallback(mSurfaceCallback);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/jellyfin/androidtv/util/ImageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public static Double getImageAspectRatio(BaseItemDto item, boolean preferParentT
}
}

if (item.getBaseItemType() == BaseItemType.UserView && item.getHasPrimaryImage())
return ImageUtils.ASPECT_RATIO_16_9;

return item.getPrimaryImageAspectRatio() != null ? item.getPrimaryImageAspectRatio() : ASPECT_RATIO_7_9;
}

Expand Down
36 changes: 13 additions & 23 deletions app/src/main/java/org/jellyfin/androidtv/util/ProfileHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public static void setVlcOptions(DeviceProfile profile, boolean isLiveTv) {
ContainerTypes.OGM,
ContainerTypes.OGV,
ContainerTypes.M2V,
ContainerTypes.AVI,
ContainerTypes.MPG,
ContainerTypes.MPEG,
ContainerTypes.MP4,
Expand Down Expand Up @@ -236,33 +235,24 @@ public static void setVlcOptions(DeviceProfile profile, boolean isLiveTv) {
new ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.RefFrames, "2"),
});

ContainerProfile videoContainerProfile = new ContainerProfile();
videoContainerProfile.setType(DlnaProfileType.Video);
videoContainerProfile.setContainer(ContainerTypes.AVI);
videoContainerProfile.setConditions(new ProfileCondition[]
{
new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.VideoCodecTag, "xvid"),
});

CodecProfile videoAudioCodecProfile = new CodecProfile();
videoAudioCodecProfile.setType(CodecType.VideoAudio);
videoAudioCodecProfile.setConditions(new ProfileCondition[]{new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "6")});
videoAudioCodecProfile.setConditions(new ProfileCondition[]{new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.AudioChannels, "8")});

profile.setCodecProfiles(new CodecProfile[]{getHevcProfile(), h264MainProfile, videoAudioCodecProfile});
profile.setContainerProfiles(new ContainerProfile[] {videoContainerProfile});
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)
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)
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.jellyfin.androidtv.startup.SelectServerActivity;
import org.jellyfin.androidtv.startup.SelectUserActivity;
import org.jellyfin.androidtv.util.DelayedMessage;
import org.jellyfin.androidtv.ui.shared.KeyboardFocusChangeListener;
import org.jellyfin.androidtv.util.Utils;

import java.io.IOException;
Expand All @@ -39,6 +40,7 @@ public static void enterManualServerAddress(final Activity activity) {
final EditText address = new EditText(activity);
address.setHint(activity.getString(R.string.lbl_ip_hint));
address.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
address.setOnFocusChangeListener(new KeyboardFocusChangeListener());
new AlertDialog.Builder(activity)
.setTitle(activity.getString(R.string.lbl_enter_server_address))
.setMessage(activity.getString(R.string.lbl_valid_server_address))
Expand All @@ -61,6 +63,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
public static void enterManualUser(final Activity activity) {
final EditText userName = new EditText(activity);
userName.setInputType(InputType.TYPE_CLASS_TEXT);
userName.setOnFocusChangeListener(new KeyboardFocusChangeListener());
new AlertDialog.Builder(activity)
.setTitle(activity.getString(R.string.lbl_enter_user_name))
.setView(userName)
Expand All @@ -74,6 +77,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
TvApp.getApplication().getLogger().Debug("Entered user: %s", userValue);
final EditText userPw = new EditText(activity);
userPw.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
userPw.setOnFocusChangeListener(new KeyboardFocusChangeListener());
new AlertDialog.Builder(activity)
.setTitle(activity.getString(R.string.lbl_enter_user_pw))
.setView(userPw)
Expand Down

0 comments on commit 03d5b88

Please sign in to comment.