Shaka Packager SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
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 MEDIA_BASE_OFFSET_BYTE_QUEUE_H_
6 #define MEDIA_BASE_OFFSET_BYTE_QUEUE_H_
7 
8 #include <stdint.h>
9 
10 #include "packager/media/base/byte_queue.h"
11 
12 namespace shaka {
13 namespace media {
14 
20  public:
22  ~OffsetByteQueue();
23 
26  void Reset();
27  void Push(const uint8_t* buf, int size);
28  void Peek(const uint8_t** buf, int* size);
29  void Pop(int count);
31 
38  void PeekAt(int64_t offset, const uint8_t** buf, int* size);
39 
49  bool Trim(int64_t max_offset);
50 
52  int64_t head() { return head_; }
55  int64_t tail() { return head_ + size_; }
56 
57  private:
58  // Synchronize |buf_| and |size_| with |queue_|.
59  void Sync();
60 
61  ByteQueue queue_;
62  const uint8_t* buf_;
63  int size_;
64  int64_t head_;
65 
66  DISALLOW_COPY_AND_ASSIGN(OffsetByteQueue);
67 };
68 
69 } // namespace media
70 } // namespace shaka
71 
72 #endif // MEDIA_BASE_OFFSET_BYTE_QUEUE_H_
void PeekAt(int64_t offset, const uint8_t **buf, int *size)
bool Trim(int64_t max_offset)