1 | |
---|
2 | |
---|
3 | /** \file TVideoIOBits.h |
---|
4 | \brief bitstream file I/O class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TVIDEOIOBITS__ |
---|
8 | #define __TVIDEOIOBITS__ |
---|
9 | |
---|
10 | #include <stdio.h> |
---|
11 | #include <fstream> |
---|
12 | #include <iostream> |
---|
13 | #include "../TLibCommon/CommonDef.h" |
---|
14 | #include "../TLibCommon/TComBitStream.h" |
---|
15 | |
---|
16 | // ==================================================================================================================== |
---|
17 | // Class definition |
---|
18 | // ==================================================================================================================== |
---|
19 | |
---|
20 | /// bitstream file I/O class |
---|
21 | class TVideoIOBits |
---|
22 | { |
---|
23 | private: |
---|
24 | std::fstream m_cHandle; ///< file handle |
---|
25 | |
---|
26 | public: |
---|
27 | TVideoIOBits() {} |
---|
28 | virtual ~TVideoIOBits() {} |
---|
29 | |
---|
30 | Void openBits ( char* pchFile, Bool bWriteMode ); ///< open or create file |
---|
31 | Void closeBits (); ///< close file |
---|
32 | |
---|
33 | Bool readBits ( TComBitstream*& rpcBitstream ); ///< read one packet from file |
---|
34 | Void writeBits ( TComBitstream* pcBitstream ); ///< write one packet to file |
---|
35 | |
---|
36 | }; |
---|
37 | |
---|
38 | /// bitstream file I/O class |
---|
39 | class TVideoIOBitsStartCode |
---|
40 | { |
---|
41 | private: |
---|
42 | std::fstream m_cHandle; ///< file handle |
---|
43 | |
---|
44 | public: |
---|
45 | TVideoIOBitsStartCode() |
---|
46 | { |
---|
47 | } |
---|
48 | virtual ~TVideoIOBitsStartCode() {} |
---|
49 | |
---|
50 | Void openBits ( char* pchFile, Bool bWriteMode ); ///< open or create file |
---|
51 | Void closeBits (); ///< close file |
---|
52 | |
---|
53 | Bool readBits ( TComBitstream*& rpcBitstream ); ///< read one packet from file |
---|
54 | Void writeBits ( TComBitstream* pcBitstream ); ///< write one packet to file |
---|
55 | |
---|
56 | std::streampos getFileLocation () { return m_cHandle.tellg(); } |
---|
57 | Void setFileLocation (std::streampos uiLocation) { m_cHandle.seekg(uiLocation, std::ios_base::beg); } |
---|
58 | Void clear () { m_cHandle.clear(); } |
---|
59 | Bool good () { return m_cHandle.good(); } |
---|
60 | |
---|
61 | private: |
---|
62 | int xFindNextStartCode(UInt& ruiPacketSize, UChar* pucBuffer); ///< get packet size and number of startcode bytes and seeks to the packet's start position |
---|
63 | |
---|
64 | }; |
---|
65 | |
---|
66 | #endif // __TVIDEOIOBITS__ |
---|
67 | |
---|