Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: media/base/byte_queue.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_BYTE_QUEUE_H_ 5 #ifndef MEDIA_BASE_BYTE_QUEUE_H_
6 #define MEDIA_BASE_BYTE_QUEUE_H_ 6 #define MEDIA_BASE_BYTE_QUEUE_H_
7 7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
10 #include "media/base/media_export.h" 9 #include "media/base/media_export.h"
11 10
12 namespace media { 11 namespace media {
13 12
14 // Represents a queue of bytes. 13 // Represents a queue of bytes.
15 // Data is added to the end of the queue via an Push() call and removed via 14 // Data is added to the end of the queue via an Push() call and removed via
16 // Pop(). The contents of the queue can be observed via the Peek() method. 15 // Pop(). The contents of the queue can be observed via the Peek() method.
17 // This class manages the underlying storage of the queue and tries to minimize 16 // This class manages the underlying storage of the queue and tries to minimize
18 // the number of buffer copies when data is appended and removed. 17 // the number of buffer copies when data is appended and removed.
19 class MEDIA_EXPORT ByteQueue { 18 class MEDIA_EXPORT ByteQueue {
20 public: 19 public:
21 ByteQueue(); 20 ByteQueue();
22 ~ByteQueue(); 21 ~ByteQueue();
23 22
24 // Reset the queue to the empty state. 23 // Reset the queue to the empty state.
25 void Reset(); 24 void Reset();
26 25
27 // Appends new bytes onto the end of the queue. 26 // Appends new bytes onto the end of the queue.
28 void Push(const uint8* data, int size); 27 void Push(const uint8_t* data, int size);
29 28
30 // Get a pointer to the front of the queue and the queue size. 29 // Get a pointer to the front of the queue and the queue size.
31 // These values are only valid until the next Push() or 30 // These values are only valid until the next Push() or
32 // Pop() call. 31 // Pop() call.
33 void Peek(const uint8** data, int* size) const; 32 void Peek(const uint8_t** data, int* size) const;
34 33
35 // Remove |count| bytes from the front of the queue. 34 // Remove |count| bytes from the front of the queue.
36 void Pop(int count); 35 void Pop(int count);
37 36
38 private: 37 private:
39 // Returns a pointer to the front of the queue. 38 // Returns a pointer to the front of the queue.
40 uint8* front() const; 39 uint8_t* front() const;
41 40
42 scoped_ptr<uint8[]> buffer_; 41 scoped_ptr<uint8_t[]> buffer_;
43 42
44 // Size of |buffer_|. 43 // Size of |buffer_|.
45 size_t size_; 44 size_t size_;
46 45
47 // Offset from the start of |buffer_| that marks the front of the queue. 46 // Offset from the start of |buffer_| that marks the front of the queue.
48 size_t offset_; 47 size_t offset_;
49 48
50 // Number of bytes stored in the queue. 49 // Number of bytes stored in the queue.
51 int used_; 50 int used_;
52 51
53 DISALLOW_COPY_AND_ASSIGN(ByteQueue); 52 DISALLOW_COPY_AND_ASSIGN(ByteQueue);
54 }; 53 };
55 54
56 } // namespace media 55 } // namespace media
57 56
58 #endif // MEDIA_BASE_BYTE_QUEUE_H_ 57 #endif // MEDIA_BASE_BYTE_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698