xs/DVBT-epg.c

filter: Statementstmt 0.0% 0 / 60 Branchbran 0.0% 0 / 52 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 112 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/mpeg2audio_stubs/mpegaudio_stubs.c ↑ Summary xs/DVBT-init-c.c »
1 # /*---------------------------------------------------------------------------------------------------*/
2  
3 void
4 dvb_clear_epg();
5 CODE:
6 0 clear_epg() ;
7  
8  
9 # /*---------------------------------------------------------------------------------------------------*/
10 # /* Scan all streams to gather all EPG information */
11 SV *
12 dvb_epg(DVB *dvb, int verbose, int alive, int section)
13  
14 INIT:
15 AV * results;
16  
17 struct list_head *epg_list ;
18 struct list_head *item, *safe;
19 struct epgitem *epg;
20 struct epgitem dummy_epg;
21  
22 0 results = (AV *)sv_2mortal((SV *)newAV());
23  
24 CODE:
25  
26 /*
27 // NOTE: Mask allows for multiple sections
28 // e.g. 0x50, 0xf0 means "read sections 0x50 - 0x5f"
29  
30 //
31 // 0x4E event_information_section - actual_transport_stream, present/following
32 // 0x4F event_information_section - other_transport_stream, present/following
33 // 0x50 to 0x5F event_information_section - actual_transport_stream, schedule
34 // 0x60 to 0x6F event_information_section - other_transport_stream, schedule
35 //
36 // 0x50 - 0x6f => 01010000 - 01101111
37 */
38 0 ▶ if (section)
Branch: 1 branch
BranchTrueFalseTotal
if (section) 0 0 0
39 {
40 0 epg_list = get_eit(/* struct dvb_state *dvb */ dvb,
41 /* int section */section, /* int mask */0xff,
42 /* int verbose */ verbose, /* int alive */ alive) ;
43 }
44 else
45 {
46 0 epg_list = get_eit(/* struct dvb_state *dvb */ dvb,
47 /* int section */0x50, /* int mask */0xf0,
48 /* int verbose */ verbose, /* int alive */ alive) ;
49  
50 0 epg_list = get_eit(/* struct dvb_state *dvb */ dvb,
51 /* int section */0x60, /* int mask */0xf0,
52 /* int verbose */ verbose, /* int alive */ alive) ;
53 }
54  
55 0 ▶ if (epg_list)
Branch: 1 branch
BranchTrueFalseTotal
if (epg_list) 0 0 0
56 {
57 /* Create Perl data */
58 0 ▶ list_for_each(item, epg_list)
Branch: 1 branch
BranchTrueFalseTotal
list_for_each(item, epg_list) 0 0 0
59 {
60 HV * rh;
61  
62 0 epg = list_entry(item, struct epgitem, next);
63  
64 /* Convert structure fields into hash elements */
65 0 rh = (HV *)sv_2mortal((SV *)newHV());
66  
67 0 ▶ HVS_I(rh, epg, id) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, id) ; 0 0 0
68 0 ▶ HVS_I(rh, epg, tsid) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, tsid) ; 0 0 0
69 0 ▶ HVS_I(rh, epg, pnr) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, pnr) ; 0 0 0
70 0 ▶ HVS_I(rh, epg, start) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, start) ; 0 0 0
71 0 ▶ HVS_I(rh, epg, stop) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, stop) ; 0 0 0
72 0 HVS_I(rh, epg, duration_secs) ;
73 0 HVS_I(rh, epg, flags) ;
74  
75 0 ▶ if (epg->lang[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->lang[0]) 0 0 0
76 {
77 0 HVS_STRING(rh, epg, lang);
78 }
79 0 ▶ if (epg->name[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->name[0]) 0 0 0
80 {
81 // title
82 0 HVS_STRING(rh, epg, name);
83 }
84 0 ▶ if (epg->stext[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->stext[0]) 0 0 0
85 {
86 // synopsis / description
87 0 HVS_STRING(rh, epg, stext);
88 }
89 0 ▶ if (epg->etext)
Branch: 1 branch
BranchTrueFalseTotal
if (epg->etext) 0 0 0
90 {
91 // extended text
92 0 HVS_STRING(rh, epg, etext);
93 }
94 0 ▶ if (epg->playing)
Branch: 1 branch
BranchTrueFalseTotal
if (epg->playing) 0 0 0
95 {
96 0 ▶ HVS_I(rh, epg, playing) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, epg, playing) ; 0 0 0
97 }
98 0 ▶ if (epg->cat[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->cat[0]) 0 0 0
99 {
100 0 hv_store(rh, "genre", sizeof("genre")-1, newSVpv(_to_string(epg->cat[0]), 0), 0) ;
101 }
102 0 ▶ if (epg->tva_prog[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->tva_prog[0]) 0 0 0
103 {
104 0 HVS_STRING(rh, epg, tva_prog);
105 }
106 0 ▶ if (epg->tva_series[0])
Branch: 1 branch
BranchTrueFalseTotal
if (epg->tva_series[0]) 0 0 0
107 {
108 0 HVS_STRING(rh, epg, tva_series);
109 }
110  
111 0 av_push(results, newRV((SV *)rh));
112 }
113  
114  
115 }
116  
117 0 RETVAL = newRV((SV *)results);
118 OUTPUT:
119 RETVAL
120  
121 # /*---------------------------------------------------------------------------------------------------*/
122 # /* Gather EPG statistics */
123 SV *
124 dvb_epg_stats(DVB *dvb)
125  
126 INIT:
127 HV * results;
128  
129 struct partitem *partp;
130 struct erritem *errp;
131 struct list_head *item;
132  
133 HV * totals ;
134 AV * parts ;
135 AV * errors ;
136  
137 0 results = (HV *)sv_2mortal((SV *)newHV());
138 0 totals = (HV *)sv_2mortal((SV *)newHV());
139 0 parts = (AV *)sv_2mortal((SV *)newAV());
140 0 errors = (AV *)sv_2mortal((SV *)newAV());
141  
142 CODE:
143  
144 /* Create Perl data */
145 0 HVS(results, totals, newRV((SV *)totals)) ;
146 0 HVS(results, parts, newRV((SV *)parts)) ;
147 0 HVS(results, errors, newRV((SV *)errors)) ;
148  
149  
150 // totals
151 0 HVS_INT(totals, parts_remaining, parts_remaining) ;
152 0 HVS_INT(totals, total_errors, total_errors) ;
153  
154  
155 // list of parts
156 0 ▶ list_for_each(item, &parts_list)
Branch: 1 branch
BranchTrueFalseTotal
list_for_each(item, &parts_list) 0 0 0
157 {
158 HV * rh;
159 struct partitem *partp;
160  
161 0 partp = list_entry(item, struct partitem, next);
162  
163 /* Convert structure fields into hash elements */
164 0 rh = (HV *)sv_2mortal((SV *)newHV());
165  
166 /*
167 struct partitem {
168 struct list_head next;
169 int pnr;
170 int tsid;
171 int parts;
172 int parts_left;
173 };
174 */
175 0 ▶ HVS_I(rh, partp, pnr) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, partp, pnr) ; 0 0 0
176 0 ▶ HVS_I(rh, partp, tsid) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, partp, tsid) ; 0 0 0
177 0 ▶ HVS_I(rh, partp, parts) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, partp, parts) ; 0 0 0
178 0 ▶ HVS_I(rh, partp, parts_left) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, partp, parts_left) ; 0 0 0
179  
180  
181 0 av_push(parts, newRV((SV *)rh));
182 }
183  
184 // list of errors
185 0 ▶ list_for_each(item, &errs_list)
Branch: 1 branch
BranchTrueFalseTotal
list_for_each(item, &errs_list) 0 0 0
186 {
187 HV * rh;
188 struct erritem *errp;
189  
190 0 errp = list_entry(item, struct erritem, next);
191  
192 /* Convert structure fields into hash elements */
193 0 rh = (HV *)sv_2mortal((SV *)newHV());
194  
195 /*
196 struct erritem {
197 struct list_head next;
198 int freq;
199 int section;
200 int errors;
201 };
202 */
203 0 ▶ HVS_I(rh, errp, freq) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, errp, freq) ; 0 0 0
204 0 ▶ HVS_I(rh, errp, section) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, errp, section) ; 0 0 0
205 0 ▶ HVS_I(rh, errp, errors) ;
Branch: 1 branch
BranchTrueFalseTotal
HVS_I(rh, errp, errors) ; 0 0 0
206  
207 0 av_push(errors, newRV((SV *)rh));
208 }
209  
210  
211 0 RETVAL = newRV((SV *)results);
212 OUTPUT:
213 RETVAL
214  
215  
« clib/mpeg2audio_stubs/mpegaudio_stubs.c ↑ Summary xs/DVBT-init-c.c »