Skip to content

Commit

Permalink
Use final wherever possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Aug 13, 2021
1 parent f9e05b9 commit 695b72d
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public static ItagItem getItag(int itagId) throws ParsingException {
throw new ParsingException("itag=" + itagId + " not supported");
}

public static ItagItem getItag(int itagId, int averageBitrate, int fps, String qualityLabel, String mimeType) throws ParsingException {
public static final ItagItem getItag(final int itagId, final int averageBitrate, final int fps, final String qualityLabel, final String mimeType) throws ParsingException {

String[] split = mimeType.split(";")[0].split("/");
String streamType = split[0];
String fileType = split[1];
String codec = mimeType.split("\"")[1];
final String[] split = mimeType.split(";")[0].split("/");
final String streamType = split[0];
final String fileType = split[1];
final String codec = mimeType.split("\"")[1];

MediaFormat format = null;
ItagType itagType = null;
Expand All @@ -110,17 +110,10 @@ public static ItagItem getItag(int itagId, int averageBitrate, int fps, String q
itagType = AUDIO;
}

if (itagType == AUDIO) {
if (fileType.equals("mp4") && (codec.startsWith("m4a") || codec.startsWith("mp4a") ))
format = M4A;
if (fileType.startsWith("webm") && codec.equals("opus"))
format = WEBMA_OPUS;
}

if (itagType == VIDEO) {
if (fileType.equals("mp4"))
format = MPEG_4;
if(fileType.equals("3gpp"))
if (fileType.equals("3gpp"))
format = v3GPP;
}

Expand All @@ -131,6 +124,13 @@ public static ItagItem getItag(int itagId, int averageBitrate, int fps, String q
format = WEBM;
}

if (itagType == AUDIO) {
if (fileType.equals("mp4") && (codec.startsWith("m4a") || codec.startsWith("mp4a")))
format = M4A;
if (fileType.startsWith("webm") && codec.equals("opus"))
format = WEBMA_OPUS;
}

if (itagType == null || format == null)
throw new ParsingException("Unknown mimeType: " + mimeType);

Expand Down

0 comments on commit 695b72d

Please sign in to comment.