-
Notifications
You must be signed in to change notification settings - Fork 14
/
h264.h
44 lines (34 loc) · 805 Bytes
/
h264.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
Copyright (C) 2009 Anton Burdinuk
clark15b@gmail.com
*/
#ifndef __H264_H
#define __H264_H
#include "common.h"
namespace h264
{
class counter
{
private:
u_int32_t ctx;
u_int64_t frame_num; // JVT NAL (h.264) frame counter
public:
counter(void):ctx(0),frame_num(0) {}
void parse(const char* p,int l)
{
for(int i=0;i<l;i++)
{
ctx=(ctx<<8)+((unsigned char*)p)[i];
if((ctx&0xffffff1f)==0x00000109) // NAL access unit
frame_num++;
}
}
u_int64_t get_frame_num(void) const { return frame_num; }
void reset(void)
{
ctx=0;
frame_num=0;
}
};
}
#endif