From 8684b02479d40da02129e8fd10404ce344bfcc76 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 6 Aug 2004 20:22:48 +0000 Subject: [PATCH] update to ffmpeg-0.4.9-pre1 This fixes problems with some XviD videos containing B-frames playing too fast. --- .../arch/MovieTexture/MovieTexture_FFMpeg.cpp | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 8fb0b70eb3..243f09169c 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -272,29 +272,17 @@ int FFMpeg_Helper::ReadPacket() avcodec::av_free_packet( &pkt ); } - int ret = avcodec::av_read_packet(m_fctx, &pkt); + int ret = avcodec::av_read_frame( m_fctx, &pkt ); /* XXX: why is avformat returning AVERROR_NOMEM on EOF? */ if( ret < 0 ) -// if( ret == -1 ) { /* EOF. */ eof = 1; pkt.size = 0; - current_packet_offset = 0; return 0; } -#if 0 - if( ret < 0 ) - { - /* XXX ? */ -// LOG->Warn("AVCodec: Error decoding %s: %i", -// GetID().filename.c_str(), ret ); - return -1; - } -#endif - if( pkt.stream_index == m_stream->index ) { current_packet_offset = 0; @@ -319,13 +307,13 @@ int FFMpeg_Helper::DecodePacket() if ( GetNextTimestamp ) { if (pkt.pts != int64_t(AV_NOPTS_VALUE)) - pts = (float)pkt.pts * m_fctx->pts_num / m_fctx->pts_den; + pts = (float)pkt.pts / AV_TIME_BASE; else pts = -1; GetNextTimestamp = false; } - /* If we have no data on the first frame, just reutrn EOF; passing an empty packet + /* If we have no data on the first frame, just return EOF; passing an empty packet * to avcodec_decode_video in this case is crashing it. However, passing an empty * packet is normal with B-frames, to flush. This may be unnecessary in newer * versions of avcodec, but I'm waiting until a new stable release to upgrade. */ @@ -337,8 +325,7 @@ int FFMpeg_Helper::DecodePacket() int len = avcodec::avcodec_decode_video( &m_stream->codec, &frame, &got_frame, - pkt.data + current_packet_offset, - pkt.size - current_packet_offset ); + pkt.data, pkt.size ); CHECKPOINT; if (len < 0)