| 1 |
|
| /*
|
| 2 |
|
| * parse_si_dit.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_si_dit.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 |
|
| // discontinuity_information_section(){
|
| 43 |
|
| // table_id 8 uimsbf
|
| 44 |
|
| // section_syntax_indicator 1 bslbf
|
| 45 |
|
| // reserved_future_use 1 bslbf
|
| 46 |
|
| // reserved 2 bslbf
|
| 47 |
|
| // section_length 12 uimsbf
|
| 48 |
|
| // transition_flag 1 uimsbf
|
| 49 |
|
| // reserved_future_use 7 bslbf
|
| 50 |
|
| // }
|
| 51 |
|
|
|
| 52 |
|
|
|
| 53 |
|
| /* ----------------------------------------------------------------------- */
|
| 54 |
0 |
| void print_dit(struct Section_discontinuity_information *dit)
|
| 55 |
|
| {
|
| 56 |
|
| struct list_head *item, *safe;
|
| 57 |
|
| int end_buff_len ;
|
| 58 |
|
|
|
| 59 |
0 |
| printf("Table: discontinuity_information [0x%02x]\n", dit->table_id) ;
|
| 60 |
0 |
| printf("Length: %d\n", dit->section_length) ;
|
| 61 |
|
|
|
| 62 |
|
| //== data ==
|
| 63 |
0 |
| printf("section_syntax_indicator = %d\n", dit->section_syntax_indicator) ;
|
| 64 |
0 |
| printf("transition_flag = %d\n", dit->transition_flag) ;
|
| 65 |
0 |
| }
|
| 66 |
|
|
|
| 67 |
|
| /* ----------------------------------------------------------------------- */
|
| 68 |
0 |
| void parse_dit(struct TS_reader *tsreader, struct TS_state *tsstate, struct TS_bits *bits,
|
| 69 |
|
| Section_handler handler, struct Section_decode_flags *flags)
|
| 70 |
|
| {
|
| 71 |
|
| struct Section_discontinuity_information dit ;
|
| 72 |
|
| struct list_head *item, *safe;
|
| 73 |
|
| unsigned byte ;
|
| 74 |
|
| int end_buff_len ;
|
| 75 |
|
|
|
| 76 |
|
| //== Parse data ==
|
| 77 |
|
|
|
| 78 |
0 |
| dit.table_id = bits_get(bits, 8) ;
|
| 79 |
0 |
| dit.section_syntax_indicator = bits_get(bits, 1) ;
|
| 80 |
0 |
| bits_skip(bits, 1) ;
|
| 81 |
0 |
| bits_skip(bits, 2) ;
|
| 82 |
0 |
| dit.section_length = bits_get(bits, 12) ;
|
| 83 |
0 |
| dit.transition_flag = bits_get(bits, 1) ;
|
| 84 |
0 |
| bits_skip(bits, 7) ;
|
| 85 |
|
|
|
| 86 |
|
| //== Call handler ==
|
| 87 |
0 |
▶ | if (handler)
|
Branch: 1 branch
| Branch | True | False | Total |
| if (handler)
|
0 |
0 |
0 |
|
| 88 |
0 |
| handler(tsreader, tsstate, (struct Section *)&dit, tsreader->user_data) ;
|
| 89 |
|
|
|
| 90 |
|
| //== Tidy up ==
|
| 91 |
0 |
| }
|