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

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

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 8 years, 6 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
(Empty)
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 // A specialized buffer for interfacing with audio / video decoders.
6 //
7 // Specifically ensures that data is aligned and padded as necessary by the
8 // underlying decoding framework. On desktop platforms this means memory is
9 // allocated using FFmpeg with particular alignment and padding requirements.
10 //
11 // Also includes decoder specific functionality for decryption.
12
13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_
14 #define MEDIA_BASE_DECODER_BUFFER_H_
15
16 #include "base/memory/scoped_ptr.h"
17 #include "media/base/buffers.h"
18 #include "media/base/decrypt_config.h"
19
20 namespace media {
21
22 class MEDIA_EXPORT DecoderBuffer : public Buffer {
23 public:
24 // Allocates buffer of size |buffer_size|. If |buffer_size| is < 0, |data_|
25 // is set to a NULL ptr. Buffer will be padded and aligned as necessary.
scherkus (not reviewing) 2012/05/30 00:45:19 I made a comment about this elsewhere "data_ is s
DaleCurtis 2012/05/30 02:28:25 Done. Public interfaces DCHECK() this behavior.
26 explicit DecoderBuffer(int buffer_size);
27
28 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be
29 // padded and aligned as necessary.
30 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
31
32 // Create a DecoderBuffer indicating we've reached End Of Stream.
scherkus (not reviewing) 2012/05/30 00:45:19 s/we've reached End Of Stream/end of stream/ also
DaleCurtis 2012/05/30 02:28:25 Done.
33 static scoped_refptr<DecoderBuffer> CreateEOSBuffer();
34
35 // Buffer implementation.
36 virtual const uint8* GetData() const OVERRIDE;
37 virtual int GetDataSize() const OVERRIDE;
38
39 // Returns a read-write pointer to the buffer data.
40 virtual uint8* GetWritableData();
41
42 virtual const DecryptConfig* GetDecryptConfig() const;
43 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config);
44
45 protected:
46 DecoderBuffer(const uint8* data, int size);
47 virtual ~DecoderBuffer();
48
49 private:
50 int buffer_size_;
51 uint8* data_;
52 scoped_ptr<DecryptConfig> decrypt_config_;
53
54 // Constructor helper method for memory allocations.
55 void Initialize();
56
57 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
58 };
59
60 } // namespace media
61
62 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698