use of org.videolan.libvlc.Media in project vlc-android by videolan.
the class MediaWrapper method init.
private void init(Media media) {
mType = TYPE_ALL;
if (media != null) {
if (media.isParsed()) {
mLength = media.getDuration();
for (int i = 0; i < media.getTrackCount(); ++i) {
final Media.Track track = media.getTrack(i);
if (track == null)
continue;
if (track.type == Media.Track.Type.Video) {
final Media.VideoTrack videoTrack = (VideoTrack) track;
mType = TYPE_VIDEO;
mWidth = videoTrack.width;
mHeight = videoTrack.height;
} else if (mType == TYPE_ALL && track.type == Media.Track.Type.Audio) {
mType = TYPE_AUDIO;
}
}
}
updateMeta(media);
if (mType == TYPE_ALL)
switch(media.getType()) {
case Media.Type.Directory:
mType = TYPE_DIR;
break;
case Media.Type.Playlist:
mType = TYPE_PLAYLIST;
break;
}
mSlaves = media.getSlaves();
}
defineType();
}
use of org.videolan.libvlc.Media in project vlc-android by videolan.
the class MediaWrapper method updateMeta.
public void updateMeta(MediaPlayer mediaPlayer) {
if (!TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mDisplayTitle))
mDisplayTitle = mTitle;
final Media media = mediaPlayer.getMedia();
if (media == null)
return;
updateMeta(media);
media.release();
}
use of org.videolan.libvlc.Media in project vlc-android by videolan.
the class MediaPlayer method setDataSource.
// FIXME, this is INCORRECT, @headers are ignored
public void setDataSource(Context context, Uri uri, Map<String, String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
mCurrentMedia = new Media(mILibVLC, uri);
mMediaPlayer.setMedia(mCurrentMedia);
}
use of org.videolan.libvlc.Media in project vlc-android by GeoffreyMetais.
the class VLCUtil method getThumbnail.
/**
* Get a media thumbnail.
* @return a bytearray with the RGBA thumbnail data inside.
*/
public static byte[] getThumbnail(LibVLC libVLC, Uri uri, int i_width, int i_height) {
/* dvd thumbnails can work only with dvdsimple demux */
if (uri.getLastPathSegment().endsWith(".iso"))
uri = Uri.parse("dvdsimple://" + uri.getEncodedPath());
final Media media = new Media(libVLC, uri);
byte[] bytes = getThumbnail(media, i_width, i_height);
media.release();
return bytes;
}
use of org.videolan.libvlc.Media in project vlc-android by GeoffreyMetais.
the class MediaWrapper method init.
private void init(Media media) {
mType = TYPE_ALL;
if (media != null) {
if (media.isParsed()) {
mLength = media.getDuration();
for (int i = 0; i < media.getTrackCount(); ++i) {
final Media.Track track = media.getTrack(i);
if (track == null)
continue;
if (track.type == Media.Track.Type.Video) {
final Media.VideoTrack videoTrack = (VideoTrack) track;
mType = TYPE_VIDEO;
mWidth = videoTrack.width;
mHeight = videoTrack.height;
} else if (mType == TYPE_ALL && track.type == Media.Track.Type.Audio) {
mType = TYPE_AUDIO;
}
}
}
updateMeta(media);
if (mType == TYPE_ALL)
switch(media.getType()) {
case Media.Type.Directory:
mType = TYPE_DIR;
break;
case Media.Type.Playlist:
mType = TYPE_PLAYLIST;
break;
}
mSlaves = media.getSlaves();
}
defineType();
}
Aggregations