Skip to content
This repository
Browse code

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
2  project/VS2010Express/XBMC.vcxproj
@@ -743,6 +743,7 @@
743 743 <ClCompile Include="..\..\xbmc\SortFileItem.cpp" />
744 744 <ClCompile Include="..\..\xbmc\storage\AutorunMediaJob.cpp" />
745 745 <ClCompile Include="..\..\xbmc\storage\cdioSupport.cpp" />
  746 + <ClCompile Include="..\..\xbmc\storage\DetectDVDType.cpp" />
746 747 <ClCompile Include="..\..\xbmc\storage\IoSupport.cpp" />
747 748 <ClCompile Include="..\..\xbmc\storage\MediaManager.cpp" />
748 749 <ClCompile Include="..\..\xbmc\storage\windows\Win32StorageProvider.cpp" />
@@ -756,6 +757,7 @@
756 757 <ClCompile Include="..\..\xbmc\threads\platform\Implementation.cpp" />
757 758 <ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
758 759 <ClInclude Include="..\..\xbmc\filesystem\FileUPnP.h" />
  760 + <ClInclude Include="..\..\xbmc\storage\DetectDVDType.h" />
759 761 <ClInclude Include="..\..\xbmc\threads\platform\win\Implementation.cpp" />
760 762 <ClCompile Include="..\..\xbmc\threads\SystemClock.cpp" />
761 763 <ClCompile Include="..\..\xbmc\threads\Thread.cpp" />
6 project/VS2010Express/XBMC.vcxproj.filters
@@ -2565,6 +2565,9 @@
2565 2565 <ClCompile Include="..\..\xbmc\filesystem\FileUPnP.cpp">
2566 2566 <Filter>filesystem</Filter>
2567 2567 </ClCompile>
  2568 + <ClCompile Include="..\..\xbmc\storage\DetectDVDType.cpp">
  2569 + <Filter>storage</Filter>
  2570 + </ClCompile>
2568 2571 </ItemGroup>
2569 2572 <ItemGroup>
2570 2573 <ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -5151,6 +5154,9 @@
5151 5154 <Filter>filesystem</Filter>
5152 5155 </ClInclude>
5153 5156 <ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
  5157 + <ClInclude Include="..\..\xbmc\storage\DetectDVDType.h">
  5158 + <Filter>storage</Filter>
  5159 + </ClInclude>
5154 5160 </ItemGroup>
5155 5161 <ItemGroup>
5156 5162 <ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
17 xbmc/ApplicationMessenger.cpp
@@ -68,6 +68,9 @@
68 68 #include "playlists/PlayList.h"
69 69 #include "FileItem.h"
70 70
  71 +#include "utils/JobManager.h"
  72 +#include "storage/DetectDVDType.h"
  73 +
71 74 using namespace std;
72 75
73 76 CDelayedMessage::CDelayedMessage(ThreadMessage& msg, unsigned int delay)
@@ -728,18 +731,8 @@ case TMSG_POWERDOWN:
728 731 #ifdef HAS_DVD_DRIVE
729 732 case TMSG_OPTICAL_MOUNT:
730 733 {
731   - CMediaSource share;
732   - share.strPath = pMsg->strParam;
733   - share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
734   - share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
735   - if(g_mediaManager.IsAudio(share.strPath))
736   - share.strStatus = "Audio-CD";
737   - else if(share.strStatus == "")
738   - share.strStatus = g_localizeStrings.Get(446);
739   - share.strName = share.strPath;
740   - share.m_ignore = true;
741   - share.m_iDriveType = CMediaSource::SOURCE_TYPE_DVD;
742   - g_mediaManager.AddAutoSource(share, pMsg->dwParam1 != 0);
  734 + CDetectDisc* discdetection = new CDetectDisc(pMsg->strParam, pMsg->dwParam1 != 0);
  735 + CJobManager::GetInstance().AddJob(discdetection, NULL);
743 736 }
744 737 break;
745 738
24 xbmc/storage/DetectDVDType.cpp
@@ -51,6 +51,7 @@
51 51 #include "Application.h"
52 52 #include "IoSupport.h"
53 53 #include "cdioSupport.h"
  54 +#include "storage/MediaManager.h"
54 55
55 56
56 57 using namespace XFILE;
@@ -529,4 +530,27 @@ const CStdString &CDetectDVDMedia::GetDVDPath()
529 530 return m_diskPath;
530 531 }
531 532
  533 +CDetectDisc::CDetectDisc(CStdString &strPath, bool bautorun)
  534 +{
  535 + m_strPath = strPath;
  536 + m_bautorun = bautorun;
  537 +}
  538 +
  539 +bool CDetectDisc::DoWork()
  540 +{
  541 + CMediaSource share;
  542 + share.strPath = m_strPath;
  543 + share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
  544 + share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
  545 + if(g_mediaManager.IsAudio(share.strPath))
  546 + share.strStatus = "Audio-CD";
  547 + else if(share.strStatus == "")
  548 + share.strStatus = g_localizeStrings.Get(446);
  549 + share.strName = share.strPath;
  550 + share.m_ignore = true;
  551 + share.m_iDriveType = CMediaSource::SOURCE_TYPE_DVD;
  552 + g_mediaManager.AddAutoSource(share, m_bautorun);
  553 + return true;
  554 +}
  555 +
532 556 #endif
12 xbmc/storage/DetectDVDType.h
@@ -37,6 +37,7 @@
37 37
38 38 #include "threads/Thread.h"
39 39 #include "utils/StdString.h"
  40 +#include "utils/Job.h"
40 41
41 42 namespace MEDIA_DETECT
42 43 {
@@ -93,4 +94,15 @@ class CDetectDVDMedia : public CThread
93 94 };
94 95 }
95 96
  97 +class CDetectDisc : public CJob
  98 +{
  99 +public:
  100 + CDetectDisc(CStdString &strPath, bool bautorun);
  101 + bool DoWork();
  102 +
  103 +private:
  104 + CStdString m_strPath;
  105 + bool m_bautorun;
  106 +};
  107 +
96 108 #endif

0 comments on commit b14d2d4

Please sign in to comment.
Something went wrong with that request. Please try again.