Java Code Examples for org.videolan.libvlc.Media#isParsed()

The following examples show how to use org.videolan.libvlc.Media#isParsed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaWrapper.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
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();
}
 
Example 2
Source File: MediaWrapper.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
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();
}
 
Example 3
Source File: MediaWrapper.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
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 && media.getType() == Media.Type.Directory)
            mType = TYPE_DIR;
    }

    if (mType == TYPE_ALL) {
        final int index = mUri.toString().indexOf('?');
        String location;
        if (index == -1)
            location = mUri.toString();
        else
            location = mUri.toString().substring(0, index);
        int dotIndex = location.lastIndexOf(".");
        if (dotIndex != -1) {
            String fileExt = location.substring(dotIndex).toLowerCase(Locale.ENGLISH);
            if( Extensions.VIDEO.contains(fileExt) ) {
                mType = TYPE_VIDEO;
            } else if (Extensions.AUDIO.contains(fileExt)) {
                mType = TYPE_AUDIO;
            } else if (Extensions.SUBTITLES.contains(fileExt)) {
                mType = TYPE_SUBTITLE;
            } else if (Extensions.PLAYLIST.contains(fileExt)) {
                mType = TYPE_PLAYLIST;
            }
        }
    }
}