Debian Codegraph @

src/lib/tsreader/MemorySink.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 #if defined LIVE555
32
33 #ifndef _MEDIA_SINK_HH
34 #include "MediaSink.hh" //Live555 header
35 #endif
36
37 #include "MemoryBuffer.h"
38 #include <mutex>
39
40 class CMemorySink: public MediaSink
41 {
42 public:
43 static CMemorySink* createNew(UsageEnvironment& env, CMemoryBuffer& buffer, size_t bufferSize = 20000);
44 void addData(unsigned char* data, size_t dataSize, struct timeval presentationTime);
45
46 protected:
47 CMemorySink(UsageEnvironment& env, CMemoryBuffer& buffer, size_t bufferSize = 20000);
48 virtual ~CMemorySink(void);
49
50 static void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds);
51 virtual void afterGettingFrame1(unsigned frameSize,struct timeval presentationTime);
52
53 unsigned char* fBuffer;
54 size_t fBufferSize;
55 CMemoryBuffer& m_buffer;
56
57 private: // redefined virtual functions:
58 virtual Boolean continuePlaying();
59
60 std::mutex m_BufferLock;
61 unsigned char* m_pSubmitBuffer;
62 int m_iSubmitBufferPos;
63 bool m_bReEntrant;
64 };
65 #endif //LIVE555