| 1 |
|
| // VERSION = "1.000" |
| 2 |
|
| // |
| 3 |
|
| // Standard C code loaded outside XS space. Contains useful routines used by ts TS parsing functions |
| 4 |
|
| // |
| 5 |
|
| // The callbacks in this file are automatically installed and always called. The user settings determine whether |
| 6 |
|
| // they want to use a callback or not; if so, then their Perl subroutine is called with the appropriate parameters. |
| 7 |
|
| // |
| 8 |
|
| // |
| 9 |
|
| // |
| 10 |
|
| // |
| 11 |
|
| #include <unistd.h> |
| 12 |
|
| #include <limits.h> |
| 13 |
|
| #include "ts_parse.h" |
| 14 |
|
| |
| 15 |
|
| |
| 16 |
|
| #define DEBUG_TS |
| 17 |
|
| |
| 18 |
|
| #ifdef DEBUG_TS |
| 19 |
|
| #define debug_prt(msg) \ |
| 20 |
|
| printf("[DVBT-TS] %s\n", msg) |
| 21 |
|
| #else |
| 22 |
|
| #define debug_prt(msg) |
| 23 |
|
| #endif |
| 24 |
|
| |
| 25 |
|
| #define VALID_READER(tsr) \ |
| 26 |
|
| RETVAL = ERR_NONE ; \ |
| 27 |
|
| if (!tsr || (tsr->MAGIC != MAGIC_READER) )\ |
| 28 |
|
| { \ |
| 29 |
|
| SET_ERROR(RETVAL, ERR_INVALID_TSREADER) ;\ |
| 30 |
|
| } |
| 31 |
|
| |
| 32 |
|
| #define SET_CALLBACK(NAME) \ |
| 33 |
|
| if (settings->NAME##_callback) \ |
| 34 |
|
| tsreader->NAME##_hook = parse_##NAME##_hook |
| 35 |
|
| |
| 36 |
|
| |
| 37 |
|
| //======================================================================================================== |
| 38 |
|
| // Settings |
| 39 |
|
| //======================================================================================================== |
| 40 |
|
| |
| 41 |
|
| // common settings from Perl - amalgamation of all settings required for the following functions |
| 42 |
|
| struct TS_settings { |
| 43 |
|
| int debug; |
| 44 |
|
| unsigned num_pkts ; |
| 45 |
|
| int origin ; |
| 46 |
|
| int skip_pkts ; |
| 47 |
|
| |
| 48 |
|
| unsigned null_error_packets ; |
| 49 |
|
| unsigned save_cut ; |
| 50 |
|
| |
| 51 |
|
| SV *perl_data ; |
| 52 |
|
| |
| 53 |
|
| SV *pid_callback ; |
| 54 |
|
| SV *error_callback ; |
| 55 |
|
| SV *payload_callback ; |
| 56 |
|
| SV *ts_callback ; |
| 57 |
|
| SV *pes_callback ; |
| 58 |
|
| SV *pes_data_callback ; |
| 59 |
|
| SV *progress_callback ; |
| 60 |
|
| SV *mpeg2_callback ; |
| 61 |
|
| SV *mpeg2_rgb_callback ; |
| 62 |
|
| SV *audio_callback ; |
| 63 |
|
| |
| 64 |
|
| }; |
| 65 |
|
| |
| 66 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 67 |
0 |
| static void clear_settings(struct TS_settings *settings) |
| 68 |
|
| { |
| 69 |
0 |
| settings->debug = 0 ; |
| 70 |
0 |
| settings->num_pkts = 0 ; |
| 71 |
0 |
| settings->origin = SEEK_SET ; |
| 72 |
0 |
| settings->skip_pkts = 0 ; |
| 73 |
|
| |
| 74 |
0 |
| settings->null_error_packets = 0 ; |
| 75 |
0 |
| settings->save_cut = 0 ; |
| 76 |
|
| |
| 77 |
0 |
| settings->pid_callback = NULL ; |
| 78 |
0 |
| settings->error_callback = NULL ; |
| 79 |
0 |
| settings->payload_callback = NULL ; |
| 80 |
0 |
| settings->ts_callback = NULL ; |
| 81 |
0 |
| settings->pes_callback = NULL ; |
| 82 |
0 |
| settings->pes_data_callback = NULL ; |
| 83 |
0 |
| settings->progress_callback = NULL ; |
| 84 |
0 |
| settings->mpeg2_callback = NULL ; |
| 85 |
0 |
| settings->mpeg2_rgb_callback = NULL ; |
| 86 |
0 |
| settings->audio_callback = NULL ; |
| 87 |
|
| |
| 88 |
0 |
| settings->perl_data = NULL ; |
| 89 |
0 |
| } |
| 90 |
|
| |
| 91 |
|
| |
| 92 |
|
| //======================================================================================================== |
| 93 |
|
| // PARSE |
| 94 |
|
| //======================================================================================================== |
| 95 |
|
| |
| 96 |
|
| // data passed into hooks |
| 97 |
|
| struct TS_parse_data { |
| 98 |
|
| // general |
| 99 |
|
| struct TS_settings *settings ; |
| 100 |
|
| struct TS_reader *tsreader ; |
| 101 |
|
| |
| 102 |
|
| // only used for repair - otherwise ignored |
| 103 |
|
| unsigned null_error_packets ; |
| 104 |
|
| int ofile; |
| 105 |
|
| }; |
| 106 |
|
| |
| 107 |
|
| |
| 108 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 109 |
0 |
| static void _add_pidinfo(HV * info_href, struct TS_pidinfo *pidinfo) |
| 110 |
|
| { |
| 111 |
0 |
| HV * pidinfo_href = newHV(); |
| 112 |
|
| char string[256] ; |
| 113 |
|
| |
| 114 |
0 |
| HVS_I(pidinfo_href, pidinfo, pid) ; |
| 115 |
0 |
| HVS_INT(pidinfo_href, err_flag, pidinfo->err_flag ? 1 : 0) ; |
| 116 |
0 |
| HVS_INT(pidinfo_href, pes_start, pidinfo->pes_start ? 1 : 0) ; |
| 117 |
0 |
| HVS_I(pidinfo_href, pidinfo, afc) ; |
| 118 |
0 |
| HVS_I(pidinfo_href, pidinfo, pid_error) ; |
| 119 |
0 |
| HVS_I(pidinfo_href, pidinfo, pktnum) ; |
| 120 |
|
| |
| 121 |
0 |
| HVS(info_href, pidinfo, newRV((SV *)pidinfo_href)) ; |
| 122 |
|
| |
| 123 |
0 |
| } |
| 124 |
|
| |
| 125 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 126 |
220 |
| static HV * _store_ts(HV * href, char *key, int64_t ts) |
| 127 |
|
| { |
| 128 |
220 |
| HV * ts_href = newHV(); |
| 129 |
|
| unsigned secs, usecs ; |
| 130 |
|
| |
| 131 |
|
| // 2^33 = 8589934592 |
| 132 |
|
| char ts_str[12] ; |
| 133 |
|
| |
| 134 |
220 |
▶ | if (ts >= 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (ts >= 0) |
220 |
0 |
220 |
|
| 135 |
|
| { |
| 136 |
220 |
| secs = (unsigned)(ts / 90000) ; |
| 137 |
220 |
| usecs = (unsigned)((ts % 90000) * 1000 / 90) ; |
| 138 |
|
| |
| 139 |
220 |
| HVS_INT(ts_href, secs, (int)secs) ; |
| 140 |
220 |
| HVS_INT(ts_href, usecs, (int)usecs) ; |
| 141 |
|
| |
| 142 |
220 |
| sprintf(ts_str, "%"PRId64, ts) ; |
| 143 |
220 |
| HVS_STR(ts_href, ts, ts_str) ; |
| 144 |
|
| |
| 145 |
220 |
| hv_store(href, key, strlen(key), newRV((SV *)ts_href), 0) ; |
| 146 |
|
| } |
| 147 |
|
| |
| 148 |
220 |
| return ts_href ; |
| 149 |
|
| } |
| 150 |
|
| |
| 151 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 152 |
|
| // Similar to _store_ts but assumes ts is relative (i.e. a duration/time) and works out the hours, mins, secs |
| 153 |
0 |
| static void _store_time(HV * href, char *key, int64_t ts) |
| 154 |
|
| { |
| 155 |
|
| HV * ts_href ; |
| 156 |
|
| unsigned hh, mm, ss ; |
| 157 |
|
| |
| 158 |
0 |
▶ | if (ts >= 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (ts >= 0) |
0 |
0 |
0 |
|
| 159 |
|
| { |
| 160 |
|
| // do the usual secs, usecs |
| 161 |
0 |
| ts_href = _store_ts(href, key, ts) ; |
| 162 |
|
| |
| 163 |
|
| // now add HH:MM:SS |
| 164 |
0 |
| ss = (unsigned)(ts / 90000) ; |
| 165 |
|
| |
| 166 |
0 |
| hh = (unsigned)(ss / (60*60)) ; |
| 167 |
0 |
| ss -= hh * 60*60 ; |
| 168 |
0 |
| mm = (unsigned)(ss / (60)) ; |
| 169 |
0 |
| ss -= mm * 60 ; |
| 170 |
|
| |
| 171 |
0 |
| HVS_INT(ts_href, hh, (int)hh) ; |
| 172 |
0 |
| HVS_INT(ts_href, mm, (int)mm) ; |
| 173 |
0 |
| HVS_INT(ts_href, ss, (int)ss) ; |
| 174 |
|
| } |
| 175 |
0 |
| } |
| 176 |
|
| |
| 177 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 178 |
0 |
| static void _add_pesinfo(HV * info_href, struct TS_pesinfo *pesinfo) |
| 179 |
|
| { |
| 180 |
0 |
| HV * pesinfo_href = newHV(); |
| 181 |
|
| char *string ; |
| 182 |
|
| |
| 183 |
0 |
| _store_ts(pesinfo_href, "pts", pesinfo->pts) ; |
| 184 |
0 |
| _store_ts(pesinfo_href, "dts", pesinfo->dts) ; |
| 185 |
|
| |
| 186 |
0 |
| _store_ts(pesinfo_href, "start_pts", pesinfo->start_pts) ; |
| 187 |
0 |
| _store_ts(pesinfo_href, "start_dts", pesinfo->start_dts) ; |
| 188 |
|
| |
| 189 |
0 |
| _store_ts(pesinfo_href, "end_pts", pesinfo->end_pts) ; |
| 190 |
0 |
| _store_ts(pesinfo_href, "end_dts", pesinfo->end_dts) ; |
| 191 |
|
| |
| 192 |
0 |
| _store_ts(pesinfo_href, "rel_pts", pesinfo->pts - pesinfo->start_pts) ; |
| 193 |
0 |
| _store_ts(pesinfo_href, "rel_dts", pesinfo->dts - pesinfo->start_dts) ; |
| 194 |
|
| |
| 195 |
0 |
| HVS_I(pesinfo_href, pesinfo, pes_error) ; |
| 196 |
0 |
| HVS_I(pesinfo_href, pesinfo, psi_error) ; |
| 197 |
0 |
| HVS_I(pesinfo_href, pesinfo, ts_error) ; |
| 198 |
|
| |
| 199 |
0 |
| string = "PES" ; |
| 200 |
0 |
▶ | if (pesinfo->pes_psi == T_PSI) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pesinfo->pes_psi == T_PSI) |
0 |
0 |
0 |
|
| 201 |
|
| { |
| 202 |
0 |
| string = "PSI" ; |
| 203 |
|
| } |
| 204 |
0 |
| HVS_STR(pesinfo_href, pes_psi, string) ; |
| 205 |
|
| |
| 206 |
0 |
| HVS(info_href, pesinfo, newRV((SV *)pesinfo_href)) ; |
| 207 |
0 |
| } |
| 208 |
|
| |
| 209 |
|
| |
| 210 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 211 |
|
| // HOOKS |
| 212 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 213 |
|
| |
| 214 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 215 |
0 |
| static unsigned parse_pid_hook(unsigned pid, void *user_data) |
| 216 |
|
| { |
| 217 |
0 |
| unsigned rc = 1 ; |
| 218 |
|
| |
| 219 |
0 |
| dSP ; |
| 220 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 221 |
|
| SV * tsreader ; |
| 222 |
|
| |
| 223 |
0 |
| ENTER; |
| 224 |
0 |
| SAVETMPS; |
| 225 |
|
| |
| 226 |
0 |
▶ | if (hook_data->settings->pid_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->pid_callback) |
0 |
0 |
0 |
|
| 227 |
|
| { |
| 228 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 229 |
|
| |
| 230 |
0 |
| tsreader = sv_newmortal(); |
| 231 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 232 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 233 |
|
| |
| 234 |
0 |
▶ | XPUSHs(sv_2mortal(newSViv(pid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv(pid))); |
0 |
0 |
0 |
|
| 235 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 236 |
0 |
| PUTBACK; |
| 237 |
|
| |
| 238 |
0 |
| rc = call_sv(hook_data->settings->pid_callback, G_SCALAR); |
| 239 |
|
| |
| 240 |
0 |
| SPAGAIN; |
| 241 |
0 |
| PUTBACK; |
| 242 |
|
| } |
| 243 |
|
| |
| 244 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 245 |
0 |
| LEAVE; |
| 246 |
|
| |
| 247 |
0 |
| return rc ; |
| 248 |
|
| } |
| 249 |
|
| |
| 250 |
|
| |
| 251 |
|
| |
| 252 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 253 |
0 |
| static void parse_error_hook(enum DVB_error error_code, struct TS_pidinfo *pidinfo, void *user_data) |
| 254 |
|
| { |
| 255 |
0 |
| dSP ; |
| 256 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 257 |
0 |
| HV * info_href = (HV*)NULL; |
| 258 |
0 |
| HV * error_href = (HV*)NULL; |
| 259 |
|
| char *error_str ; |
| 260 |
|
| SV * tsreader ; |
| 261 |
|
| |
| 262 |
0 |
| ENTER; |
| 263 |
0 |
| SAVETMPS; |
| 264 |
|
| |
| 265 |
0 |
▶ | if (hook_data->settings->error_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->error_callback) |
0 |
0 |
0 |
|
| 266 |
|
| { |
| 267 |
0 |
| info_href = newHV(); |
| 268 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 269 |
|
| |
| 270 |
0 |
| error_href = newHV(); |
| 271 |
0 |
| HVS_INT(error_href, code, (int)error_code) ; |
| 272 |
0 |
| error_str = dvb_error_str(error_code) ; |
| 273 |
0 |
| HVS_STR(error_href, str, error_str) ; |
| 274 |
0 |
| HVS(info_href, error, newRV((SV *)error_href)) ; |
| 275 |
|
| |
| 276 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 277 |
|
| |
| 278 |
0 |
| tsreader = sv_newmortal(); |
| 279 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 280 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 281 |
|
| |
| 282 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 283 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 284 |
0 |
| PUTBACK; |
| 285 |
|
| |
| 286 |
0 |
| call_sv(hook_data->settings->error_callback, G_DISCARD); |
| 287 |
|
| |
| 288 |
0 |
| SPAGAIN; |
| 289 |
|
| } |
| 290 |
|
| |
| 291 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 292 |
0 |
| LEAVE; |
| 293 |
|
| |
| 294 |
0 |
| } |
| 295 |
|
| |
| 296 |
|
| |
| 297 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 298 |
0 |
| static void parse_progress_hook(enum TS_progress_state state, unsigned progress, unsigned total, void *user_data) |
| 299 |
|
| { |
| 300 |
0 |
| dSP ; |
| 301 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 302 |
|
| char *state_str ; |
| 303 |
|
| SV * tsreader ; |
| 304 |
|
| |
| 305 |
0 |
| ENTER; |
| 306 |
0 |
| SAVETMPS; |
| 307 |
|
| |
| 308 |
0 |
▶ | if (hook_data->settings->progress_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->progress_callback) |
0 |
0 |
0 |
|
| 309 |
|
| { |
| 310 |
0 |
| switch (state) |
| 311 |
|
| { |
| 312 |
0 |
| case PROGRESS_START : state_str = "START"; break ; |
| 313 |
0 |
| case PROGRESS_RUNNING : state_str = "RUNNING"; break ; |
| 314 |
0 |
| case PROGRESS_END : state_str = "END"; break ; |
| 315 |
0 |
| case PROGRESS_STOPPED : state_str = "STOPPED"; break ; |
| 316 |
0 |
| default : state_str = "UNKNOWN"; break ; |
| 317 |
|
| } |
| 318 |
|
| |
| 319 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 320 |
|
| |
| 321 |
0 |
| tsreader = sv_newmortal(); |
| 322 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 323 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 324 |
|
| |
| 325 |
0 |
▶ | XPUSHs(sv_2mortal( newSVpv( (char *)state_str, strlen(state_str) ) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newSVpv( (char *)state_str, strlen(state_str) ) )); |
0 |
0 |
0 |
|
| 326 |
0 |
▶ | XPUSHs(sv_2mortal( newSViv(progress) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newSViv(progress) )); |
0 |
0 |
0 |
|
| 327 |
0 |
▶ | XPUSHs(sv_2mortal( newSViv(total) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newSViv(total) )); |
0 |
0 |
0 |
|
| 328 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 329 |
0 |
| PUTBACK; |
| 330 |
|
| |
| 331 |
0 |
| call_sv(hook_data->settings->progress_callback, G_DISCARD); |
| 332 |
|
| |
| 333 |
0 |
| SPAGAIN; |
| 334 |
|
| } |
| 335 |
|
| |
| 336 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 337 |
0 |
| LEAVE; |
| 338 |
|
| |
| 339 |
0 |
| } |
| 340 |
|
| |
| 341 |
|
| |
| 342 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 343 |
0 |
| static void parse_ts_hook(struct TS_pidinfo *pidinfo, uint8_t *packet, unsigned packet_len, void *user_data) |
| 344 |
|
| { |
| 345 |
0 |
| dSP ; |
| 346 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 347 |
0 |
| HV * info_href = (HV*)NULL; |
| 348 |
|
| SV * tsreader ; |
| 349 |
|
| |
| 350 |
0 |
| ENTER; |
| 351 |
0 |
| SAVETMPS; |
| 352 |
|
| |
| 353 |
0 |
▶ | if (hook_data->settings->ts_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->ts_callback) |
0 |
0 |
0 |
|
| 354 |
|
| { |
| 355 |
0 |
| info_href = newHV(); |
| 356 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 357 |
|
| |
| 358 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 359 |
|
| |
| 360 |
0 |
| tsreader = sv_newmortal(); |
| 361 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 362 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 363 |
|
| |
| 364 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 365 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)packet, packet_len))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)packet, packet_len))); |
0 |
0 |
0 |
|
| 366 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 367 |
0 |
| PUTBACK; |
| 368 |
|
| |
| 369 |
0 |
| call_sv(hook_data->settings->ts_callback, G_DISCARD); |
| 370 |
|
| |
| 371 |
0 |
| SPAGAIN; |
| 372 |
|
| } |
| 373 |
|
| |
| 374 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 375 |
0 |
| LEAVE; |
| 376 |
|
| |
| 377 |
0 |
| } |
| 378 |
|
| |
| 379 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 380 |
0 |
| static void parse_payload_hook(struct TS_pidinfo *pidinfo, uint8_t *payload, unsigned payload_len, void *user_data) |
| 381 |
|
| { |
| 382 |
0 |
| dSP ; |
| 383 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 384 |
0 |
| HV * info_href = (HV*)NULL; |
| 385 |
|
| SV * tsreader ; |
| 386 |
|
| |
| 387 |
0 |
| ENTER; |
| 388 |
0 |
| SAVETMPS; |
| 389 |
|
| |
| 390 |
0 |
▶ | if (hook_data->settings->payload_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->payload_callback) |
0 |
0 |
0 |
|
| 391 |
|
| { |
| 392 |
0 |
| info_href = newHV(); |
| 393 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 394 |
|
| |
| 395 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 396 |
|
| |
| 397 |
0 |
| tsreader = sv_newmortal(); |
| 398 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 399 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 400 |
|
| |
| 401 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 402 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)payload, payload_len))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)payload, payload_len))); |
0 |
0 |
0 |
|
| 403 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 404 |
0 |
| PUTBACK; |
| 405 |
|
| |
| 406 |
0 |
| call_sv(hook_data->settings->payload_callback, G_DISCARD); |
| 407 |
|
| |
| 408 |
0 |
| SPAGAIN; |
| 409 |
|
| } |
| 410 |
|
| |
| 411 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 412 |
0 |
| LEAVE; |
| 413 |
|
| |
| 414 |
0 |
| } |
| 415 |
|
| |
| 416 |
|
| |
| 417 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 418 |
0 |
| static void parse_pes_hook(struct TS_pidinfo *pidinfo, struct TS_pesinfo *pesinfo, uint8_t *pesdata, unsigned pesdata_len, void *user_data) |
| 419 |
|
| { |
| 420 |
0 |
| dSP ; |
| 421 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 422 |
0 |
| HV * info_href = (HV*)NULL; |
| 423 |
|
| SV * tsreader ; |
| 424 |
|
| |
| 425 |
0 |
| ENTER; |
| 426 |
0 |
| SAVETMPS; |
| 427 |
|
| |
| 428 |
0 |
▶ | if (hook_data->settings->pes_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->pes_callback) |
0 |
0 |
0 |
|
| 429 |
|
| { |
| 430 |
0 |
| info_href = newHV(); |
| 431 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 432 |
0 |
| _add_pesinfo(info_href, pesinfo) ; |
| 433 |
|
| |
| 434 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 435 |
|
| |
| 436 |
0 |
| tsreader = sv_newmortal(); |
| 437 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 438 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 439 |
|
| |
| 440 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 441 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)pesdata, pesdata_len))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)pesdata, pesdata_len))); |
0 |
0 |
0 |
|
| 442 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 443 |
0 |
| PUTBACK; |
| 444 |
|
| |
| 445 |
0 |
| call_sv(hook_data->settings->pes_callback, G_DISCARD); |
| 446 |
|
| |
| 447 |
0 |
| SPAGAIN; |
| 448 |
|
| } |
| 449 |
|
| |
| 450 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 451 |
0 |
| LEAVE; |
| 452 |
|
| |
| 453 |
0 |
| } |
| 454 |
|
| |
| 455 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 456 |
0 |
| static void parse_pes_data_hook(struct TS_pidinfo *pidinfo, struct TS_pesinfo *pesinfo, uint8_t *pesdata, unsigned pesdata_len, void *user_data) |
| 457 |
|
| { |
| 458 |
0 |
| dSP ; |
| 459 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 460 |
0 |
| HV * info_href = (HV*)NULL; |
| 461 |
|
| SV * tsreader ; |
| 462 |
|
| |
| 463 |
0 |
| ENTER; |
| 464 |
0 |
| SAVETMPS; |
| 465 |
|
| |
| 466 |
0 |
▶ | if (hook_data->settings->pes_data_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->pes_data_callback) |
0 |
0 |
0 |
|
| 467 |
|
| { |
| 468 |
0 |
| info_href = newHV(); |
| 469 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 470 |
0 |
| _add_pesinfo(info_href, pesinfo) ; |
| 471 |
|
| |
| 472 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 473 |
|
| |
| 474 |
0 |
| tsreader = sv_newmortal(); |
| 475 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 476 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 477 |
|
| |
| 478 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 479 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)pesdata, pesdata_len))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)pesdata, pesdata_len))); |
0 |
0 |
0 |
|
| 480 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 481 |
0 |
| PUTBACK; |
| 482 |
|
| |
| 483 |
0 |
| call_sv(hook_data->settings->pes_data_callback, G_DISCARD); |
| 484 |
|
| |
| 485 |
0 |
| SPAGAIN; |
| 486 |
|
| } |
| 487 |
|
| |
| 488 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 489 |
0 |
| LEAVE; |
| 490 |
|
| |
| 491 |
0 |
| } |
| 492 |
|
| |
| 493 |
|
| |
| 494 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 495 |
0 |
| static void parse_mpeg2_hook(struct TS_pidinfo *pidinfo, struct TS_frame_info *frameinfo, const mpeg2_info_t *info, void *user_data) |
| 496 |
|
| { |
| 497 |
0 |
| dSP ; |
| 498 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 499 |
0 |
| HV * info_href = (HV*)NULL; |
| 500 |
|
| SV * tsreader ; |
| 501 |
|
| |
| 502 |
0 |
| ENTER; |
| 503 |
0 |
| SAVETMPS; |
| 504 |
|
| |
| 505 |
0 |
▶ | if (hook_data->settings->mpeg2_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->mpeg2_callback) |
0 |
0 |
0 |
|
| 506 |
|
| { |
| 507 |
0 |
| int datalen = info->sequence->width * info->sequence->height ; |
| 508 |
|
| |
| 509 |
0 |
| info_href = newHV(); |
| 510 |
0 |
| HVS_I(info_href, frameinfo, framenum) ; |
| 511 |
0 |
| HVS_I(info_href, frameinfo, gop_pkt) ; |
| 512 |
0 |
| _add_pidinfo(info_href, &frameinfo->pidinfo) ; |
| 513 |
0 |
| _add_pesinfo(info_href, &frameinfo->pesinfo) ; |
| 514 |
|
| |
| 515 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 516 |
|
| |
| 517 |
0 |
| tsreader = sv_newmortal(); |
| 518 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 519 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 520 |
|
| |
| 521 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 522 |
0 |
▶ | XPUSHs(sv_2mortal(newSViv( info->sequence->width ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv( info->sequence->width ))); |
0 |
0 |
0 |
|
| 523 |
0 |
▶ | XPUSHs(sv_2mortal(newSViv( info->sequence->height ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv( info->sequence->height ))); |
0 |
0 |
0 |
|
| 524 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)info->display_fbuf->buf[0], datalen))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)info->display_fbuf->buf[0], datalen))); |
0 |
0 |
0 |
|
| 525 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 526 |
0 |
| PUTBACK; |
| 527 |
|
| |
| 528 |
0 |
| call_sv(hook_data->settings->mpeg2_callback, G_DISCARD); |
| 529 |
|
| |
| 530 |
0 |
| SPAGAIN; |
| 531 |
|
| } |
| 532 |
|
| |
| 533 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 534 |
0 |
| LEAVE; |
| 535 |
0 |
| } |
| 536 |
|
| |
| 537 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 538 |
0 |
| static void parse_mpeg2_rgb_hook(struct TS_pidinfo *pidinfo, struct TS_frame_info *frameinfo, const mpeg2_info_t *info, void *user_data) |
| 539 |
|
| { |
| 540 |
0 |
| dSP ; |
| 541 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 542 |
0 |
| HV * info_href = (HV*)NULL; |
| 543 |
|
| SV * tsreader ; |
| 544 |
|
| |
| 545 |
0 |
| ENTER; |
| 546 |
0 |
| SAVETMPS; |
| 547 |
|
| |
| 548 |
0 |
▶ | if (hook_data->settings->mpeg2_rgb_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->mpeg2_rgb_callback) |
0 |
0 |
0 |
|
| 549 |
|
| { |
| 550 |
|
| // 3 bytes (rgb) per pixel |
| 551 |
0 |
| int datalen = info->sequence->width * info->sequence->height * 3 ; |
| 552 |
|
| |
| 553 |
0 |
| info_href = newHV(); |
| 554 |
0 |
| HVS_I(info_href, frameinfo, framenum) ; |
| 555 |
0 |
| HVS_I(info_href, frameinfo, gop_pkt) ; |
| 556 |
0 |
| _add_pidinfo(info_href, &frameinfo->pidinfo) ; |
| 557 |
0 |
| _add_pesinfo(info_href, &frameinfo->pesinfo) ; |
| 558 |
|
| |
| 559 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 560 |
|
| |
| 561 |
0 |
| tsreader = sv_newmortal(); |
| 562 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 563 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 564 |
|
| |
| 565 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 566 |
0 |
▶ | XPUSHs(sv_2mortal(newSViv( info->sequence->width ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv( info->sequence->width ))); |
0 |
0 |
0 |
|
| 567 |
0 |
▶ | XPUSHs(sv_2mortal(newSViv( info->sequence->height ))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv( info->sequence->height ))); |
0 |
0 |
0 |
|
| 568 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)info->display_fbuf->buf[0], datalen))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)info->display_fbuf->buf[0], datalen))); |
0 |
0 |
0 |
|
| 569 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 570 |
0 |
| PUTBACK; |
| 571 |
|
| |
| 572 |
0 |
| call_sv(hook_data->settings->mpeg2_rgb_callback, G_DISCARD); |
| 573 |
|
| |
| 574 |
0 |
| SPAGAIN; |
| 575 |
|
| } |
| 576 |
|
| |
| 577 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 578 |
0 |
| LEAVE; |
| 579 |
0 |
| } |
| 580 |
|
| |
| 581 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 582 |
0 |
| static void parse_audio_hook(struct TS_pidinfo *pidinfo, struct TS_pesinfo *pesinfo, const mpeg2_audio_t *info, void *user_data) |
| 583 |
|
| { |
| 584 |
0 |
| dSP ; |
| 585 |
0 |
| struct TS_parse_data *hook_data = (struct TS_parse_data *)user_data ; |
| 586 |
0 |
| HV * info_href = (HV*)NULL; |
| 587 |
|
| SV * tsreader ; |
| 588 |
|
| |
| 589 |
0 |
| ENTER; |
| 590 |
0 |
| SAVETMPS; |
| 591 |
|
| |
| 592 |
0 |
▶ | if (hook_data->settings->audio_callback) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hook_data->settings->audio_callback) |
0 |
0 |
0 |
|
| 593 |
|
| { |
| 594 |
0 |
| info_href = newHV(); |
| 595 |
0 |
| HVS_I(info_href, info, sample_rate) ; |
| 596 |
0 |
| HVS_I(info_href, info, channels) ; |
| 597 |
0 |
| HVS_I(info_href, info, samples_per_frame) ; |
| 598 |
0 |
| HVS_I(info_href, info, samples) ; |
| 599 |
0 |
| HVS_I(info_href, info, audio_framenum) ; |
| 600 |
0 |
| HVS_I(info_href, info, framesize) ; |
| 601 |
0 |
| _add_pidinfo(info_href, pidinfo) ; |
| 602 |
0 |
| _add_pesinfo(info_href, pesinfo) ; |
| 603 |
|
| |
| 604 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 605 |
|
| |
| 606 |
0 |
| tsreader = sv_newmortal(); |
| 607 |
0 |
| sv_setref_pv(tsreader, "TSReaderPtr", (void *)hook_data->tsreader ); |
| 608 |
0 |
▶ | XPUSHs( tsreader ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( tsreader ); |
0 |
0 |
0 |
|
| 609 |
|
| |
| 610 |
0 |
▶ | XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal( newRV((SV *)info_href) )); |
0 |
0 |
0 |
|
| 611 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv( (char *)info->audio, info->samples))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv( (char *)info->audio, info->samples))); |
0 |
0 |
0 |
|
| 612 |
0 |
▶ | XPUSHs(hook_data->settings->perl_data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hook_data->settings->perl_data); |
0 |
0 |
0 |
|
| 613 |
0 |
| PUTBACK; |
| 614 |
|
| |
| 615 |
0 |
| call_sv(hook_data->settings->audio_callback, G_DISCARD); |
| 616 |
|
| |
| 617 |
0 |
| SPAGAIN; |
| 618 |
|
| } |
| 619 |
|
| |
| 620 |
0 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
0 |
0 |
0 |
|
| 621 |
0 |
| LEAVE; |
| 622 |
0 |
| } |
| 623 |
|
| |
| 624 |
|
| |
| 625 |
|
| |
| 626 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 627 |
|
| // PARSING |
| 628 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 629 |
|
| |
| 630 |
|
| |
| 631 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 632 |
0 |
| struct TS_reader *tsparse_start(char *filename, struct TS_settings *settings) |
| 633 |
|
| { |
| 634 |
|
| int file; |
| 635 |
|
| struct TS_parse_data *hook_data ; |
| 636 |
|
| struct TS_reader *tsreader ; |
| 637 |
|
| |
| 638 |
0 |
| dvb_error_clear() ; |
| 639 |
|
| |
| 640 |
0 |
| hook_data = (struct TS_parse_data *)malloc(sizeof(struct TS_parse_data)) ; |
| 641 |
0 |
| memset(hook_data, 0, sizeof(*hook_data)) ; |
| 642 |
|
| |
| 643 |
0 |
| hook_data->settings = settings ; |
| 644 |
0 |
| hook_data->tsreader = NULL ; |
| 645 |
|
| |
| 646 |
0 |
| tsreader = tsreader_new(filename) ; |
| 647 |
0 |
▶ | if (!tsreader) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!tsreader) |
0 |
0 |
0 |
|
| 648 |
|
| { |
| 649 |
|
| //fprintf(stderr,"ERROR %s: %s\n",filename,dvb_error_str(dvb_error_code)); |
| 650 |
0 |
| return(NULL); |
| 651 |
|
| } |
| 652 |
0 |
| hook_data->tsreader = tsreader ; |
| 653 |
0 |
| tsreader_setpos(tsreader, settings->skip_pkts, settings->origin, settings->num_pkts) ; |
| 654 |
|
| |
| 655 |
0 |
| tsreader->debug = settings->debug ; |
| 656 |
|
| |
| 657 |
|
| // if (settings->pid_callback) |
| 658 |
|
| // tsreader->pid_hook = parse_pid_hook ; |
| 659 |
0 |
▶ | SET_CALLBACK(error) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(error) ; |
0 |
0 |
0 |
|
| 660 |
0 |
▶ | SET_CALLBACK(payload) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(payload) ; |
0 |
0 |
0 |
|
| 661 |
0 |
▶ | SET_CALLBACK(ts) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(ts) ; |
0 |
0 |
0 |
|
| 662 |
0 |
▶ | SET_CALLBACK(pes) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(pes) ; |
0 |
0 |
0 |
|
| 663 |
0 |
▶ | SET_CALLBACK(pes_data) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(pes_data) ; |
0 |
0 |
0 |
|
| 664 |
0 |
▶ | SET_CALLBACK(progress) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(progress) ; |
0 |
0 |
0 |
|
| 665 |
0 |
▶ | SET_CALLBACK(audio) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(audio) ; |
0 |
0 |
0 |
|
| 666 |
0 |
▶ | SET_CALLBACK(mpeg2) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(mpeg2) ; |
0 |
0 |
0 |
|
| 667 |
0 |
▶ | SET_CALLBACK(mpeg2_rgb) ; |
Branch: 1 branch
| Branch | True | False | Total |
| SET_CALLBACK(mpeg2_rgb) ; |
0 |
0 |
0 |
|
| 668 |
|
| |
| 669 |
|
| // tsreader->error_hook = parse_error_hook ; |
| 670 |
|
| // tsreader->payload_hook = parse_payload_hook ; |
| 671 |
|
| // tsreader->ts_hook = parse_ts_hook ; |
| 672 |
|
| // tsreader->pes_hook = parse_pes_hook ; |
| 673 |
|
| // tsreader->pes_data_hook = parse_pes_data_hook ; |
| 674 |
|
| // tsreader->progress_hook = parse_progress_hook ; |
| 675 |
|
| // tsreader->audio_hook = parse_audio_hook ; |
| 676 |
|
| // |
| 677 |
|
| // if (settings->mpeg2_callback) |
| 678 |
|
| // { |
| 679 |
|
| // tsreader->mpeg2_hook = parse_mpeg2_hook ; |
| 680 |
|
| // } |
| 681 |
|
| // else if (settings->mpeg2_rgb_callback) |
| 682 |
|
| // { |
| 683 |
|
| // tsreader->mpeg2_rgb_hook = parse_mpeg2_rgb_hook ; |
| 684 |
|
| // } |
| 685 |
|
| |
| 686 |
0 |
| tsreader->user_data = hook_data ; |
| 687 |
|
| |
| 688 |
0 |
| return tsreader ; |
| 689 |
|
| } |
| 690 |
|
| |
| 691 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 692 |
0 |
| int tsparse_run(TSReader *tsreader) |
| 693 |
|
| { |
| 694 |
|
| int rc ; |
| 695 |
|
| |
| 696 |
|
| // parse data |
| 697 |
0 |
| ts_parse(tsreader) ; |
| 698 |
|
| |
| 699 |
0 |
| return(dvb_error_code) ; |
| 700 |
|
| } |
| 701 |
|
| |
| 702 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 703 |
0 |
| int tsparse_end(TSReader *tsreader) |
| 704 |
|
| { |
| 705 |
0 |
▶ | if (tsreader->user_data) |
Branch: 1 branch
| Branch | True | False | Total |
| if (tsreader->user_data) |
0 |
0 |
0 |
|
| 706 |
|
| { |
| 707 |
0 |
| free(tsreader->user_data) ; |
| 708 |
|
| } |
| 709 |
|
| |
| 710 |
|
| // free |
| 711 |
0 |
| tsreader_free(tsreader) ; |
| 712 |
|
| |
| 713 |
0 |
| return(dvb_error_code) ; |
| 714 |
|
| } |
| 715 |
|
| |
| 716 |
|
| |
| 717 |
|
| |
| 718 |
|
| |
| 719 |
|
| //--------------------------------------------------------------------------------------------------------- |
| 720 |
|
| // Self-contained |
| 721 |
0 |
| int tsparse(char *filename, struct TS_settings *settings) |
| 722 |
|
| { |
| 723 |
|
| struct TS_reader *tsreader ; |
| 724 |
|
| |
| 725 |
|
| // start |
| 726 |
0 |
| tsreader = tsparse_start(filename, settings) ; |
| 727 |
0 |
▶ | if (!tsreader) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!tsreader) |
0 |
0 |
0 |
|
| 728 |
|
| { |
| 729 |
0 |
| return(dvb_error_code); |
| 730 |
|
| } |
| 731 |
|
| |
| 732 |
|
| // parse data |
| 733 |
0 |
| tsparse_run(tsreader) ; |
| 734 |
|
| |
| 735 |
0 |
▶ | if (dvb_error_code) |
Branch: 1 branch
| Branch | True | False | Total |
| if (dvb_error_code) |
0 |
0 |
0 |
|
| 736 |
|
| { |
| 737 |
0 |
| debug_prt(dvb_error_str(dvb_error_code)) ; |
| 738 |
|
| } |
| 739 |
|
| |
| 740 |
|
| // end |
| 741 |
0 |
| tsparse_end(tsreader) ; |
| 742 |
|
| |
| 743 |
0 |
▶ | if (dvb_error_code) |
Branch: 1 branch
| Branch | True | False | Total |
| if (dvb_error_code) |
0 |
0 |
0 |
|
| 744 |
|
| { |
| 745 |
0 |
| debug_prt(dvb_error_str(dvb_error_code)) ; |
| 746 |
|
| } |
| 747 |
|
| |
| 748 |
0 |
| return(dvb_error_code) ; |
| 749 |
|
| } |
| 750 |
|
| |