|
@@ -20,6 +20,7 @@
|
20
|
20
|
#include "csa.h"
|
21
|
21
|
#include "tables.h"
|
22
|
22
|
#include "util.h"
|
|
23
|
+#include "notify.h"
|
23
|
24
|
|
24
|
25
|
static unsigned long ts_pack;
|
25
|
26
|
static int ts_pack_shown;
|
|
@@ -122,12 +123,18 @@ static void decode_buffer(struct ts *ts, uint8_t *data, int data_len) {
|
122
|
123
|
|
123
|
124
|
int scramble_idx_old = 0;
|
124
|
125
|
|
|
126
|
+ time_t now = time(NULL);
|
|
127
|
+
|
125
|
128
|
// Prepare batch structure
|
126
|
129
|
for (i = 0; i < batch_sz; i++) {
|
127
|
130
|
uint8_t *ts_packet = data + (i * 188);
|
128
|
131
|
|
129
|
132
|
uint16_t pid = ts_packet_get_pid(ts_packet);
|
130
|
133
|
if (pidmap_get(&ts->pidmap, pid) && ts_packet_is_scrambled(ts_packet)) {
|
|
134
|
+ if (ts_packet_is_scrambled(ts_packet) && ts->last_scrambled_packet_ts != now) {
|
|
135
|
+ ts->stream_is_encrypted = 1;
|
|
136
|
+ ts->last_scrambled_packet_ts = now;
|
|
137
|
+ }
|
131
|
138
|
if (ts->key.is_valid_cw) {
|
132
|
139
|
int scramble_idx = ts_packet_get_scrambled(ts_packet);
|
133
|
140
|
if (!scramble_idx_old)
|
|
@@ -174,6 +181,13 @@ static void decode_buffer(struct ts *ts, uint8_t *data, int data_len) {
|
174
|
181
|
}
|
175
|
182
|
}
|
176
|
183
|
|
|
184
|
+ if (ts->last_scrambled_packet_ts && ts->last_scrambled_packet_ts < now - 5) {
|
|
185
|
+ ts_LOGf("N/E | No encrypted packet came during the last 5 seconds, disabling NO_CODE_WORD notifcation\n");
|
|
186
|
+ notify(ts, "STREAM_NOT_ENCRYPTED", "No encrypted packets were seen in the last 5 seconds.");
|
|
187
|
+ ts->stream_is_encrypted = 0;
|
|
188
|
+ ts->last_scrambled_packet_ts = 0;
|
|
189
|
+ }
|
|
190
|
+
|
177
|
191
|
// Decode packets
|
178
|
192
|
if (even_packets) {
|
179
|
193
|
if (use_dvbcsa) {
|