资源简介
详细内容见博客:https://blog.csdn.net/li_wen01/article/details/81146461
代码片段和文件信息
/************************************************************
*FileName: avilib.c
*Date: 2018-07-15
*Author: Wen Lee
*Version: V1.0
*Description: AVI 音视频格式封装
*Others:
*History:
***********************************************************/
#include “avilib.h“
static AVI_S g_stAVIPara;
static WAV_S g_stWAVPara;
static void Int2Str(unsigned char *dst int n)
{
dst[0] = (n)&0xff;
dst[1] = (n>> 8)&0xff;
dst[2] = (n>>16)&0xff;
dst[3] = (n>>24)&0xff;
return;
}
#define OUT4CC(s) \
if(s64Nhb<=HEADERBYTES-4) memcpy(arrAVI_header+s64Nhbs4); s64Nhb += 4
#define OUTLONG(n) \
if(s64Nhb<=HEADERBYTES-4) Int2Str(arrAVI_header+s64Nhbn); s64Nhb += 4
#define OUTSHRT(n) \
if(s64Nhb<=HEADERBYTES-2) { \
arrAVI_header[s64Nhb ] = (n )&0xff; \
arrAVI_header[s64Nhb+1] = (n>>8)&0xff; \
} \
s64Nhb += 2
typedef struct IDRIndex
{
short s16IdrNo;
char arrBCDTime[6];
int s32OffsetAddr;
char arrResv[4];
}__attribute__ ((packed))IDR_INDEX_S;
int HstAviHeaderWrite(void)
{
long s64Nhb;
//int s32Strl_start;
int s32Hdrl_start s32Audio_strl_start;
int s32Njunk s32Sampsize s32HasIndex s32Ms_per_frame s32Frate s32Idxerror s32Flag;
unsigned char arrAVI_header[HEADERBYTES];
unsigned int l_u32AVILen = 0;
unsigned int j = 0;
if(g_stAVIPara.u32AviLen > 0)
{
l_u32AVILen = g_stAVIPara.u32AviLen;
}
else
{
l_u32AVILen = 0;
}
s32Idxerror = 0;
s32HasIndex =0;
if(g_stAVIPara.u32MustUseIndex ==1)
{
s32HasIndex =1;
}
if(g_stAVIPara.u64fps < 0.001)
{
s32Frate=0;
s32Ms_per_frame=0;
}
else
{
s32Frate = (int) (frame_RATE_SCALE*g_stAVIPara.u64fps + 0.5);
s32Ms_per_frame=(int) (1000000/g_stAVIPara.u64fps + 0.5);
}
s64Nhb = 0;
/* The RIFF header */
OUT4CC (“RIFF“);
OUTLONG(l_u32AVILen); /* # of bytes to follow */
OUT4CC (“AVI “);
/* Start the header list */
OUT4CC (“LIST“);
OUTLONG(0); /* Length of list in bytes don‘t know yet */
s32Hdrl_start = s64Nhb; /* Store start position */
OUT4CC (“hdrl“);
/* The main AVI header */
/* The Flags in AVI File header*/
OUT4CC (“avih“);
OUTLONG(56); /* # of bytes to follow */
OUTLONG(s32Ms_per_frame); /* Microseconds per frame */
OUTLONG(0);
/**Specifies the alignment for data in bytes.
Pad the data to multiples of this value.**/
OUTLONG(g_stAVIPara.u32Gop);
s32Flag = AVIF_ISINTERLEAVED;
if(s32HasIndex) s32Flag |= AVIF_HASINDEX;
if(s32HasIndex && g_stAVIPara.u32MustUseIndex) s32Flag |= AVIF_TRUSTCKTYPE;
OUTLONG(s32Flag); /* Flags */
OUTLONG(g_stAVIPara.u32Videoframes); /* Vedio Totalframes */
OUTLONG(0); /* Initialframes */
OUTLONG(g_stAVIPara.u32StreamNum); /**Be Careful streams = 1**/
OUTLONG(0); /* SuggestedBufferSize */
相关资源
- 使用RTP协议发送和接收H264的(支持解
- C++面向对象程序设计(第五版)alte
- RTSP PUSH tcp udp h264 easydarwin
- C++实战源码-AVI文件压缩工具
- C++面向对象程序设计第七版Walter Sav
- H264视频解压缩封装 c++
- RTSP服务器 C语言
- avilib库源C代码
- C++入门经典(第9版) ([美]Walter Sa
- C++面向对象程序设计第6版美Walter Sa
- libx264最新稳定版本附WINDOWS下编译步骤
- MFC写的录屏代码,保存格式为AVI
- OpenCV在TI 达芬奇以及OMAP平台下的移植
-
avipla
yer一个播放器 - C++ AVI播放器
- vc++6.0 mfc 关于播放.AVI格式的文件源代
- C++入门经典(第10版) Problem Solving
- Gravity: BMI160 6轴惯性运动传 感器
- mp4v2封装h264 AAC
- C++实战源码-将AVI动画分解成BMP位图
- C++实战源码-将BMP位图组合成AVI动画
- C++ 解码h264
- c++ 连续的bmp图片转avi
- h.264编解码程序
- 基于S3C6410+CMOS摄像头的H264图像压缩
- vc中基于mfc采集视频并且保存成avi格式
- 视频帧提取。bmp位图合成为avi视频
评论
共有 条评论