« clib/dvb_ts_lib/descriptors/parse_desc_private_data_specifier.c
↑ Summary
clib/dvb_ts_lib/descriptors/parse_desc_satellite_delivery_system.c »
| 1 | /* | ||||||||||
| 2 | * parse_desc_s2_satellite_delivery_system.c | ||||||||||
| 3 | * | ||||||||||
| 4 | * Created by: si_desc.pl | ||||||||||
| 5 | * Created on: 20-May-2011 | ||||||||||
| 6 | * Author: sdprice1 | ||||||||||
| 7 | */ | ||||||||||
| 8 | |||||||||||
| 9 | |||||||||||
| 10 | // VERSION = 1.00 | ||||||||||
| 11 | |||||||||||
| 12 | /*=============================================================================================*/ | ||||||||||
| 13 | // USES | ||||||||||
| 14 | /*=============================================================================================*/ | ||||||||||
| 15 | |||||||||||
| 16 | #include <stdio.h> | ||||||||||
| 17 | #include <stdlib.h> | ||||||||||
| 18 | #include <unistd.h> | ||||||||||
| 19 | #include <string.h> | ||||||||||
| 20 | #include <errno.h> | ||||||||||
| 21 | #include <ctype.h> | ||||||||||
| 22 | #include <fcntl.h> | ||||||||||
| 23 | #include <inttypes.h> | ||||||||||
| 24 | |||||||||||
| 25 | #include "parse_desc_s2_satellite_delivery_system.h" | ||||||||||
| 26 | #include "descriptors/parse_desc.h" | ||||||||||
| 27 | |||||||||||
| 28 | /*=============================================================================================*/ | ||||||||||
| 29 | // CONSTANTS | ||||||||||
| 30 | /*=============================================================================================*/ | ||||||||||
| 31 | |||||||||||
| 32 | /*=============================================================================================*/ | ||||||||||
| 33 | // MACROS | ||||||||||
| 34 | /*=============================================================================================*/ | ||||||||||
| 35 | |||||||||||
| 36 | /*=============================================================================================*/ | ||||||||||
| 37 | // FUNCTIONS | ||||||||||
| 38 | /*=============================================================================================*/ | ||||||||||
| 39 | |||||||||||
| 40 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 41 | // | ||||||||||
| 42 | // S2_satellite_delivery_system_descriptor(){ | ||||||||||
| 43 | // descriptor_tag 8 uimsbf | ||||||||||
| 44 | // descriptor_length 8 uimsbf | ||||||||||
| 45 | // scrambling_sequence_selector 1 bslbf | ||||||||||
| 46 | // multiple_input_stream_flag 1 bslbf | ||||||||||
| 47 | // backwards_compatibility_indicator 1 bslbf | ||||||||||
| 48 | // reserved_future_use 5 bslbf | ||||||||||
| 49 | // if (scrambling_sequence_selector == 1){ | ||||||||||
| 50 | // Reserved 6 bslbf | ||||||||||
| 51 | // scrambling_sequence_index 18 uimsbf | ||||||||||
| 52 | // } | ||||||||||
| 53 | // if (multiple_input_stream_flag == 1){ | ||||||||||
| 54 | // input_stream_identifier 8 uimsbf | ||||||||||
| 55 | // } | ||||||||||
| 56 | // } | ||||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 60 | 0 | void print_s2_satellite_delivery_system(struct Descriptor_s2_satellite_delivery_system *ssdsd, int level) | |||||||||
| 61 | { | ||||||||||
| 62 | struct list_head *item, *safe; | ||||||||||
| 63 | |||||||||||
| 64 | 0 | printf(" Descriptor: s2_satellite_delivery_system [0x%02x]\n", ssdsd->descriptor_tag) ; | |||||||||
| 65 | 0 | printf(" Length: %d\n", ssdsd->descriptor_length) ; | |||||||||
| 66 | |||||||||||
| 67 | 0 | printf(" scrambling_sequence_selector = %d\n", ssdsd->scrambling_sequence_selector) ; | |||||||||
| 68 | 0 | printf(" multiple_input_stream_flag = %d\n", ssdsd->multiple_input_stream_flag) ; | |||||||||
| 69 | 0 | printf(" backwards_compatibility_indicator = %d\n", ssdsd->backwards_compatibility_indicator) ; | |||||||||
| 70 | 0 | ▶ | if (ssdsd->scrambling_sequence_selector == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | { | ||||||||||
| 72 | 0 | printf(" scrambling_sequence_index = %d\n", ssdsd->scrambling_sequence_index) ; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 0 | ▶ | if (ssdsd->multiple_input_stream_flag == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | { | ||||||||||
| 77 | 0 | printf(" input_stream_identifier = %d\n", ssdsd->input_stream_identifier) ; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 0 | } | |||||||||
| 81 | |||||||||||
| 82 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 83 | 0 | struct Descriptor *parse_s2_satellite_delivery_system(struct TS_bits *bits, unsigned tag, unsigned len) | |||||||||
| 84 | { | ||||||||||
| 85 | struct Descriptor_s2_satellite_delivery_system *ssdsd ; | ||||||||||
| 86 | unsigned byte ; | ||||||||||
| 87 | int end_buff_len ; | ||||||||||
| 88 | |||||||||||
| 89 | 0 | ssdsd = (struct Descriptor_s2_satellite_delivery_system *)malloc( sizeof(*ssdsd) ) ; | |||||||||
| 90 | 0 | memset(ssdsd,0,sizeof(*ssdsd)); | |||||||||
| 91 | |||||||||||
| 92 | //== Parse data == | ||||||||||
| 93 | 0 | INIT_LIST_HEAD(&ssdsd->next); | |||||||||
| 94 | 0 | ssdsd->descriptor_tag = tag ; // already extracted by parse_desc() | |||||||||
| 95 | 0 | ssdsd->descriptor_length = len ; // already extracted by parse_desc() | |||||||||
| 96 | 0 | ssdsd->scrambling_sequence_selector = bits_get(bits, 1) ; | |||||||||
| 97 | 0 | ssdsd->multiple_input_stream_flag = bits_get(bits, 1) ; | |||||||||
| 98 | 0 | ssdsd->backwards_compatibility_indicator = bits_get(bits, 1) ; | |||||||||
| 99 | 0 | bits_skip(bits, 5) ; | |||||||||
| 100 | 0 | ▶ | if (ssdsd->scrambling_sequence_selector == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 101 | { | ||||||||||
| 102 | 0 | bits_skip(bits, 6) ; | |||||||||
| 103 | 0 | ssdsd->scrambling_sequence_index = bits_get(bits, 18) ; | |||||||||
| 104 | } | ||||||||||
| 105 | |||||||||||
| 106 | 0 | ▶ | if (ssdsd->multiple_input_stream_flag == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 107 | { | ||||||||||
| 108 | 0 | ssdsd->input_stream_identifier = bits_get(bits, 8) ; | |||||||||
| 109 | } | ||||||||||
| 110 | |||||||||||
| 111 | |||||||||||
| 112 | 0 | return (struct Descriptor *)ssdsd ; | |||||||||
| 113 | } | ||||||||||
| 114 | |||||||||||
| 115 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 116 | 0 | void free_s2_satellite_delivery_system(struct Descriptor_s2_satellite_delivery_system *ssdsd) | |||||||||
| 117 | { | ||||||||||
| 118 | struct list_head *item, *safe; | ||||||||||
| 119 | |||||||||||
| 120 | 0 | free(ssdsd) ; | |||||||||
| 121 | 0 | } | |||||||||