Browse Source

Add ts_packet_get_scrambled()

Georgi Chorbadzhiyski 9 years ago
parent
commit
1adc87bcef
2 changed files with 6 additions and 1 deletions
  1. 5 1
      tsfuncs.c
  2. 1 0
      tsfuncs.h

+ 5 - 1
tsfuncs.c View File

@@ -42,8 +42,12 @@ inline void ts_packet_inc_cont(uint8_t *ts_packet, uint8_t increment) {
42 42
 	ts_packet_set_cont(ts_packet, ts_packet_get_cont(ts_packet) + increment);
43 43
 }
44 44
 
45
+inline int ts_packet_get_scrambled(uint8_t *ts_packet) {
46
+	return ts_packet[3] >> 6; // 0 is not scamlbed, 1 is reserved, 2 or 3 mean scrambled
47
+}
48
+
45 49
 inline int ts_packet_is_scrambled(uint8_t *ts_packet) {
46
-	return (ts_packet[3] >> 6) > 1; // 0 is not scamlbed, 1 is reserved, 2 or 3 mean scrambled
50
+	return ts_packet_get_scrambled(ts_packet) > 1;
47 51
 }
48 52
 
49 53
 void ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype) {

+ 1 - 0
tsfuncs.h View File

@@ -50,6 +50,7 @@ void            ts_packet_inc_cont  (uint8_t *ts_packet, uint8_t increment);
50 50
 uint8_t         ts_packet_get_payload_offset(uint8_t *ts_packet);
51 51
 
52 52
 int             ts_packet_is_scrambled(uint8_t *ts_packet);
53
+int             ts_packet_get_scrambled(uint8_t *ts_packet);
53 54
 void            ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype);
54 55
 
55 56
 int				ts_packet_has_pcr		(uint8_t *ts_packet);