kodi
VTB.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #ifdef HAS_GL
12 #include <OpenGL/gl.h>
13 #else
14 #include <OpenGLES/ES2/gl.h>
15 #endif
16 
17 #include "DVDVideoCodecFFmpeg.h"
18 #include "cores/VideoPlayer/Buffers/VideoBuffer.h"
19 #include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h"
20 
21 #include <CoreVideo/CVPixelBuffer.h>
22 
23 class CProcessInfo;
24 
25 namespace VTB
26 {
27 class CVideoBufferVTB;
28 class CVideoBufferPoolVTB;
29 
31 {
32 public:
33  CVideoBufferVTB(IVideoBufferPool &pool, int id);
34  ~CVideoBufferVTB() override;
35  void SetRef(AVFrame *frame);
36  void Unref();
37  CVPixelBufferRef GetPB();
38 
39  GLuint m_fence = 0;
40 protected:
41  CVPixelBufferRef m_pbRef = nullptr;
42  AVFrame *m_pFrame;
43 };
44 
46 {
47 public:
48  CDecoder(CProcessInfo& processInfo);
49  ~CDecoder() override;
50  static IHardwareDecoder* Create(CDVDStreamInfo &hint, CProcessInfo &processInfo, AVPixelFormat fmt);
51  static bool Register();
52  bool Open(AVCodecContext* avctx, AVCodecContext* mainctx, const enum AVPixelFormat) override;
53  CDVDVideoCodec::VCReturn Decode(AVCodecContext* avctx, AVFrame* frame) override;
54  bool GetPicture(AVCodecContext* avctx, VideoPicture* picture) override;
55  CDVDVideoCodec::VCReturn Check(AVCodecContext* avctx) override;
56  const std::string Name() override { return "vtb"; }
57  unsigned GetAllowedReferences() override;
58 
59  void Close();
60 
61 protected:
62  unsigned m_renderbuffers_count;
63  AVCodecContext *m_avctx;
64  CProcessInfo& m_processInfo;
65  CVideoBufferVTB *m_renderBuffer = nullptr;
66  std::shared_ptr<CVideoBufferPoolVTB> m_videoBufferPool;
67 };
68 
69 }
Definition: DVDStreamInfo.h:25
Definition: VideoBuffer.h:85
Definition: DVDVideoCodec.h:248
Definition: VideoBuffer.h:51
Definition: ProcessInfo.h:26
Definition: VTB.h:25
Definition: DVDVideoCodec.h:36
Definition: VTB.h:45
Definition: VTB.h:30