cdm_allocator.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_CDM_CDM_ALLOCATOR_H_
  5. #define MEDIA_CDM_CDM_ALLOCATOR_H_
  6. #include <stddef.h>
  7. #include <stdint.h>
  8. #include <memory>
  9. #include "base/callback.h"
  10. #include "media/base/media_export.h"
  11. namespace cdm {
  12. class Buffer;
  13. }
  14. namespace media {
  15. class VideoFrameImpl;
  16. class MEDIA_EXPORT CdmAllocator {
  17. public:
  18. // Callback to create CdmAllocator for the created CDM.
  19. using CreationCB = base::RepeatingCallback<std::unique_ptr<CdmAllocator>()>;
  20. CdmAllocator(const CdmAllocator&) = delete;
  21. CdmAllocator& operator=(const CdmAllocator&) = delete;
  22. virtual ~CdmAllocator();
  23. // Creates a buffer with at least |capacity| bytes. Caller is required to
  24. // call Destroy() on the returned buffer when it is done with it.
  25. virtual cdm::Buffer* CreateCdmBuffer(size_t capacity) = 0;
  26. // Returns a new VideoFrameImpl.
  27. virtual std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() = 0;
  28. protected:
  29. CdmAllocator();
  30. };
  31. } // namespace media
  32. #endif // MEDIA_CDM_CDM_ALLOCATOR_H_