-
Notifications
You must be signed in to change notification settings - Fork 244
/
Copy pathAdaptiveByteStream.cpp
62 lines (51 loc) · 1.52 KB
/
AdaptiveByteStream.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
/*
* Copyright (C) 2022 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "AdaptiveByteStream.h"
#include "common/AdaptiveStream.h"
// AP4_ByteStream methods
AP4_Result CAdaptiveByteStream::ReadPartial(void* buffer, AP4_Size bytesToRead, AP4_Size& bytesRead)
{
bytesRead = m_adStream->read(buffer, bytesToRead);
return bytesRead > 0 ? AP4_SUCCESS : AP4_ERROR_READ_FAILED;
}
AP4_Result CAdaptiveByteStream::WritePartial(const void* buffer,
AP4_Size bytesToWrite,
AP4_Size& bytesWritten)
{
/* unimplemented */
return AP4_ERROR_NOT_SUPPORTED;
}
bool CAdaptiveByteStream::ReadFull(std::vector<uint8_t>& buffer)
{
return m_adStream->ReadFullBuffer(buffer);
}
AP4_Result CAdaptiveByteStream::Seek(AP4_Position position)
{
return m_adStream->seek(position) ? AP4_SUCCESS : AP4_ERROR_NOT_SUPPORTED;
}
AP4_Result CAdaptiveByteStream::Tell(AP4_Position& position)
{
position = m_adStream->tell();
return AP4_SUCCESS;
}
AP4_Result CAdaptiveByteStream::GetSize(AP4_LargeSize& size)
{
return AP4_ERROR_NOT_SUPPORTED;
}
bool CAdaptiveByteStream::waitingForSegment() const
{
return m_adStream->waitingForSegment();
}
void CAdaptiveByteStream::FixateInitialization(bool on)
{
m_adStream->FixateInitialization(on);
}
void CAdaptiveByteStream::SetSegmentFileOffset(uint64_t offset)
{
m_adStream->SetSegmentFileOffset(offset);
}