本文整理汇总了Java中tv.danmaku.ijk.media.player.annotations.CalledByNative类的典型用法代码示例。如果您正苦于以下问题:Java CalledByNative类的具体用法?Java CalledByNative怎么用?Java CalledByNative使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CalledByNative类属于tv.danmaku.ijk.media.player.annotations包,在下文中一共展示了CalledByNative类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postEventFromNative
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static void postEventFromNative(Object weakThiz, int what,
int arg1, int arg2, Object obj) {
if (weakThiz == null)
return;
@SuppressWarnings("rawtypes")
IjkMediaPlayer mp = (IjkMediaPlayer) ((WeakReference) weakThiz).get();
if (mp == null) {
return;
}
if (what == MEDIA_INFO && arg1 == MEDIA_INFO_STARTED_AS_NEXT) {
// this acquires the wakelock if needed, and sets the client side
// state
mp.start();
}
if (mp.mEventHandler != null) {
Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj);
mp.mEventHandler.sendMessage(m);
}
}
示例2: onSelectCodec
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static String onSelectCodec(Object weakThiz, String mimeType, int profile, int level) {
if (weakThiz == null || !(weakThiz instanceof WeakReference<?>))
return null;
@SuppressWarnings("unchecked")
WeakReference<IjkMediaPlayer> weakPlayer = (WeakReference<IjkMediaPlayer>) weakThiz;
IjkMediaPlayer player = weakPlayer.get();
if (player == null)
return null;
OnMediaCodecSelectListener listener = player.mOnMediaCodecSelectListener;
if (listener == null)
listener = DefaultMediaCodecSelector.sInstance;
return listener.onMediaCodecSelect(player, mimeType, profile, level);
}
示例3: onControlResolveSegmentUrl
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static String onControlResolveSegmentUrl(Object weakThiz, int segment) {
DebugLog.ifmt(TAG, "onControlResolveSegmentUrl %d", segment);
if (weakThiz == null || !(weakThiz instanceof WeakReference<?>))
return null;
@SuppressWarnings("unchecked")
WeakReference<IjkMediaPlayer> weakPlayer = (WeakReference<IjkMediaPlayer>) weakThiz;
IjkMediaPlayer player = weakPlayer.get();
if (player == null)
return null;
OnControlMessageListener listener = player.mOnControlMessageListener;
if (listener == null)
return null;
return listener.onControlResolveSegmentUrl(segment);
}
示例4: onNativeInvoke
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static boolean onNativeInvoke(Object weakThiz, int what, Bundle args) {
DebugLog.ifmt(TAG, "onNativeInvoke %d", what);
if (weakThiz == null || !(weakThiz instanceof WeakReference<?>))
return false;
@SuppressWarnings("unchecked")
WeakReference<IjkMediaPlayer> weakPlayer = (WeakReference<IjkMediaPlayer>) weakThiz;
IjkMediaPlayer player = weakPlayer.get();
if (player == null)
return false;
OnNativeInvokeListener listener = player.mOnNativeInvokeListener;
if (listener == null)
return false;
return listener.onNativeInvoke(what, args);
}
示例5: onNativeInvoke
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static boolean onNativeInvoke(Object weakThiz, int what, Bundle args) {
DebugLog.ifmt(TAG, "onNativeInvoke %d", what);
if (weakThiz == null || !(weakThiz instanceof WeakReference<?>))
throw new IllegalStateException("<null weakThiz>.onNativeInvoke()");
@SuppressWarnings("unchecked")
WeakReference<IjkMediaPlayer> weakPlayer = (WeakReference<IjkMediaPlayer>) weakThiz;
IjkMediaPlayer player = weakPlayer.get();
if (player == null)
throw new IllegalStateException("<null weakPlayer>.onNativeInvoke()");
OnNativeInvokeListener listener = player.mOnNativeInvokeListener;
if (listener != null && listener.onNativeInvoke(what, args))
return true;
switch (what) {
case OnNativeInvokeListener.ON_CONCAT_RESOLVE_SEGMENT: {
OnControlMessageListener onControlMessageListener = player.mOnControlMessageListener;
if (onControlMessageListener == null)
return false;
int segmentIndex = args.getInt(OnNativeInvokeListener.ARG_SEGMENT_INDEX, -1);
if (segmentIndex < 0)
throw new InvalidParameterException("onNativeInvoke(invalid segment index)");
String newUrl = onControlMessageListener.onControlResolveSegmentUrl(segmentIndex);
if (newUrl == null)
throw new RuntimeException(new IOException("onNativeInvoke() = <NULL newUrl>"));
args.putString(OnNativeInvokeListener.ARG_URL, newUrl);
return true;
}
default:
return false;
}
}
示例6: onNativeInvoke
import tv.danmaku.ijk.media.player.annotations.CalledByNative; //导入依赖的package包/类
@CalledByNative
private static boolean onNativeInvoke(Object weakThiz, int what, Bundle args) {
DebugLog.ifmt(TAG, "onNativeInvoke %d", what);
if (weakThiz == null || !(weakThiz instanceof WeakReference<?>))
throw new IllegalStateException("<null weakThiz>.onNativeInvoke()");
@SuppressWarnings("unchecked")
WeakReference<IjkMediaPlayer> weakPlayer = (WeakReference<IjkMediaPlayer>) weakThiz;
IjkMediaPlayer player = weakPlayer.get();
if (player == null)
throw new IllegalStateException("<null weakPlayer>.onNativeInvoke()");
OnNativeInvokeListener listener = player.mOnNativeInvokeListener;
if (listener != null && listener.onNativeInvoke(what, args))
return true;
switch (what) {
case OnNativeInvokeListener.CTRL_WILL_CONCAT_RESOLVE_SEGMENT: {
OnControlMessageListener onControlMessageListener = player.mOnControlMessageListener;
if (onControlMessageListener == null)
return false;
int segmentIndex = args.getInt(OnNativeInvokeListener.ARG_SEGMENT_INDEX, -1);
if (segmentIndex < 0)
throw new InvalidParameterException("onNativeInvoke(invalid segment index)");
String newUrl = onControlMessageListener.onControlResolveSegmentUrl(segmentIndex);
if (newUrl == null)
throw new RuntimeException(new IOException("onNativeInvoke() = <NULL newUrl>"));
args.putString(OnNativeInvokeListener.ARG_URL, newUrl);
return true;
}
default:
return false;
}
}