| 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/VideoBuffer.h" |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
|
| 15 |
class CVideoBufferDMA; |
| 16 |
|
| 17 |
class CVideoBufferPoolDMA : public IVideoBufferPool |
| 18 |
{ |
| 19 |
public: |
| 20 |
CVideoBufferPoolDMA() = default; |
| 21 |
~CVideoBufferPoolDMA() override; |
| 22 |
|
| 23 |
// implementation of IVideoBufferPool |
| 24 |
CVideoBuffer* Get() override; |
| 25 |
void Return(int id) override; |
| 26 |
void Configure(AVPixelFormat format, int size) override; |
| 27 |
bool IsConfigured() override; |
| 28 |
bool IsCompatible(AVPixelFormat format, int size) override; |
| 29 |
void Released(CVideoBufferManager& videoBufferManager) override; |
| 30 |
|
| 31 |
static std::shared_ptr<IVideoBufferPool> CreatePool(); |
| 32 |
|
| 33 |
protected: |
| 34 |
CCriticalSection m_critSection; |
| 35 |
std::vector<CVideoBufferDMA*> m_all; |
| 36 |
std::deque<int> m_used; |
| 37 |
std::deque<int> m_free; |
| 38 |
|
| 39 |
private: |
| 40 |
uint32_t TranslateFormat(AVPixelFormat format); |
| 41 |
|
| 42 |
uint32_t m_fourcc = 0; |
| 43 |
uint64_t m_size = 0; |
| 44 |
}; |