标签:
2015-12-23
21:28:05 modify the duration
Q:mpc-hc cannot get the duration of video
S: To fix the condition part follow this
if(m_avFormat->duration == (int64_t)AV_NOPTS_VALUE || m_avFormat->duration < 0LL)
REFERENCE_TIME CLAVFDemuxer::GetDuration() const
{
int64_t iLength = 0;
if (m_avFormat->duration == (int64_t)AV_NOPTS_VALUE || m_avFormat->duration < 0LL) {
// no duration is available for us
// try to calculate it
// TODO
/*if (m_rtCurrent != Packet::INVALID_TIME && m_avFormat->file_size > 0 && m_avFormat->pb && m_avFormat->pb->pos > 0) {
iLength = (((m_rtCurrent * m_avFormat->file_size) / m_avFormat->pb->pos) / 1000) & 0xFFFFFFFF;
}*/
DbgLog((LOG_ERROR, 1, TEXT("duration is not available")));
return -1;
} else {
iLength = m_avFormat->duration;
}
return ConvertTimestampToRT(iLength, 1, AV_TIME_BASE, 0);
}
标签:
原文地址:http://www.cnblogs.com/anyboo/p/5071477.html