diff options
Diffstat (limited to 'libhb/declpcm.c')
-rw-r--r-- | libhb/declpcm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libhb/declpcm.c b/libhb/declpcm.c index a75c506d9..e7d009375 100644 --- a/libhb/declpcm.c +++ b/libhb/declpcm.c @@ -20,6 +20,7 @@ struct hb_work_private_s uint32_t pos; /* buffer offset for next input data */ int64_t next_pts; /* pts for next output frame */ + int scr_sequence; /* the following is frame info for the frame we're currently accumulating */ uint64_t duration; /* frame duratin (in 90KHz ticks) */ @@ -151,7 +152,11 @@ static void lpcmInfo( hb_work_object_t *w, hb_buffer_t *in ) pv->nsamples = ( pv->duration * pv->samplerate ) / 90000; pv->size = pv->nchunks * chunk_size; - pv->next_pts = in->s.start; + if (in->s.start != AV_NOPTS_VALUE) + { + pv->next_pts = in->s.start; + } + pv->scr_sequence = in->s.scr_sequence; } static int declpcmInit( hb_work_object_t * w, hb_job_t * job ) @@ -160,6 +165,7 @@ static int declpcmInit( hb_work_object_t * w, hb_job_t * job ) w->private_data = pv; pv->job = job; + pv->next_pts = (int64_t)AV_NOPTS_VALUE; pv->resample = hb_audio_resample_init(AV_SAMPLE_FMT_FLT, w->audio->config.out.mixdown, @@ -336,10 +342,14 @@ static hb_buffer_t *Decode( hb_work_object_t *w ) if (out != NULL) { - out->s.start = pv->next_pts; - out->s.duration = pv->duration; - pv->next_pts += pv->duration; - out->s.stop = pv->next_pts; + out->s.start = pv->next_pts; + out->s.duration = pv->duration; + if (pv->next_pts != (int64_t)AV_NOPTS_VALUE) + { + pv->next_pts += pv->duration; + out->s.stop = pv->next_pts; + } + out->s.scr_sequence = pv->scr_sequence; } return out; } |