Remove unused ProjectConfiguration
[xy_vsfilter.git] / src / dsutil / H264Nalu.h
blob9041b71764e9738477b62f66dcd1b68884e4494e
1 /*
2 * (C) 2006-2012 see Authors.txt
4 * This file is part of MPC-HC.
6 * MPC-HC is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * MPC-HC is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 typedef enum {
24 NALU_TYPE_SLICE = 1,
25 NALU_TYPE_DPA = 2,
26 NALU_TYPE_DPB = 3,
27 NALU_TYPE_DPC = 4,
28 NALU_TYPE_IDR = 5,
29 NALU_TYPE_SEI = 6,
30 NALU_TYPE_SPS = 7,
31 NALU_TYPE_PPS = 8,
32 NALU_TYPE_AUD = 9,
33 NALU_TYPE_EOSEQ = 10,
34 NALU_TYPE_EOSTREAM = 11,
35 NALU_TYPE_FILL = 12
36 } NALU_TYPE;
38 class CH264Nalu
40 private:
41 int forbidden_bit; //! should be always FALSE
42 int nal_reference_idc; //! NALU_PRIORITY_xxxx
43 NALU_TYPE nal_unit_type; //! NALU_TYPE_xxxx
45 int m_nNALStartPos; //! NALU start (including startcode / size)
46 int m_nNALDataPos; //! Useful part
48 BYTE* m_pBuffer;
49 int m_nCurPos;
50 int m_nNextRTP;
51 int m_nSize;
52 int m_nNALSize;
54 bool MoveToNextAnnexBStartcode();
55 bool MoveToNextRTPStartcode();
57 public:
58 CH264Nalu() :
59 forbidden_bit(0),
60 nal_reference_idc(0),
61 nal_unit_type() {
62 SetBuffer(NULL, 0, 0);
65 NALU_TYPE GetType() const { return nal_unit_type; };
66 bool IsRefFrame() const { return (nal_reference_idc != 0); };
68 int GetDataLength() const { return m_nCurPos - m_nNALDataPos; };
69 BYTE* GetDataBuffer() { return m_pBuffer + m_nNALDataPos; };
70 int GetRoundedDataLength() const {
71 int nSize = m_nCurPos - m_nNALDataPos;
72 return nSize + 128 - (nSize % 128);
75 int GetLength() const { return m_nCurPos - m_nNALStartPos; };
76 BYTE* GetNALBuffer() { return m_pBuffer + m_nNALStartPos; };
77 bool IsEOF() const { return m_nCurPos >= m_nSize; };
79 void SetBuffer(BYTE* pBuffer, int nSize, int nNALSize);
80 bool ReadNext();