source: tools/xupnpd/h264.h @ 41988

Last change on this file since 41988 was 34374, checked in by Stephan, 9 years ago

add xupnpd

File size: 805 bytes
Line 
1/*
2
3 Copyright (C) 2009 Anton Burdinuk
4
5 clark15b@gmail.com
6
7*/
8
9#ifndef __H264_H
10#define __H264_H
11
12#include "common.h"
13
14namespace h264
15{
16    class counter
17    {
18    private:
19        u_int32_t ctx;
20        u_int64_t frame_num;                            // JVT NAL (h.264) frame counter
21    public:
22        counter(void):ctx(0),frame_num(0) {}
23
24        void parse(const char* p,int l)
25        {
26            for(int i=0;i<l;i++)
27            {
28                ctx=(ctx<<8)+((unsigned char*)p)[i];
29                    if((ctx&0xffffff1f)==0x00000109)    // NAL access unit
30                        frame_num++;
31            }
32        }
33
34        u_int64_t get_frame_num(void) const { return frame_num; }
35
36        void reset(void)
37        {
38            ctx=0;
39            frame_num=0;
40        }
41    };
42}
43
44#endif
Note: See TracBrowser for help on using the repository browser.