一、结构体定义的方法
VideoStreamInfo mVideoInfo1 = 0;
VideoStreamInfo *pVideoInfo1 = &mVideoInfo1;
VideoStreamInfo *pp = (VideoStreamInfo *)malloc(sizeof(VideoStreamInfo));
free(pp);
二、指针分配内存方法:
int *data_count1;
data_count1 = (int*)malloc(sizeof(int));
memset(data_count1, 0, sizeof(int));
三、码流提取
指针
动态内存非配
命名规则
fread()/fseek()指针跳转
fseek()
fseek(fp,0L,SEEK_END);末尾 0L代表偏移位数(可以为负)
fseek(fp,0L,SEEK_CUR);当前
fseek(fp,0L,SEEK_SET);开始
fopen(w)和fopen(ab) ab 代表连续写
四、解码器申请内存
VideoStreamInfo mVideoInfo1;
VideoStreamInfo* pVideoInfo1 = &mVideoInfo1 ;
pSpecilData1 = (char*)malloc(SPEC_DATA_SIZE);
五、读取码流文件
fread(&pVideoInfo1->eCodecFormat, 1, sizeof(int), fp);
六、解码器基本数据结构
VideoStreamInfo mVideoInfo1;
mVideoInfo1.eCodecFormat = VIDEO_CODEC_FORMAT_H263; 编码格式
VConfig vConfig;
extra frame buffer=
vConfig.nDisplayHoldingFrameBufferNum = 5;
vConfig.nRotateHoldingFrameBufferNum = 5;
vConfig.nDecodeSmoothFrameBufferNum = 5;
七、申请内存
struct ScMemOpsS* memops = MemAdapterGetOpsS();
vConfig.memops = memops;
八、基本数据结构
码流基本信息 :mVideoInfo1
解码器配置信息: vConfig
InitializeVideoDecoder(pVideo, &mVideoInfo1, &vConfig)
九、请求码流
datalen: 码流数据一笔一笔
RequestVideoStreamBuffer(pVideo,
dataLen,
(char**)&buf,
&buflen,
(char**)&ringBuf,
&ringBufLen,
0)
buffer循环方法
if(buflen >= dataLen)
{
memcpy(buf,AwspData,dataLen); //copy data to buf
}
else{
memcpy(buf,AwspData,buflen); //the first part of data
memcpy(ringBuf,AwspData+buflen,dataLen - buflen); //the left part of data
}
一笔码流数据是否开始结束
DataInfo.bIsFirstPart = 1;
DataInfo.bIsLastPart = 1;
VideoStreamDataInfo DataInfo; 码流数据信息
SubmitVideoStreamData(pVideo, &DataInfo, 0)
DecodeVideoStream(pVideo, endofstream, decodekeyframeonly,
dropBFrameifdelay, currenttimeus);
十、返回值
VDECODE_RESULT_UNSUPPORTED = -1,
VDECODE_RESULT_OK = 0,
VDECODE_RESULT_FRAME_DECODED = 1,
VDECODE_RESULT_CONTINUE = 2,
VDECODE_RESULT_KEYFRAME_DECODED = 3,
VDECODE_RESULT_NO_FRAME_BUFFER = 4,
VDECODE_RESULT_NO_BITSTREAM = 5,
VDECODE_RESULT_RESOLUTION_CHANGE = 6,
(11)内存:
#ifdef #else #endif (如果定义执行1) 只能判断一个宏
#ifndef #else #endif (如果定义执行1)
DMA_HEAP(连续内存)、SYSTEM_HEAP(非连续内存)
CACHED_FLAG(自动同步)、SUNC_FLAG(手动同步)
#if #elif #else #endif (判断多个宏)