aboutsummaryrefslogtreecommitdiff
path: root/Src/libvp6/include/VPStreamData.hpp
blob: e1705020769ed04d782b1e06567951112c499b91 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#if !defined(VPSTREAMDATA_HPP)
#define VPSTREAMDATA_HPP
//______________________________________________________________________________
//
//  VPStreamData.hpp
//  

//______________________________________________________________________________
//  Include Files and Forward Declarations

#include "PlayerModel.hpp"
#include <vector>
#include <iosfwd>

namespace on2vp
{

//______________________________________________________________________________
//  Macro, Enumeration, and Constant Definitions

//______________________________________________________________________________
//  Type, Struct, and Class Definitions

    //--------------------------------------
    class StreamData
    {
        friend std::ostream& operator<<(std::ostream& os, const StreamData& sd);

    public:

        StreamData();
        StreamData(const unsigned char* const pData, unsigned long ulSize);
        StreamData(const StreamData& sd);
        ~StreamData();

        StreamData& operator=(const StreamData& sd);

        unsigned long versionOrig() const;
        unsigned long sizeOrig() const;
        unsigned long version() const;
        unsigned long size() const;
        const unsigned char* data() const;

        int data(const unsigned char* pData, unsigned long ulSize);

        //  Interpreted data

        const PlayerModel& playerModel() const;
        PlayerModel& playerModel();

        bool encrypted() const;
        void encrypted(bool bEncrypted);

    private:
        class VersionInfo
        {
        public:
            VersionInfo(long lVersion, long lSize, bool bExtra) :
                m_lVersion(lVersion),
                m_lSize(lSize),
                m_bExtra(bExtra)
            {
            }

            long version() const
            {
                return m_lVersion;
            }

            long size() const
            {
                return m_lSize;
            }

            bool extra() const
            {
                return m_bExtra;
            }

        private:
            long m_lVersion;
            long m_lSize;
            bool m_bExtra;
        };

        enum
        {
            VersionMax = 6
        };

        void init_();
        int extract_(const unsigned char* pData, unsigned long ulSize);
        void update_();

        static std::vector<VersionInfo> m_vVersionInfo;

        unsigned long m_ulVersionOrig;
        unsigned long m_ulSizeOrig;

        unsigned char* m_pData;
        long m_lDataSize;

        //  Interpreted data

        PlayerModel m_pm;
        bool m_bEncrypted;
    };

//______________________________________________________________________________
//  Object and Function Declarations

//______________________________________________________________________________
//  Object and Function Definitions

}  //  namespace on2vp

#endif  //  VPSTREAMDATA_HPP