xbmc
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  int height; // height of the stream reported by the demuxer
62  int width; // width of the stream reported by the demuxer
63  double aspect; // display aspect as reported by demuxer
64  bool vfr; // variable framerate
65  bool stills; // there may be odd still frames in video
66  int level; // encoder level of the stream reported by the decoder. used to qualify hw decoders.
67  int profile; // encoder profile of the stream reported by the decoder. used to qualify hw decoders.
68  bool ptsinvalid; // pts cannot be trusted (avi's).
69  bool forced_aspect; // aspect is forced from container
70  int orientation; // orientation of the video in degrees counter clockwise
71  int bitsperpixel;
72  int bitdepth;
73  StreamHdrType hdrType;
74  AVColorSpace colorSpace;
75  AVColorRange colorRange;
76  AVColorPrimaries colorPrimaries;
77  AVColorTransferCharacteristic colorTransferCharacteristic;
78  std::shared_ptr<AVMasteringDisplayMetadata> masteringMetadata;
79  std::shared_ptr<AVContentLightMetadata> contentLightMetadata;
80  std::string stereo_mode; // stereoscopic 3d mode
81  AVDOVIDecoderConfigurationRecord dovi{};
82 
83  // AUDIO
84  int channels;
85  int samplerate;
86  int bitrate;
87  int blockalign;
88  int bitspersample;
89  uint64_t channellayout;
90 
91  // SUBTITLE
92 
93  // CODEC EXTRADATA
94  FFmpegExtraData extradata; // extra data for codec to use
95  unsigned int codec_tag; // extra identifier hints for decoding
96 
97  // Crypto initialization Data
98  std::shared_ptr<DemuxCryptoSession> cryptoSession;
99  std::shared_ptr<ADDON::IAddonProvider> externalInterfaces;
100 
101  bool operator==(const CDVDStreamInfo& right) { return Equal(right, COMPARE_ALL); }
102  bool operator!=(const CDVDStreamInfo& right) { return !Equal(right, COMPARE_ALL); }
103 
104  CDVDStreamInfo& operator=(const CDVDStreamInfo& right)
105  {
106  if (this != &right)
107  Assign(right, true);
108 
109  return *this;
110  }
111 
112  bool operator==(const CDemuxStream& right)
113  {
114  return Equal(CDVDStreamInfo(right, true), COMPARE_ALL);
115  }
116  bool operator!=(const CDemuxStream& right)
117  {
118  return !Equal(CDVDStreamInfo(right, true), COMPARE_ALL);
119  }
120 
121  CDVDStreamInfo& operator=(const CDemuxStream& right)
122  {
123  Assign(right, true);
124  return *this;
125  }
126 };
Definition: FFmpeg.h:75
Definition: DVDStreamInfo.h:25
Definition: DemuxCrypto.h:26
Definition: DVDDemux.h:72