OLD | NEW |
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 specialized buffer for interfacing with audio / video decoders. | 5 // A specialized buffer for interfacing with audio / video decoders. |
6 // | 6 // |
7 // Specifically ensures that data is aligned and padded as necessary by the | 7 // Specifically ensures that data is aligned and padded as necessary by the |
8 // underlying decoding framework. On desktop platforms this means memory is | 8 // underlying decoding framework. On desktop platforms this means memory is |
9 // allocated using FFmpeg with particular alignment and padding requirements. | 9 // allocated using FFmpeg with particular alignment and padding requirements. |
10 // | 10 // |
11 // Also includes decoder specific functionality for decryption. | 11 // Also includes decoder specific functionality for decryption. |
12 | 12 |
13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ | 13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ |
14 #define MEDIA_BASE_DECODER_BUFFER_H_ | 14 #define MEDIA_BASE_DECODER_BUFFER_H_ |
15 | 15 |
| 16 #include "base/memory/aligned_memory.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "media/base/buffers.h" | 19 #include "media/base/buffers.h" |
19 #include "media/base/decrypt_config.h" | 20 #include "media/base/decrypt_config.h" |
20 | 21 |
21 namespace media { | 22 namespace media { |
22 | 23 |
23 class MEDIA_EXPORT DecoderBuffer : public Buffer { | 24 class MEDIA_EXPORT DecoderBuffer : public Buffer { |
24 public: | 25 public: |
25 enum { | 26 enum { |
(...skipping 29 matching lines...) Expand all Loading... |
55 | 56 |
56 protected: | 57 protected: |
57 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer | 58 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer |
58 // will be padded and aligned as necessary. If |data| is NULL then |data_| is | 59 // will be padded and aligned as necessary. If |data| is NULL then |data_| is |
59 // set to NULL and |buffer_size_| to 0. | 60 // set to NULL and |buffer_size_| to 0. |
60 DecoderBuffer(const uint8* data, int size); | 61 DecoderBuffer(const uint8* data, int size); |
61 virtual ~DecoderBuffer(); | 62 virtual ~DecoderBuffer(); |
62 | 63 |
63 private: | 64 private: |
64 int buffer_size_; | 65 int buffer_size_; |
65 uint8* data_; | 66 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; |
66 scoped_ptr<DecryptConfig> decrypt_config_; | 67 scoped_ptr<DecryptConfig> decrypt_config_; |
67 | 68 |
68 // Constructor helper method for memory allocations. | 69 // Constructor helper method for memory allocations. |
69 void Initialize(); | 70 void Initialize(); |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 72 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
72 }; | 73 }; |
73 | 74 |
74 } // namespace media | 75 } // namespace media |
75 | 76 |
76 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 77 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |