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/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "media/base/buffers.h" | 17 #include "media/base/buffers.h" |
18 #include "media/base/decrypt_config.h" | 18 #include "media/base/decrypt_config.h" |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 class MEDIA_EXPORT DecoderBuffer : public Buffer { | 22 class MEDIA_EXPORT DecoderBuffer : public Buffer { |
23 public: | 23 public: |
| 24 enum { |
| 25 kPaddingSize = 16, |
| 26 #if defined(ARCH_CPU_ARM_FAMILY) |
| 27 kAlignmentSize = 16 |
| 28 #else |
| 29 kAlignmentSize = 32 |
| 30 #endif |
| 31 }; |
| 32 |
24 // Allocates buffer of size |buffer_size| >= 0. Buffer will be padded and | 33 // Allocates buffer of size |buffer_size| >= 0. Buffer will be padded and |
25 // aligned as necessary. | 34 // aligned as necessary. |
26 explicit DecoderBuffer(int buffer_size); | 35 explicit DecoderBuffer(int buffer_size); |
27 | 36 |
28 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be | 37 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be |
29 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. | 38 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. |
30 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); | 39 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); |
31 | 40 |
32 // Create a DecoderBuffer indicating we've reached end of stream. GetData() | 41 // Create a DecoderBuffer indicating we've reached end of stream. GetData() |
33 // and GetWritableData() will return NULL and GetDataSize() will return 0. | 42 // and GetWritableData() will return NULL and GetDataSize() will return 0. |
(...skipping 23 matching lines...) Expand all Loading... |
57 | 66 |
58 // Constructor helper method for memory allocations. | 67 // Constructor helper method for memory allocations. |
59 void Initialize(); | 68 void Initialize(); |
60 | 69 |
61 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 70 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
62 }; | 71 }; |
63 | 72 |
64 } // namespace media | 73 } // namespace media |
65 | 74 |
66 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 75 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |