Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed: do TMSG_OPTICAL_MOUNT in job to prevent XBMC from freezing d…

…uring CD/DVD detection (currently only in use by win32 as Linux/OSX? are using the DetectDVDType thread)
  • Loading branch information...
commit b14d2d4e1f1c22535c653661c789221decb63812 1 parent a9219be
@wsoltys wsoltys authored
View
2  project/VS2010Express/XBMC.vcxproj
@@ -743,6 +743,7 @@
<ClCompile Include="..\..\xbmc\SortFileItem.cpp" />
<ClCompile Include="..\..\xbmc\storage\AutorunMediaJob.cpp" />
<ClCompile Include="..\..\xbmc\storage\cdioSupport.cpp" />
+ <ClCompile Include="..\..\xbmc\storage\DetectDVDType.cpp" />
<ClCompile Include="..\..\xbmc\storage\IoSupport.cpp" />
<ClCompile Include="..\..\xbmc\storage\MediaManager.cpp" />
<ClCompile Include="..\..\xbmc\storage\windows\Win32StorageProvider.cpp" />
@@ -756,6 +757,7 @@
<ClCompile Include="..\..\xbmc\threads\platform\Implementation.cpp" />
<ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
<ClInclude Include="..\..\xbmc\filesystem\FileUPnP.h" />
+ <ClInclude Include="..\..\xbmc\storage\DetectDVDType.h" />
<ClInclude Include="..\..\xbmc\threads\platform\win\Implementation.cpp" />
<ClCompile Include="..\..\xbmc\threads\SystemClock.cpp" />
<ClCompile Include="..\..\xbmc\threads\Thread.cpp" />
View
6 project/VS2010Express/XBMC.vcxproj.filters
@@ -2565,6 +2565,9 @@
<ClCompile Include="..\..\xbmc\filesystem\FileUPnP.cpp">
<Filter>filesystem</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\storage\DetectDVDType.cpp">
+ <Filter>storage</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -5151,6 +5154,9 @@
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
+ <ClInclude Include="..\..\xbmc\storage\DetectDVDType.h">
+ <Filter>storage</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
View
17 xbmc/ApplicationMessenger.cpp
@@ -68,6 +68,9 @@
#include "playlists/PlayList.h"
#include "FileItem.h"
+#include "utils/JobManager.h"
+#include "storage/DetectDVDType.h"
+
using namespace std;
CDelayedMessage::CDelayedMessage(ThreadMessage& msg, unsigned int delay)
@@ -728,18 +731,8 @@ case TMSG_POWERDOWN:
#ifdef HAS_DVD_DRIVE
case TMSG_OPTICAL_MOUNT:
{
- CMediaSource share;
- share.strPath = pMsg->strParam;
- share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
- share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
- if(g_mediaManager.IsAudio(share.strPath))
- share.strStatus = "Audio-CD";
- else if(share.strStatus == "")
- share.strStatus = g_localizeStrings.Get(446);
- share.strName = share.strPath;
- share.m_ignore = true;
- share.m_iDriveType = CMediaSource::SOURCE_TYPE_DVD;
- g_mediaManager.AddAutoSource(share, pMsg->dwParam1 != 0);
+ CDetectDisc* discdetection = new CDetectDisc(pMsg->strParam, pMsg->dwParam1 != 0);
+ CJobManager::GetInstance().AddJob(discdetection, NULL);
}
break;
View
24 xbmc/storage/DetectDVDType.cpp
@@ -51,6 +51,7 @@
#include "Application.h"
#include "IoSupport.h"
#include "cdioSupport.h"
+#include "storage/MediaManager.h"
using namespace XFILE;
@@ -529,4 +530,27 @@ const CStdString &CDetectDVDMedia::GetDVDPath()
return m_diskPath;
}
+CDetectDisc::CDetectDisc(CStdString &strPath, bool bautorun)
+{
+ m_strPath = strPath;
+ m_bautorun = bautorun;
+}
+
+bool CDetectDisc::DoWork()
+{
+ CMediaSource share;
+ share.strPath = m_strPath;
+ share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
+ share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
+ if(g_mediaManager.IsAudio(share.strPath))
+ share.strStatus = "Audio-CD";
+ else if(share.strStatus == "")
+ share.strStatus = g_localizeStrings.Get(446);
+ share.strName = share.strPath;
+ share.m_ignore = true;
+ share.m_iDriveType = CMediaSource::SOURCE_TYPE_DVD;
+ g_mediaManager.AddAutoSource(share, m_bautorun);
+ return true;
+}
+
#endif
View
12 xbmc/storage/DetectDVDType.h
@@ -37,6 +37,7 @@
#include "threads/Thread.h"
#include "utils/StdString.h"
+#include "utils/Job.h"
namespace MEDIA_DETECT
{
@@ -93,4 +94,15 @@ class CDetectDVDMedia : public CThread
};
}
+class CDetectDisc : public CJob
+{
+public:
+ CDetectDisc(CStdString &strPath, bool bautorun);
+ bool DoWork();
+
+private:
+ CStdString m_strPath;
+ bool m_bautorun;
+};
+
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.