Shaka Packager SDK
Loading...
Searching...
No Matches
byte_queue.h
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PACKAGER_MEDIA_BASE_BYTE_QUEUE_H_
6#define PACKAGER_MEDIA_BASE_BYTE_QUEUE_H_
7
8#include <cstdint>
9#include <memory>
10
11#include <packager/macros/classes.h>
12
13namespace shaka {
14namespace media {
15
21class ByteQueue {
22 public:
23 ByteQueue();
24 ~ByteQueue();
25
27 void Reset();
28
30 void Push(const uint8_t* data, int size);
31
34 void Peek(const uint8_t** data, int* size) const;
35
38 void Pop(int count);
39
40 private:
41 // Returns a pointer to the front of the queue.
42 uint8_t* front() const;
43
44 std::unique_ptr<uint8_t[]> buffer_;
45
46 // Size of |buffer_|.
47 size_t size_;
48
49 // Offset from the start of |buffer_| that marks the front of the queue.
50 size_t offset_;
51
52 // Number of bytes stored in the queue.
53 int used_;
54
55 DISALLOW_COPY_AND_ASSIGN(ByteQueue);
56};
57
58} // namespace media
59} // namespace shaka
60
61#endif // PACKAGER_MEDIA_BASE_BYTE_QUEUE_H_
void Pop(int count)
Definition byte_queue.cc:70
void Peek(const uint8_t **data, int *size) const
Definition byte_queue.cc:63
void Reset()
Reset the queue to the empty state.
Definition byte_queue.cc:25
void Push(const uint8_t *data, int size)
Append new bytes to the end of the queue.
Definition byte_queue.cc:30
All the methods that are virtual are virtual for mocking.