Debian Codegraph @

src/lib/tsreader/MemoryReader.cpp

raw
1 /*
2 * Copyright (C) 2005-2012 Team Kodi
3 * https://kodi.tv
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 *************************************************************************
19 * This file is a modified version from Team MediaPortal's
20 * TsReader DirectShow filter
21 * MediaPortal is a GPL'ed HTPC-Application
22 * Copyright (C) 2005-2012 Team MediaPortal
23 * http://www.team-mediaportal.com
24 *
25 * Changes compared to Team MediaPortal's version:
26 * - Code cleanup for PVR addon usage
27 * - Code refactoring for cross platform usage
28 */
29
30 #ifdef LIVE555
31
32 #include "MemoryReader.h"
33
34 namespace MPTV
35 {
36 CMemoryReader::CMemoryReader(CMemoryBuffer& buffer)
37 :m_buffer(buffer)
38 {
39 }
40
41 CMemoryReader::~CMemoryReader(void)
42 {
43 }
44
45 long CMemoryReader::Read(unsigned char* pbData, size_t lDataLength, size_t *dwReadBytes)
46 {
47 *dwReadBytes = m_buffer.ReadFromBuffer(pbData, lDataLength);
48 if ((*dwReadBytes) == 0)
49 return S_FALSE;
50 return S_OK;
51 }
52
53 int64_t CMemoryReader::SetFilePointer(int64_t llDistanceToMove, unsigned long dwMoveMethod)
54 {
55 return 0;
56 }
57
58 size_t CMemoryReader::HasData()
59 {
60 return (m_buffer.Size());
61 }
62 }
63
64 #endif //LIVE555