JNI函数void-->int 传入整形变量
来源:互联网 发布:unity3d 角色模型 编辑:程序博客网 时间:2024/04/29 07:16
场景:DVB电视播放:
遥控器左右键切换不同频点播放首个节目,上下键当前频点不同节目.
上下键切换保持最后一帧,左右键黑屏.
之前都是黑屏操作,加入最后一帧
vendor/chuangjia/packages/apps/CyFactoryTest/src/com/chuangyi/cyfactorytest/glue/dvbplay/CyFacGlueDVB.java:180: 无法将 com.chuangyi.cyfactorytest.glue.dvbplay.CyFacGlueDVB 中的 dvbStopNative() 应用于 (int)
dvbStopNative(need_status);
(1)Java上层
public static final int SC_BLACK = 1; //上下切台静帧, 左右切换黑屏处理
public static final int SC_STILL = 0;
private void stopPlay() {
Log.i(TAG, "Stop play");
if (mGlueDVB != null)
mGlueDVB.stopLive(mProStopNeed); //mGlueDVB.stopLive();
mProStopNeed = SC_BLACK;
}
(2)JNI层
java:
public boolean stopLive(int need_status) { // stopLive()
dvbStopNative(need_status); // dvbStopNative();
return true;
}
link:
JNIEXPORT jboolean JNICALL Java_com_chuangyi_cyfactorytest_glue_dvbplay_CyFacGlueDVB_dvbStopNative
(JNIEnv *env, jobject thiz, jint need_status) // (JNIEnv *env, jobject thiz)
{
jint ret = -1;
LOGI("dvbStopNative");
ret = cy_stop_play(need_status); // ret = cy_stop_play();
return ret == 0 ? JNI_TRUE : JNI_FALSE;
}
新加了 jinit need_status
底层
int cy_stop_play(int need_status) // cy_stop_play()
{
HI_S32 Ret;
HI_UNF_AVPLAY_STOP_OPT_S Stop;
************************
// if(need_status == HI_UNF_AVPLAY_STOP_MODE_STILL )
// Stop.enMode = HI_UNF_AVPLAY_STOP_MODE_STILL;
//else
//
Stop.enMode = HI_UNF_AVPLAY_STOP_MODE_STILL&1;
Stop.u32TimeoutMs = 0;
Ret = HI_UNF_AVPLAY_Stop(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID | HI_UNF_AVPLAY_MEDIA_CHAN_AUD, &Stop);
return 0;
}
新加了 int need_status
解决: 在JNI层的java
synchronized private native boolean dvbStopNative();
改为
synchronized private native boolean dvbStopNative(int status);
link层
static JNINativeMethod gMethods[] =
{
{"dvbPlayNative","(I)Z",(void *) Java_com_chuangyi_cyfactorytest_glue_dvbplay_CyFacGlueDVB_dvbPlayNative},
{"dvbStopNative","(I)Z",(void *) Java_com_chuangyi_cyfactorytest_glue_dvbplay_CyFacGlueDVB_dvbStopNative},
括号里加上I
C 头文件cy_stop_play 的接口换为int
mm -B ok!!!
- JNI函数void-->int 传入整形变量
- 使用函数 void fun(int **p1,int **p2),交换两个变量的值?
- void (*f(int, void (*)(int)))(int) 函数解析
- void (*f(int, void (*)(int)))(int) 函数解析
- signal函数:void (*signal(int,void(*)(int)))(int);
- void (*f(int, void (*)(int)))(int) 函数解析
- void (*f(int, void (*)(int)))(int) 函数解析
- void (*f(int, void (*)(int)))(int) 函数解析
- 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数
- 四个 void swap(int&,int&) 函数
- [Algorithms, C] long2char: 自己用C写来玩玩的整形转化为字符串函数 (递归和迭代两种实现): void long2char(long from, char *to, int n);
- 通过qsort(void * lineptr[], int left, int rifht, int (*comp)(void *, void *))解读指针函数和void指针
- 注意java int整形变量的取值范围
- C语言 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- C语言实现 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- 函数传递参数为整形变量
- C语言outtextxy函数输出整形变量
- android中的shape标签
- openMP的一点使用经验
- 类似聊天一样下拉看以前的历史记录,一进来先显示数据库里已有的最后10条数据
- 编程的扇入与扇出
- windows下单机版的伪分布式solrCloud环境搭建Tomcat+solr+zookeeper
- JNI函数void-->int 传入整形变量
- oracle存储过程常用技巧
- Ubuntu 14.04下搭建Web服务器
- iOS - Concurrency Programming Guide (iOS并行编程指南)
- ssh 免密码登录
- android Activity返回数据到上一个Activity
- c++ 初始化列表
- .htaccess 详解
- 无线路由器当无线交换机后,如何进入路由器配置界面