OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ALLOCATOR_H_ | 5 #ifndef MEDIA_CDM_CDM_ALLOCATOR_H_ |
6 #define MEDIA_CDM_CDM_ALLOCATOR_H_ | 6 #define MEDIA_CDM_CDM_ALLOCATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/callback.h" | |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
16 | 15 |
17 namespace cdm { | 16 namespace cdm { |
18 class Buffer; | 17 class Buffer; |
19 } | 18 } |
20 | 19 |
21 namespace media { | 20 namespace media { |
22 | 21 |
23 class VideoFrameImpl; | 22 class VideoFrameImpl; |
24 | 23 |
25 class MEDIA_EXPORT CdmAllocator { | 24 class MEDIA_EXPORT CdmAllocator { |
26 public: | 25 public: |
27 // Callback to create CdmAllocator for the created CDM. | |
28 using CreationCB = base::RepeatingCallback<std::unique_ptr<CdmAllocator>()>; | |
29 | |
30 virtual ~CdmAllocator(); | 26 virtual ~CdmAllocator(); |
31 | 27 |
32 // Creates a buffer with at least |capacity| bytes. Caller is required to | 28 // Creates a buffer with at least |capacity| bytes. Caller is required to |
33 // call Destroy() on the returned buffer when it is done with it. | 29 // call Destroy() on the returned buffer when it is done with it. |
34 virtual cdm::Buffer* CreateCdmBuffer(size_t capacity) = 0; | 30 virtual cdm::Buffer* CreateCdmBuffer(size_t capacity) = 0; |
35 | 31 |
36 // Returns a new VideoFrameImpl. | 32 // Returns a new VideoFrameImpl. |
37 virtual std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() = 0; | 33 virtual std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() = 0; |
38 | 34 |
39 protected: | 35 protected: |
40 CdmAllocator(); | 36 CdmAllocator(); |
41 | 37 |
42 private: | 38 private: |
43 DISALLOW_COPY_AND_ASSIGN(CdmAllocator); | 39 DISALLOW_COPY_AND_ASSIGN(CdmAllocator); |
44 }; | 40 }; |
45 | 41 |
46 } // namespace media | 42 } // namespace media |
47 | 43 |
48 #endif // MEDIA_CDM_CDM_ALLOCATOR_H_ | 44 #endif // MEDIA_CDM_CDM_ALLOCATOR_H_ |
OLD | NEW |