Skip to content

Commit 99cec05

Browse files
committedMay 8, 2015
Many bug fixes and changes
1 parent 0ef038e commit 99cec05

21 files changed

+623
-180
lines changed
 

‎doxygen

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ EXPAND_ONLY_PREDEF = NO
260260
SEARCH_INCLUDES = YES
261261
INCLUDE_PATH =
262262
INCLUDE_FILE_PATTERNS =
263-
PREDEFINED =
263+
PREDEFINED = LIBDVBCSA
264264
EXPAND_AS_DEFINED =
265265
SKIP_FUNCTION_MACROS = YES
266266
#---------------------------------------------------------------------------

‎src/ChannelData.cpp

+40-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
*/
2020
#include "ChannelData.h"
2121
#include "StringConverter.h"
22+
#include "Utils.h"
23+
#include "Log.h"
2224

2325
#include <stdio.h>
2426

2527
ChannelData::ChannelData() {
28+
for (size_t i = 0; i < MAX_PIDS; ++i) {
29+
_pid.data[i].fd_dmx = -1;
30+
resetPid(i);
31+
}
32+
_pid.changed = false;
2633
initialize();
2734
}
2835

@@ -37,7 +44,7 @@ void ChannelData::initialize() {
3744
fec = FEC_AUTO;
3845
rolloff = ROLLOFF_AUTO;
3946
inversion = INVERSION_AUTO;
40-
47+
4148
for (size_t i = 0; i < MAX_PIDS; ++i) {
4249
resetPid(i);
4350
}
@@ -73,8 +80,11 @@ void ChannelData::resetPid(int pid) {
7380
_pid.data[pid].cc = 0x80;
7481
_pid.data[pid].cc_error = 0;
7582
_pid.data[pid].count = 0;
76-
_pid.data[pid].fd_dmx = -1;
7783
_pid.data[pid].pmt = false;
84+
_pid.data[pid].ecm = false;
85+
_pid.data[pid].demux = -1;
86+
_pid.data[pid].filter = -1;
87+
_pid.data[pid].parity = -1;
7888
}
7989

8090
uint32_t ChannelData::getPacketCounter(int pid) const {
@@ -89,6 +99,10 @@ int ChannelData::getDMXFileDescriptor(int pid) const {
8999
return _pid.data[pid].fd_dmx;
90100
}
91101

102+
void ChannelData::closeDMXFileDescriptor(int pid) {
103+
CLOSE_FD(_pid.data[pid].fd_dmx);
104+
}
105+
92106
void ChannelData::resetPIDChanged() {
93107
_pid.changed = false;
94108
}
@@ -138,6 +152,7 @@ void ChannelData::setPID(int pid, bool val) {
138152
// Do we need to remove this pid then also reset PMT
139153
if (!val) {
140154
_pid.data[pid].pmt = false;
155+
_pid.data[pid].ecm = false;
141156
}
142157
}
143158

@@ -158,3 +173,26 @@ bool ChannelData::isPMTPID(int pid) const {
158173
return _pid.data[pid].pmt;
159174
}
160175

176+
void ChannelData::setECMFilterData(int demux, int filter, int pid, int parity) {
177+
_pid.data[pid].ecm = true;
178+
_pid.data[pid].demux = demux;
179+
_pid.data[pid].filter = filter;
180+
// _pid.data[pid].parity = parity;
181+
}
182+
183+
void ChannelData::getECMFilterData(int &demux, int &filter, int pid) const {
184+
demux = _pid.data[pid].demux;
185+
filter = _pid.data[pid].filter;
186+
}
187+
188+
void ChannelData::setKeyParity(int pid, int parity) {
189+
_pid.data[pid].parity = parity;
190+
}
191+
192+
int ChannelData::getKeyParity(int pid) const {
193+
return _pid.data[pid].parity;
194+
}
195+
196+
bool ChannelData::isECMPID(int pid) const {
197+
return _pid.data[pid].ecm;
198+
}

‎src/ChannelData.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ typedef struct {
3737
uint8_t cc; // continuity counter (0 - 15) of this PID
3838
uint32_t cc_error; // cc error count
3939
uint32_t count; // the number of times this pid occurred
40-
bool pmt; // show if this is an pmt pid
40+
bool pmt; // show if this is an PMT pid
41+
bool ecm; // show if this is an ECM pid
42+
int demux; // dvbapi demux
43+
int filter; // dvbapi filter
44+
int parity; // key parity
4145
} PidData_t;
4246

4347
typedef struct {
@@ -72,6 +76,9 @@ class ChannelData {
7276
/// Get DMX file descriptor
7377
int getDMXFileDescriptor(int pid) const;
7478

79+
/// Close DMX file descriptor
80+
void closeDMXFileDescriptor(int pid);
81+
7582
/// Get the amount of packet that were received of this pid
7683
uint32_t getPacketCounter(int pid) const;
7784

@@ -96,6 +103,20 @@ class ChannelData {
96103
/// Is the pid set as an PMT PID
97104
bool isPMTPID(int pid) const;
98105

106+
/// Set the filter data and ECM pid
107+
void setECMFilterData(int demux, int filter, int pid, int parity);
108+
109+
/// Get the filter data of the ECM pid
110+
void getECMFilterData(int &demux, int &filter, int pid) const;
111+
112+
/// Set the key parity of the pid
113+
void setKeyParity(int pid, int parity);
114+
115+
/// Get the key parity of the pid
116+
int getKeyParity(int pid) const;
117+
118+
/// Is the pid set as an ECM PID
119+
bool isECMPID(int pid) const;
99120
// protected:
100121

101122
// private:

‎src/Configure.h

+6
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@
4040
#define ADD_CONFIG_NUMBER(xml, clName, streamID, varName, value, minValue, maxValue) \
4141
StringConverter::addFormattedString(xml, "<%s><inputtype>number</inputtype><id>%s,%d,%s</id><value>%lu</value><minvalue>%lu</minvalue><maxvalue>%lu</maxvalue></%s>", varName, clName, streamID, varName, value, minValue, maxValue, varName);
4242

43+
#define ADD_CONFIG_TEXT(xml, clName, streamID, varName, value) \
44+
StringConverter::addFormattedString(xml, "<%s><inputtype>text</inputtype><id>%s,%d,%s</id><value>%s</value></%s>", varName, clName, streamID, varName, value, varName);
45+
46+
#define ADD_CONFIG_IP(xml, clName, streamID, varName, value) \
47+
StringConverter::addFormattedString(xml, "<%s><inputtype>ip</inputtype><id>%s,%d,%s</id><value>%s</value></%s>", varName, clName, streamID, varName, value, varName);
48+
4349
#endif // CONFIGURE_H_INCLUDE

2 commit comments

Comments
 (2)

pbriesch commented on May 8, 2015

@pbriesch

Hi Marc,

I'm glad to see that the project is moving on. I just want to mention a compile waring:

src/ChannelData.cpp:176:72: warning: unused parameter ‘parity’ [-Wunused-parameter]
 void ChannelData::setECMFilterData(int demux, int filter, int pid, int parity) {
                                                                        ^

Tomorrow I will have time to do some testing.
Paul

Barracuda09 commented on May 8, 2015

@Barracuda09
OwnerAuthor

Hi Paul,

Yes Thanks.. I have not paid to much attention to warnings.. Only fixing some annoying bug
that crept in last time.

Marc

Please sign in to comment.