Commit 79f65dd4 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

libvlc: add a simple playMrl(String mrl)

Close #10007
parent 0ab8141e
......@@ -420,6 +420,18 @@ public class LibVLC {
playMrl(mLibVlcInstance, mrl, options);
}
/**
* Play an mrl
*
* @param position The index of the media
*/
public void playMrl(String mrl) {
// index=-1 will return options from libvlc instance without relying on MediaList
String[] options = mMediaList.getMediaOptions(-1);
mInternalMediaPlayerIndex = 0;
playMrl(mLibVlcInstance, mrl, options);
}
public TrackInfo[] readTracksInfo(String mrl) {
return readTracksInfo(mLibVlcInstance, mrl);
}
......
......@@ -163,31 +163,34 @@ public class MediaList {
return mInternalList.get(position).m.getLocation();
}
private String[] getMediaOptions(int position) {
if (!isValid(position))
return null;
boolean noOmx = mInternalList.get(position).noOmx;
boolean noVideo = mInternalList.get(position).noVideo;
public String[] getMediaOptions(int position) {
boolean noOmx = !mLibVLC.useIOMX();
boolean noVideo = false;
if (isValid(position))
{
if (!noOmx)
noOmx = mInternalList.get(position).noOmx;
noVideo = mInternalList.get(position).noVideo;
}
ArrayList<String> options = new ArrayList<String>();
if (!noOmx) {
if (mLibVLC.useIOMX()) {
/*
* Set higher caching values if using iomx decoding, since some omx
* decoders have a very high latency, and if the preroll data isn't
* enough to make the decoder output a frame, the playback timing gets
* started too soon, and every decoded frame appears to be too late.
* On Nexus One, the decoder latency seems to be 25 input packets
* for 320x170 H.264, a few packets less on higher resolutions.
* On Nexus S, the decoder latency seems to be about 7 packets.
*/
options.add(":file-caching=1500");
options.add(":network-caching=1500");
options.add(":codec=mediacodec,iomx,all");
}
if (noVideo)
options.add(":no-video");
/*
* Set higher caching values if using iomx decoding, since some omx
* decoders have a very high latency, and if the preroll data isn't
* enough to make the decoder output a frame, the playback timing gets
* started too soon, and every decoded frame appears to be too late.
* On Nexus One, the decoder latency seems to be 25 input packets
* for 320x170 H.264, a few packets less on higher resolutions.
* On Nexus S, the decoder latency seems to be about 7 packets.
*/
options.add(":file-caching=1500");
options.add(":network-caching=1500");
options.add(":codec=mediacodec,iomx,all");
}
if (noVideo)
options.add(":no-video");
return options.toArray(new String[options.size()]);
}
......
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 to comment