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:11
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:46
PSIPTable
A PSIP table is a variant of a PES packet containing an MPEG, ATSC or DVB table.
Definition: mpegtables.h:399
PremiereContentInformationTable::EventCount
static uint EventCount(void)
Definition: premieretables.h:32
byteBCD2int
#define byteBCD2int(i)
Definition: dvbdescriptors.h:53
PremiereContentPresentationTable::PremiereContentPresentationTable
PremiereContentPresentationTable(const PSIPTable &table)
Definition: premieretables.h:48
mpegtables.h
uint
unsigned int uint
Definition: compat.h:141
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:18
PSIPTable::TableID
uint TableID(void) const
Definition: mpegtables.h:504
PremiereContentInformationTable::Descriptors
const unsigned char * Descriptors() const
Definition: premieretables.h:36
PSIPTable::psipdata
const unsigned char * psipdata(void) const
Definition: mpegtables.h:547
dvbdescriptors.h