// While loop from within dvb_adapter_input_dvr function from dvb_adapter.c while(1) { /* Wait for input */ nfds = epoll_wait(efd, &ev, 1, -1); if (nfds < 1) continue; if (ev.data.fd != fd) break; printf("\nSteveo: dvb_adapter_input_dvr got input, r = 0x%x, i = 0x%x", r, i); fflush(NULL); c = read(fd, tsb+r, sizeof(tsb)-r); if (c < 0) { if (errno == EAGAIN || errno == EINTR) continue; else if (errno == EOVERFLOW) { tvhlog(LOG_WARNING, "dvb", "\"%s\" read() EOVERFLOW", tda->tda_identifier); continue; } else { // TODO: should we try to recover? tvhlog(LOG_ERR, "dvb", "\"%s\" read() error %d", tda->tda_identifier, errno); break; } } r += c; /* not enough data */ if (r < 188) continue; pthread_mutex_lock(&tda->tda_delivery_mutex); printf("\nSteveo: dvb_adapter_input_dvr lock ON, r = 0x%x, i = 0x%x", r, i); fflush(NULL); /* debug */ if(tda->tda_dump_fd != -1) { if(write(tda->tda_dump_fd, tsb, r) != r) { tvhlog(LOG_ERR, "dvb", "\"%s\" unable to write to mux dump file -- %s", tda->tda_identifier, strerror(errno)); close(tda->tda_dump_fd); tda->tda_dump_fd = -1; } } /* Process */ printf("\nSteveo: dvb_adapter_input_dvr --starting to process"); fflush(NULL); while (r >= 188) { /* sync */ if (tsb[i] == 0x47) { LIST_FOREACH(t, &tda->tda_transports, s_active_link) if(t->s_dvb_mux_instance == tda->tda_mux_current) ts_recv_packet1(t, tsb + i, NULL); i += 188; r -= 188; /* no sync */ } else { printf("\nSteveo: dvb_adapter_input_dvr --no sync"); fflush(NULL); tvhlog(LOG_DEBUG, "dvb", "\"%s\" ts sync lost", tda->tda_identifier); if (ts_resync(tsb, &r, &i)) break; tvhlog(LOG_DEBUG, "dvb", "\"%s\" ts sync found", tda->tda_identifier); } } pthread_mutex_unlock(&tda->tda_delivery_mutex); printf("\nSteveo: dvb_adapter_input_dvr lock OFF, r = 0x%x, i = 0x%x", r, i); fflush(NULL); /* reset buffer */ if (r) { printf("\nSteveo: dvb_adapter_input_dvr --memmove"); fflush(NULL); memmove(tsb, tsb+i, r); } i = 0; } printf("\nSteveo: dvb_adapter_input_dvr After while loop "); fflush(NULL); ****************************************************************************** Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: muxer_write_pkt Steveo: dvb_adapter_input_dvr --starting to process Steveo: sm_type = 0x0 Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x234, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x234 Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 ****************************************************************************** Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: sm_type = 0x0 Steveo: Exiting dvr_rec_set_state Steveo: muxer_write_pkt Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: dvb_adapter_input_dvr got input, r = 0x0, i = 0x0 Steveo: dvb_adapter_input_dvr lock ON, r = 0x758, i = 0x0 Steveo: dvb_adapter_input_dvr --starting to process Steveo: dvb_adapter_input_dvr lock OFF, r = 0x0, i = 0x758 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3 Steveo: sm_type = 0x3