代码拉取完成,页面将自动刷新
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class H264Decoder */
#include "H264Decoder.h"
#ifndef _Included_H264Decoder
#define _Included_H264Decoder
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: H264Decoder
* Method: nativeH264init
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_H264Decoder_nativeH264init
(JNIEnv *env, jobject){
jlong result = (jlong)new H264Decoder();
return result;
}
/*
* Class: H264Decoder
* Method: nativeH264decode
* Signature: (J[BI)[B
*/
JNIEXPORT jbyteArray JNICALL Java_H264Decoder_nativeH264decode
(JNIEnv *env, jobject jobj, jlong thiz, jbyteArray frm, jint jlen){
H264Decoder * decoder = ((H264Decoder*)thiz);
int len = jlen;// jint is long in C++,
jbyte* bBuffer = env->GetByteArrayElements(frm,NULL);//remeber to get element
unsigned char * buf = (unsigned char *)bBuffer;
decoder->decode(buf,len);
cv::Mat result = decoder->getMat();
if(result.data!=nullptr){
int offset = sizeof(int)/sizeof(unsigned char);
offset*=2;
int matSize[2]= {result.rows,result.cols};
int size = result.total()*result.elemSize();
jbyteArray resultArray = env->NewByteArray(size+offset);
jbyte* array = env->GetByteArrayElements(resultArray,JNI_FALSE);
memcpy(array,matSize,sizeof(matSize));
memcpy(array+offset,result.data,size);
env->ReleaseByteArrayElements(resultArray,array,JNI_FALSE);
return resultArray;
}
else{
return nullptr;
}
}
#ifdef __cplusplus
}
#endif
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。