当前位置: 首页>>代码示例>>Java>>正文


Java Media.parse方法代码示例

本文整理汇总了Java中org.videolan.libvlc.Media.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Media.parse方法的具体用法?Java Media.parse怎么用?Java Media.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.videolan.libvlc.Media的用法示例。


在下文中一共展示了Media.parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: expand

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
 * Expand the current media.
 * @return the index of the media was expanded, and -1 if no media was expanded
 */
@MainThread
public int expand() {
    final Media media = mMediaPlayer.getMedia();
    if (media == null)
        return -1;
    final MediaList ml = media.subItems();
    media.release();
    int ret;

    if (ml.getCount() > 0) {
        mMediaList.remove(mCurrentIndex);
        for (int i = 0; i < ml.getCount(); ++i) {
            final Media child = ml.getMediaAt(i);
            child.parse();
            mMediaList.insert(mCurrentIndex, new MediaWrapper(child));
            child.release();
        }
        ret = 0;
    } else {
        ret = -1;
    }
    ml.release();
    return ret;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:29,代码来源:PlaybackService.java

示例2: expand

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
 * Expand the current media.
 * @return the index of the media was expanded, and -1 if no media was expanded
 */
@MainThread
public int expand() {
    final Media media = mMediaPlayer.getMedia();
    if (media == null)
        return -1;
    final MediaList ml = media.subItems();
    media.release();
    int ret;

    if (ml.getCount() > 0) {
        mMediaList.remove(mCurrentIndex);
        for (int i = ml.getCount() - 1; i >= 0; --i) {
            final Media child = ml.getMediaAt(i);
            child.parse();
            mMediaList.insert(mCurrentIndex, new MediaWrapper(child));
            child.release();
        }
        ret = 0;
    } else {
        ret = -1;
    }
    ml.release();
    return ret;
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:29,代码来源:PlaybackService.java

示例3: setContextMenuItems

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
private void setContextMenuItems(Menu menu, MediaWrapper mediaWrapper) {
    long lastTime = mediaWrapper.getTime();
    if (lastTime > 0)
        menu.findItem(R.id.video_list_play_from_start).setVisible(true);

    boolean hasInfo = false;
    final Media media = new Media(VLCInstance.get(), mediaWrapper.getUri());
    media.parse();
    if (media.getMeta(Media.Meta.Title) != null)
        hasInfo = true;
    media.release();
    menu.findItem(R.id.video_list_info).setVisible(hasInfo);
    menu.findItem(R.id.video_list_delete).setVisible(!AndroidUtil.isLolliPopOrLater() ||
            mediaWrapper.getLocation().startsWith("file://" + AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY));
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:16,代码来源:VideoGridFragment.java

示例4: run

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@Override
public void run() {
    final LibVLC libVlc = VLCInstance.get();
    if (libVlc == null)
        return;
    mMedia = new Media(libVlc, mItem.getUri());
    mMedia.parse();
    int videoHeight = mItem.getHeight();
    int videoWidth = mItem.getWidth();
    if (videoWidth == 0 || videoHeight == 0) {
        return;
    }

    mHandler.sendEmptyMessage(NEW_TEXT);

    DisplayMetrics screen = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(screen);
    int width, height;
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        width = Math.min(screen.widthPixels, screen.heightPixels);
    } else {
        width = screen.widthPixels /2 ;
    }
    height = width * videoHeight/videoWidth;

    // Get the thumbnail.
    mImage = Bitmap.createBitmap(width, height, Config.ARGB_8888);

    byte[] b = VLCUtil.getThumbnail(mMedia, width, height);

    if (b == null) // We were not able to create a thumbnail for this item.
        return;

    if (Thread.interrupted()) {
        return;
    }
    mImage.copyPixelsFromBuffer(ByteBuffer.wrap(b));
    mImage = BitmapUtil.cropBorders(mImage, width, height);

    mHandler.sendEmptyMessage(NEW_IMAGE);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:42,代码来源:MediaInfoFragment.java

示例5: run

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@Override
public void run() {
    final LibVLC libVlc = VLCInstance.get();
    if (libVlc == null)
        return;
    mMedia = new Media(libVlc, mItem.getUri());
    mMedia.parse();
    int videoHeight = mItem.getHeight();
    int videoWidth = mItem.getWidth();
    if (videoWidth == 0 || videoHeight == 0) {
        //FIXME : find a better way to display media info without video size
        videoWidth = 16;
        videoHeight = 9;
    }

    mHandler.sendEmptyMessage(NEW_TEXT);

    DisplayMetrics screen = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(screen);
    int width, height;
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        width = Math.min(screen.widthPixels, screen.heightPixels);
    } else {
        width = screen.widthPixels /2 ;
    }
    height = width * videoHeight/videoWidth;

    // Get the thumbnail.
    mImage = Bitmap.createBitmap(width, height, Config.ARGB_8888);

    byte[] b = VLCUtil.getThumbnail(mMedia, width, height);

    if (b == null) // We were not able to create a thumbnail for this item.
        return;

    if (Thread.interrupted()) {
        return;
    }
    mImage.copyPixelsFromBuffer(ByteBuffer.wrap(b));
    mImage = BitmapUtil.cropBorders(mImage, width, height);

    mHandler.sendEmptyMessage(NEW_IMAGE);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:44,代码来源:MediaInfoFragment.java


注:本文中的org.videolan.libvlc.Media.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。