Search in sources :

Example 1 with VideoTrack

use of org.videolan.libvlc.Media.VideoTrack 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 VideoTrack

use of org.videolan.libvlc.Media.VideoTrack 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)2 VideoTrack (org.videolan.libvlc.Media.VideoTrack)2