Debian Codegraph @

src/lib/tsreader/MemoryBuffer.h

raw
1 #pragma once
2 /*
3 * Copyright (C) 2005-2012 Team Kodi
4 * https://kodi.tv
5 *
6 * This program 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 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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.
15 *
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/>.
18 *
19 *************************************************************************
20 * This file is a modified version from Team MediaPortal's
21 * TsReader DirectShow filter
22 * MediaPortal is a GPL'ed HTPC-Application
23 * Copyright (C) 2005-2012 Team MediaPortal
24 * http://www.team-mediaportal.com
25 *
26 * Changes compared to Team MediaPortal's version:
27 * - Code cleanup for PVR addon usage
28 * - Code refactoring for cross platform usage
29 */
30
31 #ifdef LIVE555
32
33 #include <condition_variable>
34 #include <mutex>
35 #include <vector>
36
37 class CMemoryBuffer
38 {
39 public:
40 CMemoryBuffer(void);
41 virtual ~CMemoryBuffer(void);
42
43 size_t ReadFromBuffer(unsigned char *pbData, size_t lDataLength);
44 long PutBuffer(unsigned char *pbData, size_t lDataLength);
45 void Clear();
46 size_t Size();
47 void Run(bool onOff);
48 bool IsRunning();
49
50 typedef struct
51 {
52 unsigned char* data;
53 size_t nDataLength;
54 size_t nOffset;
55 } BufferItem;
56
57 protected:
58 std::vector<BufferItem *> m_Array;
59 std::mutex m_BufferLock;
60 size_t m_BytesInBuffer;
61 std::condition_variable m_condition;
62 bool m_bRunning;
63 };
64 #endif //LIVE555