summaryrefslogtreecommitdiff
path: root/src/common/stream.h
diff options
context:
space:
mode:
authorGravatar bunnei2020-10-26 23:02:42 -0700
committerGravatar GitHub2020-10-26 23:02:42 -0700
commitd33399e1f46a10490b586196c6d0db0f04be4206 (patch)
tree8b2e1d98bf832049936ab931fc3a120e70bc36c2 /src/common/stream.h
parentMerge pull request #4832 from bunnei/cpu-manager-microprofile-fix (diff)
parentvideo_core: NVDEC Implementation (diff)
downloadyuzu-d33399e1f46a10490b586196c6d0db0f04be4206.tar.gz
yuzu-d33399e1f46a10490b586196c6d0db0f04be4206.tar.xz
yuzu-d33399e1f46a10490b586196c6d0db0f04be4206.zip
Merge pull request #4729 from ameerj/nvdec-prod
video_core: NVDEC Implementation
Diffstat (limited to 'src/common/stream.h')
-rw-r--r--src/common/stream.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/common/stream.h b/src/common/stream.h
new file mode 100644
index 000000000..2585c16af
--- /dev/null
+++ b/src/common/stream.h
@@ -0,0 +1,50 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <vector>
8#include "common/common_types.h"
9
10namespace Common {
11
12enum class SeekOrigin {
13 SetOrigin,
14 FromCurrentPos,
15 FromEnd,
16};
17
18class Stream {
19public:
20 /// Stream creates a bitstream and provides common functionality on the stream.
21 explicit Stream();
22 ~Stream();
23
24 /// Reposition bitstream "cursor" to the specified offset from origin
25 void Seek(s32 offset, SeekOrigin origin);
26
27 /// Reads next byte in the stream buffer and increments position
28 u8 ReadByte();
29
30 /// Writes byte at current position
31 void WriteByte(u8 byte);
32
33 std::size_t GetPosition() const {
34 return position;
35 }
36
37 std::vector<u8>& GetBuffer() {
38 return buffer;
39 }
40
41 const std::vector<u8>& GetBuffer() const {
42 return buffer;
43 }
44
45private:
46 std::vector<u8> buffer;
47 std::size_t position{0};
48};
49
50} // namespace Common