Shaka Packager SDK
offset_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_OFFSET_BYTE_QUEUE_H_
6 #define PACKAGER_MEDIA_BASE_OFFSET_BYTE_QUEUE_H_
7 
8 #include <cstdint>
9 
10 #include <packager/macros/classes.h>
11 #include <packager/media/base/byte_queue.h>
12 
13 namespace shaka {
14 namespace media {
15 
21  public:
23  ~OffsetByteQueue();
24 
27  void Reset();
28  void Push(const uint8_t* buf, int size);
29  void Peek(const uint8_t** buf, int* size);
30  void Pop(int count);
32 
39  void PeekAt(int64_t offset, const uint8_t** buf, int* size);
40 
50  bool Trim(int64_t max_offset);
51 
53  int64_t head() { return head_; }
56  int64_t tail() { return head_ + size_; }
57 
58  private:
59  // Synchronize |buf_| and |size_| with |queue_|.
60  void Sync();
61 
62  ByteQueue queue_;
63  const uint8_t* buf_;
64  int size_;
65  int64_t head_;
66 
67  DISALLOW_COPY_AND_ASSIGN(OffsetByteQueue);
68 };
69 
70 } // namespace media
71 } // namespace shaka
72 
73 #endif // PACKAGER_MEDIA_BASE_OFFSET_BYTE_QUEUE_H_
void PeekAt(int64_t offset, const uint8_t **buf, int *size)
bool Trim(int64_t max_offset)
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66