clib/dvb_ts_lib/tables/parse_si_tot.c

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 29 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/dvb_ts_lib/tables/parse_si_tdt.c ↑ Summary clib/dvb_ts_lib/ts_bits.c »
1 /*
2 * parse_si_tot.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_tot.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 // time_offset_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 // UTC_time 40 bslbf
49 // reserved 4 bslbf
50 // descriptors_loop_length 12 uimsbf
51 // for(i=0;i<N;i++){
52 // descriptor()
53 // }
54 // CRC_32 32 rpchof
55 // }
56
57
58 /* ----------------------------------------------------------------------- */
59 0 void print_tot(struct Section_time_offset *tot)
60 {
61 struct list_head *item, *safe;
62 int end_buff_len ;
63
64 0 printf("Table: time_offset [0x%02x]\n", tot->table_id) ;
65 0 printf("Length: %d\n", tot->section_length) ;
66
67 //== data ==
68 0 printf("section_syntax_indicator = %d\n", tot->section_syntax_indicator) ;
69 0 printf("UTC_time = %02d-%02d-%04d %02d:%02d:%02d\n",
70 tot->UTC_time.tm_mday, tot->UTC_time.tm_mon, tot->UTC_time.tm_year,
71 tot->UTC_time.tm_hour, tot->UTC_time.tm_min, tot->UTC_time.tm_sec
72 ) ;
73 0 printf("descriptors_loop_length = %d\n", tot->descriptors_loop_length) ;
74
75 // Descriptors list
76 0 print_desc_list(&tot->descriptors_array, 1) ;
77 0 }
78
79 /* ----------------------------------------------------------------------- */
80 0 void parse_tot(struct TS_reader *tsreader, struct TS_state *tsstate, struct TS_bits *bits,
81 Section_handler handler, struct Section_decode_flags *flags)
82 {
83 struct Section_time_offset tot ;
84 struct list_head *item, *safe;
85 unsigned byte ;
86 int end_buff_len ;
87
88 //== Parse data ==
89
90 0 tot.table_id = bits_get(bits, 8) ;
91 0 tot.section_syntax_indicator = bits_get(bits, 1) ;
92 0 bits_skip(bits, 1) ;
93 0 bits_skip(bits, 2) ;
94 0 tot.section_length = bits_get(bits, 12) ;
95 0 tot.UTC_time = bits_get_mjd_time(bits) ;
96 0 bits_skip(bits, 4) ;
97 0 tot.descriptors_loop_length = bits_get(bits, 12) ;
98
99 // Descriptors
100 0 INIT_LIST_HEAD(&tot.descriptors_array);
101 0 end_buff_len = bits_len_calc(bits, -tot.descriptors_loop_length ) ;
102 0 ▶ while (bits->buff_len > end_buff_len)
Branch: 1 branch
BranchTrueFalseTotal
while (bits->buff_len > end_buff_len) 0 0 0
103 {
104 0 enum TS_descriptor_ids desc_tag = parse_desc(&tot.descriptors_array, bits, flags->decode_descriptor) ;
105 }
106
107
108 //== Call handler ==
109 0 ▶ if (handler)
Branch: 1 branch
BranchTrueFalseTotal
if (handler) 0 0 0
110 0 handler(tsreader, tsstate, (struct Section *)&tot, tsreader->user_data) ;
111
112 //== Tidy up ==
113 0 free_descriptors_list(&tot.descriptors_array);
114 0 }
« clib/dvb_ts_lib/tables/parse_si_tdt.c ↑ Summary clib/dvb_ts_lib/ts_bits.c »