本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}