Browse Source

Add ts_packet_set_not_scrambled()

Georgi Chorbadzhiyski 9 years ago
parent
commit
a0ebea40a6
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

@@ -50,8 +50,12 @@ inline int ts_packet_is_scrambled(uint8_t *ts_packet) {
50 50
 	return ts_packet_get_scrambled(ts_packet) > 1;
51 51
 }
52 52
 
53
-void ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype) {
53
+inline void ts_packet_set_not_scrambled(uint8_t *ts_packet) {
54 54
 	ts_packet[3] = ts_packet[3] &~ 0xc0; // Mask top two bits (11xxxxxx)
55
+}
56
+
57
+void ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype) {
58
+	ts_packet_set_not_scrambled(ts_packet);
55 59
 	if (stype == scrambled_with_even_key)
56 60
 		ts_packet[3] |= 2 << 6;
57 61
 	if (stype == scrambled_with_odd_key)

+ 1 - 0
tsfuncs.h View File

@@ -51,6 +51,7 @@ 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 53
 int             ts_packet_get_scrambled(uint8_t *ts_packet);
54
+void            ts_packet_set_not_scrambled(uint8_t *ts_packet);
54 55
 void            ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype);
55 56
 
56 57
 int				ts_packet_has_pcr		(uint8_t *ts_packet);