Permalink
Browse files

Merge pull request #4488 from FernetMenta/paplayer

paplayer: use position based seeks for ffmpeg demuxer
  • Loading branch information...
2 parents 5cd2210 + fdcb40a commit 639b639250b1d041e50f567c5e8481045bfe7c75 @jmarshallnz jmarshallnz committed Mar 31, 2014
Showing with 17 additions and 1 deletion.
  1. +14 −1 xbmc/cores/paplayer/DVDPlayerCodec.cpp
  2. +3 −0 xbmc/cores/paplayer/DVDPlayerCodec.h
@@ -24,6 +24,7 @@
#include "cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.h"
#include "cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.h"
#include "cores/dvdplayer/DVDDemuxers/DVDDemuxUtils.h"
+#include "cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h"
#include "cores/dvdplayer/DVDStreamInfo.h"
#include "cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h"
#include "music/tags/TagLoaderTagLib.h"
@@ -60,6 +61,12 @@ void DVDPlayerCodec::SetContentType(const CStdString &strContent)
bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache)
{
+ if (!m_dllAvUtil.Load())
+ {
+ CLog::Log(LOGERROR, "DVDPlayerCodec::Init - failed to load avutil");
+ return false;
+ }
+
// take precaution if Init()ialized earlier
if (m_bInited)
{
@@ -239,6 +246,8 @@ void DVDPlayerCodec::DeInit()
m_pAudioCodec = NULL;
}
+ m_dllAvUtil.Unload();
+
// cleanup format information
m_TotalTime = 0;
m_SampleRate = 0;
@@ -262,7 +271,11 @@ int64_t DVDPlayerCodec::Seek(int64_t iSeekTime)
CDVDDemuxUtils::FreeDemuxPacket(m_pPacket);
m_pPacket = NULL;
- m_pDemuxer->SeekTime((int)iSeekTime, false);
+ CDVDDemuxFFmpeg *ffmpegDemuxer = dynamic_cast<CDVDDemuxFFmpeg*>(m_pDemuxer);
+ if (ffmpegDemuxer)
+ ffmpegDemuxer->SeekByte(m_dllAvUtil.av_rescale_rnd(iSeekTime, m_pInputStream->GetLength(), m_TotalTime, AV_ROUND_NEAR_INF));
+ else
+ m_pDemuxer->SeekTime((int)iSeekTime, false);
m_pAudioCodec->Reset();
m_decoded = NULL;
@@ -26,6 +26,7 @@
#include "cores/dvdplayer/DVDDemuxers/DVDDemux.h"
#include "cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodec.h"
#include "cores/dvdplayer/DVDInputStreams/DVDInputStream.h"
+#include "DllAvUtil.h"
class DVDPlayerCodec : public ICodec
{
@@ -63,6 +64,8 @@ class DVDPlayerCodec : public ICodec
CAEChannelInfo m_ChannelInfo;
bool m_bInited;
+
+ DllAvUtil m_dllAvUtil;
};
#endif

0 comments on commit 639b639

Please sign in to comment.