OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MEDIA_CDM_CDM_BUFFER_IMPL_H_ | 5 #ifndef MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |
6 #define MEDIA_CDM_CDM_BUFFER_IMPL_H_ | 6 #define MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <vector> | 9 #include <vector> |
11 | 10 |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "media/base/video_frame.h" |
13 #include "media/cdm/api/content_decryption_module.h" | 13 #include "media/cdm/api/content_decryption_module.h" |
| 14 #include "media/cdm/cdm_buffer.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
| 18 class CdmBufferAllocator; |
| 19 |
17 // cdm::Buffer implementation that provides access to memory. This is a simple | 20 // cdm::Buffer implementation that provides access to memory. This is a simple |
18 // implementation that stores the data in a std::vector<uint8_t>. | 21 // implementation that stores the data in a std::vector<uint8_t>. |
19 class CdmBuffer : public cdm::Buffer { | 22 class SimpleCdmBuffer : public CdmBuffer { |
20 public: | 23 public: |
21 static CdmBuffer* Create(uint32_t capacity); | 24 static scoped_refptr<SimpleCdmBuffer> Create(CdmBufferAllocator* allocator, |
| 25 uint32_t capacity); |
22 | 26 |
23 // cdm::Buffer implementation. | 27 // cdm::Buffer implementation. |
24 void Destroy() final; | 28 void Destroy() final; |
25 uint32_t Capacity() const final; | 29 uint32_t Capacity() const final; |
26 uint8_t* Data() final; | 30 uint8_t* Data() final; |
27 void SetSize(uint32_t size) final; | 31 void SetSize(uint32_t size) final; |
28 uint32_t Size() const final; | 32 uint32_t Size() const final; |
29 | 33 |
30 private: | 34 private: |
31 CdmBuffer(uint32_t capacity); | 35 SimpleCdmBuffer(CdmBufferAllocator* allocator, uint32_t capacity); |
32 ~CdmBuffer() final; | 36 ~SimpleCdmBuffer() final; |
33 | 37 |
| 38 CdmBufferAllocator* allocator_; |
34 std::vector<uint8_t> buffer_; | 39 std::vector<uint8_t> buffer_; |
35 uint32_t size_; | 40 uint32_t size_; |
36 | 41 |
37 DISALLOW_COPY_AND_ASSIGN(CdmBuffer); | 42 DISALLOW_COPY_AND_ASSIGN(SimpleCdmBuffer); |
38 }; | 43 }; |
39 | 44 |
40 } // namespace media | 45 } // namespace media |
41 | 46 |
42 #endif | 47 #endif // MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |
OLD | NEW |