« clib/dvb_ts_lib/descriptors/parse_desc_pdc.c
↑ Summary
clib/dvb_ts_lib/descriptors/parse_desc_s2_satellite_delivery_system.c »
| 1 | /* | ||
| 2 | * parse_desc_private_data_specifier.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_private_data_specifier.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 | // private_data_specifier_descriptor(){ | ||
| 43 | // descriptor_tag 8 uimsbf | ||
| 44 | // descriptor_length 8 uimsbf | ||
| 45 | // private_data_specifier 32 uimsbf | ||
| 46 | // } | ||
| 47 | |||
| 48 | |||
| 49 | /* ----------------------------------------------------------------------- */ | ||
| 50 | 0 | void print_private_data_specifier(struct Descriptor_private_data_specifier *pdsd, int level) | |
| 51 | { | ||
| 52 | struct list_head *item, *safe; | ||
| 53 | |||
| 54 | 0 | printf(" Descriptor: private_data_specifier [0x%02x]\n", pdsd->descriptor_tag) ; | |
| 55 | 0 | printf(" Length: %d\n", pdsd->descriptor_length) ; | |
| 56 | |||
| 57 | 0 | printf(" private_data_specifier = %d\n", pdsd->private_data_specifier) ; | |
| 58 | 0 | } | |
| 59 | |||
| 60 | /* ----------------------------------------------------------------------- */ | ||
| 61 | 0 | struct Descriptor *parse_private_data_specifier(struct TS_bits *bits, unsigned tag, unsigned len) | |
| 62 | { | ||
| 63 | struct Descriptor_private_data_specifier *pdsd ; | ||
| 64 | unsigned byte ; | ||
| 65 | int end_buff_len ; | ||
| 66 | |||
| 67 | 0 | pdsd = (struct Descriptor_private_data_specifier *)malloc( sizeof(*pdsd) ) ; | |
| 68 | 0 | memset(pdsd,0,sizeof(*pdsd)); | |
| 69 | |||
| 70 | //== Parse data == | ||
| 71 | 0 | INIT_LIST_HEAD(&pdsd->next); | |
| 72 | 0 | pdsd->descriptor_tag = tag ; // already extracted by parse_desc() | |
| 73 | 0 | pdsd->descriptor_length = len ; // already extracted by parse_desc() | |
| 74 | 0 | pdsd->private_data_specifier = bits_get(bits, 32) ; | |
| 75 | |||
| 76 | 0 | return (struct Descriptor *)pdsd ; | |
| 77 | } | ||
| 78 | |||
| 79 | /* ----------------------------------------------------------------------- */ | ||
| 80 | 0 | void free_private_data_specifier(struct Descriptor_private_data_specifier *pdsd) | |
| 81 | { | ||
| 82 | struct list_head *item, *safe; | ||
| 83 | |||
| 84 | 0 | free(pdsd) ; | |
| 85 | 0 | } |