| 1 |
|
| /* |
| 2 |
|
| * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the |
| 3 |
|
| * contents of TS.xs. Do not edit this file, edit TS.xs instead. |
| 4 |
|
| * |
| 5 |
|
| * ANY CHANGES MADE HERE WILL BE LOST! |
| 6 |
|
| * |
| 7 |
|
| */ |
| 8 |
|
| |
| 9 |
|
| #line 1 "TS.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 |
|
| |
| 19 |
|
| #include "xs/DVBT-ts-c.c" |
| 20 |
|
| |
| 21 |
|
| #define DVBT_TS_VERSION "1.00" |
| 22 |
|
| |
| 23 |
|
| |
| 24 |
|
| #line 25 "TS.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 "TS.c" |
| 176 |
|
| |
| 177 |
|
| /* INCLUDE: Including 'xs/DVBT-ts.c' from 'TS.xs' */ |
| 178 |
|
| |
| 179 |
|
| |
| 180 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_repair); /* prototype to pass -Wmissing-prototypes */ |
| 181 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_repair) |
| 182 |
|
| { |
| 183 |
0 |
| dVAR; dXSARGS; |
| 184 |
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 |
|
| 185 |
0 |
| croak_xs_usage(cv, "filename, ofilename, settings_href=NULL"); |
| 186 |
|
| { |
| 187 |
|
| int RETVAL; |
| 188 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 189 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 190 |
|
| ; |
| 191 |
0 |
▶ | char * ofilename = (char *)SvPV_nolen(ST(1)) |
Branch: 1 branch
| Branch | True | False | Total |
| char * ofilename = (char *)SvPV_nolen(ST(1)) |
0 |
0 |
0 |
|
| 192 |
|
| ; |
| 193 |
|
| HV * settings_href; |
| 194 |
|
| |
| 195 |
0 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
0 |
0 |
|
| 196 |
0 |
| settings_href = NULL; |
| 197 |
|
| else { |
| 198 |
|
| STMT_START { |
| 199 |
0 |
| SV* const xsub_tmp_sv = ST(2); |
| 200 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 201 |
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 |
|
| 202 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 203 |
|
| } |
| 204 |
|
| else{ |
| 205 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 206 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_repair", |
| 207 |
|
| "settings_href"); |
| 208 |
|
| } |
| 209 |
|
| } STMT_END |
| 210 |
|
| ; |
| 211 |
|
| } |
| 212 |
|
| #line 10 "./xs/DVBT-ts.c" |
| 213 |
|
| struct TS_settings settings; |
| 214 |
|
| SV **val; |
| 215 |
|
| |
| 216 |
|
| #line 217 "TS.c" |
| 217 |
|
| #line 14 "./xs/DVBT-ts.c" |
| 218 |
|
| dvb_error_clear() ; |
| 219 |
|
| clear_settings(&settings) ; |
| 220 |
|
| |
| 221 |
|
| if (settings_href) |
| 222 |
|
| { |
| 223 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 224 |
|
| HVF_IV(settings_href, null_error_packets, settings.null_error_packets) ; |
| 225 |
|
| HVF_SVV(settings_href, error_callback, settings.error_callback) ; |
| 226 |
|
| HVF_SVV(settings_href, user_data, settings.perl_data) ; |
| 227 |
|
| } |
| 228 |
|
| |
| 229 |
|
| // repair |
| 230 |
|
| RETVAL = tsrepair(filename, ofilename, &settings) ; |
| 231 |
|
| |
| 232 |
|
| #line 233 "TS.c" |
| 233 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 234 |
0 |
| ST(0) = TARG; |
| 235 |
|
| } |
| 236 |
0 |
| XSRETURN(1); |
| 237 |
|
| } |
| 238 |
|
| |
| 239 |
|
| |
| 240 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse); /* prototype to pass -Wmissing-prototypes */ |
| 241 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse) |
| 242 |
|
| { |
| 243 |
0 |
| dVAR; dXSARGS; |
| 244 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 245 |
0 |
| croak_xs_usage(cv, "filename, settings_href"); |
| 246 |
|
| { |
| 247 |
|
| int RETVAL; |
| 248 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 249 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 250 |
|
| ; |
| 251 |
|
| HV * settings_href; |
| 252 |
|
| |
| 253 |
|
| STMT_START { |
| 254 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 255 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 256 |
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 |
|
| 257 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 258 |
|
| } |
| 259 |
|
| else{ |
| 260 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 261 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_parse", |
| 262 |
|
| "settings_href"); |
| 263 |
|
| } |
| 264 |
|
| } STMT_END |
| 265 |
|
| ; |
| 266 |
|
| #line 37 "./xs/DVBT-ts.c" |
| 267 |
|
| struct TS_settings settings; |
| 268 |
|
| SV **val; |
| 269 |
|
| int ival ; |
| 270 |
|
| |
| 271 |
|
| #line 272 "TS.c" |
| 272 |
|
| #line 42 "./xs/DVBT-ts.c" |
| 273 |
|
| dvb_error_clear() ; |
| 274 |
|
| clear_settings(&settings) ; |
| 275 |
|
| |
| 276 |
|
| if (settings_href) |
| 277 |
|
| { |
| 278 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 279 |
|
| |
| 280 |
|
| HVF_IV(settings_href, num_pkts, settings.num_pkts) ; |
| 281 |
|
| HVF_IV(settings_href, skip_pkts, settings.skip_pkts) ; |
| 282 |
|
| HVF_IV(settings_href, origin, settings.origin) ; |
| 283 |
|
| |
| 284 |
|
| HVF_SVV(settings_href, pid_callback, settings.pid_callback) ; |
| 285 |
|
| HVF_SVV(settings_href, error_callback, settings.error_callback) ; |
| 286 |
|
| HVF_SVV(settings_href, payload_callback, settings.payload_callback) ; |
| 287 |
|
| HVF_SVV(settings_href, ts_callback, settings.ts_callback) ; |
| 288 |
|
| HVF_SVV(settings_href, pes_callback, settings.pes_callback) ; |
| 289 |
|
| HVF_SVV(settings_href, pes_data_callback, settings.pes_data_callback) ; |
| 290 |
|
| HVF_SVV(settings_href, progress_callback, settings.progress_callback) ; |
| 291 |
|
| HVF_SVV(settings_href, mpeg2_callback, settings.mpeg2_callback) ; |
| 292 |
|
| HVF_SVV(settings_href, mpeg2_rgb_callback, settings.mpeg2_rgb_callback) ; |
| 293 |
|
| HVF_SVV(settings_href, audio_callback, settings.audio_callback) ; |
| 294 |
|
| |
| 295 |
|
| HVF_SVV(settings_href, user_data, settings.perl_data) ; |
| 296 |
|
| } |
| 297 |
|
| |
| 298 |
|
| |
| 299 |
|
| // parse |
| 300 |
|
| RETVAL = tsparse(filename, &settings) ; |
| 301 |
|
| |
| 302 |
|
| #line 303 "TS.c" |
| 303 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 304 |
0 |
| ST(0) = TARG; |
| 305 |
|
| } |
| 306 |
0 |
| XSRETURN(1); |
| 307 |
|
| } |
| 308 |
|
| |
| 309 |
|
| |
| 310 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_begin); /* prototype to pass -Wmissing-prototypes */ |
| 311 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_begin) |
| 312 |
|
| { |
| 313 |
0 |
| dVAR; dXSARGS; |
| 314 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 315 |
0 |
| croak_xs_usage(cv, "filename, settings_href"); |
| 316 |
|
| { |
| 317 |
|
| TSReader * RETVAL; |
| 318 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 319 |
|
| ; |
| 320 |
|
| HV * settings_href; |
| 321 |
|
| |
| 322 |
|
| STMT_START { |
| 323 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 324 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 325 |
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 |
|
| 326 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 327 |
|
| } |
| 328 |
|
| else{ |
| 329 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 330 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_parse_begin", |
| 331 |
|
| "settings_href"); |
| 332 |
|
| } |
| 333 |
|
| } STMT_END |
| 334 |
|
| ; |
| 335 |
|
| #line 82 "./xs/DVBT-ts.c" |
| 336 |
|
| struct TS_settings settings; |
| 337 |
|
| SV **val; |
| 338 |
|
| int ival ; |
| 339 |
|
| |
| 340 |
|
| #line 341 "TS.c" |
| 341 |
|
| #line 87 "./xs/DVBT-ts.c" |
| 342 |
|
| dvb_error_clear() ; |
| 343 |
|
| clear_settings(&settings) ; |
| 344 |
|
| |
| 345 |
|
| if (settings_href) |
| 346 |
|
| { |
| 347 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 348 |
|
| |
| 349 |
|
| HVF_IV(settings_href, num_pkts, settings.num_pkts) ; |
| 350 |
|
| HVF_IV(settings_href, skip_pkts, settings.skip_pkts) ; |
| 351 |
|
| HVF_IV(settings_href, origin, settings.origin) ; |
| 352 |
|
| |
| 353 |
|
| HVF_SVV(settings_href, pid_callback, settings.pid_callback) ; |
| 354 |
|
| HVF_SVV(settings_href, error_callback, settings.error_callback) ; |
| 355 |
|
| HVF_SVV(settings_href, payload_callback, settings.payload_callback) ; |
| 356 |
|
| HVF_SVV(settings_href, ts_callback, settings.ts_callback) ; |
| 357 |
|
| HVF_SVV(settings_href, pes_callback, settings.pes_callback) ; |
| 358 |
|
| HVF_SVV(settings_href, pes_data_callback, settings.pes_data_callback) ; |
| 359 |
|
| HVF_SVV(settings_href, progress_callback, settings.progress_callback) ; |
| 360 |
|
| HVF_SVV(settings_href, mpeg2_callback, settings.mpeg2_callback) ; |
| 361 |
|
| HVF_SVV(settings_href, mpeg2_rgb_callback, settings.mpeg2_rgb_callback) ; |
| 362 |
|
| HVF_SVV(settings_href, audio_callback, settings.audio_callback) ; |
| 363 |
|
| |
| 364 |
|
| HVF_SVV(settings_href, user_data, settings.perl_data) ; |
| 365 |
|
| } |
| 366 |
|
| |
| 367 |
|
| // parse |
| 368 |
|
| RETVAL = tsparse_start(filename, &settings) ; |
| 369 |
|
| |
| 370 |
|
| #line 371 "TS.c" |
| 371 |
|
| { |
| 372 |
|
| SV * RETVALSV; |
| 373 |
0 |
| RETVALSV = sv_newmortal(); |
| 374 |
0 |
| sv_setref_pv(RETVALSV, "TSReaderPtr", (void*)RETVAL); |
| 375 |
0 |
| ST(0) = RETVALSV; |
| 376 |
|
| } |
| 377 |
|
| } |
| 378 |
0 |
| XSRETURN(1); |
| 379 |
|
| } |
| 380 |
|
| |
| 381 |
|
| |
| 382 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_run); /* prototype to pass -Wmissing-prototypes */ |
| 383 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_run) |
| 384 |
|
| { |
| 385 |
0 |
| dVAR; dXSARGS; |
| 386 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 387 |
0 |
| croak_xs_usage(cv, "tsreader"); |
| 388 |
|
| { |
| 389 |
|
| int RETVAL; |
| 390 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 391 |
|
| TSReader * tsreader; |
| 392 |
|
| |
| 393 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
|
| 394 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 395 |
0 |
| tsreader = INT2PTR(TSReader *,tmp); |
| 396 |
|
| } |
| 397 |
|
| else { |
| 398 |
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 |
|
| 399 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 400 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_parse_run", |
| 401 |
|
| "tsreader", "TSReaderPtr", |
| 402 |
0 |
| refstr, ST(0) |
| 403 |
|
| ); |
| 404 |
|
| } |
| 405 |
|
| ; |
| 406 |
|
| #line 125 "./xs/DVBT-ts.c" |
| 407 |
|
| dvb_error_clear() ; |
| 408 |
|
| |
| 409 |
|
| // check |
| 410 |
|
| VALID_READER(tsreader) ; |
| 411 |
|
| |
| 412 |
|
| // run |
| 413 |
|
| if (!RETVAL) |
| 414 |
|
| RETVAL = tsparse_run(tsreader) ; |
| 415 |
|
| |
| 416 |
|
| #line 417 "TS.c" |
| 417 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 418 |
0 |
| ST(0) = TARG; |
| 419 |
|
| } |
| 420 |
0 |
| XSRETURN(1); |
| 421 |
|
| } |
| 422 |
|
| |
| 423 |
|
| |
| 424 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_end); /* prototype to pass -Wmissing-prototypes */ |
| 425 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_end) |
| 426 |
|
| { |
| 427 |
0 |
| dVAR; dXSARGS; |
| 428 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 429 |
0 |
| croak_xs_usage(cv, "tsreader"); |
| 430 |
|
| { |
| 431 |
|
| int RETVAL; |
| 432 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 433 |
|
| TSReader * tsreader; |
| 434 |
|
| |
| 435 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
|
| 436 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 437 |
0 |
| tsreader = INT2PTR(TSReader *,tmp); |
| 438 |
|
| } |
| 439 |
|
| else { |
| 440 |
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 |
|
| 441 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 442 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_parse_end", |
| 443 |
|
| "tsreader", "TSReaderPtr", |
| 444 |
0 |
| refstr, ST(0) |
| 445 |
|
| ); |
| 446 |
|
| } |
| 447 |
|
| ; |
| 448 |
|
| #line 145 "./xs/DVBT-ts.c" |
| 449 |
|
| dvb_error_clear() ; |
| 450 |
|
| |
| 451 |
|
| // check |
| 452 |
|
| VALID_READER(tsreader) ; |
| 453 |
|
| |
| 454 |
|
| // finish |
| 455 |
|
| if (!RETVAL) |
| 456 |
|
| RETVAL = tsparse_end(tsreader) ; |
| 457 |
|
| |
| 458 |
|
| #line 459 "TS.c" |
| 459 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 460 |
0 |
| ST(0) = TARG; |
| 461 |
|
| } |
| 462 |
0 |
| XSRETURN(1); |
| 463 |
|
| } |
| 464 |
|
| |
| 465 |
|
| |
| 466 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_stop); /* prototype to pass -Wmissing-prototypes */ |
| 467 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_parse_stop) |
| 468 |
|
| { |
| 469 |
0 |
| dVAR; dXSARGS; |
| 470 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 471 |
0 |
| croak_xs_usage(cv, "tsreader"); |
| 472 |
|
| { |
| 473 |
|
| int RETVAL; |
| 474 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 475 |
|
| TSReader * tsreader; |
| 476 |
|
| |
| 477 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
|
| 478 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 479 |
0 |
| tsreader = INT2PTR(TSReader *,tmp); |
| 480 |
|
| } |
| 481 |
|
| else { |
| 482 |
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 |
|
| 483 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 484 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_parse_stop", |
| 485 |
|
| "tsreader", "TSReaderPtr", |
| 486 |
0 |
| refstr, ST(0) |
| 487 |
|
| ); |
| 488 |
|
| } |
| 489 |
|
| ; |
| 490 |
|
| #line 165 "./xs/DVBT-ts.c" |
| 491 |
|
| dvb_error_clear() ; |
| 492 |
|
| |
| 493 |
|
| // check |
| 494 |
|
| VALID_READER(tsreader) ; |
| 495 |
|
| |
| 496 |
|
| // stop now |
| 497 |
|
| if (!RETVAL) |
| 498 |
|
| tsreader_stop(tsreader) ; |
| 499 |
|
| |
| 500 |
|
| #line 501 "TS.c" |
| 501 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 502 |
0 |
| ST(0) = TARG; |
| 503 |
|
| } |
| 504 |
0 |
| XSRETURN(1); |
| 505 |
|
| } |
| 506 |
|
| |
| 507 |
|
| |
| 508 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_setpos); /* prototype to pass -Wmissing-prototypes */ |
| 509 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_setpos) |
| 510 |
|
| { |
| 511 |
0 |
| dVAR; dXSARGS; |
| 512 |
0 |
▶ | if (items != 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 4) |
0 |
0 |
0 |
|
| 513 |
0 |
| croak_xs_usage(cv, "tsreader, skip_pkts, origin, num_pkts"); |
| 514 |
|
| { |
| 515 |
|
| int RETVAL; |
| 516 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 517 |
|
| TSReader * tsreader; |
| 518 |
0 |
| int skip_pkts = (int)SvIV(ST(1)) |
| 519 |
|
| ; |
| 520 |
0 |
| int origin = (int)SvIV(ST(2)) |
| 521 |
|
| ; |
| 522 |
0 |
| unsigned num_pkts = (unsigned)SvUV(ST(3)) |
| 523 |
|
| ; |
| 524 |
|
| |
| 525 |
0 |
▶ | if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
| if (SvROK(ST(0)) && sv_derived_from(ST(0), "TSReaderPtr")) { |
0 |
0 |
0 |
|
| 526 |
0 |
| IV tmp = SvIV((SV*)SvRV(ST(0))); |
| 527 |
0 |
| tsreader = INT2PTR(TSReader *,tmp); |
| 528 |
|
| } |
| 529 |
|
| else { |
| 530 |
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 |
|
| 531 |
0 |
| Perl_croak_nocontext("%s: Expected %s to be of type %s; got %s%" SVf " instead", |
| 532 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_setpos", |
| 533 |
|
| "tsreader", "TSReaderPtr", |
| 534 |
0 |
| refstr, ST(0) |
| 535 |
|
| ); |
| 536 |
|
| } |
| 537 |
|
| ; |
| 538 |
|
| #line 185 "./xs/DVBT-ts.c" |
| 539 |
|
| dvb_error_clear() ; |
| 540 |
|
| |
| 541 |
|
| // check |
| 542 |
|
| VALID_READER(tsreader) ; |
| 543 |
|
| |
| 544 |
|
| // set position |
| 545 |
|
| if (!RETVAL) |
| 546 |
|
| RETVAL = tsreader_setpos(tsreader, skip_pkts, origin, num_pkts) ; |
| 547 |
|
| |
| 548 |
|
| #line 549 "TS.c" |
| 549 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 550 |
0 |
| ST(0) = TARG; |
| 551 |
|
| } |
| 552 |
0 |
| XSRETURN(1); |
| 553 |
|
| } |
| 554 |
|
| |
| 555 |
|
| |
| 556 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_info); /* prototype to pass -Wmissing-prototypes */ |
| 557 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_info) |
| 558 |
|
| { |
| 559 |
0 |
| dVAR; dXSARGS; |
| 560 |
0 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
0 |
0 |
|
| 561 |
0 |
| croak_xs_usage(cv, "filename, settings_href"); |
| 562 |
|
| { |
| 563 |
|
| SV * RETVAL; |
| 564 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 565 |
|
| ; |
| 566 |
|
| HV * settings_href; |
| 567 |
|
| |
| 568 |
|
| STMT_START { |
| 569 |
0 |
| SV* const xsub_tmp_sv = ST(1); |
| 570 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 571 |
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 |
|
| 572 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 573 |
|
| } |
| 574 |
|
| else{ |
| 575 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 576 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_info", |
| 577 |
|
| "settings_href"); |
| 578 |
|
| } |
| 579 |
|
| } STMT_END |
| 580 |
|
| ; |
| 581 |
|
| #line 204 "./xs/DVBT-ts.c" |
| 582 |
|
| TSReader *tsreader ; |
| 583 |
|
| struct TS_settings settings; |
| 584 |
|
| SV **val; |
| 585 |
|
| HV *info_href = (HV *)sv_2mortal((SV *)newHV()); |
| 586 |
|
| HV *pid_href = (HV *)sv_2mortal((SV *)newHV()); |
| 587 |
|
| struct TS_pid *piditem; |
| 588 |
|
| struct list_head *item; |
| 589 |
|
| char key[256] ; |
| 590 |
|
| |
| 591 |
|
| #line 592 "TS.c" |
| 592 |
|
| #line 214 "./xs/DVBT-ts.c" |
| 593 |
|
| dvb_error_clear() ; |
| 594 |
|
| |
| 595 |
|
| /* Create Perl data */ |
| 596 |
|
| HVS(info_href, pids, newRV((SV *)pid_href)) ; |
| 597 |
|
| |
| 598 |
|
| clear_settings(&settings) ; |
| 599 |
|
| if (settings_href) |
| 600 |
|
| { |
| 601 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 602 |
|
| } |
| 603 |
|
| |
| 604 |
|
| // get info |
| 605 |
|
| tsreader = tsinfo(filename, &settings) ; |
| 606 |
|
| |
| 607 |
|
| if (!tsreader) |
| 608 |
|
| { |
| 609 |
|
| char *errstr = dvb_error_str(dvb_error_code) ; |
| 610 |
|
| HVS_STR(info_href, error, errstr) ; |
| 611 |
|
| } |
| 612 |
|
| else |
| 613 |
|
| { |
| 614 |
|
| // save info in a HASH |
| 615 |
|
| HVS_I(info_href, tsreader->tsstate, total_pkts) ; |
| 616 |
|
| _store_time(info_href, "duration", (tsreader->tsstate->end_ts - tsreader->tsstate->start_ts) ) ; |
| 617 |
|
| _store_ts(info_href, "start_ts", tsreader->tsstate->start_ts) ; |
| 618 |
|
| _store_ts(info_href, "end_ts", tsreader->tsstate->end_ts) ; |
| 619 |
|
| |
| 620 |
|
| list_for_each(item, &tsreader->tsstate->pid_list) |
| 621 |
|
| { |
| 622 |
|
| HV *h ; |
| 623 |
|
| |
| 624 |
|
| piditem = list_entry(item, struct TS_pid, next); |
| 625 |
|
| |
| 626 |
|
| /* Convert structure fields into hash elements */ |
| 627 |
|
| h = (HV *)sv_2mortal((SV *)newHV()); |
| 628 |
|
| |
| 629 |
|
| _add_pidinfo(h, &piditem->pidinfo) ; |
| 630 |
|
| _add_pesinfo(h, &piditem->pesinfo) ; |
| 631 |
|
| |
| 632 |
|
| sprintf(key, "%d", piditem->pidinfo.pid) ; |
| 633 |
|
| hv_store(pid_href, key, strlen(key), newRV((SV *)h), 0) ; |
| 634 |
|
| } |
| 635 |
|
| |
| 636 |
|
| |
| 637 |
|
| // end |
| 638 |
|
| tsparse_end(tsreader) ; |
| 639 |
|
| } |
| 640 |
|
| |
| 641 |
|
| RETVAL = newRV((SV *)info_href); |
| 642 |
|
| |
| 643 |
|
| #line 644 "TS.c" |
| 644 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 645 |
0 |
| ST(0) = RETVAL; |
| 646 |
|
| } |
| 647 |
0 |
| XSRETURN(1); |
| 648 |
|
| } |
| 649 |
|
| |
| 650 |
|
| |
| 651 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_error_str); /* prototype to pass -Wmissing-prototypes */ |
| 652 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_error_str) |
| 653 |
|
| { |
| 654 |
0 |
| dVAR; dXSARGS; |
| 655 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 656 |
0 |
| croak_xs_usage(cv, ""); |
| 657 |
|
| { |
| 658 |
|
| SV * RETVAL; |
| 659 |
|
| #line 273 "./xs/DVBT-ts.c" |
| 660 |
|
| SV *str; |
| 661 |
|
| char *error_str ; |
| 662 |
|
| |
| 663 |
|
| #line 664 "TS.c" |
| 664 |
|
| #line 277 "./xs/DVBT-ts.c" |
| 665 |
|
| error_str = dvb_error_str(dvb_error_code) ; |
| 666 |
|
| RETVAL = newSVpv(error_str, 0) ; |
| 667 |
|
| |
| 668 |
|
| #line 669 "TS.c" |
| 669 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 670 |
0 |
| ST(0) = RETVAL; |
| 671 |
|
| } |
| 672 |
0 |
| XSRETURN(1); |
| 673 |
|
| } |
| 674 |
|
| |
| 675 |
|
| |
| 676 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_error); /* prototype to pass -Wmissing-prototypes */ |
| 677 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_error) |
| 678 |
|
| { |
| 679 |
0 |
| dVAR; dXSARGS; |
| 680 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 681 |
0 |
| croak_xs_usage(cv, ""); |
| 682 |
|
| { |
| 683 |
|
| int RETVAL; |
| 684 |
0 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
| dXSTARG; |
0 |
0 |
0 |
|
| 685 |
|
| #line 290 "./xs/DVBT-ts.c" |
| 686 |
|
| RETVAL = dvb_error_code ; |
| 687 |
|
| |
| 688 |
|
| #line 689 "TS.c" |
| 689 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 690 |
0 |
| ST(0) = TARG; |
| 691 |
|
| } |
| 692 |
0 |
| XSRETURN(1); |
| 693 |
|
| } |
| 694 |
|
| |
| 695 |
|
| |
| 696 |
|
| /* INCLUDE: Returning to 'TS.xs' from 'xs/DVBT-ts.c' */ |
| 697 |
|
| |
| 698 |
|
| |
| 699 |
|
| /* INCLUDE: Including 'xs/DVBT-ts-skip.c' from 'TS.xs' */ |
| 700 |
|
| |
| 701 |
|
| |
| 702 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_cut); /* prototype to pass -Wmissing-prototypes */ |
| 703 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_cut) |
| 704 |
|
| { |
| 705 |
0 |
| dVAR; dXSARGS; |
| 706 |
0 |
▶ | if (items < 3 || items > 4) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 3 || items > 4) |
0 |
0 |
0 |
| if (items < 3 || items > 4) |
0 |
0 |
0 |
|
| 707 |
0 |
| croak_xs_usage(cv, "filename, ofilename, cuts_aref, settings_href=NULL"); |
| 708 |
|
| { |
| 709 |
|
| int RETVAL; |
| 710 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 711 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 712 |
|
| ; |
| 713 |
0 |
▶ | char * ofilename = (char *)SvPV_nolen(ST(1)) |
Branch: 1 branch
| Branch | True | False | Total |
| char * ofilename = (char *)SvPV_nolen(ST(1)) |
0 |
0 |
0 |
|
| 714 |
|
| ; |
| 715 |
0 |
| SV * cuts_aref = ST(2) |
| 716 |
|
| ; |
| 717 |
|
| HV * settings_href; |
| 718 |
|
| |
| 719 |
0 |
▶ | if (items < 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 4) |
0 |
0 |
0 |
|
| 720 |
0 |
| settings_href = NULL; |
| 721 |
|
| else { |
| 722 |
|
| STMT_START { |
| 723 |
0 |
| SV* const xsub_tmp_sv = ST(3); |
| 724 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 725 |
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 |
|
| 726 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 727 |
|
| } |
| 728 |
|
| else{ |
| 729 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 730 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_cut", |
| 731 |
|
| "settings_href"); |
| 732 |
|
| } |
| 733 |
|
| } STMT_END |
| 734 |
|
| ; |
| 735 |
|
| } |
| 736 |
|
| #line 9 "./xs/DVBT-ts-skip.c" |
| 737 |
|
| struct TS_settings settings; |
| 738 |
|
| SV **val; |
| 739 |
|
| struct list_head cut_list; |
| 740 |
|
| unsigned num_entries ; |
| 741 |
|
| unsigned i ; |
| 742 |
|
| SV **item ; |
| 743 |
|
| HV *href ; |
| 744 |
|
| unsigned start ; |
| 745 |
|
| unsigned end ; |
| 746 |
|
| |
| 747 |
|
| #line 748 "TS.c" |
| 748 |
|
| #line 20 "./xs/DVBT-ts-skip.c" |
| 749 |
|
| dvb_error_clear() ; |
| 750 |
|
| clear_settings(&settings) ; |
| 751 |
|
| |
| 752 |
|
| if (settings_href) |
| 753 |
|
| { |
| 754 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 755 |
|
| HVF_IV(settings_href, save_cut, settings.save_cut) ; |
| 756 |
|
| HVF_SVV(settings_href, error_callback, settings.error_callback) ; |
| 757 |
|
| HVF_SVV(settings_href, user_data, settings.perl_data) ; |
| 758 |
|
| } |
| 759 |
|
| |
| 760 |
|
| // fprintf(stderr, "cuts_aref ok = %d\n", SvROK(cuts_aref)) ; |
| 761 |
|
| // fprintf(stderr, "cuts_aref type %d want %d\n", SvTYPE(SvRV(cuts_aref)), SVt_PVAV); |
| 762 |
|
| |
| 763 |
|
| |
| 764 |
|
| if ((!SvROK(cuts_aref)) |
| 765 |
|
| || (SvTYPE(SvRV(cuts_aref)) != SVt_PVAV)) |
| 766 |
|
| { |
| 767 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_cut requires a valid cuts array ref") ; |
| 768 |
|
| } |
| 769 |
|
| |
| 770 |
|
| // av_len returns -1 for empty. Returns maximum index number otherwise |
| 771 |
|
| num_entries = av_len( (AV *)SvRV(cuts_aref) ) + 1 ; |
| 772 |
|
| if (num_entries <= 0) |
| 773 |
|
| { |
| 774 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_cut requires a list of cuts hashes") ; |
| 775 |
|
| } |
| 776 |
|
| |
| 777 |
|
| |
| 778 |
|
| // Create cut list |
| 779 |
|
| INIT_LIST_HEAD(&cut_list); |
| 780 |
|
| |
| 781 |
|
| for (i=0; i <= num_entries ; i++) |
| 782 |
|
| { |
| 783 |
|
| if ((item = av_fetch((AV *)SvRV(cuts_aref), i, 0)) && SvOK (*item)) |
| 784 |
|
| { |
| 785 |
|
| if ( SvTYPE(SvRV(*item)) != SVt_PVHV ) |
| 786 |
|
| { |
| 787 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_cut requires a list of cut hashes") ; |
| 788 |
|
| } |
| 789 |
|
| href = (HV *)SvRV(*item) ; |
| 790 |
|
| |
| 791 |
|
| // get start..end cut packet numbers |
| 792 |
|
| val = HVF(href, start_pkt) ; |
| 793 |
|
| start = SvIV (*val) ; |
| 794 |
|
| val = HVF(href, end_pkt) ; |
| 795 |
|
| end = SvIV (*val) ; |
| 796 |
|
| |
| 797 |
|
| // add to cut list |
| 798 |
|
| add_cut(&cut_list, start, end) ; |
| 799 |
|
| } |
| 800 |
|
| } |
| 801 |
|
| |
| 802 |
|
| |
| 803 |
|
| //_print_cut_list("__INITIAL__", &cut_list) ; |
| 804 |
|
| |
| 805 |
|
| // cut (frees the cut_list) |
| 806 |
|
| RETVAL = ts_cut(filename, ofilename, &cut_list, settings.debug) ; |
| 807 |
|
| |
| 808 |
|
| #line 809 "TS.c" |
| 809 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 810 |
0 |
| ST(0) = TARG; |
| 811 |
|
| } |
| 812 |
0 |
| XSRETURN(1); |
| 813 |
|
| } |
| 814 |
|
| |
| 815 |
|
| |
| 816 |
|
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_split); /* prototype to pass -Wmissing-prototypes */ |
| 817 |
0 |
| XS_EUPXS(XS_Linux__DVB__DVBT__TS_dvb_ts_split) |
| 818 |
|
| { |
| 819 |
0 |
| dVAR; dXSARGS; |
| 820 |
0 |
▶ | if (items < 3 || items > 4) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 3 || items > 4) |
0 |
0 |
0 |
| if (items < 3 || items > 4) |
0 |
0 |
0 |
|
| 821 |
0 |
| croak_xs_usage(cv, "filename, ofilename, cuts_aref, settings_href=NULL"); |
| 822 |
|
| { |
| 823 |
|
| int RETVAL; |
| 824 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 825 |
0 |
| char * filename = (char *)SvPV_nolen(ST(0)) |
| 826 |
|
| ; |
| 827 |
0 |
▶ | char * ofilename = (char *)SvPV_nolen(ST(1)) |
Branch: 1 branch
| Branch | True | False | Total |
| char * ofilename = (char *)SvPV_nolen(ST(1)) |
0 |
0 |
0 |
|
| 828 |
|
| ; |
| 829 |
0 |
| SV * cuts_aref = ST(2) |
| 830 |
|
| ; |
| 831 |
|
| HV * settings_href; |
| 832 |
|
| |
| 833 |
0 |
▶ | if (items < 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 4) |
0 |
0 |
0 |
|
| 834 |
0 |
| settings_href = NULL; |
| 835 |
|
| else { |
| 836 |
|
| STMT_START { |
| 837 |
0 |
| SV* const xsub_tmp_sv = ST(3); |
| 838 |
0 |
| SvGETMAGIC(xsub_tmp_sv); |
| 839 |
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 |
|
| 840 |
0 |
| settings_href = (HV*)SvRV(xsub_tmp_sv); |
| 841 |
|
| } |
| 842 |
|
| else{ |
| 843 |
0 |
| Perl_croak_nocontext("%s: %s is not a HASH reference", |
| 844 |
|
| "Linux::DVB::DVBT::TS::dvb_ts_split", |
| 845 |
|
| "settings_href"); |
| 846 |
|
| } |
| 847 |
|
| } STMT_END |
| 848 |
|
| ; |
| 849 |
|
| } |
| 850 |
|
| #line 88 "./xs/DVBT-ts-skip.c" |
| 851 |
|
| struct TS_settings settings; |
| 852 |
|
| SV **val; |
| 853 |
|
| struct list_head cut_list; |
| 854 |
|
| unsigned num_entries ; |
| 855 |
|
| unsigned i ; |
| 856 |
|
| SV **item ; |
| 857 |
|
| HV *href ; |
| 858 |
|
| unsigned start ; |
| 859 |
|
| unsigned end ; |
| 860 |
|
| |
| 861 |
|
| #line 862 "TS.c" |
| 862 |
|
| #line 99 "./xs/DVBT-ts-skip.c" |
| 863 |
|
| dvb_error_clear() ; |
| 864 |
|
| clear_settings(&settings) ; |
| 865 |
|
| |
| 866 |
|
| if (settings_href) |
| 867 |
|
| { |
| 868 |
|
| HVF_IV(settings_href, debug, settings.debug) ; |
| 869 |
|
| HVF_IV(settings_href, save_cut, settings.save_cut) ; |
| 870 |
|
| HVF_SVV(settings_href, error_callback, settings.error_callback) ; |
| 871 |
|
| HVF_SVV(settings_href, user_data, settings.perl_data) ; |
| 872 |
|
| } |
| 873 |
|
| |
| 874 |
|
| // fprintf(stderr, "cuts_aref ok = %d\n", SvROK(cuts_aref)) ; |
| 875 |
|
| // fprintf(stderr, "cuts_aref type %d want %d\n", SvTYPE(SvRV(cuts_aref)), SVt_PVAV); |
| 876 |
|
| |
| 877 |
|
| |
| 878 |
|
| if ((!SvROK(cuts_aref)) |
| 879 |
|
| || (SvTYPE(SvRV(cuts_aref)) != SVt_PVAV)) |
| 880 |
|
| { |
| 881 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_split requires a valid cuts array ref") ; |
| 882 |
|
| } |
| 883 |
|
| |
| 884 |
|
| // av_len returns -1 for empty. Returns maximum index number otherwise |
| 885 |
|
| num_entries = av_len( (AV *)SvRV(cuts_aref) ) + 1 ; |
| 886 |
|
| if (num_entries <= 0) |
| 887 |
|
| { |
| 888 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_split requires a list of cuts hashes") ; |
| 889 |
|
| } |
| 890 |
|
| |
| 891 |
|
| |
| 892 |
|
| // Create cut list |
| 893 |
|
| INIT_LIST_HEAD(&cut_list); |
| 894 |
|
| |
| 895 |
|
| for (i=0; i <= num_entries ; i++) |
| 896 |
|
| { |
| 897 |
|
| if ((item = av_fetch((AV *)SvRV(cuts_aref), i, 0)) && SvOK (*item)) |
| 898 |
|
| { |
| 899 |
|
| if ( SvTYPE(SvRV(*item)) != SVt_PVHV ) |
| 900 |
|
| { |
| 901 |
|
| croak("Linux::DVB::DVBT::TS::dvb_ts_split requires a list of cut hashes") ; |
| 902 |
|
| } |
| 903 |
|
| href = (HV *)SvRV(*item) ; |
| 904 |
|
| |
| 905 |
|
| // get start..end cut packet numbers |
| 906 |
|
| val = HVF(href, start_pkt) ; |
| 907 |
|
| start = SvIV (*val) ; |
| 908 |
|
| val = HVF(href, end_pkt) ; |
| 909 |
|
| end = SvIV (*val) ; |
| 910 |
|
| |
| 911 |
|
| // add to cut list |
| 912 |
|
| add_cut(&cut_list, start, end) ; |
| 913 |
|
| } |
| 914 |
|
| } |
| 915 |
|
| |
| 916 |
|
| |
| 917 |
|
| //_print_cut_list("__INITIAL__", &cut_list) ; |
| 918 |
|
| |
| 919 |
|
| // split (frees the cut_list) |
| 920 |
|
| RETVAL = ts_split(filename, ofilename, &cut_list, settings.debug) ; |
| 921 |
|
| |
| 922 |
|
| #line 923 "TS.c" |
| 923 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 924 |
0 |
| ST(0) = TARG; |
| 925 |
|
| } |
| 926 |
0 |
| XSRETURN(1); |
| 927 |
|
| } |
| 928 |
|
| |
| 929 |
|
| |
| 930 |
|
| /* INCLUDE: Returning to 'TS.xs' from 'xs/DVBT-ts-skip.c' */ |
| 931 |
|
| |
| 932 |
|
| #ifdef __cplusplus |
| 933 |
|
| extern "C" { |
| 934 |
|
| #endif |
| 935 |
|
| XS_EXTERNAL(boot_Linux__DVB__DVBT__TS); /* prototype to pass -Wmissing-prototypes */ |
| 936 |
3 |
| XS_EXTERNAL(boot_Linux__DVB__DVBT__TS) |
| 937 |
|
| { |
| 938 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 939 |
|
| dVAR; dXSARGS; |
| 940 |
|
| #else |
| 941 |
3 |
| dVAR; dXSBOOTARGSXSAPIVERCHK; |
| 942 |
|
| #endif |
| 943 |
|
| #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ |
| 944 |
|
| char* file = __FILE__; |
| 945 |
|
| #else |
| 946 |
3 |
| const char* file = __FILE__; |
| 947 |
|
| #endif |
| 948 |
|
| |
| 949 |
|
| PERL_UNUSED_VAR(file); |
| 950 |
|
| |
| 951 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 952 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 953 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 954 |
|
| XS_VERSION_BOOTCHECK; |
| 955 |
|
| # ifdef XS_APIVERSION_BOOTCHECK |
| 956 |
|
| XS_APIVERSION_BOOTCHECK; |
| 957 |
|
| # endif |
| 958 |
|
| #endif |
| 959 |
|
| |
| 960 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_repair", XS_Linux__DVB__DVBT__TS_dvb_ts_repair, file, "$$;$"); |
| 961 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_parse", XS_Linux__DVB__DVBT__TS_dvb_ts_parse, file, "$$"); |
| 962 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_parse_begin", XS_Linux__DVB__DVBT__TS_dvb_ts_parse_begin, file, "$$"); |
| 963 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_parse_run", XS_Linux__DVB__DVBT__TS_dvb_ts_parse_run, file, "$"); |
| 964 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_parse_end", XS_Linux__DVB__DVBT__TS_dvb_ts_parse_end, file, "$"); |
| 965 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_parse_stop", XS_Linux__DVB__DVBT__TS_dvb_ts_parse_stop, file, "$"); |
| 966 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_setpos", XS_Linux__DVB__DVBT__TS_dvb_ts_setpos, file, "$$$$"); |
| 967 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_info", XS_Linux__DVB__DVBT__TS_dvb_ts_info, file, "$$"); |
| 968 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_error_str", XS_Linux__DVB__DVBT__TS_dvb_ts_error_str, file, ""); |
| 969 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_error", XS_Linux__DVB__DVBT__TS_dvb_ts_error, file, ""); |
| 970 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_cut", XS_Linux__DVB__DVBT__TS_dvb_ts_cut, file, "$$$;$"); |
| 971 |
3 |
| (void)newXSproto_portable("Linux::DVB::DVBT::TS::dvb_ts_split", XS_Linux__DVB__DVBT__TS_dvb_ts_split, file, "$$$;$"); |
| 972 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 973 |
|
| # if PERL_VERSION_GE(5, 9, 0) |
| 974 |
|
| if (PL_unitcheckav) |
| 975 |
|
| call_list(PL_scopestack_ix, PL_unitcheckav); |
| 976 |
|
| # endif |
| 977 |
|
| XSRETURN_YES; |
| 978 |
|
| #else |
| 979 |
3 |
| Perl_xs_boot_epilog(aTHX_ ax); |
| 980 |
|
| #endif |
| 981 |
3 |
| } |
| 982 |
|
| |
| 983 |
|
| #ifdef __cplusplus |
| 984 |
|
| } |
| 985 |
|
| #endif |