[vlc-devel] [PATCH 2/3] libav/ffmpeg: don't hack anymore as libav/ffmpeg doesn't assume pts to start from 0
Ilkka Ollakka
ileoo at videolan.org
Sat Oct 6 16:57:01 CEST 2012
On Sat, Oct 06, 2012 at 03:27:00PM +0300, Rémi Denis-Courmont wrote:
> You need to first bump the version requirement in configure if you remove the
> old support code.
I'm still in process of trying to find what libav/ffmpeg version
actually assumed pts to start from 0.
> Le samedi 6 octobre 2012 14:15:07, Ilkka Ollakka a écrit :
> > ---
> > modules/codec/avcodec/encoder.c | 4 ++--
> > modules/demux/avformat/mux.c | 8 ++++----
> > 2 files changed, 6 insertions(+), 6 deletions(-)
> > diff --git a/modules/codec/avcodec/encoder.c
> > b/modules/codec/avcodec/encoder.c index 09a456e..f7e9f4b 100644
> > --- a/modules/codec/avcodec/encoder.c
> > +++ b/modules/codec/avcodec/encoder.c
> > @@ -992,7 +992,7 @@ 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_block->i_pts =
> > p_sys->p_context->coded_frame->pts;
> > - /* Ugly work-around for stupid libavcodec behaviour */
> > + /* Ugly work-around for stupid libavcodec behaviour * /
> > {
> > int64_t i_framenum = p_block->i_pts *
> > p_enc->fmt_in.video.i_frame_rate /
> > @@ -1000,7 +1000,7 @@ static block_t *EncodeVideo( encoder_t *p_enc,
> > picture_t *p_pict )
> > p_block->i_pts = p_sys->pi_delay_pts[i_framenum %
> > MAX_FRAME_DELAY]; }
> > - /* End work-around */
> > + / * End work-around */
> > 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 ) diff
> > --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c index
> > 9ce5af0..31e8739 100644
> > --- a/modules/demux/avformat/mux.c
> > +++ b/modules/demux/avformat/mux.c
> > @@ -340,9 +340,10 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t
> > *p_input )
> > if( p_data->i_flags & BLOCK_FLAG_TYPE_I ) pkt.flags |=
> > AV_PKT_FLAG_KEY;
> > - /* avformat expects pts/dts which start from 0 */
> > + /* avformat expects pts/dts which start from 0
> > p_data->i_dts -= p_mux->p_sys->i_initial_dts;
> > p_data->i_pts -= p_mux->p_sys->i_initial_dts;
> > + */
> > if( p_data->i_pts > 0 )
> > pkt.pts = p_data->i_pts * p_stream->time_base.den /
> > @@ -350,10 +351,9 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t
> > *p_input ) if( p_data->i_dts > 0 )
> > pkt.dts = p_data->i_dts * p_stream->time_base.den /
> > INT64_C(1000000) / p_stream->time_base.num;
> > -
> > /* this is another hack to prevent libavformat from triggering the
> > "non monotone timestamps" check in avformat/utils.c */ -
> > p_stream->cur_dts = ( p_data->i_dts * p_stream->time_base.den / -
> > INT64_C(1000000) / p_stream->time_base.num ) - 1;
> > + //p_stream->cur_dts = ( p_data->i_dts * p_stream->time_base.den /
> > + // INT64_C(1000000) / p_stream->time_base.num ) - 1;
> > if( av_write_frame( p_sys->oc, &pkt ) < 0 )
> > {
--
Ilkka Ollakka
One big pile is better than two little piles.
-- Arlo Guthrie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20121006/302d5e65/attachment.sig>
More information about the vlc-devel
mailing list