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