Commit 8c879487 by eguven Committed by Oliver Woodman

Fixed demo-misc-vp9-opus-sw DASH check

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111839055
parent b7d5ce36
......@@ -87,16 +87,9 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
public static final String CONTENT_ID_EXTRA = "content_id";
public static final String CONTENT_TYPE_EXTRA = "content_type";
public static final String PROVIDER_EXTRA = "provider";
public static final int TYPE_DASH = 0;
public static final int TYPE_SS = 1;
public static final int TYPE_HLS = 2;
public static final int TYPE_OTHER = 3;
// For use when launching the demo app using adb.
private static final String CONTENT_EXT_EXTRA = "type";
private static final String EXT_DASH = ".mpd";
private static final String EXT_SS = ".ism";
private static final String EXT_HLS = ".m3u8";
private static final String TAG = "PlayerActivity";
private static final int MENU_GROUP_TRACKS = 1;
......@@ -306,15 +299,15 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
private RendererBuilder getRendererBuilder() {
String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
switch (contentType) {
case TYPE_SS:
case Util.TYPE_SS:
return new SmoothStreamingRendererBuilder(this, userAgent, contentUri.toString(),
new SmoothStreamingTestMediaDrmCallback());
case TYPE_DASH:
case Util.TYPE_DASH:
return new DashRendererBuilder(this, userAgent, contentUri.toString(),
new WidevineTestMediaDrmCallback(contentId, provider));
case TYPE_HLS:
case Util.TYPE_HLS:
return new HlsRendererBuilder(this, userAgent, contentUri.toString());
case TYPE_OTHER:
case Util.TYPE_OTHER:
return new ExtractorRendererBuilder(this, userAgent, contentUri);
default:
throw new IllegalStateException("Unsupported type: " + contentType);
......@@ -693,17 +686,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
private static int inferContentType(Uri uri, String fileExtension) {
String lastPathSegment = !TextUtils.isEmpty(fileExtension) ? "." + fileExtension
: uri.getLastPathSegment();
if (lastPathSegment == null) {
return TYPE_OTHER;
} else if (lastPathSegment.endsWith(EXT_DASH)) {
return TYPE_DASH;
} else if (lastPathSegment.endsWith(EXT_SS)) {
return TYPE_SS;
} else if (lastPathSegment.endsWith(EXT_HLS)) {
return TYPE_HLS;
} else {
return TYPE_OTHER;
}
return Util.inferContentType(lastPathSegment);
}
private static final class KeyCompatibleMediaController extends MediaController {
......
......@@ -15,6 +15,8 @@
*/
package com.google.android.exoplayer.demo;
import com.google.android.exoplayer.util.Util;
import java.util.Locale;
/**
......@@ -49,12 +51,12 @@ import java.util.Locale;
"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?"
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&"
+ "ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7."
+ "8506521BFC350652163895D4C26DEE124209AA9E&key=ik0", PlayerActivity.TYPE_DASH),
+ "8506521BFC350652163895D4C26DEE124209AA9E&key=ik0", Util.TYPE_DASH),
new Sample("Google Play (MP4,H264)",
"http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?"
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&"
+ "ipbits=0&expire=19000000000&signature=A2716F75795F5D2AF0E88962FFCD10DB79384F29."
+ "84308FF04844498CE6FBCE4731507882B8307798&key=ik0", PlayerActivity.TYPE_DASH),
+ "84308FF04844498CE6FBCE4731507882B8307798&key=ik0", Util.TYPE_DASH),
};
public static final Sample[] YOUTUBE_DASH_WEBM = new Sample[] {
......@@ -62,188 +64,188 @@ import java.util.Locale;
"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?"
+ "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&"
+ "ipbits=0&expire=19000000000&signature=249B04F79E984D7F86B4D8DB48AE6FAF41C17AB3."
+ "7B9F0EC0505E1566E59B8E488E9419F253DDF413&key=ik0", PlayerActivity.TYPE_DASH),
+ "7B9F0EC0505E1566E59B8E488E9419F253DDF413&key=ik0", Util.TYPE_DASH),
new Sample("Google Play (WebM,VP9)",
"http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?"
+ "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&"
+ "ipbits=0&expire=19000000000&signature=B1C2A74783AC1CC4865EB312D7DD2D48230CC9FD."
+ "BD153B9882175F1F94BFE5141A5482313EA38E8D&key=ik0", PlayerActivity.TYPE_DASH),
+ "BD153B9882175F1F94BFE5141A5482313EA38E8D&key=ik0", Util.TYPE_DASH),
};
public static final Sample[] SMOOTHSTREAMING = new Sample[] {
new Sample("Super speed",
"http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism",
PlayerActivity.TYPE_SS),
Util.TYPE_SS),
new Sample("Super speed (PlayReady)",
"http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism",
PlayerActivity.TYPE_SS),
Util.TYPE_SS),
};
private static final String WIDEVINE_GTS_MPD =
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd";
public static final Sample[] WIDEVINE_GTS = new Sample[] {
new Sample("WV: HDCP not specified", "d286538032258a1c", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP not required", "48fcc369939ac96c", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP required", "e06c39f1151da3df", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: Secure video path required (MP4,H264)", "0894c7c8719b28a0", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: Secure video path required (WebM,VP9)", "0894c7c8719b28a0", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure video path required (MP4,H265)", "0894c7c8719b28a0", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: HDCP + secure video path required", "efd045b1eb61888a", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: 30s license duration (fails at ~30s)", "f9a34cab7b05881a", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_HDCP = new Sample[] {
new Sample("WV: HDCP: None (not required)", "HDCP_None", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP: 1.0 required", "HDCP_V1", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP: 2.0 required", "HDCP_V2", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP: 2.1 required", "HDCP_V2_1", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP: 2.2 required", "HDCP_V2_2", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
new Sample("WV: HDCP: No digital output", "HDCP_NO_DIGTAL_OUTPUT", "widevine_test",
WIDEVINE_GTS_MPD, PlayerActivity.TYPE_DASH),
WIDEVINE_GTS_MPD, Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_H264_MP4_CLEAR = new Sample[] {
new Sample("WV: Clear SD & HD (MP4,H264)",
"https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear SD (MP4,H264)",
"https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear HD (MP4,H264)",
"https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear UHD (MP4,H264)",
"https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_H264_MP4_SECURE = new Sample[] {
new Sample("WV: Secure SD & HD (MP4,H264)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure SD (MP4,H264)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure HD (MP4,H264)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure UHD (MP4,H264)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_VP9_WEBM_CLEAR = new Sample[] {
new Sample("WV: Clear SD & HD (WebM,VP9)",
"https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear SD (WebM,VP9)",
"https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear HD (WebM,VP9)",
"https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear UHD (WebM,VP9)",
"https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_VP9_WEBM_SECURE = new Sample[] {
new Sample("WV: Secure SD & HD (WebM,VP9)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure SD (WebM,VP9)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure HD (WebM,VP9)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure UHD (WebM,VP9)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_H265_MP4_CLEAR = new Sample[] {
new Sample("WV: Clear SD & HD (MP4,H265)",
"https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear SD (MP4,H265)",
"https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear HD (MP4,H265)",
"https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Clear UHD (MP4,H265)",
"https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] WIDEVINE_H265_MP4_SECURE = new Sample[] {
new Sample("WV: Secure SD & HD (MP4,H265)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure SD (MP4,H265)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_sd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure HD (MP4,H265)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_hd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
new Sample("WV: Secure UHD (MP4,H265)", "", "widevine_test",
"https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_uhd.mpd",
PlayerActivity.TYPE_DASH),
Util.TYPE_DASH),
};
public static final Sample[] HLS = new Sample[] {
new Sample("Apple master playlist",
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/"
+ "bipbop_4x3_variant.m3u8", PlayerActivity.TYPE_HLS),
+ "bipbop_4x3_variant.m3u8", Util.TYPE_HLS),
new Sample("Apple master playlist advanced",
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/"
+ "bipbop_16x9_variant.m3u8", PlayerActivity.TYPE_HLS),
+ "bipbop_16x9_variant.m3u8", Util.TYPE_HLS),
new Sample("Apple TS media playlist",
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/"
+ "prog_index.m3u8", PlayerActivity.TYPE_HLS),
+ "prog_index.m3u8", Util.TYPE_HLS),
new Sample("Apple AAC media playlist",
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear0/"
+ "prog_index.m3u8", PlayerActivity.TYPE_HLS),
+ "prog_index.m3u8", Util.TYPE_HLS),
new Sample("Apple ID3 metadata", "http://devimages.apple.com/samplecode/adDemo/ad.m3u8",
PlayerActivity.TYPE_HLS),
Util.TYPE_HLS),
};
public static final Sample[] MISC = new Sample[] {
new Sample("Dizzy", "http://html5demos.com/assets/dizzy.mp4", PlayerActivity.TYPE_OTHER),
new Sample("Dizzy", "http://html5demos.com/assets/dizzy.mp4", Util.TYPE_OTHER),
new Sample("Apple AAC 10s", "https://devimages.apple.com.edgekey.net/"
+ "streaming/examples/bipbop_4x3/gear0/fileSequence0.aac", PlayerActivity.TYPE_OTHER),
+ "streaming/examples/bipbop_4x3/gear0/fileSequence0.aac", Util.TYPE_OTHER),
new Sample("Apple TS 10s", "https://devimages.apple.com.edgekey.net/streaming/examples/"
+ "bipbop_4x3/gear1/fileSequence0.ts", PlayerActivity.TYPE_OTHER),
+ "bipbop_4x3/gear1/fileSequence0.ts", Util.TYPE_OTHER),
new Sample("Android screens (Matroska)", "http://storage.googleapis.com/exoplayer-test-media-1/"
+ "mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv",
PlayerActivity.TYPE_OTHER),
Util.TYPE_OTHER),
new Sample("Big Buck Bunny (MP4 Video)",
"http://redirector.c.youtube.com/videoplayback?id=604ed5ce52eda7ee&itag=22&source=youtube&"
+ "sparams=ip,ipbits,expire,source,id&ip=0.0.0.0&ipbits=0&expire=19000000000&signature="
+ "513F28C7FDCBEC60A66C86C9A393556C99DC47FB.04C88036EEE12565A1ED864A875A58F15D8B5300"
+ "&key=ik0", PlayerActivity.TYPE_OTHER),
+ "&key=ik0", Util.TYPE_OTHER),
new Sample("Google Play (MP3 Audio)",
"http://storage.googleapis.com/exoplayer-test-media-0/play.mp3", PlayerActivity.TYPE_OTHER),
"http://storage.googleapis.com/exoplayer-test-media-0/play.mp3", Util.TYPE_OTHER),
new Sample("Google Glass (WebM Video with Vorbis Audio)",
"http://demos.webmproject.org/exoplayer/glass_vp9_vorbis.webm", PlayerActivity.TYPE_OTHER),
"http://demos.webmproject.org/exoplayer/glass_vp9_vorbis.webm", Util.TYPE_OTHER),
new Sample("Big Buck Bunny (FLV Video)",
"http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0", PlayerActivity.TYPE_OTHER),
"http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0", Util.TYPE_OTHER),
};
private Samples() {}
......
......@@ -53,11 +53,14 @@ import android.widget.Toast;
public class PlayerActivity extends Activity implements
LibvpxVideoTrackRenderer.EventListener, ExoPlayer.Listener {
public static final String USE_OPENGL_ID_EXTRA = "use_opengl";
/*package*/ static final String CONTENT_TYPE_EXTRA = "content_type";
/*package*/ static final String USE_OPENGL_ID_EXTRA = "use_opengl";
private static final int BUFFER_SEGMENT_SIZE = 64 * 1024;
private static final int BUFFER_SEGMENT_COUNT = 160;
private Uri contentUri;
private int contentType;
private boolean useOpenGL;
private ExoPlayer player;
......@@ -69,7 +72,6 @@ public class PlayerActivity extends Activity implements
private TextView debugInfoView;
private String debugInfo;
private String playerState;
private Uri contentUri;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -77,6 +79,8 @@ public class PlayerActivity extends Activity implements
Intent intent = getIntent();
contentUri = intent.getData();
contentType = intent.getIntExtra(CONTENT_TYPE_EXTRA,
Util.inferContentType(contentUri.toString()));
useOpenGL = intent.getBooleanExtra(USE_OPENGL_ID_EXTRA, true);
handler = new Handler();
......@@ -111,7 +115,7 @@ public class PlayerActivity extends Activity implements
}
private void startPlayback() {
if (Util.isLocalFileUri(contentUri)) {
if (contentType != Util.TYPE_DASH) {
startBasicPlayback();
} else {
startDashPlayback();
......
......@@ -15,6 +15,8 @@
*/
package com.google.android.exoplayer.demo.vp9opus;
import com.google.android.exoplayer.util.Util;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
......@@ -44,13 +46,16 @@ public class SampleChooserActivity extends Activity {
sampleAdapter.add(new Header("DASH - VP9 Only"));
sampleAdapter.add(new Sample("Google Glass",
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9.mpd"));
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9.mpd",
Util.TYPE_DASH));
sampleAdapter.add(new Header("DASH - VP9 and Opus"));
sampleAdapter.add(new Sample("Google Glass",
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_opus.mpd"));
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_opus.mpd",
Util.TYPE_DASH));
sampleAdapter.add(new Header("DASH - VP9 and Vorbis"));
sampleAdapter.add(new Sample("Google Glass",
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_vorbis.mpd"));
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_vorbis.mpd",
Util.TYPE_DASH));
sampleList.setAdapter(sampleAdapter);
sampleList.setOnItemClickListener(new OnItemClickListener() {
......@@ -67,7 +72,7 @@ public class SampleChooserActivity extends Activity {
private void onSampleSelected(Sample sample) {
Intent playerIntent = new Intent(this, PlayerActivity.class)
.setData(Uri.parse(sample.uri))
.putExtra(PlayerActivity.USE_OPENGL_ID_EXTRA, sample.useOpenGL);
.putExtra(PlayerActivity.CONTENT_TYPE_EXTRA, sample.type);
startActivity(playerIntent);
}
......@@ -112,20 +117,12 @@ public class SampleChooserActivity extends Activity {
public final String description;
public final String uri;
public final boolean useOpenGL;
public Sample(String description, boolean useOpenGL) {
this(description, null, useOpenGL);
}
public Sample(String description, String uri) {
this(description, uri, true); // always use OpenGL for DASH playbacks.
}
public final int type;
public Sample(String description, String uri, boolean useOpenGL) {
public Sample(String description, String uri, int type) {
this.description = description;
this.uri = uri;
this.useOpenGL = useOpenGL;
this.type = type;
}
}
......
......@@ -82,6 +82,27 @@ public final class Util {
*/
public static final String MODEL = android.os.Build.MODEL;
/**
* Value returned by {@link #inferContentType(String)} for DASH manifests.
*/
public static final int TYPE_DASH = 0;
/**
* Value returned by {@link #inferContentType(String)} for Smooth Streaming manifests.
*/
public static final int TYPE_SS = 1;
/**
* Value returned by {@link #inferContentType(String)} for HLS manifests.
*/
public static final int TYPE_HLS = 2;
/**
* Value returned by {@link #inferContentType(String)} for files other than DASH, HLS or Smooth
* Streaming manifests.
*/
public static final int TYPE_OTHER = 3;
private static final Pattern XS_DATE_TIME_PATTERN = Pattern.compile(
"(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)[Tt]"
+ "(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d+))?"
......@@ -728,4 +749,23 @@ public final class Util {
}
}
/**
* Makes a best guess to infer the type from a file name.
*
* @param fileName Name of the file. It can include the path of the file.
* @return One of {@link #TYPE_DASH}, {@link #TYPE_SS}, {@link #TYPE_HLS} or {@link #TYPE_OTHER}.
*/
public static int inferContentType(String fileName) {
if (fileName == null) {
return TYPE_OTHER;
} else if (fileName.endsWith(".mpd")) {
return TYPE_DASH;
} else if (fileName.endsWith(".ism")) {
return TYPE_SS;
} else if (fileName.endsWith(".m3u8")) {
return TYPE_HLS;
} else {
return TYPE_OTHER;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment