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

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

Issue 10228017: Add initial implementation of SourceBufferStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 months 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 | Annotate | Revision Log
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 // A simple implementation of Buffer that takes ownership of the given data 5 // A simple implementation of Buffer that takes ownership of the given data
6 // pointer. 6 // pointer.
7 // 7 //
8 // DataBuffer assumes that memory was allocated with new uint8[]. 8 // DataBuffer assumes that memory was allocated with new uint8[].
9 9
10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_
11 #define MEDIA_BASE_DATA_BUFFER_H_ 11 #define MEDIA_BASE_DATA_BUFFER_H_
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "media/base/buffers.h" 14 #include "media/base/buffers.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 class MEDIA_EXPORT DataBuffer : public Buffer { 18 class MEDIA_EXPORT DataBuffer : public Buffer {
19 public: 19 public:
20 // Assumes valid data of size |buffer_size|. 20 // Assumes valid data of size |buffer_size|.
21 DataBuffer(scoped_array<uint8> buffer, int buffer_size); 21 DataBuffer(scoped_array<uint8> buffer, int buffer_size);
22 22
23 // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is 23 // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is
24 // set to a NULL ptr. 24 // set to a NULL ptr.
25 explicit DataBuffer(int buffer_size); 25 explicit DataBuffer(int buffer_size);
26 // TODO(vrk): Only ChunkDemuxer and friends care about keyframes.
27 // Put keyframe stuff inside a derived class of Buffer?
acolwell GONE FROM CHROMIUM 2012/04/29 18:13:06 Remove comment since we are already making this de
vrk (LEFT CHROMIUM) 2012/05/01 22:51:13 Done.
28 DataBuffer(int buffer_size, bool is_keyframe);
26 29
27 // Create a DataBuffer whose |data_| is copied from |data|. 30 // Create a DataBuffer whose |data_| is copied from |data|.
28 static scoped_refptr<DataBuffer> CopyFrom(const uint8* data, int size); 31 static scoped_refptr<DataBuffer> CopyFrom(const uint8* data, int size);
29 32
30 // Buffer implementation. 33 // Buffer implementation.
31 virtual const uint8* GetData() const OVERRIDE; 34 virtual const uint8* GetData() const OVERRIDE;
32 virtual int GetDataSize() const OVERRIDE; 35 virtual int GetDataSize() const OVERRIDE;
33 virtual const DecryptConfig* GetDecryptConfig() const OVERRIDE; 36 virtual const DecryptConfig* GetDecryptConfig() const OVERRIDE;
34 37
35 // Returns a read-write pointer to the buffer data. 38 // Returns a read-write pointer to the buffer data.
(...skipping 16 matching lines...) Expand all
52 int buffer_size_; 55 int buffer_size_;
53 int data_size_; 56 int data_size_;
54 scoped_ptr<DecryptConfig> decrypt_config_; 57 scoped_ptr<DecryptConfig> decrypt_config_;
55 58
56 DISALLOW_COPY_AND_ASSIGN(DataBuffer); 59 DISALLOW_COPY_AND_ASSIGN(DataBuffer);
57 }; 60 };
58 61
59 } // namespace media 62 } // namespace media
60 63
61 #endif // MEDIA_BASE_DATA_BUFFER_H_ 64 #endif // MEDIA_BASE_DATA_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698