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/decoder_buffer.h

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Buffer Bonanza! 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
(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 #if !defined(OS_ANDROID)
20 #include "media/ffmpeg/ffmpeg_common.h"
scherkus (not reviewing) 2012/05/26 01:36:32 this header file should only be included by .cc fi
DaleCurtis 2012/05/29 21:17:01 Done.
21 #endif
22
23 namespace media {
24
25 class MEDIA_EXPORT DecoderBuffer : public Buffer {
26 public:
27 // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is
28 // set to a NULL ptr. Buffer will be padded and aligned as needed for decode.
29 explicit DecoderBuffer(int buffer_size);
30
31 // Create a DataBuffer whose |data_| is copied from |data|. Buffer will be
32 // padded and aligned as needed for decode.
33 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
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 #if !defined(OS_ANDROID)
52 scoped_ptr_malloc<uint8, ScopedPtrAVFree> data_;
53 #else
54 scoped_array<uint8> data_;
55 #endif
56 scoped_ptr<DecryptConfig> decrypt_config_;
57
58 // Constructor helper method for memory allocations.
59 void Initialize();
60
61 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
62 };
63
64 } // namespace media
65
66 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698