[vlc-devel] commit: Fixed timestamp in ffmpeg reget_buffer callback. (Laurent Aimar )
git version control
git at videolan.org
Tue Sep 2 01:07:16 CEST 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 2 01:09:29 2008 +0200| [0ef30fab8dc334392f4425fc63033a1e9b324cf8] | committer: Laurent Aimar
Fixed timestamp in ffmpeg reget_buffer callback.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ef30fab8dc334392f4425fc63033a1e9b324cf8
---
modules/codec/avcodec/video.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 21b8baa..8b1076f 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -902,12 +902,20 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
static int ffmpeg_ReGetFrameBuf( struct AVCodecContext *p_context, AVFrame *p_ff_pic )
{
decoder_t *p_dec = (decoder_t *)p_context->opaque;
+ int i_ret;
- /* Set picture PTS */
- ffmpeg_SetFrameBufferPts( p_dec, p_ff_pic );
+ /* */
+ p_ff_pic->pts = AV_NOPTS_VALUE;
/* We always use default reget function, it works perfectly fine */
- return avcodec_default_reget_buffer( p_context, p_ff_pic );
+ i_ret = avcodec_default_reget_buffer( p_context, p_ff_pic );
+
+ /* Set picture PTS if avcodec_default_reget_buffer didn't set it (through a
+ * ffmpeg_GetFrameBuf call) */
+ if( !i_ret && p_ff_pic->pts == AV_NOPTS_VALUE )
+ ffmpeg_SetFrameBufferPts( p_dec, p_ff_pic );
+
+ return i_ret;
}
static void ffmpeg_SetFrameBufferPts( decoder_t *p_dec, AVFrame *p_ff_pic )
@@ -928,9 +936,15 @@ static void ffmpeg_SetFrameBufferPts( decoder_t *p_dec, AVFrame *p_ff_pic )
{
p_ff_pic->pts = p_sys->input_dts;
}
- else p_ff_pic->pts = 0;
+ else
+ {
+ p_ff_pic->pts = 0;
+ }
+ }
+ else
+ {
+ p_ff_pic->pts = 0;
}
- else p_ff_pic->pts = 0;
if( p_sys->i_pts ) /* make sure 1st frame has a pts > 0 */
{
More information about the vlc-devel
mailing list