Ejemplo n.º 1
0
/*
 * Class:     h264_com_VView
 * Method:    InitDecoder
 * Signature: ()I
 */
jlong Java_h264_com_VView_InitDecoder(JNIEnv* env, jobject thiz)
{
	CreateYUVTab_16();
	Decoder * de  = (Decoder *)av_malloc(sizeof(Decoder));
	de->c = avcodec_alloc_context();

	avcodec_open(de->c);

	de->picture  = avcodec_alloc_frame();//picture= malloc(sizeof(AVFrame));
		
	return (jlong)de;
}
Ejemplo n.º 2
0
/*
 * Class:     h264_com_VView
 * Method:    InitDecoder
 * Signature: ()I
 */
jint Java_h264_com_VView_InitDecoder(JNIEnv* env, jobject thiz, jint width, jint height)
{
	iWidth = width;
	iHeight = height;

	CreateYUVTab_16();
	
	c = avcodec_alloc_context(); 

	avcodec_open(c); 

	picture  = avcodec_alloc_frame();//picture= malloc(sizeof(AVFrame));
		
	return 1;
}
Ejemplo n.º 3
0
/*
 * Class:     com_zhutieju_testservice_H264Android
 * Method:    initDecoder
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_com_zhutieju_testservice_H264Android_initDecoder
  (JNIEnv* env, jobject thiz, jint width, jint height)
{
	iWidth = width;
	iHeight = height;

	CreateYUVTab_16();
	
	avcodec_init();
	avcodec_register_all();
	//找到H264解码器
	codec = avcodec_find_decoder(CODEC_ID_H264);
	//分配解码器内存
	c = avcodec_alloc_context();
	//打开解码器
	avcodec_open(c,codec);
	//给解码器解码后的帧数据分配存储空间
	picture  = avcodec_alloc_frame();//picture= malloc(sizeof(AVFrame));

	return 1;
}