diff options
-rw-r--r-- | libhb/encfaac.c | 7 | ||||
-rw-r--r-- | libhb/sync.c | 12 |
2 files changed, 10 insertions, 9 deletions
diff --git a/libhb/encfaac.c b/libhb/encfaac.c index c955199d0..cc7e3b912 100644 --- a/libhb/encfaac.c +++ b/libhb/encfaac.c @@ -18,8 +18,8 @@ struct hb_work_private_s uint8_t * buf; uint8_t * obuf; hb_list_t * list; - int64_t pts; - int64_t framedur; + double pts; + double framedur; int out_discrete_channels; }; @@ -97,8 +97,9 @@ int encfaacInit( hb_work_object_t * w, hb_job_t * job ) &pv->input_samples, &pv->output_bytes ); pv->buf = malloc( pv->input_samples * sizeof( float ) ); pv->obuf = malloc( pv->output_bytes ); - pv->framedur = 90000LL * pv->input_samples / + pv->framedur = 90000.0 * pv->input_samples / ( audio->config.out.samplerate * pv->out_discrete_channels ); +printf("in %ld out %ld sr %d dur %g\n", pv->input_samples, pv->output_bytes, audio->config.out.samplerate, pv->framedur); cfg = faacEncGetCurrentConfiguration( pv->faac ); cfg->mpegVersion = MPEG4; diff --git a/libhb/sync.c b/libhb/sync.c index 57809d7e2..fac0c3432 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -36,7 +36,7 @@ typedef struct typedef struct { int index; - int64_t next_start; /* start time of next output frame */ + double next_start; /* start time of next output frame */ int64_t next_pts; /* start time of next input frame */ int64_t first_drop; /* PTS of first 'went backwards' frame dropped */ int drop_count; /* count of 'time went backwards' drops */ @@ -1193,8 +1193,8 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i ) static hb_buffer_t * OutputAudioFrame( hb_audio_t *audio, hb_buffer_t *buf, hb_sync_audio_t *sync ) { - int64_t start = sync->next_start; - int64_t duration = buf->stop - buf->start; + int64_t start = (int64_t)sync->next_start; + double duration = buf->stop - buf->start; sync->next_pts += duration; @@ -1244,13 +1244,13 @@ static hb_buffer_t * OutputAudioFrame( hb_audio_t *audio, hb_buffer_t *buf, hb_buffer_close( &buf_raw ); buf->size = sync->data.output_frames_gen * channel_count; - duration = ( sync->data.output_frames_gen * 90000 ) / + duration = (double)( sync->data.output_frames_gen * 90000 ) / audio->config.out.samplerate; } buf->frametype = HB_FRAME_AUDIO; buf->start = start; - buf->stop = start + duration; - sync->next_start = start + duration; + sync->next_start += duration; + buf->stop = (int64_t)sync->next_start; return buf; } |