Search in sources :

Example 1 with Media

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();
}
Also used : VideoTrack(org.videolan.libvlc.Media.VideoTrack) Media(org.videolan.libvlc.Media) VideoTrack(org.videolan.libvlc.Media.VideoTrack)

Example 2 with Media

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();
}
Also used : Media(org.videolan.libvlc.Media)

Example 3 with Media

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);
}
Also used : Media(org.videolan.libvlc.Media) IMedia(org.videolan.libvlc.interfaces.IMedia)

Example 4 with Media

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;
}
Also used : Media(org.videolan.libvlc.Media)

Example 5 with Media

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();
}
Also used : VideoTrack(org.videolan.libvlc.Media.VideoTrack) Media(org.videolan.libvlc.Media) VideoTrack(org.videolan.libvlc.Media.VideoTrack)

Aggregations

Media (org.videolan.libvlc.Media)18 MainThread (android.support.annotation.MainThread)3 IMedia (org.videolan.libvlc.interfaces.IMedia)3 SuppressLint (android.annotation.SuppressLint)2 VideoTrack (org.videolan.libvlc.Media.VideoTrack)2 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)2