clib/dvb_ts_lib/tables/parse_si_rst.c

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 44 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/dvb_ts_lib/tables/parse_si_pmt.c ↑ Summary clib/dvb_ts_lib/tables/parse_si_sdt.c »
1 /*
2 * parse_si_rst.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_rst.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 // running_status_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 // for (i=0;i<N;i++){
49 // transport_stream_id 16 uimsbf
50 // original_network_id 16 uimsbf
51 // service_id 16 uimsbf
52 // event_id 16 uimsbf
53 // reserved_future_use 5 bslbf
54 // running_status 3 uimsbf
55 // }
56 // }
57
58
59 /* ----------------------------------------------------------------------- */
60 0 void print_rst(struct Section_running_status *rst)
61 {
62 struct list_head *item, *safe;
63 int end_buff_len ;
64
65 0 printf("Table: running_status [0x%02x]\n", rst->table_id) ;
66 0 printf("Length: %d\n", rst->section_length) ;
67
68 //== data ==
69 0 printf("section_syntax_indicator = %d\n", rst->section_syntax_indicator) ;
70
71 0 ▶ list_for_each_safe(item,safe,&rst->rst_array) {
Branch: 1 branch
BranchTrueFalseTotal
list_for_each_safe(item,safe,&rst->rst_array) { 0 0 0
72 0 struct RST_entry *rst_entry = list_entry(item, struct RST_entry, next);
73
74 // RST entry
75 0 printf(" -RST entry-\n") ;
76
77 0 printf(" transport_stream_id = %d\n", rst_entry->transport_stream_id) ;
78 0 printf(" original_network_id = %d\n", rst_entry->original_network_id) ;
79 0 printf(" service_id = %d\n", rst_entry->service_id) ;
80 0 printf(" event_id = %d\n", rst_entry->event_id) ;
81 0 printf(" running_status = %d\n", rst_entry->running_status) ;
82 }
83
84 0 }
85
86 /* ----------------------------------------------------------------------- */
87 0 void parse_rst(struct TS_reader *tsreader, struct TS_state *tsstate, struct TS_bits *bits,
88 Section_handler handler, struct Section_decode_flags *flags)
89 {
90 struct Section_running_status rst ;
91 struct list_head *item, *safe;
92 unsigned byte ;
93 int end_buff_len ;
94
95 //== Parse data ==
96
97 0 rst.table_id = bits_get(bits, 8) ;
98 0 rst.section_syntax_indicator = bits_get(bits, 1) ;
99 0 bits_skip(bits, 1) ;
100 0 bits_skip(bits, 2) ;
101 0 rst.section_length = bits_get(bits, 12) ;
102
103 0 INIT_LIST_HEAD(&rst.rst_array) ;
104 0 ▶ while (bits->buff_len >= 9)
Branch: 1 branch
BranchTrueFalseTotal
while (bits->buff_len >= 9) 0 0 0
105 {
106 0 struct RST_entry *rst_entry = malloc(sizeof(*rst_entry));
107 0 memset(rst_entry,0,sizeof(*rst_entry));
108 0 list_add_tail(&rst_entry->next,&rst.rst_array);
109
110 0 rst_entry->transport_stream_id = bits_get(bits, 16) ;
111 0 rst_entry->original_network_id = bits_get(bits, 16) ;
112 0 rst_entry->service_id = bits_get(bits, 16) ;
113 0 rst_entry->event_id = bits_get(bits, 16) ;
114 0 bits_skip(bits, 5) ;
115 0 rst_entry->running_status = bits_get(bits, 3) ;
116 }
117
118
119 //== Call handler ==
120 0 ▶ if (handler)
Branch: 1 branch
BranchTrueFalseTotal
if (handler) 0 0 0
121 0 handler(tsreader, tsstate, (struct Section *)&rst, tsreader->user_data) ;
122
123 //== Tidy up ==
124
125 0 ▶ list_for_each_safe(item,safe,&rst.rst_array) {
Branch: 1 branch
BranchTrueFalseTotal
list_for_each_safe(item,safe,&rst.rst_array) { 0 0 0
126 0 struct RST_entry *rst_entry = list_entry(item, struct RST_entry, next);
127 0 free(rst_entry) ;
128 }
129
130 0 }
« clib/dvb_ts_lib/tables/parse_si_pmt.c ↑ Summary clib/dvb_ts_lib/tables/parse_si_sdt.c »