clib/dvb_ts_lib/tables/parse_si_cat.c

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 33 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/dvb_ts_lib/tables/parse_si_bat.c ↑ Summary clib/dvb_ts_lib/tables/parse_si_cit.c »
1 /*
2 * parse_si_cat.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_cat.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 // conditional_access_section() {
43 // table_id 8 uimsbf
44 // section_syntax_indicator 1 bslbf
45 // '0' 1 bslbf
46 // reserved 2 bslbf
47 // section_length 12 uimsbf
48 // reserved 18 bslbf
49 // version_number 5 uimsbf
50 // current_next_indicator 1 bslbf
51 // section_number 8 uimsbf
52 // last_section_number 8 uimsbf
53 // for (i = 0; i < N; i++) {
54 // descriptor()
55 // }
56 // CRC_32 32 rpchof
57 // }
58
59
60 /* ----------------------------------------------------------------------- */
61 0 void print_cat(struct Section_conditional_access *cat)
62 {
63 struct list_head *item, *safe;
64 int end_buff_len ;
65
66 0 printf("Table: conditional_access [0x%02x]\n", cat->table_id) ;
67 0 printf("Length: %d\n", cat->section_length) ;
68
69 //== data ==
70 0 printf("section_syntax_indicator = %d\n", cat->section_syntax_indicator) ;
71 0 printf("version_number = %d\n", cat->version_number) ;
72 0 printf("current_next_indicator = %d\n", cat->current_next_indicator) ;
73 0 printf("section_number = %d\n", cat->section_number) ;
74 0 printf("last_section_number = %d\n", cat->last_section_number) ;
75
76 // Descriptors list
77 0 print_desc_list(&cat->descriptors_array, 1) ;
78 0 }
79
80 /* ----------------------------------------------------------------------- */
81 0 void parse_cat(struct TS_reader *tsreader, struct TS_state *tsstate, struct TS_bits *bits,
82 Section_handler handler, struct Section_decode_flags *flags)
83 {
84 struct Section_conditional_access cat ;
85 struct list_head *item, *safe;
86 unsigned byte ;
87 int end_buff_len ;
88
89 //== Parse data ==
90
91 0 cat.table_id = bits_get(bits, 8) ;
92 0 cat.section_syntax_indicator = bits_get(bits, 1) ;
93 0 bits_skip(bits, 1) ;
94 0 bits_skip(bits, 2) ;
95 0 cat.section_length = bits_get(bits, 12) ;
96 0 bits_skip(bits, 18) ;
97 0 cat.version_number = bits_get(bits, 5) ;
98 0 cat.current_next_indicator = bits_get(bits, 1) ;
99 0 cat.section_number = bits_get(bits, 8) ;
100 0 cat.last_section_number = bits_get(bits, 8) ;
101
102 // Descriptors
103 0 INIT_LIST_HEAD(&cat.descriptors_array);
104 0 end_buff_len = bits_len_calc(bits, -cat.section_length ) ;
105 0 ▶ while (bits->buff_len > end_buff_len)
Branch: 1 branch
BranchTrueFalseTotal
while (bits->buff_len > end_buff_len) 0 0 0
106 {
107 0 enum TS_descriptor_ids desc_tag = parse_desc(&cat.descriptors_array, bits, flags->decode_descriptor) ;
108 }
109
110
111 //== Call handler ==
112 0 ▶ if (handler)
Branch: 1 branch
BranchTrueFalseTotal
if (handler) 0 0 0
113 0 handler(tsreader, tsstate, (struct Section *)&cat, tsreader->user_data) ;
114
115 //== Tidy up ==
116 0 free_descriptors_list(&cat.descriptors_array);
117 0 }
« clib/dvb_ts_lib/tables/parse_si_bat.c ↑ Summary clib/dvb_ts_lib/tables/parse_si_cit.c »