MythTV  master
dishdescriptors.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // Copyright (c) 2003-2004, Daniel Thor Kristjansson
3 #ifndef DISH_DESCRIPTORS_H
4 #define DISH_DESCRIPTORS_H
5 
6 #include <QString>
7 #include <QMutex>
8 #include <QDate>
9 #include <QMap>
10 
11 #include "atscdescriptors.h"
12 #include "dvbdescriptors.h"
13 
15 {
16  public:
17  explicit DishEventMPAADescriptor(const unsigned char *data, int len = 300) :
18  MPEGDescriptor(data, len, PrivateDescriptorID::dish_event_mpaa) { }
19  // Name bits loc expected value
20  // descriptor_tag 8 0.0 0x89
21  // descriptor_length 8 1.0
22  // stars 3 2.0
23  uint stars_raw(void) const { return (m_data[2] & 0xe0) >> 0x05; }
24  float stars(void) const;
25 
26  // rating 3 2.3
27  uint rating_raw(void) const { return (m_data[2] & 0x1c) >> 0x02; }
28  QString rating(void) const;
29 
30  // advisories 8 3.0
31  uint advisory_raw(void) const { return m_data[3]; }
32  QString advisory(void) const;
33 
34  private:
35  static void Init(void);
36 
37  private:
38  static QMutex s_mpaaRatingsLock;
39  static QMap<uint,QString> s_mpaaRatingsDesc;
40  static bool s_mpaaRatingsExists;
41 };
42 
44 {
45  public:
46  explicit DishEventVCHIPDescriptor(const unsigned char *data, int len = 300) :
47  MPEGDescriptor(data, len, PrivateDescriptorID::dish_event_vchip) { }
48  // Name bits loc expected value
49  // descriptor_tag 8 0.0 0x95
50  // descriptor_length 8 1.0
51  // rating 8 2.0
52  uint rating_raw(void) const { return m_data[2]; }
53  QString rating(void) const;
54 
55  // advisory 8 3.0
56  uint advisory_raw(void) const { return m_data[3]; }
57  QString advisory(void) const;
58 
59  private:
60  static void Init(void);
61 
62  private:
63  static QMutex s_vchipRatingsLock;
64  static QMap<uint,QString> s_vchipRatingsDesc;
65  static bool s_vchipRatingsExists;
66 };
67 
69 {
70  public:
71  explicit DishEventNameDescriptor(const unsigned char *data, int len = 300) :
72  MPEGDescriptor(data, len, PrivateDescriptorID::dish_event_name) { }
73  // Name bits loc expected value
74  // descriptor_tag 8 0.0 0x91
75  // descriptor_length 8 1.0
76  // unknown 8 2.0
77  // event_name dlen-1 3.0
78  bool HasName(void) const { return DescriptorLength() > 1; }
79  QString Name(uint compression_type) const;
80 };
81 
83 {
84  public:
85  explicit DishEventDescriptionDescriptor(const unsigned char *data, int len = 300) :
87  data, len, PrivateDescriptorID::dish_event_description) { }
88  // Name bits loc expected value
89  // descriptor_tag 8 0.0 0x92
90  // descriptor_length 8 1.0
91  // unknown 8/16 2.0
92  // event_name dlen-2 3.0/4.0
93  const unsigned char *DescriptionRaw(void) const;
94  uint DescriptionRawLength(void) const;
95  bool HasDescription(void) const { return DescriptionRawLength() != 0U; }
96  QString Description(uint compression_type) const;
97 };
98 
100 {
101  public:
102  explicit DishEventPropertiesDescriptor(const unsigned char *data, int len = 300) :
104  data, len, PrivateDescriptorID::dish_event_properties) { }
105  // Name bits loc expected value
106  // descriptor_tag 8 0.0 0x94
107  // descriptor_length 8 1.0
108  // unknown 8 2.0
109  // event_name dlen-1 3.0
110  bool HasProperties(void) const { return DescriptorLength() > 1; }
111  uint SubtitleProperties(uint compression_type) const;
112  uint AudioProperties(uint compression_type) const;
113 
114  private:
115  void decompress_properties(uint compression_type) const;
116 
117  private:
120  static bool s_decompressed;
121 };
122 
124 {
125  public:
126  explicit DishEventTagsDescriptor(const unsigned char *data, int len = 300) :
127  MPEGDescriptor(data, len, PrivateDescriptorID::dish_event_tags) { }
128  // Name bits loc expected value
129  // descriptor_tag 8 0.0 0x96
130  // descriptor_length 8 1.0
131  // seriesid 64 2.0
132  QString seriesid(void) const;
133  QString programid(void) const;
134  QDate originalairdate(void) const;
135 };
136 
137 enum DishThemeType : std::uint8_t
138 {
150 };
151 
152 QString dish_theme_type_to_string(uint theme_type);
154 
156 {
157  public:
158  explicit DishContentDescriptor(const unsigned char *data, int len = 300) :
159  ContentDescriptor(data, len) { }
160 
161  DishThemeType GetTheme(void) const;
162  QString GetCategory(void) const;
163  QString toString() const override; // ContentDescriptor
164 
165  private:
166  static void Init(void);
167 
168  private:
169  static QMap<uint,QString> s_themeDesc;
170  static QMap<uint,QString> s_dishCategoryDesc;
171  static volatile bool s_dishCategoryDescExists;
172 };
173 
174 #endif // DISH_DESCRIPTORS_H
DishEventMPAADescriptor::DishEventMPAADescriptor
DishEventMPAADescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:17
kThemeMusic
@ kThemeMusic
Definition: dishdescriptors.h:146
DishEventDescriptionDescriptor::DishEventDescriptionDescriptor
DishEventDescriptionDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:85
DishEventVCHIPDescriptor::DishEventVCHIPDescriptor
DishEventVCHIPDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:46
kThemeEducation
@ kThemeEducation
Definition: dishdescriptors.h:144
MPEGDescriptor::DescriptorLength
uint DescriptorLength(void) const
Definition: mpegdescriptors.h:346
DishEventVCHIPDescriptor::s_vchipRatingsDesc
static QMap< uint, QString > s_vchipRatingsDesc
Definition: dishdescriptors.h:64
DishEventVCHIPDescriptor::s_vchipRatingsLock
static QMutex s_vchipRatingsLock
Definition: dishdescriptors.h:63
DishEventNameDescriptor::HasName
bool HasName(void) const
Definition: dishdescriptors.h:78
DishEventPropertiesDescriptor::s_decompressed
static bool s_decompressed
Definition: dishdescriptors.h:120
DishEventVCHIPDescriptor::advisory_raw
uint advisory_raw(void) const
Definition: dishdescriptors.h:56
DishEventPropertiesDescriptor::AudioProperties
uint AudioProperties(uint compression_type) const
Definition: dishdescriptors.cpp:62
DishEventPropertiesDescriptor::s_subtitleProps
static uint s_subtitleProps
Definition: dishdescriptors.h:118
DishEventPropertiesDescriptor::decompress_properties
void decompress_properties(uint compression_type) const
Definition: dishdescriptors.cpp:69
DishEventDescriptionDescriptor::DescriptionRaw
const unsigned char * DescriptionRaw(void) const
Definition: dishdescriptors.cpp:21
DishEventMPAADescriptor::Init
static void Init(void)
Definition: dishdescriptors.cpp:228
DishEventMPAADescriptor::s_mpaaRatingsLock
static QMutex s_mpaaRatingsLock
Definition: dishdescriptors.h:38
kThemeSports
@ kThemeSports
Definition: dishdescriptors.h:141
DishEventVCHIPDescriptor::Init
static void Init(void)
Definition: dishdescriptors.cpp:283
DishEventVCHIPDescriptor::rating_raw
uint rating_raw(void) const
Definition: dishdescriptors.h:52
DishEventTagsDescriptor::DishEventTagsDescriptor
DishEventTagsDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:126
DishEventDescriptionDescriptor
Definition: dishdescriptors.h:82
atscdescriptors.h
DishEventNameDescriptor
Definition: dishdescriptors.h:68
DishEventTagsDescriptor::seriesid
QString seriesid(void) const
Definition: dishdescriptors.cpp:120
kThemeReligious
@ kThemeReligious
Definition: dishdescriptors.h:147
DishEventVCHIPDescriptor::s_vchipRatingsExists
static bool s_vchipRatingsExists
Definition: dishdescriptors.h:65
DishContentDescriptor::s_dishCategoryDescExists
static volatile bool s_dishCategoryDescExists
Definition: dishdescriptors.h:171
DishEventMPAADescriptor::s_mpaaRatingsDesc
static QMap< uint, QString > s_mpaaRatingsDesc
Definition: dishdescriptors.h:39
DishEventDescriptionDescriptor::HasDescription
bool HasDescription(void) const
Definition: dishdescriptors.h:95
DishEventMPAADescriptor::rating_raw
uint rating_raw(void) const
Definition: dishdescriptors.h:27
DishContentDescriptor::GetCategory
QString GetCategory(void) const
Definition: dishdescriptors.cpp:349
MPEGDescriptor
Definition: mpegdescriptors.h:302
MPEGDescriptor::m_data
const unsigned char * m_data
Definition: mpegdescriptors.h:370
DishEventVCHIPDescriptor::advisory
QString advisory(void) const
Definition: dishdescriptors.cpp:264
DishContentDescriptor::s_themeDesc
static QMap< uint, QString > s_themeDesc
Definition: dishdescriptors.h:169
string_to_dish_theme_type
DishThemeType string_to_dish_theme_type(const QString &type)
Definition: dishdescriptors.cpp:318
DishEventMPAADescriptor::advisory_raw
uint advisory_raw(void) const
Definition: dishdescriptors.h:31
DishEventMPAADescriptor::advisory
QString advisory(void) const
Definition: dishdescriptors.cpp:205
DishEventMPAADescriptor::stars_raw
uint stars_raw(void) const
Definition: dishdescriptors.h:23
DishEventNameDescriptor::DishEventNameDescriptor
DishEventNameDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:71
uint
unsigned int uint
Definition: compat.h:81
DishEventVCHIPDescriptor::rating
QString rating(void) const
Definition: dishdescriptors.cpp:249
DishEventMPAADescriptor::s_mpaaRatingsExists
static bool s_mpaaRatingsExists
Definition: dishdescriptors.h:40
DishEventPropertiesDescriptor::s_audioProps
static uint s_audioProps
Definition: dishdescriptors.h:119
DishEventDescriptionDescriptor::Description
QString Description(uint compression_type) const
Definition: dishdescriptors.cpp:39
DishEventPropertiesDescriptor::HasProperties
bool HasProperties(void) const
Definition: dishdescriptors.h:110
DishEventPropertiesDescriptor
Definition: dishdescriptors.h:99
DishEventTagsDescriptor
Definition: dishdescriptors.h:123
DishEventTagsDescriptor::originalairdate
QDate originalairdate(void) const
Definition: dishdescriptors.cpp:144
kThemeNone
@ kThemeNone
Definition: dishdescriptors.h:139
kThemeFamily
@ kThemeFamily
Definition: dishdescriptors.h:143
DishEventMPAADescriptor::stars
float stars(void) const
Definition: dishdescriptors.cpp:174
ContentDescriptor
Definition: dvbdescriptors.h:617
DishContentDescriptor::GetTheme
DishThemeType GetTheme(void) const
Definition: dishdescriptors.cpp:333
DishContentDescriptor::DishContentDescriptor
DishContentDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:158
DishEventMPAADescriptor
Definition: dishdescriptors.h:14
DishContentDescriptor::toString
QString toString() const override
Definition: dishdescriptors.cpp:368
kThemeLast
@ kThemeLast
Definition: dishdescriptors.h:149
DishEventPropertiesDescriptor::DishEventPropertiesDescriptor
DishEventPropertiesDescriptor(const unsigned char *data, int len=300)
Definition: dishdescriptors.h:102
DishEventTagsDescriptor::programid
QString programid(void) const
Definition: dishdescriptors.cpp:87
DishContentDescriptor::Init
static void Init(void)
Definition: dishdescriptors.cpp:373
kThemeSeries
@ kThemeSeries
Definition: dishdescriptors.h:145
DishEventVCHIPDescriptor
Definition: dishdescriptors.h:43
DishContentDescriptor::s_dishCategoryDesc
static QMap< uint, QString > s_dishCategoryDesc
Definition: dishdescriptors.h:170
kThemeOffAir
@ kThemeOffAir
Definition: dishdescriptors.h:148
DishEventMPAADescriptor::rating
QString rating(void) const
Definition: dishdescriptors.cpp:190
DishEventDescriptionDescriptor::DescriptionRawLength
uint DescriptionRawLength(void) const
Definition: dishdescriptors.cpp:30
kThemeMovie
@ kThemeMovie
Definition: dishdescriptors.h:140
DishEventPropertiesDescriptor::SubtitleProperties
uint SubtitleProperties(uint compression_type) const
Definition: dishdescriptors.cpp:55
dish_theme_type_to_string
QString dish_theme_type_to_string(uint theme_type)
Definition: dishdescriptors.cpp:304
kThemeNews
@ kThemeNews
Definition: dishdescriptors.h:142
DishContentDescriptor
Definition: dishdescriptors.h:155
DishEventNameDescriptor::Name
QString Name(uint compression_type) const
Definition: dishdescriptors.cpp:12
DishThemeType
DishThemeType
Definition: dishdescriptors.h:137
dvbdescriptors.h
PrivateDescriptorID
Definition: mpegdescriptors.h:197