tsfile: sorted PCR processing for tsfile
This commit is contained in:
parent
8e2ed3f466
commit
73d671af3f
4 changed files with 23 additions and 12 deletions
|
@ -96,19 +96,12 @@ mpegts_input_recv_packets
|
|||
/* Other */
|
||||
} else {
|
||||
service_t *s;
|
||||
int64_t tpcr = PTS_UNSET;
|
||||
int64_t *ppcr = (pcr_pid && *pcr_pid == pid) ? pcr : NULL;
|
||||
LIST_FOREACH(s, &mi->mi_transports, s_active_link) {
|
||||
ts_recv_packet1((mpegts_service_t*)s, tsb+i, NULL);
|
||||
}
|
||||
if (tpcr != PTS_UNSET) {
|
||||
// printf("pcr = %p, %"PRId64" pcr_pid == %p, %d, pid = %d\n", pcr, tpcr, pcr_pid, *pcr_pid, pid);
|
||||
if (pcr && pcr_pid){// && (*pcr_pid == 0 || *pcr_pid == pid)) {
|
||||
printf("SET\n");
|
||||
*pcr_pid = pid;
|
||||
*pcr = tpcr;
|
||||
printf("pcr set to %"PRId64"\n", tpcr);
|
||||
}
|
||||
ts_recv_packet1((mpegts_service_t*)s, tsb+i, ppcr);
|
||||
}
|
||||
if (ppcr && *ppcr == PTS_UNSET)
|
||||
ts_recv_packet1(NULL, tsb+i, ppcr);
|
||||
}
|
||||
|
||||
i += 188;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
/*
|
||||
* Globals
|
||||
*/
|
||||
pthread_mutex_t tsfile_lock;
|
||||
mpegts_network_t tsfile_network;
|
||||
mpegts_input_list_t tsfile_inputs;
|
||||
|
||||
|
@ -39,7 +40,9 @@ tsfile_network_create_service
|
|||
( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid )
|
||||
{
|
||||
static int t = 0;
|
||||
pthread_mutex_lock(&tsfile_lock);
|
||||
mpegts_service_t *s = mpegts_service_create1(NULL, mm, sid, pmt_pid);
|
||||
pthread_mutex_unlock(&tsfile_lock);
|
||||
|
||||
// TODO: HACK: REMOVE ME
|
||||
if (s) {
|
||||
|
@ -59,6 +62,9 @@ void tsfile_init ( int tuners )
|
|||
int i;
|
||||
mpegts_input_t *mi;
|
||||
|
||||
/* Mutex - used for minor efficiency in service processing */
|
||||
pthread_mutex_init(&tsfile_lock, NULL);
|
||||
|
||||
/* Shared network */
|
||||
mpegts_network_create0(&tsfile_network, &mpegts_network_class, NULL,
|
||||
"TSfile Network");
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
extern const idclass_t mpegts_input_class;
|
||||
|
||||
|
||||
static void *
|
||||
tsfile_input_thread ( void *aux )
|
||||
{
|
||||
|
@ -84,6 +85,17 @@ tsfile_input_thread ( void *aux )
|
|||
|
||||
/* Process input */
|
||||
while (1) {
|
||||
|
||||
/* Find PCR PID */
|
||||
if (!tmi->mmi_tsfile_pcr_pid) {
|
||||
mpegts_service_t *s;
|
||||
pthread_mutex_lock(&tsfile_lock);
|
||||
LIST_FOREACH(s, &tmi->mmi_mux->mm_services, s_dvb_mux_link) {
|
||||
if (s->s_pcr_pid)
|
||||
tmi->mmi_tsfile_pcr_pid = s->s_pcr_pid;
|
||||
}
|
||||
pthread_mutex_unlock(&tsfile_lock);
|
||||
}
|
||||
|
||||
/* Check for terminate */
|
||||
nfds = epoll_wait(efd, &ev, 1, 0);
|
||||
|
@ -113,7 +125,6 @@ tsfile_input_thread ( void *aux )
|
|||
if (c >= 0) {
|
||||
pcr = PTS_UNSET;
|
||||
pos = mpegts_input_recv_packets(mi, mmi, tsb, c, &pcr, &tmi->mmi_tsfile_pcr_pid);
|
||||
printf("pcr = %lu, pcr_pid = %d\n", pcr, tmi->mmi_tsfile_pcr_pid);
|
||||
|
||||
/* Delay */
|
||||
if (pcr != PTS_UNSET) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
extern mpegts_network_t tsfile_network;
|
||||
extern mpegts_input_list_t tsfile_inputs;
|
||||
extern pthread_mutex_t tsfile_lock;
|
||||
|
||||
/*
|
||||
* Typedefs
|
||||
|
|
Loading…
Add table
Reference in a new issue