此生既入苦寒山,何妨再攀险峰!
分类: LINUX
2015-01-29 11:06:11
正常情况下的两路视频码流发送,aimer39平台框架已经实现。报警情况下的视频码流编码,需要独立调用视频库接口实现。
特别需要注意,在三路码流并发执行情况下,第三路码流编码时 需要复位视频库。
第三路视频编码简单流程:
1. open_encode(int width, int height, int real_width, int real_height);
2. frame_encode(T_pVOID hvs1, void *pinbuf, void **poutbuf, unsigned long *size);
简单参考实现:
static T_pVOID open_encode(int width, int height, int real_width, int real_height)
{
T_VIDEOLIB_ENC_OPEN_INPUT open_input;
T_U32 temp;
outbuf = akuio_alloc_pmem(ENCMEM);
if (AK_NULL == outbuf)
{
return AK_NULL;
}
temp = akuio_vaddr2paddr(outbuf) & 7;
//编码buffer 起始地址必须8字节对齐
encbuf = ((T_U8 *)outbuf) + ((8-temp)&7);
open_input.encFlag = VIDEO_DRV_MJPEG;
open_input.encMJPEGPar.frameType = ENC_YUV420_PLANAR;//JPEGENC_YUV420_PLANAR;
open_input.encMJPEGPar.format = ENC_THUMB_JPEG;
open_input.encMJPEGPar.thumbWidth = 0;
open_input.encMJPEGPar.thumbHeight = 0;
open_input.encMJPEGPar.thumbData = NULL;
open_input.encMJPEGPar.thumbDataLen = 0;
open_input.encMJPEGPar.qLevel = 7;
open_input.encMJPEGPar.width = 640;
open_input.encMJPEGPar.height = 480;
open_input.encMJPEGPar.lumWidthSrc = 640;
open_input.encMJPEGPar.lumHeightSrc =480;
open_input.encMJPEGPar.horOffsetSrc = 0;
open_input.encMJPEGPar.verOffsetSrc =0;
return VideoStream_Enc_Open(&open_input);
}
int photograph( void *pbuf, int size)
{
unsigned long outsize;
int ret;
VideoStream_Enc_Reset();
ret = frame_encode(h_eid, pbuf, &buf, &outsize);
VideoStream_Enc_Reset();
return 0;
}