- 此文件用于演示如何使用C++解析H264文件,便于刚入门音视频的朋友学习,建议参考协议学习!
#include <iostream>
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
typedef enum {
NALU_TYPE_SLICE = 1,
NALU_TYPE_DPA = 2,
NALU_TYPE_DPB = 3,
NALU_TYPE_DPC = 4,
NALU_TYPE_IDR = 5,
NALU_TYPE_SEI = 6,
NALU_TYPE_SPS = 7,
NALU_TYPE_PPS = 8,
NALU_TYPE_AUD = 9,
NALU_TYPE_EOSEQ = 10,
NALU_TYPE_EOSTREAM = 11,
NALU_TYPE_FILL = 12,
} NaluType;
typedef enum {
NALU_PRIORITY_DISPOSABLE = 0,
NALU_PRIRITY_LOW = 1,
NALU_PRIORITY_HIGH = 2,
NALU_PRIORITY_HIGHEST = 3
} NaluPriority;
void printfH264(int j, int i, int nLen, int nFrameType)
{
printf("%d %d", j, i);
int nForbiddenBit = (nFrameType >> 7) & 0x1;
int nReference_idc = (nFrameType >> 5) & 0x03;
int nType = nFrameType & 0x1f;