kodi
DVDStreamInfo.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 "DVDDemuxers/DVDDemux.h"
12 
13 extern "C"
14 {
15 #include <libavcodec/avcodec.h>
16 #include <libavutil/dovi_meta.h>
17 }
18 
19 #define CODEC_FORCE_SOFTWARE 0x01
20 #define CODEC_ALLOW_FALLBACK 0x02
21 
22 class CDemuxStream;
23 struct DemuxCryptoSession;
24 
26 {
27 public:
29  CDVDStreamInfo(const CDVDStreamInfo &right, bool withextradata = true);
30  CDVDStreamInfo(const CDemuxStream &right, bool withextradata = true);
31 
32  ~CDVDStreamInfo();
33 
34  void Clear(); // clears current information
35  bool Equal(const CDVDStreamInfo& right, int compare);
36  bool Equal(const CDemuxStream &right, bool withextradata);
37 
38  void Assign(const CDVDStreamInfo &right, bool withextradata);
39  void Assign(const CDemuxStream &right, bool withextradata);
40 
41  enum
42  {
43  COMPARE_EXTRADATA = 1,
44  COMPARE_ID = 2,
45  COMPARE_ALL = 3,
46  };
47 
48  AVCodecID codec;
49  StreamType type;
50  int uniqueId;
51  int demuxerId = -1;
52  int source{STREAM_SOURCE_NONE};
53  int flags;
54  std::string filename;
55  bool dvd;
56  int codecOptions;
57 
58  // VIDEO
59  int fpsscale; // scale of 1001 and a rate of 60000 will result in 59.94 fps
60  int fpsrate;
61  bool interlaced;
62  int height; // height of the stream reported by the demuxer
63  int width; // width of the stream reported by the demuxer
64  double aspect; // display aspect as reported by demuxer
65  bool vfr; // variable framerate
66  bool stills; // there may be odd still frames in video
67  int level; // encoder level of the stream reported by the decoder. used to qualify hw decoders.
68  int profile; // encoder profile of the stream reported by the decoder. used to qualify hw decoders.
69  bool ptsinvalid; // pts cannot be trusted (avi's).
70  bool forced_aspect; // aspect is forced from container
71  int orientation; // orientation of the video in degrees counter clockwise
72  int bitsperpixel;
73  int bitdepth;
74  StreamHdrType hdrType;
75  AVColorSpace colorSpace;
76  AVColorRange colorRange;
77  AVColorPrimaries colorPrimaries;
78  AVColorTransferCharacteristic colorTransferCharacteristic;
79  std::shared_ptr<AVMasteringDisplayMetadata> masteringMetadata;
80  std::shared_ptr<AVContentLightMetadata> contentLightMetadata;
81  std::string stereo_mode; // stereoscopic 3d mode
82  AVDOVIDecoderConfigurationRecord dovi{};
83 
84  // AUDIO
85  int channels;
86  int samplerate;
87  int bitrate;
88  int blockalign;
89  int bitspersample;
90  uint64_t channellayout;
91 
92  // SUBTITLE
93 
94  // CODEC EXTRADATA
95  FFmpegExtraData extradata; // extra data for codec to use
96  unsigned int codec_tag; // extra identifier hints for decoding
97 
98  // Crypto initialization Data
99  std::shared_ptr<DemuxCryptoSession> cryptoSession;
100  std::shared_ptr<ADDON::IAddonProvider> externalInterfaces;
101 
102  bool operator==(const CDVDStreamInfo& right) { return Equal(right, COMPARE_ALL); }
103  bool operator!=(const CDVDStreamInfo& right) { return !Equal(right, COMPARE_ALL); }
104 
105  CDVDStreamInfo& operator=(const CDVDStreamInfo& right)
106  {
107  if (this != &right)
108  Assign(right, true);
109 
110  return *this;
111  }
112 
113  bool operator==(const CDemuxStream& right)
114  {
115  return Equal(CDVDStreamInfo(right, true), COMPARE_ALL);
116  }
117  bool operator!=(const CDemuxStream& right)
118  {
119  return !Equal(CDVDStreamInfo(right, true), COMPARE_ALL);
120  }
121 
122  CDVDStreamInfo& operator=(const CDemuxStream& right)
123  {
124  Assign(right, true);
125  return *this;
126  }
127 };
Definition: FFmpeg.h:75
Definition: DVDStreamInfo.h:25
Definition: DemuxCrypto.h:26
Definition: DVDDemux.h:72