当前位置: 编程技术>移动开发
本页文章导读:
▪jni参数的变换(3) jni参数的转换(3)
1.java中:private native FFMpegAVFormatContext native_av_setInputFile(String filePath) throws IOException;JNI中:static jobject FFMpeg_setInputFile(JNIEnv *env, jobject obj, jstring filePath) { const char *_filePath = (*e.........
▪ fleep滑动切换tab(切换牵动画) fleep滑动切换tab(切换带动画)
从右向左滑动,tab页切换后的效果主要代码1:继承TabHost覆写setCurrentTab(int index)方法@Override
public void setCurrentTab(int index) {
//index为要切换到的tab页索引,currentTabI.........
▪ hadoop排序跟google三大论文 hadoop排序和google三大论文
见附近内容。
......
[1]jni参数的变换(3)
来源: 互联网 发布时间: 2014-02-18
jni参数的转换(3)
1.
java中:
private native FFMpegAVFormatContext native_av_setInputFile(String filePath) throws IOException;
JNI中:
static jobject FFMpeg_setInputFile(JNIEnv *env, jobject obj, jstring filePath) {
const char *_filePath = (*env)->GetStringUTFChars(env, filePath, NULL);
AVFormatContext *fileContext = opt_input_file(_filePath);
if(fileContext == NULL) {
jniThrowException(env,
"java/io/IOException",
"Can't create input file");
}
jobject *file = AVFormatContext_create(env, fileContext);
jobject *inFormat = AVInputFormat_create(env, fileContext->iformat);
jfieldID f = (*env)->GetFieldID(env,
AVFormatContext_getClass(env),
"mInFormat",
AVInputFormat_getClassSignature());
(*env)->SetObjectField(env, file, f, inFormat);
return file;
}
2.
java中:
private native FFMpegAVFormatContext native_av_setOutputFile(String filePath) throws IOException;
JNI中:
static jobject FFMpeg_setOutputFile(JNIEnv *env, jobject obj, jstring filePath) {
const char *_filePath = (*env)->GetStringUTFChars(env, filePath, NULL);
AVFormatContext *fileContext = opt_output_file(_filePath);
if(fileContext == NULL) {
jniThrowException(env,
"java/io/IOException",
"Can't create output file");
}
return AVFormatContext_create(env, fileContext);
}
3.private native void native_av_parse_options(String[] args) throws RuntimeException;
static void FFMpeg_parseOptions(JNIEnv *env, jobject obj, jobjectArray args) {
int i = 0;
int argc = 0;
char **argv = NULL;
if (args != NULL) {
argc = (*env)->GetArrayLength(env, args);
argv = (char **) malloc(sizeof(char *) * argc);
for(i=0;i<argc;i++)
{
jstring str = (jstring)(*env)->GetObjectArrayElement(env, args, i);
argv[i] = (char *)(*env)->GetStringUTFChars(env, str, NULL);
}
}
/* parse options */
parse_options(argc, argv, options, opt_output_file);
if(nb_output_files <= 0 && nb_input_files == 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"Use -h to get full help or, even better, run 'man ffmpeg");
}
/* file converter / grab */
if (nb_output_files <= 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"At least one output file must be specified");
}
if (nb_input_files == 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"At least one input file must be specified");
}
}
4.
1.
java中:
private native FFMpegAVFormatContext native_av_setInputFile(String filePath) throws IOException;
JNI中:
static jobject FFMpeg_setInputFile(JNIEnv *env, jobject obj, jstring filePath) {
const char *_filePath = (*env)->GetStringUTFChars(env, filePath, NULL);
AVFormatContext *fileContext = opt_input_file(_filePath);
if(fileContext == NULL) {
jniThrowException(env,
"java/io/IOException",
"Can't create input file");
}
jobject *file = AVFormatContext_create(env, fileContext);
jobject *inFormat = AVInputFormat_create(env, fileContext->iformat);
jfieldID f = (*env)->GetFieldID(env,
AVFormatContext_getClass(env),
"mInFormat",
AVInputFormat_getClassSignature());
(*env)->SetObjectField(env, file, f, inFormat);
return file;
}
2.
java中:
private native FFMpegAVFormatContext native_av_setOutputFile(String filePath) throws IOException;
JNI中:
static jobject FFMpeg_setOutputFile(JNIEnv *env, jobject obj, jstring filePath) {
const char *_filePath = (*env)->GetStringUTFChars(env, filePath, NULL);
AVFormatContext *fileContext = opt_output_file(_filePath);
if(fileContext == NULL) {
jniThrowException(env,
"java/io/IOException",
"Can't create output file");
}
return AVFormatContext_create(env, fileContext);
}
3.private native void native_av_parse_options(String[] args) throws RuntimeException;
static void FFMpeg_parseOptions(JNIEnv *env, jobject obj, jobjectArray args) {
int i = 0;
int argc = 0;
char **argv = NULL;
if (args != NULL) {
argc = (*env)->GetArrayLength(env, args);
argv = (char **) malloc(sizeof(char *) * argc);
for(i=0;i<argc;i++)
{
jstring str = (jstring)(*env)->GetObjectArrayElement(env, args, i);
argv[i] = (char *)(*env)->GetStringUTFChars(env, str, NULL);
}
}
/* parse options */
parse_options(argc, argv, options, opt_output_file);
if(nb_output_files <= 0 && nb_input_files == 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"Use -h to get full help or, even better, run 'man ffmpeg");
}
/* file converter / grab */
if (nb_output_files <= 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"At least one output file must be specified");
}
if (nb_input_files == 0) {
jniThrowException(env,
"java/lang/RuntimeException",
"At least one input file must be specified");
}
}
4.
[2] fleep滑动切换tab(切换牵动画)
来源: 互联网 发布时间: 2014-02-18
fleep滑动切换tab(切换带动画)
从右向左滑动,tab页切换后的效果
主要代码1:继承TabHost覆写setCurrentTab(int index)方法
2:实现OnGestureListener接口,覆写onFling()方法
从右向左滑动,tab页切换后的效果
主要代码1:继承TabHost覆写setCurrentTab(int index)方法
@Override public void setCurrentTab(int index) { //index为要切换到的tab页索引,currentTabIndex为现在要当前tab页的索引 int currentTabIndex = getCurrentTab(); //设置当前tab页退出时的动画 if (null != getCurrentView()){//第一次进入MainActivity时,getCurrentView()取得的值为空 if (currentTabIndex == (tabCount - 1) && index == 0) {//处理边界滑动 getCurrentView().startAnimation(slideLeftOut); } else if (currentTabIndex == 0 && index == (tabCount - 1)) {//处理边界滑动 getCurrentView().startAnimation(slideRightOut); } else if (index > currentTabIndex) {//非边界情况下从右往左fleep getCurrentView().startAnimation(slideLeftOut); } else if (index < currentTabIndex) {//非边界情况下从左往右fleep getCurrentView().startAnimation(slideRightOut); } } super.setCurrentTab(index); //设置即将显示的tab页的动画 if (currentTabIndex == (tabCount - 1) && index == 0){//处理边界滑动 getCurrentView().startAnimation(slideLeftIn); } else if (currentTabIndex == 0 && index == (tabCount - 1)) {//处理边界滑动 getCurrentView().startAnimation(slideRightIn); } else if (index > currentTabIndex) {//非边界情况下从右往左fleep getCurrentView().startAnimation(slideLeftIn); } else if (index < currentTabIndex) {//非边界情况下从左往右fleep getCurrentView().startAnimation(slideRightIn); } }
2:实现OnGestureListener接口,覆写onFling()方法
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) { if (e1.getX() - e2.getX() <= (-FLEEP_DISTANCE)) {//从左向右滑动 currentTabID = tabHost.getCurrentTab() - 1; if (currentTabID < 0) { currentTabID = tabHost.getTabCount() - 1; } } else if (e1.getX() - e2.getX() >= FLEEP_DISTANCE) {//从右向左滑动 currentTabID = tabHost.getCurrentTab() + 1; if (currentTabID >= tabHost.getTabCount()) { currentTabID = 0; } } tabHost.setCurrentTab(currentTabID); return false; }
[3] hadoop排序跟google三大论文
来源: 互联网 发布时间: 2014-02-18
hadoop排序和google三大论文
见附近内容。
见附近内容。
最新技术文章: