x264软编码(jni接口)

这篇博客深入探讨了x264软编码技术,通过JNI接口在Android平台上实现高效视频编码。内容涵盖x264编码库的使用、JNI接口设计与调用、以及在实际应用中的性能优化策略。
摘要由CSDN通过智能技术生成

链接地址:http://download.csdn.net/detail/yuanchunsi/9895103



//  x264.c
//  jni
//
//  
//  create by yuanchunsi.



#include <jni.h>  
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
#include <arpa/inet.h>  
#include <stdbool.h>  
#include <pthread.h>  

#include "stdint.h"  
#include "utils_jni.h"  
#include "utils/log.h"
#include "utils/queue.h"



#if defined ( __cplusplus)  
extern "C"  
{  
#include "x264.h"  
};  
#else  
#include "x264.h"  
#endif  

typedef struct _Encoder{  
  x264_param_t * param;  
  x264_t *handle;  
  x264_picture_t * picture;  
  x264_nal_t  *nal;  
} Encoder; 

typedef struct _packet{
  char *in;
  int insize;
} packet_t;


Encoder * encoder = NULL;
static queue_t * queue = NULL;
static pthread_t encoder_id;
static bool encoder_stop ;
static FILE* fp_dst = NULL;

static void* encoder_run(void *data) {

  int ret;  
  int y_size;  
  //int i,j;  
  //int iNal   = -1;  
  //int frame_num = 0;

  pthread_detach(pthread_self());


  pthread_t thid;
  struct sched_param param;
  thid = pthread_self();
  param.sched_priority = sched_get_priority_max(SCHED_RR);
  pthread_setschedparam(thid,SCHED_RR,¶m);


  Encoder *en = (Encoder*)data;
  if (NULL == en) {
    ERROR("Invaid data\n");
    return NULL;
  }
  //fp_ds
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值