w->private_data = pv;
pv->job = job;
- pv->pts = -1;
+ pv->pts = 0;
// Warn if the input color palette is empty
int paletteEmpty = 1;
pv->buf->id = in->id;
pv->buf->sequence = in->sequence;
pv->size_got = in->size;
- pv->pts = in->start;
+ if( in->start >= 0 )
+ {
+ pv->pts = in->start;
+ }
}
}
else
pv->size_sub = 0;
pv->size_got = 0;
pv->size_rle = 0;
- pv->pts = -1;
+
+ // If we don't get a valid next timestamp, use the stop time
+ // of the current sub as the start of the next.
+ // This can happen if reader invalidates timestamps while
+ // waiting for an audio to update the SCR.
+ pv->pts = pv->pts_stop;
}
return HB_WORK_OK;
int command;
int date, next;
- pv->pts_start = 0;
+ pv->pts_start = -1;
pv->pts_stop = -1;
pv->pts_forced = 0;
}
i = next;
}
+ // Generate timestamps if they are not set
+ if( pv->pts_start == -1 )
+ {
+ // Set pts to end of last sub if the start time is unknown.
+ pv->pts_start = pv->pts;
+ }
+ if( pv->pts_stop == -1 )
+ {
+ // Set durtion to 10 sec if unknown.
+ pv->pts_stop = pv->pts + 90000L * 10;
+ }
}
/***********************************************************************