« clib/dvb_ts_lib/descriptors/parse_desc_ca_identifier.c
↑ Summary
clib/dvb_ts_lib/descriptors/parse_desc_cell_frequency_link.c »
| 1 | /* | ||
| 2 | * parse_desc_cable_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_cable_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 | // cable_delivery_system_descriptor(){ | ||
| 43 | // descriptor_tag 8 uimsbf | ||
| 44 | // descriptor_length 8 uimsbf | ||
| 45 | // frequency 32 bslbf | ||
| 46 | // reserved_future_use 12 bslbf | ||
| 47 | // FEC_outer 4 bslbf | ||
| 48 | // modulation 8 bslbf | ||
| 49 | // symbol_rate 28 bslbf | ||
| 50 | // FEC_inner 4 bslbf | ||
| 51 | // } | ||
| 52 | |||
| 53 | |||
| 54 | /* ----------------------------------------------------------------------- */ | ||
| 55 | 0 | void print_cable_delivery_system(struct Descriptor_cable_delivery_system *cdsd, int level) | |
| 56 | { | ||
| 57 | struct list_head *item, *safe; | ||
| 58 | |||
| 59 | 0 | printf(" Descriptor: cable_delivery_system [0x%02x]\n", cdsd->descriptor_tag) ; | |
| 60 | 0 | printf(" Length: %d\n", cdsd->descriptor_length) ; | |
| 61 | |||
| 62 | 0 | printf(" frequency = %d\n", cdsd->frequency) ; | |
| 63 | 0 | printf(" FEC_outer = %d\n", cdsd->FEC_outer) ; | |
| 64 | 0 | printf(" modulation = %d\n", cdsd->modulation) ; | |
| 65 | 0 | printf(" symbol_rate = %d\n", cdsd->symbol_rate) ; | |
| 66 | 0 | printf(" FEC_inner = %d\n", cdsd->FEC_inner) ; | |
| 67 | 0 | } | |
| 68 | |||
| 69 | /* ----------------------------------------------------------------------- */ | ||
| 70 | 0 | struct Descriptor *parse_cable_delivery_system(struct TS_bits *bits, unsigned tag, unsigned len) | |
| 71 | { | ||
| 72 | struct Descriptor_cable_delivery_system *cdsd ; | ||
| 73 | unsigned byte ; | ||
| 74 | int end_buff_len ; | ||
| 75 | |||
| 76 | 0 | cdsd = (struct Descriptor_cable_delivery_system *)malloc( sizeof(*cdsd) ) ; | |
| 77 | 0 | memset(cdsd,0,sizeof(*cdsd)); | |
| 78 | |||
| 79 | //== Parse data == | ||
| 80 | 0 | INIT_LIST_HEAD(&cdsd->next); | |
| 81 | 0 | cdsd->descriptor_tag = tag ; // already extracted by parse_desc() | |
| 82 | 0 | cdsd->descriptor_length = len ; // already extracted by parse_desc() | |
| 83 | 0 | cdsd->frequency = bits_get(bits, 32) ; | |
| 84 | 0 | bits_skip(bits, 12) ; | |
| 85 | 0 | cdsd->FEC_outer = bits_get(bits, 4) ; | |
| 86 | 0 | cdsd->modulation = bits_get(bits, 8) ; | |
| 87 | 0 | cdsd->symbol_rate = bits_get(bits, 28) ; | |
| 88 | 0 | cdsd->FEC_inner = bits_get(bits, 4) ; | |
| 89 | |||
| 90 | 0 | return (struct Descriptor *)cdsd ; | |
| 91 | } | ||
| 92 | |||
| 93 | /* ----------------------------------------------------------------------- */ | ||
| 94 | 0 | void free_cable_delivery_system(struct Descriptor_cable_delivery_system *cdsd) | |
| 95 | { | ||
| 96 | struct list_head *item, *safe; | ||
| 97 | |||
| 98 | 0 | free(cdsd) ; | |
| 99 | 0 | } |