Skip to content

Commit

Permalink
Fix media details tag for multiple versions support
Browse files Browse the repository at this point in the history
(cherry picked from commit 9ec9de0)
  • Loading branch information
MichaelRUSF authored and nielsvanvelzen committed Feb 11, 2024
1 parent 065e738 commit 91ccf32
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions app/src/main/java/org/jellyfin/androidtv/util/InfoLayoutHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void addInfoRow(Context context, BaseItemDto item, int mediaSource
if (includeRuntime) addRuntime(context, item, layout, includeEndTime);
addSeriesStatus(context, item, layout);
addRatingAndRes(context, item, mediaSourceIndex, layout);
addMediaDetails(context, audioStream, layout);
addMediaDetails(context, item, mediaSourceIndex, layout);
}

private static void addText(Context context, String text, LinearLayout layout, int maxWidth) {
Expand Down Expand Up @@ -392,34 +392,36 @@ private static void addVideoCodecDetails(Context context, LinearLayout layout, M
}
}

private static void addMediaDetails(Context context, MediaStream stream, LinearLayout layout) {
private static void addMediaDetails(Context context, BaseItemDto item, int mediaSourceIndex, LinearLayout layout) {

if (stream != null) {
if (stream.getProfile() != null && stream.getProfile().contains("Dolby Atmos")) {
MediaStream audioStream = StreamHelper.getFirstAudioStream(item, mediaSourceIndex);

if (audioStream != null) {
if (audioStream.getProfile() != null && audioStream.getProfile().contains("Dolby Atmos")) {
addBlockText(context, layout, "ATMOS");
addSpacer(context, layout, " ");
} else if (stream.getProfile() != null && stream.getProfile().contains("DTS:X")) {
} else if (audioStream.getProfile() != null && audioStream.getProfile().contains("DTS:X")) {
addBlockText(context, layout, "DTS:X");
addSpacer(context, layout, " ");
} else {
String codec = null;
if (stream.getProfile() != null && stream.getProfile().contains("DTS-HD")) {
if (audioStream.getProfile() != null && audioStream.getProfile().contains("DTS-HD")) {
codec = "DTS-HD";
} else if (stream.getCodec() != null && stream.getCodec().trim().length() > 0) {
switch (stream.getCodec().toLowerCase()) {
} else if (audioStream.getCodec() != null &audioStream.getCodec().trim().length() > 0) {
switch (audioStream.getCodec().toLowerCase()) {
case "dca": codec = "DTS"; break;
case "eac3": codec = "DD+"; break;
case "ac3": codec = "DD"; break;
default: codec = stream.getCodec().toUpperCase();
default: codec = audioStream.getCodec().toUpperCase();
}
}
if (codec != null) {
addBlockText(context, layout, codec);
addSpacer(context, layout, " ");
}
}
if (stream.getChannelLayout() != null && stream.getChannelLayout().trim().length() > 0) {
addBlockText(context, layout, stream.getChannelLayout().toUpperCase());
if (audioStream.getChannelLayout() != null && audioStream.getChannelLayout().trim().length() > 0) {
addBlockText(context, layout, audioStream.getChannelLayout().toUpperCase());
addSpacer(context, layout, " ");
}
}
Expand Down

0 comments on commit 91ccf32

Please sign in to comment.