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