9
9
#include < vdr/tools.h>
10
10
#include " common.h"
11
11
12
- uint16_t ts_pid (const uint8_t *bufP)
13
- {
14
- return (uint16_t )(((bufP[1 ] & 0x1f ) << 8 ) + bufP[2 ]);
12
+ uint16_t ts_pid (const uint8_t *bufP) {
13
+ return (uint16_t ) (((bufP[1 ] & 0x1f ) << 8 ) + bufP[2 ]);
15
14
}
16
15
17
- uint8_t payload (const uint8_t *bufP)
18
- {
19
- if (!(bufP[3 ] & 0x10 )) // no payload?
20
- return 0 ;
21
-
22
- if (bufP[3 ] & 0x20 ) { // adaptation field?
23
- if (bufP[4 ] > 183 ) // corrupted data?
16
+ uint8_t payload (const uint8_t *bufP) {
17
+ if (!(bufP[3 ] & 0x10 )) {// no payload?
24
18
return 0 ;
25
- else
26
- return (uint8_t )((184 - 1 ) - bufP[4 ]);
27
- }
19
+ }
20
+
21
+ if (bufP[3 ] & 0x20 ) { // adaptation field?
22
+ if (bufP[4 ] > 183 ) { // corrupted data?
23
+ return 0 ;
24
+ } else {
25
+ return (uint8_t ) ((184 - 1 ) - bufP[4 ]);
26
+ }
27
+ }
28
28
29
- return 184 ;
29
+ return 184 ;
30
30
}
31
31
32
- const char *id_pid (const u_short pidP)
33
- {
34
- for ( int i = 0 ; i < SECTION_FILTER_TABLE_SIZE; ++i ) {
35
- if (pidP == section_filter_table[i].pid )
36
- return section_filter_table[i]. tag ;
37
- }
38
- return " ---" ;
32
+ const char *id_pid (const u_short pidP) {
33
+ for ( int i = 0 ; i < SECTION_FILTER_TABLE_SIZE; ++i) {
34
+ if (pidP==section_filter_table[i]. pid ) {
35
+ return section_filter_table[i].tag ;
36
+ }
37
+ }
38
+ return " ---" ;
39
39
}
40
40
41
- int select_single_desc (int descriptorP, const int usecsP, const bool selectWriteP)
42
- {
43
- // Wait for data
44
- struct timeval tv;
45
- tv.tv_sec = 0 ;
46
- tv.tv_usec = usecsP;
47
- // Use select
48
- fd_set infd;
49
- fd_set outfd;
50
- fd_set errfd;
51
- FD_ZERO (&infd);
52
- FD_ZERO (&outfd);
53
- FD_ZERO (&errfd);
54
- FD_SET (descriptorP, &errfd);
55
- if (selectWriteP)
56
- FD_SET (descriptorP, &outfd);
57
- else
58
- FD_SET (descriptorP, &infd);
59
- int retval = select (descriptorP + 1 , &infd, &outfd, &errfd, &tv);
60
- // Check if error
61
- ERROR_IF_RET (retval < 0 , " select()" , return retval);
62
- return retval;
41
+ int select_single_desc (int descriptorP, const int usecsP, const bool selectWriteP) {
42
+ // Wait for data
43
+ struct timeval tv;
44
+ tv.tv_sec = 0 ;
45
+ tv.tv_usec = usecsP;
46
+ // Use select
47
+ fd_set infd;
48
+ fd_set outfd;
49
+ fd_set errfd;
50
+ FD_ZERO (&infd);
51
+ FD_ZERO (&outfd);
52
+ FD_ZERO (&errfd);
53
+ FD_SET (descriptorP, &errfd);
54
+
55
+ if (selectWriteP) {
56
+ FD_SET (descriptorP, &outfd);
57
+ } else {
58
+ FD_SET (descriptorP, &infd);
59
+ }
60
+
61
+ int retval = select (descriptorP + 1 , &infd, &outfd, &errfd, &tv);
62
+
63
+ // Check if error
64
+ ERROR_IF_RET (retval < 0 , " select()" , return retval);
65
+ return retval;
63
66
}
64
67
65
- cString ChangeCase (const cString &strP, bool upperP)
66
- {
67
- cString res (strP) ;
68
- char *p = ( char *)*res;
69
- while (p && *p) {
68
+ cString ChangeCase (const cString &strP, bool upperP) {
69
+ cString res (strP);
70
+ char *p = ( char *) *res ;
71
+
72
+ while (p && *p) {
70
73
*p = upperP ? toupper (*p) : tolower (*p);
71
74
++p;
72
- }
73
- return res;
75
+ }
76
+ return res;
74
77
}
75
78
76
79
const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE] =
77
- {
78
- /* description tag pid tid mask */
79
- {trNOOP (" PAT (0x00)" ), " PAT" , 0x00 , 0x00 , 0xFF },
80
- {trNOOP (" NIT (0x40)" ), " NIT" , 0x10 , 0x40 , 0xFF },
81
- {trNOOP (" SDT (0x42)" ), " SDT" , 0x11 , 0x42 , 0xFF },
82
- {trNOOP (" EIT (0x4E/0x4F/0x5X/0x6X)" ), " EIT" , 0x12 , 0x40 , 0xC0 },
83
- {trNOOP (" TDT (0x70)" ), " TDT" , 0x14 , 0x70 , 0xFF },
84
- };
85
-
86
- std::string ReplaceAll (std::string str, const std::string& from, const std::string& to) {
80
+ {
81
+ /* description tag pid tid mask */
82
+ {trNOOP (" PAT (0x00)" ), " PAT" , 0x00 , 0x00 , 0xFF },
83
+ {trNOOP (" NIT (0x40)" ), " NIT" , 0x10 , 0x40 , 0xFF },
84
+ {trNOOP (" SDT (0x42)" ), " SDT" , 0x11 , 0x42 , 0xFF },
85
+ {trNOOP (" EIT (0x4E/0x4F/0x5X/0x6X)" ), " EIT" , 0x12 , 0x40 , 0xC0 },
86
+ {trNOOP (" TDT (0x70)" ), " TDT" , 0x14 , 0x70 , 0xFF },
87
+ };
88
+
89
+ std::string ReplaceAll (std::string str, const std::string & from, const std::string & to) {
87
90
size_t start_pos = 0 ;
88
- while ((start_pos = str.find (from, start_pos)) != std::string::npos) {
91
+
92
+ while ((start_pos = str.find (from, start_pos))!=std::string::npos) {
89
93
str.replace (start_pos, from.length (), to);
90
94
start_pos += to.length (); // Handles case where 'to' is a substring of 'from'
91
95
}
@@ -97,6 +101,7 @@ void printBacktrace() {
97
101
98
102
cBackTrace::BackTrace (stringList, 0 , false );
99
103
esyslog (" [iptv] Backtrace size: %d" , stringList.Size ());
104
+
100
105
for (int i = 0 ; i < stringList.Size (); ++i) {
101
106
esyslog (" [iptv] ==> %s" , stringList[i]);
102
107
}
0 commit comments