|
@@ -124,6 +124,8 @@ static void decode_buffer(struct ts *ts, uint8_t *data, int data_len) {
|
124
|
124
|
struct dvbcsa_bs_batch_s even_pcks[batch_sz + 1];
|
125
|
125
|
struct dvbcsa_bs_batch_s odd_pcks [batch_sz + 1];
|
126
|
126
|
|
|
127
|
+ int scramble_idx_old = 0;
|
|
128
|
+
|
127
|
129
|
// Prepare batch structure
|
128
|
130
|
for (i = 0; i < batch_sz; i++) {
|
129
|
131
|
uint8_t *ts_packet = data + (i * 188);
|
|
@@ -132,6 +134,8 @@ static void decode_buffer(struct ts *ts, uint8_t *data, int data_len) {
|
132
|
134
|
if (pidmap_get(&ts->pidmap, pid) && ts_packet_is_scrambled(ts_packet)) {
|
133
|
135
|
if (ts->key.is_valid_cw) {
|
134
|
136
|
int scramble_idx = ts_packet_get_scrambled(ts_packet);
|
|
137
|
+ if (!scramble_idx_old)
|
|
138
|
+ scramble_idx_old = scramble_idx;
|
135
|
139
|
uint8_t payload_ofs = ts_packet_get_payload_offset(ts_packet);
|
136
|
140
|
if (scramble_idx == 2) { // scramble_idx 2 == even key
|
137
|
141
|
even_pcks[even_packets].data = ts_packet + payload_ofs;
|
|
@@ -144,6 +148,15 @@ static void decode_buffer(struct ts *ts, uint8_t *data, int data_len) {
|
144
|
148
|
odd_packets++;
|
145
|
149
|
}
|
146
|
150
|
ts_packet_set_not_scrambled(ts_packet);
|
|
151
|
+ if (scramble_idx_old != scramble_idx) {
|
|
152
|
+ struct timeval tv;
|
|
153
|
+ gettimeofday(&tv, NULL);
|
|
154
|
+ ts_LOGf("CWC | SID 0x%04x ------------ EcmTime: %5llu ms CW_time: %5llu ms\n",
|
|
155
|
+ ts->service_id,
|
|
156
|
+ timeval_diff_msec(&ts->ecm_change_time, &tv),
|
|
157
|
+ timeval_diff_msec(&ts->key.ts_keyset, &tv));
|
|
158
|
+ }
|
|
159
|
+ scramble_idx_old = scramble_idx;
|
147
|
160
|
} else {
|
148
|
161
|
if (ts->pid_filter)
|
149
|
162
|
ts_packet_set_pid(ts_packet, 0x1fff);
|
|
@@ -307,6 +320,7 @@ void process_packets(struct ts *ts, uint8_t *data, ssize_t data_len) {
|
307
|
320
|
if (ts->pid_report)
|
308
|
321
|
ts->pid_stats[pid]++;
|
309
|
322
|
|
|
323
|
+
|
310
|
324
|
ts_pack_shown = 0;
|
311
|
325
|
|
312
|
326
|
process_pat(ts, pid, ts_packet);
|