/
RTSPFileReader.cpp
99 lines (79 loc) · 1.82 KB
/
RTSPFileReader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <streams.h>
#include "RTSPFileReader.h"
CRTSPFileReader::CRTSPFileReader(SharedMemory* pSharedMemory)
:FileReader(pSharedMemory)
,m_client(m_memoryBuffer)
{
}
CRTSPFileReader::~CRTSPFileReader()
{
}
CRTSPFileReader* CRTSPFileReader::CreateFileReader()
{
return new CRTSPFileReader(NULL);
}
HRESULT CRTSPFileReader::OpenFile()
{
// Open the URL, to get a SDP description:
char url[MAX_PATH];
WideCharToMultiByte(CP_ACP,0,m_pFileName,-1,url,MAX_PATH,0,0);
if (m_client.Initialize())
{
if (m_client.OpenStream(url))
{
m_client.Play();
return S_OK;
}
}
return E_FAIL;
}
HRESULT CRTSPFileReader::CloseFile()
{
return NOERROR;
}
HRESULT CRTSPFileReader::Read(PBYTE pbData, ULONG lDataLength, ULONG *dwReadBytes)
{
*dwReadBytes= m_memoryBuffer.ReadFromBuffer(pbData,lDataLength,0);
return NOERROR;
}
HRESULT CRTSPFileReader::Read(PBYTE pbData, ULONG lDataLength, ULONG *dwReadBytes, __int64 llDistanceToMove, DWORD dwMoveMethod)
{
*dwReadBytes= m_memoryBuffer.ReadFromBuffer(pbData,lDataLength,0);
return NOERROR;
}
HRESULT CRTSPFileReader::GetFileSize(__int64 *pStartPosition, __int64 *pLength)
{
*pStartPosition=0LL;
*pLength=0LL;
return S_OK;
}
HRESULT CRTSPFileReader::GetInfoFileSize(__int64 *lpllsize)
{
*lpllsize=0LL;
return S_OK;
}
HRESULT CRTSPFileReader::GetStartPosition(__int64 *lpllpos)
{
*lpllpos=0LL;
return S_OK;
}
BOOL CRTSPFileReader::IsFileInvalid()
{
return true;
}
DWORD CRTSPFileReader::SetFilePointer(__int64 llDistanceToMove, DWORD dwMoveMethod)
{
return 0;
}
__int64 CRTSPFileReader::GetFilePointer()
{
return 0;
}
DWORD CRTSPFileReader::setFilePointer(__int64 llDistanceToMove, DWORD dwMoveMethod)
{
return 0;
}
__int64 CRTSPFileReader::getFilePointer()
{
return 0;
}