mpegts tsfile: fix PCR extraction for tsfile playback
This commit is contained in:
parent
a7c78250b6
commit
155f303215
4 changed files with 8 additions and 6 deletions
|
@ -33,6 +33,7 @@
|
|||
#define MPEGTS_TSID_NONE 0xFFFF
|
||||
#define MPEGTS_PSI_SECTION_SIZE 5000
|
||||
#define MPEGTS_FULLMUX_PID 0x2000
|
||||
#define MPEGTS_PID_NONE 0xFFFF
|
||||
|
||||
/* Types */
|
||||
typedef struct mpegts_table mpegts_table_t;
|
||||
|
|
|
@ -459,14 +459,15 @@ mpegts_input_recv_packets
|
|||
// without the potential need to buffer data (since that would
|
||||
// require per mmi buffers, where this is generally not required)
|
||||
|
||||
/* Extract PCR */
|
||||
// Note: this is only used by tsfile for timing the play out of packets
|
||||
// maybe we should move it?
|
||||
/* Extract PCR (used for tsfile playback) */
|
||||
if (pcr && pcr_pid) {
|
||||
uint8_t *tmp = tsb;
|
||||
for (i = 0; i < p; i++) {
|
||||
if (*pcr_pid == (((tmp[1] & 0x1f) << 8) | tmp[2]) || *pcr_pid == 0)
|
||||
int pid = ((tmp[1] & 0x1f) << 8) | tmp[2];
|
||||
if (*pcr_pid == MPEGTS_PID_NONE || *pcr_pid == pid) {
|
||||
ts_recv_packet1(NULL, tmp, pcr, 0);
|
||||
if (*pcr != PTS_UNSET) *pcr_pid = pid;
|
||||
}
|
||||
tmp += 188;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ tsfile_input_thread ( void *aux )
|
|||
while (1) {
|
||||
|
||||
/* Find PCR PID */
|
||||
if (!tmi->mmi_tsfile_pcr_pid) {
|
||||
if (tmi->mmi_tsfile_pcr_pid == MPEGTS_PID_NONE) {
|
||||
mpegts_service_t *s;
|
||||
pthread_mutex_lock(&tsfile_lock);
|
||||
LIST_FOREACH(s, &tmi->mmi_mux->mm_services, s_dvb_mux_link) {
|
||||
|
|
|
@ -31,7 +31,7 @@ tsfile_mux_instance_create
|
|||
mpegts_mux_instance_create(tsfile_mux_instance, NULL, mi, mm);
|
||||
#undef tsfile_mux_instance_class
|
||||
mmi->mmi_tsfile_path = strdup(path);
|
||||
mmi->mmi_tsfile_pcr_pid = 0;
|
||||
mmi->mmi_tsfile_pcr_pid = MPEGTS_PID_NONE;
|
||||
tvhtrace("tsfile", "mmi created %p path %s", mmi, mmi->mmi_tsfile_path);
|
||||
return mmi;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue