Code improvements here and there

This commit is contained in:
Stypox 2022-05-21 12:02:57 +02:00 committed by AudricV
parent e5ffa2aa09
commit 8dad6d7e1c
No known key found for this signature in database
GPG key ID: DA92EC7905614198
3 changed files with 31 additions and 31 deletions

View file

@ -786,11 +786,9 @@ public class DownloadDialog extends DialogFragment
if (format == MediaFormat.TTML) { if (format == MediaFormat.TTML) {
filenameTmp += MediaFormat.SRT.suffix; filenameTmp += MediaFormat.SRT.suffix;
} else { } else if (format != null) {
if (format != null) {
filenameTmp += format.suffix; filenameTmp += format.suffix;
} }
}
break; break;
default: default:
throw new RuntimeException("No stream selected"); throw new RuntimeException("No stream selected");

View file

@ -35,7 +35,10 @@ public class SecondaryStreamHelper<T extends Stream> {
public static AudioStream getAudioStreamFor(@NonNull final List<AudioStream> audioStreams, public static AudioStream getAudioStreamFor(@NonNull final List<AudioStream> audioStreams,
@NonNull final VideoStream videoStream) { @NonNull final VideoStream videoStream) {
final MediaFormat mediaFormat = videoStream.getFormat(); final MediaFormat mediaFormat = videoStream.getFormat();
if (mediaFormat != null) { if (mediaFormat == null) {
return null;
}
switch (mediaFormat) { switch (mediaFormat) {
case WEBM: case WEBM:
case MPEG_4:// ¿is mpeg-4 DASH? case MPEG_4:// ¿is mpeg-4 DASH?
@ -63,7 +66,6 @@ public class SecondaryStreamHelper<T extends Stream> {
return audio; return audio;
} }
} }
}
return null; return null;
} }

View file

@ -155,10 +155,10 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
qualityString += " (" + context.getString(R.string.caption_auto_generated) + ")"; qualityString += " (" + context.getString(R.string.caption_auto_generated) + ")";
} }
} else { } else {
if (mediaFormat != null) { if (mediaFormat == null) {
qualityString = mediaFormat.getSuffix();
} else {
qualityString = context.getString(R.string.unknown_quality); qualityString = context.getString(R.string.unknown_quality);
} else {
qualityString = mediaFormat.getSuffix();
} }
} }