kodi
PltFrameBuffer.h
1 /*****************************************************************
2 |
3 | Platinum - Frame Buffer
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
21 |
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
32 |
33 ****************************************************************/
34 
35 #ifndef _PLT_FRAME_BUFFER_H_
36 #define _PLT_FRAME_BUFFER_H_
37 
38 /*----------------------------------------------------------------------
39 | includes
40 +---------------------------------------------------------------------*/
41 #include "Neptune.h"
42 
43 /*----------------------------------------------------------------------
44 | PLT_FrameBuffer
45 +---------------------------------------------------------------------*/
47 {
48  public:
49  // constructor & destructor
50  PLT_FrameBuffer(const char* mime_type);
51  virtual ~PLT_FrameBuffer();
52 
53  void Reset();
54  void Abort();
55  void AddReader() { m_Readers.Increment(); }
56  void RemoveReader() { m_Readers.Decrement(); }
57  int GetNbReaders() { return m_Readers.GetValue(); }
58  const char* GetMimeType() { return m_MimeType; }
59 
60  // data buffer handling methods
61  virtual NPT_Result SetNextFrame(const NPT_Byte* buffer, NPT_Size bufferSize);
62  virtual NPT_Result GetNextFrame(NPT_UInt32& last_frame_index,
63  NPT_DataBuffer& buffer,
64  NPT_Timeout timeout = NPT_TIMEOUT_INFINITE);
65 
66  protected:
67  // members
68  NPT_String m_MimeType;
69  bool m_Aborted;
70  NPT_SharedVariable m_FrameIndex;
71  NPT_DataBuffer m_Frame;
72  NPT_Mutex m_FrameLock;
73  NPT_AtomicVariable m_Readers;
74 };
75 
76 #endif // _PLT_FRAME_BUFFER_H_
Definition: PltFrameBuffer.h:46
Definition: NptThreads.h:76
Definition: NptThreads.h:149
Definition: NptThreads.h:190
Definition: NptDataBuffer.h:44
Definition: NptStrings.h:57