2 * $Id: H264Nalu.h 3581 2011-08-05 16:26:10Z underground78 $
4 * (C) 2006-2011 see AUTHORS
6 * This file is part of mplayerc.
8 * Mplayerc is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * Mplayerc is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 NALU_TYPE_EOSTREAM
= 11,
44 int forbidden_bit
; //! should be always FALSE
45 int nal_reference_idc
; //! NALU_PRIORITY_xxxx
46 NALU_TYPE nal_unit_type
; //! NALU_TYPE_xxxx
48 int m_nNALStartPos
; //! NALU start (including startcode / size)
49 int m_nNALDataPos
; //! Useful part
50 unsigned m_nDataLen
; //! Length of the NAL unit (Excluding the start code, which does not belong to the NALU)
58 bool MoveToNextAnnexBStartcode();
59 bool MoveToNextRTPStartcode();
64 NALU_TYPE
GetType() const {
67 bool IsRefFrame() const {
68 return (nal_reference_idc
!= 0);
71 int GetDataLength() const {
72 return m_nCurPos
- m_nNALDataPos
;
74 BYTE
* GetDataBuffer() {
75 return m_pBuffer
+ m_nNALDataPos
;
77 int GetRoundedDataLength() const {
78 int nSize
= m_nCurPos
- m_nNALDataPos
;
79 return nSize
+ 128 - (nSize
%128);
82 int GetLength() const {
83 return m_nCurPos
- m_nNALStartPos
;
85 BYTE
* GetNALBuffer() {
86 return m_pBuffer
+ m_nNALStartPos
;
89 return m_nCurPos
>= m_nSize
;
92 void SetBuffer (BYTE
* pBuffer
, int nSize
, int nNALSize
);