aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiff_ <spiff_@svn>2010-11-25 23:17:09 +0000
committerspiff_ <spiff_@svn>2010-11-25 23:17:09 +0000
commitbbd0263915507737de0e87e8f3a881cb64c791e7 (patch)
treecd1f6e93c6d7222fdcfe2882a227d0de5ccfc51d
parentc69d738737ecc661c6a25c2f2d6c8af8b0564742 (diff)
fixed: avoid initing the ogg codec twice if it's a vorbis file
(cherry picked from commit 14a92dbee3a9934f189dacfaeab3f53076445e7e) git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@35465 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/cores/paplayer/CodecFactory.cpp5
-rw-r--r--xbmc/cores/paplayer/OGGcodec.cpp4
-rw-r--r--xbmc/cores/paplayer/OGGcodec.h1
3 files changed, 6 insertions, 4 deletions
diff --git a/xbmc/cores/paplayer/CodecFactory.cpp b/xbmc/cores/paplayer/CodecFactory.cpp
index d1d878b8c0..ee117ffc5b 100644
--- a/xbmc/cores/paplayer/CodecFactory.cpp
+++ b/xbmc/cores/paplayer/CodecFactory.cpp
@@ -250,10 +250,7 @@ ICodec* CodecFactory::CreateOGGCodec(const CStdString& strFile,
try
{
if (codec->Init(strFile, filecache))
- {
- delete codec; // class can't be inited twice - deinit doesn't properly deinit some members.
- return new OGGCodec;
- }
+ return codec;
}
catch( ... )
{
diff --git a/xbmc/cores/paplayer/OGGcodec.cpp b/xbmc/cores/paplayer/OGGcodec.cpp
index 0d5c1aa2fc..69f0058581 100644
--- a/xbmc/cores/paplayer/OGGcodec.cpp
+++ b/xbmc/cores/paplayer/OGGcodec.cpp
@@ -38,6 +38,7 @@ OGGCodec::OGGCodec() : m_callback(m_file)
m_CurrentStream=0;
m_TotalTime = 0;
m_VorbisFile.datasource = NULL;
+ m_inited = false;
}
OGGCodec::~OGGCodec()
@@ -47,6 +48,8 @@ OGGCodec::~OGGCodec()
bool OGGCodec::Init(const CStdString &strFile1, unsigned int filecache)
{
+ if (m_inited)
+ return true;
CStdString strFile=strFile1;
if (!m_dll.Load())
return false;
@@ -157,6 +160,7 @@ void OGGCodec::DeInit()
if (m_VorbisFile.datasource)
m_dll.ov_clear(&m_VorbisFile);
m_VorbisFile.datasource = NULL;
+ m_inited = false;
}
__int64 OGGCodec::Seek(__int64 iSeekTime)
diff --git a/xbmc/cores/paplayer/OGGcodec.h b/xbmc/cores/paplayer/OGGcodec.h
index c727adc53b..f967c7b82a 100644
--- a/xbmc/cores/paplayer/OGGcodec.h
+++ b/xbmc/cores/paplayer/OGGcodec.h
@@ -45,4 +45,5 @@ private:
OggVorbis_File m_VorbisFile;
double m_TimeOffset;
int m_CurrentStream;
+ bool m_inited;
};