commit 29121de3069a6684df11257ada9eccbe623157f0 Author: elupus Date: Mon Dec 12 22:20:31 2011 +0100 Remove old code depending on deprecated file_size This may need some testing for growing files diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index cdc6e8f..1205e05 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -765,19 +765,12 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() { stream->duration = duration; duration = m_dllAvUtil.av_rescale_rnd(stream->duration, (int64_t)stream->time_base.num * AV_TIME_BASE, stream->time_base.den, AV_ROUND_NEAR_INF); - if ((m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE && m_pFormatContext->file_size > 0) + if ((m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE) || (m_pFormatContext->duration != (int64_t)AV_NOPTS_VALUE && duration > m_pFormatContext->duration)) m_pFormatContext->duration = duration; } } - // check if stream seem to have grown since start - if(m_pFormatContext->file_size > 0 && m_pFormatContext->pb) - { - if(m_pFormatContext->pb->pos > m_pFormatContext->file_size) - m_pFormatContext->file_size = m_pFormatContext->pb->pos; - } - pPacket->iStreamId = pkt.stream_index; // XXX just for now } m_dllAvCodec.av_free_packet(&pkt); @@ -915,19 +908,6 @@ int CDVDDemuxFFmpeg::GetStreamLength() if (!m_pFormatContext) return 0; - /* apperently ffmpeg messes up sometimes, so check for negative value too */ - if (m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE || m_pFormatContext->duration < 0LL) - { - // no duration is available for us - // try to calculate it - int iLength = 0; - if (m_iCurrentPts != DVD_NOPTS_VALUE && m_pFormatContext->file_size > 0 && m_pFormatContext->pb && m_pFormatContext->pb->pos > 0) - { - iLength = (int)(((m_iCurrentPts * m_pFormatContext->file_size) / m_pFormatContext->pb->pos) / 1000) & 0xFFFFFFFF; - } - return iLength; - } - return (int)(m_pFormatContext->duration / (AV_TIME_BASE / 1000)); }