« clib/dvb_ts_lib/descriptors/parse_desc_s2_satellite_delivery_system.c
↑ Summary
clib/dvb_ts_lib/descriptors/parse_desc_scrambling.c »
| 1 | /* | ||||||||||
| 2 | * parse_desc_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_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 | // satellite_delivery_system_descriptor(){ | ||||||||||
| 43 | // descriptor_tag 8 uimsbf | ||||||||||
| 44 | // descriptor_length 8 uimsbf | ||||||||||
| 45 | // frequency 32 bslbf | ||||||||||
| 46 | // orbital_position 16 bslbf | ||||||||||
| 47 | // west_east_flag 1 bslbf | ||||||||||
| 48 | // polarization 2 bslbf | ||||||||||
| 49 | // If (modulation_system == "1") { | ||||||||||
| 50 | // roll_off 2 bslbf | ||||||||||
| 51 | // } else { | ||||||||||
| 52 | // "00" 2 bslbf | ||||||||||
| 53 | // } | ||||||||||
| 54 | // modulation_system 1 bslbf | ||||||||||
| 55 | // modulation_type 2 bslbf | ||||||||||
| 56 | // symbol_rate 28 bslbf | ||||||||||
| 57 | // FEC_inner 4 bslbf | ||||||||||
| 58 | // } | ||||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 62 | 0 | void print_satellite_delivery_system(struct Descriptor_satellite_delivery_system *sdsd, int level) | |||||||||
| 63 | { | ||||||||||
| 64 | struct list_head *item, *safe; | ||||||||||
| 65 | |||||||||||
| 66 | 0 | printf(" Descriptor: satellite_delivery_system [0x%02x]\n", sdsd->descriptor_tag) ; | |||||||||
| 67 | 0 | printf(" Length: %d\n", sdsd->descriptor_length) ; | |||||||||
| 68 | |||||||||||
| 69 | 0 | printf(" frequency = %d\n", sdsd->frequency) ; | |||||||||
| 70 | 0 | printf(" orbital_position = %d\n", sdsd->orbital_position) ; | |||||||||
| 71 | 0 | printf(" west_east_flag = %d\n", sdsd->west_east_flag) ; | |||||||||
| 72 | 0 | printf(" polarization = %d\n", sdsd->polarization) ; | |||||||||
| 73 | 0 | ▶ | if (sdsd->modulation_system == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | { | ||||||||||
| 75 | 0 | printf(" roll_off = %d\n", sdsd->roll_off) ; | |||||||||
| 76 | } | ||||||||||
| 77 | else | ||||||||||
| 78 | { | ||||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 0 | printf(" modulation_system = %d\n", sdsd->modulation_system) ; | |||||||||
| 82 | 0 | printf(" modulation_type = %d\n", sdsd->modulation_type) ; | |||||||||
| 83 | 0 | printf(" symbol_rate = %d\n", sdsd->symbol_rate) ; | |||||||||
| 84 | 0 | printf(" FEC_inner = %d\n", sdsd->FEC_inner) ; | |||||||||
| 85 | 0 | } | |||||||||
| 86 | |||||||||||
| 87 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 88 | 0 | struct Descriptor *parse_satellite_delivery_system(struct TS_bits *bits, unsigned tag, unsigned len) | |||||||||
| 89 | { | ||||||||||
| 90 | struct Descriptor_satellite_delivery_system *sdsd ; | ||||||||||
| 91 | unsigned byte ; | ||||||||||
| 92 | int end_buff_len ; | ||||||||||
| 93 | |||||||||||
| 94 | 0 | sdsd = (struct Descriptor_satellite_delivery_system *)malloc( sizeof(*sdsd) ) ; | |||||||||
| 95 | 0 | memset(sdsd,0,sizeof(*sdsd)); | |||||||||
| 96 | |||||||||||
| 97 | //== Parse data == | ||||||||||
| 98 | 0 | INIT_LIST_HEAD(&sdsd->next); | |||||||||
| 99 | 0 | sdsd->descriptor_tag = tag ; // already extracted by parse_desc() | |||||||||
| 100 | 0 | sdsd->descriptor_length = len ; // already extracted by parse_desc() | |||||||||
| 101 | 0 | sdsd->frequency = bits_get(bits, 32) ; | |||||||||
| 102 | 0 | sdsd->orbital_position = bits_get(bits, 16) ; | |||||||||
| 103 | 0 | sdsd->west_east_flag = bits_get(bits, 1) ; | |||||||||
| 104 | 0 | sdsd->polarization = bits_get(bits, 2) ; | |||||||||
| 105 | 0 | ▶ | if (sdsd->modulation_system == 0x1 ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 106 | { | ||||||||||
| 107 | 0 | sdsd->roll_off = bits_get(bits, 2) ; | |||||||||
| 108 | } | ||||||||||
| 109 | else | ||||||||||
| 110 | { | ||||||||||
| 111 | 0 | bits_skip(bits, 2) ; | |||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | 0 | sdsd->modulation_system = bits_get(bits, 1) ; | |||||||||
| 115 | 0 | sdsd->modulation_type = bits_get(bits, 2) ; | |||||||||
| 116 | 0 | sdsd->symbol_rate = bits_get(bits, 28) ; | |||||||||
| 117 | 0 | sdsd->FEC_inner = bits_get(bits, 4) ; | |||||||||
| 118 | |||||||||||
| 119 | 0 | return (struct Descriptor *)sdsd ; | |||||||||
| 120 | } | ||||||||||
| 121 | |||||||||||
| 122 | /* ----------------------------------------------------------------------- */ | ||||||||||
| 123 | 0 | void free_satellite_delivery_system(struct Descriptor_satellite_delivery_system *sdsd) | |||||||||
| 124 | { | ||||||||||
| 125 | struct list_head *item, *safe; | ||||||||||
| 126 | |||||||||||
| 127 | 0 | free(sdsd) ; | |||||||||
| 128 | 0 | } | |||||||||