xbmc
AddonVideoCodec.h
1 /*
2  * Copyright (C) 2017-2018 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 "DVDVideoCodec.h"
12 #include "addons/AddonProvider.h"
13 #include "addons/binary-addons/AddonInstanceHandler.h"
14 #include "addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h"
15 
16 class BufferPool;
17 
19  : public CDVDVideoCodec
21 {
22 public:
23  CAddonVideoCodec(CProcessInfo& processInfo,
24  ADDON::AddonInfoPtr& addonInfo,
25  KODI_HANDLE parentInstance);
26  ~CAddonVideoCodec() override;
27 
28  bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) override;
29  bool Reconfigure(CDVDStreamInfo &hints) override;
30  bool AddData(const DemuxPacket &packet) override;
31  void Reset() override;
32  VCReturn GetPicture(VideoPicture* pVideoPicture) override;
33  const char* GetName() override;
34  void SetCodecControl(int flags) override { m_codecFlags = flags; }
35 
36 private:
37  bool CopyToInitData(VIDEOCODEC_INITDATA &initData, CDVDStreamInfo &hints);
38 
44  bool GetFrameBuffer(VIDEOCODEC_PICTURE &picture);
45  void ReleaseFrameBuffer(KODI_HANDLE videoBufferHandle);
46 
47  static bool get_frame_buffer(void* kodiInstance, VIDEOCODEC_PICTURE *picture);
48  static void release_frame_buffer(void* kodiInstance, KODI_HANDLE videoBufferHandle);
49 
50  int m_codecFlags;
51  VIDEOCODEC_FORMAT m_formats[VIDEOCODEC_FORMAT_MAXFORMATS + 1];
52  float m_displayAspect;
53  unsigned int m_width, m_height;
54 };
Definition: DVDStreamInfo.h:23
bool Reconfigure(CDVDStreamInfo &hints) override
Reconfigure the decoder, returns true on success Decoders not capable of running multiple instances m...
Definition: AddonVideoCodec.cpp:206
Definition: DVDCodecs.h:23
const char * GetName() override
should return codecs name
Definition: AddonVideoCodec.cpp:319
Definition: video_codec.h:154
Definition: AddonVideoCodec.h:18
void Reset() override
Reset the decoder.
Definition: AddonVideoCodec.cpp:326
Definition: AddonInstanceHandler.h:33
Definition: ProcessInfo.h:26
bool AddData(const DemuxPacket &packet) override
add data, decoder has to consume the entire packet returns true if the packet was consumed or if resu...
Definition: AddonVideoCodec.cpp:218
bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) override
Open the decoder, returns true on success Decoders not capable of running multiple instances should r...
Definition: AddonVideoCodec.cpp:187
Definition: DVDVideoCodec.h:36
Definition: DemuxPacket.h:22
VCReturn GetPicture(VideoPicture *pVideoPicture) override
GetPicture controls decoding.
Definition: AddonVideoCodec.cpp:226
void SetCodecControl(int flags) override
Codec can be informed by player with the following flags:
Definition: AddonVideoCodec.h:34
Definition: video_codec.h:203
Definition: DVDVideoCodec.h:107