kodi
VideoPlayerCodec.h
1 /*
2  * Copyright (C) 2005-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 "ICodec.h"
12 #include "cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodec.h"
13 #include "cores/VideoPlayer/DVDDemuxers/DVDDemux.h"
14 #include "cores/VideoPlayer/DVDInputStreams/DVDInputStream.h"
15 
16 namespace ActiveAE
17 {
18  class IAEResample;
19 };
20 
21 class VideoPlayerCodec : public ICodec
22 {
23 public:
25  ~VideoPlayerCodec() override;
26 
27  bool Init(const CFileItem &file, unsigned int filecache) override;
28  bool Seek(int64_t iSeekTime) override;
29  int ReadPCM(uint8_t* pBuffer, size_t size, size_t* actualsize) override;
30  int ReadRaw(uint8_t **pBuffer, int *bufferSize) override;
31  bool CanInit() override;
32  bool CanSeek() override;
33 
34  void DeInit();
35  AEAudioFormat GetFormat();
36  void SetContentType(const std::string &strContent);
37 
38  bool NeedConvert(AEDataFormat fmt);
39  void SetPassthroughStreamType(CAEStreamInfo::DataType streamType);
40 
41 private:
42  CAEStreamInfo::DataType GetPassthroughStreamType(AVCodecID codecId, int samplerate, int profile);
43 
44  CDVDDemux* m_pDemuxer{nullptr};
45  std::shared_ptr<CDVDInputStream> m_pInputStream;
46  std::unique_ptr<CDVDAudioCodec> m_pAudioCodec;
47 
48  std::string m_strContentType;
49  std::string m_strFileName;
50  int m_nAudioStream{-1};
51  size_t m_nDecodedLen{0};
52 
53  bool m_bInited{false};
54  bool m_bCanSeek{false};
55 
56  std::unique_ptr<ActiveAE::IAEResample> m_pResampler;
57  DVDAudioFrame m_audioFrame{};
58  int m_planes{0};
59  bool m_needConvert{false};
60  AEAudioFormat m_srcFormat{};
61  int m_channels{0};
62 
63  std::unique_ptr<CProcessInfo> m_processInfo;
64 };
65 
Definition: DVDDemux.h:221
Definition: Application.h:67
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
Definition: DVDAudioCodec.h:27
Definition: ICodec.h:23
Represents a file on a share.
Definition: FileItem.h:102
Definition: VideoPlayerCodec.h:21