kodi
DVDVideoCodecDRMPRIME.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 "cores/VideoPlayer/Buffers/VideoBuffer.h"
12 #include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h"
13 #include "cores/VideoPlayer/DVDStreamInfo.h"
14 
15 #include <memory>
16 
18 {
19 public:
20  explicit CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo);
21  ~CDVDVideoCodecDRMPRIME() override;
22 
23  static std::unique_ptr<CDVDVideoCodec> Create(CProcessInfo& processInfo);
24  static void Register();
25 
26  bool Open(CDVDStreamInfo& hints, CDVDCodecOptions& options) override;
27  bool AddData(const DemuxPacket& packet) override;
28  void Reset() override;
29  CDVDVideoCodec::VCReturn GetPicture(VideoPicture* pVideoPicture) override;
30  const char* GetName() override { return m_name.c_str(); }
31  unsigned GetAllowedReferences() override { return 5; }
32  void SetCodecControl(int flags) override;
33 
34 protected:
35  void Drain();
36  void SetPictureParams(VideoPicture* pVideoPicture);
37  void UpdateProcessInfo(struct AVCodecContext* avctx, const enum AVPixelFormat fmt);
38  static enum AVPixelFormat GetFormat(struct AVCodecContext* avctx, const enum AVPixelFormat* fmt);
39  static int GetBuffer(struct AVCodecContext* avctx, AVFrame* frame, int flags);
40 
41  std::string m_name;
42  int m_codecControlFlags = 0;
43  CDVDStreamInfo m_hints;
44  double m_DAR = 1.0;
45  AVCodecContext* m_pCodecContext = nullptr;
46  AVFrame* m_pFrame = nullptr;
47  std::shared_ptr<IVideoBufferPool> m_videoBufferPool;
48 };
Definition: DVDStreamInfo.h:25
unsigned GetAllowedReferences() override
Number of references to old pictures that are allowed to be retained when calling decode on the next ...
Definition: DVDVideoCodecDRMPRIME.h:31
Definition: DVDCodecs.h:23
void Reset() override
Reset the decoder.
Definition: DVDVideoCodecDRMPRIME.cpp:451
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: DVDVideoCodecDRMPRIME.cpp:401
CDVDVideoCodec::VCReturn GetPicture(VideoPicture *pVideoPicture) override
GetPicture controls decoding.
Definition: DVDVideoCodecDRMPRIME.cpp:601
bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) override
Open the decoder, returns true on success Decoders not capable of running multiple instances should r...
Definition: DVDVideoCodecDRMPRIME.cpp:282
Definition: DVDVideoCodecDRMPRIME.h:17
Definition: ProcessInfo.h:26
Definition: DVDVideoCodec.h:36
Definition: DemuxPacket.h:22
const char * GetName() override
should return codecs name
Definition: DVDVideoCodecDRMPRIME.h:30
void SetCodecControl(int flags) override
Codec can be informed by player with the following flags:
Definition: DVDVideoCodecDRMPRIME.cpp:667
Definition: DVDVideoCodec.h:110