Debian Codegraph @

xbmc/cores/VideoPlayer/Buffers/VideoBufferDMA.h

raw
1 /*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h"
12
13 #include <memory>
14
15 class IBufferObject;
16
17 class CVideoBufferDMA : public CVideoBufferDRMPRIMEFFmpeg
18 {
19 public:
20 CVideoBufferDMA(IVideoBufferPool& pool, int id, uint32_t fourcc, uint64_t size);
21 ~CVideoBufferDMA() override;
22
23 // implementation of CVideoBufferDRMPRIME via CVideoBufferDRMPRIMEFFmpeg
24 uint32_t GetWidth() const override { return m_width; }
25 uint32_t GetHeight() const override { return m_height; }
26 AVDRMFrameDescriptor* GetDescriptor() const override;
27
28 // implementation of CVideoBuffer via CVideoBufferDRMPRIMEFFmpeg
29 void GetPlanes(uint8_t* (&planes)[YuvImage::MAX_PLANES]) override;
30 void GetStrides(int (&strides)[YuvImage::MAX_PLANES]) override;
31 uint8_t* GetMemPtr() override;
32 void SetDimensions(int width, int height, const int (&strides)[YuvImage::MAX_PLANES]) override;
33 void SetDimensions(int width,
34 int height,
35 const int (&strides)[YuvImage::MAX_PLANES],
36 const int (&planeOffsets)[YuvImage::MAX_PLANES]) override;
37
38 void SetDimensions(int width, int height);
39 bool Alloc();
40 void Export(AVFrame* frame, uint32_t width, uint32_t height);
41
42 void SyncStart();
43 void SyncEnd();
44
45 private:
46 void Destroy();
47
48 std::unique_ptr<IBufferObject> m_bo;
49
50 int m_offsets[YuvImage::MAX_PLANES]{0};
51 int m_strides[YuvImage::MAX_PLANES]{0};
52
53 AVDRMFrameDescriptor m_descriptor{};
54 uint32_t m_planes{0};
55 uint32_t m_width{0};
56 uint32_t m_height{0};
57 uint32_t m_fourcc{0};
58 uint64_t m_size{0};
59 uint8_t* m_addr{nullptr};
60 int m_fd{-1};
61 };