MythTV  master
premieretables.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 #ifndef PREMIERE_TABLES_H
3 #define PREMIERE_TABLES_H
4 
5 #include <QString>
6 #include <cstdint> // uint32_t
7 #include "mpegtables.h"
8 #include "dvbdescriptors.h"
9 
11 {
12  public:
13  explicit PremiereContentInformationTable(const PSIPTable& table) : PSIPTable(table)
14  {
15  assert(IsEIT(TableID()));
16  }
17 
18  // content_id 32 0.0
19  uint ContentID(void) const
20  { return ( psipdata()[0]<<24) | (psipdata()[1]<<16) |
21  (psipdata()[2]<< 8) | psipdata()[3]; }
22 
23  // event_duration 24 4.0
25  { return ((byteBCD2int(psipdata()[4]) * 3600) +
26  (byteBCD2int(psipdata()[5]) * 60) +
27  (byteBCD2int(psipdata()[6]))); }
28  // descriptor length 8 8.0
30  { return ((psipdata()[7] & 0x0F) << 8) | psipdata()[8]; }
31 
32  static uint EventCount(void)
33  { return 1; }
34 
35  // descriptor length x 9.0
36  const unsigned char* Descriptors() const
37  { return &psipdata()[9]; }
38 
39  static bool IsEIT(uint table_id);
40 
41  private:
42  mutable std::vector<const unsigned char*> m_ptrs; // used to parse
43 };
44 
46 {
47  public:
48  explicit PremiereContentPresentationTable(const PSIPTable& table) : PSIPTable(table)
49  {
50  }
51 };
52 #endif // PREMIERE_TABLES_H
PremiereContentInformationTable
Definition: premieretables.h:10
PremiereContentInformationTable::PremiereContentInformationTable
PremiereContentInformationTable(const PSIPTable &table)
Definition: premieretables.h:13
PremiereContentInformationTable::DescriptorsLength
uint DescriptorsLength() const
Definition: premieretables.h:29
PremiereContentInformationTable::m_ptrs
std::vector< const unsigned char * > m_ptrs
Definition: premieretables.h:42
PremiereContentPresentationTable
Definition: premieretables.h:45
PSIPTable
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
Definition: mpegtables.h:409
PremiereContentInformationTable::EventCount
static uint EventCount(void)
Definition: premieretables.h:32
PremiereContentPresentationTable::PremiereContentPresentationTable
PremiereContentPresentationTable(const PSIPTable &table)
Definition: premieretables.h:48
byteBCD2int
static constexpr uint8_t byteBCD2int(uint8_t i)
Definition: dvbdescriptors.h:56
mpegtables.h
uint
unsigned int uint
Definition: compat.h:81
PremiereContentInformationTable::ContentID
uint ContentID(void) const
Definition: premieretables.h:19
PremiereContentInformationTable::IsEIT
static bool IsEIT(uint table_id)
Definition: premieretables.cpp:3
PremiereContentInformationTable::DurationInSeconds
uint DurationInSeconds() const
Definition: premieretables.h:24
assert
#define assert(x)
Definition: audiooutputalsa.cpp:16
PSIPTable::TableID
uint TableID(void) const
Definition: mpegtables.h:515
PremiereContentInformationTable::Descriptors
const unsigned char * Descriptors() const
Definition: premieretables.h:36
PSIPTable::psipdata
const unsigned char * psipdata(void) const
Definition: mpegtables.h:560
dvbdescriptors.h