| 1 |
|
| /* |
| 2 |
|
| * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the |
| 3 |
|
| * contents of DVBT.xs. Do not edit this file, edit DVBT.xs instead. |
| 4 |
|
| * |
| 5 |
|
| * ANY CHANGES MADE HERE WILL BE LOST! |
| 6 |
|
| * |
| 7 |
|
| */ |
| 8 |
|
| |
| 9 |
|
| #line 1 "DVBT.xs" |
| 10 |
|
| #include "EXTERN.h" |
| 11 |
|
| #include "perl.h" |
| 12 |
|
| #include "XSUB.h" |
| 13 |
|
| |
| 14 |
|
| #include "ppport.h" |
| 15 |
|
| |
| 16 |
|
| /*---------------------------------------------------------------------------------------------------*/ |
| 17 |
|
| #include "xs/shared/DVBT-common.h" |
| 18 |
|
| #include "xs/DVBT-specific.h" |
| 19 |
|
| |
| 20 |
|
| #include "xs/DVBT-init-c.c" |
| 21 |
|
| |
| 22 |
|
| #define DVBT_VERSION "2.03" |
| 23 |
|
| |
| 24 |
|
| #line 25 "DVBT.c" |
| 25 |
|
| #ifndef PERL_UNUSED_VAR |
| 26 |
|
| # define PERL_UNUSED_VAR(var) if (0) var = var |
| 27 |
|
| #endif |
| 28 |
|
| |
| 29 |
|
| #ifndef dVAR |
| 30 |
|
| # define dVAR dNOOP |
| 31 |
|
| #endif |
| 32 |
|
| |
| 33 |
|
| |
| 34 |
|
| /* This stuff is not part of the API! You have been warned. */ |
| 35 |
|
| #ifndef PERL_VERSION_DECIMAL |
| 36 |
|
| # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
| 37 |
|
| #endif |
| 38 |
|
| #ifndef PERL_DECIMAL_VERSION |
| 39 |
|
| # define PERL_DECIMAL_VERSION \ |
| 40 |
|
| PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
| 41 |
|
| #endif |
| 42 |
|
| #ifndef PERL_VERSION_GE |
| 43 |
|
| # define PERL_VERSION_GE(r,v,s) \ |
| 44 |
|
| (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
| 45 |
|
| #endif |
| 46 |
|
| #ifndef PERL_VERSION_LE |
| 47 |
|
| # define PERL_VERSION_LE(r,v,s) \ |
| 48 |
|
| (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
| 49 |
|
| #endif |
| 50 |
|
| |
| 51 |
|
| /* XS_INTERNAL is the explicit static-linkage variant of the default |
| 52 |
|
| * XS macro. |
| 53 |
|
| * |
| 54 |
|
| * XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
| 55 |
|
| * "static", ie. it exports XSUB symbols. You probably don't want that |
| 56 |
|
| * for anything but the BOOT XSUB. |
| 57 |
|
| * |
| 58 |
|
| * See XSUB.h in core! |
| 59 |
|
| */ |
| 60 |
|
| |
| 61 |
|
| |
| 62 |
|
| /* TODO: This might be compatible further back than 5.10.0. */ |
| 63 |
|
| #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
| 64 |
|
| # undef XS_EXTERNAL |
| 65 |
|
| # undef XS_INTERNAL |
| 66 |
|
| # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
| 67 |
|
| # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
| 68 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 69 |
|
| # endif |
| 70 |
|
| # if defined(__SYMBIAN32__) |
| 71 |
|
| # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
| 72 |
|
| # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name) |
| 73 |
|
| # endif |
| 74 |
|
| # ifndef XS_EXTERNAL |
| 75 |
|
| # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
| 76 |
|
| # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
| 77 |
|
| # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__) |
| 78 |
|
| # else |
| 79 |
|
| # ifdef __cplusplus |
| 80 |
|
| # define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
| 81 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 82 |
|
| # else |
| 83 |
|
| # define XS_EXTERNAL(name) XSPROTO(name) |
| 84 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 85 |
|
| # endif |
| 86 |
|
| # endif |
| 87 |
|
| # endif |
| 88 |
|
| #endif |
| 89 |
|
| |
| 90 |
|
| /* perl >= 5.10.0 && perl <= 5.15.1 */ |
| 91 |
|
| |
| 92 |
|
| |
| 93 |
|
| /* The XS_EXTERNAL macro is used for functions that must not be static |
| 94 |
|
| * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
| 95 |
|
| * macro defined, the best we can do is assume XS is the same. |
| 96 |
|
| * Dito for XS_INTERNAL. |
| 97 |
|
| */ |
| 98 |
|
| #ifndef XS_EXTERNAL |
| 99 |
|
| # define XS_EXTERNAL(name) XS(name) |
| 100 |
|
| #endif |
| 101 |
|
| #ifndef XS_INTERNAL |
| 102 |
|
| # define XS_INTERNAL(name) XS(name) |
| 103 |
|
| #endif |
| 104 |
|
| |
| 105 |
|
| /* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
| 106 |
|
| * internal macro that we're free to redefine for varying linkage due |
| 107 |
|
| * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
| 108 |
|
| * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
| 109 |
|
| */ |
| 110 |
|
| |
| 111 |
|
| #undef XS_EUPXS |
| 112 |
|
| #if defined(PERL_EUPXS_ALWAYS_EXPORT) |
| 113 |
|
| # define XS_EUPXS(name) XS_EXTERNAL(name) |
| 114 |
|
| #else |
| 115 |
|
| /* default to internal */ |
| 116 |
|
| # define XS_EUPXS(name) XS_INTERNAL(name) |
| 117 |
|
| #endif |
| 118 |
|
| |
| 119 |
|
| #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 120 |
|
| #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
| 121 |
|
| |
| 122 |
|
| /* prototype to pass -Wmissing-prototypes */ |
| 123 |
|
| static void |
| 124 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params); |
| 125 |
|
| |
| 126 |
|
| static void |
| 127 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params) |
| 128 |
|
| { |
| 129 |
|
| const GV *const gv = CvGV(cv); |
| 130 |
|
| |
| 131 |
|
| PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
| 132 |
|
| |
| 133 |
|
| if (gv) { |
| 134 |
|
| const char *const gvname = GvNAME(gv); |
| 135 |
|
| const HV *const stash = GvSTASH(gv); |
| 136 |
|
| const char *const hvname = stash ? HvNAME(stash) : NULL; |
| 137 |
|
| |
| 138 |
|
| if (hvname) |
| 139 |
|
| Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
| 140 |
|
| else |
| 141 |
|
| Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
| 142 |
|
| } else { |
| 143 |
|
| /* Pants. I don't think that it should be possible to get here. */ |
| 144 |
|
| Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
| 145 |
|
| } |
| 146 |
|
| } |
| 147 |
|
| #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 148 |
|
| |
| 149 |
|
| #define croak_xs_usage S_croak_xs_usage |
| 150 |
|
| |
| 151 |
|
| #endif |
| 152 |
|
| |
| 153 |
|
| /* NOTE: the prototype of newXSproto() is different in versions of perls, |
| 154 |
|
| * so we define a portable version of newXSproto() |
| 155 |
|
| */ |
| 156 |
|
| #ifdef newXS_flags |
| 157 |
|
| #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
| 158 |
|
| #else |
| 159 |
|
| #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
| 160 |
|
| #endif /* !defined(newXS_flags) */ |
| 161 |
|
| |
| 162 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 163 |
|
| # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
| 164 |
|
| #else |
| 165 |
|
| # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
| 166 |
|
| #endif |
| 167 |
|
| |
| 168 |
|
| /* simple backcompat versions of the TARGx() macros with no optimisation */ |
| 169 |
|
| #ifndef TARGi |
| 170 |
|
| # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv) |
| 171 |
|
| # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv) |
| 172 |
|
| # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv) |
| 173 |
|
| #endif |
| 174 |
|
| |
| 175 |
|
| #line 176 "DVBT.c" |
| 176 |
|
| |
| 177 |
|
| /* INCLUDE: Including 'xs/DVBT-const.c' from 'DVBT.xs' */ |
| 178 |
|
| |
| 179 |
|
| |
| 180 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-const.c' */ |
| 181 |
|
| |
| 182 |
|
| |
| 183 |
|
| /* INCLUDE: Including 'xs/DVBT-init.c' from 'DVBT.xs' */ |
| 184 |
|
| |
| 185 |
|
| |
| 186 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_device_probe); /* prototype to pass -Wmissing-prototypes */ |
| 187 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_device_probe) |
| 188 |
|
| { |
| 189 |
0 |
| dVAR; dXSARGS; |
| 190 |
0 |
▶ | if (items < 2 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 2 || items > 3) |
0 |
0 |
0 |
| if (items < 2 || items > 3) |
0 |
0 |
0 |
|
| 191 |
0 |
| croak_xs_usage(cv, "adap, fe, debug=0"); |
| 192 |
|
| { |
| 193 |
|
| HV * RETVAL; |
| 194 |
0 |
| unsigned adap = (unsigned)SvUV(ST(0)) |
| 195 |
|
| ; |
| 196 |
0 |
| unsigned fe = (unsigned)SvUV(ST(1)) |
| 197 |
|
| ; |
| 198 |
|
| unsigned debug; |
| 199 |
|
| |
| 200 |
0 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
0 |
0 |
|
| 201 |
0 |
| debug = 0; |
| 202 |
|
| else { |
| 203 |
0 |
| debug = (unsigned)SvUV(ST(2)) |
| 204 |
|
| ; |
| 205 |
|
| } |
| 206 |
|
| #line 10 "./xs/DVBT-init.c" |
| 207 |
|
| struct devinfo *info ; |
| 208 |
|
| |
| 209 |
|
| HV *results ; |
| 210 |
|
| |
| 211 |
|
| #line 212 "DVBT.c" |
| 212 |
|
| #line 16 "./xs/DVBT-init.c" |
| 213 |
|
| /* get info */ |
| 214 |
|
| info = dvb_probe_frontend(adap, fe, debug) ; |
| 215 |
|
| |
| 216 |
|
| if (info) |
| 217 |
|
| { |
| 218 |
|
| results = device_info_hv(info) ; |
| 219 |
|
| |
| 220 |
|
| /* free info */ |
| 221 |
|
| free(info) ; |
| 222 |
|
| } |
| 223 |
|
| else |
| 224 |
|
| { |
| 225 |
|
| results = (HV *)sv_2mortal((SV *)newHV()); |
| 226 |
|
| } |
| 227 |
|
| |
| 228 |
|
| RETVAL = results ; |
| 229 |
|
| |
| 230 |
|
| #line 231 "DVBT.c" |
| 231 |
|
| { |
| 232 |
|
| SV * RETVALSV; |
| 233 |
0 |
| RETVALSV = newRV((SV*)RETVAL); |
| 234 |
0 |
| RETVALSV = sv_2mortal(RETVALSV); |
| 235 |
0 |
| ST(0) = RETVALSV; |
| 236 |
|
| } |
| 237 |
|
| } |
| 238 |
0 |
| XSRETURN(1); |
| 239 |
|
| } |
| 240 |
|
| |
| 241 |
|
| |
| 242 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_device_names); /* prototype to pass -Wmissing-prototypes */ |
| 243 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_device_names) |
| 244 |
|
| { |
| 245 |
0 |
| dVAR; dXSARGS; |
| 246 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 247 |
0 |
| croak_xs_usage(cv, "dvb"); |
| 248 |
|
| { |
| 249 |
|
| SV * RETVAL; |
| 250 |
|
| DVB * dvb; |
| 251 |
|
| |
| 252 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 253 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 254 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 255 |
|
| } |
| 256 |
|
| else { |
| 257 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 258 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 259 |
|
| "Linux::DVB::DVBT::dvb_device_names", |
| 260 |
|
| "dvb", "DVBPtr", |
| 261 |
0 |
| refstr, ST(0) |
| 262 |
|
| ); |
| 263 |
|
| } |
| 264 |
|
| ; |
| 265 |
|
| #line 43 "./xs/DVBT-init.c" |
| 266 |
|
| HV * results; |
| 267 |
|
| |
| 268 |
|
| #line 269 "DVBT.c" |
| 269 |
|
| #line 46 "./xs/DVBT-init.c" |
| 270 |
|
| results = (HV *)sv_2mortal((SV *)newHV()); |
| 271 |
|
| |
| 272 |
|
| /* get device names from dvb struct */ |
| 273 |
|
| HVS(results, fe_name, newSVpv(dvb->frontend, 0)) ; |
| 274 |
|
| HVS(results, demux_name, newSVpv(dvb->demux, 0)) ; |
| 275 |
|
| HVS(results, dvr_name, newSVpv(dvb->dvr, 0)) ; |
| 276 |
|
| |
| 277 |
|
| RETVAL = newRV((SV *)results); |
| 278 |
|
| #line 279 "DVBT.c" |
| 279 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 280 |
0 |
| ST(0) = RETVAL; |
| 281 |
|
| } |
| 282 |
0 |
| XSRETURN(1); |
| 283 |
|
| } |
| 284 |
|
| |
| 285 |
|
| |
| 286 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_init); /* prototype to pass -Wmissing-prototypes */ |
| 287 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_init) |
| 288 |
|
| { |
| 289 |
0 |
| dVAR; dXSARGS; |
| 290 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 291 |
0 |
| croak_xs_usage(cv, "adapter, frontend"); |
| 292 |
|
| { |
| 293 |
|
| DVB * RETVAL; |
| 294 |
0 |
| char * adapter = (char *)SvPV_nolen(ST(0)) |
| 295 |
|
| ; |
| 296 |
0 |
| int frontend = (int)SvIV(ST(1)) |
| 297 |
|
| ; |
| 298 |
|
| #line 63 "./xs/DVBT-init.c" |
| 299 |
|
| RETVAL = dvb_init(adapter, frontend) ; |
| 300 |
|
| #line 301 "DVBT.c" |
| 301 |
|
| { |
| 302 |
|
| SV * RETVALSV; |
| 303 |
0 |
| RETVALSV = sv_newmortal(); |
| 304 |
0 |
| sv_setref_pv(RETVALSV, "DVBPtr", (void*)RETVAL); |
| 305 |
0 |
| ST(0) = RETVALSV; |
| 306 |
|
| } |
| 307 |
|
| } |
| 308 |
0 |
| XSRETURN(1); |
| 309 |
|
| } |
| 310 |
|
| |
| 311 |
|
| |
| 312 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_init_nr); /* prototype to pass -Wmissing-prototypes */ |
| 313 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_init_nr) |
| 314 |
|
| { |
| 315 |
0 |
| dVAR; dXSARGS; |
| 316 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 317 |
0 |
| croak_xs_usage(cv, "adapter_num, frontend_num"); |
| 318 |
|
| { |
| 319 |
|
| DVB * RETVAL; |
| 320 |
0 |
| int adapter_num = (int)SvIV(ST(0)) |
| 321 |
|
| ; |
| 322 |
0 |
| int frontend_num = (int)SvIV(ST(1)) |
| 323 |
|
| ; |
| 324 |
|
| #line 73 "./xs/DVBT-init.c" |
| 325 |
|
| RETVAL = dvb_init_nr(adapter_num, frontend_num) ; |
| 326 |
|
| #line 327 "DVBT.c" |
| 327 |
|
| { |
| 328 |
|
| SV * RETVALSV; |
| 329 |
0 |
| RETVALSV = sv_newmortal(); |
| 330 |
0 |
| sv_setref_pv(RETVALSV, "DVBPtr", (void*)RETVAL); |
| 331 |
0 |
| ST(0) = RETVALSV; |
| 332 |
|
| } |
| 333 |
|
| } |
| 334 |
0 |
| XSRETURN(1); |
| 335 |
|
| } |
| 336 |
|
| |
| 337 |
|
| |
| 338 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_fini); /* prototype to pass -Wmissing-prototypes */ |
| 339 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_fini) |
| 340 |
|
| { |
| 341 |
0 |
| dVAR; dXSARGS; |
| 342 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 343 |
0 |
| croak_xs_usage(cv, "dvb"); |
| 344 |
|
| { |
| 345 |
|
| DVB * dvb; |
| 346 |
|
| |
| 347 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 348 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 349 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 350 |
|
| } |
| 351 |
|
| else { |
| 352 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 353 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 354 |
|
| "Linux::DVB::DVBT::dvb_fini", |
| 355 |
|
| "dvb", "DVBPtr", |
| 356 |
0 |
| refstr, ST(0) |
| 357 |
|
| ); |
| 358 |
|
| } |
| 359 |
|
| ; |
| 360 |
|
| #line 82 "./xs/DVBT-init.c" |
| 361 |
|
| dvb_fini(dvb) ; |
| 362 |
|
| #line 363 "DVBT.c" |
| 363 |
|
| } |
| 364 |
0 |
| XSRETURN_EMPTY; |
| 365 |
|
| } |
| 366 |
|
| |
| 367 |
|
| |
| 368 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_set_debug); /* prototype to pass -Wmissing-prototypes */ |
| 369 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_set_debug) |
| 370 |
|
| { |
| 371 |
0 |
| dVAR; dXSARGS; |
| 372 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 373 |
0 |
| croak_xs_usage(cv, "debug"); |
| 374 |
|
| { |
| 375 |
0 |
| int debug = (int)SvIV(ST(0)) |
| 376 |
|
| ; |
| 377 |
|
| #line 90 "./xs/DVBT-init.c" |
| 378 |
|
| dvb_debug = debug ; |
| 379 |
|
| DVBT_DEBUG = debug ; |
| 380 |
|
| #line 381 "DVBT.c" |
| 381 |
|
| } |
| 382 |
0 |
| XSRETURN_EMPTY; |
| 383 |
|
| } |
| 384 |
|
| |
| 385 |
|
| |
| 386 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_error_str); /* prototype to pass -Wmissing-prototypes */ |
| 387 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_error_str) |
| 388 |
|
| { |
| 389 |
0 |
| dVAR; dXSARGS; |
| 390 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 391 |
0 |
| croak_xs_usage(cv, ""); |
| 392 |
|
| { |
| 393 |
|
| SV * RETVAL; |
| 394 |
|
| #line 99 "./xs/DVBT-init.c" |
| 395 |
|
| SV *str; |
| 396 |
|
| char *error_str ; |
| 397 |
|
| |
| 398 |
|
| #line 399 "DVBT.c" |
| 399 |
|
| #line 103 "./xs/DVBT-init.c" |
| 400 |
|
| error_str = dvb_error_str(dvb_error_code) ; |
| 401 |
|
| RETVAL = newSVpv(error_str, 0) ; |
| 402 |
|
| |
| 403 |
|
| #line 404 "DVBT.c" |
| 404 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 405 |
0 |
| ST(0) = RETVAL; |
| 406 |
|
| } |
| 407 |
0 |
| XSRETURN(1); |
| 408 |
|
| } |
| 409 |
|
| |
| 410 |
|
| |
| 411 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_file_flags); /* prototype to pass -Wmissing-prototypes */ |
| 412 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_file_flags) |
| 413 |
|
| { |
| 414 |
0 |
| dVAR; dXSARGS; |
| 415 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 416 |
0 |
| croak_xs_usage(cv, ""); |
| 417 |
|
| { |
| 418 |
|
| #line 116 "./xs/DVBT-init.c" |
| 419 |
|
| fprintf(stderr, "O_LARGEFILE 0x%08x\n", O_LARGEFILE) ; |
| 420 |
|
| fprintf(stderr, "O_WRONLY 0x%08x\n", O_WRONLY) ; |
| 421 |
|
| fprintf(stderr, "O_TRUNC 0x%08x\n", O_TRUNC) ; |
| 422 |
|
| fprintf(stderr, "O_CREAT 0x%08x\n", O_CREAT) ; |
| 423 |
|
| #line 424 "DVBT.c" |
| 424 |
|
| } |
| 425 |
0 |
| XSRETURN_EMPTY; |
| 426 |
|
| } |
| 427 |
|
| |
| 428 |
|
| |
| 429 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_free_disk); /* prototype to pass -Wmissing-prototypes */ |
| 430 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_free_disk) |
| 431 |
|
| { |
| 432 |
0 |
| dVAR; dXSARGS; |
| 433 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 434 |
0 |
| croak_xs_usage(cv, "path"); |
| 435 |
|
| { |
| 436 |
|
| float RETVAL; |
| 437 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 438 |
0 |
| char * path = (char *)SvPV_nolen(ST(0)) |
| 439 |
|
| ; |
| 440 |
|
| #line 129 "./xs/DVBT-init.c" |
| 441 |
|
| unsigned long long free_space ; |
| 442 |
|
| |
| 443 |
|
| #line 444 "DVBT.c" |
| 444 |
|
| #line 132 "./xs/DVBT-init.c" |
| 445 |
|
| free_space = get_free_space(path) ; |
| 446 |
|
| //fprintf(stderr, "free_space(%s) %llu\n", path, free_space) ; |
| 447 |
|
| RETVAL = (float)free_space ; |
| 448 |
|
| //fprintf(stderr, " + space %.2f\n", RETVAL) ; |
| 449 |
|
| |
| 450 |
|
| #line 451 "DVBT.c" |
| 451 |
0 |
▶ | TARGn((double)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGn((double)RETVAL, 1); |
0 |
0 |
0 |
|
| 452 |
0 |
| ST(0) = TARG; |
| 453 |
|
| } |
| 454 |
0 |
| XSRETURN(1); |
| 455 |
|
| } |
| 456 |
|
| |
| 457 |
|
| |
| 458 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-init.c' */ |
| 459 |
|
| |
| 460 |
|
| |
| 461 |
|
| /* INCLUDE: Including 'xs/DVBT-scan.c' from 'DVBT.xs' */ |
| 462 |
|
| |
| 463 |
|
| |
| 464 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_new); /* prototype to pass -Wmissing-prototypes */ |
| 465 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_new) |
| 466 |
|
| { |
| 467 |
0 |
| dVAR; dXSARGS; |
| 468 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 469 |
0 |
| croak_xs_usage(cv, "dvb, verbose"); |
| 470 |
|
| { |
| 471 |
|
| DVB * dvb; |
| 472 |
0 |
| int verbose = (int)SvIV(ST(1)) |
| 473 |
|
| ; |
| 474 |
|
| |
| 475 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 476 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 477 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 478 |
|
| } |
| 479 |
|
| else { |
| 480 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 481 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 482 |
|
| "Linux::DVB::DVBT::dvb_scan_new", |
| 483 |
|
| "dvb", "DVBPtr", |
| 484 |
0 |
| refstr, ST(0) |
| 485 |
|
| ); |
| 486 |
|
| } |
| 487 |
|
| ; |
| 488 |
|
| #line 9 "./xs/DVBT-scan.c" |
| 489 |
|
| // init the freq list |
| 490 |
|
| clear_freqlist() ; |
| 491 |
|
| #line 492 "DVBT.c" |
| 492 |
|
| } |
| 493 |
0 |
| XSRETURN_EMPTY; |
| 494 |
|
| } |
| 495 |
|
| |
| 496 |
|
| |
| 497 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_init); /* prototype to pass -Wmissing-prototypes */ |
| 498 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_init) |
| 499 |
|
| { |
| 500 |
0 |
| dVAR; dXSARGS; |
| 501 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 502 |
0 |
| croak_xs_usage(cv, "dvb, verbose"); |
| 503 |
|
| { |
| 504 |
|
| DVB * dvb; |
| 505 |
0 |
| int verbose = (int)SvIV(ST(1)) |
| 506 |
|
| ; |
| 507 |
|
| |
| 508 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 509 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 510 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 511 |
|
| } |
| 512 |
|
| else { |
| 513 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 514 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 515 |
|
| "Linux::DVB::DVBT::dvb_scan_init", |
| 516 |
|
| "dvb", "DVBPtr", |
| 517 |
0 |
| refstr, ST(0) |
| 518 |
|
| ); |
| 519 |
|
| } |
| 520 |
|
| ; |
| 521 |
|
| #line 18 "./xs/DVBT-scan.c" |
| 522 |
|
| dvb_scan_init(dvb, verbose) ; |
| 523 |
|
| #line 524 "DVBT.c" |
| 524 |
|
| } |
| 525 |
0 |
| XSRETURN_EMPTY; |
| 526 |
|
| } |
| 527 |
|
| |
| 528 |
|
| |
| 529 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_end); /* prototype to pass -Wmissing-prototypes */ |
| 530 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_end) |
| 531 |
|
| { |
| 532 |
0 |
| dVAR; dXSARGS; |
| 533 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 534 |
0 |
| croak_xs_usage(cv, "dvb, verbose"); |
| 535 |
|
| { |
| 536 |
|
| DVB * dvb; |
| 537 |
0 |
| int verbose = (int)SvIV(ST(1)) |
| 538 |
|
| ; |
| 539 |
|
| |
| 540 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 541 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 542 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 543 |
|
| } |
| 544 |
|
| else { |
| 545 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 546 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 547 |
|
| "Linux::DVB::DVBT::dvb_scan_end", |
| 548 |
|
| "dvb", "DVBPtr", |
| 549 |
0 |
| refstr, ST(0) |
| 550 |
|
| ); |
| 551 |
|
| } |
| 552 |
|
| ; |
| 553 |
|
| #line 26 "./xs/DVBT-scan.c" |
| 554 |
|
| /* Free up results */ |
| 555 |
|
| dvb_scan_end(dvb, verbose) ; |
| 556 |
|
| #line 557 "DVBT.c" |
| 557 |
|
| } |
| 558 |
0 |
| XSRETURN_EMPTY; |
| 559 |
|
| } |
| 560 |
|
| |
| 561 |
|
| |
| 562 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan); /* prototype to pass -Wmissing-prototypes */ |
| 563 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan) |
| 564 |
|
| { |
| 565 |
0 |
| dVAR; dXSARGS; |
| 566 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 567 |
0 |
| croak_xs_usage(cv, "dvb, verbose"); |
| 568 |
|
| { |
| 569 |
|
| SV * RETVAL; |
| 570 |
|
| DVB * dvb; |
| 571 |
0 |
| int verbose = (int)SvIV(ST(1)) |
| 572 |
|
| ; |
| 573 |
|
| |
| 574 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 575 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 576 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 577 |
|
| } |
| 578 |
|
| else { |
| 579 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 580 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 581 |
|
| "Linux::DVB::DVBT::dvb_scan", |
| 582 |
|
| "dvb", "DVBPtr", |
| 583 |
0 |
| refstr, ST(0) |
| 584 |
|
| ); |
| 585 |
|
| } |
| 586 |
|
| ; |
| 587 |
|
| #line 35 "./xs/DVBT-scan.c" |
| 588 |
|
| HV * results; |
| 589 |
|
| |
| 590 |
|
| AV * streams ; |
| 591 |
|
| HV * freqs ; |
| 592 |
|
| AV * programs ; |
| 593 |
|
| |
| 594 |
|
| char key[256] ; |
| 595 |
|
| char key2[256] ; |
| 596 |
|
| |
| 597 |
|
| struct dvbmon *dm ; |
| 598 |
|
| struct list_head *item, *safe, *pitem, *fitem ; |
| 599 |
|
| struct psi_program *program ; |
| 600 |
|
| struct psi_stream *stream; |
| 601 |
|
| struct prog_info *pinfo ; |
| 602 |
|
| struct freqitem *freqi; |
| 603 |
|
| struct freq_info *finfo; |
| 604 |
|
| |
| 605 |
|
| results = (HV *)sv_2mortal((SV *)newHV()); |
| 606 |
|
| |
| 607 |
|
| streams = (AV *)sv_2mortal((SV *)newAV()); |
| 608 |
|
| programs = (AV *)sv_2mortal((SV *)newAV()); |
| 609 |
|
| freqs = (HV *)sv_2mortal((SV *)newHV()); |
| 610 |
|
| |
| 611 |
|
| #line 612 "DVBT.c" |
| 612 |
|
| #line 59 "./xs/DVBT-scan.c" |
| 613 |
|
| /* get info */ |
| 614 |
|
| dm = dvb_scan_freqs(dvb, verbose) ; |
| 615 |
|
| |
| 616 |
|
| /** Create Perl data **/ |
| 617 |
|
| HVS(results, ts, newRV((SV *)streams)) ; |
| 618 |
|
| HVS(results, pr, newRV((SV *)programs)) ; |
| 619 |
|
| HVS(results, freqs, newRV((SV *)freqs)) ; |
| 620 |
|
| |
| 621 |
|
| if (DVBT_DEBUG >= 10) |
| 622 |
|
| { |
| 623 |
|
| fprintf(stderr, "\n\n == DVBT.xs::dvb_scan() ================\n") ; |
| 624 |
|
| |
| 625 |
|
| } |
| 626 |
|
| |
| 627 |
|
| /* Store frequency info */ |
| 628 |
|
| list_for_each(item,&freq_list) |
| 629 |
|
| { |
| 630 |
|
| HV * fh; |
| 631 |
|
| |
| 632 |
|
| freqi = list_entry(item, struct freqitem, next); |
| 633 |
|
| |
| 634 |
|
| // Only consider valid frequencies |
| 635 |
|
| if (VALID_FREQ(freqi->frequency)) |
| 636 |
|
| { |
| 637 |
|
| |
| 638 |
|
| if (DVBT_DEBUG >= 10) |
| 639 |
|
| { |
| 640 |
|
| fprintf(stderr, "#@f FREQ: %d Hz seen=%d tuned=%d (Strength=%d) [", |
| 641 |
|
| freqi->frequency, |
| 642 |
|
| freqi->flags.seen, |
| 643 |
|
| freqi->flags.tuned, |
| 644 |
|
| freqi->strength |
| 645 |
|
| ) ; |
| 646 |
|
| fprintf(stderr, "inv=%d bw=%d crh=%d crl=%d con=%d tr=%d g=%d hi=%d", |
| 647 |
|
| freqi->params.inversion, |
| 648 |
|
| freqi->params.u.ofdm.bandwidth, |
| 649 |
|
| freqi->params.u.ofdm.code_rate_HP, |
| 650 |
|
| freqi->params.u.ofdm.code_rate_LP, |
| 651 |
|
| freqi->params.u.ofdm.constellation, |
| 652 |
|
| freqi->params.u.ofdm.transmission_mode, |
| 653 |
|
| freqi->params.u.ofdm.guard_interval, |
| 654 |
|
| freqi->params.u.ofdm.hierarchy_information |
| 655 |
|
| ) ; |
| 656 |
|
| fprintf(stderr, "]\n") ; |
| 657 |
|
| fprintf(stderr, "#@f Mod=%d\n", co_t[ freqi->params.u.ofdm.constellation ] ); |
| 658 |
|
| } |
| 659 |
|
| |
| 660 |
|
| /* Convert structure fields into hash elements */ |
| 661 |
|
| fh = (HV *)sv_2mortal((SV *)newHV()); |
| 662 |
|
| |
| 663 |
|
| HVS_I(fh, freqi, strength) ; |
| 664 |
|
| HVS_I(fh, freqi, ber) ; |
| 665 |
|
| HVS_I(fh, freqi, snr) ; |
| 666 |
|
| HVS(fh, seen, newSViv(freqi->flags.seen)) ; |
| 667 |
|
| HVS(fh, tuned, newSViv(freqi->flags.tuned)) ; |
| 668 |
|
| |
| 669 |
|
| // Convert frontend params into VDR values |
| 670 |
|
| HVS_INT(fh, inversion, freqi->params.inversion) ; |
| 671 |
|
| HVS_INT(fh, bandwidth, bw[ freqi->params.u.ofdm.bandwidth ] ); |
| 672 |
|
| HVS_INT(fh, code_rate_high, ra_t[ freqi->params.u.ofdm.code_rate_HP ] ); |
| 673 |
|
| HVS_INT(fh, code_rate_low, ra_t[ freqi->params.u.ofdm.code_rate_LP ] ); |
| 674 |
|
| HVS_INT(fh, modulation, co_t[ freqi->params.u.ofdm.constellation ] ); |
| 675 |
|
| HVS_INT(fh, transmission, tr[ freqi->params.u.ofdm.transmission_mode ] ); |
| 676 |
|
| HVS_INT(fh, guard_interval, gu[ freqi->params.u.ofdm.guard_interval ] ); |
| 677 |
|
| HVS_INT(fh, hierarchy, hi[ freqi->params.u.ofdm.hierarchy_information ] ); |
| 678 |
|
| |
| 679 |
|
| sprintf(key, "%d", freqi->frequency) ; |
| 680 |
|
| hv_store(freqs, key, strlen(key), newRV((SV *)fh), 0) ; |
| 681 |
|
| |
| 682 |
|
| } // freq valid |
| 683 |
|
| } // foreach freq |
| 684 |
|
| |
| 685 |
|
| |
| 686 |
|
| |
| 687 |
|
| /* Store stream info */ |
| 688 |
|
| list_for_each(item,&dm->info->streams) |
| 689 |
|
| { |
| 690 |
|
| HV * rh; |
| 691 |
|
| HV * tsidh; |
| 692 |
|
| int frequency ; |
| 693 |
|
| |
| 694 |
|
| stream = list_entry(item, struct psi_stream, next); |
| 695 |
|
| |
| 696 |
|
| // round up frequency to nearest kHz |
| 697 |
|
| // HVS_I(rh, stream, frequency) ; |
| 698 |
|
| frequency = ROUND_FREQUENCY(stream->frequency) ; |
| 699 |
|
| |
| 700 |
|
| if (DVBT_DEBUG >= 10) |
| 701 |
|
| { |
| 702 |
|
| fprintf(stderr, "#@f stream: TSID %d freq = %d Hz [%d Hz] : tuned=%d updated=%d\n", |
| 703 |
|
| stream->tsid, |
| 704 |
|
| stream->frequency, |
| 705 |
|
| frequency, |
| 706 |
|
| stream->tuned, |
| 707 |
|
| stream->updated |
| 708 |
|
| ) ; |
| 709 |
|
| } |
| 710 |
|
| |
| 711 |
|
| |
| 712 |
|
| /* |
| 713 |
|
| // int tsid; |
| 714 |
|
| // |
| 715 |
|
| // // network // |
| 716 |
|
| // int netid; |
| 717 |
|
| // char net[PSI_STR_MAX]; |
| 718 |
|
| // |
| 719 |
|
| // int frequency; |
| 720 |
|
| // int symbol_rate; |
| 721 |
|
| // char *bandwidth; |
| 722 |
|
| // char *constellation; |
| 723 |
|
| // char *hierarchy; |
| 724 |
|
| // char *code_rate_hp; |
| 725 |
|
| // char *code_rate_lp; |
| 726 |
|
| // char *fec_inner; |
| 727 |
|
| // char *guard; |
| 728 |
|
| // char *transmission; |
| 729 |
|
| // char *polarization; |
| 730 |
|
| */ |
| 731 |
|
| |
| 732 |
|
| /* Convert structure fields into hash elements */ |
| 733 |
|
| rh = (HV *)sv_2mortal((SV *)newHV()); |
| 734 |
|
| tsidh = (HV *)sv_2mortal((SV *)newHV()); |
| 735 |
|
| |
| 736 |
|
| HVS_INT(rh, frequency, frequency) ; |
| 737 |
|
| |
| 738 |
|
| HVS_I(rh, stream, tsid) ; |
| 739 |
|
| HVS_I(rh, stream, netid) ; |
| 740 |
|
| HVS_S(rh, stream, bandwidth) ; |
| 741 |
|
| HVSN_S(rh, stream, code_rate_hp, code_rate_high) ; |
| 742 |
|
| HVSN_S(rh, stream, code_rate_lp, code_rate_low) ; |
| 743 |
|
| HVSN_S(rh, stream, constellation, modulation) ; |
| 744 |
|
| HVSN_S(rh, stream, guard, guard_interval) ; |
| 745 |
|
| HVS_S(rh, stream, hierarchy) ; |
| 746 |
|
| HVS_S(rh, stream, net) ; |
| 747 |
|
| HVS_S(rh, stream, transmission) ; |
| 748 |
|
| |
| 749 |
|
| /* Process the program lcns attached to this stream |
| 750 |
|
| |
| 751 |
|
| 'lcn' => { |
| 752 |
|
| |
| 753 |
|
| $tsid => { |
| 754 |
|
| |
| 755 |
|
| $pnr => { |
| 756 |
|
| 'service_type' => xx, |
| 757 |
|
| 'visible' => yy, |
| 758 |
|
| 'lcn' => zz, |
| 759 |
|
| } |
| 760 |
|
| } |
| 761 |
|
| } |
| 762 |
|
| */ |
| 763 |
|
| list_for_each(pitem,&stream->prog_info_list) |
| 764 |
|
| { |
| 765 |
|
| /* Convert structure fields into hash elements */ |
| 766 |
|
| HV * pnrh = (HV *)sv_2mortal((SV *)newHV()); |
| 767 |
|
| |
| 768 |
|
| pinfo = list_entry(pitem, struct prog_info, next); |
| 769 |
|
| |
| 770 |
|
| if (DVBT_DEBUG >= 10) |
| 771 |
|
| { |
| 772 |
|
| fprintf(stderr, "#@p + LCN: %d (pnr %d) type=%d visible=%d\n", |
| 773 |
|
| pinfo->lcn, |
| 774 |
|
| pinfo->service_id, |
| 775 |
|
| pinfo->service_type, |
| 776 |
|
| pinfo->visible |
| 777 |
|
| ) ; |
| 778 |
|
| } |
| 779 |
|
| |
| 780 |
|
| if (pinfo->lcn > 0) |
| 781 |
|
| { |
| 782 |
|
| /* |
| 783 |
|
| int service_id ; # same as pnr |
| 784 |
|
| int service_type ; |
| 785 |
|
| int visible ; |
| 786 |
|
| int lcn ; |
| 787 |
|
| */ |
| 788 |
|
| HVS_I(pnrh, pinfo, service_type) ; |
| 789 |
|
| HVS_I(pnrh, pinfo, visible) ; |
| 790 |
|
| HVS_I(pnrh, pinfo, lcn) ; |
| 791 |
|
| |
| 792 |
|
| sprintf(key2, "%d", pinfo->service_id) ; |
| 793 |
|
| hv_store(tsidh, key2, strlen(key2), newRV((SV *)pnrh), 0) ; |
| 794 |
|
| } |
| 795 |
|
| } |
| 796 |
|
| HVS(rh, lcn, newRV((SV *)tsidh)) ; |
| 797 |
|
| |
| 798 |
|
| av_push(streams, newRV((SV *)rh)); |
| 799 |
|
| |
| 800 |
|
| } |
| 801 |
|
| |
| 802 |
|
| /* store program info */ |
| 803 |
|
| list_for_each(item,&dm->info->programs) |
| 804 |
|
| { |
| 805 |
|
| program = list_entry(item, struct psi_program, next); |
| 806 |
|
| |
| 807 |
|
| if (DVBT_DEBUG >= 15) |
| 808 |
|
| { |
| 809 |
|
| print_program(program) ; |
| 810 |
|
| } |
| 811 |
|
| |
| 812 |
|
| /* |
| 813 |
|
| // int tsid; |
| 814 |
|
| // int pnr; |
| 815 |
|
| // int version; |
| 816 |
|
| // int running; |
| 817 |
|
| // int ca; |
| 818 |
|
| // |
| 819 |
|
| // // program data // |
| 820 |
|
| // int type; |
| 821 |
|
| // int p_pid; // program |
| 822 |
|
| // int v_pid; // video |
| 823 |
|
| // int a_pid; // audio |
| 824 |
|
| // int t_pid; // teletext |
| 825 |
|
| // int s_pid; // subtitle //by rainbowcrypt |
| 826 |
|
| // char audio[PSI_STR_MAX]; |
| 827 |
|
| // char subtitle[PSI_STR_MAX]; //by rainbowcrypt |
| 828 |
|
| // char net[PSI_STR_MAX]; |
| 829 |
|
| // char name[PSI_STR_MAX]; |
| 830 |
|
| // |
| 831 |
|
| // // status info // |
| 832 |
|
| // int updated; |
| 833 |
|
| // int seen; |
| 834 |
|
| */ |
| 835 |
|
| |
| 836 |
|
| if (DVBT_DEBUG >= 10) |
| 837 |
|
| { |
| 838 |
|
| fprintf(stderr, "#@p PROG %d-%d: %s\n", |
| 839 |
|
| program->tsid, |
| 840 |
|
| program->pnr, |
| 841 |
|
| program->name |
| 842 |
|
| ) ; |
| 843 |
|
| } |
| 844 |
|
| |
| 845 |
|
| /* Only bother saving this if the same is set AND type > 0*/ |
| 846 |
|
| if ((strlen(program->name) > 0) && (program->type > 0)) |
| 847 |
|
| { |
| 848 |
|
| HV * rh; |
| 849 |
|
| AV * freq_array; |
| 850 |
|
| int frequency ; |
| 851 |
|
| |
| 852 |
|
| /* Convert structure fields into hash elements */ |
| 853 |
|
| rh = (HV *)sv_2mortal((SV *)newHV()); |
| 854 |
|
| |
| 855 |
|
| if (DVBT_DEBUG >= 10) |
| 856 |
|
| { |
| 857 |
|
| fprintf(stderr, "#@p + PNR %d pmt=%d Video=%d Audio=%d Teletext=%d Subtitle=%d (type=%d)\n", /* by rainbowcrypt*/ |
| 858 |
|
| program->pnr, |
| 859 |
|
| program->p_pid, |
| 860 |
|
| program->v_pid, |
| 861 |
|
| program->a_pid, |
| 862 |
|
| program->t_pid, |
| 863 |
|
| program->s_pid, /*by rainbowcrypt*/ |
| 864 |
|
| program->type |
| 865 |
|
| ) ; |
| 866 |
|
| } |
| 867 |
|
| |
| 868 |
|
| HVS_I(rh, program, tsid) ; |
| 869 |
|
| HVS_I(rh, program, pnr) ; |
| 870 |
|
| HVS_I(rh, program, ca) ; |
| 871 |
|
| HVS_I(rh, program, type) ; |
| 872 |
|
| HVSN_I(rh, program, p_pid, pmt) ; |
| 873 |
|
| HVSN_I(rh, program, v_pid, video) ; |
| 874 |
|
| HVSN_I(rh, program, a_pid, audio) ; |
| 875 |
|
| HVSN_I(rh, program, t_pid, teletext) ; |
| 876 |
|
| HVSN_I(rh, program, s_pid, subtitle) ; |
| 877 |
|
| HVSN_I(rh, program, pcr_pid, pcr) ; |
| 878 |
|
| HVSN_S(rh, program, audio, audio_details) ; |
| 879 |
|
| HVSN_S(rh, program, subtitle, subtitle_details) ; /*by rainbowcrypt*/ |
| 880 |
|
| HVS_S(rh, program, net) ; |
| 881 |
|
| HVS_S(rh, program, name) ; |
| 882 |
|
| |
| 883 |
|
| // add frequencies |
| 884 |
|
| freq_array = (AV *)sv_2mortal((SV *)newAV()); |
| 885 |
|
| list_for_each(fitem,&program->tuned_freq_list) { |
| 886 |
|
| finfo = list_entry(fitem, struct freq_info, next); |
| 887 |
|
| |
| 888 |
|
| // round up frequency to nearest kHz |
| 889 |
|
| frequency = ROUND_FREQUENCY(finfo->frequency) ; |
| 890 |
|
| |
| 891 |
|
| if (DVBT_DEBUG >= 10) |
| 892 |
|
| { |
| 893 |
|
| fprintf(stderr, "#@f + + freq = %d Hz [%d Hz]\n", |
| 894 |
|
| finfo->frequency, frequency |
| 895 |
|
| ) ; |
| 896 |
|
| } |
| 897 |
|
| |
| 898 |
|
| AVS_I(freq_array, frequency) ; |
| 899 |
|
| } |
| 900 |
|
| HVS(rh, freqs, newRV((SV *)freq_array)) ; |
| 901 |
|
| |
| 902 |
|
| // save entry in list |
| 903 |
|
| av_push(programs, newRV((SV *)rh)); |
| 904 |
|
| |
| 905 |
|
| } |
| 906 |
|
| } |
| 907 |
|
| |
| 908 |
|
| if (DVBT_DEBUG >= 10) |
| 909 |
|
| { |
| 910 |
|
| fprintf(stderr, "\n\n == DVBT.xs::dvb_scan() - END =============\n") ; |
| 911 |
|
| } |
| 912 |
|
| |
| 913 |
|
| |
| 914 |
|
| RETVAL = newRV((SV *)results); |
| 915 |
|
| #line 916 "DVBT.c" |
| 916 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 917 |
0 |
| ST(0) = RETVAL; |
| 918 |
|
| } |
| 919 |
0 |
| XSRETURN(1); |
| 920 |
|
| } |
| 921 |
|
| |
| 922 |
|
| |
| 923 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-scan.c' */ |
| 924 |
|
| |
| 925 |
|
| |
| 926 |
|
| /* INCLUDE: Including 'xs/DVBT-tuning.c' from 'DVBT.xs' */ |
| 927 |
|
| |
| 928 |
|
| |
| 929 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_tune); /* prototype to pass -Wmissing-prototypes */ |
| 930 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_tune) |
| 931 |
|
| { |
| 932 |
0 |
| dVAR; dXSARGS; |
| 933 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 934 |
0 |
| croak_xs_usage(cv, "dvb, parameters"); |
| 935 |
|
| { |
| 936 |
|
| int RETVAL; |
| 937 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 938 |
|
| DVB * dvb; |
| 939 |
|
| HV * parameters; |
| 940 |
|
| |
| 941 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 942 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 943 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 944 |
|
| } |
| 945 |
|
| else { |
| 946 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 947 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 948 |
|
| "Linux::DVB::DVBT::dvb_tune", |
| 949 |
|
| "dvb", "DVBPtr", |
| 950 |
0 |
| refstr, ST(0) |
| 951 |
|
| ); |
| 952 |
|
| } |
| 953 |
|
| ; |
| 954 |
|
| |
| 955 |
|
| STMT_START { |
| 956 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 957 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 958 |
0 |
▶ | if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
|
| 959 |
0 |
▶ | parameters = (HV*)SvRV(xsub_tmp_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| parameters = (HV*)SvRV(xsub_tmp_sv); |
0 |
0 |
0 |
|
| 960 |
|
| } |
| 961 |
|
| else{ |
| 962 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 963 |
|
| "Linux::DVB::DVBT::dvb_tune", |
| 964 |
|
| "parameters"); |
| 965 |
|
| } |
| 966 |
|
| } STMT_END |
| 967 |
|
| ; |
| 968 |
|
| #line 10 "./xs/DVBT-tuning.c" |
| 969 |
|
| SV **val; |
| 970 |
|
| |
| 971 |
|
| int frequency=0; |
| 972 |
|
| |
| 973 |
|
| /* We hope that any unset params will cope just using the AUTO option */ |
| 974 |
|
| int inversion=TUNING_AUTO; |
| 975 |
|
| int bandwidth=TUNING_AUTO; |
| 976 |
|
| int code_rate_high=TUNING_AUTO; |
| 977 |
|
| int code_rate_low=TUNING_AUTO; |
| 978 |
|
| int modulation=TUNING_AUTO; |
| 979 |
|
| int transmission=TUNING_AUTO; |
| 980 |
|
| int guard_interval=TUNING_AUTO; |
| 981 |
|
| int hierarchy=TUNING_AUTO; |
| 982 |
|
| |
| 983 |
|
| int timeout=DEFAULT_TIMEOUT; |
| 984 |
|
| |
| 985 |
|
| #line 986 "DVBT.c" |
| 986 |
|
| #line 28 "./xs/DVBT-tuning.c" |
| 987 |
|
| if (DVBT_DEBUG >= 10) |
| 988 |
|
| { |
| 989 |
|
| fprintf(stderr, " == DVBT.xs::dvb_tune() ================\n") ; |
| 990 |
|
| } |
| 991 |
|
| |
| 992 |
|
| /* Read all those HASH values that are actually set into discrete variables */ |
| 993 |
|
| HVF_I(parameters, frequency) ; |
| 994 |
|
| HVF_I(parameters, inversion) ; |
| 995 |
|
| HVF_I(parameters, bandwidth) ; |
| 996 |
|
| HVF_I(parameters, code_rate_high) ; |
| 997 |
|
| HVF_I(parameters, code_rate_low) ; |
| 998 |
|
| HVF_I(parameters, modulation) ; |
| 999 |
|
| HVF_I(parameters, transmission) ; |
| 1000 |
|
| HVF_I(parameters, guard_interval) ; |
| 1001 |
|
| HVF_I(parameters, hierarchy) ; |
| 1002 |
|
| HVF_I(parameters, timeout) ; |
| 1003 |
|
| |
| 1004 |
|
| if (frequency <= 0) |
| 1005 |
|
| croak ("Linux::DVB::DVBT::dvb_tune requires a valid frequency"); |
| 1006 |
|
| |
| 1007 |
|
| /* use 3x global timeout for tuning */ |
| 1008 |
|
| timeout *= 3 ; |
| 1009 |
|
| |
| 1010 |
|
| if (DVBT_DEBUG >= 10) |
| 1011 |
|
| { |
| 1012 |
|
| fprintf(stderr, "#@f DVBT.xs::dvb_tune() : tuning freq=%d Hz, inv=(%d) " |
| 1013 |
|
| "bandwidth=(%d) code_rate=(%d - %d) constellation=(%d) " |
| 1014 |
|
| "transmission=(%d) guard=(%d) hierarchy=(%d)\n", |
| 1015 |
|
| frequency, |
| 1016 |
|
| inversion, |
| 1017 |
|
| bandwidth, |
| 1018 |
|
| code_rate_high, |
| 1019 |
|
| code_rate_low, |
| 1020 |
|
| modulation, |
| 1021 |
|
| transmission, |
| 1022 |
|
| guard_interval, |
| 1023 |
|
| hierarchy |
| 1024 |
|
| ) ; |
| 1025 |
|
| } |
| 1026 |
|
| |
| 1027 |
|
| // set tuning |
| 1028 |
|
| RETVAL = dvb_tune(dvb, |
| 1029 |
|
| /* For frontend tuning */ |
| 1030 |
|
| frequency, |
| 1031 |
|
| inversion, |
| 1032 |
|
| bandwidth, |
| 1033 |
|
| code_rate_high, |
| 1034 |
|
| code_rate_low, |
| 1035 |
|
| modulation, |
| 1036 |
|
| transmission, |
| 1037 |
|
| guard_interval, |
| 1038 |
|
| hierarchy, |
| 1039 |
|
| timeout) ; |
| 1040 |
|
| |
| 1041 |
|
| if (DVBT_DEBUG >= 10) |
| 1042 |
|
| { |
| 1043 |
|
| fprintf(stderr, " rc = %d\n", RETVAL) ; |
| 1044 |
|
| fprintf(stderr, " == DVBT.xs::dvb_tune() - END ================\n") ; |
| 1045 |
|
| } |
| 1046 |
|
| |
| 1047 |
|
| #line 1048 "DVBT.c" |
| 1048 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1049 |
0 |
| ST(0) = TARG; |
| 1050 |
|
| } |
| 1051 |
0 |
| XSRETURN(1); |
| 1052 |
|
| } |
| 1053 |
|
| |
| 1054 |
|
| |
| 1055 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_tune); /* prototype to pass -Wmissing-prototypes */ |
| 1056 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_scan_tune) |
| 1057 |
|
| { |
| 1058 |
0 |
| dVAR; dXSARGS; |
| 1059 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 1060 |
0 |
| croak_xs_usage(cv, "dvb, parameters"); |
| 1061 |
|
| { |
| 1062 |
|
| int RETVAL; |
| 1063 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1064 |
|
| DVB * dvb; |
| 1065 |
|
| HV * parameters; |
| 1066 |
|
| |
| 1067 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1068 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1069 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1070 |
|
| } |
| 1071 |
|
| else { |
| 1072 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1073 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1074 |
|
| "Linux::DVB::DVBT::dvb_scan_tune", |
| 1075 |
|
| "dvb", "DVBPtr", |
| 1076 |
0 |
| refstr, ST(0) |
| 1077 |
|
| ); |
| 1078 |
|
| } |
| 1079 |
|
| ; |
| 1080 |
|
| |
| 1081 |
|
| STMT_START { |
| 1082 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 1083 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 1084 |
0 |
▶ | if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
|
| 1085 |
0 |
▶ | parameters = (HV*)SvRV(xsub_tmp_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| parameters = (HV*)SvRV(xsub_tmp_sv); |
0 |
0 |
0 |
|
| 1086 |
|
| } |
| 1087 |
|
| else{ |
| 1088 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 1089 |
|
| "Linux::DVB::DVBT::dvb_scan_tune", |
| 1090 |
|
| "parameters"); |
| 1091 |
|
| } |
| 1092 |
|
| } STMT_END |
| 1093 |
|
| ; |
| 1094 |
|
| #line 97 "./xs/DVBT-tuning.c" |
| 1095 |
|
| SV **val; |
| 1096 |
|
| |
| 1097 |
|
| int frequency=0; |
| 1098 |
|
| |
| 1099 |
|
| /* We hope that any unset params will cope just using the AUTO option */ |
| 1100 |
|
| int inversion=TUNING_AUTO; |
| 1101 |
|
| int bandwidth=TUNING_AUTO; |
| 1102 |
|
| int code_rate_high=TUNING_AUTO; |
| 1103 |
|
| int code_rate_low=TUNING_AUTO; |
| 1104 |
|
| int modulation=TUNING_AUTO; |
| 1105 |
|
| int transmission=TUNING_AUTO; |
| 1106 |
|
| int guard_interval=TUNING_AUTO; |
| 1107 |
|
| int hierarchy=TUNING_AUTO; |
| 1108 |
|
| |
| 1109 |
|
| int timeout=DEFAULT_TIMEOUT; |
| 1110 |
|
| |
| 1111 |
|
| #line 1112 "DVBT.c" |
| 1112 |
|
| #line 115 "./xs/DVBT-tuning.c" |
| 1113 |
|
| if (DVBT_DEBUG >= 10) |
| 1114 |
|
| { |
| 1115 |
|
| fprintf(stderr, " == DVBT.xs::dvb_scan_tune() ================\n") ; |
| 1116 |
|
| } |
| 1117 |
|
| |
| 1118 |
|
| /* Read all those HASH values that are actually set into discrete variables */ |
| 1119 |
|
| HVF_I(parameters, frequency) ; |
| 1120 |
|
| HVF_I(parameters, inversion) ; |
| 1121 |
|
| HVF_I(parameters, bandwidth) ; |
| 1122 |
|
| HVF_I(parameters, code_rate_high) ; |
| 1123 |
|
| HVF_I(parameters, code_rate_low) ; |
| 1124 |
|
| HVF_I(parameters, modulation) ; |
| 1125 |
|
| HVF_I(parameters, transmission) ; |
| 1126 |
|
| HVF_I(parameters, guard_interval) ; |
| 1127 |
|
| HVF_I(parameters, hierarchy) ; |
| 1128 |
|
| HVF_I(parameters, timeout) ; |
| 1129 |
|
| |
| 1130 |
|
| if (frequency <= 0) |
| 1131 |
|
| croak ("Linux::DVB::DVBT::dvb_tune requires a valid frequency"); |
| 1132 |
|
| |
| 1133 |
|
| /* use 3x global timeout for tuning */ |
| 1134 |
|
| timeout *= 3 ; |
| 1135 |
|
| |
| 1136 |
|
| if (DVBT_DEBUG >= 10) |
| 1137 |
|
| { |
| 1138 |
|
| fprintf(stderr, "#@f DVBT.xs::dvb_scan_tune() : tuning freq=%d Hz, inv=(%d) " |
| 1139 |
|
| "bandwidth=(%d) code_rate=(%d - %d) constellation=(%d) " |
| 1140 |
|
| "transmission=(%d) guard=(%d) hierarchy=(%d)\n", |
| 1141 |
|
| frequency, |
| 1142 |
|
| inversion, |
| 1143 |
|
| bandwidth, |
| 1144 |
|
| code_rate_high, |
| 1145 |
|
| code_rate_low, |
| 1146 |
|
| modulation, |
| 1147 |
|
| transmission, |
| 1148 |
|
| guard_interval, |
| 1149 |
|
| hierarchy |
| 1150 |
|
| ) ; |
| 1151 |
|
| } |
| 1152 |
|
| |
| 1153 |
|
| // set tuning |
| 1154 |
|
| RETVAL = dvb_scan_tune(dvb, |
| 1155 |
|
| /* For frontend tuning */ |
| 1156 |
|
| frequency, |
| 1157 |
|
| inversion, |
| 1158 |
|
| bandwidth, |
| 1159 |
|
| code_rate_high, |
| 1160 |
|
| code_rate_low, |
| 1161 |
|
| modulation, |
| 1162 |
|
| transmission, |
| 1163 |
|
| guard_interval, |
| 1164 |
|
| hierarchy, |
| 1165 |
|
| timeout) ; |
| 1166 |
|
| |
| 1167 |
|
| #line 1168 "DVBT.c" |
| 1168 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1169 |
0 |
| ST(0) = TARG; |
| 1170 |
|
| } |
| 1171 |
0 |
| XSRETURN(1); |
| 1172 |
|
| } |
| 1173 |
|
| |
| 1174 |
|
| |
| 1175 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_signal_quality); /* prototype to pass -Wmissing-prototypes */ |
| 1176 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_signal_quality) |
| 1177 |
|
| { |
| 1178 |
0 |
| dVAR; dXSARGS; |
| 1179 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 1180 |
0 |
| croak_xs_usage(cv, "dvb"); |
| 1181 |
|
| { |
| 1182 |
|
| SV * RETVAL; |
| 1183 |
|
| DVB * dvb; |
| 1184 |
|
| |
| 1185 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1186 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1187 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1188 |
|
| } |
| 1189 |
|
| else { |
| 1190 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1191 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1192 |
|
| "Linux::DVB::DVBT::dvb_signal_quality", |
| 1193 |
|
| "dvb", "DVBPtr", |
| 1194 |
0 |
| refstr, ST(0) |
| 1195 |
|
| ); |
| 1196 |
|
| } |
| 1197 |
|
| ; |
| 1198 |
|
| #line 179 "./xs/DVBT-tuning.c" |
| 1199 |
|
| HV * results; |
| 1200 |
|
| unsigned ber ; |
| 1201 |
|
| unsigned snr ; |
| 1202 |
|
| unsigned strength ; |
| 1203 |
|
| unsigned uncorrected_blocks ; |
| 1204 |
|
| int ok ; |
| 1205 |
|
| |
| 1206 |
|
| results = (HV *)sv_2mortal((SV *)newHV()); |
| 1207 |
|
| |
| 1208 |
|
| #line 1209 "DVBT.c" |
| 1209 |
|
| #line 189 "./xs/DVBT-tuning.c" |
| 1210 |
|
| /* get info */ |
| 1211 |
|
| ok = dvb_signal_quality(dvb, &ber, &snr, &strength, &uncorrected_blocks) ; |
| 1212 |
|
| |
| 1213 |
|
| /** Create Perl data **/ |
| 1214 |
|
| HVS(results, ber, newSViv((int)ber)) ; |
| 1215 |
|
| HVS(results, snr, newSViv((int)snr)) ; |
| 1216 |
|
| HVS(results, strength, newSViv((int)strength)) ; |
| 1217 |
|
| HVS(results, uncorrected_blocks, newSViv((int)uncorrected_blocks)) ; |
| 1218 |
|
| HVS(results, ok, newSViv(ok)) ; |
| 1219 |
|
| |
| 1220 |
|
| RETVAL = newRV((SV *)results); |
| 1221 |
|
| #line 1222 "DVBT.c" |
| 1222 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 1223 |
0 |
| ST(0) = RETVAL; |
| 1224 |
|
| } |
| 1225 |
0 |
| XSRETURN(1); |
| 1226 |
|
| } |
| 1227 |
|
| |
| 1228 |
|
| |
| 1229 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_round_freq); /* prototype to pass -Wmissing-prototypes */ |
| 1230 |
2 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_round_freq) |
| 1231 |
|
| { |
| 1232 |
2 |
| dVAR; dXSARGS; |
| 1233 |
2 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
2 |
2 |
|
| 1234 |
0 |
| croak_xs_usage(cv, "freqin"); |
| 1235 |
|
| { |
| 1236 |
|
| int RETVAL; |
| 1237 |
2 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
2 |
0 |
2 |
|
| 1238 |
2 |
▶ | int freqin = (int)SvIV(ST(0)) |
Branch: 1 branch
| Branch | True | False | Total |
| int freqin = (int)SvIV(ST(0)) |
1 |
1 |
2 |
|
| 1239 |
|
| ; |
| 1240 |
|
| #line 209 "./xs/DVBT-tuning.c" |
| 1241 |
|
| RETVAL = ROUND_FREQUENCY(freqin) ; |
| 1242 |
|
| #line 1243 "DVBT.c" |
| 1243 |
2 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
1 |
1 |
2 |
|
| 1244 |
2 |
| ST(0) = TARG; |
| 1245 |
|
| } |
| 1246 |
2 |
| XSRETURN(1); |
| 1247 |
|
| } |
| 1248 |
|
| |
| 1249 |
|
| |
| 1250 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_is_busy); /* prototype to pass -Wmissing-prototypes */ |
| 1251 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_is_busy) |
| 1252 |
|
| { |
| 1253 |
0 |
| dVAR; dXSARGS; |
| 1254 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 1255 |
0 |
| croak_xs_usage(cv, "dvb"); |
| 1256 |
|
| { |
| 1257 |
|
| int RETVAL; |
| 1258 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1259 |
|
| DVB * dvb; |
| 1260 |
|
| |
| 1261 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1262 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1263 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1264 |
|
| } |
| 1265 |
|
| else { |
| 1266 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1267 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1268 |
|
| "Linux::DVB::DVBT::dvb_is_busy", |
| 1269 |
|
| "dvb", "DVBPtr", |
| 1270 |
0 |
| refstr, ST(0) |
| 1271 |
|
| ); |
| 1272 |
|
| } |
| 1273 |
|
| ; |
| 1274 |
|
| #line 219 "./xs/DVBT-tuning.c" |
| 1275 |
|
| RETVAL = dvb_frontend_is_busy(dvb) ; |
| 1276 |
|
| #line 1277 "DVBT.c" |
| 1277 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1278 |
0 |
| ST(0) = TARG; |
| 1279 |
|
| } |
| 1280 |
0 |
| XSRETURN(1); |
| 1281 |
|
| } |
| 1282 |
|
| |
| 1283 |
|
| |
| 1284 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-tuning.c' */ |
| 1285 |
|
| |
| 1286 |
|
| |
| 1287 |
|
| /* INCLUDE: Including 'xs/DVBT-epg.c' from 'DVBT.xs' */ |
| 1288 |
|
| |
| 1289 |
|
| |
| 1290 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_clear_epg); /* prototype to pass -Wmissing-prototypes */ |
| 1291 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_clear_epg) |
| 1292 |
|
| { |
| 1293 |
0 |
| dVAR; dXSARGS; |
| 1294 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 1295 |
0 |
| croak_xs_usage(cv, ""); |
| 1296 |
|
| { |
| 1297 |
|
| #line 6 "./xs/DVBT-epg.c" |
| 1298 |
|
| clear_epg() ; |
| 1299 |
|
| #line 1300 "DVBT.c" |
| 1300 |
|
| } |
| 1301 |
0 |
| XSRETURN_EMPTY; |
| 1302 |
|
| } |
| 1303 |
|
| |
| 1304 |
|
| |
| 1305 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_epg); /* prototype to pass -Wmissing-prototypes */ |
| 1306 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_epg) |
| 1307 |
|
| { |
| 1308 |
0 |
| dVAR; dXSARGS; |
| 1309 |
0 |
▶ | if (items != 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 4) |
0 |
0 |
0 |
|
| 1310 |
0 |
| croak_xs_usage(cv, "dvb, verbose, alive, section"); |
| 1311 |
|
| { |
| 1312 |
|
| SV * RETVAL; |
| 1313 |
|
| DVB * dvb; |
| 1314 |
0 |
| int verbose = (int)SvIV(ST(1)) |
| 1315 |
|
| ; |
| 1316 |
0 |
| int alive = (int)SvIV(ST(2)) |
| 1317 |
|
| ; |
| 1318 |
0 |
| int section = (int)SvIV(ST(3)) |
| 1319 |
|
| ; |
| 1320 |
|
| |
| 1321 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1322 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1323 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1324 |
|
| } |
| 1325 |
|
| else { |
| 1326 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1327 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1328 |
|
| "Linux::DVB::DVBT::dvb_epg", |
| 1329 |
|
| "dvb", "DVBPtr", |
| 1330 |
0 |
| refstr, ST(0) |
| 1331 |
|
| ); |
| 1332 |
|
| } |
| 1333 |
|
| ; |
| 1334 |
|
| #line 15 "./xs/DVBT-epg.c" |
| 1335 |
|
| AV * results; |
| 1336 |
|
| |
| 1337 |
|
| struct list_head *epg_list ; |
| 1338 |
|
| struct list_head *item, *safe; |
| 1339 |
|
| struct epgitem *epg; |
| 1340 |
|
| struct epgitem dummy_epg; |
| 1341 |
|
| |
| 1342 |
|
| results = (AV *)sv_2mortal((SV *)newAV()); |
| 1343 |
|
| |
| 1344 |
|
| #line 1345 "DVBT.c" |
| 1345 |
|
| #line 26 "./xs/DVBT-epg.c" |
| 1346 |
|
| /* |
| 1347 |
|
| // NOTE: Mask allows for multiple sections |
| 1348 |
|
| // e.g. 0x50, 0xf0 means "read sections 0x50 - 0x5f" |
| 1349 |
|
| |
| 1350 |
|
| // |
| 1351 |
|
| // 0x4E event_information_section - actual_transport_stream, present/following |
| 1352 |
|
| // 0x4F event_information_section - other_transport_stream, present/following |
| 1353 |
|
| // 0x50 to 0x5F event_information_section - actual_transport_stream, schedule |
| 1354 |
|
| // 0x60 to 0x6F event_information_section - other_transport_stream, schedule |
| 1355 |
|
| // |
| 1356 |
|
| // 0x50 - 0x6f => 01010000 - 01101111 |
| 1357 |
|
| */ |
| 1358 |
|
| if (section) |
| 1359 |
|
| { |
| 1360 |
|
| epg_list = get_eit(/* struct dvb_state *dvb */ dvb, |
| 1361 |
|
| /* int section */section, /* int mask */0xff, |
| 1362 |
|
| /* int verbose */ verbose, /* int alive */ alive) ; |
| 1363 |
|
| } |
| 1364 |
|
| else |
| 1365 |
|
| { |
| 1366 |
|
| epg_list = get_eit(/* struct dvb_state *dvb */ dvb, |
| 1367 |
|
| /* int section */0x50, /* int mask */0xf0, |
| 1368 |
|
| /* int verbose */ verbose, /* int alive */ alive) ; |
| 1369 |
|
| |
| 1370 |
|
| epg_list = get_eit(/* struct dvb_state *dvb */ dvb, |
| 1371 |
|
| /* int section */0x60, /* int mask */0xf0, |
| 1372 |
|
| /* int verbose */ verbose, /* int alive */ alive) ; |
| 1373 |
|
| } |
| 1374 |
|
| |
| 1375 |
|
| if (epg_list) |
| 1376 |
|
| { |
| 1377 |
|
| /* Create Perl data */ |
| 1378 |
|
| list_for_each(item, epg_list) |
| 1379 |
|
| { |
| 1380 |
|
| HV * rh; |
| 1381 |
|
| |
| 1382 |
|
| epg = list_entry(item, struct epgitem, next); |
| 1383 |
|
| |
| 1384 |
|
| /* Convert structure fields into hash elements */ |
| 1385 |
|
| rh = (HV *)sv_2mortal((SV *)newHV()); |
| 1386 |
|
| |
| 1387 |
|
| HVS_I(rh, epg, id) ; |
| 1388 |
|
| HVS_I(rh, epg, tsid) ; |
| 1389 |
|
| HVS_I(rh, epg, pnr) ; |
| 1390 |
|
| HVS_I(rh, epg, start) ; |
| 1391 |
|
| HVS_I(rh, epg, stop) ; |
| 1392 |
|
| HVS_I(rh, epg, duration_secs) ; |
| 1393 |
|
| HVS_I(rh, epg, flags) ; |
| 1394 |
|
| |
| 1395 |
|
| if (epg->lang[0]) |
| 1396 |
|
| { |
| 1397 |
|
| HVS_STRING(rh, epg, lang); |
| 1398 |
|
| } |
| 1399 |
|
| if (epg->name[0]) |
| 1400 |
|
| { |
| 1401 |
|
| // title |
| 1402 |
|
| HVS_STRING(rh, epg, name); |
| 1403 |
|
| } |
| 1404 |
|
| if (epg->stext[0]) |
| 1405 |
|
| { |
| 1406 |
|
| // synopsis / description |
| 1407 |
|
| HVS_STRING(rh, epg, stext); |
| 1408 |
|
| } |
| 1409 |
|
| if (epg->etext) |
| 1410 |
|
| { |
| 1411 |
|
| // extended text |
| 1412 |
|
| HVS_STRING(rh, epg, etext); |
| 1413 |
|
| } |
| 1414 |
|
| if (epg->playing) |
| 1415 |
|
| { |
| 1416 |
|
| HVS_I(rh, epg, playing) ; |
| 1417 |
|
| } |
| 1418 |
|
| if (epg->cat[0]) |
| 1419 |
|
| { |
| 1420 |
|
| hv_store(rh, "genre", sizeof("genre")-1, newSVpv(_to_string(epg->cat[0]), 0), 0) ; |
| 1421 |
|
| } |
| 1422 |
|
| if (epg->tva_prog[0]) |
| 1423 |
|
| { |
| 1424 |
|
| HVS_STRING(rh, epg, tva_prog); |
| 1425 |
|
| } |
| 1426 |
|
| if (epg->tva_series[0]) |
| 1427 |
|
| { |
| 1428 |
|
| HVS_STRING(rh, epg, tva_series); |
| 1429 |
|
| } |
| 1430 |
|
| |
| 1431 |
|
| av_push(results, newRV((SV *)rh)); |
| 1432 |
|
| } |
| 1433 |
|
| |
| 1434 |
|
| |
| 1435 |
|
| } |
| 1436 |
|
| |
| 1437 |
|
| RETVAL = newRV((SV *)results); |
| 1438 |
|
| #line 1439 "DVBT.c" |
| 1439 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 1440 |
0 |
| ST(0) = RETVAL; |
| 1441 |
|
| } |
| 1442 |
0 |
| XSRETURN(1); |
| 1443 |
|
| } |
| 1444 |
|
| |
| 1445 |
|
| |
| 1446 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_epg_stats); /* prototype to pass -Wmissing-prototypes */ |
| 1447 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_epg_stats) |
| 1448 |
|
| { |
| 1449 |
0 |
| dVAR; dXSARGS; |
| 1450 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 1451 |
0 |
| croak_xs_usage(cv, "dvb"); |
| 1452 |
|
| { |
| 1453 |
|
| SV * RETVAL; |
| 1454 |
|
| DVB * dvb; |
| 1455 |
|
| |
| 1456 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1457 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1458 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1459 |
|
| } |
| 1460 |
|
| else { |
| 1461 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1462 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1463 |
|
| "Linux::DVB::DVBT::dvb_epg_stats", |
| 1464 |
|
| "dvb", "DVBPtr", |
| 1465 |
0 |
| refstr, ST(0) |
| 1466 |
|
| ); |
| 1467 |
|
| } |
| 1468 |
|
| ; |
| 1469 |
|
| #line 127 "./xs/DVBT-epg.c" |
| 1470 |
|
| HV * results; |
| 1471 |
|
| |
| 1472 |
|
| struct partitem *partp; |
| 1473 |
|
| struct erritem *errp; |
| 1474 |
|
| struct list_head *item; |
| 1475 |
|
| |
| 1476 |
|
| HV * totals ; |
| 1477 |
|
| AV * parts ; |
| 1478 |
|
| AV * errors ; |
| 1479 |
|
| |
| 1480 |
|
| results = (HV *)sv_2mortal((SV *)newHV()); |
| 1481 |
|
| totals = (HV *)sv_2mortal((SV *)newHV()); |
| 1482 |
|
| parts = (AV *)sv_2mortal((SV *)newAV()); |
| 1483 |
|
| errors = (AV *)sv_2mortal((SV *)newAV()); |
| 1484 |
|
| |
| 1485 |
|
| #line 1486 "DVBT.c" |
| 1486 |
|
| #line 144 "./xs/DVBT-epg.c" |
| 1487 |
|
| /* Create Perl data */ |
| 1488 |
|
| HVS(results, totals, newRV((SV *)totals)) ; |
| 1489 |
|
| HVS(results, parts, newRV((SV *)parts)) ; |
| 1490 |
|
| HVS(results, errors, newRV((SV *)errors)) ; |
| 1491 |
|
| |
| 1492 |
|
| |
| 1493 |
|
| // totals |
| 1494 |
|
| HVS_INT(totals, parts_remaining, parts_remaining) ; |
| 1495 |
|
| HVS_INT(totals, total_errors, total_errors) ; |
| 1496 |
|
| |
| 1497 |
|
| |
| 1498 |
|
| // list of parts |
| 1499 |
|
| list_for_each(item, &parts_list) |
| 1500 |
|
| { |
| 1501 |
|
| HV * rh; |
| 1502 |
|
| struct partitem *partp; |
| 1503 |
|
| |
| 1504 |
|
| partp = list_entry(item, struct partitem, next); |
| 1505 |
|
| |
| 1506 |
|
| /* Convert structure fields into hash elements */ |
| 1507 |
|
| rh = (HV *)sv_2mortal((SV *)newHV()); |
| 1508 |
|
| |
| 1509 |
|
| /* |
| 1510 |
|
| struct partitem { |
| 1511 |
|
| struct list_head next; |
| 1512 |
|
| int pnr; |
| 1513 |
|
| int tsid; |
| 1514 |
|
| int parts; |
| 1515 |
|
| int parts_left; |
| 1516 |
|
| }; |
| 1517 |
|
| */ |
| 1518 |
|
| HVS_I(rh, partp, pnr) ; |
| 1519 |
|
| HVS_I(rh, partp, tsid) ; |
| 1520 |
|
| HVS_I(rh, partp, parts) ; |
| 1521 |
|
| HVS_I(rh, partp, parts_left) ; |
| 1522 |
|
| |
| 1523 |
|
| |
| 1524 |
|
| av_push(parts, newRV((SV *)rh)); |
| 1525 |
|
| } |
| 1526 |
|
| |
| 1527 |
|
| // list of errors |
| 1528 |
|
| list_for_each(item, &errs_list) |
| 1529 |
|
| { |
| 1530 |
|
| HV * rh; |
| 1531 |
|
| struct erritem *errp; |
| 1532 |
|
| |
| 1533 |
|
| errp = list_entry(item, struct erritem, next); |
| 1534 |
|
| |
| 1535 |
|
| /* Convert structure fields into hash elements */ |
| 1536 |
|
| rh = (HV *)sv_2mortal((SV *)newHV()); |
| 1537 |
|
| |
| 1538 |
|
| /* |
| 1539 |
|
| struct erritem { |
| 1540 |
|
| struct list_head next; |
| 1541 |
|
| int freq; |
| 1542 |
|
| int section; |
| 1543 |
|
| int errors; |
| 1544 |
|
| }; |
| 1545 |
|
| */ |
| 1546 |
|
| HVS_I(rh, errp, freq) ; |
| 1547 |
|
| HVS_I(rh, errp, section) ; |
| 1548 |
|
| HVS_I(rh, errp, errors) ; |
| 1549 |
|
| |
| 1550 |
|
| av_push(errors, newRV((SV *)rh)); |
| 1551 |
|
| } |
| 1552 |
|
| |
| 1553 |
|
| |
| 1554 |
|
| RETVAL = newRV((SV *)results); |
| 1555 |
|
| #line 1556 "DVBT.c" |
| 1556 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 1557 |
0 |
| ST(0) = RETVAL; |
| 1558 |
|
| } |
| 1559 |
0 |
| XSRETURN(1); |
| 1560 |
|
| } |
| 1561 |
|
| |
| 1562 |
|
| |
| 1563 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-epg.c' */ |
| 1564 |
|
| |
| 1565 |
|
| |
| 1566 |
|
| /* INCLUDE: Including 'xs/DVBT-record.c' from 'DVBT.xs' */ |
| 1567 |
|
| |
| 1568 |
|
| |
| 1569 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_del_demux); /* prototype to pass -Wmissing-prototypes */ |
| 1570 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_del_demux) |
| 1571 |
|
| { |
| 1572 |
0 |
| dVAR; dXSARGS; |
| 1573 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 1574 |
0 |
| croak_xs_usage(cv, "dvb, fd"); |
| 1575 |
|
| { |
| 1576 |
|
| int RETVAL; |
| 1577 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1578 |
|
| DVB * dvb; |
| 1579 |
0 |
| int fd = (int)SvIV(ST(1)) |
| 1580 |
|
| ; |
| 1581 |
|
| |
| 1582 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1583 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1584 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1585 |
|
| } |
| 1586 |
|
| else { |
| 1587 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1588 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1589 |
|
| "Linux::DVB::DVBT::dvb_del_demux", |
| 1590 |
|
| "dvb", "DVBPtr", |
| 1591 |
0 |
| refstr, ST(0) |
| 1592 |
|
| ); |
| 1593 |
|
| } |
| 1594 |
|
| ; |
| 1595 |
|
| #line 8 "./xs/DVBT-record.c" |
| 1596 |
|
| if (fd > 0) |
| 1597 |
|
| { |
| 1598 |
|
| // delete demux filter |
| 1599 |
|
| RETVAL = dvb_demux_remove_filter(dvb, fd) ; |
| 1600 |
|
| } |
| 1601 |
|
| else |
| 1602 |
|
| { |
| 1603 |
|
| RETVAL = -1 ; |
| 1604 |
|
| } |
| 1605 |
|
| |
| 1606 |
|
| #line 1607 "DVBT.c" |
| 1607 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1608 |
0 |
| ST(0) = TARG; |
| 1609 |
|
| } |
| 1610 |
0 |
| XSRETURN(1); |
| 1611 |
|
| } |
| 1612 |
|
| |
| 1613 |
|
| |
| 1614 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_add_demux); /* prototype to pass -Wmissing-prototypes */ |
| 1615 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_add_demux) |
| 1616 |
|
| { |
| 1617 |
0 |
| dVAR; dXSARGS; |
| 1618 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 1619 |
0 |
| croak_xs_usage(cv, "dvb, pid"); |
| 1620 |
|
| { |
| 1621 |
|
| int RETVAL; |
| 1622 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1623 |
|
| DVB * dvb; |
| 1624 |
0 |
| unsigned int pid = (unsigned int)SvUV(ST(1)) |
| 1625 |
|
| ; |
| 1626 |
|
| |
| 1627 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1628 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1629 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1630 |
|
| } |
| 1631 |
|
| else { |
| 1632 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1633 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1634 |
|
| "Linux::DVB::DVBT::dvb_add_demux", |
| 1635 |
|
| "dvb", "DVBPtr", |
| 1636 |
0 |
| refstr, ST(0) |
| 1637 |
|
| ); |
| 1638 |
|
| } |
| 1639 |
|
| ; |
| 1640 |
|
| #line 29 "./xs/DVBT-record.c" |
| 1641 |
|
| // set demux |
| 1642 |
|
| RETVAL = dvb_demux_add_filter(dvb, pid) ; |
| 1643 |
|
| |
| 1644 |
|
| #line 1645 "DVBT.c" |
| 1645 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1646 |
0 |
| ST(0) = TARG; |
| 1647 |
|
| } |
| 1648 |
0 |
| XSRETURN(1); |
| 1649 |
|
| } |
| 1650 |
|
| |
| 1651 |
|
| |
| 1652 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_record); /* prototype to pass -Wmissing-prototypes */ |
| 1653 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_record) |
| 1654 |
|
| { |
| 1655 |
0 |
| dVAR; dXSARGS; |
| 1656 |
0 |
▶ | if (items != 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 3) |
0 |
0 |
0 |
|
| 1657 |
0 |
| croak_xs_usage(cv, "dvb, filename, sec"); |
| 1658 |
|
| { |
| 1659 |
|
| int RETVAL; |
| 1660 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1661 |
|
| DVB * dvb; |
| 1662 |
0 |
| char * filename = (char *)SvPV_nolen(ST(1)) |
| 1663 |
|
| ; |
| 1664 |
0 |
| int sec = (int)SvIV(ST(2)) |
| 1665 |
|
| ; |
| 1666 |
|
| |
| 1667 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1668 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1669 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1670 |
|
| } |
| 1671 |
|
| else { |
| 1672 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1673 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1674 |
|
| "Linux::DVB::DVBT::dvb_record", |
| 1675 |
|
| "dvb", "DVBPtr", |
| 1676 |
0 |
| refstr, ST(0) |
| 1677 |
|
| ); |
| 1678 |
|
| } |
| 1679 |
|
| ; |
| 1680 |
|
| #line 42 "./xs/DVBT-record.c" |
| 1681 |
|
| if (sec <= 0) |
| 1682 |
|
| croak ("Linux::DVB::DVBT::dvb_record requires a valid record length in seconds"); |
| 1683 |
|
| |
| 1684 |
|
| |
| 1685 |
|
| // open dvr first |
| 1686 |
|
| RETVAL = dvb_dvr_open(dvb) ; |
| 1687 |
|
| |
| 1688 |
|
| // save stream |
| 1689 |
|
| if (RETVAL == 0) |
| 1690 |
|
| { |
| 1691 |
|
| RETVAL = write_stream(dvb, filename, sec) ; |
| 1692 |
|
| |
| 1693 |
|
| // close dvr |
| 1694 |
|
| dvb_dvr_release(dvb) ; |
| 1695 |
|
| } |
| 1696 |
|
| |
| 1697 |
|
| |
| 1698 |
|
| #line 1699 "DVBT.c" |
| 1699 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1700 |
0 |
| ST(0) = TARG; |
| 1701 |
|
| } |
| 1702 |
0 |
| XSRETURN(1); |
| 1703 |
|
| } |
| 1704 |
|
| |
| 1705 |
|
| |
| 1706 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_record_demux); /* prototype to pass -Wmissing-prototypes */ |
| 1707 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT_dvb_record_demux) |
| 1708 |
|
| { |
| 1709 |
0 |
| dVAR; dXSARGS; |
| 1710 |
0 |
▶ | if (items < 2 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 2 || items > 3) |
0 |
0 |
0 |
| if (items < 2 || items > 3) |
0 |
0 |
0 |
|
| 1711 |
0 |
| croak_xs_usage(cv, "dvb, multiplex_aref, options_href=NULL"); |
| 1712 |
|
| { |
| 1713 |
|
| int RETVAL; |
| 1714 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 1715 |
|
| DVB * dvb; |
| 1716 |
|
| AV * multiplex_aref; |
| 1717 |
|
| HV * options_href; |
| 1718 |
|
| |
| 1719 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "DVBPtr")) { |
0 |
0 |
0 |
|
| 1720 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 1721 |
0 |
| dvb = INT2PTR(DVB *,tmp); |
| 1722 |
|
| } |
| 1723 |
|
| else { |
| 1724 |
0 |
▶ | const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
Branch: 2 branches
| Branch | True | False | Total |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
| const char* refstr = SvROK(ST(0)) ? "" : SvOK(ST(0)) ? "scalar " : "undef"; |
0 |
0 |
0 |
|
| 1725 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 1726 |
|
| "Linux::DVB::DVBT::dvb_record_demux", |
| 1727 |
|
| "dvb", "DVBPtr", |
| 1728 |
0 |
| refstr, ST(0) |
| 1729 |
|
| ); |
| 1730 |
|
| } |
| 1731 |
|
| ; |
| 1732 |
|
| |
| 1733 |
|
| STMT_START { |
| 1734 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 1735 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 1736 |
0 |
▶ | if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){ |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){ |
0 |
0 |
0 |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){ |
0 |
0 |
0 |
|
| 1737 |
0 |
| multiplex_aref = (AV*)SvRV(xsub_tmp_sv); |
| 1738 |
|
| } |
| 1739 |
|
| else{ |
| 1740 |
0 |
| Perl_croak_nocontext("%s: %s is not an ARRAY reference", |
| 1741 |
|
| "Linux::DVB::DVBT::dvb_record_demux", |
| 1742 |
|
| "multiplex_aref"); |
| 1743 |
|
| } |
| 1744 |
|
| } STMT_END |
| 1745 |
|
| ; |
| 1746 |
|
| |
| 1747 |
0 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
0 |
0 |
|
| 1748 |
0 |
| options_href = NULL; |
| 1749 |
|
| else { |
| 1750 |
|
| STMT_START { |
| 1751 |
0 |
| SV* const xsub_tmp_sv = ST(2); |
| 1752 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 1753 |
0 |
▶ | if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
| if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ |
0 |
0 |
0 |
|
| 1754 |
0 |
| options_href = (HV*)SvRV(xsub_tmp_sv); |
| 1755 |
|
| } |
| 1756 |
|
| else{ |
| 1757 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 1758 |
|
| "Linux::DVB::DVBT::dvb_record_demux", |
| 1759 |
|
| "options_href"); |
| 1760 |
|
| } |
| 1761 |
|
| } STMT_END |
| 1762 |
|
| ; |
| 1763 |
|
| } |
| 1764 |
|
| #line 85 "./xs/DVBT-record.c" |
| 1765 |
|
| unsigned num_entries ; |
| 1766 |
|
| int i ; |
| 1767 |
|
| SV **item ; |
| 1768 |
|
| SV **val; |
| 1769 |
|
| HV *href ; |
| 1770 |
|
| HV *errors_href ; |
| 1771 |
|
| HV *overflows_href ; |
| 1772 |
|
| HV *pkts_href ; |
| 1773 |
|
| HV *timeslip_href ; |
| 1774 |
|
| char *str ; |
| 1775 |
|
| char key[256] ; |
| 1776 |
|
| char string[256] ; |
| 1777 |
|
| |
| 1778 |
|
| AV *pid_array; |
| 1779 |
|
| unsigned num_pids ; |
| 1780 |
|
| int j ; |
| 1781 |
|
| SV **piditem ; |
| 1782 |
|
| |
| 1783 |
|
| struct multiplex_file_struct *file_info ; |
| 1784 |
|
| struct multiplex_pid_struct *pid_list ; |
| 1785 |
|
| unsigned pid_list_length ; |
| 1786 |
|
| unsigned pid_index; |
| 1787 |
|
| |
| 1788 |
|
| time_t now, start, end; |
| 1789 |
|
| int file ; |
| 1790 |
|
| int rc ; |
| 1791 |
|
| |
| 1792 |
|
| unsigned use_demux2 = 0 ; |
| 1793 |
|
| unsigned pnr = 0 ; |
| 1794 |
|
| int event_id = -1 ; |
| 1795 |
|
| unsigned timeslip_start = 0 ; |
| 1796 |
|
| unsigned timeslip_end = 0 ; |
| 1797 |
|
| unsigned max_timeslip = 0 ; |
| 1798 |
|
| |
| 1799 |
|
| #line 1800 "DVBT.c" |
| 1800 |
|
| #line 121 "./xs/DVBT-record.c" |
| 1801 |
|
| if (options_href) |
| 1802 |
|
| { |
| 1803 |
|
| HVF_IV(options_href, use_demux2, use_demux2) ; |
| 1804 |
|
| } |
| 1805 |
|
| |
| 1806 |
|
| |
| 1807 |
|
| // av_len returns -1 for empty. Returns maximum index number otherwise |
| 1808 |
|
| //num_entries = av_len( (AV *)SvRV(multiplex_aref) ) + 1 ; |
| 1809 |
|
| num_entries = av_len( multiplex_aref ) + 1 ; |
| 1810 |
|
| if (num_entries <= 0) |
| 1811 |
|
| { |
| 1812 |
|
| croak("Linux::DVB::DVBT::dvb_record_demux requires a list of multiplex hashes") ; |
| 1813 |
|
| } |
| 1814 |
|
| |
| 1815 |
|
| // count number of entries (and check structure) |
| 1816 |
|
| pid_list_length = 0 ; |
| 1817 |
|
| |
| 1818 |
|
| for (i=0; i <= num_entries ; i++) |
| 1819 |
|
| { |
| 1820 |
|
| if ((item = av_fetch(multiplex_aref, i, 0)) && SvOK (*item)) |
| 1821 |
|
| { |
| 1822 |
|
| if ( SvTYPE(SvRV(*item)) != SVt_PVHV ) |
| 1823 |
|
| { |
| 1824 |
|
| croak("Linux::DVB::DVBT::dvb_record_demux requires a list of multiplex hashes") ; |
| 1825 |
|
| } |
| 1826 |
|
| href = (HV *)SvRV(*item) ; |
| 1827 |
|
| |
| 1828 |
|
| // get pids |
| 1829 |
|
| val = HVF(href, pids) ; |
| 1830 |
|
| pid_array = (AV *) SvRV (*val); |
| 1831 |
|
| num_pids = av_len(pid_array) + 1 ; |
| 1832 |
|
| |
| 1833 |
|
| pid_list_length += num_pids ; |
| 1834 |
|
| } |
| 1835 |
|
| } |
| 1836 |
|
| |
| 1837 |
|
| // create arrays |
| 1838 |
|
| now = time(NULL); |
| 1839 |
|
| pid_list = (struct multiplex_pid_struct *)safemalloc( sizeof(struct multiplex_pid_struct) * pid_list_length); |
| 1840 |
|
| file_info = (struct multiplex_file_struct *)safemalloc( sizeof(struct multiplex_file_struct) * num_entries ); |
| 1841 |
|
| |
| 1842 |
|
| for (i=0, pid_index=0; i <= num_entries ; i++) |
| 1843 |
|
| { |
| 1844 |
|
| if ((item = av_fetch(multiplex_aref, i, 0)) && SvOK (*item)) |
| 1845 |
|
| { |
| 1846 |
|
| href = (HV *)SvRV(*item) ; |
| 1847 |
|
| |
| 1848 |
|
| val = HVF(href, destfile) ; |
| 1849 |
|
| str = (char *)SvPV(*val, SvLEN(*val)) ; |
| 1850 |
|
| file = open(str, O_WRONLY | O_TRUNC | O_CREAT | O_LARGEFILE, 0666); |
| 1851 |
|
| if (-1 == file) { |
| 1852 |
|
| |
| 1853 |
|
| fprintf(stderr,"open %s: %s\n",str,strerror(errno)); |
| 1854 |
|
| croak("Linux::DVB::DVBT::dvb_record_demux failed to write to file") ; |
| 1855 |
|
| } |
| 1856 |
|
| |
| 1857 |
|
| // create file info struct |
| 1858 |
|
| file_info[i].file = file ; |
| 1859 |
|
| |
| 1860 |
|
| val = HVF(href, offset) ; |
| 1861 |
|
| file_info[i].start = now + SvIV (*val) ; |
| 1862 |
|
| |
| 1863 |
|
| val = HVF(href, duration) ; |
| 1864 |
|
| file_info[i].duration = SvIV (*val) ; |
| 1865 |
|
| file_info[i].end = file_info[i].start + SvIV (*val) ; |
| 1866 |
|
| |
| 1867 |
|
| |
| 1868 |
|
| pnr = 0 ; |
| 1869 |
|
| event_id = -1 ; |
| 1870 |
|
| timeslip_start = 0 ; |
| 1871 |
|
| timeslip_end = 0 ; |
| 1872 |
|
| max_timeslip = 0 ; |
| 1873 |
|
| |
| 1874 |
|
| HVF_IV(href, pnr, pnr) ; |
| 1875 |
|
| HVF_IV(href, event_id, event_id) ; |
| 1876 |
|
| HVF_IV(href, timeslip_start, timeslip_start) ; |
| 1877 |
|
| HVF_IV(href, timeslip_end, timeslip_end) ; |
| 1878 |
|
| HVF_IV(href, max_timeslip, max_timeslip) ; |
| 1879 |
|
| |
| 1880 |
|
| // get pids |
| 1881 |
|
| val = HVF(href, pids) ; |
| 1882 |
|
| pid_array = (AV *) SvRV (*val); |
| 1883 |
|
| num_pids = av_len(pid_array) + 1 ; |
| 1884 |
|
| |
| 1885 |
|
| for (j=0; j < num_pids ; j++, ++pid_index) |
| 1886 |
|
| { |
| 1887 |
|
| if ((piditem = av_fetch(pid_array, j, 0)) && SvOK (*piditem)) |
| 1888 |
|
| { |
| 1889 |
|
| pid_list[pid_index].file_info = &file_info[i] ; |
| 1890 |
|
| pid_list[pid_index].pid = SvIV (*piditem) ; |
| 1891 |
|
| pid_list[pid_index].started = 0 ; |
| 1892 |
|
| pid_list[pid_index].done = 0 ; |
| 1893 |
|
| |
| 1894 |
|
| // Statistics |
| 1895 |
|
| pid_list[pid_index].errors = 0 ; |
| 1896 |
|
| pid_list[pid_index].overflows = 0 ; |
| 1897 |
|
| pid_list[pid_index].pkts = 0 ; |
| 1898 |
|
| pid_list[pid_index].timeslip_start_secs = 0 ; |
| 1899 |
|
| pid_list[pid_index].timeslip_end_secs = 0 ; |
| 1900 |
|
| |
| 1901 |
|
| // Timeslipping |
| 1902 |
|
| pid_list[pid_index].pnr = pnr ; |
| 1903 |
|
| pid_list[pid_index].event_id = event_id ; |
| 1904 |
|
| pid_list[pid_index].running_status = RUNNING_STATUS_UNDEF ; |
| 1905 |
|
| pid_list[pid_index].max_timeslip = max_timeslip ; |
| 1906 |
|
| |
| 1907 |
|
| // Flags - set to timeslip start and/or end of prog |
| 1908 |
|
| pid_list[pid_index].timeslip_start = timeslip_start ; |
| 1909 |
|
| pid_list[pid_index].timeslip_end = timeslip_end ; |
| 1910 |
|
| |
| 1911 |
|
| |
| 1912 |
|
| // internal |
| 1913 |
|
| pid_list[pid_index].running_event_id = EVENT_ID_UNDEF ; |
| 1914 |
|
| pid_list[pid_index].pending_event_id = EVENT_ID_UNDEF ; |
| 1915 |
|
| pid_list[pid_index].got_eit = 0 ; |
| 1916 |
|
| pid_list[pid_index].ref = (void *)item ; |
| 1917 |
|
| } |
| 1918 |
|
| } |
| 1919 |
|
| |
| 1920 |
|
| } |
| 1921 |
|
| } |
| 1922 |
|
| |
| 1923 |
|
| // open dvr first |
| 1924 |
|
| RETVAL = dvb_dvr_open(dvb) ; |
| 1925 |
|
| |
| 1926 |
|
| // save stream |
| 1927 |
|
| if (RETVAL == 0) |
| 1928 |
|
| { |
| 1929 |
|
| RETVAL = write_stream_demux(dvb, pid_list, pid_index) ; |
| 1930 |
|
| |
| 1931 |
|
| // close dvr |
| 1932 |
|
| dvb_dvr_release(dvb) ; |
| 1933 |
|
| } |
| 1934 |
|
| |
| 1935 |
|
| // Copy error/packet counts |
| 1936 |
|
| for (i=0; i < pid_index; ++i) |
| 1937 |
|
| { |
| 1938 |
|
| item = (SV **)pid_list[i].ref ; |
| 1939 |
|
| href = (HV *)SvRV(*item) ; |
| 1940 |
|
| |
| 1941 |
|
| sprintf(key, "%d", pid_list[i].pid) ; |
| 1942 |
|
| |
| 1943 |
|
| // set errors (save 64 bit value as a string) |
| 1944 |
|
| val = HVF(href, errors) ; |
| 1945 |
|
| errors_href = (HV *) SvRV (*val); |
| 1946 |
|
| sprintf(string, "%"PRIu64, pid_list[i].errors) ; |
| 1947 |
|
| hv_store(errors_href, key, strlen(key), newSVpv(string, 0), 0); |
| 1948 |
|
| |
| 1949 |
|
| // set overflows (save 64 bit value as a string) |
| 1950 |
|
| val = HVF(href, overflows) ; |
| 1951 |
|
| overflows_href = (HV *) SvRV (*val); |
| 1952 |
|
| sprintf(string, "%"PRIu64, pid_list[i].overflows) ; |
| 1953 |
|
| hv_store(overflows_href, key, strlen(key), newSVpv(string, 0), 0); |
| 1954 |
|
| |
| 1955 |
|
| // set packets (save 64 bit value as a string) |
| 1956 |
|
| val = HVF(href, pkts) ; |
| 1957 |
|
| pkts_href = (HV *) SvRV (*val); |
| 1958 |
|
| sprintf(string, "%"PRIu64, pid_list[i].pkts) ; |
| 1959 |
|
| hv_store(pkts_href, key, strlen(key), newSVpv(string, 0), 0); |
| 1960 |
|
| |
| 1961 |
|
| // set timeslip statistics |
| 1962 |
|
| val = HVF(href, timeslip_start_secs) ; |
| 1963 |
|
| timeslip_href = (HV *) SvRV (*val); |
| 1964 |
|
| sprintf(string, "%u", pid_list[i].timeslip_start_secs) ; |
| 1965 |
|
| hv_store(timeslip_href, key, strlen(key), newSVpv(string, 0), 0); |
| 1966 |
|
| val = HVF(href, timeslip_end_secs) ; |
| 1967 |
|
| timeslip_href = (HV *) SvRV (*val); |
| 1968 |
|
| sprintf(string, "%u", pid_list[i].timeslip_end_secs) ; |
| 1969 |
|
| hv_store(timeslip_href, key, strlen(key), newSVpv(string, 0), 0); |
| 1970 |
|
| |
| 1971 |
|
| |
| 1972 |
|
| } |
| 1973 |
|
| |
| 1974 |
|
| // free up |
| 1975 |
|
| for (i=0; i < num_entries ; i++) |
| 1976 |
|
| { |
| 1977 |
|
| if (file_info[i].file > 0) |
| 1978 |
|
| { |
| 1979 |
|
| close(file_info[i].file) ; |
| 1980 |
|
| } |
| 1981 |
|
| } |
| 1982 |
|
| safefree(pid_list) ; |
| 1983 |
|
| safefree(file_info) ; |
| 1984 |
|
| |
| 1985 |
|
| |
| 1986 |
|
| #line 1987 "DVBT.c" |
| 1987 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 1988 |
0 |
| ST(0) = TARG; |
| 1989 |
|
| } |
| 1990 |
0 |
| XSRETURN(1); |
| 1991 |
|
| } |
| 1992 |
|
| |
| 1993 |
|
| |
| 1994 |
|
| /* INCLUDE: Returning to 'DVBT.xs' from 'xs/DVBT-record.c' */ |
| 1995 |
|
| |
| 1996 |
|
| #ifdef __cplusplus |
| 1997 |
|
| extern "C" { |
| 1998 |
|
| #endif |
| 1999 |
|
| XS_EXTERNAL(boot_Linux__DVB__DVBT); /* prototype to pass -Wmissing-prototypes */ |
| 2000 |
10 |
| XS_EXTERNAL(boot_Linux__DVB__DVBT) |
| 2001 |
|
| { |
| 2002 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 2003 |
|
| dVAR; dXSARGS; |
| 2004 |
|
| #else |
| 2005 |
10 |
| dVAR; dXSBOOTARGSXSAPIVERCHK; |
| 2006 |
|
| #endif |
| 2007 |
|
| #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ |
| 2008 |
|
| char* file = __FILE__; |
| 2009 |
|
| #else |
| 2010 |
10 |
| const char* file = __FILE__; |
| 2011 |
|
| #endif |
| 2012 |
|
| |
| 2013 |
|
| PERL_UNUSED_VAR(file); |
| 2014 |
|
| |
| 2015 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 2016 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 2017 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 2018 |
|
| XS_VERSION_BOOTCHECK; |
| 2019 |
|
| # ifdef XS_APIVERSION_BOOTCHECK |
| 2020 |
|
| XS_APIVERSION_BOOTCHECK; |
| 2021 |
|
| # endif |
| 2022 |
|
| #endif |
| 2023 |
|
| |
| 2024 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_device_probe", XS_Linux__DVB__DVBT_dvb_device_probe, file, "$$;$"); |
| 2025 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_device_names", XS_Linux__DVB__DVBT_dvb_device_names, file, "$"); |
| 2026 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_init", XS_Linux__DVB__DVBT_dvb_init, file, "$$"); |
| 2027 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_init_nr", XS_Linux__DVB__DVBT_dvb_init_nr, file, "$$"); |
| 2028 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_fini", XS_Linux__DVB__DVBT_dvb_fini, file, "$"); |
| 2029 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_set_debug", XS_Linux__DVB__DVBT_dvb_set_debug, file, "$"); |
| 2030 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_error_str", XS_Linux__DVB__DVBT_dvb_error_str, file, ""); |
| 2031 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_file_flags", XS_Linux__DVB__DVBT_dvb_file_flags, file, ""); |
| 2032 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_free_disk", XS_Linux__DVB__DVBT_dvb_free_disk, file, "$"); |
| 2033 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_scan_new", XS_Linux__DVB__DVBT_dvb_scan_new, file, "$$"); |
| 2034 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_scan_init", XS_Linux__DVB__DVBT_dvb_scan_init, file, "$$"); |
| 2035 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_scan_end", XS_Linux__DVB__DVBT_dvb_scan_end, file, "$$"); |
| 2036 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_scan", XS_Linux__DVB__DVBT_dvb_scan, file, "$$"); |
| 2037 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_tune", XS_Linux__DVB__DVBT_dvb_tune, file, "$$"); |
| 2038 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_scan_tune", XS_Linux__DVB__DVBT_dvb_scan_tune, file, "$$"); |
| 2039 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_signal_quality", XS_Linux__DVB__DVBT_dvb_signal_quality, file, "$"); |
| 2040 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_round_freq", XS_Linux__DVB__DVBT_dvb_round_freq, file, "$"); |
| 2041 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_is_busy", XS_Linux__DVB__DVBT_dvb_is_busy, file, "$"); |
| 2042 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_clear_epg", XS_Linux__DVB__DVBT_dvb_clear_epg, file, ""); |
| 2043 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_epg", XS_Linux__DVB__DVBT_dvb_epg, file, "$$$$"); |
| 2044 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_epg_stats", XS_Linux__DVB__DVBT_dvb_epg_stats, file, "$"); |
| 2045 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_del_demux", XS_Linux__DVB__DVBT_dvb_del_demux, file, "$$"); |
| 2046 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_add_demux", XS_Linux__DVB__DVBT_dvb_add_demux, file, "$$"); |
| 2047 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_record", XS_Linux__DVB__DVBT_dvb_record, file, "$$$"); |
| 2048 |
10 |
| (void)newXSproto_portable("Linux::DVB::DVBT::dvb_record_demux", XS_Linux__DVB__DVBT_dvb_record_demux, file, "$$;$"); |
| 2049 |
|
| |
| 2050 |
|
| /* Initialisation Section */ |
| 2051 |
|
| |
| 2052 |
|
| #line 6 "./xs/DVBT-const.c" |
| 2053 |
|
| HV *globals ; |
| 2054 |
|
| HV *rh, *rh2 ; |
| 2055 |
|
| globals = get_hv("Linux::DVB::DVBT::Constants::CONSTANTS", TRUE) ; |
| 2056 |
|
| HVS_INT(globals, FRAMES_PER_SEC, FPS) ; |
| 2057 |
|
| globals = get_hv("Linux::DVB::DVBT::Constants::CONSTANTS", FALSE) ; |
| 2058 |
|
| |
| 2059 |
|
| #line 2060 "DVBT.c" |
| 2060 |
|
| |
| 2061 |
|
| /* End of Initialisation Section */ |
| 2062 |
|
| |
| 2063 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 2064 |
|
| # if PERL_VERSION_GE(5, 9, 0) |
| 2065 |
|
| if (PL_unitcheckav) |
| 2066 |
|
| call_list(PL_scopestack_ix, PL_unitcheckav); |
| 2067 |
|
| # endif |
| 2068 |
|
| XSRETURN_YES; |
| 2069 |
|
| #else |
| 2070 |
10 |
| Perl_xs_boot_epilog(aTHX_ ax); |
| 2071 |
|
| #endif |
| 2072 |
10 |
| } |
| 2073 |
|
| |
| 2074 |
|
| #ifdef __cplusplus |
| 2075 |
|
| } |
| 2076 |
|
| #endif |