Commit 90bf0f63 authored by Ilkka Ollakka's avatar Ilkka Ollakka

avcodec: remove pts workaround

parent 1cc119a0
...@@ -135,9 +135,6 @@ struct encoder_sys_t ...@@ -135,9 +135,6 @@ struct encoder_sys_t
float f_lumi_masking, f_dark_masking, f_p_masking, f_border_masking; float f_lumi_masking, f_dark_masking, f_p_masking, f_border_masking;
int i_luma_elim, i_chroma_elim; int i_luma_elim, i_chroma_elim;
int i_aac_profile; /* AAC profile to use.*/ int i_aac_profile; /* AAC profile to use.*/
/* Used to work around stupid timestamping behaviour in libavcodec */
uint64_t i_framenum;
mtime_t pi_delay_pts[MAX_FRAME_DELAY];
}; };
static const char *const ppsz_enc_options[] = { static const char *const ppsz_enc_options[] = {
...@@ -942,16 +939,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -942,16 +939,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
} }
} }
frame.quality = p_sys->i_quality; frame->quality = p_sys->i_quality;
/* Ugly work-around for stupid libavcodec behaviour */
p_sys->i_framenum++;
p_sys->pi_delay_pts[p_sys->i_framenum % MAX_FRAME_DELAY] = frame.pts;
frame.pts = p_sys->i_framenum * AV_TIME_BASE *
p_enc->fmt_in.video.i_frame_rate_base;
frame.pts += p_enc->fmt_in.video.i_frame_rate - 1;
frame.pts /= p_enc->fmt_in.video.i_frame_rate;
/* End work-around */
i_out = avcodec_encode_video( p_sys->p_context, p_block->p_buffer, i_out = avcodec_encode_video( p_sys->p_context, p_block->p_buffer,
p_block->i_buffer, &frame ); p_block->i_buffer, &frame );
...@@ -989,16 +977,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) ...@@ -989,16 +977,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
p_sys->i_buggy_pts_detect = p_sys->p_context->coded_frame->pts; p_sys->i_buggy_pts_detect = p_sys->p_context->coded_frame->pts;
p_block->i_pts = p_sys->p_context->coded_frame->pts; p_block->i_pts = p_sys->p_context->coded_frame->pts;
/* Ugly work-around for stupid libavcodec behaviour */
{
int64_t i_framenum = p_block->i_pts *
p_enc->fmt_in.video.i_frame_rate /
p_enc->fmt_in.video.i_frame_rate_base / AV_TIME_BASE;
p_block->i_pts = p_sys->pi_delay_pts[i_framenum % MAX_FRAME_DELAY];
}
/* End work-around */
if( p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_I && if( p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_I &&
p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_P ) p_sys->p_context->coded_frame->pict_type != AV_PICTURE_TYPE_P )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment