[rename] - rename all iFile and iDirectory implementations to have the protocol in...
authorMemphiz <memphis@machzwo.de>
Sun, 18 Mar 2012 16:24:54 +0000 (17:24 +0100)
committerMemphiz <memphis@machzwo.de>
Tue, 27 Mar 2012 20:11:39 +0000 (22:11 +0200)
- fix includes after file renaming
- split Slingbox to SlingboxFile and SlingboxDirectory
- split HDHomeRun to HDHomeRunFile and HDHomeRunDirectory
- fix buildsystem/projects after file renaming

175 files changed:
XBMC-ATV2.xcodeproj/project.pbxproj
XBMC-IOS.xcodeproj/project.pbxproj
XBMC.xcodeproj/project.pbxproj
project/VS2010Express/XBMC.vcxproj
project/VS2010Express/XBMC.vcxproj.filters
xbmc/Application.cpp
xbmc/Autorun.cpp
xbmc/FileItem.cpp
xbmc/SystemGlobals.cpp
xbmc/Util.cpp
xbmc/addons/Scraper.cpp
xbmc/cores/ExternalPlayer/ExternalPlayer.cpp
xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHttp.cpp
xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamTV.cpp
xbmc/filesystem/AFPDirectory.cpp
xbmc/filesystem/AFPFile.cpp [new file with mode: 0644]
xbmc/filesystem/AFPFile.h [new file with mode: 0644]
xbmc/filesystem/AddonsDirectory.cpp
xbmc/filesystem/CDDAFile.cpp [new file with mode: 0644]
xbmc/filesystem/CDDAFile.h [new file with mode: 0644]
xbmc/filesystem/CacheCircular.cpp [deleted file]
xbmc/filesystem/CacheCircular.h [deleted file]
xbmc/filesystem/CacheMemBuffer.cpp [deleted file]
xbmc/filesystem/CacheMemBuffer.h [deleted file]
xbmc/filesystem/CircularCache.cpp [new file with mode: 0644]
xbmc/filesystem/CircularCache.h [new file with mode: 0644]
xbmc/filesystem/CurlFile.cpp [new file with mode: 0644]
xbmc/filesystem/CurlFile.h [new file with mode: 0644]
xbmc/filesystem/DAAPDirectory.cpp
xbmc/filesystem/DAAPFile.cpp [new file with mode: 0644]
xbmc/filesystem/DAAPFile.h [new file with mode: 0644]
xbmc/filesystem/DAVDirectory.cpp
xbmc/filesystem/Directory.cpp
xbmc/filesystem/DirectoryCache.cpp
xbmc/filesystem/DirectoryCache.h
xbmc/filesystem/DirectoryFactory.cpp [new file with mode: 0644]
xbmc/filesystem/DirectoryFactory.h [new file with mode: 0644]
xbmc/filesystem/DirectoryTuxBox.cpp [deleted file]
xbmc/filesystem/DirectoryTuxBox.h [deleted file]
xbmc/filesystem/FTPDirectory.cpp
xbmc/filesystem/FactoryDirectory.cpp [deleted file]
xbmc/filesystem/FactoryDirectory.h [deleted file]
xbmc/filesystem/FactoryFileDirectory.cpp [deleted file]
xbmc/filesystem/FactoryFileDirectory.h [deleted file]
xbmc/filesystem/File.cpp
xbmc/filesystem/FileAFP.cpp [deleted file]
xbmc/filesystem/FileAFP.h [deleted file]
xbmc/filesystem/FileCDDA.cpp [deleted file]
xbmc/filesystem/FileCDDA.h [deleted file]
xbmc/filesystem/FileCache.cpp
xbmc/filesystem/FileCache.h
xbmc/filesystem/FileCurl.cpp [deleted file]
xbmc/filesystem/FileCurl.h [deleted file]
xbmc/filesystem/FileDAAP.cpp [deleted file]
xbmc/filesystem/FileDAAP.h [deleted file]
xbmc/filesystem/FileDirectoryFactory.cpp [new file with mode: 0644]
xbmc/filesystem/FileDirectoryFactory.h [new file with mode: 0644]
xbmc/filesystem/FileFactory.cpp
xbmc/filesystem/FileFileReader.cpp [deleted file]
xbmc/filesystem/FileFileReader.h [deleted file]
xbmc/filesystem/FileHD.cpp [deleted file]
xbmc/filesystem/FileHD.h [deleted file]
xbmc/filesystem/FileISO.cpp [deleted file]
xbmc/filesystem/FileISO.h [deleted file]
xbmc/filesystem/FileLastFM.cpp [deleted file]
xbmc/filesystem/FileLastFM.h [deleted file]
xbmc/filesystem/FileMusicDatabase.cpp [deleted file]
xbmc/filesystem/FileMusicDatabase.h [deleted file]
xbmc/filesystem/FileNFS.cpp [deleted file]
xbmc/filesystem/FileNFS.h [deleted file]
xbmc/filesystem/FilePipe.cpp [deleted file]
xbmc/filesystem/FilePipe.h [deleted file]
xbmc/filesystem/FileRTV.cpp [deleted file]
xbmc/filesystem/FileRTV.h [deleted file]
xbmc/filesystem/FileRar.cpp [deleted file]
xbmc/filesystem/FileRar.h [deleted file]
xbmc/filesystem/FileReaderFile.cpp [new file with mode: 0644]
xbmc/filesystem/FileReaderFile.h [new file with mode: 0644]
xbmc/filesystem/FileSFTP.cpp [deleted file]
xbmc/filesystem/FileSFTP.h [deleted file]
xbmc/filesystem/FileShoutcast.cpp [deleted file]
xbmc/filesystem/FileShoutcast.h [deleted file]
xbmc/filesystem/FileSmb.cpp [deleted file]
xbmc/filesystem/FileSmb.h [deleted file]
xbmc/filesystem/FileSpecialProtocol.cpp [deleted file]
xbmc/filesystem/FileSpecialProtocol.h [deleted file]
xbmc/filesystem/FileTuxBox.cpp [deleted file]
xbmc/filesystem/FileTuxBox.h [deleted file]
xbmc/filesystem/FileUDF.cpp [deleted file]
xbmc/filesystem/FileUDF.h [deleted file]
xbmc/filesystem/FileUPnP.cpp [deleted file]
xbmc/filesystem/FileUPnP.h [deleted file]
xbmc/filesystem/FileZip.cpp [deleted file]
xbmc/filesystem/FileZip.h [deleted file]
xbmc/filesystem/HDFile.cpp [new file with mode: 0644]
xbmc/filesystem/HDFile.h [new file with mode: 0644]
xbmc/filesystem/HDHomeRun.cpp [deleted file]
xbmc/filesystem/HDHomeRun.h [deleted file]
xbmc/filesystem/HDHomeRunDirectory.cpp [new file with mode: 0644]
xbmc/filesystem/HDHomeRunDirectory.h [new file with mode: 0644]
xbmc/filesystem/HDHomeRunFile.cpp [new file with mode: 0644]
xbmc/filesystem/HDHomeRunFile.h [new file with mode: 0644]
xbmc/filesystem/HTTPDirectory.cpp
xbmc/filesystem/ISOFile.cpp [new file with mode: 0644]
xbmc/filesystem/ISOFile.h [new file with mode: 0644]
xbmc/filesystem/LastFMDirectory.cpp
xbmc/filesystem/LastFMDirectory.h
xbmc/filesystem/LastFMFile.cpp [new file with mode: 0644]
xbmc/filesystem/LastFMFile.h [new file with mode: 0644]
xbmc/filesystem/Makefile.in
xbmc/filesystem/MemBufferCache.cpp [new file with mode: 0644]
xbmc/filesystem/MemBufferCache.h [new file with mode: 0644]
xbmc/filesystem/MusicDatabaseFile.cpp [new file with mode: 0644]
xbmc/filesystem/MusicDatabaseFile.h [new file with mode: 0644]
xbmc/filesystem/MythDirectory.cpp
xbmc/filesystem/MythFile.cpp
xbmc/filesystem/NFSDirectory.h
xbmc/filesystem/NFSFile.cpp [new file with mode: 0644]
xbmc/filesystem/NFSFile.h [new file with mode: 0644]
xbmc/filesystem/PipeFile.cpp [new file with mode: 0644]
xbmc/filesystem/PipeFile.h [new file with mode: 0644]
xbmc/filesystem/RSSDirectory.cpp
xbmc/filesystem/RTVFile.cpp [new file with mode: 0644]
xbmc/filesystem/RTVFile.h [new file with mode: 0644]
xbmc/filesystem/RarFile.cpp [new file with mode: 0644]
xbmc/filesystem/RarFile.h [new file with mode: 0644]
xbmc/filesystem/SFTPDirectory.h
xbmc/filesystem/SFTPFile.cpp [new file with mode: 0644]
xbmc/filesystem/SFTPFile.h [new file with mode: 0644]
xbmc/filesystem/SMBDirectory.h
xbmc/filesystem/ShoutcastFile.cpp [new file with mode: 0644]
xbmc/filesystem/ShoutcastFile.h [new file with mode: 0644]
xbmc/filesystem/Slingbox.cpp [deleted file]
xbmc/filesystem/Slingbox.h [deleted file]
xbmc/filesystem/SlingboxDirectory.cpp [new file with mode: 0644]
xbmc/filesystem/SlingboxDirectory.h [new file with mode: 0644]
xbmc/filesystem/SlingboxFile.cpp [new file with mode: 0644]
xbmc/filesystem/SlingboxFile.h [new file with mode: 0644]
xbmc/filesystem/SmbFile.cpp [new file with mode: 0644]
xbmc/filesystem/SmbFile.h [new file with mode: 0644]
xbmc/filesystem/SpecialProtocolFile.cpp [new file with mode: 0644]
xbmc/filesystem/SpecialProtocolFile.h [new file with mode: 0644]
xbmc/filesystem/TuxBoxDirectory.cpp [new file with mode: 0644]
xbmc/filesystem/TuxBoxDirectory.h [new file with mode: 0644]
xbmc/filesystem/TuxBoxFile.cpp [new file with mode: 0644]
xbmc/filesystem/TuxBoxFile.h [new file with mode: 0644]
xbmc/filesystem/UDFFile.cpp [new file with mode: 0644]
xbmc/filesystem/UDFFile.h [new file with mode: 0644]
xbmc/filesystem/UPnPFile.cpp [new file with mode: 0644]
xbmc/filesystem/UPnPFile.h [new file with mode: 0644]
xbmc/filesystem/VirtualDirectory.cpp
xbmc/filesystem/ZipFile.cpp [new file with mode: 0644]
xbmc/filesystem/ZipFile.h [new file with mode: 0644]
xbmc/interfaces/http-api/XBMChttp.cpp
xbmc/music/LastFmManager.cpp
xbmc/music/MusicDatabase.cpp
xbmc/music/MusicInfoLoader.cpp
xbmc/music/dialogs/GUIDialogSongInfo.cpp
xbmc/music/infoscanner/MusicInfoScanner.cpp
xbmc/music/infoscanner/MusicInfoScraper.h
xbmc/music/windows/GUIWindowMusicBase.cpp
xbmc/network/AirTunesServer.cpp
xbmc/network/AirTunesServer.h
xbmc/network/libscrobbler/scrobbler.cpp
xbmc/pictures/Picture.cpp
xbmc/utils/DownloadQueue.cpp
xbmc/utils/Fanart.cpp
xbmc/utils/FileOperationJob.cpp
xbmc/utils/RssReader.cpp
xbmc/utils/ScraperUrl.cpp
xbmc/utils/SystemInfo.cpp
xbmc/utils/TuxBoxUtil.cpp
xbmc/video/VideoInfoDownloader.h
xbmc/video/VideoInfoScanner.cpp
xbmc/windows/GUIMediaWindow.cpp

index d570b17..2acf839 100644 (file)
@@ -8,7 +8,6 @@
 
 /* Begin PBXBuildFile section */
                1830216013B8E35300770920 /* controledit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1830215F13B8E35300770920 /* controledit.cpp */; };
-               18404DFB1396C43B00863BBA /* Slingbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18404DF91396C43B00863BBA /* Slingbox.cpp */; };
                18404DFD1396C44F00863BBA /* SlingboxLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18404DFC1396C44F00863BBA /* SlingboxLib.a */; };
                1840B796139968DB007C848B /* JSONVariantParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B792139968DB007C848B /* JSONVariantParser.cpp */; };
                1840B797139968DB007C848B /* JSONVariantWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B794139968DB007C848B /* JSONVariantWriter.cpp */; };
                7C0A7FC913A9E75400AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FC613A9E75400AFC2BD /* DirtyRegionTracker.cpp */; };
                7C0A7FCC13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FCA13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp */; };
                7C89627013B702F3003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */; };
-               7C99B73F133D372300FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B73D133D372300FC2B16 /* CacheCircular.cpp */; };
                7C99B7AA134072CD00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */; };
                7CCFD9AA1514952700211D82 /* PCMCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCFD9A81514952700211D82 /* PCMCodec.cpp */; };
                7CEE2E6D13D6B7A8000ABF2A /* TimeSmoother.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE2E6B13D6B7A8000ABF2A /* TimeSmoother.cpp */; };
                C807119F135DB842002F601B /* InputOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C807119D135DB842002F601B /* InputOperations.cpp */; };
                C8EC5D51136954E400CCC10D /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D4F136954E400CCC10D /* XBMC_keytable.cpp */; };
-               DF0DF16C13A3AF82008ED511 /* FileNFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF16813A3AF82008ED511 /* FileNFS.cpp */; };
                DF0DF16D13A3AF82008ED511 /* NFSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF16A13A3AF82008ED511 /* NFSDirectory.cpp */; };
                DF34890913FD96390026A711 /* GUIAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF34890713FD96390026A711 /* GUIAction.cpp */; };
                DF44852F140064F40069344B /* BXAcodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44852D140064F40069344B /* BXAcodec.cpp */; };
-               DF4485341400651B0069344B /* FilePipe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4485301400651B0069344B /* FilePipe.cpp */; };
                DF4485351400651B0069344B /* PipesManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4485321400651B0069344B /* PipesManager.cpp */; };
                DF4485381400654A0069344B /* AirTunesServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4485361400654A0069344B /* AirTunesServer.cpp */; };
                DF527780151BAFD600B5B63B /* WebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF527777151BAFD600B5B63B /* WebSocket.cpp */; };
                DF527783151BAFD600B5B63B /* WebSocketV8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52777D151BAFD600B5B63B /* WebSocketV8.cpp */; };
                DF527788151BAFEE00B5B63B /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF527784151BAFEE00B5B63B /* Base64.cpp */; };
                DF527789151BAFEE00B5B63B /* HttpResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF527786151BAFEE00B5B63B /* HttpResponse.cpp */; };
-               DF673A251443769300A5A509 /* FileUPnP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF673A231443769300A5A509 /* FileUPnP.cpp */; };
+               DF93D7701444B09C007C6459 /* AFPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7381444B09C007C6459 /* AFPFile.cpp */; };
+               DF93D7731444B09C007C6459 /* CDDAFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D73E1444B09C007C6459 /* CDDAFile.cpp */; };
+               DF93D7741444B09C007C6459 /* CurlFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7401444B09C007C6459 /* CurlFile.cpp */; };
+               DF93D7751444B09C007C6459 /* DAAPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7421444B09C007C6459 /* DAAPFile.cpp */; };
+               DF93D7761444B09C007C6459 /* DirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7441444B09C007C6459 /* DirectoryFactory.cpp */; };
+               DF93D7771444B09C007C6459 /* FileDirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7461444B09C007C6459 /* FileDirectoryFactory.cpp */; };
+               DF93D7781444B09C007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7481444B09C007C6459 /* FileReaderFile.cpp */; };
+               DF93D7791444B09C007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74A1444B09C007C6459 /* HDFile.cpp */; };
+               DF93D77A1444B09C007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74C1444B09C007C6459 /* ISOFile.cpp */; };
+               DF93D77B1444B09C007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74E1444B09C007C6459 /* LastFMFile.cpp */; };
+               DF93D77C1444B09C007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7501444B09C007C6459 /* MusicDatabaseFile.cpp */; };
+               DF93D77D1444B09C007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7521444B09C007C6459 /* NFSFile.cpp */; };
+               DF93D77E1444B09C007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7541444B09C007C6459 /* PipeFile.cpp */; };
+               DF93D77F1444B09C007C6459 /* RarFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7561444B09C007C6459 /* RarFile.cpp */; };
+               DF93D7801444B09C007C6459 /* RTVFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7581444B09C007C6459 /* RTVFile.cpp */; };
+               DF93D7811444B09C007C6459 /* SFTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D75A1444B09C007C6459 /* SFTPFile.cpp */; };
+               DF93D7821444B09C007C6459 /* ShoutcastFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D75C1444B09C007C6459 /* ShoutcastFile.cpp */; };
+               DF93D7831444B09C007C6459 /* SlingboxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D75E1444B09C007C6459 /* SlingboxDirectory.cpp */; };
+               DF93D7841444B09C007C6459 /* SlingboxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7601444B09C007C6459 /* SlingboxFile.cpp */; };
+               DF93D7851444B09C007C6459 /* SmbFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7621444B09C007C6459 /* SmbFile.cpp */; };
+               DF93D7861444B09C007C6459 /* SpecialProtocolFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7641444B09C007C6459 /* SpecialProtocolFile.cpp */; };
+               DF93D7871444B09C007C6459 /* TuxBoxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7661444B09C007C6459 /* TuxBoxDirectory.cpp */; };
+               DF93D7881444B09C007C6459 /* TuxBoxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7681444B09C007C6459 /* TuxBoxFile.cpp */; };
+               DF93D7891444B09C007C6459 /* UDFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D76A1444B09C007C6459 /* UDFFile.cpp */; };
+               DF93D78A1444B09C007C6459 /* UPnPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D76C1444B09C007C6459 /* UPnPFile.cpp */; };
+               DF93D78B1444B09C007C6459 /* ZipFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D76E1444B09C007C6459 /* ZipFile.cpp */; };
+               DF93D8331444B88B007C6459 /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D82F1444B88B007C6459 /* HDHomeRunDirectory.cpp */; };
+               DF93D8341444B88B007C6459 /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D8311444B88B007C6459 /* HDHomeRunFile.cpp */; };
                DF98D9A81434F4B400A6EBE1 /* SkinVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF98D9A61434F4B400A6EBE1 /* SkinVariable.cpp */; };
                DFA6BE8713FED2A10048CC11 /* AirPlayServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFA6BE8513FED2A10048CC11 /* AirPlayServer.cpp */; };
                DFA6BE8A13FED2B40048CC11 /* HttpParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFA6BE8813FED2B40048CC11 /* HttpParser.cpp */; };
                DFCA6B0F15224684000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCA6B0615224684000BFAAE /* HTTPWebinterfaceHandler.cpp */; };
                DFCA6B1015224684000BFAAE /* IHTTPRequestHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCA6B0815224684000BFAAE /* IHTTPRequestHandler.cpp */; };
                DFCFC53D1413F7F70004D0BF /* AFPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCFC5391413F7F70004D0BF /* AFPDirectory.cpp */; };
-               DFCFC53E1413F7F70004D0BF /* FileAFP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCFC53B1413F7F70004D0BF /* FileAFP.cpp */; };
                DFD4D22013D7286E00A47C47 /* Implementation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD4D21413D7286E00A47C47 /* Implementation.cpp */; };
                DFD4D22113D7286E00A47C47 /* README.platform in Resources */ = {isa = PBXBuildFile; fileRef = DFD4D21613D7286E00A47C47 /* README.platform */; };
                DFD4D22213D7286E00A47C47 /* SystemClock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD4D21C13D7286E00A47C47 /* SystemClock.cpp */; };
+               DFDB00491516408F005079A4 /* CircularCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00411516408F005079A4 /* CircularCache.cpp */; };
+               DFDB004A1516408F005079A4 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00431516408F005079A4 /* DirectoryCache.cpp */; };
+               DFDB004B1516408F005079A4 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00451516408F005079A4 /* FileCache.cpp */; };
+               DFDB004C1516408F005079A4 /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00471516408F005079A4 /* MemBufferCache.cpp */; };
                F54D9E8E12B71457006870F9 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F54D9E8D12B71457006870F9 /* CoreAudio.framework */; };
                F56B15FB12CD6922009B4C96 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15FA12CD6922009B4C96 /* CoreVideo.framework */; };
                F56B15FD12CD6930009B4C96 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15FC12CD6930009B4C96 /* AudioToolbox.framework */; };
                F56C7971131EC154000AD0F6 /* ASAPFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C739F131EC151000AD0F6 /* ASAPFileDirectory.cpp */; };
                F56C7972131EC154000AD0F6 /* MusicFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A1131EC151000AD0F6 /* MusicFileDirectory.cpp */; };
                F56C7973131EC154000AD0F6 /* MythSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A3131EC151000AD0F6 /* MythSession.cpp */; };
-               F56C7974131EC154000AD0F6 /* FileSmb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A4131EC151000AD0F6 /* FileSmb.cpp */; };
                F56C7975131EC154000AD0F6 /* SMBDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A5131EC151000AD0F6 /* SMBDirectory.cpp */; };
                F56C7976131EC154000AD0F6 /* MythDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A6131EC151000AD0F6 /* MythDirectory.cpp */; };
                F56C7977131EC154000AD0F6 /* MythFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73A8131EC151000AD0F6 /* MythFile.cpp */; };
-               F56C7978131EC154000AD0F6 /* FileShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73AA131EC151000AD0F6 /* FileShoutcast.cpp */; };
-               F56C7979131EC154000AD0F6 /* CacheMemBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73AB131EC151000AD0F6 /* CacheMemBuffer.cpp */; };
                F56C797A131EC154000AD0F6 /* CacheStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73AD131EC151000AD0F6 /* CacheStrategy.cpp */; };
                F56C797B131EC154000AD0F6 /* CDDADirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73AF131EC151000AD0F6 /* CDDADirectory.cpp */; };
                F56C797C131EC154000AD0F6 /* DAAPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73B1131EC151000AD0F6 /* DAAPDirectory.cpp */; };
                F56C797D131EC154000AD0F6 /* DAVDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73B3131EC151000AD0F6 /* DAVDirectory.cpp */; };
                F56C797E131EC154000AD0F6 /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73B5131EC151000AD0F6 /* Directory.cpp */; };
-               F56C797F131EC154000AD0F6 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73B7131EC151000AD0F6 /* DirectoryCache.cpp */; };
                F56C7980131EC154000AD0F6 /* DirectoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73B9131EC151000AD0F6 /* DirectoryHistory.cpp */; };
-               F56C7981131EC154000AD0F6 /* DirectoryTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73BB131EC151000AD0F6 /* DirectoryTuxBox.cpp */; };
                F56C7982131EC154000AD0F6 /* DllLibCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73BD131EC151000AD0F6 /* DllLibCurl.cpp */; };
-               F56C7983131EC154000AD0F6 /* FactoryDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73BF131EC151000AD0F6 /* FactoryDirectory.cpp */; };
-               F56C7984131EC154000AD0F6 /* FactoryFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73C1131EC151000AD0F6 /* FactoryFileDirectory.cpp */; };
                F56C7985131EC154000AD0F6 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73C3131EC151000AD0F6 /* File.cpp */; };
-               F56C7986131EC154000AD0F6 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73C5131EC151000AD0F6 /* FileCache.cpp */; };
-               F56C7987131EC154000AD0F6 /* FileCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73C7131EC151000AD0F6 /* FileCDDA.cpp */; };
-               F56C7988131EC154000AD0F6 /* FileCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73C9131EC151000AD0F6 /* FileCurl.cpp */; };
-               F56C7989131EC154000AD0F6 /* FileDAAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73CB131EC151000AD0F6 /* FileDAAP.cpp */; };
                F56C798A131EC154000AD0F6 /* FileFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73CD131EC151000AD0F6 /* FileFactory.cpp */; };
-               F56C798B131EC154000AD0F6 /* FileFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73CF131EC151000AD0F6 /* FileFileReader.cpp */; };
-               F56C798C131EC154000AD0F6 /* FileHD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73D1131EC151000AD0F6 /* FileHD.cpp */; };
-               F56C798D131EC154000AD0F6 /* FileISO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73D3131EC151000AD0F6 /* FileISO.cpp */; };
-               F56C798E131EC154000AD0F6 /* FileLastFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73D5131EC151000AD0F6 /* FileLastFM.cpp */; };
-               F56C798F131EC154000AD0F6 /* FileMusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73D7131EC151000AD0F6 /* FileMusicDatabase.cpp */; };
-               F56C7990131EC154000AD0F6 /* FileRar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73D9131EC151000AD0F6 /* FileRar.cpp */; };
-               F56C7991131EC154000AD0F6 /* FileRTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73DB131EC151000AD0F6 /* FileRTV.cpp */; };
-               F56C7992131EC154000AD0F6 /* FileSFTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73DD131EC151000AD0F6 /* FileSFTP.cpp */; };
-               F56C7993131EC154000AD0F6 /* FileSpecialProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73E0131EC151000AD0F6 /* FileSpecialProtocol.cpp */; };
-               F56C7994131EC154000AD0F6 /* FileTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73E2131EC151000AD0F6 /* FileTuxBox.cpp */; };
-               F56C7995131EC154000AD0F6 /* FileUDF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73E4131EC151000AD0F6 /* FileUDF.cpp */; };
-               F56C7997131EC154000AD0F6 /* FileZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73E8131EC151000AD0F6 /* FileZip.cpp */; };
                F56C7998131EC154000AD0F6 /* FTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73EA131EC151000AD0F6 /* FTPDirectory.cpp */; };
                F56C7999131EC154000AD0F6 /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73EC131EC151000AD0F6 /* FTPParse.cpp */; };
                F56C799A131EC154000AD0F6 /* HDDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73EE131EC151000AD0F6 /* HDDirectory.cpp */; };
-               F56C799B131EC154000AD0F6 /* HDHomeRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73F0131EC151000AD0F6 /* HDHomeRun.cpp */; };
                F56C799C131EC154000AD0F6 /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73F3131EC151000AD0F6 /* HTSPDirectory.cpp */; };
                F56C799D131EC154000AD0F6 /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73F5131EC151000AD0F6 /* HTSPSession.cpp */; };
                F56C799E131EC154000AD0F6 /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73F7131EC151000AD0F6 /* HTTPDirectory.cpp */; };
 
 /* Begin PBXFileReference section */
                1830215F13B8E35300770920 /* controledit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controledit.cpp; sourceTree = "<group>"; };
-               18404DF91396C43B00863BBA /* Slingbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Slingbox.cpp; sourceTree = "<group>"; };
-               18404DFA1396C43B00863BBA /* Slingbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slingbox.h; sourceTree = "<group>"; };
                18404DFC1396C44F00863BBA /* SlingboxLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = SlingboxLib.a; path = lib/SlingboxLib/SlingboxLib.a; sourceTree = "<group>"; };
                1840B792139968DB007C848B /* JSONVariantParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONVariantParser.cpp; sourceTree = "<group>"; };
                1840B793139968DB007C848B /* JSONVariantParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONVariantParser.h; sourceTree = "<group>"; };
                7C0A7FCB13A9E76E00AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; };
                7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
                7C89626F13B702F3003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; };
-               7C99B73D133D372300FC2B16 /* CacheCircular.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheCircular.cpp; sourceTree = "<group>"; };
-               7C99B73E133D372300FC2B16 /* CacheCircular.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheCircular.h; sourceTree = "<group>"; };
                7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; };
                7C99B7A9134072CD00FC2B16 /* GUIDialogPlayEject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogPlayEject.h; sourceTree = "<group>"; };
                7CCFD9A81514952700211D82 /* PCMCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMCodec.cpp; sourceTree = "<group>"; };
                C807119E135DB842002F601B /* InputOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputOperations.h; sourceTree = "<group>"; };
                C8EC5D4F136954E400CCC10D /* XBMC_keytable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBMC_keytable.cpp; sourceTree = "<group>"; };
                C8EC5D50136954E400CCC10D /* XBMC_keytable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMC_keytable.h; sourceTree = "<group>"; };
-               DF0DF16813A3AF82008ED511 /* FileNFS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileNFS.cpp; sourceTree = "<group>"; };
-               DF0DF16913A3AF82008ED511 /* FileNFS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileNFS.h; sourceTree = "<group>"; };
                DF0DF16A13A3AF82008ED511 /* NFSDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSDirectory.cpp; sourceTree = "<group>"; };
                DF0DF16B13A3AF82008ED511 /* NFSDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSDirectory.h; sourceTree = "<group>"; };
                DF34890713FD96390026A711 /* GUIAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIAction.cpp; sourceTree = "<group>"; };
                DF34890813FD96390026A711 /* GUIAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIAction.h; sourceTree = "<group>"; };
                DF44852D140064F40069344B /* BXAcodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BXAcodec.cpp; sourceTree = "<group>"; };
                DF44852E140064F40069344B /* BXAcodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BXAcodec.h; sourceTree = "<group>"; };
-               DF4485301400651B0069344B /* FilePipe.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FilePipe.cpp; sourceTree = "<group>"; };
-               DF4485311400651B0069344B /* FilePipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePipe.h; sourceTree = "<group>"; };
                DF4485321400651B0069344B /* PipesManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipesManager.cpp; sourceTree = "<group>"; };
                DF4485331400651B0069344B /* PipesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipesManager.h; sourceTree = "<group>"; };
                DF4485361400654A0069344B /* AirTunesServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirTunesServer.cpp; sourceTree = "<group>"; };
                DF527785151BAFEE00B5B63B /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
                DF527786151BAFEE00B5B63B /* HttpResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpResponse.cpp; sourceTree = "<group>"; };
                DF527787151BAFEE00B5B63B /* HttpResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpResponse.h; sourceTree = "<group>"; };
-               DF673A231443769300A5A509 /* FileUPnP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUPnP.cpp; sourceTree = "<group>"; };
-               DF673A241443769300A5A509 /* FileUPnP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUPnP.h; sourceTree = "<group>"; };
+               DF93D7381444B09C007C6459 /* AFPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPFile.cpp; sourceTree = "<group>"; };
+               DF93D7391444B09C007C6459 /* AFPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPFile.h; sourceTree = "<group>"; };
+               DF93D73E1444B09C007C6459 /* CDDAFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDAFile.cpp; sourceTree = "<group>"; };
+               DF93D73F1444B09C007C6459 /* CDDAFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDDAFile.h; sourceTree = "<group>"; };
+               DF93D7401444B09C007C6459 /* CurlFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurlFile.cpp; sourceTree = "<group>"; };
+               DF93D7411444B09C007C6459 /* CurlFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurlFile.h; sourceTree = "<group>"; };
+               DF93D7421444B09C007C6459 /* DAAPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DAAPFile.cpp; sourceTree = "<group>"; };
+               DF93D7431444B09C007C6459 /* DAAPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAAPFile.h; sourceTree = "<group>"; };
+               DF93D7441444B09C007C6459 /* DirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D7451444B09C007C6459 /* DirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D7461444B09C007C6459 /* FileDirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D7471444B09C007C6459 /* FileDirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D7481444B09C007C6459 /* FileReaderFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileReaderFile.cpp; sourceTree = "<group>"; };
+               DF93D7491444B09C007C6459 /* FileReaderFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileReaderFile.h; sourceTree = "<group>"; };
+               DF93D74A1444B09C007C6459 /* HDFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDFile.cpp; sourceTree = "<group>"; };
+               DF93D74B1444B09C007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
+               DF93D74C1444B09C007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
+               DF93D74D1444B09C007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
+               DF93D74E1444B09C007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
+               DF93D74F1444B09C007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
+               DF93D7501444B09C007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
+               DF93D7511444B09C007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
+               DF93D7521444B09C007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
+               DF93D7531444B09C007C6459 /* NFSFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSFile.h; sourceTree = "<group>"; };
+               DF93D7541444B09C007C6459 /* PipeFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipeFile.cpp; sourceTree = "<group>"; };
+               DF93D7551444B09C007C6459 /* PipeFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipeFile.h; sourceTree = "<group>"; };
+               DF93D7561444B09C007C6459 /* RarFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RarFile.cpp; sourceTree = "<group>"; };
+               DF93D7571444B09C007C6459 /* RarFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RarFile.h; sourceTree = "<group>"; };
+               DF93D7581444B09C007C6459 /* RTVFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTVFile.cpp; sourceTree = "<group>"; };
+               DF93D7591444B09C007C6459 /* RTVFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTVFile.h; sourceTree = "<group>"; };
+               DF93D75A1444B09C007C6459 /* SFTPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFTPFile.cpp; sourceTree = "<group>"; };
+               DF93D75B1444B09C007C6459 /* SFTPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFTPFile.h; sourceTree = "<group>"; };
+               DF93D75C1444B09C007C6459 /* ShoutcastFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShoutcastFile.cpp; sourceTree = "<group>"; };
+               DF93D75D1444B09C007C6459 /* ShoutcastFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShoutcastFile.h; sourceTree = "<group>"; };
+               DF93D75E1444B09C007C6459 /* SlingboxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D75F1444B09C007C6459 /* SlingboxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxDirectory.h; sourceTree = "<group>"; };
+               DF93D7601444B09C007C6459 /* SlingboxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxFile.cpp; sourceTree = "<group>"; };
+               DF93D7611444B09C007C6459 /* SlingboxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxFile.h; sourceTree = "<group>"; };
+               DF93D7621444B09C007C6459 /* SmbFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmbFile.cpp; sourceTree = "<group>"; };
+               DF93D7631444B09C007C6459 /* SmbFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmbFile.h; sourceTree = "<group>"; };
+               DF93D7641444B09C007C6459 /* SpecialProtocolFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolFile.cpp; sourceTree = "<group>"; };
+               DF93D7651444B09C007C6459 /* SpecialProtocolFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolFile.h; sourceTree = "<group>"; };
+               DF93D7661444B09C007C6459 /* TuxBoxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D7671444B09C007C6459 /* TuxBoxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxDirectory.h; sourceTree = "<group>"; };
+               DF93D7681444B09C007C6459 /* TuxBoxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxFile.cpp; sourceTree = "<group>"; };
+               DF93D7691444B09C007C6459 /* TuxBoxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxFile.h; sourceTree = "<group>"; };
+               DF93D76A1444B09C007C6459 /* UDFFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UDFFile.cpp; sourceTree = "<group>"; };
+               DF93D76B1444B09C007C6459 /* UDFFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UDFFile.h; sourceTree = "<group>"; };
+               DF93D76C1444B09C007C6459 /* UPnPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPFile.cpp; sourceTree = "<group>"; };
+               DF93D76D1444B09C007C6459 /* UPnPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPFile.h; sourceTree = "<group>"; };
+               DF93D76E1444B09C007C6459 /* ZipFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZipFile.cpp; sourceTree = "<group>"; };
+               DF93D76F1444B09C007C6459 /* ZipFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipFile.h; sourceTree = "<group>"; };
+               DF93D82F1444B88B007C6459 /* HDHomeRunDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunDirectory.cpp; sourceTree = "<group>"; };
+               DF93D8301444B88B007C6459 /* HDHomeRunDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunDirectory.h; sourceTree = "<group>"; };
+               DF93D8311444B88B007C6459 /* HDHomeRunFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunFile.cpp; sourceTree = "<group>"; };
+               DF93D8321444B88B007C6459 /* HDHomeRunFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunFile.h; sourceTree = "<group>"; };
                DF98D9A61434F4B400A6EBE1 /* SkinVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkinVariable.cpp; sourceTree = "<group>"; };
                DF98D9A71434F4B400A6EBE1 /* SkinVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkinVariable.h; sourceTree = "<group>"; };
                DFA6BE8513FED2A10048CC11 /* AirPlayServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirPlayServer.cpp; sourceTree = "<group>"; };
                DFCA6B0915224684000BFAAE /* IHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IHTTPRequestHandler.h; sourceTree = "<group>"; };
                DFCFC5391413F7F70004D0BF /* AFPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPDirectory.cpp; sourceTree = "<group>"; };
                DFCFC53A1413F7F70004D0BF /* AFPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPDirectory.h; sourceTree = "<group>"; };
-               DFCFC53B1413F7F70004D0BF /* FileAFP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileAFP.cpp; sourceTree = "<group>"; };
-               DFCFC53C1413F7F70004D0BF /* FileAFP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileAFP.h; sourceTree = "<group>"; };
                DFD4D20D13D7286E00A47C47 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                DFD4D20E13D7286E00A47C47 /* CriticalSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CriticalSection.h; sourceTree = "<group>"; };
                DFD4D21213D7286E00A47C47 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                DFD4D21713D7286E00A47C47 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
                DFD4D21C13D7286E00A47C47 /* SystemClock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemClock.cpp; sourceTree = "<group>"; };
                DFD4D21D13D7286E00A47C47 /* SystemClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemClock.h; sourceTree = "<group>"; };
+               DFDB00411516408F005079A4 /* CircularCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CircularCache.cpp; sourceTree = "<group>"; };
+               DFDB00421516408F005079A4 /* CircularCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircularCache.h; sourceTree = "<group>"; };
+               DFDB00431516408F005079A4 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
+               DFDB00441516408F005079A4 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
+               DFDB00451516408F005079A4 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
+               DFDB00461516408F005079A4 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
+               DFDB00471516408F005079A4 /* MemBufferCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemBufferCache.cpp; sourceTree = "<group>"; };
+               DFDB00481516408F005079A4 /* MemBufferCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemBufferCache.h; sourceTree = "<group>"; };
                F54D9E8D12B71457006870F9 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
                F558F66813AFE7F300631E12 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                F558F66E13AFE81500631E12 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
                F56C73A1131EC151000AD0F6 /* MusicFileDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicFileDirectory.cpp; sourceTree = "<group>"; };
                F56C73A2131EC151000AD0F6 /* MusicFileDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicFileDirectory.h; sourceTree = "<group>"; };
                F56C73A3131EC151000AD0F6 /* MythSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythSession.cpp; sourceTree = "<group>"; };
-               F56C73A4131EC151000AD0F6 /* FileSmb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSmb.cpp; sourceTree = "<group>"; };
                F56C73A5131EC151000AD0F6 /* SMBDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SMBDirectory.cpp; sourceTree = "<group>"; };
                F56C73A6131EC151000AD0F6 /* MythDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythDirectory.cpp; sourceTree = "<group>"; };
                F56C73A7131EC151000AD0F6 /* MythDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MythDirectory.h; sourceTree = "<group>"; };
                F56C73A8131EC151000AD0F6 /* MythFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythFile.cpp; sourceTree = "<group>"; };
                F56C73A9131EC151000AD0F6 /* MythFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MythFile.h; sourceTree = "<group>"; };
-               F56C73AA131EC151000AD0F6 /* FileShoutcast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileShoutcast.cpp; sourceTree = "<group>"; };
-               F56C73AB131EC151000AD0F6 /* CacheMemBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheMemBuffer.cpp; sourceTree = "<group>"; };
-               F56C73AC131EC151000AD0F6 /* CacheMemBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheMemBuffer.h; sourceTree = "<group>"; };
                F56C73AD131EC151000AD0F6 /* CacheStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStrategy.cpp; sourceTree = "<group>"; };
                F56C73AE131EC151000AD0F6 /* CacheStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStrategy.h; sourceTree = "<group>"; };
                F56C73AF131EC151000AD0F6 /* CDDADirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDADirectory.cpp; sourceTree = "<group>"; };
                F56C73B4131EC151000AD0F6 /* DAVDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAVDirectory.h; sourceTree = "<group>"; };
                F56C73B5131EC151000AD0F6 /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Directory.cpp; sourceTree = "<group>"; };
                F56C73B6131EC151000AD0F6 /* Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Directory.h; sourceTree = "<group>"; };
-               F56C73B7131EC151000AD0F6 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
-               F56C73B8131EC151000AD0F6 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
                F56C73B9131EC151000AD0F6 /* DirectoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryHistory.cpp; sourceTree = "<group>"; };
                F56C73BA131EC151000AD0F6 /* DirectoryHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryHistory.h; sourceTree = "<group>"; };
-               F56C73BB131EC151000AD0F6 /* DirectoryTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryTuxBox.cpp; sourceTree = "<group>"; };
-               F56C73BC131EC151000AD0F6 /* DirectoryTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryTuxBox.h; sourceTree = "<group>"; };
                F56C73BD131EC151000AD0F6 /* DllLibCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DllLibCurl.cpp; sourceTree = "<group>"; };
                F56C73BE131EC151000AD0F6 /* DllLibCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DllLibCurl.h; sourceTree = "<group>"; };
-               F56C73BF131EC151000AD0F6 /* FactoryDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryDirectory.cpp; sourceTree = "<group>"; };
-               F56C73C0131EC151000AD0F6 /* FactoryDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryDirectory.h; sourceTree = "<group>"; };
-               F56C73C1131EC151000AD0F6 /* FactoryFileDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryFileDirectory.cpp; sourceTree = "<group>"; };
-               F56C73C2131EC151000AD0F6 /* FactoryFileDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryFileDirectory.h; sourceTree = "<group>"; };
                F56C73C3131EC151000AD0F6 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = "<group>"; };
                F56C73C4131EC151000AD0F6 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = "<group>"; };
-               F56C73C5131EC151000AD0F6 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
-               F56C73C6131EC151000AD0F6 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
-               F56C73C7131EC151000AD0F6 /* FileCDDA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCDDA.cpp; sourceTree = "<group>"; };
-               F56C73C8131EC151000AD0F6 /* FileCDDA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCDDA.h; sourceTree = "<group>"; };
-               F56C73C9131EC151000AD0F6 /* FileCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCurl.cpp; sourceTree = "<group>"; };
-               F56C73CA131EC151000AD0F6 /* FileCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCurl.h; sourceTree = "<group>"; };
-               F56C73CB131EC151000AD0F6 /* FileDAAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDAAP.cpp; sourceTree = "<group>"; };
-               F56C73CC131EC151000AD0F6 /* FileDAAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDAAP.h; sourceTree = "<group>"; };
                F56C73CD131EC151000AD0F6 /* FileFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFactory.cpp; sourceTree = "<group>"; };
                F56C73CE131EC151000AD0F6 /* FileFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFactory.h; sourceTree = "<group>"; };
-               F56C73CF131EC151000AD0F6 /* FileFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFileReader.cpp; sourceTree = "<group>"; };
-               F56C73D0131EC151000AD0F6 /* FileFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFileReader.h; sourceTree = "<group>"; };
-               F56C73D1131EC151000AD0F6 /* FileHD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileHD.cpp; sourceTree = "<group>"; };
-               F56C73D2131EC151000AD0F6 /* FileHD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileHD.h; sourceTree = "<group>"; };
-               F56C73D3131EC151000AD0F6 /* FileISO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileISO.cpp; sourceTree = "<group>"; };
-               F56C73D4131EC151000AD0F6 /* FileISO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileISO.h; sourceTree = "<group>"; };
-               F56C73D5131EC151000AD0F6 /* FileLastFM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileLastFM.cpp; sourceTree = "<group>"; };
-               F56C73D6131EC151000AD0F6 /* FileLastFM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileLastFM.h; sourceTree = "<group>"; };
-               F56C73D7131EC151000AD0F6 /* FileMusicDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileMusicDatabase.cpp; sourceTree = "<group>"; };
-               F56C73D8131EC151000AD0F6 /* FileMusicDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMusicDatabase.h; sourceTree = "<group>"; };
-               F56C73D9131EC151000AD0F6 /* FileRar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRar.cpp; sourceTree = "<group>"; };
-               F56C73DA131EC151000AD0F6 /* FileRar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRar.h; sourceTree = "<group>"; };
-               F56C73DB131EC151000AD0F6 /* FileRTV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRTV.cpp; sourceTree = "<group>"; };
-               F56C73DC131EC151000AD0F6 /* FileRTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRTV.h; sourceTree = "<group>"; };
-               F56C73DD131EC151000AD0F6 /* FileSFTP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSFTP.cpp; sourceTree = "<group>"; };
-               F56C73DE131EC151000AD0F6 /* FileSFTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSFTP.h; sourceTree = "<group>"; };
-               F56C73DF131EC151000AD0F6 /* FileSmb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSmb.h; sourceTree = "<group>"; };
-               F56C73E0131EC151000AD0F6 /* FileSpecialProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSpecialProtocol.cpp; sourceTree = "<group>"; };
-               F56C73E1131EC151000AD0F6 /* FileSpecialProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSpecialProtocol.h; sourceTree = "<group>"; };
-               F56C73E2131EC151000AD0F6 /* FileTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileTuxBox.cpp; sourceTree = "<group>"; };
-               F56C73E3131EC151000AD0F6 /* FileTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTuxBox.h; sourceTree = "<group>"; };
-               F56C73E4131EC151000AD0F6 /* FileUDF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUDF.cpp; sourceTree = "<group>"; };
-               F56C73E5131EC151000AD0F6 /* FileUDF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUDF.h; sourceTree = "<group>"; };
-               F56C73E8131EC151000AD0F6 /* FileZip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileZip.cpp; sourceTree = "<group>"; };
-               F56C73E9131EC151000AD0F6 /* FileZip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileZip.h; sourceTree = "<group>"; };
                F56C73EA131EC151000AD0F6 /* FTPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPDirectory.cpp; sourceTree = "<group>"; };
                F56C73EB131EC151000AD0F6 /* FTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPDirectory.h; sourceTree = "<group>"; };
                F56C73EC131EC151000AD0F6 /* FTPParse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPParse.cpp; sourceTree = "<group>"; };
                F56C73ED131EC151000AD0F6 /* FTPParse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPParse.h; sourceTree = "<group>"; };
                F56C73EE131EC151000AD0F6 /* HDDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDDirectory.cpp; sourceTree = "<group>"; };
                F56C73EF131EC151000AD0F6 /* HDDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDirectory.h; sourceTree = "<group>"; };
-               F56C73F0131EC151000AD0F6 /* HDHomeRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRun.cpp; sourceTree = "<group>"; };
-               F56C73F1131EC151000AD0F6 /* HDHomeRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRun.h; sourceTree = "<group>"; };
                F56C73F2131EC151000AD0F6 /* HTSPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPDirectory.h; sourceTree = "<group>"; };
                F56C73F3131EC151000AD0F6 /* HTSPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTSPDirectory.cpp; sourceTree = "<group>"; };
                F56C73F4131EC151000AD0F6 /* HTSPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPSession.h; sourceTree = "<group>"; };
                                F56C739D131EC151000AD0F6 /* AddonsDirectory.h */,
                                DFCFC5391413F7F70004D0BF /* AFPDirectory.cpp */,
                                DFCFC53A1413F7F70004D0BF /* AFPDirectory.h */,
+                               DF93D7381444B09C007C6459 /* AFPFile.cpp */,
+                               DF93D7391444B09C007C6459 /* AFPFile.h */,
                                F56C739F131EC151000AD0F6 /* ASAPFileDirectory.cpp */,
                                F56C73A0131EC151000AD0F6 /* ASAPFileDirectory.h */,
-                               7C99B73D133D372300FC2B16 /* CacheCircular.cpp */,
-                               7C99B73E133D372300FC2B16 /* CacheCircular.h */,
-                               F56C73AB131EC151000AD0F6 /* CacheMemBuffer.cpp */,
-                               F56C73AC131EC151000AD0F6 /* CacheMemBuffer.h */,
                                F56C73AD131EC151000AD0F6 /* CacheStrategy.cpp */,
                                F56C73AE131EC151000AD0F6 /* CacheStrategy.h */,
                                F56C73AF131EC151000AD0F6 /* CDDADirectory.cpp */,
                                F56C73B0131EC151000AD0F6 /* CDDADirectory.h */,
+                               DF93D73E1444B09C007C6459 /* CDDAFile.cpp */,
+                               DF93D73F1444B09C007C6459 /* CDDAFile.h */,
+                               DFDB00411516408F005079A4 /* CircularCache.cpp */,
+                               DFDB00421516408F005079A4 /* CircularCache.h */,
+                               DF93D7401444B09C007C6459 /* CurlFile.cpp */,
+                               DF93D7411444B09C007C6459 /* CurlFile.h */,
                                F56C73B1131EC151000AD0F6 /* DAAPDirectory.cpp */,
                                F56C73B2131EC151000AD0F6 /* DAAPDirectory.h */,
+                               DF93D7421444B09C007C6459 /* DAAPFile.cpp */,
+                               DF93D7431444B09C007C6459 /* DAAPFile.h */,
                                F56C73B3131EC151000AD0F6 /* DAVDirectory.cpp */,
                                F56C73B4131EC151000AD0F6 /* DAVDirectory.h */,
                                F56C73B5131EC151000AD0F6 /* Directory.cpp */,
                                F56C73B6131EC151000AD0F6 /* Directory.h */,
-                               F56C73B7131EC151000AD0F6 /* DirectoryCache.cpp */,
-                               F56C73B8131EC151000AD0F6 /* DirectoryCache.h */,
+                               DFDB00431516408F005079A4 /* DirectoryCache.cpp */,
+                               DFDB00441516408F005079A4 /* DirectoryCache.h */,
+                               DF93D7441444B09C007C6459 /* DirectoryFactory.cpp */,
+                               DF93D7451444B09C007C6459 /* DirectoryFactory.h */,
                                F56C73B9131EC151000AD0F6 /* DirectoryHistory.cpp */,
                                F56C73BA131EC151000AD0F6 /* DirectoryHistory.h */,
-                               F56C73BB131EC151000AD0F6 /* DirectoryTuxBox.cpp */,
-                               F56C73BC131EC151000AD0F6 /* DirectoryTuxBox.h */,
                                F56C73BD131EC151000AD0F6 /* DllLibCurl.cpp */,
                                F56C73BE131EC151000AD0F6 /* DllLibCurl.h */,
-                               F56C73BF131EC151000AD0F6 /* FactoryDirectory.cpp */,
-                               F56C73C0131EC151000AD0F6 /* FactoryDirectory.h */,
-                               F56C73C1131EC151000AD0F6 /* FactoryFileDirectory.cpp */,
-                               F56C73C2131EC151000AD0F6 /* FactoryFileDirectory.h */,
                                F56C73C3131EC151000AD0F6 /* File.cpp */,
                                F56C73C4131EC151000AD0F6 /* File.h */,
-                               DFCFC53B1413F7F70004D0BF /* FileAFP.cpp */,
-                               DFCFC53C1413F7F70004D0BF /* FileAFP.h */,
-                               F56C73C5131EC151000AD0F6 /* FileCache.cpp */,
-                               F56C73C6131EC151000AD0F6 /* FileCache.h */,
-                               F56C73C7131EC151000AD0F6 /* FileCDDA.cpp */,
-                               F56C73C8131EC151000AD0F6 /* FileCDDA.h */,
-                               F56C73C9131EC151000AD0F6 /* FileCurl.cpp */,
-                               F56C73CA131EC151000AD0F6 /* FileCurl.h */,
-                               F56C73CB131EC151000AD0F6 /* FileDAAP.cpp */,
-                               F56C73CC131EC151000AD0F6 /* FileDAAP.h */,
+                               DFDB00451516408F005079A4 /* FileCache.cpp */,
+                               DFDB00461516408F005079A4 /* FileCache.h */,
+                               DF93D7461444B09C007C6459 /* FileDirectoryFactory.cpp */,
+                               DF93D7471444B09C007C6459 /* FileDirectoryFactory.h */,
                                F56C73CD131EC151000AD0F6 /* FileFactory.cpp */,
                                F56C73CE131EC151000AD0F6 /* FileFactory.h */,
-                               F56C73CF131EC151000AD0F6 /* FileFileReader.cpp */,
-                               F56C73D0131EC151000AD0F6 /* FileFileReader.h */,
-                               F56C73D1131EC151000AD0F6 /* FileHD.cpp */,
-                               F56C73D2131EC151000AD0F6 /* FileHD.h */,
-                               F56C73D3131EC151000AD0F6 /* FileISO.cpp */,
-                               F56C73D4131EC151000AD0F6 /* FileISO.h */,
-                               F56C73D5131EC151000AD0F6 /* FileLastFM.cpp */,
-                               F56C73D6131EC151000AD0F6 /* FileLastFM.h */,
-                               F56C73D7131EC151000AD0F6 /* FileMusicDatabase.cpp */,
-                               F56C73D8131EC151000AD0F6 /* FileMusicDatabase.h */,
-                               DF0DF16813A3AF82008ED511 /* FileNFS.cpp */,
-                               DF0DF16913A3AF82008ED511 /* FileNFS.h */,
-                               DF4485301400651B0069344B /* FilePipe.cpp */,
-                               DF4485311400651B0069344B /* FilePipe.h */,
-                               F56C73D9131EC151000AD0F6 /* FileRar.cpp */,
-                               F56C73DA131EC151000AD0F6 /* FileRar.h */,
-                               F56C73DB131EC151000AD0F6 /* FileRTV.cpp */,
-                               F56C73DC131EC151000AD0F6 /* FileRTV.h */,
-                               F56C73DD131EC151000AD0F6 /* FileSFTP.cpp */,
-                               F56C73DE131EC151000AD0F6 /* FileSFTP.h */,
-                               F56C73AA131EC151000AD0F6 /* FileShoutcast.cpp */,
-                               F56C73A4131EC151000AD0F6 /* FileSmb.cpp */,
-                               F56C73DF131EC151000AD0F6 /* FileSmb.h */,
-                               F56C73E0131EC151000AD0F6 /* FileSpecialProtocol.cpp */,
-                               F56C73E1131EC151000AD0F6 /* FileSpecialProtocol.h */,
-                               F56C73E2131EC151000AD0F6 /* FileTuxBox.cpp */,
-                               F56C73E3131EC151000AD0F6 /* FileTuxBox.h */,
-                               F56C73E4131EC151000AD0F6 /* FileUDF.cpp */,
-                               F56C73E5131EC151000AD0F6 /* FileUDF.h */,
-                               DF673A231443769300A5A509 /* FileUPnP.cpp */,
-                               DF673A241443769300A5A509 /* FileUPnP.h */,
-                               F56C73E8131EC151000AD0F6 /* FileZip.cpp */,
-                               F56C73E9131EC151000AD0F6 /* FileZip.h */,
+                               DF93D7481444B09C007C6459 /* FileReaderFile.cpp */,
+                               DF93D7491444B09C007C6459 /* FileReaderFile.h */,
                                F56C73EA131EC151000AD0F6 /* FTPDirectory.cpp */,
                                F56C73EB131EC151000AD0F6 /* FTPDirectory.h */,
                                F56C73EC131EC151000AD0F6 /* FTPParse.cpp */,
                                F56C73ED131EC151000AD0F6 /* FTPParse.h */,
                                F56C73EE131EC151000AD0F6 /* HDDirectory.cpp */,
                                F56C73EF131EC151000AD0F6 /* HDDirectory.h */,
-                               F56C73F0131EC151000AD0F6 /* HDHomeRun.cpp */,
-                               F56C73F1131EC151000AD0F6 /* HDHomeRun.h */,
+                               DF93D74A1444B09C007C6459 /* HDFile.cpp */,
+                               DF93D74B1444B09C007C6459 /* HDFile.h */,
+                               DF93D82F1444B88B007C6459 /* HDHomeRunDirectory.cpp */,
+                               DF93D8301444B88B007C6459 /* HDHomeRunDirectory.h */,
+                               DF93D8311444B88B007C6459 /* HDHomeRunFile.cpp */,
+                               DF93D8321444B88B007C6459 /* HDHomeRunFile.h */,
                                F56C73F3131EC151000AD0F6 /* HTSPDirectory.cpp */,
                                F56C73F2131EC151000AD0F6 /* HTSPDirectory.h */,
                                F56C73F5131EC151000AD0F6 /* HTSPSession.cpp */,
                                F56C73FE131EC151000AD0F6 /* iso9660.h */,
                                F56C73FF131EC151000AD0F6 /* ISO9660Directory.cpp */,
                                F56C7400131EC151000AD0F6 /* ISO9660Directory.h */,
+                               DF93D74C1444B09C007C6459 /* ISOFile.cpp */,
+                               DF93D74D1444B09C007C6459 /* ISOFile.h */,
                                F56C7401131EC151000AD0F6 /* LastFMDirectory.cpp */,
                                F56C7402131EC151000AD0F6 /* LastFMDirectory.h */,
+                               DF93D74E1444B09C007C6459 /* LastFMFile.cpp */,
+                               DF93D74F1444B09C007C6459 /* LastFMFile.h */,
+                               DFDB00471516408F005079A4 /* MemBufferCache.cpp */,
+                               DFDB00481516408F005079A4 /* MemBufferCache.h */,
                                F56C7403131EC151000AD0F6 /* MultiPathDirectory.cpp */,
                                F56C7404131EC152000AD0F6 /* MultiPathDirectory.h */,
                                F56C7405131EC152000AD0F6 /* MultiPathFile.cpp */,
                                F56C7406131EC152000AD0F6 /* MultiPathFile.h */,
                                F56C7434131EC152000AD0F6 /* MusicDatabaseDirectory.cpp */,
                                F56C7435131EC152000AD0F6 /* MusicDatabaseDirectory.h */,
+                               DF93D7501444B09C007C6459 /* MusicDatabaseFile.cpp */,
+                               DF93D7511444B09C007C6459 /* MusicDatabaseFile.h */,
                                F56C73A1131EC151000AD0F6 /* MusicFileDirectory.cpp */,
                                F56C73A2131EC151000AD0F6 /* MusicFileDirectory.h */,
                                F56C7436131EC152000AD0F6 /* MusicSearchDirectory.cpp */,
                                F56C73A3131EC151000AD0F6 /* MythSession.cpp */,
                                DF0DF16A13A3AF82008ED511 /* NFSDirectory.cpp */,
                                DF0DF16B13A3AF82008ED511 /* NFSDirectory.h */,
+                               DF93D7521444B09C007C6459 /* NFSFile.cpp */,
+                               DF93D7531444B09C007C6459 /* NFSFile.h */,
                                F56C739A131EC151000AD0F6 /* NptXbmcFile.cpp */,
                                F56C7438131EC152000AD0F6 /* NSFFileDirectory.cpp */,
                                F56C7439131EC152000AD0F6 /* NSFFileDirectory.h */,
                                F56C743A131EC152000AD0F6 /* OGGFileDirectory.cpp */,
                                F56C743B131EC152000AD0F6 /* OGGFileDirectory.h */,
+                               DF93D7541444B09C007C6459 /* PipeFile.cpp */,
+                               DF93D7551444B09C007C6459 /* PipeFile.h */,
                                DF4485321400651B0069344B /* PipesManager.cpp */,
                                DF4485331400651B0069344B /* PipesManager.h */,
                                F56C743C131EC152000AD0F6 /* PlaylistDirectory.cpp */,
                                F56C7441131EC152000AD0F6 /* PluginDirectory.h */,
                                F56C7442131EC152000AD0F6 /* RarDirectory.cpp */,
                                F56C7443131EC152000AD0F6 /* RarDirectory.h */,
+                               DF93D7561444B09C007C6459 /* RarFile.cpp */,
+                               DF93D7571444B09C007C6459 /* RarFile.h */,
                                F56C7444131EC152000AD0F6 /* RarManager.cpp */,
                                F56C7445131EC152000AD0F6 /* RarManager.h */,
                                F56C739B131EC151000AD0F6 /* RSSDirectory.cpp */,
                                F56C739C131EC151000AD0F6 /* RSSDirectory.h */,
                                F56C7446131EC152000AD0F6 /* RTVDirectory.cpp */,
                                F56C7447131EC152000AD0F6 /* RTVDirectory.h */,
+                               DF93D7581444B09C007C6459 /* RTVFile.cpp */,
+                               DF93D7591444B09C007C6459 /* RTVFile.h */,
                                F56C7449131EC152000AD0F6 /* SAPDirectory.cpp */,
                                F56C7448131EC152000AD0F6 /* SAPDirectory.h */,
                                F56C744B131EC152000AD0F6 /* SAPFile.cpp */,
                                F56C744A131EC152000AD0F6 /* SAPFile.h */,
                                F56C744C131EC152000AD0F6 /* SFTPDirectory.cpp */,
                                F56C744D131EC152000AD0F6 /* SFTPDirectory.h */,
+                               DF93D75A1444B09C007C6459 /* SFTPFile.cpp */,
+                               DF93D75B1444B09C007C6459 /* SFTPFile.h */,
+                               DF93D75C1444B09C007C6459 /* ShoutcastFile.cpp */,
+                               DF93D75D1444B09C007C6459 /* ShoutcastFile.h */,
                                F56C744E131EC152000AD0F6 /* SIDFileDirectory.cpp */,
                                F56C744F131EC152000AD0F6 /* SIDFileDirectory.h */,
-                               18404DF91396C43B00863BBA /* Slingbox.cpp */,
-                               18404DFA1396C43B00863BBA /* Slingbox.h */,
+                               DF93D75E1444B09C007C6459 /* SlingboxDirectory.cpp */,
+                               DF93D75F1444B09C007C6459 /* SlingboxDirectory.h */,
+                               DF93D7601444B09C007C6459 /* SlingboxFile.cpp */,
+                               DF93D7611444B09C007C6459 /* SlingboxFile.h */,
                                F56C7450131EC152000AD0F6 /* SmartPlaylistDirectory.cpp */,
                                F56C7451131EC152000AD0F6 /* SmartPlaylistDirectory.h */,
                                F56C73A5131EC151000AD0F6 /* SMBDirectory.cpp */,
                                F56C7452131EC152000AD0F6 /* SMBDirectory.h */,
+                               DF93D7621444B09C007C6459 /* SmbFile.cpp */,
+                               DF93D7631444B09C007C6459 /* SmbFile.h */,
                                F57A1DBB1329FB0A00498CC7 /* SourcesDirectory.cpp */,
                                F57A1DBC1329FB0A00498CC7 /* SourcesDirectory.h */,
                                F56C7396131EC151000AD0F6 /* SpecialProtocol.cpp */,
                                F56C7397131EC151000AD0F6 /* SpecialProtocol.h */,
                                F56C7398131EC151000AD0F6 /* SpecialProtocolDirectory.cpp */,
                                F56C7399131EC151000AD0F6 /* SpecialProtocolDirectory.h */,
+                               DF93D7641444B09C007C6459 /* SpecialProtocolFile.cpp */,
+                               DF93D7651444B09C007C6459 /* SpecialProtocolFile.h */,
                                F56C7453131EC152000AD0F6 /* StackDirectory.cpp */,
                                F56C7454131EC152000AD0F6 /* StackDirectory.h */,
+                               DF93D7661444B09C007C6459 /* TuxBoxDirectory.cpp */,
+                               DF93D7671444B09C007C6459 /* TuxBoxDirectory.h */,
+                               DF93D7681444B09C007C6459 /* TuxBoxFile.cpp */,
+                               DF93D7691444B09C007C6459 /* TuxBoxFile.h */,
                                F56C7455131EC152000AD0F6 /* udf25.cpp */,
                                F56C7456131EC152000AD0F6 /* udf25.h */,
                                F56C7457131EC152000AD0F6 /* UDFDirectory.cpp */,
                                F56C7458131EC152000AD0F6 /* UDFDirectory.h */,
+                               DF93D76A1444B09C007C6459 /* UDFFile.cpp */,
+                               DF93D76B1444B09C007C6459 /* UDFFile.h */,
                                F56C7459131EC152000AD0F6 /* UPnPDirectory.cpp */,
                                F56C745A131EC152000AD0F6 /* UPnPDirectory.h */,
+                               DF93D76C1444B09C007C6459 /* UPnPFile.cpp */,
+                               DF93D76D1444B09C007C6459 /* UPnPFile.h */,
                                F56C7490131EC152000AD0F6 /* VideoDatabaseDirectory.cpp */,
                                F56C7491131EC152000AD0F6 /* VideoDatabaseDirectory.h */,
                                F56C7492131EC152000AD0F6 /* VirtualDirectory.cpp */,
                                F56C7498131EC152000AD0F6 /* ZeroconfDirectory.h */,
                                F56C749B131EC152000AD0F6 /* ZipDirectory.cpp */,
                                F56C749C131EC152000AD0F6 /* ZipDirectory.h */,
+                               DF93D76E1444B09C007C6459 /* ZipFile.cpp */,
+                               DF93D76F1444B09C007C6459 /* ZipFile.h */,
                                F56C749D131EC152000AD0F6 /* ZipManager.cpp */,
                                F56C749E131EC152000AD0F6 /* ZipManager.h */,
                        );
                                F56C7971131EC154000AD0F6 /* ASAPFileDirectory.cpp in Sources */,
                                F56C7972131EC154000AD0F6 /* MusicFileDirectory.cpp in Sources */,
                                F56C7973131EC154000AD0F6 /* MythSession.cpp in Sources */,
-                               F56C7974131EC154000AD0F6 /* FileSmb.cpp in Sources */,
                                F56C7975131EC154000AD0F6 /* SMBDirectory.cpp in Sources */,
                                F56C7976131EC154000AD0F6 /* MythDirectory.cpp in Sources */,
                                F56C7977131EC154000AD0F6 /* MythFile.cpp in Sources */,
-                               F56C7978131EC154000AD0F6 /* FileShoutcast.cpp in Sources */,
-                               F56C7979131EC154000AD0F6 /* CacheMemBuffer.cpp in Sources */,
                                F56C797A131EC154000AD0F6 /* CacheStrategy.cpp in Sources */,
                                F56C797B131EC154000AD0F6 /* CDDADirectory.cpp in Sources */,
                                F56C797C131EC154000AD0F6 /* DAAPDirectory.cpp in Sources */,
                                F56C797D131EC154000AD0F6 /* DAVDirectory.cpp in Sources */,
                                F56C797E131EC154000AD0F6 /* Directory.cpp in Sources */,
-                               F56C797F131EC154000AD0F6 /* DirectoryCache.cpp in Sources */,
                                F56C7980131EC154000AD0F6 /* DirectoryHistory.cpp in Sources */,
-                               F56C7981131EC154000AD0F6 /* DirectoryTuxBox.cpp in Sources */,
                                F56C7982131EC154000AD0F6 /* DllLibCurl.cpp in Sources */,
-                               F56C7983131EC154000AD0F6 /* FactoryDirectory.cpp in Sources */,
-                               F56C7984131EC154000AD0F6 /* FactoryFileDirectory.cpp in Sources */,
                                F56C7985131EC154000AD0F6 /* File.cpp in Sources */,
-                               F56C7986131EC154000AD0F6 /* FileCache.cpp in Sources */,
-                               F56C7987131EC154000AD0F6 /* FileCDDA.cpp in Sources */,
-                               F56C7988131EC154000AD0F6 /* FileCurl.cpp in Sources */,
-                               F56C7989131EC154000AD0F6 /* FileDAAP.cpp in Sources */,
                                F56C798A131EC154000AD0F6 /* FileFactory.cpp in Sources */,
-                               F56C798B131EC154000AD0F6 /* FileFileReader.cpp in Sources */,
-                               F56C798C131EC154000AD0F6 /* FileHD.cpp in Sources */,
-                               F56C798D131EC154000AD0F6 /* FileISO.cpp in Sources */,
-                               F56C798E131EC154000AD0F6 /* FileLastFM.cpp in Sources */,
-                               F56C798F131EC154000AD0F6 /* FileMusicDatabase.cpp in Sources */,
-                               F56C7990131EC154000AD0F6 /* FileRar.cpp in Sources */,
-                               F56C7991131EC154000AD0F6 /* FileRTV.cpp in Sources */,
-                               F56C7992131EC154000AD0F6 /* FileSFTP.cpp in Sources */,
-                               F56C7993131EC154000AD0F6 /* FileSpecialProtocol.cpp in Sources */,
-                               F56C7994131EC154000AD0F6 /* FileTuxBox.cpp in Sources */,
-                               F56C7995131EC154000AD0F6 /* FileUDF.cpp in Sources */,
-                               F56C7997131EC154000AD0F6 /* FileZip.cpp in Sources */,
                                F56C7998131EC154000AD0F6 /* FTPDirectory.cpp in Sources */,
                                F56C7999131EC154000AD0F6 /* FTPParse.cpp in Sources */,
                                F56C799A131EC154000AD0F6 /* HDDirectory.cpp in Sources */,
-                               F56C799B131EC154000AD0F6 /* HDHomeRun.cpp in Sources */,
                                F56C799C131EC154000AD0F6 /* HTSPDirectory.cpp in Sources */,
                                F56C799D131EC154000AD0F6 /* HTSPSession.cpp in Sources */,
                                F56C799E131EC154000AD0F6 /* HTTPDirectory.cpp in Sources */,
                                F56C7FB0131F36BF000AD0F6 /* DVDVideoCodecVideoToolBox.cpp in Sources */,
                                F57A1DBD1329FB0A00498CC7 /* SourcesDirectory.cpp in Sources */,
                                F5B13E0113344F310045076D /* DarwinUtils.mm in Sources */,
-                               7C99B73F133D372300FC2B16 /* CacheCircular.cpp in Sources */,
                                7C99B7AA134072CD00FC2B16 /* GUIDialogPlayEject.cpp in Sources */,
                                F5AE40EA134175160004BD79 /* HttpApi.cpp in Sources */,
                                F5AE40EB134175160004BD79 /* XBMChttp.cpp in Sources */,
                                18ACF8E313597B0000B67371 /* RecentlyAddedJob.cpp in Sources */,
                                C807119F135DB842002F601B /* InputOperations.cpp in Sources */,
                                C8EC5D51136954E400CCC10D /* XBMC_keytable.cpp in Sources */,
-                               18404DFB1396C43B00863BBA /* Slingbox.cpp in Sources */,
                                1840B796139968DB007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B797139968DB007C848B /* JSONVariantWriter.cpp in Sources */,
                                7C0A7ECD13A5DBF900AFC2BD /* AppParamParser.cpp in Sources */,
                                7C0A7FC813A9E75400AFC2BD /* DirtyRegionSolvers.cpp in Sources */,
                                7C0A7FC913A9E75400AFC2BD /* DirtyRegionTracker.cpp in Sources */,
                                7C0A7FCC13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */,
-                               DF0DF16C13A3AF82008ED511 /* FileNFS.cpp in Sources */,
                                DF0DF16D13A3AF82008ED511 /* NFSDirectory.cpp in Sources */,
                                7C89627013B702F3003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
                                1830216013B8E35300770920 /* controledit.cpp in Sources */,
                                DFA6BE8A13FED2B40048CC11 /* HttpParser.cpp in Sources */,
                                18968DE814155E1D005BA742 /* ApplicationOperations.cpp in Sources */,
                                DFCFC53D1413F7F70004D0BF /* AFPDirectory.cpp in Sources */,
-                               DFCFC53E1413F7F70004D0BF /* FileAFP.cpp in Sources */,
                                32D6D47C1423A9D8003641AC /* JpegIO.cpp in Sources */,
                                DF44852F140064F40069344B /* BXAcodec.cpp in Sources */,
-                               DF4485341400651B0069344B /* FilePipe.cpp in Sources */,
                                DF4485351400651B0069344B /* PipesManager.cpp in Sources */,
                                DF4485381400654A0069344B /* AirTunesServer.cpp in Sources */,
                                DF98D9A81434F4B400A6EBE1 /* SkinVariable.cpp in Sources */,
                                F5E1132814357B6500175026 /* GUIDialogPeripheralSettings.cpp in Sources */,
                                F5E1132914357B6500175026 /* Peripherals.cpp in Sources */,
                                F5E113AD1435882400175026 /* pyrendercapture.cpp in Sources */,
-                               DF673A251443769300A5A509 /* FileUPnP.cpp in Sources */,
                                F5BD033A148D4923001B5583 /* CryptThreading.cpp in Sources */,
                                7CCFD9AA1514952700211D82 /* PCMCodec.cpp in Sources */,
                                DF527780151BAFD600B5B63B /* WebSocket.cpp in Sources */,
                                DFCA6B0E15224684000BFAAE /* HTTPWebinterfaceAddonsHandler.cpp in Sources */,
                                DFCA6B0F15224684000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */,
                                DFCA6B1015224684000BFAAE /* IHTTPRequestHandler.cpp in Sources */,
+                               DF93D7701444B09C007C6459 /* AFPFile.cpp in Sources */,
+                               DF93D7731444B09C007C6459 /* CDDAFile.cpp in Sources */,
+                               DF93D7741444B09C007C6459 /* CurlFile.cpp in Sources */,
+                               DF93D7751444B09C007C6459 /* DAAPFile.cpp in Sources */,
+                               DF93D7761444B09C007C6459 /* DirectoryFactory.cpp in Sources */,
+                               DF93D7771444B09C007C6459 /* FileDirectoryFactory.cpp in Sources */,
+                               DF93D7781444B09C007C6459 /* FileReaderFile.cpp in Sources */,
+                               DF93D7791444B09C007C6459 /* HDFile.cpp in Sources */,
+                               DF93D77A1444B09C007C6459 /* ISOFile.cpp in Sources */,
+                               DF93D77B1444B09C007C6459 /* LastFMFile.cpp in Sources */,
+                               DF93D77C1444B09C007C6459 /* MusicDatabaseFile.cpp in Sources */,
+                               DF93D77D1444B09C007C6459 /* NFSFile.cpp in Sources */,
+                               DF93D77E1444B09C007C6459 /* PipeFile.cpp in Sources */,
+                               DF93D77F1444B09C007C6459 /* RarFile.cpp in Sources */,
+                               DF93D7801444B09C007C6459 /* RTVFile.cpp in Sources */,
+                               DF93D7811444B09C007C6459 /* SFTPFile.cpp in Sources */,
+                               DF93D7821444B09C007C6459 /* ShoutcastFile.cpp in Sources */,
+                               DF93D7831444B09C007C6459 /* SlingboxDirectory.cpp in Sources */,
+                               DF93D7841444B09C007C6459 /* SlingboxFile.cpp in Sources */,
+                               DF93D7851444B09C007C6459 /* SmbFile.cpp in Sources */,
+                               DF93D7861444B09C007C6459 /* SpecialProtocolFile.cpp in Sources */,
+                               DF93D7871444B09C007C6459 /* TuxBoxDirectory.cpp in Sources */,
+                               DF93D7881444B09C007C6459 /* TuxBoxFile.cpp in Sources */,
+                               DF93D7891444B09C007C6459 /* UDFFile.cpp in Sources */,
+                               DF93D78A1444B09C007C6459 /* UPnPFile.cpp in Sources */,
+                               DF93D78B1444B09C007C6459 /* ZipFile.cpp in Sources */,
+                               DF93D8331444B88B007C6459 /* HDHomeRunDirectory.cpp in Sources */,
+                               DF93D8341444B88B007C6459 /* HDHomeRunFile.cpp in Sources */,
+                               DFDB00491516408F005079A4 /* CircularCache.cpp in Sources */,
+                               DFDB004A1516408F005079A4 /* DirectoryCache.cpp in Sources */,
+                               DFDB004B1516408F005079A4 /* FileCache.cpp in Sources */,
+                               DFDB004C1516408F005079A4 /* MemBufferCache.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ff606d5..7dfb790 100644 (file)
@@ -9,7 +9,6 @@
 /* Begin PBXBuildFile section */
                1830219E13B8E37300770920 /* controledit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1830219D13B8E37300770920 /* controledit.cpp */; };
                18404DD31396C3D200863BBA /* SlingboxLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18404DD21396C3D200863BBA /* SlingboxLib.a */; };
-               18404DD61396C3F300863BBA /* Slingbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18404DD41396C3F300863BBA /* Slingbox.cpp */; };
                1840B77A1399616D007C848B /* JSONVariantParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B7761399616D007C848B /* JSONVariantParser.cpp */; };
                1840B77B1399616D007C848B /* JSONVariantWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B7781399616D007C848B /* JSONVariantWriter.cpp */; };
                188F761E1522182F009870CE /* GUIOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 188F761C1522182F009870CE /* GUIOperations.cpp */; };
                7C0A7FB213A9E72E00AFC2BD /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FAE13A9E72E00AFC2BD /* DirtyRegionSolvers.cpp */; };
                7C0A7FB313A9E72E00AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FB013A9E72E00AFC2BD /* DirtyRegionTracker.cpp */; };
                7C89628013B7031E003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */; };
-               7C99B6E9133D36E200FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */; };
                7C99B7BE1340730000FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */; };
                7CCFD9991514950700211D82 /* PCMCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCFD9971514950700211D82 /* PCMCodec.cpp */; };
                7CEE2E7F13D6B7D4000ABF2A /* TimeSmoother.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE2E7D13D6B7D4000ABF2A /* TimeSmoother.cpp */; };
                C80711AD135DB85F002F601B /* InputOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C80711AB135DB85F002F601B /* InputOperations.cpp */; };
                C8EC5D26136953E100CCC10D /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D24136953E100CCC10D /* XBMC_keytable.cpp */; };
-               DF0DF17F13A3AF9F008ED511 /* FileNFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF17B13A3AF9F008ED511 /* FileNFS.cpp */; };
                DF0DF18013A3AF9F008ED511 /* NFSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF17D13A3AF9F008ED511 /* NFSDirectory.cpp */; };
                DF3488F813FD961A0026A711 /* GUIAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF3488F613FD961A0026A711 /* GUIAction.cpp */; };
                DF44856C140065C60069344B /* BXAcodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44856A140065C60069344B /* BXAcodec.cpp */; };
-               DF448571140065E10069344B /* FilePipe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44856D140065E10069344B /* FilePipe.cpp */; };
                DF448572140065E10069344B /* PipesManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44856F140065E10069344B /* PipesManager.cpp */; };
                DF4485751400662D0069344B /* AirTunesServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4485731400662D0069344B /* AirTunesServer.cpp */; };
                DF527757151BAF8200B5B63B /* WebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52774E151BAF8200B5B63B /* WebSocket.cpp */; };
                DF52775A151BAF8200B5B63B /* WebSocketV8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF527754151BAF8200B5B63B /* WebSocketV8.cpp */; };
                DF527760151BAFA000B5B63B /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52775C151BAFA000B5B63B /* Base64.cpp */; };
                DF527761151BAFA000B5B63B /* HttpResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52775E151BAFA000B5B63B /* HttpResponse.cpp */; };
-               DF6739E21443765F00A5A509 /* FileUPnP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF6739E01443765F00A5A509 /* FileUPnP.cpp */; };
+               DF93D7CF1444B105007C6459 /* AFPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7971444B105007C6459 /* AFPFile.cpp */; };
+               DF93D7D21444B105007C6459 /* CDDAFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D79D1444B105007C6459 /* CDDAFile.cpp */; };
+               DF93D7D31444B105007C6459 /* CurlFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D79F1444B105007C6459 /* CurlFile.cpp */; };
+               DF93D7D41444B105007C6459 /* DAAPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A11444B105007C6459 /* DAAPFile.cpp */; };
+               DF93D7D51444B105007C6459 /* DirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A31444B105007C6459 /* DirectoryFactory.cpp */; };
+               DF93D7D61444B105007C6459 /* FileDirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A51444B105007C6459 /* FileDirectoryFactory.cpp */; };
+               DF93D7D71444B105007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A71444B105007C6459 /* FileReaderFile.cpp */; };
+               DF93D7D81444B105007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A91444B105007C6459 /* HDFile.cpp */; };
+               DF93D7D91444B105007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AB1444B105007C6459 /* ISOFile.cpp */; };
+               DF93D7DA1444B105007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AD1444B105007C6459 /* LastFMFile.cpp */; };
+               DF93D7DB1444B105007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AF1444B105007C6459 /* MusicDatabaseFile.cpp */; };
+               DF93D7DC1444B105007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B11444B105007C6459 /* NFSFile.cpp */; };
+               DF93D7DD1444B105007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B31444B105007C6459 /* PipeFile.cpp */; };
+               DF93D7DE1444B105007C6459 /* RarFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B51444B105007C6459 /* RarFile.cpp */; };
+               DF93D7DF1444B105007C6459 /* RTVFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B71444B105007C6459 /* RTVFile.cpp */; };
+               DF93D7E01444B105007C6459 /* SFTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B91444B105007C6459 /* SFTPFile.cpp */; };
+               DF93D7E11444B105007C6459 /* ShoutcastFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7BB1444B105007C6459 /* ShoutcastFile.cpp */; };
+               DF93D7E21444B105007C6459 /* SlingboxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7BD1444B105007C6459 /* SlingboxDirectory.cpp */; };
+               DF93D7E31444B105007C6459 /* SlingboxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7BF1444B105007C6459 /* SlingboxFile.cpp */; };
+               DF93D7E41444B105007C6459 /* SmbFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7C11444B105007C6459 /* SmbFile.cpp */; };
+               DF93D7E51444B105007C6459 /* SpecialProtocolFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7C31444B105007C6459 /* SpecialProtocolFile.cpp */; };
+               DF93D7E61444B105007C6459 /* TuxBoxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7C51444B105007C6459 /* TuxBoxDirectory.cpp */; };
+               DF93D7E71444B105007C6459 /* TuxBoxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7C71444B105007C6459 /* TuxBoxFile.cpp */; };
+               DF93D7E81444B105007C6459 /* UDFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7C91444B105007C6459 /* UDFFile.cpp */; };
+               DF93D7E91444B105007C6459 /* UPnPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7CB1444B105007C6459 /* UPnPFile.cpp */; };
+               DF93D7EA1444B105007C6459 /* ZipFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7CD1444B105007C6459 /* ZipFile.cpp */; };
+               DF93D81E1444B86B007C6459 /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D81A1444B86B007C6459 /* HDHomeRunDirectory.cpp */; };
+               DF93D81F1444B86B007C6459 /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D81C1444B86B007C6459 /* HDHomeRunFile.cpp */; };
                DF98D9991434F49500A6EBE1 /* SkinVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF98D9971434F49500A6EBE1 /* SkinVariable.cpp */; };
                DFA6BE4313FECA010048CC11 /* AirPlayServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFA6BE4113FECA010048CC11 /* AirPlayServer.cpp */; };
                DFA6BE7713FED09C0048CC11 /* HttpParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFA6BE7513FED09C0048CC11 /* HttpParser.cpp */; };
                DFCA6AEF15224671000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCA6AE615224671000BFAAE /* HTTPWebinterfaceHandler.cpp */; };
                DFCA6AF015224671000BFAAE /* IHTTPRequestHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCA6AE815224671000BFAAE /* IHTTPRequestHandler.cpp */; };
                DFCFC52A1413F7D60004D0BF /* AFPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCFC5261413F7D60004D0BF /* AFPDirectory.cpp */; };
-               DFCFC52B1413F7D60004D0BF /* FileAFP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFCFC5281413F7D60004D0BF /* FileAFP.cpp */; };
                DFD4D1E213D725ED00A47C47 /* Implementation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD4D1D813D725ED00A47C47 /* Implementation.cpp */; };
                DFD4D1E713D7263000A47C47 /* README.platform in Resources */ = {isa = PBXBuildFile; fileRef = DFD4D1E613D7263000A47C47 /* README.platform */; };
                DFD4D1FE13D7283500A47C47 /* SystemClock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD4D1FC13D7283500A47C47 /* SystemClock.cpp */; };
+               DFDB00241516403A005079A4 /* CircularCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB001C1516403A005079A4 /* CircularCache.cpp */; };
+               DFDB00251516403A005079A4 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB001E1516403A005079A4 /* DirectoryCache.cpp */; };
+               DFDB00261516403A005079A4 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00201516403A005079A4 /* FileCache.cpp */; };
+               DFDB00271516403A005079A4 /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00221516403A005079A4 /* MemBufferCache.cpp */; };
                F56B143412CAF279009B4C96 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B143312CAF279009B4C96 /* CoreVideo.framework */; };
                F56B14A512CAF523009B4C96 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B14A412CAF523009B4C96 /* AudioToolbox.framework */; };
                F56B15D512CD67A9009B4C96 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15D412CD67A9009B4C96 /* CoreGraphics.framework */; };
                F56C895B131F42ED000AD0F6 /* ASAPFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8382131F42E8000AD0F6 /* ASAPFileDirectory.cpp */; };
                F56C895C131F42ED000AD0F6 /* MusicFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8384131F42E8000AD0F6 /* MusicFileDirectory.cpp */; };
                F56C895D131F42ED000AD0F6 /* MythSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8386131F42E8000AD0F6 /* MythSession.cpp */; };
-               F56C895E131F42ED000AD0F6 /* FileSmb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8387131F42E8000AD0F6 /* FileSmb.cpp */; };
                F56C895F131F42ED000AD0F6 /* SMBDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8388131F42E8000AD0F6 /* SMBDirectory.cpp */; };
                F56C8960131F42ED000AD0F6 /* MythDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8389131F42E8000AD0F6 /* MythDirectory.cpp */; };
                F56C8961131F42ED000AD0F6 /* MythFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C838B131F42E8000AD0F6 /* MythFile.cpp */; };
-               F56C8962131F42ED000AD0F6 /* FileShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C838D131F42E8000AD0F6 /* FileShoutcast.cpp */; };
-               F56C8963131F42ED000AD0F6 /* CacheMemBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C838E131F42E8000AD0F6 /* CacheMemBuffer.cpp */; };
                F56C8964131F42ED000AD0F6 /* CacheStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8390131F42E8000AD0F6 /* CacheStrategy.cpp */; };
                F56C8965131F42ED000AD0F6 /* CDDADirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8392131F42E8000AD0F6 /* CDDADirectory.cpp */; };
                F56C8966131F42ED000AD0F6 /* DAAPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8394131F42E8000AD0F6 /* DAAPDirectory.cpp */; };
                F56C8967131F42ED000AD0F6 /* DAVDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8396131F42E8000AD0F6 /* DAVDirectory.cpp */; };
                F56C8968131F42ED000AD0F6 /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8398131F42E8000AD0F6 /* Directory.cpp */; };
-               F56C8969131F42ED000AD0F6 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C839A131F42E8000AD0F6 /* DirectoryCache.cpp */; };
                F56C896A131F42ED000AD0F6 /* DirectoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C839C131F42E8000AD0F6 /* DirectoryHistory.cpp */; };
-               F56C896B131F42ED000AD0F6 /* DirectoryTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C839E131F42E8000AD0F6 /* DirectoryTuxBox.cpp */; };
                F56C896C131F42ED000AD0F6 /* DllLibCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83A0131F42E8000AD0F6 /* DllLibCurl.cpp */; };
-               F56C896D131F42ED000AD0F6 /* FactoryDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83A2131F42E8000AD0F6 /* FactoryDirectory.cpp */; };
-               F56C896E131F42ED000AD0F6 /* FactoryFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83A4131F42E8000AD0F6 /* FactoryFileDirectory.cpp */; };
                F56C896F131F42ED000AD0F6 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83A6131F42E8000AD0F6 /* File.cpp */; };
-               F56C8970131F42ED000AD0F6 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83A8131F42E8000AD0F6 /* FileCache.cpp */; };
-               F56C8971131F42ED000AD0F6 /* FileCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83AA131F42E8000AD0F6 /* FileCDDA.cpp */; };
-               F56C8972131F42ED000AD0F6 /* FileCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83AC131F42E8000AD0F6 /* FileCurl.cpp */; };
-               F56C8973131F42ED000AD0F6 /* FileDAAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83AE131F42E8000AD0F6 /* FileDAAP.cpp */; };
                F56C8974131F42ED000AD0F6 /* FileFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83B0131F42E8000AD0F6 /* FileFactory.cpp */; };
-               F56C8975131F42ED000AD0F6 /* FileFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83B2131F42E8000AD0F6 /* FileFileReader.cpp */; };
-               F56C8976131F42ED000AD0F6 /* FileHD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83B4131F42E8000AD0F6 /* FileHD.cpp */; };
-               F56C8977131F42ED000AD0F6 /* FileISO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83B6131F42E8000AD0F6 /* FileISO.cpp */; };
-               F56C8978131F42ED000AD0F6 /* FileLastFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83B8131F42E8000AD0F6 /* FileLastFM.cpp */; };
-               F56C8979131F42ED000AD0F6 /* FileMusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83BA131F42E8000AD0F6 /* FileMusicDatabase.cpp */; };
-               F56C897A131F42ED000AD0F6 /* FileRar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83BC131F42E8000AD0F6 /* FileRar.cpp */; };
-               F56C897B131F42ED000AD0F6 /* FileRTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83BE131F42E8000AD0F6 /* FileRTV.cpp */; };
-               F56C897C131F42ED000AD0F6 /* FileSFTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83C0131F42E8000AD0F6 /* FileSFTP.cpp */; };
-               F56C897D131F42ED000AD0F6 /* FileSpecialProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83C3131F42E8000AD0F6 /* FileSpecialProtocol.cpp */; };
-               F56C897E131F42ED000AD0F6 /* FileTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83C5131F42E8000AD0F6 /* FileTuxBox.cpp */; };
-               F56C897F131F42ED000AD0F6 /* FileUDF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83C7131F42E8000AD0F6 /* FileUDF.cpp */; };
-               F56C8981131F42ED000AD0F6 /* FileZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83CB131F42E8000AD0F6 /* FileZip.cpp */; };
                F56C8982131F42ED000AD0F6 /* FTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83CD131F42E8000AD0F6 /* FTPDirectory.cpp */; };
                F56C8983131F42ED000AD0F6 /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83CF131F42E8000AD0F6 /* FTPParse.cpp */; };
                F56C8984131F42ED000AD0F6 /* HDDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83D1131F42E8000AD0F6 /* HDDirectory.cpp */; };
-               F56C8985131F42ED000AD0F6 /* HDHomeRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83D3131F42E8000AD0F6 /* HDHomeRun.cpp */; };
                F56C8986131F42ED000AD0F6 /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83D6131F42E8000AD0F6 /* HTSPDirectory.cpp */; };
                F56C8987131F42ED000AD0F6 /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83D8131F42E8000AD0F6 /* HTSPSession.cpp */; };
                F56C8988131F42ED000AD0F6 /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83DA131F42E8000AD0F6 /* HTTPDirectory.cpp */; };
 /* Begin PBXFileReference section */
                1830219D13B8E37300770920 /* controledit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controledit.cpp; sourceTree = "<group>"; };
                18404DD21396C3D200863BBA /* SlingboxLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = SlingboxLib.a; path = lib/SlingboxLib/SlingboxLib.a; sourceTree = "<group>"; };
-               18404DD41396C3F300863BBA /* Slingbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Slingbox.cpp; sourceTree = "<group>"; };
-               18404DD51396C3F300863BBA /* Slingbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slingbox.h; sourceTree = "<group>"; };
                1840B7761399616D007C848B /* JSONVariantParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONVariantParser.cpp; sourceTree = "<group>"; };
                1840B7771399616D007C848B /* JSONVariantParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONVariantParser.h; sourceTree = "<group>"; };
                1840B7781399616D007C848B /* JSONVariantWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONVariantWriter.cpp; sourceTree = "<group>"; };
                7C0A7FB113A9E72E00AFC2BD /* DirtyRegionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegionTracker.h; sourceTree = "<group>"; };
                7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
                7C89627F13B7031E003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; };
-               7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheCircular.cpp; sourceTree = "<group>"; };
-               7C99B6E8133D36E200FC2B16 /* CacheCircular.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheCircular.h; sourceTree = "<group>"; };
                7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; };
                7C99B7BD1340730000FC2B16 /* GUIDialogPlayEject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogPlayEject.h; sourceTree = "<group>"; };
                7CCFD9971514950700211D82 /* PCMCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMCodec.cpp; sourceTree = "<group>"; };
                C80711AC135DB85F002F601B /* InputOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputOperations.h; sourceTree = "<group>"; };
                C8EC5D24136953E100CCC10D /* XBMC_keytable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBMC_keytable.cpp; sourceTree = "<group>"; };
                C8EC5D25136953E100CCC10D /* XBMC_keytable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMC_keytable.h; sourceTree = "<group>"; };
-               DF0DF17B13A3AF9F008ED511 /* FileNFS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileNFS.cpp; sourceTree = "<group>"; };
-               DF0DF17C13A3AF9F008ED511 /* FileNFS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileNFS.h; sourceTree = "<group>"; };
                DF0DF17D13A3AF9F008ED511 /* NFSDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSDirectory.cpp; sourceTree = "<group>"; };
                DF0DF17E13A3AF9F008ED511 /* NFSDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSDirectory.h; sourceTree = "<group>"; };
                DF3488F613FD961A0026A711 /* GUIAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIAction.cpp; sourceTree = "<group>"; };
                DF3488F713FD961A0026A711 /* GUIAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIAction.h; sourceTree = "<group>"; };
                DF44856A140065C60069344B /* BXAcodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BXAcodec.cpp; sourceTree = "<group>"; };
                DF44856B140065C60069344B /* BXAcodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BXAcodec.h; sourceTree = "<group>"; };
-               DF44856D140065E10069344B /* FilePipe.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FilePipe.cpp; sourceTree = "<group>"; };
-               DF44856E140065E10069344B /* FilePipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePipe.h; sourceTree = "<group>"; };
                DF44856F140065E10069344B /* PipesManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipesManager.cpp; sourceTree = "<group>"; };
                DF448570140065E10069344B /* PipesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipesManager.h; sourceTree = "<group>"; };
                DF4485731400662D0069344B /* AirTunesServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirTunesServer.cpp; sourceTree = "<group>"; };
                DF52775D151BAFA000B5B63B /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
                DF52775E151BAFA000B5B63B /* HttpResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpResponse.cpp; sourceTree = "<group>"; };
                DF52775F151BAFA000B5B63B /* HttpResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpResponse.h; sourceTree = "<group>"; };
-               DF6739E01443765F00A5A509 /* FileUPnP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUPnP.cpp; sourceTree = "<group>"; };
-               DF6739E11443765F00A5A509 /* FileUPnP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUPnP.h; sourceTree = "<group>"; };
+               DF93D7971444B105007C6459 /* AFPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPFile.cpp; sourceTree = "<group>"; };
+               DF93D7981444B105007C6459 /* AFPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPFile.h; sourceTree = "<group>"; };
+               DF93D79D1444B105007C6459 /* CDDAFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDAFile.cpp; sourceTree = "<group>"; };
+               DF93D79E1444B105007C6459 /* CDDAFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDDAFile.h; sourceTree = "<group>"; };
+               DF93D79F1444B105007C6459 /* CurlFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurlFile.cpp; sourceTree = "<group>"; };
+               DF93D7A01444B105007C6459 /* CurlFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurlFile.h; sourceTree = "<group>"; };
+               DF93D7A11444B105007C6459 /* DAAPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DAAPFile.cpp; sourceTree = "<group>"; };
+               DF93D7A21444B105007C6459 /* DAAPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAAPFile.h; sourceTree = "<group>"; };
+               DF93D7A31444B105007C6459 /* DirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D7A41444B105007C6459 /* DirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D7A51444B105007C6459 /* FileDirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D7A61444B105007C6459 /* FileDirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D7A71444B105007C6459 /* FileReaderFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileReaderFile.cpp; sourceTree = "<group>"; };
+               DF93D7A81444B105007C6459 /* FileReaderFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileReaderFile.h; sourceTree = "<group>"; };
+               DF93D7A91444B105007C6459 /* HDFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDFile.cpp; sourceTree = "<group>"; };
+               DF93D7AA1444B105007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
+               DF93D7AB1444B105007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
+               DF93D7AC1444B105007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
+               DF93D7AD1444B105007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
+               DF93D7AE1444B105007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
+               DF93D7AF1444B105007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
+               DF93D7B01444B105007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
+               DF93D7B11444B105007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
+               DF93D7B21444B105007C6459 /* NFSFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSFile.h; sourceTree = "<group>"; };
+               DF93D7B31444B105007C6459 /* PipeFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipeFile.cpp; sourceTree = "<group>"; };
+               DF93D7B41444B105007C6459 /* PipeFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipeFile.h; sourceTree = "<group>"; };
+               DF93D7B51444B105007C6459 /* RarFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RarFile.cpp; sourceTree = "<group>"; };
+               DF93D7B61444B105007C6459 /* RarFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RarFile.h; sourceTree = "<group>"; };
+               DF93D7B71444B105007C6459 /* RTVFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTVFile.cpp; sourceTree = "<group>"; };
+               DF93D7B81444B105007C6459 /* RTVFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTVFile.h; sourceTree = "<group>"; };
+               DF93D7B91444B105007C6459 /* SFTPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFTPFile.cpp; sourceTree = "<group>"; };
+               DF93D7BA1444B105007C6459 /* SFTPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFTPFile.h; sourceTree = "<group>"; };
+               DF93D7BB1444B105007C6459 /* ShoutcastFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShoutcastFile.cpp; sourceTree = "<group>"; };
+               DF93D7BC1444B105007C6459 /* ShoutcastFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShoutcastFile.h; sourceTree = "<group>"; };
+               DF93D7BD1444B105007C6459 /* SlingboxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D7BE1444B105007C6459 /* SlingboxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxDirectory.h; sourceTree = "<group>"; };
+               DF93D7BF1444B105007C6459 /* SlingboxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxFile.cpp; sourceTree = "<group>"; };
+               DF93D7C01444B105007C6459 /* SlingboxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxFile.h; sourceTree = "<group>"; };
+               DF93D7C11444B105007C6459 /* SmbFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmbFile.cpp; sourceTree = "<group>"; };
+               DF93D7C21444B105007C6459 /* SmbFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmbFile.h; sourceTree = "<group>"; };
+               DF93D7C31444B105007C6459 /* SpecialProtocolFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolFile.cpp; sourceTree = "<group>"; };
+               DF93D7C41444B105007C6459 /* SpecialProtocolFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolFile.h; sourceTree = "<group>"; };
+               DF93D7C51444B105007C6459 /* TuxBoxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D7C61444B105007C6459 /* TuxBoxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxDirectory.h; sourceTree = "<group>"; };
+               DF93D7C71444B105007C6459 /* TuxBoxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxFile.cpp; sourceTree = "<group>"; };
+               DF93D7C81444B105007C6459 /* TuxBoxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxFile.h; sourceTree = "<group>"; };
+               DF93D7C91444B105007C6459 /* UDFFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UDFFile.cpp; sourceTree = "<group>"; };
+               DF93D7CA1444B105007C6459 /* UDFFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UDFFile.h; sourceTree = "<group>"; };
+               DF93D7CB1444B105007C6459 /* UPnPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPFile.cpp; sourceTree = "<group>"; };
+               DF93D7CC1444B105007C6459 /* UPnPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPFile.h; sourceTree = "<group>"; };
+               DF93D7CD1444B105007C6459 /* ZipFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZipFile.cpp; sourceTree = "<group>"; };
+               DF93D7CE1444B105007C6459 /* ZipFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipFile.h; sourceTree = "<group>"; };
+               DF93D81A1444B86B007C6459 /* HDHomeRunDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunDirectory.cpp; sourceTree = "<group>"; };
+               DF93D81B1444B86B007C6459 /* HDHomeRunDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunDirectory.h; sourceTree = "<group>"; };
+               DF93D81C1444B86B007C6459 /* HDHomeRunFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunFile.cpp; sourceTree = "<group>"; };
+               DF93D81D1444B86B007C6459 /* HDHomeRunFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunFile.h; sourceTree = "<group>"; };
                DF98D9971434F49500A6EBE1 /* SkinVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkinVariable.cpp; sourceTree = "<group>"; };
                DF98D9981434F49500A6EBE1 /* SkinVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkinVariable.h; sourceTree = "<group>"; };
                DFA6BE4113FECA010048CC11 /* AirPlayServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirPlayServer.cpp; sourceTree = "<group>"; };
                DFCA6AE915224671000BFAAE /* IHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IHTTPRequestHandler.h; sourceTree = "<group>"; };
                DFCFC5261413F7D60004D0BF /* AFPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPDirectory.cpp; sourceTree = "<group>"; };
                DFCFC5271413F7D60004D0BF /* AFPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPDirectory.h; sourceTree = "<group>"; };
-               DFCFC5281413F7D60004D0BF /* FileAFP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileAFP.cpp; sourceTree = "<group>"; };
-               DFCFC5291413F7D60004D0BF /* FileAFP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileAFP.h; sourceTree = "<group>"; };
                DFD4D1D113D725ED00A47C47 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                DFD4D1D213D725ED00A47C47 /* CriticalSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CriticalSection.h; sourceTree = "<group>"; };
                DFD4D1D613D725ED00A47C47 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                DFD4D1E613D7263000A47C47 /* README.platform */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.platform; sourceTree = "<group>"; };
                DFD4D1FC13D7283500A47C47 /* SystemClock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemClock.cpp; sourceTree = "<group>"; };
                DFD4D1FD13D7283500A47C47 /* SystemClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemClock.h; sourceTree = "<group>"; };
+               DFDB001C1516403A005079A4 /* CircularCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CircularCache.cpp; sourceTree = "<group>"; };
+               DFDB001D1516403A005079A4 /* CircularCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircularCache.h; sourceTree = "<group>"; };
+               DFDB001E1516403A005079A4 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
+               DFDB001F1516403A005079A4 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
+               DFDB00201516403A005079A4 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
+               DFDB00211516403A005079A4 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
+               DFDB00221516403A005079A4 /* MemBufferCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemBufferCache.cpp; sourceTree = "<group>"; };
+               DFDB00231516403A005079A4 /* MemBufferCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemBufferCache.h; sourceTree = "<group>"; };
                F558F60613AFDC1700631E12 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                F558F61013AFDC3000631E12 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
                F56B143312CAF279009B4C96 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
                F56C8384131F42E8000AD0F6 /* MusicFileDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicFileDirectory.cpp; sourceTree = "<group>"; };
                F56C8385131F42E8000AD0F6 /* MusicFileDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicFileDirectory.h; sourceTree = "<group>"; };
                F56C8386131F42E8000AD0F6 /* MythSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythSession.cpp; sourceTree = "<group>"; };
-               F56C8387131F42E8000AD0F6 /* FileSmb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSmb.cpp; sourceTree = "<group>"; };
                F56C8388131F42E8000AD0F6 /* SMBDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SMBDirectory.cpp; sourceTree = "<group>"; };
                F56C8389131F42E8000AD0F6 /* MythDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythDirectory.cpp; sourceTree = "<group>"; };
                F56C838A131F42E8000AD0F6 /* MythDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MythDirectory.h; sourceTree = "<group>"; };
                F56C838B131F42E8000AD0F6 /* MythFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythFile.cpp; sourceTree = "<group>"; };
                F56C838C131F42E8000AD0F6 /* MythFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MythFile.h; sourceTree = "<group>"; };
-               F56C838D131F42E8000AD0F6 /* FileShoutcast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileShoutcast.cpp; sourceTree = "<group>"; };
-               F56C838E131F42E8000AD0F6 /* CacheMemBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheMemBuffer.cpp; sourceTree = "<group>"; };
-               F56C838F131F42E8000AD0F6 /* CacheMemBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheMemBuffer.h; sourceTree = "<group>"; };
                F56C8390131F42E8000AD0F6 /* CacheStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStrategy.cpp; sourceTree = "<group>"; };
                F56C8391131F42E8000AD0F6 /* CacheStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStrategy.h; sourceTree = "<group>"; };
                F56C8392131F42E8000AD0F6 /* CDDADirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDADirectory.cpp; sourceTree = "<group>"; };
                F56C8397131F42E8000AD0F6 /* DAVDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAVDirectory.h; sourceTree = "<group>"; };
                F56C8398131F42E8000AD0F6 /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Directory.cpp; sourceTree = "<group>"; };
                F56C8399131F42E8000AD0F6 /* Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Directory.h; sourceTree = "<group>"; };
-               F56C839A131F42E8000AD0F6 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
-               F56C839B131F42E8000AD0F6 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
                F56C839C131F42E8000AD0F6 /* DirectoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryHistory.cpp; sourceTree = "<group>"; };
                F56C839D131F42E8000AD0F6 /* DirectoryHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryHistory.h; sourceTree = "<group>"; };
-               F56C839E131F42E8000AD0F6 /* DirectoryTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryTuxBox.cpp; sourceTree = "<group>"; };
-               F56C839F131F42E8000AD0F6 /* DirectoryTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryTuxBox.h; sourceTree = "<group>"; };
                F56C83A0131F42E8000AD0F6 /* DllLibCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DllLibCurl.cpp; sourceTree = "<group>"; };
                F56C83A1131F42E8000AD0F6 /* DllLibCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DllLibCurl.h; sourceTree = "<group>"; };
-               F56C83A2131F42E8000AD0F6 /* FactoryDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryDirectory.cpp; sourceTree = "<group>"; };
-               F56C83A3131F42E8000AD0F6 /* FactoryDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryDirectory.h; sourceTree = "<group>"; };
-               F56C83A4131F42E8000AD0F6 /* FactoryFileDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryFileDirectory.cpp; sourceTree = "<group>"; };
-               F56C83A5131F42E8000AD0F6 /* FactoryFileDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryFileDirectory.h; sourceTree = "<group>"; };
                F56C83A6131F42E8000AD0F6 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = "<group>"; };
                F56C83A7131F42E8000AD0F6 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = "<group>"; };
-               F56C83A8131F42E8000AD0F6 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
-               F56C83A9131F42E8000AD0F6 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
-               F56C83AA131F42E8000AD0F6 /* FileCDDA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCDDA.cpp; sourceTree = "<group>"; };
-               F56C83AB131F42E8000AD0F6 /* FileCDDA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCDDA.h; sourceTree = "<group>"; };
-               F56C83AC131F42E8000AD0F6 /* FileCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCurl.cpp; sourceTree = "<group>"; };
-               F56C83AD131F42E8000AD0F6 /* FileCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCurl.h; sourceTree = "<group>"; };
-               F56C83AE131F42E8000AD0F6 /* FileDAAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDAAP.cpp; sourceTree = "<group>"; };
-               F56C83AF131F42E8000AD0F6 /* FileDAAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDAAP.h; sourceTree = "<group>"; };
                F56C83B0131F42E8000AD0F6 /* FileFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFactory.cpp; sourceTree = "<group>"; };
                F56C83B1131F42E8000AD0F6 /* FileFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFactory.h; sourceTree = "<group>"; };
-               F56C83B2131F42E8000AD0F6 /* FileFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFileReader.cpp; sourceTree = "<group>"; };
-               F56C83B3131F42E8000AD0F6 /* FileFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFileReader.h; sourceTree = "<group>"; };
-               F56C83B4131F42E8000AD0F6 /* FileHD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileHD.cpp; sourceTree = "<group>"; };
-               F56C83B5131F42E8000AD0F6 /* FileHD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileHD.h; sourceTree = "<group>"; };
-               F56C83B6131F42E8000AD0F6 /* FileISO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileISO.cpp; sourceTree = "<group>"; };
-               F56C83B7131F42E8000AD0F6 /* FileISO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileISO.h; sourceTree = "<group>"; };
-               F56C83B8131F42E8000AD0F6 /* FileLastFM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileLastFM.cpp; sourceTree = "<group>"; };
-               F56C83B9131F42E8000AD0F6 /* FileLastFM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileLastFM.h; sourceTree = "<group>"; };
-               F56C83BA131F42E8000AD0F6 /* FileMusicDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileMusicDatabase.cpp; sourceTree = "<group>"; };
-               F56C83BB131F42E8000AD0F6 /* FileMusicDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMusicDatabase.h; sourceTree = "<group>"; };
-               F56C83BC131F42E8000AD0F6 /* FileRar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRar.cpp; sourceTree = "<group>"; };
-               F56C83BD131F42E8000AD0F6 /* FileRar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRar.h; sourceTree = "<group>"; };
-               F56C83BE131F42E8000AD0F6 /* FileRTV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRTV.cpp; sourceTree = "<group>"; };
-               F56C83BF131F42E8000AD0F6 /* FileRTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRTV.h; sourceTree = "<group>"; };
-               F56C83C0131F42E8000AD0F6 /* FileSFTP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSFTP.cpp; sourceTree = "<group>"; };
-               F56C83C1131F42E8000AD0F6 /* FileSFTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSFTP.h; sourceTree = "<group>"; };
-               F56C83C2131F42E8000AD0F6 /* FileSmb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSmb.h; sourceTree = "<group>"; };
-               F56C83C3131F42E8000AD0F6 /* FileSpecialProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSpecialProtocol.cpp; sourceTree = "<group>"; };
-               F56C83C4131F42E8000AD0F6 /* FileSpecialProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSpecialProtocol.h; sourceTree = "<group>"; };
-               F56C83C5131F42E8000AD0F6 /* FileTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileTuxBox.cpp; sourceTree = "<group>"; };
-               F56C83C6131F42E8000AD0F6 /* FileTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTuxBox.h; sourceTree = "<group>"; };
-               F56C83C7131F42E8000AD0F6 /* FileUDF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUDF.cpp; sourceTree = "<group>"; };
-               F56C83C8131F42E8000AD0F6 /* FileUDF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUDF.h; sourceTree = "<group>"; };
-               F56C83CB131F42E8000AD0F6 /* FileZip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileZip.cpp; sourceTree = "<group>"; };
-               F56C83CC131F42E8000AD0F6 /* FileZip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileZip.h; sourceTree = "<group>"; };
                F56C83CD131F42E8000AD0F6 /* FTPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPDirectory.cpp; sourceTree = "<group>"; };
                F56C83CE131F42E8000AD0F6 /* FTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPDirectory.h; sourceTree = "<group>"; };
                F56C83CF131F42E8000AD0F6 /* FTPParse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPParse.cpp; sourceTree = "<group>"; };
                F56C83D0131F42E8000AD0F6 /* FTPParse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPParse.h; sourceTree = "<group>"; };
                F56C83D1131F42E8000AD0F6 /* HDDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDDirectory.cpp; sourceTree = "<group>"; };
                F56C83D2131F42E8000AD0F6 /* HDDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDirectory.h; sourceTree = "<group>"; };
-               F56C83D3131F42E8000AD0F6 /* HDHomeRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRun.cpp; sourceTree = "<group>"; };
-               F56C83D4131F42E8000AD0F6 /* HDHomeRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRun.h; sourceTree = "<group>"; };
                F56C83D5131F42E8000AD0F6 /* HTSPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPDirectory.h; sourceTree = "<group>"; };
                F56C83D6131F42E8000AD0F6 /* HTSPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTSPDirectory.cpp; sourceTree = "<group>"; };
                F56C83D7131F42E8000AD0F6 /* HTSPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPSession.h; sourceTree = "<group>"; };
                                F56C8380131F42E8000AD0F6 /* AddonsDirectory.h */,
                                DFCFC5261413F7D60004D0BF /* AFPDirectory.cpp */,
                                DFCFC5271413F7D60004D0BF /* AFPDirectory.h */,
+                               DF93D7971444B105007C6459 /* AFPFile.cpp */,
+                               DF93D7981444B105007C6459 /* AFPFile.h */,
                                F56C8382131F42E8000AD0F6 /* ASAPFileDirectory.cpp */,
                                F56C8383131F42E8000AD0F6 /* ASAPFileDirectory.h */,
-                               7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */,
-                               7C99B6E8133D36E200FC2B16 /* CacheCircular.h */,
-                               F56C838E131F42E8000AD0F6 /* CacheMemBuffer.cpp */,
-                               F56C838F131F42E8000AD0F6 /* CacheMemBuffer.h */,
                                F56C8390131F42E8000AD0F6 /* CacheStrategy.cpp */,
                                F56C8391131F42E8000AD0F6 /* CacheStrategy.h */,
                                F56C8392131F42E8000AD0F6 /* CDDADirectory.cpp */,
                                F56C8393131F42E8000AD0F6 /* CDDADirectory.h */,
+                               DF93D79D1444B105007C6459 /* CDDAFile.cpp */,
+                               DF93D79E1444B105007C6459 /* CDDAFile.h */,
+                               DFDB001C1516403A005079A4 /* CircularCache.cpp */,
+                               DFDB001D1516403A005079A4 /* CircularCache.h */,
+                               DF93D79F1444B105007C6459 /* CurlFile.cpp */,
+                               DF93D7A01444B105007C6459 /* CurlFile.h */,
                                F56C8394131F42E8000AD0F6 /* DAAPDirectory.cpp */,
                                F56C8395131F42E8000AD0F6 /* DAAPDirectory.h */,
+                               DF93D7A11444B105007C6459 /* DAAPFile.cpp */,
+                               DF93D7A21444B105007C6459 /* DAAPFile.h */,
                                F56C8396131F42E8000AD0F6 /* DAVDirectory.cpp */,
                                F56C8397131F42E8000AD0F6 /* DAVDirectory.h */,
                                F56C8398131F42E8000AD0F6 /* Directory.cpp */,
                                F56C8399131F42E8000AD0F6 /* Directory.h */,
-                               F56C839A131F42E8000AD0F6 /* DirectoryCache.cpp */,
-                               F56C839B131F42E8000AD0F6 /* DirectoryCache.h */,
+                               DFDB001E1516403A005079A4 /* DirectoryCache.cpp */,
+                               DFDB001F1516403A005079A4 /* DirectoryCache.h */,
+                               DF93D7A31444B105007C6459 /* DirectoryFactory.cpp */,
+                               DF93D7A41444B105007C6459 /* DirectoryFactory.h */,
                                F56C839C131F42E8000AD0F6 /* DirectoryHistory.cpp */,
                                F56C839D131F42E8000AD0F6 /* DirectoryHistory.h */,
-                               F56C839E131F42E8000AD0F6 /* DirectoryTuxBox.cpp */,
-                               F56C839F131F42E8000AD0F6 /* DirectoryTuxBox.h */,
                                F56C83A0131F42E8000AD0F6 /* DllLibCurl.cpp */,
                                F56C83A1131F42E8000AD0F6 /* DllLibCurl.h */,
-                               F56C83A2131F42E8000AD0F6 /* FactoryDirectory.cpp */,
-                               F56C83A3131F42E8000AD0F6 /* FactoryDirectory.h */,
-                               F56C83A4131F42E8000AD0F6 /* FactoryFileDirectory.cpp */,
-                               F56C83A5131F42E8000AD0F6 /* FactoryFileDirectory.h */,
                                F56C83A6131F42E8000AD0F6 /* File.cpp */,
                                F56C83A7131F42E8000AD0F6 /* File.h */,
-                               DFCFC5281413F7D60004D0BF /* FileAFP.cpp */,
-                               DFCFC5291413F7D60004D0BF /* FileAFP.h */,
-                               F56C83A8131F42E8000AD0F6 /* FileCache.cpp */,
-                               F56C83A9131F42E8000AD0F6 /* FileCache.h */,
-                               F56C83AA131F42E8000AD0F6 /* FileCDDA.cpp */,
-                               F56C83AB131F42E8000AD0F6 /* FileCDDA.h */,
-                               F56C83AC131F42E8000AD0F6 /* FileCurl.cpp */,
-                               F56C83AD131F42E8000AD0F6 /* FileCurl.h */,
-                               F56C83AE131F42E8000AD0F6 /* FileDAAP.cpp */,
-                               F56C83AF131F42E8000AD0F6 /* FileDAAP.h */,
+                               DFDB00201516403A005079A4 /* FileCache.cpp */,
+                               DFDB00211516403A005079A4 /* FileCache.h */,
+                               DF93D7A51444B105007C6459 /* FileDirectoryFactory.cpp */,
+                               DF93D7A61444B105007C6459 /* FileDirectoryFactory.h */,
                                F56C83B0131F42E8000AD0F6 /* FileFactory.cpp */,
                                F56C83B1131F42E8000AD0F6 /* FileFactory.h */,
-                               F56C83B2131F42E8000AD0F6 /* FileFileReader.cpp */,
-                               F56C83B3131F42E8000AD0F6 /* FileFileReader.h */,
-                               F56C83B4131F42E8000AD0F6 /* FileHD.cpp */,
-                               F56C83B5131F42E8000AD0F6 /* FileHD.h */,
-                               F56C83B6131F42E8000AD0F6 /* FileISO.cpp */,
-                               F56C83B7131F42E8000AD0F6 /* FileISO.h */,
-                               F56C83B8131F42E8000AD0F6 /* FileLastFM.cpp */,
-                               F56C83B9131F42E8000AD0F6 /* FileLastFM.h */,
-                               F56C83BA131F42E8000AD0F6 /* FileMusicDatabase.cpp */,
-                               F56C83BB131F42E8000AD0F6 /* FileMusicDatabase.h */,
-                               DF0DF17B13A3AF9F008ED511 /* FileNFS.cpp */,
-                               DF0DF17C13A3AF9F008ED511 /* FileNFS.h */,
-                               DF44856D140065E10069344B /* FilePipe.cpp */,
-                               DF44856E140065E10069344B /* FilePipe.h */,
-                               F56C83BC131F42E8000AD0F6 /* FileRar.cpp */,
-                               F56C83BD131F42E8000AD0F6 /* FileRar.h */,
-                               F56C83BE131F42E8000AD0F6 /* FileRTV.cpp */,
-                               F56C83BF131F42E8000AD0F6 /* FileRTV.h */,
-                               F56C83C0131F42E8000AD0F6 /* FileSFTP.cpp */,
-                               F56C83C1131F42E8000AD0F6 /* FileSFTP.h */,
-                               F56C838D131F42E8000AD0F6 /* FileShoutcast.cpp */,
-                               F56C8387131F42E8000AD0F6 /* FileSmb.cpp */,
-                               F56C83C2131F42E8000AD0F6 /* FileSmb.h */,
-                               F56C83C3131F42E8000AD0F6 /* FileSpecialProtocol.cpp */,
-                               F56C83C4131F42E8000AD0F6 /* FileSpecialProtocol.h */,
-                               F56C83C5131F42E8000AD0F6 /* FileTuxBox.cpp */,
-                               F56C83C6131F42E8000AD0F6 /* FileTuxBox.h */,
-                               F56C83C7131F42E8000AD0F6 /* FileUDF.cpp */,
-                               F56C83C8131F42E8000AD0F6 /* FileUDF.h */,
-                               DF6739E01443765F00A5A509 /* FileUPnP.cpp */,
-                               DF6739E11443765F00A5A509 /* FileUPnP.h */,
-                               F56C83CB131F42E8000AD0F6 /* FileZip.cpp */,
-                               F56C83CC131F42E8000AD0F6 /* FileZip.h */,
+                               DF93D7A71444B105007C6459 /* FileReaderFile.cpp */,
+                               DF93D7A81444B105007C6459 /* FileReaderFile.h */,
                                F56C83CD131F42E8000AD0F6 /* FTPDirectory.cpp */,
                                F56C83CE131F42E8000AD0F6 /* FTPDirectory.h */,
                                F56C83CF131F42E8000AD0F6 /* FTPParse.cpp */,
                                F56C83D0131F42E8000AD0F6 /* FTPParse.h */,
                                F56C83D1131F42E8000AD0F6 /* HDDirectory.cpp */,
                                F56C83D2131F42E8000AD0F6 /* HDDirectory.h */,
-                               F56C83D3131F42E8000AD0F6 /* HDHomeRun.cpp */,
-                               F56C83D4131F42E8000AD0F6 /* HDHomeRun.h */,
+                               DF93D7A91444B105007C6459 /* HDFile.cpp */,
+                               DF93D7AA1444B105007C6459 /* HDFile.h */,
+                               DF93D81A1444B86B007C6459 /* HDHomeRunDirectory.cpp */,
+                               DF93D81B1444B86B007C6459 /* HDHomeRunDirectory.h */,
+                               DF93D81C1444B86B007C6459 /* HDHomeRunFile.cpp */,
+                               DF93D81D1444B86B007C6459 /* HDHomeRunFile.h */,
                                F56C83D6131F42E8000AD0F6 /* HTSPDirectory.cpp */,
                                F56C83D5131F42E8000AD0F6 /* HTSPDirectory.h */,
                                F56C83D8131F42E8000AD0F6 /* HTSPSession.cpp */,
                                F56C83E1131F42E8000AD0F6 /* iso9660.h */,
                                F56C83E2131F42E8000AD0F6 /* ISO9660Directory.cpp */,
                                F56C83E3131F42E8000AD0F6 /* ISO9660Directory.h */,
+                               DF93D7AB1444B105007C6459 /* ISOFile.cpp */,
+                               DF93D7AC1444B105007C6459 /* ISOFile.h */,
                                F56C83E4131F42E8000AD0F6 /* LastFMDirectory.cpp */,
                                F56C83E5131F42E8000AD0F6 /* LastFMDirectory.h */,
+                               DF93D7AD1444B105007C6459 /* LastFMFile.cpp */,
+                               DF93D7AE1444B105007C6459 /* LastFMFile.h */,
+                               DFDB00221516403A005079A4 /* MemBufferCache.cpp */,
+                               DFDB00231516403A005079A4 /* MemBufferCache.h */,
                                F56C83E6131F42E8000AD0F6 /* MultiPathDirectory.cpp */,
                                F56C83E7131F42E8000AD0F6 /* MultiPathDirectory.h */,
                                F56C83E8131F42E8000AD0F6 /* MultiPathFile.cpp */,
                                F56C83E9131F42E8000AD0F6 /* MultiPathFile.h */,
                                F56C8417131F42E8000AD0F6 /* MusicDatabaseDirectory.cpp */,
                                F56C8418131F42E8000AD0F6 /* MusicDatabaseDirectory.h */,
+                               DF93D7AF1444B105007C6459 /* MusicDatabaseFile.cpp */,
+                               DF93D7B01444B105007C6459 /* MusicDatabaseFile.h */,
                                F56C8384131F42E8000AD0F6 /* MusicFileDirectory.cpp */,
                                F56C8385131F42E8000AD0F6 /* MusicFileDirectory.h */,
                                F56C8419131F42E8000AD0F6 /* MusicSearchDirectory.cpp */,
                                F56C8386131F42E8000AD0F6 /* MythSession.cpp */,
                                DF0DF17D13A3AF9F008ED511 /* NFSDirectory.cpp */,
                                DF0DF17E13A3AF9F008ED511 /* NFSDirectory.h */,
+                               DF93D7B11444B105007C6459 /* NFSFile.cpp */,
+                               DF93D7B21444B105007C6459 /* NFSFile.h */,
                                F56C837D131F42E8000AD0F6 /* NptXbmcFile.cpp */,
                                F56C841B131F42E8000AD0F6 /* NSFFileDirectory.cpp */,
                                F56C841C131F42E8000AD0F6 /* NSFFileDirectory.h */,
                                F56C841D131F42E8000AD0F6 /* OGGFileDirectory.cpp */,
                                F56C841E131F42E8000AD0F6 /* OGGFileDirectory.h */,
+                               DF93D7B31444B105007C6459 /* PipeFile.cpp */,
+                               DF93D7B41444B105007C6459 /* PipeFile.h */,
                                DF44856F140065E10069344B /* PipesManager.cpp */,
                                DF448570140065E10069344B /* PipesManager.h */,
                                F56C841F131F42E8000AD0F6 /* PlaylistDirectory.cpp */,
                                F56C8424131F42E8000AD0F6 /* PluginDirectory.h */,
                                F56C8425131F42E8000AD0F6 /* RarDirectory.cpp */,
                                F56C8426131F42E8000AD0F6 /* RarDirectory.h */,
+                               DF93D7B51444B105007C6459 /* RarFile.cpp */,
+                               DF93D7B61444B105007C6459 /* RarFile.h */,
                                F56C8427131F42E8000AD0F6 /* RarManager.cpp */,
                                F56C8428131F42E8000AD0F6 /* RarManager.h */,
                                F56C837E131F42E8000AD0F6 /* RSSDirectory.cpp */,
                                F56C837F131F42E8000AD0F6 /* RSSDirectory.h */,
                                F56C8429131F42E8000AD0F6 /* RTVDirectory.cpp */,
                                F56C842A131F42E8000AD0F6 /* RTVDirectory.h */,
+                               DF93D7B71444B105007C6459 /* RTVFile.cpp */,
+                               DF93D7B81444B105007C6459 /* RTVFile.h */,
                                F56C842C131F42E8000AD0F6 /* SAPDirectory.cpp */,
                                F56C842B131F42E8000AD0F6 /* SAPDirectory.h */,
                                F56C842E131F42E8000AD0F6 /* SAPFile.cpp */,
                                F56C842D131F42E8000AD0F6 /* SAPFile.h */,
                                F56C842F131F42E8000AD0F6 /* SFTPDirectory.cpp */,
                                F56C8430131F42E8000AD0F6 /* SFTPDirectory.h */,
+                               DF93D7B91444B105007C6459 /* SFTPFile.cpp */,
+                               DF93D7BA1444B105007C6459 /* SFTPFile.h */,
+                               DF93D7BB1444B105007C6459 /* ShoutcastFile.cpp */,
+                               DF93D7BC1444B105007C6459 /* ShoutcastFile.h */,
                                F56C8431131F42E8000AD0F6 /* SIDFileDirectory.cpp */,
                                F56C8432131F42E8000AD0F6 /* SIDFileDirectory.h */,
-                               18404DD41396C3F300863BBA /* Slingbox.cpp */,
-                               18404DD51396C3F300863BBA /* Slingbox.h */,
+                               DF93D7BD1444B105007C6459 /* SlingboxDirectory.cpp */,
+                               DF93D7BE1444B105007C6459 /* SlingboxDirectory.h */,
+                               DF93D7BF1444B105007C6459 /* SlingboxFile.cpp */,
+                               DF93D7C01444B105007C6459 /* SlingboxFile.h */,
                                F56C8433131F42E8000AD0F6 /* SmartPlaylistDirectory.cpp */,
                                F56C8434131F42E8000AD0F6 /* SmartPlaylistDirectory.h */,
                                F56C8388131F42E8000AD0F6 /* SMBDirectory.cpp */,
                                F56C8435131F42E8000AD0F6 /* SMBDirectory.h */,
+                               DF93D7C11444B105007C6459 /* SmbFile.cpp */,
+                               DF93D7C21444B105007C6459 /* SmbFile.h */,
                                F57A1DB61329FAF700498CC7 /* SourcesDirectory.cpp */,
                                F57A1DB71329FAF700498CC7 /* SourcesDirectory.h */,
                                F56C8379131F42E8000AD0F6 /* SpecialProtocol.cpp */,
                                F56C837A131F42E8000AD0F6 /* SpecialProtocol.h */,
                                F56C837B131F42E8000AD0F6 /* SpecialProtocolDirectory.cpp */,
                                F56C837C131F42E8000AD0F6 /* SpecialProtocolDirectory.h */,
+                               DF93D7C31444B105007C6459 /* SpecialProtocolFile.cpp */,
+                               DF93D7C41444B105007C6459 /* SpecialProtocolFile.h */,
                                F56C8436131F42E8000AD0F6 /* StackDirectory.cpp */,
                                F56C8437131F42E8000AD0F6 /* StackDirectory.h */,
+                               DF93D7C51444B105007C6459 /* TuxBoxDirectory.cpp */,
+                               DF93D7C61444B105007C6459 /* TuxBoxDirectory.h */,
+                               DF93D7C71444B105007C6459 /* TuxBoxFile.cpp */,
+                               DF93D7C81444B105007C6459 /* TuxBoxFile.h */,
                                F56C8438131F42E8000AD0F6 /* udf25.cpp */,
                                F56C8439131F42E8000AD0F6 /* udf25.h */,
                                F56C843A131F42E8000AD0F6 /* UDFDirectory.cpp */,
                                F56C843B131F42E8000AD0F6 /* UDFDirectory.h */,
+                               DF93D7C91444B105007C6459 /* UDFFile.cpp */,
+                               DF93D7CA1444B105007C6459 /* UDFFile.h */,
                                F56C843C131F42E8000AD0F6 /* UPnPDirectory.cpp */,
                                F56C843D131F42E8000AD0F6 /* UPnPDirectory.h */,
+                               DF93D7CB1444B105007C6459 /* UPnPFile.cpp */,
+                               DF93D7CC1444B105007C6459 /* UPnPFile.h */,
                                F56C8473131F42E8000AD0F6 /* VideoDatabaseDirectory.cpp */,
                                F56C8474131F42E8000AD0F6 /* VideoDatabaseDirectory.h */,
                                F56C8475131F42E8000AD0F6 /* VirtualDirectory.cpp */,
                                F56C847B131F42E9000AD0F6 /* ZeroconfDirectory.h */,
                                F56C847E131F42E9000AD0F6 /* ZipDirectory.cpp */,
                                F56C847F131F42E9000AD0F6 /* ZipDirectory.h */,
+                               DF93D7CD1444B105007C6459 /* ZipFile.cpp */,
+                               DF93D7CE1444B105007C6459 /* ZipFile.h */,
                                F56C8480131F42E9000AD0F6 /* ZipManager.cpp */,
                                F56C8481131F42E9000AD0F6 /* ZipManager.h */,
                        );
                                F56C895B131F42ED000AD0F6 /* ASAPFileDirectory.cpp in Sources */,
                                F56C895C131F42ED000AD0F6 /* MusicFileDirectory.cpp in Sources */,
                                F56C895D131F42ED000AD0F6 /* MythSession.cpp in Sources */,
-                               F56C895E131F42ED000AD0F6 /* FileSmb.cpp in Sources */,
                                F56C895F131F42ED000AD0F6 /* SMBDirectory.cpp in Sources */,
                                F56C8960131F42ED000AD0F6 /* MythDirectory.cpp in Sources */,
                                F56C8961131F42ED000AD0F6 /* MythFile.cpp in Sources */,
-                               F56C8962131F42ED000AD0F6 /* FileShoutcast.cpp in Sources */,
-                               F56C8963131F42ED000AD0F6 /* CacheMemBuffer.cpp in Sources */,
                                F56C8964131F42ED000AD0F6 /* CacheStrategy.cpp in Sources */,
                                F56C8965131F42ED000AD0F6 /* CDDADirectory.cpp in Sources */,
                                F56C8966131F42ED000AD0F6 /* DAAPDirectory.cpp in Sources */,
                                F56C8967131F42ED000AD0F6 /* DAVDirectory.cpp in Sources */,
                                F56C8968131F42ED000AD0F6 /* Directory.cpp in Sources */,
-                               F56C8969131F42ED000AD0F6 /* DirectoryCache.cpp in Sources */,
                                F56C896A131F42ED000AD0F6 /* DirectoryHistory.cpp in Sources */,
-                               F56C896B131F42ED000AD0F6 /* DirectoryTuxBox.cpp in Sources */,
                                F56C896C131F42ED000AD0F6 /* DllLibCurl.cpp in Sources */,
-                               F56C896D131F42ED000AD0F6 /* FactoryDirectory.cpp in Sources */,
-                               F56C896E131F42ED000AD0F6 /* FactoryFileDirectory.cpp in Sources */,
                                F56C896F131F42ED000AD0F6 /* File.cpp in Sources */,
-                               F56C8970131F42ED000AD0F6 /* FileCache.cpp in Sources */,
-                               F56C8971131F42ED000AD0F6 /* FileCDDA.cpp in Sources */,
-                               F56C8972131F42ED000AD0F6 /* FileCurl.cpp in Sources */,
-                               F56C8973131F42ED000AD0F6 /* FileDAAP.cpp in Sources */,
                                F56C8974131F42ED000AD0F6 /* FileFactory.cpp in Sources */,
-                               F56C8975131F42ED000AD0F6 /* FileFileReader.cpp in Sources */,
-                               F56C8976131F42ED000AD0F6 /* FileHD.cpp in Sources */,
-                               F56C8977131F42ED000AD0F6 /* FileISO.cpp in Sources */,
-                               F56C8978131F42ED000AD0F6 /* FileLastFM.cpp in Sources */,
-                               F56C8979131F42ED000AD0F6 /* FileMusicDatabase.cpp in Sources */,
-                               F56C897A131F42ED000AD0F6 /* FileRar.cpp in Sources */,
-                               F56C897B131F42ED000AD0F6 /* FileRTV.cpp in Sources */,
-                               F56C897C131F42ED000AD0F6 /* FileSFTP.cpp in Sources */,
-                               F56C897D131F42ED000AD0F6 /* FileSpecialProtocol.cpp in Sources */,
-                               F56C897E131F42ED000AD0F6 /* FileTuxBox.cpp in Sources */,
-                               F56C897F131F42ED000AD0F6 /* FileUDF.cpp in Sources */,
-                               F56C8981131F42ED000AD0F6 /* FileZip.cpp in Sources */,
                                F56C8982131F42ED000AD0F6 /* FTPDirectory.cpp in Sources */,
                                F56C8983131F42ED000AD0F6 /* FTPParse.cpp in Sources */,
                                F56C8984131F42ED000AD0F6 /* HDDirectory.cpp in Sources */,
-                               F56C8985131F42ED000AD0F6 /* HDHomeRun.cpp in Sources */,
                                F56C8986131F42ED000AD0F6 /* HTSPDirectory.cpp in Sources */,
                                F56C8987131F42ED000AD0F6 /* HTSPSession.cpp in Sources */,
                                F56C8988131F42ED000AD0F6 /* HTTPDirectory.cpp in Sources */,
                                F56C8BAB131F4466000AD0F6 /* XBMCEAGLView.mm in Sources */,
                                F57A1DB81329FAF700498CC7 /* SourcesDirectory.cpp in Sources */,
                                F5B13DCF1334490D0045076D /* DarwinUtils.mm in Sources */,
-                               7C99B6E9133D36E200FC2B16 /* CacheCircular.cpp in Sources */,
                                7C99B7BE1340730000FC2B16 /* GUIDialogPlayEject.cpp in Sources */,
                                F5AE413D1341754C0004BD79 /* HttpApi.cpp in Sources */,
                                F5AE413E1341754C0004BD79 /* XBMChttp.cpp in Sources */,
                                18ACF8FD13597B5700B67371 /* RecentlyAddedJob.cpp in Sources */,
                                C80711AD135DB85F002F601B /* InputOperations.cpp in Sources */,
                                C8EC5D26136953E100CCC10D /* XBMC_keytable.cpp in Sources */,
-                               18404DD61396C3F300863BBA /* Slingbox.cpp in Sources */,
                                1840B77A1399616D007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B77B1399616D007C848B /* JSONVariantWriter.cpp in Sources */,
                                7C0A7EDE13A5DC2800AFC2BD /* AppParamParser.cpp in Sources */,
                                7C0A7F9D13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */,
                                7C0A7FB213A9E72E00AFC2BD /* DirtyRegionSolvers.cpp in Sources */,
                                7C0A7FB313A9E72E00AFC2BD /* DirtyRegionTracker.cpp in Sources */,
-                               DF0DF17F13A3AF9F008ED511 /* FileNFS.cpp in Sources */,
                                DF0DF18013A3AF9F008ED511 /* NFSDirectory.cpp in Sources */,
                                7C89628013B7031E003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
                                1830219E13B8E37300770920 /* controledit.cpp in Sources */,
                                DFA6BE7713FED09C0048CC11 /* HttpParser.cpp in Sources */,
                                18968DDE14155E01005BA742 /* ApplicationOperations.cpp in Sources */,
                                DFCFC52A1413F7D60004D0BF /* AFPDirectory.cpp in Sources */,
-                               DFCFC52B1413F7D60004D0BF /* FileAFP.cpp in Sources */,
                                3291892B1423A9B700E878CD /* JpegIO.cpp in Sources */,
                                DF44856C140065C60069344B /* BXAcodec.cpp in Sources */,
-                               DF448571140065E10069344B /* FilePipe.cpp in Sources */,
                                DF448572140065E10069344B /* PipesManager.cpp in Sources */,
                                DF4485751400662D0069344B /* AirTunesServer.cpp in Sources */,
                                DF98D9991434F49500A6EBE1 /* SkinVariable.cpp in Sources */,
                                F5E112E8143577A000175026 /* GUIDialogPeripheralManager.cpp in Sources */,
                                F5E112E9143577A000175026 /* GUIDialogPeripheralSettings.cpp in Sources */,
                                F5E112EC143577A000175026 /* Peripherals.cpp in Sources */,
-                               DF6739E21443765F00A5A509 /* FileUPnP.cpp in Sources */,
                                F5BD034F148D496A001B5583 /* CryptThreading.cpp in Sources */,
                                7CCFD9991514950700211D82 /* PCMCodec.cpp in Sources */,
                                DF527757151BAF8200B5B63B /* WebSocket.cpp in Sources */,
                                DFCA6AEE15224671000BFAAE /* HTTPWebinterfaceAddonsHandler.cpp in Sources */,
                                DFCA6AEF15224671000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */,
                                DFCA6AF015224671000BFAAE /* IHTTPRequestHandler.cpp in Sources */,
+                               DF93D7CF1444B105007C6459 /* AFPFile.cpp in Sources */,
+                               DF93D7D21444B105007C6459 /* CDDAFile.cpp in Sources */,
+                               DF93D7D31444B105007C6459 /* CurlFile.cpp in Sources */,
+                               DF93D7D41444B105007C6459 /* DAAPFile.cpp in Sources */,
+                               DF93D7D51444B105007C6459 /* DirectoryFactory.cpp in Sources */,
+                               DF93D7D61444B105007C6459 /* FileDirectoryFactory.cpp in Sources */,
+                               DF93D7D71444B105007C6459 /* FileReaderFile.cpp in Sources */,
+                               DF93D7D81444B105007C6459 /* HDFile.cpp in Sources */,
+                               DF93D7D91444B105007C6459 /* ISOFile.cpp in Sources */,
+                               DF93D7DA1444B105007C6459 /* LastFMFile.cpp in Sources */,
+                               DF93D7DB1444B105007C6459 /* MusicDatabaseFile.cpp in Sources */,
+                               DF93D7DC1444B105007C6459 /* NFSFile.cpp in Sources */,
+                               DF93D7DD1444B105007C6459 /* PipeFile.cpp in Sources */,
+                               DF93D7DE1444B105007C6459 /* RarFile.cpp in Sources */,
+                               DF93D7DF1444B105007C6459 /* RTVFile.cpp in Sources */,
+                               DF93D7E01444B105007C6459 /* SFTPFile.cpp in Sources */,
+                               DF93D7E11444B105007C6459 /* ShoutcastFile.cpp in Sources */,
+                               DF93D7E21444B105007C6459 /* SlingboxDirectory.cpp in Sources */,
+                               DF93D7E31444B105007C6459 /* SlingboxFile.cpp in Sources */,
+                               DF93D7E41444B105007C6459 /* SmbFile.cpp in Sources */,
+                               DF93D7E51444B105007C6459 /* SpecialProtocolFile.cpp in Sources */,
+                               DF93D7E61444B105007C6459 /* TuxBoxDirectory.cpp in Sources */,
+                               DF93D7E71444B105007C6459 /* TuxBoxFile.cpp in Sources */,
+                               DF93D7E81444B105007C6459 /* UDFFile.cpp in Sources */,
+                               DF93D7E91444B105007C6459 /* UPnPFile.cpp in Sources */,
+                               DF93D7EA1444B105007C6459 /* ZipFile.cpp in Sources */,
+                               DF93D81E1444B86B007C6459 /* HDHomeRunDirectory.cpp in Sources */,
+                               DF93D81F1444B86B007C6459 /* HDHomeRunFile.cpp in Sources */,
+                               DFDB00241516403A005079A4 /* CircularCache.cpp in Sources */,
+                               DFDB00251516403A005079A4 /* DirectoryCache.cpp in Sources */,
+                               DFDB00261516403A005079A4 /* FileCache.cpp in Sources */,
+                               DFDB00271516403A005079A4 /* MemBufferCache.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 5c4587a..7a76d99 100644 (file)
@@ -43,9 +43,7 @@
                183C454D130C4D55006AA317 /* xbmcvfsmodule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 189047D11301DEAB00C11012 /* xbmcvfsmodule.cpp */; settings = {COMPILER_FLAGS = "-I$XBMC_DEPENDS/include/python2.6"; }; };
                183FDF8A11AF0B0500B81E9C /* PluginSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 183FDF8811AF0B0500B81E9C /* PluginSource.cpp */; };
                183FDF8B11AF0B0500B81E9C /* PluginSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 183FDF8811AF0B0500B81E9C /* PluginSource.cpp */; };
-               18404D9E1396C13500863BBA /* Slingbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18404D9C1396C13500863BBA /* Slingbox.cpp */; };
                18404DA61396C31B00863BBA /* SlingboxLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18404DA51396C31B00863BBA /* SlingboxLib.a */; };
-               18404E701396E05D00863BBA /* Slingbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18404D9C1396C13500863BBA /* Slingbox.cpp */; };
                18404E711396E06C00863BBA /* SlingboxLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18404DA51396C31B00863BBA /* SlingboxLib.a */; };
                1840B74D13993D8A007C848B /* JSONVariantParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B74B13993D8A007C848B /* JSONVariantParser.cpp */; };
                1840B74E13993D8A007C848B /* JSONVariantParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B74B13993D8A007C848B /* JSONVariantParser.cpp */; };
                432D7CE512D86DA500CE4C49 /* NetworkLinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 432D7CE312D86DA500CE4C49 /* NetworkLinux.cpp */; };
                432D7CF712D870E800CE4C49 /* TCPServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 432D7CF612D870E800CE4C49 /* TCPServer.cpp */; };
                432D7CF812D870E800CE4C49 /* TCPServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 432D7CF612D870E800CE4C49 /* TCPServer.cpp */; };
-               433219D712E4C6A500CD7486 /* FileUDF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D112E4C6A500CD7486 /* FileUDF.cpp */; };
                433219D812E4C6A500CD7486 /* udf25.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D312E4C6A500CD7486 /* udf25.cpp */; };
                433219D912E4C6A500CD7486 /* UDFDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D512E4C6A500CD7486 /* UDFDirectory.cpp */; };
-               433219DA12E4C6A500CD7486 /* FileUDF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D112E4C6A500CD7486 /* FileUDF.cpp */; };
                433219DB12E4C6A500CD7486 /* udf25.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D312E4C6A500CD7486 /* udf25.cpp */; };
                433219DC12E4C6A500CD7486 /* UDFDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433219D512E4C6A500CD7486 /* UDFDirectory.cpp */; };
                43348AA3107747CD00F859CF /* Edl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43348AA1107747CD00F859CF /* Edl.cpp */; };
                7C8A14571154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; };
                7C8A187C115B2A8200E5FCFA /* TextureDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */; };
                7C8A187D115B2A8200E5FCFA /* TextureDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */; };
-               7C99B6A4133D342100FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6A2133D342100FC2B16 /* CacheCircular.cpp */; };
-               7C99B6A5133D342100FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6A2133D342100FC2B16 /* CacheCircular.cpp */; };
+               7C99B6A4133D342100FC2B16 /* CircularCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6A2133D342100FC2B16 /* CircularCache.cpp */; };
+               7C99B6A5133D342100FC2B16 /* CircularCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6A2133D342100FC2B16 /* CircularCache.cpp */; };
                7C99B7951340723F00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7931340723F00FC2B16 /* GUIDialogPlayEject.cpp */; };
                7C99B7961340723F00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7931340723F00FC2B16 /* GUIDialogPlayEject.cpp */; };
                7CAA20511079C8160096DE39 /* BaseRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CAA204F1079C8160096DE39 /* BaseRenderer.cpp */; };
                C8D0B2AF1265A9A800F0C0AC /* SystemGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8D0B2AE1265A9A800F0C0AC /* SystemGlobals.cpp */; };
                C8D0B2B01265A9A800F0C0AC /* SystemGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8D0B2AE1265A9A800F0C0AC /* SystemGlobals.cpp */; };
                C8EC5D0E1369519D00CCC10D /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D0C1369519D00CCC10D /* XBMC_keytable.cpp */; };
-               DF0DF15B13A3ADA7008ED511 /* FileNFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15713A3ADA7008ED511 /* FileNFS.cpp */; };
                DF0DF15C13A3ADA7008ED511 /* NFSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */; };
                DF24A6B41406C7C500C7721E /* AFPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF24A6B01406C7C500C7721E /* AFPDirectory.cpp */; };
-               DF24A6B51406C7C500C7721E /* FileAFP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF24A6B21406C7C500C7721E /* FileAFP.cpp */; };
                DF24A6B61406C7C500C7721E /* AFPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF24A6B01406C7C500C7721E /* AFPDirectory.cpp */; };
-               DF24A6B71406C7C500C7721E /* FileAFP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF24A6B21406C7C500C7721E /* FileAFP.cpp */; };
                DF3488E713FD958F0026A711 /* GUIAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF3488E513FD958F0026A711 /* GUIAction.cpp */; };
                DF3488E813FD958F0026A711 /* GUIAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF3488E513FD958F0026A711 /* GUIAction.cpp */; };
                DF34892A13FD9C780026A711 /* AirPlayServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF34892813FD9C780026A711 /* AirPlayServer.cpp */; };
                DF34898313FDAAF60026A711 /* HttpParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF34898113FDAAF60026A711 /* HttpParser.cpp */; };
                DF448457140048A60069344B /* AirTunesServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF448455140048A60069344B /* AirTunesServer.cpp */; };
                DF448458140048A60069344B /* AirTunesServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF448455140048A60069344B /* AirTunesServer.cpp */; };
-               DF44845D140048C80069344B /* FilePipe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF448459140048C80069344B /* FilePipe.cpp */; };
                DF44845E140048C80069344B /* PipesManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44845B140048C80069344B /* PipesManager.cpp */; };
-               DF44845F140048C80069344B /* FilePipe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF448459140048C80069344B /* FilePipe.cpp */; };
                DF448460140048C80069344B /* PipesManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF44845B140048C80069344B /* PipesManager.cpp */; };
                DF4484EE140054530069344B /* BXAcodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4484EC140054530069344B /* BXAcodec.cpp */; };
                DF4484EF140054530069344B /* BXAcodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF4484EC140054530069344B /* BXAcodec.cpp */; };
                DF52773B151BAF4C00B5B63B /* WebSocketV13.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52772F151BAF4C00B5B63B /* WebSocketV13.cpp */; };
                DF52773C151BAF4C00B5B63B /* WebSocketV8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF527731151BAF4C00B5B63B /* WebSocketV8.cpp */; };
                DF673AA51443819600A5A509 /* AddonManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B49FF41152BFA5001AF8A6 /* AddonManager.cpp */; };
-               DF85BAB51443669A000686BE /* FileUPnP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF85BAB41443669A000686BE /* FileUPnP.cpp */; };
-               DF85BAB61443669A000686BE /* FileUPnP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF85BAB41443669A000686BE /* FileUPnP.cpp */; };
+               DF93D65D1444A7A3007C6459 /* SlingboxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D65C1444A7A3007C6459 /* SlingboxDirectory.cpp */; };
+               DF93D65E1444A7A3007C6459 /* SlingboxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D65C1444A7A3007C6459 /* SlingboxDirectory.cpp */; };
+               DF93D6991444A8B1007C6459 /* AFPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6631444A8B0007C6459 /* AFPFile.cpp */; };
+               DF93D69A1444A8B1007C6459 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6651444A8B0007C6459 /* DirectoryCache.cpp */; };
+               DF93D69B1444A8B1007C6459 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6671444A8B0007C6459 /* FileCache.cpp */; };
+               DF93D69C1444A8B1007C6459 /* CDDAFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6691444A8B0007C6459 /* CDDAFile.cpp */; };
+               DF93D69D1444A8B1007C6459 /* CurlFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66B1444A8B0007C6459 /* CurlFile.cpp */; };
+               DF93D69E1444A8B1007C6459 /* DAAPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66D1444A8B0007C6459 /* DAAPFile.cpp */; };
+               DF93D69F1444A8B1007C6459 /* DirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66F1444A8B0007C6459 /* DirectoryFactory.cpp */; };
+               DF93D6A01444A8B1007C6459 /* FileDirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6711444A8B0007C6459 /* FileDirectoryFactory.cpp */; };
+               DF93D6A11444A8B1007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6731444A8B0007C6459 /* FileReaderFile.cpp */; };
+               DF93D6A21444A8B1007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6751444A8B0007C6459 /* HDFile.cpp */; };
+               DF93D6A31444A8B1007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6771444A8B0007C6459 /* ISOFile.cpp */; };
+               DF93D6A41444A8B1007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6791444A8B0007C6459 /* LastFMFile.cpp */; };
+               DF93D6A51444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */; };
+               DF93D6A61444A8B1007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67D1444A8B0007C6459 /* NFSFile.cpp */; };
+               DF93D6A71444A8B1007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67F1444A8B0007C6459 /* PipeFile.cpp */; };
+               DF93D6A81444A8B1007C6459 /* RarFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6811444A8B0007C6459 /* RarFile.cpp */; };
+               DF93D6A91444A8B1007C6459 /* RTVFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6831444A8B0007C6459 /* RTVFile.cpp */; };
+               DF93D6AA1444A8B1007C6459 /* SFTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6851444A8B0007C6459 /* SFTPFile.cpp */; };
+               DF93D6AB1444A8B1007C6459 /* ShoutcastFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6871444A8B0007C6459 /* ShoutcastFile.cpp */; };
+               DF93D6AC1444A8B1007C6459 /* SlingboxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6891444A8B0007C6459 /* SlingboxFile.cpp */; };
+               DF93D6AD1444A8B1007C6459 /* SmbFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68B1444A8B0007C6459 /* SmbFile.cpp */; };
+               DF93D6AE1444A8B1007C6459 /* SpecialProtocolFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68D1444A8B0007C6459 /* SpecialProtocolFile.cpp */; };
+               DF93D6AF1444A8B1007C6459 /* TuxBoxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68F1444A8B0007C6459 /* TuxBoxDirectory.cpp */; };
+               DF93D6B01444A8B1007C6459 /* TuxBoxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6911444A8B0007C6459 /* TuxBoxFile.cpp */; };
+               DF93D6B11444A8B1007C6459 /* UDFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6931444A8B0007C6459 /* UDFFile.cpp */; };
+               DF93D6B21444A8B1007C6459 /* UPnPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6951444A8B0007C6459 /* UPnPFile.cpp */; };
+               DF93D6B31444A8B1007C6459 /* ZipFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6971444A8B0007C6459 /* ZipFile.cpp */; };
+               DF93D6B41444A8B1007C6459 /* AFPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6631444A8B0007C6459 /* AFPFile.cpp */; };
+               DF93D6B51444A8B1007C6459 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6651444A8B0007C6459 /* DirectoryCache.cpp */; };
+               DF93D6B61444A8B1007C6459 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6671444A8B0007C6459 /* FileCache.cpp */; };
+               DF93D6B71444A8B1007C6459 /* CDDAFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6691444A8B0007C6459 /* CDDAFile.cpp */; };
+               DF93D6B81444A8B1007C6459 /* CurlFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66B1444A8B0007C6459 /* CurlFile.cpp */; };
+               DF93D6B91444A8B1007C6459 /* DAAPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66D1444A8B0007C6459 /* DAAPFile.cpp */; };
+               DF93D6BA1444A8B1007C6459 /* DirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D66F1444A8B0007C6459 /* DirectoryFactory.cpp */; };
+               DF93D6BB1444A8B1007C6459 /* FileDirectoryFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6711444A8B0007C6459 /* FileDirectoryFactory.cpp */; };
+               DF93D6BC1444A8B1007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6731444A8B0007C6459 /* FileReaderFile.cpp */; };
+               DF93D6BD1444A8B1007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6751444A8B0007C6459 /* HDFile.cpp */; };
+               DF93D6BE1444A8B1007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6771444A8B0007C6459 /* ISOFile.cpp */; };
+               DF93D6BF1444A8B1007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6791444A8B0007C6459 /* LastFMFile.cpp */; };
+               DF93D6C01444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */; };
+               DF93D6C11444A8B1007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67D1444A8B0007C6459 /* NFSFile.cpp */; };
+               DF93D6C21444A8B1007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67F1444A8B0007C6459 /* PipeFile.cpp */; };
+               DF93D6C31444A8B1007C6459 /* RarFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6811444A8B0007C6459 /* RarFile.cpp */; };
+               DF93D6C41444A8B1007C6459 /* RTVFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6831444A8B0007C6459 /* RTVFile.cpp */; };
+               DF93D6C51444A8B1007C6459 /* SFTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6851444A8B0007C6459 /* SFTPFile.cpp */; };
+               DF93D6C61444A8B1007C6459 /* ShoutcastFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6871444A8B0007C6459 /* ShoutcastFile.cpp */; };
+               DF93D6C71444A8B1007C6459 /* SlingboxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6891444A8B0007C6459 /* SlingboxFile.cpp */; };
+               DF93D6C81444A8B1007C6459 /* SmbFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68B1444A8B0007C6459 /* SmbFile.cpp */; };
+               DF93D6C91444A8B1007C6459 /* SpecialProtocolFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68D1444A8B0007C6459 /* SpecialProtocolFile.cpp */; };
+               DF93D6CA1444A8B1007C6459 /* TuxBoxDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D68F1444A8B0007C6459 /* TuxBoxDirectory.cpp */; };
+               DF93D6CB1444A8B1007C6459 /* TuxBoxFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6911444A8B0007C6459 /* TuxBoxFile.cpp */; };
+               DF93D6CC1444A8B1007C6459 /* UDFFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6931444A8B0007C6459 /* UDFFile.cpp */; };
+               DF93D6CD1444A8B1007C6459 /* UPnPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6951444A8B0007C6459 /* UPnPFile.cpp */; };
+               DF93D6CE1444A8B1007C6459 /* ZipFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6971444A8B0007C6459 /* ZipFile.cpp */; };
+               DF93D7F21444B54A007C6459 /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */; };
+               DF93D7F31444B54A007C6459 /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */; };
+               DF93D7F61444B568007C6459 /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */; };
+               DF93D7F71444B568007C6459 /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */; };
                DF98D98C1434F47D00A6EBE1 /* SkinVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF98D98A1434F47D00A6EBE1 /* SkinVariable.cpp */; };
                DF98D98D1434F47D00A6EBE1 /* SkinVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF98D98A1434F47D00A6EBE1 /* SkinVariable.cpp */; };
                DFAB049813F8376700B70BFB /* InertialScrollingHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFAB049613F8376700B70BFB /* InertialScrollingHandler.cpp */; };
                E38E1FFC0D25F9FD00618676 /* DynamicDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E168C0D25F9FA00618676 /* DynamicDll.cpp */; };
                E38E1FFE0D25F9FD00618676 /* Favourites.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16900D25F9FA00618676 /* Favourites.cpp */; };
                E38E1FFF0D25F9FD00618676 /* FileItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16920D25F9FA00618676 /* FileItem.cpp */; };
-               E38E20010D25F9FD00618676 /* CacheMemBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16970D25F9FA00618676 /* CacheMemBuffer.cpp */; };
+               E38E20010D25F9FD00618676 /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16970D25F9FA00618676 /* MemBufferCache.cpp */; };
                E38E20020D25F9FD00618676 /* CacheStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16990D25F9FA00618676 /* CacheStrategy.cpp */; };
                E38E20030D25F9FD00618676 /* CDDADirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169B0D25F9FA00618676 /* CDDADirectory.cpp */; };
                E38E20040D25F9FD00618676 /* cddb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169D0D25F9FA00618676 /* cddb.cpp */; };
                E38E20050D25F9FD00618676 /* cdioSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169F0D25F9FA00618676 /* cdioSupport.cpp */; };
                E38E20060D25F9FD00618676 /* DAAPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AA0D25F9FA00618676 /* DAAPDirectory.cpp */; };
                E38E20070D25F9FD00618676 /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AC0D25F9FA00618676 /* Directory.cpp */; };
-               E38E20080D25F9FD00618676 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AE0D25F9FA00618676 /* DirectoryCache.cpp */; };
                E38E20090D25F9FD00618676 /* DirectoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B00D25F9FA00618676 /* DirectoryHistory.cpp */; };
-               E38E200A0D25F9FD00618676 /* DirectoryTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B20D25F9FA00618676 /* DirectoryTuxBox.cpp */; };
                E38E200B0D25F9FD00618676 /* DllLibCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B40D25F9FA00618676 /* DllLibCurl.cpp */; };
-               E38E200C0D25F9FD00618676 /* FactoryDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B60D25F9FA00618676 /* FactoryDirectory.cpp */; };
-               E38E200D0D25F9FD00618676 /* FactoryFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B80D25F9FA00618676 /* FactoryFileDirectory.cpp */; };
                E38E200E0D25F9FD00618676 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BA0D25F9FA00618676 /* File.cpp */; };
-               E38E200F0D25F9FD00618676 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BC0D25F9FA00618676 /* FileCache.cpp */; };
-               E38E20100D25F9FD00618676 /* FileCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BE0D25F9FA00618676 /* FileCDDA.cpp */; };
-               E38E20110D25F9FD00618676 /* FileCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C00D25F9FA00618676 /* FileCurl.cpp */; };
-               E38E20120D25F9FD00618676 /* FileDAAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C20D25F9FA00618676 /* FileDAAP.cpp */; };
                E38E20130D25F9FD00618676 /* FileFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C40D25F9FA00618676 /* FileFactory.cpp */; };
-               E38E20140D25F9FD00618676 /* FileFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C60D25F9FA00618676 /* FileFileReader.cpp */; };
-               E38E20160D25F9FD00618676 /* FileHD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CA0D25F9FA00618676 /* FileHD.cpp */; };
-               E38E20170D25F9FD00618676 /* FileISO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CC0D25F9FA00618676 /* FileISO.cpp */; };
-               E38E20180D25F9FD00618676 /* FileLastFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CE0D25F9FA00618676 /* FileLastFM.cpp */; };
-               E38E201A0D25F9FD00618676 /* FileMusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D20D25F9FA00618676 /* FileMusicDatabase.cpp */; };
-               E38E201B0D25F9FD00618676 /* FileRar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D40D25F9FA00618676 /* FileRar.cpp */; };
-               E38E201C0D25F9FD00618676 /* FileRTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D60D25F9FA00618676 /* FileRTV.cpp */; };
-               E38E20200D25F9FD00618676 /* FileTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16DE0D25F9FA00618676 /* FileTuxBox.cpp */; };
-               E38E20220D25F9FD00618676 /* FileZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E20D25F9FA00618676 /* FileZip.cpp */; };
                E38E20230D25F9FD00618676 /* FTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E40D25F9FA00618676 /* FTPDirectory.cpp */; };
                E38E20240D25F9FD00618676 /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E60D25F9FA00618676 /* FTPParse.cpp */; };
                E38E20250D25F9FD00618676 /* HDDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E80D25F9FA00618676 /* HDDirectory.cpp */; };
-               E38E20260D25F9FD00618676 /* HDHomeRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EA0D25F9FA00618676 /* HDHomeRun.cpp */; };
                E38E20270D25F9FD00618676 /* IDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EC0D25F9FA00618676 /* IDirectory.cpp */; };
                E38E20280D25F9FD00618676 /* IFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EE0D25F9FA00618676 /* IFile.cpp */; };
                E38E20290D25F9FD00618676 /* iso9660.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16F10D25F9FA00618676 /* iso9660.cpp */; };
                E38E25BB0D263CE000618676 /* xbmcplugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E259C0D263CE000618676 /* xbmcplugin.cpp */; settings = {COMPILER_FLAGS = "-I$XBMC_DEPENDS/include/python2.6"; }; };
                E38E25C00D263DC100618676 /* DVDFactoryDemuxer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E25BF0D263DC100618676 /* DVDFactoryDemuxer.cpp */; };
                E38E25C30D263DE200618676 /* DVDDemuxFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */; };
-               E38F12C20D29FF200035C331 /* FileShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38F12C10D29FF200035C331 /* FileShoutcast.cpp */; };
                E3A4780A0D29029A00F3C3A6 /* GUIDialogCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A478090D29029A00F3C3A6 /* GUIDialogCache.cpp */; };
                E3A4781A0D29032C00F3C3A6 /* GUIDialogAccessPoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A478190D29032C00F3C3A6 /* GUIDialogAccessPoints.cpp */; };
                E3B53E7C0D97B08100021A96 /* DVDSubtitleParserMicroDVD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3B53E7A0D97B08100021A96 /* DVDSubtitleParserMicroDVD.cpp */; };
                E3BBB7990D7EA78A00CAAFD3 /* MythSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3BBB7980D7EA78A00CAAFD3 /* MythSession.cpp */; };
-               E3DAAF8C0D6E1B0500F17647 /* FileSmb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DAAF8A0D6E1B0500F17647 /* FileSmb.cpp */; };
                E3DAAF8D0D6E1B0500F17647 /* SMBDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DAAF8B0D6E1B0500F17647 /* SMBDirectory.cpp */; };
                E3E91FFD0D8C61DF002BF43D /* EventPacket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E91FFA0D8C61DF002BF43D /* EventPacket.cpp */; };
                E3E91FFE0D8C61DF002BF43D /* EventServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E91FFB0D8C61DF002BF43D /* EventServer.cpp */; };
                F558F28013ABD57400631E12 /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F27D13ABD57400631E12 /* DirtyRegionTracker.cpp */; };
                F558F29613ABD7DF00631E12 /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F29413ABD7DF00631E12 /* GUIWindowDebugInfo.cpp */; };
                F558F29713ABD7DF00631E12 /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F29413ABD7DF00631E12 /* GUIWindowDebugInfo.cpp */; };
-               F558F3D013AE663300631E12 /* FileNFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15713A3ADA7008ED511 /* FileNFS.cpp */; };
                F558F3D113AE663A00631E12 /* NFSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */; };
                F56579AF13060D1E0085ED7F /* RenderCapture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56579AD13060D1E0085ED7F /* RenderCapture.cpp */; };
                F56A084B0F4A18FB003F9F87 /* karaokewindowbackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */; };
                F57A1D1F1329B15300498CC7 /* AutoPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = F57A1D1D1329B15300498CC7 /* AutoPool.mm */; };
                F57B6F801071B8B500079ACB /* JobManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F57B6F7E1071B8B500079ACB /* JobManager.cpp */; };
                F57B6F811071B8B500079ACB /* JobManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F57B6F7E1071B8B500079ACB /* JobManager.cpp */; };
-               F584E1290F257BD800DB26A5 /* FileSpecialProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E1270F257BD800DB26A5 /* FileSpecialProtocol.cpp */; };
                F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */; };
                F58E293911FFC103006F4D46 /* DVDInputStreamBluray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58E293711FFC103006F4D46 /* DVDInputStreamBluray.cpp */; };
                F58E293A11FFC103006F4D46 /* DVDInputStreamBluray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58E293711FFC103006F4D46 /* DVDInputStreamBluray.cpp */; };
                F5A1C93E0F6B06CF00A96ABD /* DynamicDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E168C0D25F9FA00618676 /* DynamicDll.cpp */; };
                F5A1C9400F6B06CF00A96ABD /* Favourites.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16900D25F9FA00618676 /* Favourites.cpp */; };
                F5A1C9410F6B06CF00A96ABD /* FileItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16920D25F9FA00618676 /* FileItem.cpp */; };
-               F5A1C9420F6B06CF00A96ABD /* CacheMemBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16970D25F9FA00618676 /* CacheMemBuffer.cpp */; };
+               F5A1C9420F6B06CF00A96ABD /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16970D25F9FA00618676 /* MemBufferCache.cpp */; };
                F5A1C9430F6B06CF00A96ABD /* CacheStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16990D25F9FA00618676 /* CacheStrategy.cpp */; };
                F5A1C9440F6B06CF00A96ABD /* CDDADirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169B0D25F9FA00618676 /* CDDADirectory.cpp */; };
                F5A1C9450F6B06CF00A96ABD /* cddb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169D0D25F9FA00618676 /* cddb.cpp */; };
                F5A1C9460F6B06CF00A96ABD /* cdioSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E169F0D25F9FA00618676 /* cdioSupport.cpp */; };
                F5A1C9470F6B06CF00A96ABD /* DAAPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AA0D25F9FA00618676 /* DAAPDirectory.cpp */; };
                F5A1C9480F6B06CF00A96ABD /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AC0D25F9FA00618676 /* Directory.cpp */; };
-               F5A1C9490F6B06CF00A96ABD /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16AE0D25F9FA00618676 /* DirectoryCache.cpp */; };
                F5A1C94A0F6B06CF00A96ABD /* DirectoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B00D25F9FA00618676 /* DirectoryHistory.cpp */; };
-               F5A1C94B0F6B06CF00A96ABD /* DirectoryTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B20D25F9FA00618676 /* DirectoryTuxBox.cpp */; };
                F5A1C94C0F6B06CF00A96ABD /* DllLibCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B40D25F9FA00618676 /* DllLibCurl.cpp */; };
-               F5A1C94D0F6B06CF00A96ABD /* FactoryDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B60D25F9FA00618676 /* FactoryDirectory.cpp */; };
-               F5A1C94E0F6B06CF00A96ABD /* FactoryFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16B80D25F9FA00618676 /* FactoryFileDirectory.cpp */; };
                F5A1C94F0F6B06CF00A96ABD /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BA0D25F9FA00618676 /* File.cpp */; };
-               F5A1C9500F6B06CF00A96ABD /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BC0D25F9FA00618676 /* FileCache.cpp */; };
-               F5A1C9510F6B06CF00A96ABD /* FileCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16BE0D25F9FA00618676 /* FileCDDA.cpp */; };
-               F5A1C9520F6B06CF00A96ABD /* FileCurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C00D25F9FA00618676 /* FileCurl.cpp */; };
-               F5A1C9530F6B06CF00A96ABD /* FileDAAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C20D25F9FA00618676 /* FileDAAP.cpp */; };
                F5A1C9540F6B06CF00A96ABD /* FileFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C40D25F9FA00618676 /* FileFactory.cpp */; };
-               F5A1C9550F6B06CF00A96ABD /* FileFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16C60D25F9FA00618676 /* FileFileReader.cpp */; };
-               F5A1C9560F6B06CF00A96ABD /* FileHD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CA0D25F9FA00618676 /* FileHD.cpp */; };
-               F5A1C9570F6B06CF00A96ABD /* FileISO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CC0D25F9FA00618676 /* FileISO.cpp */; };
-               F5A1C9580F6B06CF00A96ABD /* FileLastFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16CE0D25F9FA00618676 /* FileLastFM.cpp */; };
-               F5A1C9590F6B06CF00A96ABD /* FileMusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D20D25F9FA00618676 /* FileMusicDatabase.cpp */; };
-               F5A1C95A0F6B06CF00A96ABD /* FileRar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D40D25F9FA00618676 /* FileRar.cpp */; };
-               F5A1C95B0F6B06CF00A96ABD /* FileRTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16D60D25F9FA00618676 /* FileRTV.cpp */; };
-               F5A1C95C0F6B06CF00A96ABD /* FileTuxBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16DE0D25F9FA00618676 /* FileTuxBox.cpp */; };
-               F5A1C95D0F6B06CF00A96ABD /* FileZip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E20D25F9FA00618676 /* FileZip.cpp */; };
                F5A1C95E0F6B06CF00A96ABD /* FTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E40D25F9FA00618676 /* FTPDirectory.cpp */; };
                F5A1C95F0F6B06CF00A96ABD /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E60D25F9FA00618676 /* FTPParse.cpp */; };
                F5A1C9600F6B06CF00A96ABD /* HDDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E80D25F9FA00618676 /* HDDirectory.cpp */; };
-               F5A1C9610F6B06CF00A96ABD /* HDHomeRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EA0D25F9FA00618676 /* HDHomeRun.cpp */; };
                F5A1C9620F6B06CF00A96ABD /* IDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EC0D25F9FA00618676 /* IDirectory.cpp */; };
                F5A1C9630F6B06CF00A96ABD /* IFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EE0D25F9FA00618676 /* IFile.cpp */; };
                F5A1C9640F6B06CF00A96ABD /* iso9660.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16F10D25F9FA00618676 /* iso9660.cpp */; };
                F5A1CB1A0F6B06CF00A96ABD /* DVDDemuxFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */; };
                F5A1CB1B0F6B06CF00A96ABD /* GUIDialogCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A478090D29029A00F3C3A6 /* GUIDialogCache.cpp */; };
                F5A1CB1D0F6B06CF00A96ABD /* GUIDialogAccessPoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A478190D29032C00F3C3A6 /* GUIDialogAccessPoints.cpp */; };
-               F5A1CB1F0F6B06CF00A96ABD /* FileShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38F12C10D29FF200035C331 /* FileShoutcast.cpp */; };
                F5A1CB220F6B06CF00A96ABD /* DVDPlayerCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E36578860D3AA7B40033CC1C /* DVDPlayerCodec.cpp */; };
                F5A1CB230F6B06CF00A96ABD /* DVDDemuxVobsub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E33206370D5070AA00435CE3 /* DVDDemuxVobsub.cpp */; };
                F5A1CB240F6B06CF00A96ABD /* DVDInputStreamTV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E33979940D62FD47004ECDDA /* DVDInputStreamTV.cpp */; };
                F5A1CB250F6B06CF00A96ABD /* PltMediaConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9F600D67BD2F0095F5DD /* PltMediaConnect.cpp */; };
                F5A1CB3C0F6B06CF00A96ABD /* MythDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9FA50D67D1FB0095F5DD /* MythDirectory.cpp */; };
                F5A1CB3D0F6B06CF00A96ABD /* MythFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9FA70D67D1FB0095F5DD /* MythFile.cpp */; };
-               F5A1CB3E0F6B06CF00A96ABD /* FileSmb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DAAF8A0D6E1B0500F17647 /* FileSmb.cpp */; };
                F5A1CB3F0F6B06CF00A96ABD /* SMBDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DAAF8B0D6E1B0500F17647 /* SMBDirectory.cpp */; };
                F5A1CB410F6B06CF00A96ABD /* MythSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3BBB7980D7EA78A00CAAFD3 /* MythSession.cpp */; };
                F5A1CB420F6B06CF00A96ABD /* EventPacket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E91FFA0D8C61DF002BF43D /* EventPacket.cpp */; };
                F5A1CB7F0F6B06CF00A96ABD /* AudioRendererFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A00B070EFDDDFC00CD59F3 /* AudioRendererFactory.cpp */; };
                F5A1CB800F6B06CF00A96ABD /* NullDirectSound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A00B240EFDE44100CD59F3 /* NullDirectSound.cpp */; };
                F5A1CB810F6B06CF00A96ABD /* ExternalPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5608C40F1754930056433A /* ExternalPlayer.cpp */; };
-               F5A1CB820F6B06CF00A96ABD /* FileSpecialProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E1270F257BD800DB26A5 /* FileSpecialProtocol.cpp */; };
                F5A1CB830F6B06CF00A96ABD /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */; };
                F5A1CB840F6B06CF00A96ABD /* GUIDialogKaraokeSongSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D00F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp */; };
                F5A1CB850F6B06CF00A96ABD /* karaokelyricscdg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D40F1E784800D46E3C /* karaokelyricscdg.cpp */; };
                F5A7A703112893E50059D6AA /* AnnouncementManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7A700112893E50059D6AA /* AnnouncementManager.cpp */; };
                F5A7A85B112908F00059D6AA /* WebServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7A859112908F00059D6AA /* WebServer.cpp */; };
                F5A7A85C112908F00059D6AA /* WebServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7A859112908F00059D6AA /* WebServer.cpp */; };
-               F5A7B376113AFB5F0059D6AA /* FileSFTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7B374113AFB5F0059D6AA /* FileSFTP.cpp */; };
-               F5A7B377113AFB5F0059D6AA /* FileSFTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7B374113AFB5F0059D6AA /* FileSFTP.cpp */; };
                F5A7B37E113AFB900059D6AA /* SFTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7B37C113AFB900059D6AA /* SFTPDirectory.cpp */; };
                F5A7B37F113AFB900059D6AA /* SFTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7B37C113AFB900059D6AA /* SFTPDirectory.cpp */; };
                F5A7B42C113CBB950059D6AA /* AddonsDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A7B42B113CBB950059D6AA /* AddonsDirectory.cpp */; };
                18308CB51303370800AA309E /* stdio_utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdio_utf8.h; sourceTree = "<group>"; };
                183FDF8811AF0B0500B81E9C /* PluginSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginSource.cpp; sourceTree = "<group>"; };
                183FDF8911AF0B0500B81E9C /* PluginSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginSource.h; sourceTree = "<group>"; };
-               18404D9C1396C13500863BBA /* Slingbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Slingbox.cpp; sourceTree = "<group>"; };
-               18404D9D1396C13500863BBA /* Slingbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slingbox.h; sourceTree = "<group>"; };
                18404DA51396C31B00863BBA /* SlingboxLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = SlingboxLib.a; path = lib/SlingboxLib/SlingboxLib.a; sourceTree = "<group>"; };
                1840B74B13993D8A007C848B /* JSONVariantParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONVariantParser.cpp; sourceTree = "<group>"; };
                1840B74C13993D8A007C848B /* JSONVariantParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONVariantParser.h; sourceTree = "<group>"; };
                432D7CE312D86DA500CE4C49 /* NetworkLinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkLinux.cpp; sourceTree = "<group>"; };
                432D7CF512D870D600CE4C49 /* TCPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPServer.h; sourceTree = "<group>"; };
                432D7CF612D870E800CE4C49 /* TCPServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TCPServer.cpp; sourceTree = "<group>"; };
-               433219D112E4C6A500CD7486 /* FileUDF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUDF.cpp; sourceTree = "<group>"; };
-               433219D212E4C6A500CD7486 /* FileUDF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUDF.h; sourceTree = "<group>"; };
                433219D312E4C6A500CD7486 /* udf25.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = udf25.cpp; sourceTree = "<group>"; };
                433219D412E4C6A500CD7486 /* udf25.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = udf25.h; sourceTree = "<group>"; };
                433219D512E4C6A500CD7486 /* UDFDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UDFDirectory.cpp; sourceTree = "<group>"; };
                7C8A14551154CB2600E5FCFA /* TextureCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureCache.h; sourceTree = "<group>"; };
                7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureDatabase.cpp; sourceTree = "<group>"; };
                7C8A187B115B2A8200E5FCFA /* TextureDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureDatabase.h; sourceTree = "<group>"; };
-               7C99B6A2133D342100FC2B16 /* CacheCircular.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheCircular.cpp; sourceTree = "<group>"; };
-               7C99B6A3133D342100FC2B16 /* CacheCircular.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheCircular.h; sourceTree = "<group>"; };
+               7C99B6A2133D342100FC2B16 /* CircularCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CircularCache.cpp; sourceTree = "<group>"; };
+               7C99B6A3133D342100FC2B16 /* CircularCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircularCache.h; sourceTree = "<group>"; };
                7C99B7931340723F00FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; };
                7C99B7941340723F00FC2B16 /* GUIDialogPlayEject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogPlayEject.h; sourceTree = "<group>"; };
                7CAA204F1079C8160096DE39 /* BaseRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseRenderer.cpp; sourceTree = "<group>"; };
                C8D0B2AE1265A9A800F0C0AC /* SystemGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemGlobals.cpp; sourceTree = "<group>"; };
                C8EC5D0C1369519D00CCC10D /* XBMC_keytable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBMC_keytable.cpp; sourceTree = "<group>"; };
                C8EC5D0D1369519D00CCC10D /* XBMC_keytable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMC_keytable.h; sourceTree = "<group>"; };
-               DF0DF15713A3ADA7008ED511 /* FileNFS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileNFS.cpp; sourceTree = "<group>"; };
-               DF0DF15813A3ADA7008ED511 /* FileNFS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileNFS.h; sourceTree = "<group>"; };
                DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSDirectory.cpp; sourceTree = "<group>"; };
                DF0DF15A13A3ADA7008ED511 /* NFSDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSDirectory.h; sourceTree = "<group>"; };
                DF24A6B01406C7C500C7721E /* AFPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPDirectory.cpp; sourceTree = "<group>"; };
                DF24A6B11406C7C500C7721E /* AFPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPDirectory.h; sourceTree = "<group>"; };
-               DF24A6B21406C7C500C7721E /* FileAFP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileAFP.cpp; sourceTree = "<group>"; };
-               DF24A6B31406C7C500C7721E /* FileAFP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileAFP.h; sourceTree = "<group>"; };
                DF3488E513FD958F0026A711 /* GUIAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIAction.cpp; sourceTree = "<group>"; };
                DF3488E613FD958F0026A711 /* GUIAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIAction.h; sourceTree = "<group>"; };
                DF34892813FD9C780026A711 /* AirPlayServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirPlayServer.cpp; sourceTree = "<group>"; };
                DF34898113FDAAF60026A711 /* HttpParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpParser.cpp; sourceTree = "<group>"; };
                DF448455140048A60069344B /* AirTunesServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AirTunesServer.cpp; sourceTree = "<group>"; };
                DF448456140048A60069344B /* AirTunesServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AirTunesServer.h; sourceTree = "<group>"; };
-               DF448459140048C80069344B /* FilePipe.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FilePipe.cpp; sourceTree = "<group>"; };
-               DF44845A140048C80069344B /* FilePipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePipe.h; sourceTree = "<group>"; };
                DF44845B140048C80069344B /* PipesManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipesManager.cpp; sourceTree = "<group>"; };
                DF44845C140048C80069344B /* PipesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipesManager.h; sourceTree = "<group>"; };
                DF4484EC140054530069344B /* BXAcodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BXAcodec.cpp; sourceTree = "<group>"; };
                DF527730151BAF4C00B5B63B /* WebSocketV13.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketV13.h; sourceTree = "<group>"; };
                DF527731151BAF4C00B5B63B /* WebSocketV8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketV8.cpp; sourceTree = "<group>"; };
                DF527732151BAF4C00B5B63B /* WebSocketV8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketV8.h; sourceTree = "<group>"; };
-               DF85BAB31443669A000686BE /* FileUPnP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUPnP.h; sourceTree = "<group>"; };
-               DF85BAB41443669A000686BE /* FileUPnP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileUPnP.cpp; sourceTree = "<group>"; };
+               DF93D65B1444A7A3007C6459 /* SlingboxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxDirectory.h; sourceTree = "<group>"; };
+               DF93D65C1444A7A3007C6459 /* SlingboxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D6631444A8B0007C6459 /* AFPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AFPFile.cpp; sourceTree = "<group>"; };
+               DF93D6641444A8B0007C6459 /* AFPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPFile.h; sourceTree = "<group>"; };
+               DF93D6651444A8B0007C6459 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
+               DF93D6661444A8B0007C6459 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
+               DF93D6671444A8B0007C6459 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
+               DF93D6681444A8B0007C6459 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
+               DF93D6691444A8B0007C6459 /* CDDAFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDAFile.cpp; sourceTree = "<group>"; };
+               DF93D66A1444A8B0007C6459 /* CDDAFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDDAFile.h; sourceTree = "<group>"; };
+               DF93D66B1444A8B0007C6459 /* CurlFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurlFile.cpp; sourceTree = "<group>"; };
+               DF93D66C1444A8B0007C6459 /* CurlFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurlFile.h; sourceTree = "<group>"; };
+               DF93D66D1444A8B0007C6459 /* DAAPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DAAPFile.cpp; sourceTree = "<group>"; };
+               DF93D66E1444A8B0007C6459 /* DAAPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAAPFile.h; sourceTree = "<group>"; };
+               DF93D66F1444A8B0007C6459 /* DirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D6701444A8B0007C6459 /* DirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D6711444A8B0007C6459 /* FileDirectoryFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDirectoryFactory.cpp; sourceTree = "<group>"; };
+               DF93D6721444A8B0007C6459 /* FileDirectoryFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDirectoryFactory.h; sourceTree = "<group>"; };
+               DF93D6731444A8B0007C6459 /* FileReaderFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileReaderFile.cpp; sourceTree = "<group>"; };
+               DF93D6741444A8B0007C6459 /* FileReaderFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileReaderFile.h; sourceTree = "<group>"; };
+               DF93D6751444A8B0007C6459 /* HDFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDFile.cpp; sourceTree = "<group>"; };
+               DF93D6761444A8B0007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
+               DF93D6771444A8B0007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
+               DF93D6781444A8B0007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
+               DF93D6791444A8B0007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
+               DF93D67A1444A8B0007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
+               DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
+               DF93D67C1444A8B0007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
+               DF93D67D1444A8B0007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
+               DF93D67E1444A8B0007C6459 /* NFSFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSFile.h; sourceTree = "<group>"; };
+               DF93D67F1444A8B0007C6459 /* PipeFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PipeFile.cpp; sourceTree = "<group>"; };
+               DF93D6801444A8B0007C6459 /* PipeFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PipeFile.h; sourceTree = "<group>"; };
+               DF93D6811444A8B0007C6459 /* RarFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RarFile.cpp; sourceTree = "<group>"; };
+               DF93D6821444A8B0007C6459 /* RarFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RarFile.h; sourceTree = "<group>"; };
+               DF93D6831444A8B0007C6459 /* RTVFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTVFile.cpp; sourceTree = "<group>"; };
+               DF93D6841444A8B0007C6459 /* RTVFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTVFile.h; sourceTree = "<group>"; };
+               DF93D6851444A8B0007C6459 /* SFTPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFTPFile.cpp; sourceTree = "<group>"; };
+               DF93D6861444A8B0007C6459 /* SFTPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFTPFile.h; sourceTree = "<group>"; };
+               DF93D6871444A8B0007C6459 /* ShoutcastFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShoutcastFile.cpp; sourceTree = "<group>"; };
+               DF93D6881444A8B0007C6459 /* ShoutcastFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShoutcastFile.h; sourceTree = "<group>"; };
+               DF93D6891444A8B0007C6459 /* SlingboxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlingboxFile.cpp; sourceTree = "<group>"; };
+               DF93D68A1444A8B0007C6459 /* SlingboxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlingboxFile.h; sourceTree = "<group>"; };
+               DF93D68B1444A8B0007C6459 /* SmbFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmbFile.cpp; sourceTree = "<group>"; };
+               DF93D68C1444A8B0007C6459 /* SmbFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmbFile.h; sourceTree = "<group>"; };
+               DF93D68D1444A8B0007C6459 /* SpecialProtocolFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolFile.cpp; sourceTree = "<group>"; };
+               DF93D68E1444A8B0007C6459 /* SpecialProtocolFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolFile.h; sourceTree = "<group>"; };
+               DF93D68F1444A8B0007C6459 /* TuxBoxDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxDirectory.cpp; sourceTree = "<group>"; };
+               DF93D6901444A8B0007C6459 /* TuxBoxDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxDirectory.h; sourceTree = "<group>"; };
+               DF93D6911444A8B0007C6459 /* TuxBoxFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TuxBoxFile.cpp; sourceTree = "<group>"; };
+               DF93D6921444A8B0007C6459 /* TuxBoxFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TuxBoxFile.h; sourceTree = "<group>"; };
+               DF93D6931444A8B0007C6459 /* UDFFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UDFFile.cpp; sourceTree = "<group>"; };
+               DF93D6941444A8B0007C6459 /* UDFFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UDFFile.h; sourceTree = "<group>"; };
+               DF93D6951444A8B0007C6459 /* UPnPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPFile.cpp; sourceTree = "<group>"; };
+               DF93D6961444A8B0007C6459 /* UPnPFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPFile.h; sourceTree = "<group>"; };
+               DF93D6971444A8B0007C6459 /* ZipFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZipFile.cpp; sourceTree = "<group>"; };
+               DF93D6981444A8B0007C6459 /* ZipFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipFile.h; sourceTree = "<group>"; };
+               DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunFile.cpp; sourceTree = "<group>"; };
+               DF93D7F11444B54A007C6459 /* HDHomeRunFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunFile.h; sourceTree = "<group>"; };
+               DF93D7F41444B568007C6459 /* HDHomeRunDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRunDirectory.h; sourceTree = "<group>"; };
+               DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRunDirectory.cpp; sourceTree = "<group>"; };
                DF98D98A1434F47D00A6EBE1 /* SkinVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkinVariable.cpp; sourceTree = "<group>"; };
                DF98D98B1434F47D00A6EBE1 /* SkinVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkinVariable.h; sourceTree = "<group>"; };
                DFAB049613F8376700B70BFB /* InertialScrollingHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InertialScrollingHandler.cpp; sourceTree = "<group>"; };
                E38E16910D25F9FA00618676 /* Favourites.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Favourites.h; sourceTree = "<group>"; };
                E38E16920D25F9FA00618676 /* FileItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileItem.cpp; sourceTree = "<group>"; };
                E38E16930D25F9FA00618676 /* FileItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileItem.h; sourceTree = "<group>"; };
-               E38E16970D25F9FA00618676 /* CacheMemBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheMemBuffer.cpp; sourceTree = "<group>"; };
-               E38E16980D25F9FA00618676 /* CacheMemBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheMemBuffer.h; sourceTree = "<group>"; };
+               E38E16970D25F9FA00618676 /* MemBufferCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemBufferCache.cpp; sourceTree = "<group>"; };
+               E38E16980D25F9FA00618676 /* MemBufferCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemBufferCache.h; sourceTree = "<group>"; };
                E38E16990D25F9FA00618676 /* CacheStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStrategy.cpp; sourceTree = "<group>"; };
                E38E169A0D25F9FA00618676 /* CacheStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStrategy.h; sourceTree = "<group>"; };
                E38E169B0D25F9FA00618676 /* CDDADirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDDADirectory.cpp; sourceTree = "<group>"; };
                E38E16AB0D25F9FA00618676 /* DAAPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAAPDirectory.h; sourceTree = "<group>"; };
                E38E16AC0D25F9FA00618676 /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Directory.cpp; sourceTree = "<group>"; };
                E38E16AD0D25F9FA00618676 /* Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Directory.h; sourceTree = "<group>"; };
-               E38E16AE0D25F9FA00618676 /* DirectoryCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryCache.cpp; sourceTree = "<group>"; };
-               E38E16AF0D25F9FA00618676 /* DirectoryCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryCache.h; sourceTree = "<group>"; };
                E38E16B00D25F9FA00618676 /* DirectoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryHistory.cpp; sourceTree = "<group>"; };
                E38E16B10D25F9FA00618676 /* DirectoryHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryHistory.h; sourceTree = "<group>"; };
-               E38E16B20D25F9FA00618676 /* DirectoryTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryTuxBox.cpp; sourceTree = "<group>"; };
-               E38E16B30D25F9FA00618676 /* DirectoryTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryTuxBox.h; sourceTree = "<group>"; };
                E38E16B40D25F9FA00618676 /* DllLibCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DllLibCurl.cpp; sourceTree = "<group>"; };
                E38E16B50D25F9FA00618676 /* DllLibCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DllLibCurl.h; sourceTree = "<group>"; };
-               E38E16B60D25F9FA00618676 /* FactoryDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryDirectory.cpp; sourceTree = "<group>"; };
-               E38E16B70D25F9FA00618676 /* FactoryDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryDirectory.h; sourceTree = "<group>"; };
-               E38E16B80D25F9FA00618676 /* FactoryFileDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FactoryFileDirectory.cpp; sourceTree = "<group>"; };
-               E38E16B90D25F9FA00618676 /* FactoryFileDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FactoryFileDirectory.h; sourceTree = "<group>"; };
                E38E16BA0D25F9FA00618676 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = "<group>"; };
                E38E16BB0D25F9FA00618676 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = "<group>"; };
-               E38E16BC0D25F9FA00618676 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCache.cpp; sourceTree = "<group>"; };
-               E38E16BD0D25F9FA00618676 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
-               E38E16BE0D25F9FA00618676 /* FileCDDA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCDDA.cpp; sourceTree = "<group>"; };
-               E38E16BF0D25F9FA00618676 /* FileCDDA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCDDA.h; sourceTree = "<group>"; };
-               E38E16C00D25F9FA00618676 /* FileCurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileCurl.cpp; sourceTree = "<group>"; };
-               E38E16C10D25F9FA00618676 /* FileCurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCurl.h; sourceTree = "<group>"; };
-               E38E16C20D25F9FA00618676 /* FileDAAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileDAAP.cpp; sourceTree = "<group>"; };
-               E38E16C30D25F9FA00618676 /* FileDAAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileDAAP.h; sourceTree = "<group>"; };
                E38E16C40D25F9FA00618676 /* FileFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFactory.cpp; sourceTree = "<group>"; };
                E38E16C50D25F9FA00618676 /* FileFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFactory.h; sourceTree = "<group>"; };
-               E38E16C60D25F9FA00618676 /* FileFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileFileReader.cpp; sourceTree = "<group>"; };
-               E38E16C70D25F9FA00618676 /* FileFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFileReader.h; sourceTree = "<group>"; };
-               E38E16CA0D25F9FA00618676 /* FileHD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileHD.cpp; sourceTree = "<group>"; };
-               E38E16CB0D25F9FA00618676 /* FileHD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileHD.h; sourceTree = "<group>"; };
-               E38E16CC0D25F9FA00618676 /* FileISO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileISO.cpp; sourceTree = "<group>"; };
-               E38E16CD0D25F9FA00618676 /* FileISO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileISO.h; sourceTree = "<group>"; };
-               E38E16CE0D25F9FA00618676 /* FileLastFM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileLastFM.cpp; sourceTree = "<group>"; };
-               E38E16CF0D25F9FA00618676 /* FileLastFM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileLastFM.h; sourceTree = "<group>"; };
-               E38E16D20D25F9FA00618676 /* FileMusicDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileMusicDatabase.cpp; sourceTree = "<group>"; };
-               E38E16D30D25F9FA00618676 /* FileMusicDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMusicDatabase.h; sourceTree = "<group>"; };
-               E38E16D40D25F9FA00618676 /* FileRar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRar.cpp; sourceTree = "<group>"; };
-               E38E16D50D25F9FA00618676 /* FileRar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRar.h; sourceTree = "<group>"; };
-               E38E16D60D25F9FA00618676 /* FileRTV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileRTV.cpp; sourceTree = "<group>"; };
-               E38E16D70D25F9FA00618676 /* FileRTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileRTV.h; sourceTree = "<group>"; };
-               E38E16DB0D25F9FA00618676 /* FileSmb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSmb.h; sourceTree = "<group>"; };
-               E38E16DE0D25F9FA00618676 /* FileTuxBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileTuxBox.cpp; sourceTree = "<group>"; };
-               E38E16DF0D25F9FA00618676 /* FileTuxBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTuxBox.h; sourceTree = "<group>"; };
-               E38E16E20D25F9FA00618676 /* FileZip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileZip.cpp; sourceTree = "<group>"; };
-               E38E16E30D25F9FA00618676 /* FileZip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileZip.h; sourceTree = "<group>"; };
                E38E16E40D25F9FA00618676 /* FTPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPDirectory.cpp; sourceTree = "<group>"; };
                E38E16E50D25F9FA00618676 /* FTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPDirectory.h; sourceTree = "<group>"; };
                E38E16E60D25F9FA00618676 /* FTPParse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPParse.cpp; sourceTree = "<group>"; };
                E38E16E70D25F9FA00618676 /* FTPParse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPParse.h; sourceTree = "<group>"; };
                E38E16E80D25F9FA00618676 /* HDDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDDirectory.cpp; sourceTree = "<group>"; };
                E38E16E90D25F9FA00618676 /* HDDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDDirectory.h; sourceTree = "<group>"; };
-               E38E16EA0D25F9FA00618676 /* HDHomeRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDHomeRun.cpp; sourceTree = "<group>"; };
-               E38E16EB0D25F9FA00618676 /* HDHomeRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDHomeRun.h; sourceTree = "<group>"; };
                E38E16EC0D25F9FA00618676 /* IDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDirectory.cpp; sourceTree = "<group>"; };
                E38E16ED0D25F9FA00618676 /* IDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDirectory.h; sourceTree = "<group>"; };
                E38E16EE0D25F9FA00618676 /* IFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IFile.cpp; sourceTree = "<group>"; };
                E38E259C0D263CE000618676 /* xbmcplugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xbmcplugin.cpp; sourceTree = "<group>"; };
                E38E25BF0D263DC100618676 /* DVDFactoryDemuxer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDFactoryDemuxer.cpp; sourceTree = "<group>"; };
                E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDDemuxFFmpeg.cpp; sourceTree = "<group>"; };
-               E38F12C10D29FF200035C331 /* FileShoutcast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileShoutcast.cpp; sourceTree = "<group>"; };
                E3A478090D29029A00F3C3A6 /* GUIDialogCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogCache.cpp; sourceTree = "<group>"; };
                E3A478190D29032C00F3C3A6 /* GUIDialogAccessPoints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogAccessPoints.cpp; sourceTree = "<group>"; };
                E3B53E7A0D97B08100021A96 /* DVDSubtitleParserMicroDVD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDSubtitleParserMicroDVD.cpp; sourceTree = "<group>"; };
                E3B53E7B0D97B08100021A96 /* DVDSubtitleParserMicroDVD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDSubtitleParserMicroDVD.h; sourceTree = "<group>"; };
                E3BBB7980D7EA78A00CAAFD3 /* MythSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythSession.cpp; sourceTree = "<group>"; };
-               E3DAAF8A0D6E1B0500F17647 /* FileSmb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSmb.cpp; sourceTree = "<group>"; };
                E3DAAF8B0D6E1B0500F17647 /* SMBDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SMBDirectory.cpp; sourceTree = "<group>"; };
                E3E91FFA0D8C61DF002BF43D /* EventPacket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventPacket.cpp; sourceTree = "<group>"; };
                E3E91FFB0D8C61DF002BF43D /* EventServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventServer.cpp; sourceTree = "<group>"; };
                F57A1D1D1329B15300498CC7 /* AutoPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoPool.mm; sourceTree = "<group>"; };
                F57B6F7E1071B8B500079ACB /* JobManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JobManager.cpp; sourceTree = "<group>"; };
                F57B6F7F1071B8B500079ACB /* JobManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JobManager.h; sourceTree = "<group>"; };
-               F584E1270F257BD800DB26A5 /* FileSpecialProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSpecialProtocol.cpp; sourceTree = "<group>"; };
-               F584E1280F257BD800DB26A5 /* FileSpecialProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSpecialProtocol.h; sourceTree = "<group>"; };
                F584E12C0F257C5100DB26A5 /* HTTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPDirectory.h; sourceTree = "<group>"; };
                F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPDirectory.cpp; sourceTree = "<group>"; };
                F58E293711FFC103006F4D46 /* DVDInputStreamBluray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDInputStreamBluray.cpp; sourceTree = "<group>"; };
                F5A7A701112893E50059D6AA /* AnnouncementManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnnouncementManager.h; sourceTree = "<group>"; };
                F5A7A859112908F00059D6AA /* WebServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebServer.cpp; sourceTree = "<group>"; };
                F5A7A85A112908F00059D6AA /* WebServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebServer.h; sourceTree = "<group>"; };
-               F5A7B374113AFB5F0059D6AA /* FileSFTP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSFTP.cpp; sourceTree = "<group>"; };
-               F5A7B375113AFB5F0059D6AA /* FileSFTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSFTP.h; sourceTree = "<group>"; };
                F5A7B37C113AFB900059D6AA /* SFTPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SFTPDirectory.cpp; sourceTree = "<group>"; };
                F5A7B37D113AFB900059D6AA /* SFTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFTPDirectory.h; sourceTree = "<group>"; };
                F5A7B42A113CBB950059D6AA /* AddonsDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddonsDirectory.h; sourceTree = "<group>"; };
                                F5A7B42A113CBB950059D6AA /* AddonsDirectory.h */,
                                DF24A6B01406C7C500C7721E /* AFPDirectory.cpp */,
                                DF24A6B11406C7C500C7721E /* AFPDirectory.h */,
+                               DF93D6631444A8B0007C6459 /* AFPFile.cpp */,
+                               DF93D6641444A8B0007C6459 /* AFPFile.h */,
                                88ACB0190DCF40800083CFDF /* ASAPFileDirectory.cpp */,
                                88ACB01A0DCF40800083CFDF /* ASAPFileDirectory.h */,
-                               7C99B6A2133D342100FC2B16 /* CacheCircular.cpp */,
-                               7C99B6A3133D342100FC2B16 /* CacheCircular.h */,
-                               E38E16970D25F9FA00618676 /* CacheMemBuffer.cpp */,
-                               E38E16980D25F9FA00618676 /* CacheMemBuffer.h */,
                                E38E16990D25F9FA00618676 /* CacheStrategy.cpp */,
                                E38E169A0D25F9FA00618676 /* CacheStrategy.h */,
                                E38E169B0D25F9FA00618676 /* CDDADirectory.cpp */,
                                E38E169C0D25F9FA00618676 /* CDDADirectory.h */,
+                               DF93D6691444A8B0007C6459 /* CDDAFile.cpp */,
+                               DF93D66A1444A8B0007C6459 /* CDDAFile.h */,
+                               7C99B6A2133D342100FC2B16 /* CircularCache.cpp */,
+                               7C99B6A3133D342100FC2B16 /* CircularCache.h */,
+                               DF93D66B1444A8B0007C6459 /* CurlFile.cpp */,
+                               DF93D66C1444A8B0007C6459 /* CurlFile.h */,
                                E38E16AA0D25F9FA00618676 /* DAAPDirectory.cpp */,
                                E38E16AB0D25F9FA00618676 /* DAAPDirectory.h */,
+                               DF93D66D1444A8B0007C6459 /* DAAPFile.cpp */,
+                               DF93D66E1444A8B0007C6459 /* DAAPFile.h */,
                                7C45DBE710F325C400D4BBF3 /* DAVDirectory.cpp */,
                                7C45DBE810F325C400D4BBF3 /* DAVDirectory.h */,
                                E38E16AC0D25F9FA00618676 /* Directory.cpp */,
                                E38E16AD0D25F9FA00618676 /* Directory.h */,
-                               E38E16AE0D25F9FA00618676 /* DirectoryCache.cpp */,
-                               E38E16AF0D25F9FA00618676 /* DirectoryCache.h */,
+                               DF93D6651444A8B0007C6459 /* DirectoryCache.cpp */,
+                               DF93D6661444A8B0007C6459 /* DirectoryCache.h */,
+                               DF93D66F1444A8B0007C6459 /* DirectoryFactory.cpp */,
+                               DF93D6701444A8B0007C6459 /* DirectoryFactory.h */,
                                E38E16B00D25F9FA00618676 /* DirectoryHistory.cpp */,
                                E38E16B10D25F9FA00618676 /* DirectoryHistory.h */,
-                               E38E16B20D25F9FA00618676 /* DirectoryTuxBox.cpp */,
-                               E38E16B30D25F9FA00618676 /* DirectoryTuxBox.h */,
                                E38E16B40D25F9FA00618676 /* DllLibCurl.cpp */,
                                E38E16B50D25F9FA00618676 /* DllLibCurl.h */,
-                               E38E16B60D25F9FA00618676 /* FactoryDirectory.cpp */,
-                               E38E16B70D25F9FA00618676 /* FactoryDirectory.h */,
-                               E38E16B80D25F9FA00618676 /* FactoryFileDirectory.cpp */,
-                               E38E16B90D25F9FA00618676 /* FactoryFileDirectory.h */,
                                E38E16BA0D25F9FA00618676 /* File.cpp */,
                                E38E16BB0D25F9FA00618676 /* File.h */,
-                               DF24A6B21406C7C500C7721E /* FileAFP.cpp */,
-                               DF24A6B31406C7C500C7721E /* FileAFP.h */,
-                               E38E16BC0D25F9FA00618676 /* FileCache.cpp */,
-                               E38E16BD0D25F9FA00618676 /* FileCache.h */,
-                               E38E16BE0D25F9FA00618676 /* FileCDDA.cpp */,
-                               E38E16BF0D25F9FA00618676 /* FileCDDA.h */,
-                               E38E16C00D25F9FA00618676 /* FileCurl.cpp */,
-                               E38E16C10D25F9FA00618676 /* FileCurl.h */,
-                               E38E16C20D25F9FA00618676 /* FileDAAP.cpp */,
-                               E38E16C30D25F9FA00618676 /* FileDAAP.h */,
+                               DF93D6671444A8B0007C6459 /* FileCache.cpp */,
+                               DF93D6681444A8B0007C6459 /* FileCache.h */,
+                               DF93D6711444A8B0007C6459 /* FileDirectoryFactory.cpp */,
+                               DF93D6721444A8B0007C6459 /* FileDirectoryFactory.h */,
                                E38E16C40D25F9FA00618676 /* FileFactory.cpp */,
                                E38E16C50D25F9FA00618676 /* FileFactory.h */,
-                               E38E16C60D25F9FA00618676 /* FileFileReader.cpp */,
-                               E38E16C70D25F9FA00618676 /* FileFileReader.h */,
-                               E38E16CA0D25F9FA00618676 /* FileHD.cpp */,
-                               E38E16CB0D25F9FA00618676 /* FileHD.h */,
-                               E38E16CC0D25F9FA00618676 /* FileISO.cpp */,
-                               E38E16CD0D25F9FA00618676 /* FileISO.h */,
-                               E38E16CE0D25F9FA00618676 /* FileLastFM.cpp */,
-                               E38E16CF0D25F9FA00618676 /* FileLastFM.h */,
-                               E38E16D20D25F9FA00618676 /* FileMusicDatabase.cpp */,
-                               E38E16D30D25F9FA00618676 /* FileMusicDatabase.h */,
-                               DF0DF15713A3ADA7008ED511 /* FileNFS.cpp */,
-                               DF0DF15813A3ADA7008ED511 /* FileNFS.h */,
-                               DF448459140048C80069344B /* FilePipe.cpp */,
-                               DF44845A140048C80069344B /* FilePipe.h */,
-                               E38E16D40D25F9FA00618676 /* FileRar.cpp */,
-                               E38E16D50D25F9FA00618676 /* FileRar.h */,
-                               E38E16D60D25F9FA00618676 /* FileRTV.cpp */,
-                               E38E16D70D25F9FA00618676 /* FileRTV.h */,
-                               F5A7B374113AFB5F0059D6AA /* FileSFTP.cpp */,
-                               F5A7B375113AFB5F0059D6AA /* FileSFTP.h */,
-                               E38F12C10D29FF200035C331 /* FileShoutcast.cpp */,
-                               E3DAAF8A0D6E1B0500F17647 /* FileSmb.cpp */,
-                               E38E16DB0D25F9FA00618676 /* FileSmb.h */,
-                               F584E1270F257BD800DB26A5 /* FileSpecialProtocol.cpp */,
-                               F584E1280F257BD800DB26A5 /* FileSpecialProtocol.h */,
-                               E38E16DE0D25F9FA00618676 /* FileTuxBox.cpp */,
-                               E38E16DF0D25F9FA00618676 /* FileTuxBox.h */,
-                               433219D112E4C6A500CD7486 /* FileUDF.cpp */,
-                               433219D212E4C6A500CD7486 /* FileUDF.h */,
-                               DF85BAB41443669A000686BE /* FileUPnP.cpp */,
-                               DF85BAB31443669A000686BE /* FileUPnP.h */,
-                               E38E16E20D25F9FA00618676 /* FileZip.cpp */,
-                               E38E16E30D25F9FA00618676 /* FileZip.h */,
+                               DF93D6731444A8B0007C6459 /* FileReaderFile.cpp */,
+                               DF93D6741444A8B0007C6459 /* FileReaderFile.h */,
                                E38E16E40D25F9FA00618676 /* FTPDirectory.cpp */,
                                E38E16E50D25F9FA00618676 /* FTPDirectory.h */,
                                E38E16E60D25F9FA00618676 /* FTPParse.cpp */,
                                E38E16E70D25F9FA00618676 /* FTPParse.h */,
                                E38E16E80D25F9FA00618676 /* HDDirectory.cpp */,
                                E38E16E90D25F9FA00618676 /* HDDirectory.h */,
-                               E38E16EA0D25F9FA00618676 /* HDHomeRun.cpp */,
-                               E38E16EB0D25F9FA00618676 /* HDHomeRun.h */,
+                               DF93D6751444A8B0007C6459 /* HDFile.cpp */,
+                               DF93D6761444A8B0007C6459 /* HDFile.h */,
+                               DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */,
+                               DF93D7F41444B568007C6459 /* HDHomeRunDirectory.h */,
+                               DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */,
+                               DF93D7F11444B54A007C6459 /* HDHomeRunFile.h */,
                                E43196140FB2382E0030E150 /* HTSPDirectory.cpp */,
                                E43196130FB2382D0030E150 /* HTSPDirectory.h */,
                                E43196160FB2382E0030E150 /* HTSPSession.cpp */,
                                E38E16F20D25F9FA00618676 /* iso9660.h */,
                                E38E16F30D25F9FA00618676 /* ISO9660Directory.cpp */,
                                E38E16F40D25F9FA00618676 /* ISO9660Directory.h */,
+                               DF93D6771444A8B0007C6459 /* ISOFile.cpp */,
+                               DF93D6781444A8B0007C6459 /* ISOFile.h */,
                                E38E16F50D25F9FA00618676 /* LastFMDirectory.cpp */,
                                E38E16F60D25F9FA00618676 /* LastFMDirectory.h */,
+                               DF93D6791444A8B0007C6459 /* LastFMFile.cpp */,
+                               DF93D67A1444A8B0007C6459 /* LastFMFile.h */,
+                               E38E16970D25F9FA00618676 /* MemBufferCache.cpp */,
+                               E38E16980D25F9FA00618676 /* MemBufferCache.h */,
                                E38E17080D25F9FA00618676 /* MultiPathDirectory.cpp */,
                                E38E17090D25F9FA00618676 /* MultiPathDirectory.h */,
                                F50629780E57B9680066625A /* MultiPathFile.cpp */,
                                F50629790E57B9680066625A /* MultiPathFile.h */,
                                E38E17370D25F9FA00618676 /* MusicDatabaseDirectory.cpp */,
                                E38E17380D25F9FA00618676 /* MusicDatabaseDirectory.h */,
+                               DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */,
+                               DF93D67C1444A8B0007C6459 /* MusicDatabaseFile.h */,
                                880DBE530DC224A100E26B71 /* MusicFileDirectory.cpp */,
                                880DBE540DC224A100E26B71 /* MusicFileDirectory.h */,
                                E38E17390D25F9FA00618676 /* MusicSearchDirectory.cpp */,
                                E3BBB7980D7EA78A00CAAFD3 /* MythSession.cpp */,
                                DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */,
                                DF0DF15A13A3ADA7008ED511 /* NFSDirectory.h */,
+                               DF93D67D1444A8B0007C6459 /* NFSFile.cpp */,
+                               DF93D67E1444A8B0007C6459 /* NFSFile.h */,
                                E4E91BB70E7F7338001F0546 /* NptXbmcFile.cpp */,
                                E38E173C0D25F9FA00618676 /* NSFFileDirectory.cpp */,
                                E38E173D0D25F9FA00618676 /* NSFFileDirectory.h */,
                                E38E173E0D25F9FA00618676 /* OGGFileDirectory.cpp */,
                                E38E173F0D25F9FA00618676 /* OGGFileDirectory.h */,
+                               DF93D67F1444A8B0007C6459 /* PipeFile.cpp */,
+                               DF93D6801444A8B0007C6459 /* PipeFile.h */,
                                DF44845B140048C80069344B /* PipesManager.cpp */,
                                DF44845C140048C80069344B /* PipesManager.h */,
                                E38E17400D25F9FA00618676 /* PlaylistDirectory.cpp */,
                                E38E17450D25F9FA00618676 /* PluginDirectory.h */,
                                E38E17460D25F9FA00618676 /* RarDirectory.cpp */,
                                E38E17470D25F9FA00618676 /* RarDirectory.h */,
+                               DF93D6811444A8B0007C6459 /* RarFile.cpp */,
+                               DF93D6821444A8B0007C6459 /* RarFile.h */,
                                E38E17480D25F9FA00618676 /* RarManager.cpp */,
                                E38E17490D25F9FA00618676 /* RarManager.h */,
                                889B4D8C0E0EF86C00FAD25E /* RSSDirectory.cpp */,
                                889B4D8D0E0EF86C00FAD25E /* RSSDirectory.h */,
                                E38E174B0D25F9FA00618676 /* RTVDirectory.cpp */,
                                E38E174C0D25F9FA00618676 /* RTVDirectory.h */,
+                               DF93D6831444A8B0007C6459 /* RTVFile.cpp */,
+                               DF93D6841444A8B0007C6459 /* RTVFile.h */,
                                E4DC97500FFE5BA8008E0C07 /* SAPDirectory.cpp */,
                                E4DC97510FFE5BA8008E0C07 /* SAPDirectory.h */,
                                E4DC97520FFE5BA8008E0C07 /* SAPFile.cpp */,
                                E4DC97530FFE5BA8008E0C07 /* SAPFile.h */,
                                F5A7B37C113AFB900059D6AA /* SFTPDirectory.cpp */,
                                F5A7B37D113AFB900059D6AA /* SFTPDirectory.h */,
+                               DF93D6851444A8B0007C6459 /* SFTPFile.cpp */,
+                               DF93D6861444A8B0007C6459 /* SFTPFile.h */,
+                               DF93D6871444A8B0007C6459 /* ShoutcastFile.cpp */,
+                               DF93D6881444A8B0007C6459 /* ShoutcastFile.h */,
                                E38E17510D25F9FA00618676 /* SIDFileDirectory.cpp */,
                                E38E17520D25F9FA00618676 /* SIDFileDirectory.h */,
-                               18404D9C1396C13500863BBA /* Slingbox.cpp */,
-                               18404D9D1396C13500863BBA /* Slingbox.h */,
+                               DF93D65C1444A7A3007C6459 /* SlingboxDirectory.cpp */,
+                               DF93D65B1444A7A3007C6459 /* SlingboxDirectory.h */,
+                               DF93D6891444A8B0007C6459 /* SlingboxFile.cpp */,
+                               DF93D68A1444A8B0007C6459 /* SlingboxFile.h */,
                                E38E17530D25F9FA00618676 /* SmartPlaylistDirectory.cpp */,
                                E38E17540D25F9FA00618676 /* SmartPlaylistDirectory.h */,
                                E3DAAF8B0D6E1B0500F17647 /* SMBDirectory.cpp */,
                                E38E17560D25F9FA00618676 /* SMBDirectory.h */,
+                               DF93D68B1444A8B0007C6459 /* SmbFile.cpp */,
+                               DF93D68C1444A8B0007C6459 /* SmbFile.h */,
                                7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */,
                                7C84A59D12FA3C1600CD1714 /* SourcesDirectory.h */,
                                7C2D6AE20F35453E00DD2E85 /* SpecialProtocol.cpp */,
                                7C2D6AE30F35453E00DD2E85 /* SpecialProtocol.h */,
                                7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */,
                                7CEBD8A70F33A0D800CAF6AD /* SpecialProtocolDirectory.h */,
+                               DF93D68D1444A8B0007C6459 /* SpecialProtocolFile.cpp */,
+                               DF93D68E1444A8B0007C6459 /* SpecialProtocolFile.h */,
                                E38E17590D25F9FA00618676 /* StackDirectory.cpp */,
                                E38E175A0D25F9FA00618676 /* StackDirectory.h */,
+                               DF93D68F1444A8B0007C6459 /* TuxBoxDirectory.cpp */,
+                               DF93D6901444A8B0007C6459 /* TuxBoxDirectory.h */,
+                               DF93D6911444A8B0007C6459 /* TuxBoxFile.cpp */,
+                               DF93D6921444A8B0007C6459 /* TuxBoxFile.h */,
                                433219D312E4C6A500CD7486 /* udf25.cpp */,
                                433219D412E4C6A500CD7486 /* udf25.h */,
                                433219D512E4C6A500CD7486 /* UDFDirectory.cpp */,
                                433219D612E4C6A500CD7486 /* UDFDirectory.h */,
+                               DF93D6931444A8B0007C6459 /* UDFFile.cpp */,
+                               DF93D6941444A8B0007C6459 /* UDFFile.h */,
                                E38E175B0D25F9FA00618676 /* UPnPDirectory.cpp */,
                                E38E175C0D25F9FA00618676 /* UPnPDirectory.h */,
+                               DF93D6951444A8B0007C6459 /* UPnPFile.cpp */,
+                               DF93D6961444A8B0007C6459 /* UPnPFile.h */,
                                E38E178A0D25F9FA00618676 /* VideoDatabaseDirectory.cpp */,
                                E38E178B0D25F9FA00618676 /* VideoDatabaseDirectory.h */,
                                E38E178C0D25F9FA00618676 /* VirtualDirectory.cpp */,
                                E49ACD8A100745C400A86ECD /* ZeroconfDirectory.h */,
                                E38E17930D25F9FA00618676 /* ZipDirectory.cpp */,
                                E38E17940D25F9FA00618676 /* ZipDirectory.h */,
+                               DF93D6971444A8B0007C6459 /* ZipFile.cpp */,
+                               DF93D6981444A8B0007C6459 /* ZipFile.h */,
                                E38E17950D25F9FA00618676 /* ZipManager.cpp */,
                                E38E17960D25F9FA00618676 /* ZipManager.h */,
                        );
                                E38E1FFC0D25F9FD00618676 /* DynamicDll.cpp in Sources */,
                                E38E1FFE0D25F9FD00618676 /* Favourites.cpp in Sources */,
                                E38E1FFF0D25F9FD00618676 /* FileItem.cpp in Sources */,
-                               E38E20010D25F9FD00618676 /* CacheMemBuffer.cpp in Sources */,
+                               E38E20010D25F9FD00618676 /* MemBufferCache.cpp in Sources */,
                                E38E20020D25F9FD00618676 /* CacheStrategy.cpp in Sources */,
                                E38E20030D25F9FD00618676 /* CDDADirectory.cpp in Sources */,
                                E38E20040D25F9FD00618676 /* cddb.cpp in Sources */,
                                E38E20050D25F9FD00618676 /* cdioSupport.cpp in Sources */,
                                E38E20060D25F9FD00618676 /* DAAPDirectory.cpp in Sources */,
                                E38E20070D25F9FD00618676 /* Directory.cpp in Sources */,
-                               E38E20080D25F9FD00618676 /* DirectoryCache.cpp in Sources */,
                                E38E20090D25F9FD00618676 /* DirectoryHistory.cpp in Sources */,
-                               E38E200A0D25F9FD00618676 /* DirectoryTuxBox.cpp in Sources */,
                                E38E200B0D25F9FD00618676 /* DllLibCurl.cpp in Sources */,
-                               E38E200C0D25F9FD00618676 /* FactoryDirectory.cpp in Sources */,
-                               E38E200D0D25F9FD00618676 /* FactoryFileDirectory.cpp in Sources */,
                                E38E200E0D25F9FD00618676 /* File.cpp in Sources */,
-                               E38E200F0D25F9FD00618676 /* FileCache.cpp in Sources */,
-                               E38E20100D25F9FD00618676 /* FileCDDA.cpp in Sources */,
-                               E38E20110D25F9FD00618676 /* FileCurl.cpp in Sources */,
-                               E38E20120D25F9FD00618676 /* FileDAAP.cpp in Sources */,
                                E38E20130D25F9FD00618676 /* FileFactory.cpp in Sources */,
-                               E38E20140D25F9FD00618676 /* FileFileReader.cpp in Sources */,
-                               E38E20160D25F9FD00618676 /* FileHD.cpp in Sources */,
-                               E38E20170D25F9FD00618676 /* FileISO.cpp in Sources */,
-                               E38E20180D25F9FD00618676 /* FileLastFM.cpp in Sources */,
-                               E38E201A0D25F9FD00618676 /* FileMusicDatabase.cpp in Sources */,
-                               E38E201B0D25F9FD00618676 /* FileRar.cpp in Sources */,
-                               E38E201C0D25F9FD00618676 /* FileRTV.cpp in Sources */,
-                               E38E20200D25F9FD00618676 /* FileTuxBox.cpp in Sources */,
-                               E38E20220D25F9FD00618676 /* FileZip.cpp in Sources */,
                                E38E20230D25F9FD00618676 /* FTPDirectory.cpp in Sources */,
                                E38E20240D25F9FD00618676 /* FTPParse.cpp in Sources */,
                                E38E20250D25F9FD00618676 /* HDDirectory.cpp in Sources */,
-                               E38E20260D25F9FD00618676 /* HDHomeRun.cpp in Sources */,
                                E38E20270D25F9FD00618676 /* IDirectory.cpp in Sources */,
                                E38E20280D25F9FD00618676 /* IFile.cpp in Sources */,
                                E38E20290D25F9FD00618676 /* iso9660.cpp in Sources */,
                                E38E25C30D263DE200618676 /* DVDDemuxFFmpeg.cpp in Sources */,
                                E3A4780A0D29029A00F3C3A6 /* GUIDialogCache.cpp in Sources */,
                                E3A4781A0D29032C00F3C3A6 /* GUIDialogAccessPoints.cpp in Sources */,
-                               E38F12C20D29FF200035C331 /* FileShoutcast.cpp in Sources */,
                                E36578880D3AA7B40033CC1C /* DVDPlayerCodec.cpp in Sources */,
                                E33206380D5070AA00435CE3 /* DVDDemuxVobsub.cpp in Sources */,
                                E33979960D62FD48004ECDDA /* DVDInputStreamTV.cpp in Sources */,
                                810C9F630D67BD2F0095F5DD /* PltMediaConnect.cpp in Sources */,
                                810C9FA90D67D1FB0095F5DD /* MythDirectory.cpp in Sources */,
                                810C9FAA0D67D1FB0095F5DD /* MythFile.cpp in Sources */,
-                               E3DAAF8C0D6E1B0500F17647 /* FileSmb.cpp in Sources */,
                                E3DAAF8D0D6E1B0500F17647 /* SMBDirectory.cpp in Sources */,
                                E3BBB7990D7EA78A00CAAFD3 /* MythSession.cpp in Sources */,
                                E3E91FFD0D8C61DF002BF43D /* EventPacket.cpp in Sources */,
                                F5A00B080EFDDDFC00CD59F3 /* AudioRendererFactory.cpp in Sources */,
                                F5A00B260EFDE44100CD59F3 /* NullDirectSound.cpp in Sources */,
                                7C5608C70F1754930056433A /* ExternalPlayer.cpp in Sources */,
-                               F584E1290F257BD800DB26A5 /* FileSpecialProtocol.cpp in Sources */,
                                F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */,
                                F54C51D20F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp in Sources */,
                                F54C51D50F1E784800D46E3C /* karaokelyricscdg.cpp in Sources */,
                                F5A7A702112893E50059D6AA /* AnnouncementManager.cpp in Sources */,
                                F5A7A85B112908F00059D6AA /* WebServer.cpp in Sources */,
                                7C7B2B301134F36400713D6D /* mysqldataset.cpp in Sources */,
-                               F5A7B376113AFB5F0059D6AA /* FileSFTP.cpp in Sources */,
                                F5A7B37E113AFB900059D6AA /* SFTPDirectory.cpp in Sources */,
                                F5A7B42C113CBB950059D6AA /* AddonsDirectory.cpp in Sources */,
                                18B4A0021152BFA5001AF8A6 /* Addon.cpp in Sources */,
                                18B7CA1E12944A8E009E7A26 /* tinyxmlparser.cpp in Sources */,
                                432D7CE412D86DA500CE4C49 /* NetworkLinux.cpp in Sources */,
                                432D7CF712D870E800CE4C49 /* TCPServer.cpp in Sources */,
-                               433219D712E4C6A500CD7486 /* FileUDF.cpp in Sources */,
                                433219D812E4C6A500CD7486 /* udf25.cpp in Sources */,
                                433219D912E4C6A500CD7486 /* UDFDirectory.cpp in Sources */,
                                7C4705AE12EF584C00369E51 /* AddonInstaller.cpp in Sources */,
                                7C84A59E12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */,
                                F57A1D1E1329B15300498CC7 /* AutoPool.mm in Sources */,
                                F5B13C8D1334056B0045076D /* DarwinUtils.mm in Sources */,
-                               7C99B6A4133D342100FC2B16 /* CacheCircular.cpp in Sources */,
+                               7C99B6A4133D342100FC2B16 /* CircularCache.cpp in Sources */,
                                7C99B7951340723F00FC2B16 /* GUIDialogPlayEject.cpp in Sources */,
                                F5AE407613415D8D0004BD79 /* HttpApi.cpp in Sources */,
                                F5AE407913415D8D0004BD79 /* XBMChttp.cpp in Sources */,
                                18ACF84313596C9B00B67371 /* RecentlyAddedJob.cpp in Sources */,
                                C807114D135DB5CC002F601B /* InputOperations.cpp in Sources */,
                                C8EC5D0E1369519D00CCC10D /* XBMC_keytable.cpp in Sources */,
-                               18404D9E1396C13500863BBA /* Slingbox.cpp in Sources */,
                                1840B74D13993D8A007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B75313993DA0007C848B /* JSONVariantWriter.cpp in Sources */,
                                7C0A7EC013A5DBCE00AFC2BD /* AppParamParser.cpp in Sources */,
                                F558F27B13ABD56600631E12 /* DirtyRegionSolvers.cpp in Sources */,
                                F558F27F13ABD57400631E12 /* DirtyRegionTracker.cpp in Sources */,
                                F558F29613ABD7DF00631E12 /* GUIWindowDebugInfo.cpp in Sources */,
-                               DF0DF15B13A3ADA7008ED511 /* FileNFS.cpp in Sources */,
                                DF0DF15C13A3ADA7008ED511 /* NFSDirectory.cpp in Sources */,
                                7C89619213B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
                                1830212813B8E2DC00770920 /* controledit.cpp in Sources */,
                                DF34898213FDAAF60026A711 /* HttpParser.cpp in Sources */,
                                18968DC814155D7C005BA742 /* ApplicationOperations.cpp in Sources */,
                                DF24A6B41406C7C500C7721E /* AFPDirectory.cpp in Sources */,
-                               DF24A6B51406C7C500C7721E /* FileAFP.cpp in Sources */,
                                32C631281423A90F00F18420 /* JpegIO.cpp in Sources */,
                                DF448457140048A60069344B /* AirTunesServer.cpp in Sources */,
-                               DF44845D140048C80069344B /* FilePipe.cpp in Sources */,
                                DF44845E140048C80069344B /* PipesManager.cpp in Sources */,
                                DF4484EE140054530069344B /* BXAcodec.cpp in Sources */,
                                DF98D98C1434F47D00A6EBE1 /* SkinVariable.cpp in Sources */,
                                F5E1125E14356B2400175026 /* pyrendercapture.cpp in Sources */,
                                F5E1138014357F3800175026 /* PeripheralCecAdapter.cpp in Sources */,
                                F54BCC5F1439345300F86B0F /* HotKeyController.m in Sources */,
-                               DF85BAB51443669A000686BE /* FileUPnP.cpp in Sources */,
                                DF673AA51443819600A5A509 /* AddonManager.cpp in Sources */,
                                F5BD02F6148D3A7E001B5583 /* CryptThreading.cpp in Sources */,
                                7CCFD98D151494E100211D82 /* PCMCodec.cpp in Sources */,
                                DFCA6AC9152245CD000BFAAE /* HTTPWebinterfaceAddonsHandler.cpp in Sources */,
                                DFCA6ACA152245CD000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */,
                                DFCA6ACB152245CD000BFAAE /* IHTTPRequestHandler.cpp in Sources */,
+                               DF93D65D1444A7A3007C6459 /* SlingboxDirectory.cpp in Sources */,
+                               DF93D6991444A8B1007C6459 /* AFPFile.cpp in Sources */,
+                               DF93D69A1444A8B1007C6459 /* DirectoryCache.cpp in Sources */,
+                               DF93D69B1444A8B1007C6459 /* FileCache.cpp in Sources */,
+                               DF93D69C1444A8B1007C6459 /* CDDAFile.cpp in Sources */,
+                               DF93D69D1444A8B1007C6459 /* CurlFile.cpp in Sources */,
+                               DF93D69E1444A8B1007C6459 /* DAAPFile.cpp in Sources */,
+                               DF93D69F1444A8B1007C6459 /* DirectoryFactory.cpp in Sources */,
+                               DF93D6A01444A8B1007C6459 /* FileDirectoryFactory.cpp in Sources */,
+                               DF93D6A11444A8B1007C6459 /* FileReaderFile.cpp in Sources */,
+                               DF93D6A21444A8B1007C6459 /* HDFile.cpp in Sources */,
+                               DF93D6A31444A8B1007C6459 /* ISOFile.cpp in Sources */,
+                               DF93D6A41444A8B1007C6459 /* LastFMFile.cpp in Sources */,
+                               DF93D6A51444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */,
+                               DF93D6A61444A8B1007C6459 /* NFSFile.cpp in Sources */,
+                               DF93D6A71444A8B1007C6459 /* PipeFile.cpp in Sources */,
+                               DF93D6A81444A8B1007C6459 /* RarFile.cpp in Sources */,
+                               DF93D6A91444A8B1007C6459 /* RTVFile.cpp in Sources */,
+                               DF93D6AA1444A8B1007C6459 /* SFTPFile.cpp in Sources */,
+                               DF93D6AB1444A8B1007C6459 /* ShoutcastFile.cpp in Sources */,
+                               DF93D6AC1444A8B1007C6459 /* SlingboxFile.cpp in Sources */,
+                               DF93D6AD1444A8B1007C6459 /* SmbFile.cpp in Sources */,
+                               DF93D6AE1444A8B1007C6459 /* SpecialProtocolFile.cpp in Sources */,
+                               DF93D6AF1444A8B1007C6459 /* TuxBoxDirectory.cpp in Sources */,
+                               DF93D6B01444A8B1007C6459 /* TuxBoxFile.cpp in Sources */,
+                               DF93D6B11444A8B1007C6459 /* UDFFile.cpp in Sources */,
+                               DF93D6B21444A8B1007C6459 /* UPnPFile.cpp in Sources */,
+                               DF93D6B31444A8B1007C6459 /* ZipFile.cpp in Sources */,
+                               DF93D7F21444B54A007C6459 /* HDHomeRunFile.cpp in Sources */,
+                               DF93D7F61444B568007C6459 /* HDHomeRunDirectory.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                F5A1C93E0F6B06CF00A96ABD /* DynamicDll.cpp in Sources */,
                                F5A1C9400F6B06CF00A96ABD /* Favourites.cpp in Sources */,
                                F5A1C9410F6B06CF00A96ABD /* FileItem.cpp in Sources */,
-                               F5A1C9420F6B06CF00A96ABD /* CacheMemBuffer.cpp in Sources */,
+                               F5A1C9420F6B06CF00A96ABD /* MemBufferCache.cpp in Sources */,
                                F5A1C9430F6B06CF00A96ABD /* CacheStrategy.cpp in Sources */,
                                F5A1C9440F6B06CF00A96ABD /* CDDADirectory.cpp in Sources */,
                                F5A1C9450F6B06CF00A96ABD /* cddb.cpp in Sources */,
                                F5A1C9460F6B06CF00A96ABD /* cdioSupport.cpp in Sources */,
                                F5A1C9470F6B06CF00A96ABD /* DAAPDirectory.cpp in Sources */,
                                F5A1C9480F6B06CF00A96ABD /* Directory.cpp in Sources */,
-                               F5A1C9490F6B06CF00A96ABD /* DirectoryCache.cpp in Sources */,
                                F5A1C94A0F6B06CF00A96ABD /* DirectoryHistory.cpp in Sources */,
-                               F5A1C94B0F6B06CF00A96ABD /* DirectoryTuxBox.cpp in Sources */,
                                F5A1C94C0F6B06CF00A96ABD /* DllLibCurl.cpp in Sources */,
-                               F5A1C94D0F6B06CF00A96ABD /* FactoryDirectory.cpp in Sources */,
-                               F5A1C94E0F6B06CF00A96ABD /* FactoryFileDirectory.cpp in Sources */,
                                F5A1C94F0F6B06CF00A96ABD /* File.cpp in Sources */,
-                               F5A1C9500F6B06CF00A96ABD /* FileCache.cpp in Sources */,
-                               F5A1C9510F6B06CF00A96ABD /* FileCDDA.cpp in Sources */,
-                               F5A1C9520F6B06CF00A96ABD /* FileCurl.cpp in Sources */,
-                               F5A1C9530F6B06CF00A96ABD /* FileDAAP.cpp in Sources */,
                                F5A1C9540F6B06CF00A96ABD /* FileFactory.cpp in Sources */,
-                               F5A1C9550F6B06CF00A96ABD /* FileFileReader.cpp in Sources */,
-                               F5A1C9560F6B06CF00A96ABD /* FileHD.cpp in Sources */,
-                               F5A1C9570F6B06CF00A96ABD /* FileISO.cpp in Sources */,
-                               F5A1C9580F6B06CF00A96ABD /* FileLastFM.cpp in Sources */,
-                               F5A1C9590F6B06CF00A96ABD /* FileMusicDatabase.cpp in Sources */,
-                               F5A1C95A0F6B06CF00A96ABD /* FileRar.cpp in Sources */,
-                               F5A1C95B0F6B06CF00A96ABD /* FileRTV.cpp in Sources */,
-                               F5A1C95C0F6B06CF00A96ABD /* FileTuxBox.cpp in Sources */,
-                               F5A1C95D0F6B06CF00A96ABD /* FileZip.cpp in Sources */,
                                F5A1C95E0F6B06CF00A96ABD /* FTPDirectory.cpp in Sources */,
                                F5A1C95F0F6B06CF00A96ABD /* FTPParse.cpp in Sources */,
                                F5A1C9600F6B06CF00A96ABD /* HDDirectory.cpp in Sources */,
-                               F5A1C9610F6B06CF00A96ABD /* HDHomeRun.cpp in Sources */,
                                F5A1C9620F6B06CF00A96ABD /* IDirectory.cpp in Sources */,
                                F5A1C9630F6B06CF00A96ABD /* IFile.cpp in Sources */,
                                F5A1C9640F6B06CF00A96ABD /* iso9660.cpp in Sources */,
                                F5A1CB1A0F6B06CF00A96ABD /* DVDDemuxFFmpeg.cpp in Sources */,
                                F5A1CB1B0F6B06CF00A96ABD /* GUIDialogCache.cpp in Sources */,
                                F5A1CB1D0F6B06CF00A96ABD /* GUIDialogAccessPoints.cpp in Sources */,
-                               F5A1CB1F0F6B06CF00A96ABD /* FileShoutcast.cpp in Sources */,
                                F5A1CB220F6B06CF00A96ABD /* DVDPlayerCodec.cpp in Sources */,
                                F5A1CB230F6B06CF00A96ABD /* DVDDemuxVobsub.cpp in Sources */,
                                F5A1CB240F6B06CF00A96ABD /* DVDInputStreamTV.cpp in Sources */,
                                F5A1CB250F6B06CF00A96ABD /* PltMediaConnect.cpp in Sources */,
                                F5A1CB3C0F6B06CF00A96ABD /* MythDirectory.cpp in Sources */,
                                F5A1CB3D0F6B06CF00A96ABD /* MythFile.cpp in Sources */,
-                               F5A1CB3E0F6B06CF00A96ABD /* FileSmb.cpp in Sources */,
                                F5A1CB3F0F6B06CF00A96ABD /* SMBDirectory.cpp in Sources */,
                                F5A1CB410F6B06CF00A96ABD /* MythSession.cpp in Sources */,
                                F5A1CB420F6B06CF00A96ABD /* EventPacket.cpp in Sources */,
                                F5A1CB7F0F6B06CF00A96ABD /* AudioRendererFactory.cpp in Sources */,
                                F5A1CB800F6B06CF00A96ABD /* NullDirectSound.cpp in Sources */,
                                F5A1CB810F6B06CF00A96ABD /* ExternalPlayer.cpp in Sources */,
-                               F5A1CB820F6B06CF00A96ABD /* FileSpecialProtocol.cpp in Sources */,
                                F5A1CB830F6B06CF00A96ABD /* HTTPDirectory.cpp in Sources */,
                                F5A1CB840F6B06CF00A96ABD /* GUIDialogKaraokeSongSelector.cpp in Sources */,
                                F5A1CB850F6B06CF00A96ABD /* karaokelyricscdg.cpp in Sources */,
                                F5A7A703112893E50059D6AA /* AnnouncementManager.cpp in Sources */,
                                F5A7A85C112908F00059D6AA /* WebServer.cpp in Sources */,
                                7C7B2B311134F36400713D6D /* mysqldataset.cpp in Sources */,
-                               F5A7B377113AFB5F0059D6AA /* FileSFTP.cpp in Sources */,
                                F5A7B37F113AFB900059D6AA /* SFTPDirectory.cpp in Sources */,
                                F5A7B42D113CBB950059D6AA /* AddonsDirectory.cpp in Sources */,
                                18B4A0081152BFA5001AF8A6 /* Addon.cpp in Sources */,
                                18B7CA2C12944A8E009E7A26 /* tinyxmlparser.cpp in Sources */,
                                432D7CE512D86DA500CE4C49 /* NetworkLinux.cpp in Sources */,
                                432D7CF812D870E800CE4C49 /* TCPServer.cpp in Sources */,
-                               433219DA12E4C6A500CD7486 /* FileUDF.cpp in Sources */,
                                433219DB12E4C6A500CD7486 /* udf25.cpp in Sources */,
                                433219DC12E4C6A500CD7486 /* UDFDirectory.cpp in Sources */,
                                7C4705AF12EF584C00369E51 /* AddonInstaller.cpp in Sources */,
                                7C84A59F12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */,
                                F57A1D1F1329B15300498CC7 /* AutoPool.mm in Sources */,
                                F5B13C8E1334056B0045076D /* DarwinUtils.mm in Sources */,
-                               7C99B6A5133D342100FC2B16 /* CacheCircular.cpp in Sources */,
+                               7C99B6A5133D342100FC2B16 /* CircularCache.cpp in Sources */,
                                7C99B7961340723F00FC2B16 /* GUIDialogPlayEject.cpp in Sources */,
                                F5AE407A13415D8D0004BD79 /* HttpApi.cpp in Sources */,
                                F5AE407D13415D8D0004BD79 /* XBMChttp.cpp in Sources */,
                                43EA4297136C1D9E002C82A5 /* RenderCapture.cpp in Sources */,
                                43EA429B136C1E2F002C82A5 /* xbmcvfsmodule.cpp in Sources */,
                                43EA42B0136C2274002C82A5 /* InputOperations.cpp in Sources */,
-                               18404E701396E05D00863BBA /* Slingbox.cpp in Sources */,
                                1840B74E13993D8A007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B75413993DA0007C848B /* JSONVariantWriter.cpp in Sources */,
                                7C0A7EC113A5DBCE00AFC2BD /* AppParamParser.cpp in Sources */,
                                F558F27C13ABD56600631E12 /* DirtyRegionSolvers.cpp in Sources */,
                                F558F28013ABD57400631E12 /* DirtyRegionTracker.cpp in Sources */,
                                F558F29713ABD7DF00631E12 /* GUIWindowDebugInfo.cpp in Sources */,
-                               F558F3D013AE663300631E12 /* FileNFS.cpp in Sources */,
                                F558F3D113AE663A00631E12 /* NFSDirectory.cpp in Sources */,
                                7C89619313B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
                                1830212913B8E2DC00770920 /* controledit.cpp in Sources */,
                                DF34898313FDAAF60026A711 /* HttpParser.cpp in Sources */,
                                18968DC914155D7C005BA742 /* ApplicationOperations.cpp in Sources */,
                                DF24A6B61406C7C500C7721E /* AFPDirectory.cpp in Sources */,
-                               DF24A6B71406C7C500C7721E /* FileAFP.cpp in Sources */,
                                F5E10D381428426B00175026 /* JpegIO.cpp in Sources */,
                                DF448458140048A60069344B /* AirTunesServer.cpp in Sources */,
-                               DF44845F140048C80069344B /* FilePipe.cpp in Sources */,
                                DF448460140048C80069344B /* PipesManager.cpp in Sources */,
                                DF4484EF140054530069344B /* BXAcodec.cpp in Sources */,
                                DF98D98D1434F47D00A6EBE1 /* SkinVariable.cpp in Sources */,
                                F5E1125F14356B2400175026 /* pyrendercapture.cpp in Sources */,
                                F5E1138114357F3900175026 /* PeripheralCecAdapter.cpp in Sources */,
                                F54BCC601439345300F86B0F /* HotKeyController.m in Sources */,
-                               DF85BAB61443669A000686BE /* FileUPnP.cpp in Sources */,
                                F5BD02F7148D3A7E001B5583 /* CryptThreading.cpp in Sources */,
                                7CCFD98C151494E100211D82 /* PCMCodec.cpp in Sources */,
                                DF527726151BAEDA00B5B63B /* Base64.cpp in Sources */,
                                DFCA6AD0152245CD000BFAAE /* HTTPWebinterfaceAddonsHandler.cpp in Sources */,
                                DFCA6AD1152245CD000BFAAE /* HTTPWebinterfaceHandler.cpp in Sources */,
                                DFCA6AD2152245CD000BFAAE /* IHTTPRequestHandler.cpp in Sources */,
+                               DF93D65E1444A7A3007C6459 /* SlingboxDirectory.cpp in Sources */,
+                               DF93D6B41444A8B1007C6459 /* AFPFile.cpp in Sources */,
+                               DF93D6B51444A8B1007C6459 /* DirectoryCache.cpp in Sources */,
+                               DF93D6B61444A8B1007C6459 /* FileCache.cpp in Sources */,
+                               DF93D6B71444A8B1007C6459 /* CDDAFile.cpp in Sources */,
+                               DF93D6B81444A8B1007C6459 /* CurlFile.cpp in Sources */,
+                               DF93D6B91444A8B1007C6459 /* DAAPFile.cpp in Sources */,
+                               DF93D6BA1444A8B1007C6459 /* DirectoryFactory.cpp in Sources */,
+                               DF93D6BB1444A8B1007C6459 /* FileDirectoryFactory.cpp in Sources */,
+                               DF93D6BC1444A8B1007C6459 /* FileReaderFile.cpp in Sources */,
+                               DF93D6BD1444A8B1007C6459 /* HDFile.cpp in Sources */,
+                               DF93D6BE1444A8B1007C6459 /* ISOFile.cpp in Sources */,
+                               DF93D6BF1444A8B1007C6459 /* LastFMFile.cpp in Sources */,
+                               DF93D6C01444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */,
+                               DF93D6C11444A8B1007C6459 /* NFSFile.cpp in Sources */,
+                               DF93D6C21444A8B1007C6459 /* PipeFile.cpp in Sources */,
+                               DF93D6C31444A8B1007C6459 /* RarFile.cpp in Sources */,
+                               DF93D6C41444A8B1007C6459 /* RTVFile.cpp in Sources */,
+                               DF93D6C51444A8B1007C6459 /* SFTPFile.cpp in Sources */,
+                               DF93D6C61444A8B1007C6459 /* ShoutcastFile.cpp in Sources */,
+                               DF93D6C71444A8B1007C6459 /* SlingboxFile.cpp in Sources */,
+                               DF93D6C81444A8B1007C6459 /* SmbFile.cpp in Sources */,
+                               DF93D6C91444A8B1007C6459 /* SpecialProtocolFile.cpp in Sources */,
+                               DF93D6CA1444A8B1007C6459 /* TuxBoxDirectory.cpp in Sources */,
+                               DF93D6CB1444A8B1007C6459 /* TuxBoxFile.cpp in Sources */,
+                               DF93D6CC1444A8B1007C6459 /* UDFFile.cpp in Sources */,
+                               DF93D6CD1444A8B1007C6459 /* UPnPFile.cpp in Sources */,
+                               DF93D6CE1444A8B1007C6459 /* ZipFile.cpp in Sources */,
+                               DF93D7F31444B54A007C6459 /* HDHomeRunFile.cpp in Sources */,
+                               DF93D7F71444B568007C6459 /* HDHomeRunDirectory.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 864c7ae..65d5158 100644 (file)
     <ClCompile Include="..\..\xbmc\DynamicDll.cpp" />
     <ClCompile Include="..\..\xbmc\Favourites.cpp" />
     <ClCompile Include="..\..\xbmc\FileItem.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\CacheCircular.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\FileNFS.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\FilePipe.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\FileUPnP.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\iso9660.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\ISO9660Directory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileUDF.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\AddonsDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\AFPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\AFPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\CDDADirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\CDDAFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\CircularCache.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\CurlFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DAAPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DAAPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DAVDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\Directory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryCache.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryFactory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryHistory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\DllLibCurl.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\File.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FileCache.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FileDirectoryFactory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FileFactory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FileReaderFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FTPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\FTPParse.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HDDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HDFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HTSPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HTSPSession.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\HTTPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\IDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\IFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\iso9660.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ISO9660Directory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ISOFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\LastFMDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\LastFMFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MemBufferCache.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MultiPathDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MultiPathFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MusicFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MusicSearchDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MythDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MythFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\MythSession.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\NFSDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\NFSFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\NptXbmcFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\NSFFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\OGGFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\PipeFile.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\PipesManager.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\Slingbox.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\udf25.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\UDFDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\PlaylistDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\PlaylistFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\PluginDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RarDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RarFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RarManager.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RSSDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RTVDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\RTVFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SAPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SAPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SFTPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SFTPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ShoutcastFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SIDFileDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SlingboxDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SlingboxFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SmartPlaylistDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SourcesDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocol.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocolDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocolFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\StackDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\TuxBoxDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\TuxBoxFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\udf25.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\UDFDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\UDFFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\UPnPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\UPnPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\VideoDatabaseDirectory.cpp" />
     <ClCompile Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory\DirectoryNodeCountry.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\windows\WINFileSMB.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\windows\WINSMBDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\VirtualDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\VTPDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\VTPFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\VTPSession.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\ZeroconfDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ZipDirectory.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ZipFile.cpp" />
+    <ClCompile Include="..\..\xbmc\filesystem\ZipManager.cpp" />
     <ClCompile Include="..\..\xbmc\GUIInfoManager.cpp" />
     <ClCompile Include="..\..\xbmc\GUILargeTextureManager.cpp" />
     <ClCompile Include="..\..\xbmc\guilib\AnimatedGif.cpp" />
     <ClCompile Include="..\..\xbmc\threads\platform\Implementation.cpp" />
     <ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
     <ClInclude Include="..\..\xbmc\cores\paplayer\PCMCodec.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FileUPnP.h" />
     <ClInclude Include="..\..\xbmc\filesystem\windows\WINFileSMB.h" />
     <ClInclude Include="..\..\xbmc\filesystem\windows\WINSMBDirectory.h" />
     <ClInclude Include="..\..\xbmc\interfaces\python\xbmcmodule\pythreadstate.h" />
     <ClInclude Include="..\..\xbmc\network\httprequesthandler\HTTPWebinterfaceAddonsHandler.h" />
     <ClInclude Include="..\..\xbmc\network\httprequesthandler\HTTPWebinterfaceHandler.h" />
     <ClInclude Include="..\..\xbmc\network\httprequesthandler\IHTTPRequestHandler.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\CircularCache.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryCache.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FileCache.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MemBufferCache.h" />
+    <ClInclude Include="..\..\xbmc\interfaces\python\xbmcmodule\pythreadstate.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\AddonsDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\AFPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\AFPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ASAPFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\CacheStrategy.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\CDDADirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\CDDAFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\CurlFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DAAPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DAAPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DAVDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\Directory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryFactory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryHistory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllHDHomeRunDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllHDHomeRunFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibAfp.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibCMyth.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibCurl.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibNfs.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\File.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FileDirectoryFactory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FileFactory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FileReaderFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FTPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\FTPParse.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HDDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HDFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HTSPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HTSPSession.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\HTTPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\IDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\IFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\IFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ILiveTV.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\iso9660.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ISO9660Directory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ISOFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\LastFMDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\LastFMFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MultiPathDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MultiPathFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MusicFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MusicSearchDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MythDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MythFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\MythSession.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\NFSDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\NFSFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\NSFFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\OGGFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\PipeFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\PipesManager.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\PlaylistDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\PlaylistFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\PluginDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RarDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RarFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RarManager.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RSSDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RTVDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\RTVFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SAPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SAPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SFTPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SFTPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ShoutcastFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SIDFileDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SlingboxDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SlingboxFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SmartPlaylistDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SourcesDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocol.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocolDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocolFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\StackDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\TuxBoxDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\TuxBoxFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\udf25.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\UDFDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\UDFFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\UPnPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\UPnPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\VideoDatabaseDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\VirtualDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\VTPDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\VTPFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\VTPSession.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ZeroconfDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ZipDirectory.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ZipFile.h" />
+    <ClInclude Include="..\..\xbmc\filesystem\ZipManager.h" />
     <ClInclude Include="..\..\xbmc\threads\platform\win\Implementation.cpp" />
     <ClCompile Include="..\..\xbmc\threads\SystemClock.cpp" />
     <ClCompile Include="..\..\xbmc\threads\Thread.cpp" />
     <ClCompile Include="..\..\xbmc\cores\ExternalPlayer\ExternalPlayer.cpp" />
     <ClCompile Include="..\..\xbmc\cores\playercorefactory\PlayerCoreFactory.cpp" />
     <ClCompile Include="..\..\xbmc\cores\playercorefactory\PlayerSelectionRule.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\AddonsDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\ASAPFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\CacheMemBuffer.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\CacheStrategy.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\CDDADirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DAAPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DAVDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\Directory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryCache.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryHistory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryTuxBox.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\DllLibCurl.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FactoryDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FactoryFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\File.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCache.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCDDA.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCurl.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileDAAP.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileFactory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileFileReader.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileHD.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileISO.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileLastFM.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileMusicDatabase.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileRar.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileRTV.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileSFTP.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileShoutcast.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileSpecialProtocol.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileTuxBox.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FileZip.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FTPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\FTPParse.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\HDDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\HDHomeRun.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\HTSPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\HTSPSession.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\HTTPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\IDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\IFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\LastFMDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MultiPathDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MultiPathFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicSearchDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MythDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MythFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\MythSession.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\NptXbmcFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\NSFFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\OGGFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\PlaylistDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\PlaylistFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\PluginDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\RarDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\RarManager.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\RSSDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\RTVDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SAPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SAPFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SFTPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SIDFileDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SmartPlaylistDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SpecialProtocol.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SpecialProtocolDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\StackDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\SourcesDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\UPnPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\VirtualDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPFile.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPSession.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\ZipDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\FileSystem\ZipManager.cpp" />
     <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNode.cpp" />
     <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbum.cpp" />
     <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumCompilations.cpp" />
     <ClInclude Include="..\..\xbmc\DynamicDll.h" />
     <ClInclude Include="..\..\xbmc\Favourites.h" />
     <ClInclude Include="..\..\xbmc\FileItem.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\CacheCircular.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\Directory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\DirectoryHistory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FactoryDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\File.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FileFactory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FileHD.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FileNFS.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\FilePipe.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\HDDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\IDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\IFile.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\IFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\ILiveTV.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\iso9660.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\ISO9660Directory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileUDF.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\NFSDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\PipesManager.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\Slingbox.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\udf25.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\UDFDirectory.h" />
     <ClInclude Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory\DirectoryNodeCountry.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\VirtualDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\ZeroconfDirectory.h" />
     <ClInclude Include="..\..\xbmc\GUIInfoManager.h" />
     <ClInclude Include="..\..\xbmc\GUILargeTextureManager.h" />
     <ClInclude Include="..\..\xbmc\guilib\AnimatedGif.h" />
     <ClInclude Include="..\..\xbmc\cores\playercorefactory\PlayerCoreConfig.h" />
     <ClInclude Include="..\..\xbmc\cores\playercorefactory\PlayerCoreFactory.h" />
     <ClInclude Include="..\..\xbmc\cores\playercorefactory\PlayerSelectionRule.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\AddonsDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\ASAPFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\CacheMemBuffer.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\CacheStrategy.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\CDDADirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DAAPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DAVDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DirectoryCache.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DirectoryTuxBox.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DllLibCMyth.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\DllLibCurl.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FactoryFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCache.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCDDA.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCurl.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileDAAP.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileFileReader.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileISO.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileLastFM.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileMusicDatabase.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileRar.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileRTV.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileSFTP.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileShoutcast.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileSpecialProtocol.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileTuxBox.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FileZip.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FTPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\FTPParse.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\HDHomeRun.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\HTSPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\HTSPSession.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\HTTPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\LastFMDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MultiPathDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MultiPathFile.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicSearchDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MythDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MythFile.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\MythSession.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\NSFFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\OGGFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\PlaylistDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\PlaylistFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\PluginDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\RarDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\RarManager.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\RSSDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\RTVDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SAPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SAPFile.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SFTPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SIDFileDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SmartPlaylistDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SpecialProtocol.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SpecialProtocolDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\StackDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\SourcesDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\UPnPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPFile.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPSession.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\ZipDirectory.h" />
-    <ClInclude Include="..\..\xbmc\FileSystem\ZipManager.h" />
     <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNode.h" />
     <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbum.h" />
     <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumCompilations.h" />
index f17d462..9e8d3cf 100644 (file)
     <ClCompile Include="..\..\xbmc\cores\playercorefactory\PlayerSelectionRule.cpp">
       <Filter>cores\PlayerCoreFactory</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\AddonsDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\ASAPFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\CacheMemBuffer.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\CacheStrategy.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\CDDADirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DAAPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DAVDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\Directory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryCache.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryHistory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DirectoryTuxBox.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\DllLibCurl.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FactoryDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FactoryFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\File.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCache.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCDDA.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileCurl.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileDAAP.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileFactory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileFileReader.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileHD.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileISO.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileLastFM.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileMusicDatabase.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileRar.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileRTV.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileSFTP.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileShoutcast.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileSpecialProtocol.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileTuxBox.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileZip.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FTPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FTPParse.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\HDDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\HDHomeRun.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\HTSPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\HTSPSession.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\HTTPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\IDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\IFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\iso9660.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\ISO9660Directory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\LastFMDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MultiPathDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MultiPathFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MusicSearchDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MythDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MythFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\MythSession.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\NptXbmcFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\NSFFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\OGGFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\PlaylistDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\PlaylistFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\PluginDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\RarDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\RarManager.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\RSSDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\RTVDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SAPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SAPFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SFTPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SIDFileDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SmartPlaylistDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SpecialProtocol.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SpecialProtocolDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\StackDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\SourcesDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\UPnPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\VirtualDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\VTPSession.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\ZipDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\ZipManager.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNode.cpp">
       <Filter>filesystem\MusicDatabaseDirectory</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\dialogs\GUIDialogYesNo.cpp">
       <Filter>dialogs</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\ZeroconfDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\Application.cpp" />
     <ClCompile Include="..\..\xbmc\MediaSource.cpp" />
     <ClCompile Include="..\..\xbmc\SystemGlobals.cpp" />
     <ClCompile Include="..\..\xbmc\utils\LangCodeExpander.cpp">
       <Filter>utils</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\udf25.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\UDFDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\FileSystem\FileUDF.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\ApplicationMessenger.cpp">
       <Filter>utils</Filter>
     </ClCompile>
     <ClCompile Include="..\..\lib\SlingboxLib\SlingboxLib.cpp">
       <Filter>libs\SlingboxLib</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\Slingbox.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\dialogs\GUIDialogPlayEject.cpp">
       <Filter>dialogs</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\InputOperations.cpp">
       <Filter>interfaces\json-rpc</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\CacheCircular.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\input\XBMC_keytable.cpp">
       <Filter>input</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\guilib\JpegIO.cpp">
       <Filter>guilib</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\FileNFS.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\NFSDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\FilePipe.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\PipesManager.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\cores\paplayer\BXAcodec.cpp">
       <Filter>cores\paplayer</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\interfaces\python\xbmcmodule\pyrendercapture.cpp">
       <Filter>interfaces\python\xbmcmodule</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\FileUPnP.cpp">
+    <ClCompile Include="..\..\xbmc\filesystem\AddonsDirectory.cpp">
       <Filter>filesystem</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\cores\paplayer\PCMCodec.cpp">
       <Filter>cores\paplayer</Filter>
+       </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\AFPDirectory.cpp">
+      <Filter>filesystem</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\network\httprequesthandler\HTTPApiHandler.cpp">
       <Filter>network\httprequesthandler</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\network\httprequesthandler\IHTTPRequestHandler.cpp">
       <Filter>network\httprequesthandler</Filter>
+       </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\AFPFile.cpp">
+      <Filter>filesystem</Filter>
     </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\..\xbmc\win32\pch.h">
-      <Filter>win32</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\win32\PlatformDefs.h">
-      <Filter>win32</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\win32\WIN32Util.h">
-      <Filter>win32</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\win32\WINDirectSound.h">
-      <Filter>win32</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\win32\WindowHelper.h">
-      <Filter>win32</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\DummyVideoPlayer.h">
-      <Filter>cores</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\IPlayer.h">
-      <Filter>cores</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\dvd_config.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDAudio.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDClock.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxSPU.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxVobsub.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDFileInfo.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamTV.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessage.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessageQueue.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessageTracker.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDOverlayContainer.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDOverlayRenderer.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPerformanceCounter.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayer.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerAudio.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerAudioResampler.h">
-      <Filter>cores\dvdplayer</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerSubtitle.h">
-      <Filter>cores\dvdplayer</Filter>
+    <ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\CDDADirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\CDDAFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\CurlFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DAAPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DAAPFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DAVDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\Directory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryFactory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryHistory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DllLibCurl.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\File.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FileDirectoryFactory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FileFactory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FileReaderFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FTPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FTPParse.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HDDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HDFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HTSPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HTSPSession.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\HTTPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\IDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\IFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\iso9660.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ISO9660Directory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ISOFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\LastFMDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\LastFMFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MultiPathDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MultiPathFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MusicFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MusicSearchDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MythDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MythFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MythSession.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\NFSDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\NFSFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\NptXbmcFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\NSFFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\OGGFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\PipeFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\PipesManager.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\PlaylistDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\PlaylistFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\PluginDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RarDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RarFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RarManager.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RSSDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RTVDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\RTVFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SAPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SAPFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SFTPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SFTPFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ShoutcastFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SIDFileDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SlingboxDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SlingboxFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SmartPlaylistDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SourcesDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocol.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocolDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\SpecialProtocolFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\StackDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\TuxBoxDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\TuxBoxFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\udf25.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\UDFDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\UDFFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\UPnPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\UPnPFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\VideoDatabaseDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\VirtualDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\VTPDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\VTPFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\VTPSession.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ZeroconfDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ZipDirectory.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ZipFile.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\ZipManager.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\CircularCache.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\DirectoryCache.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\FileCache.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\filesystem\MemBufferCache.cpp">
+      <Filter>filesystem</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\xbmc\win32\pch.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\PlatformDefs.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\WIN32Util.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\WINDirectSound.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\WindowHelper.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\WINFileSMB.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\win32\WINSMBDirectory.h">
+      <Filter>win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\DummyVideoPlayer.h">
+      <Filter>cores</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\IPlayer.h">
+      <Filter>cores</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\dvd_config.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDAudio.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDClock.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxSPU.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxVobsub.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDFileInfo.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamTV.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessage.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessageQueue.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDMessageTracker.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDOverlayContainer.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDOverlayRenderer.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPerformanceCounter.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayer.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerAudio.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerAudioResampler.h">
+      <Filter>cores\dvdplayer</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerSubtitle.h">
+      <Filter>cores\dvdplayer</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDPlayerTeletext.h">
       <Filter>cores\dvdplayer</Filter>
     <ClInclude Include="..\..\xbmc\cores\playercorefactory\PlayerSelectionRule.h">
       <Filter>cores\PlayerCoreFactory</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\AddonsDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\ASAPFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\CacheMemBuffer.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\CacheStrategy.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\CDDADirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DAAPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DAVDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DirectoryCache.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DirectoryTuxBox.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DllLibCMyth.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\DllLibCurl.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FactoryFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCache.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCDDA.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileCurl.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileDAAP.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileFileReader.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileISO.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileLastFM.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileMusicDatabase.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileRar.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileRTV.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileSFTP.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileShoutcast.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileSpecialProtocol.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileTuxBox.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileZip.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FTPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FTPParse.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\HDHomeRun.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\HTSPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\HTSPSession.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\HTTPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\ISO9660Directory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\LastFMDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MultiPathDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MultiPathFile.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MusicSearchDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MythDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MythFile.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\MythSession.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\NSFFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\OGGFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\PlaylistDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\PlaylistFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\PluginDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\RarDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\RarManager.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\RSSDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\RTVDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SAPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SAPFile.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SFTPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SIDFileDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SmartPlaylistDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SpecialProtocol.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SpecialProtocolDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\StackDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\SourcesDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\UPnPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPFile.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\VTPSession.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\ZipDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\ZipManager.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNode.h">
       <Filter>filesystem\MusicDatabaseDirectory</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\dialogs\GUIDialogYesNo.h">
       <Filter>dialogs</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\ILiveTV.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\ZeroconfDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\Application.h" />
     <ClInclude Include="..\..\xbmc\system.h" />
     <ClInclude Include="..\..\xbmc\guilib\AnimatedGif.h">
       <Filter>guilib</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\guilib\TextureBundleXBT.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\TextureBundleXPR.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\TransformMatrix.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\Tween.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\VisibleEffect.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\XBTF.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\guilib\XBTFReader.h">
-      <Filter>guilib</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\Directory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\DirectoryHistory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FactoryDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\File.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FileFactory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FileHD.h">
-      <Filter>filesystem</Filter>
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\HDDirectory.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\TextureBundleXPR.h">
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\IDirectory.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\TransformMatrix.h">
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\IFile.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\Tween.h">
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\IFileDirectory.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\VisibleEffect.h">
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\iso9660.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\XBTF.h">
+      <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\VirtualDirectory.h">
-      <Filter>filesystem</Filter>
+    <ClInclude Include="..\..\xbmc\guilib\XBTFReader.h">
+      <Filter>guilib</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\input\ButtonTranslator.h">
       <Filter>input</Filter>
     <ClInclude Include="..\..\xbmc\utils\LangCodeExpander.h">
       <Filter>utils</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\udf25.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\UDFDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\FileSystem\FileUDF.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\ApplicationMessenger.h">
       <Filter>utils</Filter>
     </ClInclude>
     <ClInclude Include="..\..\lib\SlingboxLib\SlingboxLib.h">
       <Filter>libs\SlingboxLib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\Slingbox.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\CacheCircular.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\dialogs\GUIDialogPlayEject.h">
       <Filter>dialogs</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\guilib\JpegIO.h">
       <Filter>guilib</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FileNFS.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\NFSDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FilePipe.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\PipesManager.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\cores\paplayer\BXAcodec.h">
       <Filter>cores\paplayer</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\threads\platform\win\Implementation.cpp">
       <Filter>threads\platform\win</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\FileUPnP.h">
+    <ClInclude Include="..\..\xbmc\filesystem\ZipManager.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\AddonsDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\AFPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\AFPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ASAPFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\CacheStrategy.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\CDDADirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\CDDAFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\CurlFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DAAPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DAAPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DAVDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\Directory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryFactory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryHistory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllHDHomeRunDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllHDHomeRunFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibAfp.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibCMyth.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibCurl.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DllLibNfs.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\File.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FileDirectoryFactory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FileFactory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FileReaderFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FTPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FTPParse.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HDDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HDFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HTSPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HTSPSession.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\HTTPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\IDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\IFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\IFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ILiveTV.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\iso9660.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ISO9660Directory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ISOFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\LastFMDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\LastFMFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MultiPathDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MultiPathFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MusicFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MusicSearchDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MythDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MythFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MythSession.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\NFSDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\NFSFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\NSFFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\OGGFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\PipeFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\PipesManager.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\PlaylistDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\PlaylistFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\PluginDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RarDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RarFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RarManager.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RSSDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RTVDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\RTVFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SAPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SAPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SFTPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SFTPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ShoutcastFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SIDFileDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SlingboxDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SlingboxFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SmartPlaylistDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SourcesDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocol.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocolDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\SpecialProtocolFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\StackDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\TuxBoxDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\TuxBoxFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\udf25.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\UDFDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\UDFFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\UPnPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\UPnPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\VideoDatabaseDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\VirtualDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\VTPDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\VTPFile.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\VTPSession.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ZeroconfDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ZipDirectory.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\ZipFile.h">
       <Filter>filesystem</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\cores\AudioRenderers\IAudioRenderer.h" />
     </ClInclude>
     <ClInclude Include="..\..\xbmc\cores\paplayer\PCMCodec.h">
       <Filter>cores\paplayer</Filter>
+       </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\MemBufferCache.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\CircularCache.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\DirectoryCache.h">
+      <Filter>filesystem</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\filesystem\FileCache.h">
+      <Filter>filesystem</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\utils\Base64.h">
       <Filter>utils</Filter>
index 076d705..c148a90 100644 (file)
@@ -72,7 +72,7 @@
 #include "SectionLoader.h"
 #include "cores/DllLoader/DllLoaderContainer.h"
 #include "GUIUserMessages.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/StackDirectory.h"
 #include "filesystem/SpecialProtocol.h"
 #include "filesystem/DllLibCurl.h"
 #include "filesystem/SMBDirectory.h"
 #endif
 #ifdef HAS_FILESYSTEM_NFS
-#include "filesystem/FileNFS.h"
+#include "filesystem/NFSFile.h"
 #endif
 #ifdef HAS_FILESYSTEM_AFP
 #include "filesystem/FileAFP.h"
 #endif
 #ifdef HAS_FILESYSTEM_SFTP
-#include "filesystem/FileSFTP.h"
+#include "filesystem/SFTPFile.h"
 #endif
 #include "PartyModeManager.h"
 #ifdef HAS_VIDEO_PLAYBACK
index 846b28d..79b31a9 100644 (file)
@@ -31,7 +31,7 @@
 #include "PlayListPlayer.h"
 #include "filesystem/StackDirectory.h"
 #include "filesystem/Directory.h"
-#include "filesystem/FactoryDirectory.h"
+#include "filesystem/DirectoryFactory.h"
 #include "filesystem/File.h"
 #include "settings/GUISettings.h"
 #include "settings/AdvancedSettings.h"
index 651f848..f52f8a6 100644 (file)
 #include "pictures/Picture.h"
 #include "playlists/PlayListFactory.h"
 #include "utils/Crc32.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/StackDirectory.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "filesystem/MultiPathDirectory.h"
 #include "filesystem/MusicDatabaseDirectory.h"
 #include "filesystem/VideoDatabaseDirectory.h"
-#include "filesystem/FactoryDirectory.h"
+#include "filesystem/DirectoryFactory.h"
 #include "music/tags/MusicInfoTagLoaderFactory.h"
 #include "CueDocument.h"
 #include "video/VideoDatabase.h"
index 71aeca0..a7cfcf1 100644 (file)
@@ -31,7 +31,7 @@
 #include "utils/DownloadQueueManager.h"
 #include "GUIInfoManager.h"
 #include "filesystem/DllLibCurl.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "GUIPassword.h"
 #include "LangInfo.h"
 #include "utils/LangCodeExpander.h"
index 271c8cb..8aebaa7 100644 (file)
@@ -45,7 +45,7 @@
 #include "storage/IoSupport.h"
 #include "filesystem/StackDirectory.h"
 #include "filesystem/MultiPathDirectory.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/SpecialProtocol.h"
 #include "filesystem/RSSDirectory.h"
 #include "ThumbnailCache.h"
index 796a2c5..b7536d3 100644 (file)
@@ -21,7 +21,7 @@
 #include "Scraper.h"
 #include "filesystem/File.h"
 #include "filesystem/Directory.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "AddonManager.h"
 #include "utils/ScraperParser.h"
 #include "utils/ScraperUrl.h"
index 37406ac..a20d48f 100644 (file)
@@ -30,7 +30,7 @@
 #include "dialogs/GUIDialogOK.h"
 #include "guilib/GUIWindowManager.h"
 #include "Application.h"
-#include "filesystem/FileMusicDatabase.h"
+#include "filesystem/MusicDatabaseFile.h"
 #include "FileItem.h"
 #include "utils/RegExp.h"
 #include "utils/StringUtils.h"
index 812fbd4..be4b720 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "DVDInputStreamHttp.h"
 #include "URL.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 
 using namespace XFILE;
 
index 5ed50a9..30a02a8 100644 (file)
@@ -22,7 +22,7 @@
 #include "DVDInputStreamTV.h"
 #include "filesystem/MythFile.h"
 #include "filesystem/VTPFile.h"
-#include "filesystem/Slingbox.h"
+#include "filesystem/SlingboxFile.h"
 #include "URL.h"
 
 using namespace XFILE;
index d43b0f9..d5e3345 100644 (file)
@@ -23,7 +23,7 @@
 
 #if defined(HAS_FILESYSTEM_AFP)
 #include "AFPDirectory.h"
-#include "FileAFP.h"
+#include "AFPFile.h"
 #include "Util.h"
 #include "guilib/LocalizeStrings.h"
 #include "Application.h"
diff --git a/xbmc/filesystem/AFPFile.cpp b/xbmc/filesystem/AFPFile.cpp
new file mode 100644 (file)
index 0000000..fbfe0ec
--- /dev/null
@@ -0,0 +1,735 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileAFP.cpp: implementation of the CAFPFile class.
+//
+//////////////////////////////////////////////////////////////////////
+#ifdef _LINUX
+#include "system.h"
+
+#if defined(HAS_FILESYSTEM_AFP)
+#include "AFPFile.h"
+#include "PasswordManager.h"
+#include "AFPDirectory.h"
+#include "Util.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/GUISettings.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/TimeUtils.h"
+
+using namespace XFILE;
+
+#define AFP_MAX_READ_SIZE 131072
+
+CStdString URLEncode(const CStdString value)
+{
+  CStdString encoded(value);
+  CURL::Encode(encoded);
+  return encoded;
+}
+
+void AfpConnectionLog(void *priv, enum loglevels loglevel, int logtype, const char *message)
+{
+  if (!message) return;
+  CStdString msg = "LIBAFPCLIENT: " + CStdString(message);
+
+  switch(logtype)
+  {
+    case LOG_WARNING:
+      CLog::Log(LOGWARNING, "%s", msg.c_str());
+      break;
+    case LOG_ERR:
+      CLog::Log(LOGERROR, "%s", msg.c_str());
+      break;
+    default:
+      CLog::Log(LOGDEBUG, "%s", msg.c_str());
+      break;
+  }
+}
+
+CAfpConnection::CAfpConnection()
+ : m_OpenConnections(0)
+ , m_IdleTimeout(0)
+ , m_pAfpServer(NULL)
+ , m_pAfpVol(NULL)
+ , m_pAfpUrl((struct afp_url*)malloc(sizeof(struct afp_url)))
+ , m_pAfpClient((struct libafpclient*)malloc(sizeof(struct libafpclient)))
+ , m_pLibAfp(new DllLibAfp())
+ , m_bDllInited(false)
+{
+}
+
+CAfpConnection::~CAfpConnection()
+{
+  Disconnect();
+  free(m_pAfpClient);
+  free(m_pAfpUrl);
+  if (m_pLibAfp->IsLoaded())
+    m_pLibAfp->Unload();
+  delete m_pLibAfp;
+}
+
+bool CAfpConnection::initLib()
+{
+  if (!m_bDllInited)
+  {
+    if (m_pLibAfp->Load())
+    {
+      m_pAfpClient->unmount_volume = NULL;
+      m_pAfpClient->log_for_client = AfpConnectionLog;
+      m_pAfpClient->forced_ending_hook = NULL;
+      m_pAfpClient->scan_extra_fds = NULL;
+      m_pAfpClient->loop_started = NULL;
+
+      m_pLibAfp->libafpclient_register(m_pAfpClient);
+      m_pLibAfp->init_uams();
+      m_pLibAfp->afp_main_quick_startup(NULL);
+      CLog::Log(LOGDEBUG, "AFP: Supported UAMs: %s", m_pLibAfp->get_uam_names_list());
+      m_bDllInited = true;
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "AFP: Error loading afpclient lib.");
+    }
+  }
+
+  return m_bDllInited;
+}
+
+//only unmount here - afpclient lib is not
+//stoppable (no afp_main_quick_shutdown as counter part
+//for afp_main_quick_startup)
+void CAfpConnection::Deinit()
+{
+  if(m_pAfpVol && m_pLibAfp->IsLoaded())
+  {
+    disconnectVolume();
+    Disconnect();
+    m_pAfpUrl->servername[0] = '\0';
+  }        
+}
+
+void CAfpConnection::Disconnect()
+{
+  CSingleLock lock(*this);
+  m_pAfpServer = NULL;
+}
+
+void CAfpConnection::disconnectVolume()
+{
+  if (m_pAfpVol)
+  {
+    // afp_unmount_volume(m_pAfpVol);
+    m_pLibAfp->afp_unmount_all_volumes(m_pAfpServer);
+    m_pAfpVol = NULL;
+  }
+}
+
+// taken from cmdline tool
+bool CAfpConnection::connectVolume(const char *volumename, struct afp_volume *&pVolume)
+{
+  bool ret = false;
+  if (strlen(volumename) != 0)
+  {
+    // Ah, we're not connected to a volume
+    unsigned int len = 0;
+    char mesg[1024];
+
+    if ((pVolume = m_pLibAfp->find_volume_by_name(m_pAfpServer, volumename)) == NULL)
+    {
+      CLog::Log(LOGDEBUG, "AFP: Could not find a volume called %s\n", volumename);
+    }
+    else
+    {
+      pVolume->mapping = AFP_MAPPING_LOGINIDS;
+      pVolume->extra_flags |= VOLUME_EXTRA_FLAGS_NO_LOCKING;
+
+      if (m_pLibAfp->afp_connect_volume(pVolume, m_pAfpServer, mesg, &len, 1024 ))
+      {
+        CLog::Log(LOGDEBUG, "AFP: Could not access volume %s (error: %s)\n", pVolume->volume_name, mesg);
+        pVolume = NULL;
+      }
+      else
+      {
+        CLog::Log(LOGDEBUG, "AFP: Connected to volume %s\n", pVolume->volume_name_printable);
+        ret = true;
+      }
+    }
+  }
+
+  return ret;
+}
+
+CStdString CAfpConnection::getAuthenticatedPath(const CURL &url)
+{
+  CURL authURL(url);
+  CStdString ret;
+  CPasswordManager::GetInstance().AuthenticateURL(authURL);
+  ret = authURL.Get();
+  return ret;
+}
+
+CAfpConnection::afpConnnectError CAfpConnection::Connect(const CURL& url)
+{
+  CSingleLock lock(*this);
+  struct afp_connection_request *conn_req = NULL;
+  struct afp_url tmpurl;
+  CURL nonConstUrl(getAuthenticatedPath(url)); // we need a editable copy of the url
+  bool serverChanged=false;
+
+  if (!initLib())
+    return AfpFailed;
+
+  m_pLibAfp->afp_default_url(&tmpurl);
+
+  // if hostname has changed - assume server changed
+  if (!nonConstUrl.GetHostName().Equals(m_pAfpUrl->servername, false)|| (m_pAfpServer && m_pAfpServer->connect_state == 0))
+  {
+    serverChanged = true;
+    Disconnect();
+  }
+
+  // if volume changed - also assume server changed (afpclient can't reuse old servobject it seems)
+  if (!nonConstUrl.GetShareName().Equals(m_pAfpUrl->volumename, false))
+  {
+   // no reusing of old server object possible with libafpclient it seems...
+    serverChanged = true;
+    Disconnect();
+  }
+
+  // first, try to parse the URL
+  if (m_pLibAfp->afp_parse_url(&tmpurl, nonConstUrl.Get().c_str(), 0) != 0)
+  {
+    // Okay, this isn't a real URL
+    CLog::Log(LOGDEBUG, "AFP: Could not parse url: %s!\n", nonConstUrl.Get().c_str());
+    return AfpFailed;
+  }
+  else // parsed sucessfull
+  {
+    // this is our current url object whe are connected to (at least we try)
+    *m_pAfpUrl = tmpurl;
+  }
+
+  // if no username and password is set - use no user authent uam
+  if (strlen(m_pAfpUrl->password) == 0 && strlen(m_pAfpUrl->username) == 0)
+  {
+    // try anonymous
+    strncpy(m_pAfpUrl->uamname, "No User Authent", sizeof(m_pAfpUrl->uamname));
+    CLog::Log(LOGDEBUG, "AFP: Using anonymous authentication.");
+  }
+  else if ((nonConstUrl.GetPassWord().IsEmpty() || nonConstUrl.GetUserName().IsEmpty()) && serverChanged)
+  {
+    // this is our current url object whe are connected to (at least we try)
+    return AfpAuth;
+  }
+
+  // we got a password in the url
+  if (!nonConstUrl.GetPassWord().IsEmpty())
+  {
+    // copy password because afp_parse_url just puts garbage into the password field :(
+    strncpy(m_pAfpUrl->password, nonConstUrl.GetPassWord().c_str(), 127);
+  }
+
+  // whe are not connected or we want to connect to another server
+  if (!m_pAfpServer || serverChanged)
+  {
+    // code from cmdline tool
+    conn_req = (struct afp_connection_request*)malloc(sizeof(struct afp_connection_request));
+    memset(conn_req, 0, sizeof(struct afp_connection_request));
+
+    conn_req->url = *m_pAfpUrl;
+    conn_req->url.requested_version = 31;
+
+    if (strlen(m_pAfpUrl->uamname)>0)
+    {
+      if ((conn_req->uam_mask = m_pLibAfp->find_uam_by_name(m_pAfpUrl->uamname)) == 0)
+      {
+        CLog::Log(LOGDEBUG, "AFP:I don't know about UAM %s\n", m_pAfpUrl->uamname);
+        m_pAfpUrl->volumename[0] = '\0';
+        m_pAfpUrl->servername[0] = '\0';
+        free(conn_req);
+        return AfpFailed;
+      }
+    }
+    else
+    {
+      conn_req->uam_mask = m_pLibAfp->default_uams_mask();
+    }
+
+    // try to connect
+#ifdef USE_CVS_AFPFS
+    if ((m_pAfpServer = m_pLibAfp->afp_wrap_server_full_connect(NULL, conn_req, NULL)) == NULL)
+#else
+    if ((m_pAfpServer = m_pLibAfp->afp_wrap_server_full_connect(NULL, conn_req)) == NULL)
+#endif
+    {
+      m_pAfpUrl->volumename[0] = '\0';
+      m_pAfpUrl->servername[0] = '\0';
+      free(conn_req);
+      CLog::Log(LOGERROR, "AFP: Error connecting to %s", url.Get().c_str());
+      return AfpFailed;
+    }
+    // success!
+    CLog::Log(LOGDEBUG, "AFP: Connected to server %s using UAM \"%s\"\n",
+      m_pAfpServer->server_name, m_pLibAfp->uam_bitmap_to_string(m_pAfpServer->using_uam));
+    // we don't need it after here ...
+    free(conn_req);
+  }
+
+  // if server changed reconnect volume
+  if (serverChanged)
+  {
+    connectVolume(m_pAfpUrl->volumename, m_pAfpVol); // connect new volume
+  }
+  return AfpOk;
+}
+
+int CAfpConnection::stat(const CURL &url, struct stat *statbuff)
+{
+  CSingleLock lock(*this);
+  CStdString strPath = gAfpConnection.GetPath(url);
+  struct afp_volume *pTmpVol = NULL;
+  struct afp_url tmpurl;
+  int iResult = -1;
+  CURL nonConstUrl(getAuthenticatedPath(url)); // we need a editable copy of the url
+
+  if (!initLib() || !m_pAfpServer)
+    return -1;
+
+  m_pLibAfp->afp_default_url(&tmpurl);
+
+  // first, try to parse the URL
+  if (m_pLibAfp->afp_parse_url(&tmpurl, nonConstUrl.Get().c_str(), 0) != 0)
+  {
+    // Okay, this isn't a real URL
+    CLog::Log(LOGDEBUG, "AFP: Could not parse url: %s!\n", nonConstUrl.Get().c_str());
+    return -1;
+  }
+
+  // if no username and password is set - use no user authent uam
+  if (strlen(tmpurl.password) == 0 && strlen(tmpurl.username) == 0)
+  {
+    // try anonymous
+    strncpy(tmpurl.uamname, "No User Authent", sizeof(tmpurl.uamname));
+    CLog::Log(LOGDEBUG, "AFP: Using anonymous authentication.");
+  }
+  else if ((nonConstUrl.GetPassWord().IsEmpty() || nonConstUrl.GetUserName().IsEmpty()))
+  {
+    // this is our current url object whe are connected to (at least we try)
+    return -1;
+  }
+
+  // we got a password in the url
+  if (!nonConstUrl.GetPassWord().IsEmpty())
+  {
+    // copy password because afp_parse_url just puts garbage into the password field :(
+    strncpy(tmpurl.password, nonConstUrl.GetPassWord().c_str(), 127);
+  }
+
+  // connect new volume
+  if(connectVolume(tmpurl.volumename, pTmpVol) && pTmpVol)
+  {
+    iResult = m_pLibAfp->afp_wrap_getattr(pTmpVol, strPath.c_str(), statbuff);
+    //unmount single volume crashs
+    //we will get rid of the mounted volume
+    //once the context is changed in connect function
+    //ppppooooorrrr!!
+    //m_pLibAfp->afp_unmount_volume(pTmpVol);
+  }
+  return iResult;
+}
+
+
+/* This is called from CApplication::ProcessSlow() and is used to tell if afp have been idle for too long */
+void CAfpConnection::CheckIfIdle()
+{
+  /* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
+   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
+  if (m_OpenConnections == 0 && m_pAfpVol != NULL)
+  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
+    CSingleLock lock(*this);
+    if (m_OpenConnections == 0 /* check again - when locked */)
+    {
+      if (m_IdleTimeout > 0)
+      {
+        m_IdleTimeout--;
+      }
+      else
+      {
+        CLog::Log(LOGNOTICE, "AFP is idle. Closing the remaining connections.");
+        gAfpConnection.Deinit();
+      }
+    }
+  }
+}
+
+/* The following two function is used to keep track on how many Opened files/directories there are.
+needed for unloading the dylib*/
+void CAfpConnection::AddActiveConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections++;
+}
+
+void CAfpConnection::AddIdleConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections--;
+  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
+   leaves the movie paused for a long while and then press stop */
+  m_IdleTimeout = 180;
+}
+
+CStdString CAfpConnection::GetPath(const CURL &url)
+{
+  struct afp_url tmpurl;
+  CStdString ret = "";
+
+  m_pLibAfp->afp_default_url(&tmpurl);
+
+  // First, try to parse the URL
+  if (m_pLibAfp->afp_parse_url(&tmpurl, url.Get().c_str(), 0) != 0 )
+  {
+    // Okay, this isn't a real URL
+    CLog::Log(LOGDEBUG, "AFP: Could not parse url.\n");
+  }
+  else
+  {
+    ret = CStdString(tmpurl.path);
+  }
+  return ret;
+}
+
+CAfpConnection gAfpConnection;
+
+CAFPFile::CAFPFile()
+ : m_fileSize(0)
+ , m_fileOffset(0)
+ , m_pFp(NULL)
+ , m_pAfpVol(NULL)
+{
+  gAfpConnection.AddActiveConnection();
+}
+
+CAFPFile::~CAFPFile()
+{
+  gAfpConnection.AddIdleConnection();
+  Close();
+}
+
+int64_t CAFPFile::GetPosition()
+{
+  if (m_pFp == NULL) return 0;
+  return m_fileOffset;
+}
+
+int64_t CAFPFile::GetLength()
+{
+  if (m_pFp == NULL) return 0;
+  return m_fileSize;
+}
+
+bool CAFPFile::Open(const CURL& url)
+{
+  Close();
+  // we can't open files like afp://file.f or afp://server/file.f
+  // if a file matches the if below return false, it can't exist on a afp share.
+  if (!IsValidFile(url.GetFileName()))
+  {
+    CLog::Log(LOGNOTICE, "FileAfp: Bad URL : '%s'", url.GetFileName().c_str());
+    return false;
+  }
+
+  CSingleLock lock(gAfpConnection);
+  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
+    return false;
+  m_pAfpVol = gAfpConnection.GetVolume();
+
+  CStdString strPath = gAfpConnection.GetPath(url);
+
+  if (gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, strPath.c_str(), O_RDONLY, &m_pFp))
+  {
+    if (gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, URLEncode(strPath.c_str()).c_str(), O_RDONLY, &m_pFp))
+    {
+      // write error to logfile
+      CLog::Log(LOGINFO, "CAFPFile::Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strPath.c_str(), errno, strerror(errno));
+      return false;
+    }
+  }
+  
+  CLog::Log(LOGDEBUG,"CAFPFile::Open - opened %s, fd=%d",url.GetFileName().c_str(), m_pFp ? m_pFp->fileid:-1);
+  m_url = url;
+  
+#ifdef _LINUX
+  struct __stat64 tmpBuffer;
+#else
+  struct stat tmpBuffer;
+#endif  
+  if(Stat(&tmpBuffer))
+  {
+    m_url.Reset();
+    Close();
+    return false;
+  }
+
+  m_fileSize = tmpBuffer.st_size;
+  m_fileOffset = 0;
+  // We've successfully opened the file!
+  return true;
+}
+
+
+bool CAFPFile::Exists(const CURL& url)
+{
+  return Stat(url, NULL) == 0;
+}
+
+int CAFPFile::Stat(struct __stat64* buffer)
+{
+  if (m_pFp == NULL)
+    return -1;
+  return Stat(m_url, buffer);
+}
+
+// TODO - maybe check returncode!
+int CAFPFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  CSingleLock lock(gAfpConnection);
+  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
+    return -1;
+
+  CStdString strPath = gAfpConnection.GetPath(url);
+
+  struct stat tmpBuffer = {0};
+  int iResult = gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), strPath.c_str(), &tmpBuffer);
+
+  if (buffer)
+  {
+    memset(buffer, 0, sizeof(struct __stat64));
+    buffer->st_dev   = tmpBuffer.st_dev;
+    buffer->st_ino   = tmpBuffer.st_ino;
+    buffer->st_mode  = tmpBuffer.st_mode;
+    buffer->st_nlink = tmpBuffer.st_nlink;
+    buffer->st_uid   = tmpBuffer.st_uid;
+    buffer->st_gid   = tmpBuffer.st_gid;
+    buffer->st_rdev  = tmpBuffer.st_rdev;
+    buffer->st_size  = tmpBuffer.st_size;
+    buffer->st_atime = tmpBuffer.st_atime;
+    buffer->st_mtime = tmpBuffer.st_mtime;
+    buffer->st_ctime = tmpBuffer.st_ctime;
+  }
+
+  return iResult;
+}
+
+unsigned int CAFPFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  CSingleLock lock(gAfpConnection);
+  if (m_pFp == NULL || !m_pAfpVol)
+    return 0;
+
+  if (uiBufSize > AFP_MAX_READ_SIZE)
+    uiBufSize = AFP_MAX_READ_SIZE;
+
+#ifdef USE_CVS_AFPFS
+  char *name = m_pFp->basename;
+#else
+  char *name = m_pFp->name;
+  if (strlen(name) == 0)
+    name = m_pFp->basename;
+
+#endif
+  int eof = 0;
+  int bytesRead = gAfpConnection.GetImpl()->afp_wrap_read(m_pAfpVol,
+    name, (char *)lpBuf,(size_t)uiBufSize, m_fileOffset, m_pFp, &eof);
+  if (bytesRead > 0)
+    m_fileOffset += bytesRead;
+
+  if (bytesRead < 0)
+  {
+    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s )", __FUNCTION__, bytesRead, errno, strerror(errno));
+    return 0;
+  }
+
+  return (unsigned int)bytesRead;
+}
+
+int64_t CAFPFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  off_t newOffset = m_fileOffset;
+  if (m_pFp == NULL) return -1;
+
+  switch(iWhence)
+  {
+    case SEEK_SET:
+      newOffset = iFilePosition;
+      break;
+    case SEEK_END:
+      newOffset = m_fileSize+iFilePosition;
+      break;
+    case SEEK_CUR:
+      newOffset += iFilePosition;
+      break;
+  }
+
+  if ( newOffset < 0 || newOffset > m_fileSize)
+  {
+    CLog::Log(LOGERROR, "%s - Error( %"PRId64")", __FUNCTION__, newOffset);
+    return -1;
+  }
+
+  m_fileOffset = newOffset;
+  return (int64_t)m_fileOffset;
+}
+
+void CAFPFile::Close()
+{
+  CSingleLock lock(gAfpConnection);
+  if (m_pFp != NULL && m_pAfpVol)
+  {
+    CLog::Log(LOGDEBUG, "CAFPFile::Close closing fd %d", m_pFp->fileid);
+#ifdef USE_CVS_AFPFS
+    char *name = m_pFp->basename;
+#else
+    char *name = m_pFp->name;
+    if (strlen(name) == 0)
+      name = m_pFp->basename;
+#endif
+    gAfpConnection.GetImpl()->afp_wrap_close(m_pAfpVol, name, m_pFp);
+    delete m_pFp;
+    m_pFp = NULL;
+    m_pAfpVol = NULL;
+  }
+}
+
+int CAFPFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  CSingleLock lock(gAfpConnection);
+  if (m_pFp == NULL || !m_pAfpVol)
+   return -1;
+
+  int numberOfBytesWritten = 0;
+  uid_t uid;
+  gid_t gid;
+
+  // FIXME need a better way to get server's uid/gid
+  uid = getuid();
+  gid = getgid();
+#ifdef USE_CVS_AFPFS
+  char *name = m_pFp->basename;
+#else
+  char *name = m_pFp->name;
+  if (strlen(name) == 0)
+    name = m_pFp->basename;
+#endif
+  numberOfBytesWritten = gAfpConnection.GetImpl()->afp_wrap_write(m_pAfpVol,
+    name, (const char *)lpBuf, (size_t)uiBufSize, m_fileOffset, m_pFp, uid, gid);
+
+  return numberOfBytesWritten;
+}
+
+bool CAFPFile::Delete(const CURL& url)
+{
+  CSingleLock lock(gAfpConnection);
+  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
+    return false;
+
+  CStdString strPath = gAfpConnection.GetPath(url);
+
+  int result = gAfpConnection.GetImpl()->afp_wrap_unlink(gAfpConnection.GetVolume(), strPath.c_str());
+
+  if (result != 0)
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
+
+  return (result == 0);
+}
+
+bool CAFPFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  CSingleLock lock(gAfpConnection);
+  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
+    return false;
+
+  CStdString strFile = gAfpConnection.GetPath(url);
+  CStdString strFileNew = gAfpConnection.GetPath(urlnew);
+
+  int result = gAfpConnection.GetImpl()->afp_wrap_rename(gAfpConnection.GetVolume(), strFile.c_str(), strFileNew.c_str());
+
+  if (result != 0)
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
+
+  return (result == 0);
+}
+
+bool CAFPFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{
+
+  int ret = 0;
+  m_fileSize = 0;
+  m_fileOffset = 0;
+
+  Close();
+  CSingleLock lock(gAfpConnection);
+  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
+    return false;
+
+  // we can't open files like afp://file.f or afp://server/file.f
+  // if a file matches the if below return false, it can't exist on a afp share.
+  if (!IsValidFile(url.GetFileName()))
+    return false;
+
+  m_pAfpVol = gAfpConnection.GetVolume();
+
+  CStdString strPath = gAfpConnection.GetPath(url);
+
+  if (bOverWrite)
+  {
+    CLog::Log(LOGWARNING, "FileAFP::OpenForWrite() called with overwriting enabled! - %s", strPath.c_str());
+    ret = gAfpConnection.GetImpl()->afp_wrap_creat(m_pAfpVol, strPath.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+  }
+
+  ret = gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, strPath.c_str(), O_RDWR, &m_pFp);
+
+  if (ret || m_pFp == NULL)
+  {
+    // write error to logfile
+    CLog::Log(LOGERROR, "CAFPFile::Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strPath.c_str(), errno, strerror(errno));
+    return false;
+  }
+
+  // We've successfully opened the file!
+  return true;
+}
+
+bool CAFPFile::IsValidFile(const CStdString& strFileName)
+{
+  if (strFileName.Find('/') == -1   || // doesn't have sharename
+      strFileName.Right(2)  == "/." || // not current folder
+      strFileName.Right(3)  == "/..")  // not parent folder
+  {
+    return false;
+  }
+
+  return true;
+}
+#endif // HAS_FILESYSTEM_AFP
+#endif // _LINUX
diff --git a/xbmc/filesystem/AFPFile.h b/xbmc/filesystem/AFPFile.h
new file mode 100644 (file)
index 0000000..f9edc13
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileAFP.h: interface for the CAFPFile class.
+#ifndef FILEAFP_H_
+#define FILEAFP_H_
+
+
+#ifdef _LINUX
+
+#include "IFile.h"
+#include "URL.h"
+#include "threads/CriticalSection.h"
+#include "DllLibAfp.h"
+
+// libafpclient includes
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+CStdString URLEncode(CStdString str);
+
+class CAfpConnection : public CCriticalSection
+{
+public:
+    enum eAfpConnectError
+    {
+      AfpOk     = 0,
+      AfpFailed = 1,
+      AfpAuth   = 2,
+    };
+    typedef enum eAfpConnectError afpConnnectError;
+
+   CAfpConnection();
+  ~CAfpConnection();
+
+  afpConnnectError      Connect(const CURL &url);
+  void                  Disconnect(void);
+  struct afp_server     *GetServer()    {return m_pAfpServer;}
+  struct afp_volume     *GetVolume()    {return m_pAfpVol;};
+  struct afp_url        *GetUrl()       {return m_pAfpUrl;};
+  CStdString            GetPath(const CURL &url);
+  DllLibAfp             *GetImpl()      {return m_pLibAfp;}
+  
+  const char            *GetConnectedIp() const { if(m_pAfpUrl) return m_pAfpUrl->servername;else return "";}
+  
+  //special stat which uses its own context
+  //needed for getting intervolume symlinks to work
+  //it uses the same global server connection
+  //but its own volume
+  int                   stat(const CURL &url, struct stat *statbuff);
+  
+  void AddActiveConnection();
+  void AddIdleConnection();
+  void CheckIfIdle();  
+  void Deinit();  
+
+private:
+  bool                  initLib(void);
+  bool                  connectVolume(const char *volumename, struct afp_volume *&pVolume);
+  void                  disconnectVolume(void);
+  CStdString            getAuthenticatedPath(const CURL &url);
+
+  int                   m_OpenConnections;
+  int                   m_IdleTimeout;
+  struct afp_server     *m_pAfpServer;
+  struct afp_volume     *m_pAfpVol;
+  struct afp_url        *m_pAfpUrl;
+  struct libafpclient   *m_pAfpClient;
+  DllLibAfp             *m_pLibAfp;
+  bool                  m_bDllInited;
+};
+
+extern CAfpConnection gAfpConnection;
+
+namespace XFILE
+{
+class CAFPFile : public IFile
+{
+public:
+  CAFPFile();
+  virtual ~CAFPFile();
+  virtual void          Close();
+  virtual int64_t       Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
+  virtual bool          Open(const CURL& url);
+  virtual bool          Exists(const CURL& url);
+  virtual int           Stat(const CURL& url, struct __stat64* buffer);
+  virtual int           Stat(struct __stat64* buffer);
+  virtual int64_t       GetLength();
+  virtual int64_t       GetPosition();
+  virtual int           Write(const void* lpBuf, int64_t uiBufSize);
+
+  virtual bool          OpenForWrite(const CURL& url, bool bOverWrite = false);
+  virtual bool          Delete(const CURL& url);
+  virtual bool          Rename(const CURL& url, const CURL& urlnew);
+  virtual int           GetChunkSize() {return 1;}
+  // implement iocontrol for seek_possible for preventing the stat in File class for
+  // getting this info ...
+  virtual int           IoControl(EIoControl request, void* param)
+                        { if (request == IOCTRL_SEEK_POSSIBLE) return 1;
+                          return -1;
+                        };
+
+protected:
+  bool                  IsValidFile(const CStdString& strFileName);
+
+  CURL                  m_url;
+  int64_t               m_fileSize;
+  off_t                 m_fileOffset; // current SEEK pointer
+  struct afp_file_info *m_pFp;
+  struct afp_volume    *m_pAfpVol;  
+};
+}
+#endif // _LINUX
+#endif // FILEAFP_H_
index cdac766..68842c6 100644 (file)
@@ -22,9 +22,9 @@
 
 #include "AddonsDirectory.h"
 #include "addons/AddonDatabase.h"
-#include "FactoryDirectory.h"
+#include "DirectoryFactory.h"
 #include "Directory.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "FileItem.h"
 #include "addons/Repository.h"
 #include "addons/AddonInstaller.h"
diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp
new file mode 100644 (file)
index 0000000..408efe1
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "system.h"
+
+#ifdef HAS_DVD_DRIVE
+
+#include "CDDAFile.h"
+#include <sys/stat.h>
+#include "Util.h"
+#include "URL.h"
+#include "storage/MediaManager.h"
+#include "utils/log.h"
+#include "utils/URIUtils.h"
+
+using namespace MEDIA_DETECT;
+using namespace XFILE;
+
+CFileCDDA::CFileCDDA(void)
+{
+  m_pCdIo = NULL;
+  m_lsnStart = CDIO_INVALID_LSN;
+  m_lsnCurrent = CDIO_INVALID_LSN;
+  m_lsnEnd = CDIO_INVALID_LSN;
+  m_cdio = CLibcdio::GetInstance();
+}
+
+CFileCDDA::~CFileCDDA(void)
+{
+  Close();
+}
+
+bool CFileCDDA::Open(const CURL& url)
+{
+  CStdString strURL = url.GetWithoutFilename();
+
+  if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url))
+    return false;
+
+  // Open the dvd drive
+#ifdef _LINUX
+  m_pCdIo = m_cdio->cdio_open(g_mediaManager.TranslateDevicePath(strURL), DRIVER_UNKNOWN);
+#elif defined(_WIN32)
+  m_pCdIo = m_cdio->cdio_open_win32(g_mediaManager.TranslateDevicePath(strURL, true));
+#else
+  m_pCdIo = m_cdio->cdio_open_win32("D:");
+#endif
+  if (!m_pCdIo)
+  {
+    CLog::Log(LOGERROR, "file cdda: Opening the dvd drive failed");
+    return false;
+  }
+
+  int iTrack = GetTrackNum(url);
+
+  m_lsnStart = m_cdio->cdio_get_track_lsn(m_pCdIo, iTrack);
+  m_lsnEnd = m_cdio->cdio_get_track_last_lsn(m_pCdIo, iTrack);
+  m_lsnCurrent = m_lsnStart;
+
+  if (m_lsnStart == CDIO_INVALID_LSN || m_lsnEnd == CDIO_INVALID_LSN)
+  {
+    m_cdio->cdio_destroy(m_pCdIo);
+    m_pCdIo = NULL;
+    return false;
+  }
+
+  return true;
+}
+
+bool CFileCDDA::Exists(const CURL& url)
+{
+  if (!IsValidFile(url))
+    return false;
+
+  int iTrack = GetTrackNum(url);
+
+  if (!Open(url))
+    return false;
+
+  int iLastTrack = m_cdio->cdio_get_last_track_num(m_pCdIo);
+  if (iLastTrack == CDIO_INVALID_TRACK)
+    return false;
+
+  return (iTrack > 0 && iTrack <= iLastTrack);
+}
+
+int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer)
+{
+  if (Open(url))
+  {
+    memset(buffer, 0, sizeof(struct __stat64));
+    buffer->st_size = GetLength();
+    buffer->st_mode = _S_IFREG;
+    Close();
+    return 0;
+  }
+  errno = ENOENT;
+  return -1;
+}
+
+unsigned int CFileCDDA::Read(void* lpBuf, int64_t uiBufSize)
+{
+  if (!m_pCdIo || !g_mediaManager.IsDiscInDrive())
+    return 0;
+
+  int iSectorCount = (int)uiBufSize / CDIO_CD_FRAMESIZE_RAW;
+
+  if (iSectorCount <= 0)
+    return 0;
+
+  // Are there enough sectors left to read
+  if (m_lsnCurrent + iSectorCount > m_lsnEnd)
+    iSectorCount = m_lsnEnd - m_lsnCurrent;
+
+  int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount);
+
+  if ( iret != DRIVER_OP_SUCCESS)
+  {
+    CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret);
+    return 0;
+  }
+
+  m_lsnCurrent += iSectorCount;
+
+  return iSectorCount*CDIO_CD_FRAMESIZE_RAW;
+}
+
+int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
+{
+  if (!m_pCdIo)
+    return -1;
+
+  lsn_t lsnPosition = (int)iFilePosition / CDIO_CD_FRAMESIZE_RAW;
+
+  switch (iWhence)
+  {
+  case SEEK_SET:
+    // cur = pos
+    m_lsnCurrent = m_lsnStart + lsnPosition;
+    break;
+  case SEEK_CUR:
+    // cur += pos
+    m_lsnCurrent += lsnPosition;
+    break;
+  case SEEK_END:
+    // end += pos
+    m_lsnCurrent = m_lsnEnd + lsnPosition;
+    break;
+  default:
+    return -1;
+  }
+
+  return ((m_lsnCurrent -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
+}
+
+void CFileCDDA::Close()
+{
+  if (m_pCdIo)
+  {
+    m_cdio->cdio_destroy(m_pCdIo);
+    m_pCdIo = NULL;
+  }
+}
+
+int64_t CFileCDDA::GetPosition()
+{
+  if (!m_pCdIo)
+    return 0;
+
+  return ((m_lsnCurrent -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
+}
+
+int64_t CFileCDDA::GetLength()
+{
+  if (!m_pCdIo)
+    return 0;
+
+  return ((m_lsnEnd -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
+}
+
+bool CFileCDDA::IsValidFile(const CURL& url)
+{
+  // Only .cdda files are supported
+  CStdString strExtension;
+  URIUtils::GetExtension(url.Get(), strExtension);
+  strExtension.MakeLower();
+
+  return (strExtension == ".cdda");
+}
+
+int CFileCDDA::GetTrackNum(const CURL& url)
+{
+  CStdString strFileName = url.Get();
+
+  // get track number from "cdda://local/01.cdda"
+  return atoi(strFileName.substr(13, strFileName.size() - 13 - 5).c_str());
+}
+
+#define SECTOR_COUNT 52 // max. sectors that can be read at once
+int CFileCDDA::GetChunkSize()
+{
+  return SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW;
+}
+
+#endif
+
diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h
new file mode 100644 (file)
index 0000000..e10e517
--- /dev/null
@@ -0,0 +1,62 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "system.h" // for HAS_DVD_DRIVE
+
+#ifdef HAS_DVD_DRIVE
+
+#include "IFile.h"
+#include "storage/cdioSupport.h"
+
+namespace XFILE
+{
+class CFileCDDA : public IFile
+{
+public:
+  CFileCDDA(void);
+  virtual ~CFileCDDA(void);
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual int GetChunkSize();
+
+protected:
+  bool IsValidFile(const CURL& url);
+  int GetTrackNum(const CURL& url);
+
+protected:
+  CdIo_t* m_pCdIo;
+  lsn_t m_lsnStart;  // Start of m_iTrack in logical sector number
+  lsn_t m_lsnCurrent; // Position inside the track in logical sector number
+  lsn_t m_lsnEnd;   // End of m_iTrack in logical sector number
+  MEDIA_DETECT::CLibcdio* m_cdio;
+};
+}
+
+#endif
+
diff --git a/xbmc/filesystem/CacheCircular.cpp b/xbmc/filesystem/CacheCircular.cpp
deleted file mode 100644 (file)
index 1716927..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "threads/SystemClock.h"
-#include "system.h"
-#include "utils/log.h"
-#include "threads/SingleLock.h"
-#include "utils/TimeUtils.h"
-#include "CacheCircular.h"
-
-using namespace XFILE;
-
-CCacheCircular::CCacheCircular(size_t front, size_t back)
- : CCacheStrategy()
- , m_beg(0)
- , m_end(0)
- , m_cur(0)
- , m_buf(NULL)
- , m_size(front + back)
- , m_size_back(back)
-#ifdef _WIN32
- , m_handle(INVALID_HANDLE_VALUE)
-#endif
-{
-}
-
-CCacheCircular::~CCacheCircular()
-{
-  Close();
-}
-
-int CCacheCircular::Open()
-{
-#ifdef _WIN32
-  m_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, m_size, NULL);
-  if(m_handle == INVALID_HANDLE_VALUE)
-    return CACHE_RC_ERROR;
-  m_buf = (uint8_t*)MapViewOfFile(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, 0);
-#else
-  m_buf = new uint8_t[m_size];
-#endif
-  if(m_buf == 0)
-    return CACHE_RC_ERROR;
-  m_beg = 0;
-  m_end = 0;
-  m_cur = 0;
-  return CACHE_RC_OK;
-}
-
-void CCacheCircular::Close()
-{
-#ifdef _WIN32
-  UnmapViewOfFile(m_buf);
-  CloseHandle(m_handle);
-  m_handle = INVALID_HANDLE_VALUE;
-#else
-  delete[] m_buf;
-#endif
-  m_buf = NULL;
-}
-
-/**
- * Function will write to m_buf at m_end % m_size location
- * it will write at maximum m_size, but it will only write
- * as much it can without wrapping around in the buffer
- *
- * It will always leave m_size_back of the backbuffer intact
- * but if the back buffer is less than that, that space is
- * usable to write.
- *
- * If back buffer is filled to an larger extent than
- * m_size_back, it will allow it to be overwritten
- * until only m_size_back data remains.
- *
- * The following always apply:
- *  * m_end <= m_cur <= m_end
- *  * m_end - m_beg <= m_size
- *
- * Multiple calls may be needed to fill buffer completely.
- */
-int CCacheCircular::WriteToCache(const char *buf, size_t len)
-{
-  CSingleLock lock(m_sync);
-
-  // where are we in the buffer
-  size_t pos   = m_end % m_size;
-  size_t back  = (size_t)(m_cur - m_beg);
-  size_t front = (size_t)(m_end - m_cur);
-
-  size_t limit = m_size - std::min(back, m_size_back) - front;
-  size_t wrap  = m_size - pos;
-
-  // limit by max forward size
-  if(len > limit)
-    len = limit;
-
-  // limit to wrap point
-  if(len > wrap)
-    len = wrap;
-
-  if(len == 0)
-    return 0;
-
-  // write the data
-  memcpy(m_buf + pos, buf, len);
-  m_end += len;
-
-  // drop history that was overwritten
-  if(m_end - m_beg > m_size)
-    m_beg = m_end - m_size;
-
-  m_written.Set();
-
-  return len;
-}
-
-/**
- * Reads data from cache. Will only read up till
- * the buffer wrap point. So multiple calls
- * may be needed to empty the whole cache
- */
-int CCacheCircular::ReadFromCache(char *buf, size_t len)
-{
-  CSingleLock lock(m_sync);
-
-  size_t pos   = m_cur % m_size;
-  size_t front = (size_t)(m_end - m_cur);
-  size_t avail = std::min(m_size - pos, front);
-
-  if(avail == 0)
-  {
-    if(IsEndOfInput())
-      return 0;
-    else
-      return CACHE_RC_WOULD_BLOCK;
-  }
-
-  if(len > avail)
-    len = avail;
-
-  if(len == 0)
-    return 0;
-
-  memcpy(buf, m_buf + pos, len);
-  m_cur += len;
-
-  m_space.Set();
-
-  return len;
-}
-
-int64_t CCacheCircular::WaitForData(unsigned int minumum, unsigned int millis)
-{
-  CSingleLock lock(m_sync);
-  uint64_t avail = m_end - m_cur;
-
-  if(millis == 0 || IsEndOfInput())
-    return avail;
-
-  if(minumum > m_size - m_size_back)
-    minumum = m_size - m_size_back;
-
-  XbmcThreads::EndTime endtime(millis);
-  while (!IsEndOfInput() && avail < minumum && !endtime.IsTimePast() )
-  {
-    lock.Leave();
-    m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
-    lock.Enter();
-    avail = m_end - m_cur;
-  }
-
-  return avail;
-}
-
-int64_t CCacheCircular::Seek(int64_t pos)
-{
-  CSingleLock lock(m_sync);
-
-  // if seek is a bit over what we have, try to wait a few seconds for the data to be available.
-  // we try to avoid a (heavy) seek on the source
-  if ((uint64_t)pos >= m_end && (uint64_t)pos < m_end + 100000)
-  {
-    lock.Leave();
-    WaitForData((size_t)(pos - m_cur), 5000);
-    lock.Enter();
-  }
-
-  if((uint64_t)pos >= m_beg && (uint64_t)pos <= m_end)
-  {
-    m_cur = pos;
-    return pos;
-  }
-
-  return CACHE_RC_ERROR;
-}
-
-void CCacheCircular::Reset(int64_t pos)
-{
-  CSingleLock lock(m_sync);
-  m_end = pos;
-  m_beg = pos;
-  m_cur = pos;
-}
-
diff --git a/xbmc/filesystem/CacheCircular.h b/xbmc/filesystem/CacheCircular.h
deleted file mode 100644 (file)
index 52981c6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#ifndef CACHECIRCULAR_H
-#define CACHECIRCULAR_H
-
-#include "CacheStrategy.h"
-#include "threads/CriticalSection.h"
-#include "threads/Event.h"
-
-namespace XFILE {
-
-class CCacheCircular : public CCacheStrategy
-{
-public:
-    CCacheCircular(size_t front, size_t back);
-    virtual ~CCacheCircular();
-
-    virtual int Open() ;
-    virtual void Close();
-
-    virtual int WriteToCache(const char *buf, size_t len) ;
-    virtual int ReadFromCache(char *buf, size_t len) ;
-    virtual int64_t WaitForData(unsigned int minimum, unsigned int iMillis) ;
-
-    virtual int64_t Seek(int64_t pos) ;
-    virtual void Reset(int64_t pos) ;
-
-protected:
-    uint64_t          m_beg;       /**< index in file (not buffer) of beginning of valid data */
-    uint64_t          m_end;       /**< index in file (not buffer) of end of valid data */
-    uint64_t          m_cur;       /**< current reading index in file */
-    uint8_t          *m_buf;       /**< buffer holding data */
-    size_t            m_size;      /**< size of data buffer used (m_buf) */
-    size_t            m_size_back; /**< guaranteed size of back buffer (actual size can be smaller, or larger if front buffer doesn't need it) */
-    CCriticalSection  m_sync;
-    CEvent            m_written;
-#ifdef _WIN32
-    HANDLE            m_handle;
-#endif
-};
-
-} // namespace XFILE
-#endif
diff --git a/xbmc/filesystem/CacheMemBuffer.cpp b/xbmc/filesystem/CacheMemBuffer.cpp
deleted file mode 100644 (file)
index 65bd005..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#ifdef _LINUX
-#include "threads/SystemClock.h"
-#include "linux/PlatformDefs.h"
-#endif
-#include "settings/AdvancedSettings.h"
-#include "CacheMemBuffer.h"
-#include "utils/log.h"
-#include "threads/SingleLock.h"
-#include "utils/TimeUtils.h"
-
-#include <math.h>
-
-using namespace XFILE;
-
-#define SEEK_CHECK_RET(x) if (!(x)) return -1;
-
-CacheMemBuffer::CacheMemBuffer()
- : CCacheStrategy()
-{
-  m_nStartPosition = 0;
-  m_buffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
-  m_HistoryBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
-  m_forwardBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
-}
-
-
-CacheMemBuffer::~CacheMemBuffer()
-{
-  m_buffer.Destroy();
-  m_HistoryBuffer.Destroy();
-  m_forwardBuffer.Destroy();
-}
-
-int CacheMemBuffer::Open()
-{
-  m_nStartPosition = 0;
-  m_buffer.Clear();
-  m_HistoryBuffer.Clear();
-  m_forwardBuffer.Clear();
-  return CACHE_RC_OK;
-}
-
-void CacheMemBuffer::Close()
-{
-  m_buffer.Clear();
-  m_HistoryBuffer.Clear();
-  m_forwardBuffer.Clear();
-}
-
-int CacheMemBuffer::WriteToCache(const char *pBuffer, size_t iSize)
-{
-  CSingleLock lock(m_sync);
-  unsigned int nToWrite = m_buffer.getMaxWriteSize() ;
-
-  // must also check the forward buffer.
-  // if we have leftovers from the previous seek - we need not read anymore until they are utilized
-  if (nToWrite == 0 || m_forwardBuffer.getMaxReadSize() > 0)
-    return 0;
-
-  if (nToWrite > iSize)
-    nToWrite = iSize;
-
-  if (!m_buffer.WriteData((char*)pBuffer, nToWrite))
-  {
-    CLog::Log(LOGWARNING,"%s, failed to write %d bytes to buffer. max buffer size: %d", __FUNCTION__, nToWrite, m_buffer.getMaxWriteSize());
-    nToWrite = 0;
-  }
-
-  m_written.Set();
-
-  return nToWrite;
-}
-
-int CacheMemBuffer::ReadFromCache(char *pBuffer, size_t iMaxSize)
-{
-  CSingleLock lock(m_sync);
-  if ( m_buffer.getMaxReadSize() == 0 ) {
-    return m_bEndOfInput ? 0 : CACHE_RC_WOULD_BLOCK;
-  }
-
-  int nRead = iMaxSize;
-  if ((size_t) m_buffer.getMaxReadSize() < iMaxSize)
-    nRead = m_buffer.getMaxReadSize();
-
-  if (nRead > 0)
-  {
-    if (!m_buffer.ReadData(pBuffer, nRead))
-    {
-      CLog::Log(LOGWARNING, "%s, failed to read %d bytes from buffer. max read size: %d", __FUNCTION__, nRead, m_buffer.getMaxReadSize());
-      return 0;
-    }
-
-    // copy to history so we can seek back
-    if ((int) m_HistoryBuffer.getMaxWriteSize() < nRead)
-      m_HistoryBuffer.SkipBytes(nRead);
-    m_HistoryBuffer.WriteData(pBuffer, nRead);
-
-    m_nStartPosition += nRead;
-  }
-
-  // check forward buffer and copy it when enough space is available
-  if (m_forwardBuffer.getMaxReadSize() > 0 && m_buffer.getMaxWriteSize() >= m_forwardBuffer.getMaxReadSize())
-  {
-    m_buffer.Append(m_forwardBuffer);
-    m_forwardBuffer.Clear();
-  }
-
-  if (nRead > 0)
-    m_space.Set();
-
-  return nRead;
-}
-
-int64_t CacheMemBuffer::WaitForData(unsigned int iMinAvail, unsigned int millis)
-{
-  if (millis == 0 || IsEndOfInput())
-    return m_buffer.getMaxReadSize();
-
-  XbmcThreads::EndTime endTime(millis);
-  while (!IsEndOfInput() && (unsigned int) m_buffer.getMaxReadSize() < iMinAvail && !endTime.IsTimePast() )
-    m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
-
-  return m_buffer.getMaxReadSize();
-}
-
-int64_t CacheMemBuffer::Seek(int64_t iFilePosition)
-{
-  CSingleLock lock(m_sync);
-
-  // if seek is a bit over what we have, try to wait a few seconds for the data to be available.
-  // we try to avoid a (heavy) seek on the source
-  if (iFilePosition > m_nStartPosition + m_buffer.getMaxReadSize() &&
-      iFilePosition < m_nStartPosition + m_buffer.getMaxReadSize() + 100000)
-  {
-    int nRequired = (int)(iFilePosition - (m_nStartPosition + m_buffer.getMaxReadSize()));
-    lock.Leave();
-    WaitForData(nRequired + 1, 5000);
-    lock.Enter();
-  }
-
-  // check if seek is inside the current buffer
-  if (iFilePosition >= m_nStartPosition && iFilePosition < m_nStartPosition + m_buffer.getMaxReadSize())
-  {
-    unsigned int nOffset = (unsigned int)(iFilePosition - m_nStartPosition);
-    // copy to history so we can seek back
-    if (m_HistoryBuffer.getMaxWriteSize() < nOffset)
-      m_HistoryBuffer.SkipBytes(nOffset);
-
-    if (!m_buffer.ReadData(m_HistoryBuffer, nOffset))
-    {
-      CLog::Log(LOGERROR, "%s, failed to copy %d bytes to history", __FUNCTION__, nOffset);
-    }
-
-    m_nStartPosition = iFilePosition;
-    m_space.Set();
-    return m_nStartPosition;
-  }
-
-  int64_t iHistoryStart = m_nStartPosition - m_HistoryBuffer.getMaxReadSize();
-  if (iFilePosition < m_nStartPosition && iFilePosition >= iHistoryStart)
-  {
-    CRingBuffer saveHist, saveUnRead;
-    int64_t nToSkip = iFilePosition - iHistoryStart;
-    SEEK_CHECK_RET(m_HistoryBuffer.ReadData(saveHist, (int)nToSkip));
-
-    SEEK_CHECK_RET(saveUnRead.Copy(m_buffer));
-
-    SEEK_CHECK_RET(m_buffer.Copy(m_HistoryBuffer));
-    int nSpace = m_buffer.getMaxWriteSize();
-    int nToCopy = saveUnRead.getMaxReadSize();
-
-    if (nToCopy < nSpace)
-      nSpace = nToCopy;
-
-    SEEK_CHECK_RET(saveUnRead.ReadData(m_buffer, nSpace));
-    nToCopy -= nSpace;
-    if (nToCopy > 0)
-      m_forwardBuffer.Copy(saveUnRead);
-
-    m_nStartPosition = iFilePosition;
-    m_space.Set();
-    return m_nStartPosition;
-  }
-
-  // seek outside the buffer. return error.
-  return CACHE_RC_ERROR;
-}
-
-void CacheMemBuffer::Reset(int64_t iSourcePosition)
-{
-  CSingleLock lock(m_sync);
-  m_nStartPosition = iSourcePosition;
-  m_buffer.Clear();
-  m_HistoryBuffer.Clear();
-  m_forwardBuffer.Clear();
-}
-
-
diff --git a/xbmc/filesystem/CacheMemBuffer.h b/xbmc/filesystem/CacheMemBuffer.h
deleted file mode 100644 (file)
index c2fc109..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#ifndef CACHEMEMBUFFER_H
-#define CACHEMEMBUFFER_H
-
-#include "CacheStrategy.h"
-#include "threads/CriticalSection.h"
-#include "threads/Event.h"
-#include "utils/RingBuffer.h"
-
-/**
-  @author Team XBMC
-*/
-namespace XFILE {
-
-class CacheMemBuffer : public CCacheStrategy
-{
-public:
-    CacheMemBuffer();
-    virtual ~CacheMemBuffer();
-
-    virtual int Open() ;
-    virtual void Close();
-
-    virtual int WriteToCache(const char *pBuffer, size_t iSize) ;
-    virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ;
-    virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ;
-
-    virtual int64_t Seek(int64_t iFilePosition) ;
-    virtual void Reset(int64_t iSourcePosition) ;
-
-protected:
-    int64_t m_nStartPosition;
-    CRingBuffer m_buffer;
-    CRingBuffer m_HistoryBuffer;
-    CRingBuffer m_forwardBuffer; // for seek cases, to store data already read
-    CCriticalSection m_sync;
-    CEvent m_written;
-};
-
-} // namespace XFILE
-#endif
diff --git a/xbmc/filesystem/CircularCache.cpp b/xbmc/filesystem/CircularCache.cpp
new file mode 100644 (file)
index 0000000..1716927
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "threads/SystemClock.h"
+#include "system.h"
+#include "utils/log.h"
+#include "threads/SingleLock.h"
+#include "utils/TimeUtils.h"
+#include "CacheCircular.h"
+
+using namespace XFILE;
+
+CCacheCircular::CCacheCircular(size_t front, size_t back)
+ : CCacheStrategy()
+ , m_beg(0)
+ , m_end(0)
+ , m_cur(0)
+ , m_buf(NULL)
+ , m_size(front + back)
+ , m_size_back(back)
+#ifdef _WIN32
+ , m_handle(INVALID_HANDLE_VALUE)
+#endif
+{
+}
+
+CCacheCircular::~CCacheCircular()
+{
+  Close();
+}
+
+int CCacheCircular::Open()
+{
+#ifdef _WIN32
+  m_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, m_size, NULL);
+  if(m_handle == INVALID_HANDLE_VALUE)
+    return CACHE_RC_ERROR;
+  m_buf = (uint8_t*)MapViewOfFile(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, 0);
+#else
+  m_buf = new uint8_t[m_size];
+#endif
+  if(m_buf == 0)
+    return CACHE_RC_ERROR;
+  m_beg = 0;
+  m_end = 0;
+  m_cur = 0;
+  return CACHE_RC_OK;
+}
+
+void CCacheCircular::Close()
+{
+#ifdef _WIN32
+  UnmapViewOfFile(m_buf);
+  CloseHandle(m_handle);
+  m_handle = INVALID_HANDLE_VALUE;
+#else
+  delete[] m_buf;
+#endif
+  m_buf = NULL;
+}
+
+/**
+ * Function will write to m_buf at m_end % m_size location
+ * it will write at maximum m_size, but it will only write
+ * as much it can without wrapping around in the buffer
+ *
+ * It will always leave m_size_back of the backbuffer intact
+ * but if the back buffer is less than that, that space is
+ * usable to write.
+ *
+ * If back buffer is filled to an larger extent than
+ * m_size_back, it will allow it to be overwritten
+ * until only m_size_back data remains.
+ *
+ * The following always apply:
+ *  * m_end <= m_cur <= m_end
+ *  * m_end - m_beg <= m_size
+ *
+ * Multiple calls may be needed to fill buffer completely.
+ */
+int CCacheCircular::WriteToCache(const char *buf, size_t len)
+{
+  CSingleLock lock(m_sync);
+
+  // where are we in the buffer
+  size_t pos   = m_end % m_size;
+  size_t back  = (size_t)(m_cur - m_beg);
+  size_t front = (size_t)(m_end - m_cur);
+
+  size_t limit = m_size - std::min(back, m_size_back) - front;
+  size_t wrap  = m_size - pos;
+
+  // limit by max forward size
+  if(len > limit)
+    len = limit;
+
+  // limit to wrap point
+  if(len > wrap)
+    len = wrap;
+
+  if(len == 0)
+    return 0;
+
+  // write the data
+  memcpy(m_buf + pos, buf, len);
+  m_end += len;
+
+  // drop history that was overwritten
+  if(m_end - m_beg > m_size)
+    m_beg = m_end - m_size;
+
+  m_written.Set();
+
+  return len;
+}
+
+/**
+ * Reads data from cache. Will only read up till
+ * the buffer wrap point. So multiple calls
+ * may be needed to empty the whole cache
+ */
+int CCacheCircular::ReadFromCache(char *buf, size_t len)
+{
+  CSingleLock lock(m_sync);
+
+  size_t pos   = m_cur % m_size;
+  size_t front = (size_t)(m_end - m_cur);
+  size_t avail = std::min(m_size - pos, front);
+
+  if(avail == 0)
+  {
+    if(IsEndOfInput())
+      return 0;
+    else
+      return CACHE_RC_WOULD_BLOCK;
+  }
+
+  if(len > avail)
+    len = avail;
+
+  if(len == 0)
+    return 0;
+
+  memcpy(buf, m_buf + pos, len);
+  m_cur += len;
+
+  m_space.Set();
+
+  return len;
+}
+
+int64_t CCacheCircular::WaitForData(unsigned int minumum, unsigned int millis)
+{
+  CSingleLock lock(m_sync);
+  uint64_t avail = m_end - m_cur;
+
+  if(millis == 0 || IsEndOfInput())
+    return avail;
+
+  if(minumum > m_size - m_size_back)
+    minumum = m_size - m_size_back;
+
+  XbmcThreads::EndTime endtime(millis);
+  while (!IsEndOfInput() && avail < minumum && !endtime.IsTimePast() )
+  {
+    lock.Leave();
+    m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
+    lock.Enter();
+    avail = m_end - m_cur;
+  }
+
+  return avail;
+}
+
+int64_t CCacheCircular::Seek(int64_t pos)
+{
+  CSingleLock lock(m_sync);
+
+  // if seek is a bit over what we have, try to wait a few seconds for the data to be available.
+  // we try to avoid a (heavy) seek on the source
+  if ((uint64_t)pos >= m_end && (uint64_t)pos < m_end + 100000)
+  {
+    lock.Leave();
+    WaitForData((size_t)(pos - m_cur), 5000);
+    lock.Enter();
+  }
+
+  if((uint64_t)pos >= m_beg && (uint64_t)pos <= m_end)
+  {
+    m_cur = pos;
+    return pos;
+  }
+
+  return CACHE_RC_ERROR;
+}
+
+void CCacheCircular::Reset(int64_t pos)
+{
+  CSingleLock lock(m_sync);
+  m_end = pos;
+  m_beg = pos;
+  m_cur = pos;
+}
+
diff --git a/xbmc/filesystem/CircularCache.h b/xbmc/filesystem/CircularCache.h
new file mode 100644 (file)
index 0000000..52981c6
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifndef CACHECIRCULAR_H
+#define CACHECIRCULAR_H
+
+#include "CacheStrategy.h"
+#include "threads/CriticalSection.h"
+#include "threads/Event.h"
+
+namespace XFILE {
+
+class CCacheCircular : public CCacheStrategy
+{
+public:
+    CCacheCircular(size_t front, size_t back);
+    virtual ~CCacheCircular();
+
+    virtual int Open() ;
+    virtual void Close();
+
+    virtual int WriteToCache(const char *buf, size_t len) ;
+    virtual int ReadFromCache(char *buf, size_t len) ;
+    virtual int64_t WaitForData(unsigned int minimum, unsigned int iMillis) ;
+
+    virtual int64_t Seek(int64_t pos) ;
+    virtual void Reset(int64_t pos) ;
+
+protected:
+    uint64_t          m_beg;       /**< index in file (not buffer) of beginning of valid data */
+    uint64_t          m_end;       /**< index in file (not buffer) of end of valid data */
+    uint64_t          m_cur;       /**< current reading index in file */
+    uint8_t          *m_buf;       /**< buffer holding data */
+    size_t            m_size;      /**< size of data buffer used (m_buf) */
+    size_t            m_size_back; /**< guaranteed size of back buffer (actual size can be smaller, or larger if front buffer doesn't need it) */
+    CCriticalSection  m_sync;
+    CEvent            m_written;
+#ifdef _WIN32
+    HANDLE            m_handle;
+#endif
+};
+
+} // namespace XFILE
+#endif
diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp
new file mode 100644 (file)
index 0000000..29ae694
--- /dev/null
@@ -0,0 +1,1400 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "CurlFile.h"
+#include "utils/URIUtils.h"
+#include "Util.h"
+#include "URL.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/GUISettings.h"
+#include "settings/Settings.h"
+#include "File.h"
+
+#include <vector>
+#include <climits>
+
+#ifdef _LINUX
+#include <errno.h>
+#include <inttypes.h>
+#include "../linux/XFileUtils.h"
+#include "../linux/XTimeUtils.h"
+#include "../linux/ConvUtils.h"
+#endif
+
+#include "DllLibCurl.h"
+#include "ShoutcastFile.h"
+#include "SpecialProtocol.h"
+#include "utils/CharsetConverter.h"
+#include "utils/log.h"
+
+using namespace XFILE;
+using namespace XCURL;
+
+#define XMIN(a,b) ((a)<(b)?(a):(b))
+#define FITS_INT(a) (((a) <= INT_MAX) && ((a) >= INT_MIN))
+
+#define dllselect select
+
+// curl calls this routine to debug
+extern "C" int debug_callback(CURL_HANDLE *handle, curl_infotype info, char *output, size_t size, void *data)
+{
+  if (info == CURLINFO_DATA_IN || info == CURLINFO_DATA_OUT)
+    return 0;
+
+  // Only shown cURL debug into with loglevel DEBUG_SAMBA or higher
+  if( g_advancedSettings.m_logLevel < LOG_LEVEL_DEBUG_SAMBA )
+    return 0;
+
+  CStdString strLine;
+  strLine.append(output, size);
+  std::vector<CStdString> vecLines;
+  CUtil::Tokenize(strLine, vecLines, "\r\n");
+  std::vector<CStdString>::const_iterator it = vecLines.begin();
+
+  while (it != vecLines.end()) {
+    CLog::Log(LOGDEBUG, "Curl::Debug %s", (*it).c_str());
+    it++;
+  }
+  return 0;
+}
+
+/* curl calls this routine to get more data */
+extern "C" size_t write_callback(char *buffer,
+               size_t size,
+               size_t nitems,
+               void *userp)
+{
+  if(userp == NULL) return 0;
+
+  CCurlFile::CReadState *state = (CCurlFile::CReadState *)userp;
+  return state->WriteCallback(buffer, size, nitems);
+}
+
+extern "C" size_t header_callback(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+  CCurlFile::CReadState *state = (CCurlFile::CReadState *)stream;
+  return state->HeaderCallback(ptr, size, nmemb);
+}
+
+/* fix for silly behavior of realloc */
+static inline void* realloc_simple(void *ptr, size_t size)
+{
+  void *ptr2 = realloc(ptr, size);
+  if(ptr && !ptr2 && size > 0)
+  {
+    free(ptr);
+    return NULL;
+  }
+  else
+    return ptr2;
+}
+
+size_t CCurlFile::CReadState::HeaderCallback(void *ptr, size_t size, size_t nmemb)
+{
+  // clear any previous header
+  if(m_headerdone)
+  {
+    m_httpheader.Clear();
+    m_headerdone = false;
+  }
+
+  // libcurl doc says that this info is not always \0 terminated
+  char* strData = (char*)ptr;
+  int iSize = size * nmemb;
+
+  if (strData[iSize] != 0)
+  {
+    strData = (char*)malloc(iSize + 1);
+    strncpy(strData, (char*)ptr, iSize);
+    strData[iSize] = 0;
+  }
+  else strData = strdup((char*)ptr);
+
+  if(strcmp(strData, "\r\n") == 0)
+    m_headerdone = true;
+
+  m_httpheader.Parse(strData);
+
+  free(strData);
+
+  return iSize;
+}
+
+size_t CCurlFile::CReadState::WriteCallback(char *buffer, size_t size, size_t nitems)
+{
+  unsigned int amount = size * nitems;
+//  CLog::Log(LOGDEBUG, "CCurlFile::WriteCallback (%p) with %i bytes, readsize = %i, writesize = %i", this, amount, m_buffer.getMaxReadSize(), m_buffer.getMaxWriteSize() - m_overflowSize);
+  if (m_overflowSize)
+  {
+    // we have our overflow buffer - first get rid of as much as we can
+    unsigned int maxWriteable = XMIN((unsigned int)m_buffer.getMaxWriteSize(), m_overflowSize);
+    if (maxWriteable)
+    {
+      if (!m_buffer.WriteData(m_overflowBuffer, maxWriteable))
+        CLog::Log(LOGERROR, "Unable to write to buffer - what's up?");
+      if (m_overflowSize > maxWriteable)
+      { // still have some more - copy it down
+        memmove(m_overflowBuffer, m_overflowBuffer + maxWriteable, m_overflowSize - maxWriteable);
+      }
+      m_overflowSize -= maxWriteable;
+    }
+  }
+  // ok, now copy the data into our ring buffer
+  unsigned int maxWriteable = XMIN((unsigned int)m_buffer.getMaxWriteSize(), amount);
+  if (maxWriteable)
+  {
+    if (!m_buffer.WriteData(buffer, maxWriteable))
+    {
+      CLog::Log(LOGERROR, "%s - Unable to write to buffer with %i bytes - what's up?", __FUNCTION__, maxWriteable);
+    }
+    else
+    {
+      amount -= maxWriteable;
+      buffer += maxWriteable;
+    }
+  }
+  if (amount)
+  {
+//    CLog::Log(LOGDEBUG, "CCurlFile::WriteCallback(%p) not enough free space for %i bytes", (void*)this,  amount);
+
+    m_overflowBuffer = (char*)realloc_simple(m_overflowBuffer, amount + m_overflowSize);
+    if(m_overflowBuffer == NULL)
+    {
+      CLog::Log(LOGWARNING, "%s - Failed to grow overflow buffer from %i bytes to %i bytes", __FUNCTION__, m_overflowSize, amount + m_overflowSize);
+      return 0;
+    }
+    memcpy(m_overflowBuffer + m_overflowSize, buffer, amount);
+    m_overflowSize += amount;
+  }
+  return size * nitems;
+}
+
+CCurlFile::CReadState::CReadState()
+{
+  m_easyHandle = NULL;
+  m_multiHandle = NULL;
+  m_overflowBuffer = NULL;
+  m_overflowSize = 0;
+  m_filePos = 0;
+  m_fileSize = 0;
+  m_bufferSize = 0;
+  m_cancelled = false;
+  m_bFirstLoop = true;
+  m_headerdone = false;
+}
+
+CCurlFile::CReadState::~CReadState()
+{
+  Disconnect();
+
+  if(m_easyHandle)
+    g_curlInterface.easy_release(&m_easyHandle, &m_multiHandle);
+}
+
+bool CCurlFile::CReadState::Seek(int64_t pos)
+{
+  if(pos == m_filePos)
+    return true;
+
+  if(FITS_INT(pos - m_filePos) && m_buffer.SkipBytes((int)(pos - m_filePos)))
+  {
+    m_filePos = pos;
+    return true;
+  }
+
+  if(pos > m_filePos && pos < m_filePos + m_bufferSize)
+  {
+    int len = m_buffer.getMaxReadSize();
+    m_filePos += len;
+    m_buffer.SkipBytes(len);
+    if(!FillBuffer(m_bufferSize))
+    {
+      if(!m_buffer.SkipBytes(-len))
+        CLog::Log(LOGERROR, "%s - Failed to restore position after failed fill", __FUNCTION__);
+      else
+        m_filePos -= len;
+      return false;
+    }
+
+    if(!FITS_INT(pos - m_filePos) || !m_buffer.SkipBytes((int)(pos - m_filePos)))
+    {
+      CLog::Log(LOGERROR, "%s - Failed to skip to position after having filled buffer", __FUNCTION__);
+      if(!m_buffer.SkipBytes(-len))
+        CLog::Log(LOGERROR, "%s - Failed to restore position after failed seek", __FUNCTION__);
+      else
+        m_filePos -= len;
+      return false;
+    }
+    m_filePos = pos;
+    return true;
+  }
+  return false;
+}
+
+long CCurlFile::CReadState::Connect(unsigned int size)
+{
+  g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
+  g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
+
+  m_bufferSize = size;
+  m_buffer.Destroy();
+  m_buffer.Create(size * 3);
+  m_headerdone = false;
+
+  // read some data in to try and obtain the length
+  // maybe there's a better way to get this info??
+  m_stillRunning = 1;
+  if (!FillBuffer(1))
+  {
+    CLog::Log(LOGERROR, "CCurlFile::CReadState::Open, didn't get any data from stream.");
+    return -1;
+  }
+
+  double length;
+  if (CURLE_OK == g_curlInterface.easy_getinfo(m_easyHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &length))
+  {
+    if (length < 0)
+      length = 0.0;
+    m_fileSize = m_filePos + (int64_t)length;
+  }
+
+  long response;
+  if (CURLE_OK == g_curlInterface.easy_getinfo(m_easyHandle, CURLINFO_RESPONSE_CODE, &response))
+    return response;
+
+  return -1;
+}
+
+void CCurlFile::CReadState::Disconnect()
+{
+  if(m_multiHandle && m_easyHandle)
+    g_curlInterface.multi_remove_handle(m_multiHandle, m_easyHandle);
+
+  m_buffer.Clear();
+  free(m_overflowBuffer);
+  m_overflowBuffer = NULL;
+  m_overflowSize = 0;
+  m_filePos = 0;
+  m_fileSize = 0;
+  m_bufferSize = 0;
+}
+
+
+CCurlFile::~CCurlFile()
+{
+  if (m_opened)
+    Close();
+  delete m_state;
+  g_curlInterface.Unload();
+}
+
+CCurlFile::CCurlFile()
+{
+  g_curlInterface.Load(); // loads the curl dll and resolves exports etc.
+  m_curlAliasList = NULL;
+  m_curlHeaderList = NULL;
+  m_opened = false;
+  m_multisession  = true;
+  m_seekable = true;
+  m_useOldHttpVersion = false;
+  m_connecttimeout = 0;
+  m_lowspeedtime = 0;
+  m_ftpauth = "";
+  m_ftpport = "";
+  m_ftppasvip = false;
+  m_bufferSize = 32768;
+  m_binary = true;
+  m_postdata = "";
+  m_username = "";
+  m_password = "";
+  m_httpauth = "";
+  m_state = new CReadState();
+  m_skipshout = false;
+}
+
+//Has to be called before Open()
+void CCurlFile::SetBufferSize(unsigned int size)
+{
+  m_bufferSize = size;
+}
+
+void CCurlFile::Close()
+{
+  m_state->Disconnect();
+
+  m_url.Empty();
+  m_referer.Empty();
+  m_cookie.Empty();
+
+  /* cleanup */
+  if( m_curlAliasList )
+    g_curlInterface.slist_free_all(m_curlAliasList);
+  if( m_curlHeaderList )
+    g_curlInterface.slist_free_all(m_curlHeaderList);
+
+  m_curlAliasList = NULL;
+  m_curlHeaderList = NULL;
+  m_opened = false;
+}
+
+void CCurlFile::SetCommonOptions(CReadState* state)
+{
+  CURL_HANDLE* h = state->m_easyHandle;
+
+  g_curlInterface.easy_reset(h);
+
+  g_curlInterface.easy_setopt(h, CURLOPT_DEBUGFUNCTION, debug_callback);
+
+  if( g_advancedSettings.m_logLevel >= LOG_LEVEL_DEBUG )
+    g_curlInterface.easy_setopt(h, CURLOPT_VERBOSE, TRUE);
+  else
+    g_curlInterface.easy_setopt(h, CURLOPT_VERBOSE, FALSE);
+
+  g_curlInterface.easy_setopt(h, CURLOPT_WRITEDATA, state);
+  g_curlInterface.easy_setopt(h, CURLOPT_WRITEFUNCTION, write_callback);
+
+  // set username and password for current handle
+  if (m_username.length() > 0 && m_password.length() > 0)
+  {
+    CStdString userpwd = m_username + ":" + m_password;
+    g_curlInterface.easy_setopt(h, CURLOPT_USERPWD, userpwd.c_str());
+  }
+
+  // make sure headers are seperated from the data stream
+  g_curlInterface.easy_setopt(h, CURLOPT_WRITEHEADER, state);
+  g_curlInterface.easy_setopt(h, CURLOPT_HEADERFUNCTION, header_callback);
+  g_curlInterface.easy_setopt(h, CURLOPT_HEADER, FALSE);
+
+  g_curlInterface.easy_setopt(h, CURLOPT_FTP_USE_EPSV, 0); // turn off epsv
+
+  // Allow us to follow two redirects
+  g_curlInterface.easy_setopt(h, CURLOPT_FOLLOWLOCATION, TRUE);
+  g_curlInterface.easy_setopt(h, CURLOPT_MAXREDIRS, 5);
+
+  // Enable cookie engine for current handle to re-use them in future requests
+  CStdString strCookieFile;
+  CStdString strTempPath = CSpecialProtocol::TranslatePath(g_advancedSettings.m_cachePath);
+  URIUtils::AddFileToFolder(strTempPath, "cookies.dat", strCookieFile);
+
+  g_curlInterface.easy_setopt(h, CURLOPT_COOKIEFILE, strCookieFile.c_str());
+  g_curlInterface.easy_setopt(h, CURLOPT_COOKIEJAR, strCookieFile.c_str());
+
+  // Set custom cookie if requested
+  if (!m_cookie.IsEmpty())
+    g_curlInterface.easy_setopt(h, CURLOPT_COOKIE, m_cookie.c_str());
+
+  g_curlInterface.easy_setopt(h, CURLOPT_COOKIELIST, "FLUSH");
+
+  // When using multiple threads you should set the CURLOPT_NOSIGNAL option to
+  // TRUE for all handles. Everything will work fine except that timeouts are not
+  // honored during the DNS lookup - which you can work around by building libcurl
+  // with c-ares support. c-ares is a library that provides asynchronous name
+  // resolves. Unfortunately, c-ares does not yet support IPv6.
+  g_curlInterface.easy_setopt(h, CURLOPT_NOSIGNAL, TRUE);
+
+  // not interested in failed requests
+  g_curlInterface.easy_setopt(h, CURLOPT_FAILONERROR, 1);
+
+  // enable support for icecast / shoutcast streams
+  m_curlAliasList = g_curlInterface.slist_append(m_curlAliasList, "ICY 200 OK");
+  g_curlInterface.easy_setopt(h, CURLOPT_HTTP200ALIASES, m_curlAliasList);
+
+  // never verify peer, we don't have any certificates to do this
+  g_curlInterface.easy_setopt(h, CURLOPT_SSL_VERIFYPEER, 0);
+  g_curlInterface.easy_setopt(h, CURLOPT_SSL_VERIFYHOST, 0);
+
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_URL, m_url.c_str());
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TRANSFERTEXT, FALSE);
+
+  // setup POST data if it exists
+  if (!m_postdata.IsEmpty())
+  {
+    g_curlInterface.easy_setopt(h, CURLOPT_POST, 1 );
+    g_curlInterface.easy_setopt(h, CURLOPT_POSTFIELDSIZE, m_postdata.length());
+    g_curlInterface.easy_setopt(h, CURLOPT_POSTFIELDS, m_postdata.c_str());
+  }
+
+  // setup Referer header if needed
+  if (!m_referer.IsEmpty())
+    g_curlInterface.easy_setopt(h, CURLOPT_REFERER, m_referer.c_str());
+  else
+  {
+    g_curlInterface.easy_setopt(h, CURLOPT_REFERER, NULL);
+    g_curlInterface.easy_setopt(h, CURLOPT_AUTOREFERER, TRUE);
+  }
+
+  // setup any requested authentication
+  if( m_ftpauth.length() > 0 )
+  {
+    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
+    if( m_ftpauth.Equals("any") )
+      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_DEFAULT);
+    else if( m_ftpauth.Equals("ssl") )
+      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_SSL);
+    else if( m_ftpauth.Equals("tls") )
+      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS);
+  }
+
+  // setup requested http authentication method
+  if(m_httpauth.length() > 0)
+  {
+    if( m_httpauth.Equals("any") )
+      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+    else if( m_httpauth.Equals("anysafe") )
+      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
+    else if( m_httpauth.Equals("digest") )
+      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+    else if( m_httpauth.Equals("ntlm") )
+      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
+  }
+
+  // allow passive mode for ftp
+  if( m_ftpport.length() > 0 )
+    g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, m_ftpport.c_str());
+  else
+    g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, NULL);
+
+  // allow curl to not use the ip address in the returned pasv response
+  if( m_ftppasvip )
+    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SKIP_PASV_IP, 0);
+  else
+    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SKIP_PASV_IP, 1);
+
+  // setup Content-Encoding if requested
+  if( m_contentencoding.length() > 0 )
+    g_curlInterface.easy_setopt(h, CURLOPT_ENCODING, m_contentencoding.c_str());
+
+  if (m_userAgent.length() > 0)
+    g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, m_userAgent.c_str());
+  else /* set some default agent as shoutcast doesn't return proper stuff otherwise */
+    g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, g_settings.m_userAgent.c_str());
+
+  if (m_useOldHttpVersion)
+    g_curlInterface.easy_setopt(h, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+  else
+    SetRequestHeader("Connection", "keep-alive");
+
+  if (g_advancedSettings.m_curlDisableIPV6)
+    g_curlInterface.easy_setopt(h, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+
+  if (m_proxy.length() > 0)
+  {
+    g_curlInterface.easy_setopt(h, CURLOPT_PROXY, m_proxy.c_str());
+    if (m_proxyuserpass.length() > 0)
+      g_curlInterface.easy_setopt(h, CURLOPT_PROXYUSERPWD, m_proxyuserpass.c_str());
+
+  }
+  if (m_customrequest.length() > 0)
+    g_curlInterface.easy_setopt(h, CURLOPT_CUSTOMREQUEST, m_customrequest.c_str());
+
+  if (m_connecttimeout == 0)
+    m_connecttimeout = g_advancedSettings.m_curlconnecttimeout;
+
+  // set our timeouts, we abort connection after m_timeout, and reads after no data for m_timeout seconds
+  g_curlInterface.easy_setopt(h, CURLOPT_CONNECTTIMEOUT, m_connecttimeout);
+
+  // We abort in case we transfer less than 1byte/second
+  g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_LIMIT, 1);
+
+  if (m_lowspeedtime == 0)
+    m_lowspeedtime = g_advancedSettings.m_curllowspeedtime;
+
+  // Set the lowspeed time very low as it seems Curl takes much longer to detect a lowspeed condition
+  g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_TIME, m_lowspeedtime);
+}
+
+void CCurlFile::SetRequestHeaders(CReadState* state)
+{
+  if(m_curlHeaderList)
+  {
+    g_curlInterface.slist_free_all(m_curlHeaderList);
+    m_curlHeaderList = NULL;
+  }
+
+  MAPHTTPHEADERS::iterator it;
+  for(it = m_requestheaders.begin(); it != m_requestheaders.end(); it++)
+  {
+    CStdString buffer = it->first + ": " + it->second;
+    m_curlHeaderList = g_curlInterface.slist_append(m_curlHeaderList, buffer.c_str());
+  }
+
+  // add user defined headers
+  if (m_curlHeaderList && state->m_easyHandle)
+    g_curlInterface.easy_setopt(state->m_easyHandle, CURLOPT_HTTPHEADER, m_curlHeaderList);
+
+}
+
+void CCurlFile::SetCorrectHeaders(CReadState* state)
+{
+  CHttpHeader& h = state->m_httpheader;
+  /* workaround for shoutcast server wich doesn't set content type on standard mp3 */
+  if( h.GetMimeType().IsEmpty() )
+  {
+    if( !h.GetValue("icy-notice1").IsEmpty()
+    || !h.GetValue("icy-name").IsEmpty()
+    || !h.GetValue("icy-br").IsEmpty() )
+    h.Parse("Content-Type: audio/mpeg\r\n");
+  }
+
+  /* hack for google video */
+  if ( h.GetMimeType().Equals("text/html")
+  &&  !h.GetValue("Content-Disposition").IsEmpty() )
+  {
+    CStdString strValue = h.GetValue("Content-Disposition");
+    if (strValue.Find("filename=") > -1 && strValue.Find(".flv") > -1)
+      h.Parse("Content-Type: video/flv\r\n");
+  }
+}
+
+void CCurlFile::ParseAndCorrectUrl(CURL &url2)
+{
+  CStdString strProtocol = url2.GetTranslatedProtocol();
+  url2.SetProtocol(strProtocol);
+
+  if( strProtocol.Equals("ftp")
+  ||  strProtocol.Equals("ftps") )
+  {
+    /* this is uggly, depending on from where   */
+    /* we get the link it may or may not be     */
+    /* url encoded. if handed from ftpdirectory */
+    /* it won't be so let's handle that case    */
+
+    CStdString partial, filename(url2.GetFileName());
+    CStdStringArray array;
+
+    /* our current client doesn't support utf8 */
+    g_charsetConverter.utf8ToStringCharset(filename);
+
+    /* TODO: create a tokenizer that doesn't skip empty's */
+    CUtil::Tokenize(filename, array, "/");
+    filename.Empty();
+    for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
+    {
+      if(it != array.begin())
+        filename += "/";
+
+      partial = *it;
+      CURL::Encode(partial);
+      filename += partial;
+    }
+
+    /* make sure we keep slashes */
+    if(url2.GetFileName().Right(1) == "/")
+      filename += "/";
+
+    url2.SetFileName(filename);
+
+    CStdString options = url2.GetOptions().Mid(1);
+    options.TrimRight('/'); // hack for trailing slashes being added from source
+
+    m_ftpauth = "";
+    m_ftpport = "";
+    m_ftppasvip = false;
+
+    /* parse options given */
+    CUtil::Tokenize(options, array, "&");
+    for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
+    {
+      CStdString name, value;
+      int pos = it->Find('=');
+      if(pos >= 0)
+      {
+        name = it->Left(pos);
+        value = it->Mid(pos+1, it->size());
+      }
+      else
+      {
+        name = (*it);
+        value = "";
+      }
+
+      if(name.Equals("auth"))
+      {
+        m_ftpauth = value;
+        if(m_ftpauth.IsEmpty())
+          m_ftpauth = "any";
+      }
+      else if(name.Equals("active"))
+      {
+        m_ftpport = value;
+        if(value.IsEmpty())
+          m_ftpport = "-";
+      }
+      else if(name.Equals("pasvip"))
+      {
+        if(value == "0")
+          m_ftppasvip = false;
+        else
+          m_ftppasvip = true;
+      }
+    }
+
+    /* ftp has no options */
+    url2.SetOptions("");
+  }
+  else if( strProtocol.Equals("http")
+       ||  strProtocol.Equals("https"))
+  {
+    if (g_guiSettings.GetBool("network.usehttpproxy") && m_proxy.IsEmpty())
+    {
+      m_proxy = "http://" + g_guiSettings.GetString("network.httpproxyserver");
+      m_proxy += ":" + g_guiSettings.GetString("network.httpproxyport");
+      if (g_guiSettings.GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
+      {
+        m_proxyuserpass = g_guiSettings.GetString("network.httpproxyusername");
+        m_proxyuserpass += ":" + g_guiSettings.GetString("network.httpproxypassword");
+      }
+      CLog::Log(LOGDEBUG, "Using proxy %s", m_proxy.c_str());
+    }
+
+    // get username and password
+    m_username = url2.GetUserName();
+    m_password = url2.GetPassWord();
+
+    // handle any protocol options
+    CStdString options = url2.GetProtocolOptions();
+    options.TrimRight('/'); // hack for trailing slashes being added from source
+    if (options.length() > 0)
+    {
+      // clear protocol options
+      url2.SetProtocolOptions("");
+      // set xbmc headers
+      CStdStringArray array;
+      CUtil::Tokenize(options, array, "&");
+      for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
+      {
+        // parse name, value
+        CStdString name, value;
+        int pos = it->Find('=');
+        if(pos >= 0)
+        {
+          name = it->Left(pos);
+          value = it->Mid(pos+1, it->size());
+        }
+        else
+        {
+          name = (*it);
+          value = "";
+        }
+
+        // url decode value
+        CURL::Decode(value);
+
+        if(name.Equals("auth"))
+        {
+          m_httpauth = value;
+          if(m_httpauth.IsEmpty())
+            m_httpauth = "any";
+        }
+        else if (name.Equals("Referer"))
+          SetReferer(value);
+        else if (name.Equals("User-Agent"))
+          SetUserAgent(value);
+        else if (name.Equals("Cookie"))
+          SetCookie(value);
+        else if (name.Equals("Encoding"))
+          SetContentEncoding(value);
+        else if (name.Equals("noshout") && value.Equals("true"))
+          m_skipshout = true;
+        else
+          SetRequestHeader(name, value);
+      }
+    }
+  }
+
+  if (m_username.length() > 0 && m_password.length() > 0)
+    m_url = url2.GetWithoutUserDetails();
+  else
+    m_url = url2.Get();
+}
+
+bool CCurlFile::Post(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML)
+{
+  return Service(strURL, strPostData, strHTML);
+}
+
+bool CCurlFile::Get(const CStdString& strURL, CStdString& strHTML)
+{
+  return Service(strURL, "", strHTML);
+}
+
+bool CCurlFile::Service(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML)
+{
+  m_postdata = strPostData;
+  if (Open(strURL))
+  {
+    if (ReadData(strHTML))
+    {
+      Close();
+      return true;
+    }
+  }
+  Close();
+  return false;
+}
+
+bool CCurlFile::ReadData(CStdString& strHTML)
+{
+  int size_read = 0;
+  int data_size = 0;
+  strHTML = "";
+  char buffer[16384];
+  while( (size_read = Read(buffer, sizeof(buffer)-1) ) > 0 )
+  {
+    buffer[size_read] = 0;
+    strHTML.append(buffer, size_read);
+    data_size += size_read;
+  }
+  if (m_state->m_cancelled)
+    return false;
+  return true;
+}
+
+bool CCurlFile::Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize)
+{
+  CLog::Log(LOGINFO, "Download: %s->%s", strURL.c_str(), strFileName.c_str());
+
+  CStdString strData;
+  if (!Get(strURL, strData))
+    return false;
+
+  XFILE::CFile file;
+  if (!file.OpenForWrite(strFileName, true))
+  {
+    CLog::Log(LOGERROR, "Unable to open file %s: %u",
+    strFileName.c_str(), GetLastError());
+    return false;
+  }
+  if (strData.size())
+    file.Write(strData.c_str(), strData.size());
+  file.Close();
+
+  if (pdwSize != NULL)
+  {
+    *pdwSize = strData.size();
+  }
+
+  return true;
+}
+
+// Detect whether we are "online" or not! Very simple and dirty!
+bool CCurlFile::IsInternet(bool checkDNS /* = true */)
+{
+  CStdString strURL = "http://www.google.com";
+  if (!checkDNS)
+    strURL = "http://74.125.19.103"; // www.google.com ip
+
+  bool found = Exists(strURL);
+  Close();
+
+  return found;
+}
+
+void CCurlFile::Cancel()
+{
+  m_state->m_cancelled = true;
+  while (m_opened)
+    Sleep(1);
+}
+
+void CCurlFile::Reset()
+{
+  m_state->m_cancelled = false;
+}
+
+bool CCurlFile::Open(const CURL& url)
+{
+
+  m_opened = true;
+
+  CURL url2(url);
+  ParseAndCorrectUrl(url2);
+
+  CLog::Log(LOGDEBUG, "CurlFile::Open(%p) %s", (void*)this, m_url.c_str());
+
+  ASSERT(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle));
+  if( m_state->m_easyHandle == NULL )
+    g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, &m_state->m_multiHandle );
+
+  // setup common curl options
+  SetCommonOptions(m_state);
+  SetRequestHeaders(m_state);
+
+  long response = m_state->Connect(m_bufferSize);
+  if( response < 0 || response >= 400)
+    return false;
+
+  SetCorrectHeaders(m_state);
+
+  // since we can't know the stream size up front if we're gzipped/deflated
+  // flag the stream with an unknown file size rather than the compressed
+  // file size.
+  if (m_contentencoding.size() > 0)
+    m_state->m_fileSize = 0;
+
+  // check if this stream is a shoutcast stream. sometimes checking the protocol line is not enough so examine other headers as well.
+  // shoutcast streams should be handled by FileShoutcast.
+  if ((m_state->m_httpheader.GetProtoLine().Left(3) == "ICY" || !m_state->m_httpheader.GetValue("icy-notice1").IsEmpty()
+     || !m_state->m_httpheader.GetValue("icy-name").IsEmpty()
+     || !m_state->m_httpheader.GetValue("icy-br").IsEmpty()) && !m_skipshout)
+  {
+    CLog::Log(LOGDEBUG,"CurlFile - file <%s> is a shoutcast stream. re-opening", m_url.c_str());
+    throw new CRedirectException(new CShoutcastFile);
+  }
+
+  m_multisession = false;
+  if(m_url.Left(5).Equals("http:") || m_url.Left(6).Equals("https:"))
+  {
+    m_multisession = true;
+    if(m_state->m_httpheader.GetValue("Server").Find("Portable SDK for UPnP devices") >= 0)
+    {
+      CLog::Log(LOGWARNING, "CurlFile - disabling multi session due to broken libupnp server");
+      m_multisession = false;
+    }
+  }
+
+  if(m_state->m_httpheader.GetValue("Transfer-Encoding").Equals("chunked"))
+    m_state->m_fileSize = 0;
+
+  m_seekable = false;
+  if(m_state->m_fileSize > 0)
+  {
+    m_seekable = true;
+
+    if(url2.GetProtocol().Equals("http")
+    || url2.GetProtocol().Equals("https"))
+    {
+      // if server says explicitly it can't seek, respect that
+      if(m_state->m_httpheader.GetValue("Accept-Ranges").Equals("none"))
+        m_seekable = false;
+    }
+  }
+
+  char* efurl;
+  if (CURLE_OK == g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_EFFECTIVE_URL,&efurl) && efurl)
+    m_url = efurl;
+
+  return true;
+}
+
+bool CCurlFile::CReadState::ReadString(char *szLine, int iLineLength)
+{
+  unsigned int want = (unsigned int)iLineLength;
+
+  if((m_fileSize == 0 || m_filePos < m_fileSize) && !FillBuffer(want))
+    return false;
+
+  // ensure only available data is considered
+  want = XMIN((unsigned int)m_buffer.getMaxReadSize(), want);
+
+  /* check if we finished prematurely */
+  if (!m_stillRunning && (m_fileSize == 0 || m_filePos != m_fileSize) && !want)
+  {
+    if (m_fileSize != 0)
+      CLog::Log(LOGWARNING, "%s - Transfer ended before entire file was retrieved pos %"PRId64", size %"PRId64, __FUNCTION__, m_filePos, m_fileSize);
+
+    return false;
+  }
+
+  char* pLine = szLine;
+  do
+  {
+    if (!m_buffer.ReadData(pLine, 1))
+      break;
+
+    pLine++;
+  } while (((pLine - 1)[0] != '\n') && ((unsigned int)(pLine - szLine) < want));
+  pLine[0] = 0;
+  m_filePos += (pLine - szLine);
+  return (bool)((pLine - szLine) > 0);
+}
+
+bool CCurlFile::Exists(const CURL& url)
+{
+  // if file is already running, get info from it
+  if( m_opened )
+  {
+    CLog::Log(LOGWARNING, "%s - Exist called on open file", __FUNCTION__);
+    return true;
+  }
+
+  CURL url2(url);
+  ParseAndCorrectUrl(url2);
+
+  ASSERT(m_state->m_easyHandle == NULL);
+  g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, NULL);
+
+  SetCommonOptions(m_state);
+  SetRequestHeaders(m_state);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_NOBODY, 1);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
+
+  if(url2.GetProtocol() == "ftp")
+  {
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+  }
+
+  CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
+  g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
+
+  if (result == CURLE_WRITE_ERROR || result == CURLE_OK)
+    return true;
+
+  errno = ENOENT;
+  return false;
+}
+
+int64_t CCurlFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  int64_t nextPos = m_state->m_filePos;
+  switch(iWhence)
+  {
+    case SEEK_SET:
+      nextPos = iFilePosition;
+      break;
+    case SEEK_CUR:
+      nextPos += iFilePosition;
+      break;
+    case SEEK_END:
+      if (m_state->m_fileSize)
+        nextPos = m_state->m_fileSize + iFilePosition;
+      else
+        return -1;
+      break;
+    default:
+      return -1;
+  }
+
+  // We can't seek beyond EOF
+  if (m_state->m_fileSize && nextPos > m_state->m_fileSize) return -1;
+
+  if(m_state->Seek(nextPos))
+    return nextPos;
+
+  if(!m_seekable)
+    return -1;
+
+  CReadState* oldstate = NULL;
+  if(m_multisession)
+  {
+    CURL url(m_url);
+    oldstate = m_state;
+    m_state = new CReadState();
+
+    g_curlInterface.easy_aquire(url.GetProtocol(), url.GetHostName(), &m_state->m_easyHandle, &m_state->m_multiHandle );
+
+    // setup common curl options
+    SetCommonOptions(m_state);
+  }
+  else
+    m_state->Disconnect();
+
+  /* caller might have changed some headers (needed for daap)*/
+  SetRequestHeaders(m_state);
+
+  m_state->m_filePos = nextPos;
+  if (oldstate)
+    m_state->m_fileSize = oldstate->m_fileSize;
+
+  long response = m_state->Connect(m_bufferSize);
+  if(response < 0 && (m_state->m_fileSize == 0 || m_state->m_fileSize != m_state->m_filePos))
+  {
+    m_seekable = false;
+    if(oldstate)
+    {
+      delete m_state;
+      m_state = oldstate;
+    }
+    return -1;
+  }
+
+  SetCorrectHeaders(m_state);
+  delete oldstate;
+
+  return m_state->m_filePos;
+}
+
+int64_t CCurlFile::GetLength()
+{
+  if (!m_opened) return 0;
+  return m_state->m_fileSize;
+}
+
+int64_t CCurlFile::GetPosition()
+{
+  if (!m_opened) return 0;
+  return m_state->m_filePos;
+}
+
+int CCurlFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  // if file is already running, get info from it
+  if( m_opened )
+  {
+    CLog::Log(LOGWARNING, "%s - Stat called on open file", __FUNCTION__);
+    if (buffer)
+    {
+      memset(buffer, 0, sizeof(struct __stat64));
+      buffer->st_size = GetLength();
+      buffer->st_mode = _S_IFREG;
+    }
+    return 0;
+  }
+
+  CURL url2(url);
+  ParseAndCorrectUrl(url2);
+
+  ASSERT(m_state->m_easyHandle == NULL);
+  g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, NULL);
+
+  SetCommonOptions(m_state);
+  SetRequestHeaders(m_state);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_NOBODY, 1);
+  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
+
+  if(url2.GetProtocol() == "ftp")
+  {
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+  }
+
+  CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
+
+
+  if(result == CURLE_HTTP_RETURNED_ERROR)
+  {
+    long code;
+    if(g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_RESPONSE_CODE, &code) == CURLE_OK && code == 404 )
+      return -1;
+  }
+
+  if(result == CURLE_GOT_NOTHING 
+  || result == CURLE_HTTP_RETURNED_ERROR 
+  || result == CURLE_RECV_ERROR /* some silly shoutcast servers */ )
+  {
+    /* some http servers and shoutcast servers don't give us any data on a head request */
+    /* request normal and just fail out, it's their loss */
+    /* somehow curl doesn't reset CURLOPT_NOBODY properly so reset everything */
+    SetCommonOptions(m_state);
+    SetRequestHeaders(m_state);
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_RANGE, "0-0");
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
+    result = g_curlInterface.easy_perform(m_state->m_easyHandle);
+  }
+
+  if( result == CURLE_HTTP_RANGE_ERROR )
+  {
+    /* crap can't use the range option, disable it and try again */
+    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_RANGE, NULL);
+    result = g_curlInterface.easy_perform(m_state->m_easyHandle);
+  }
+
+  if( result != CURLE_WRITE_ERROR && result != CURLE_OK )
+  {
+    g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
+    errno = ENOENT;
+    return -1;
+  }
+
+  double length;
+  if (CURLE_OK != g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &length) || length < 0.0)
+  {
+    if (url.GetProtocol() == "ftp")
+    {
+      g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
+      errno = ENOENT;
+      return -1;
+    }
+    else
+      length = 0.0;
+  }
+
+  SetCorrectHeaders(m_state);
+
+  if(buffer)
+  {
+    char *content;
+    if (CURLE_OK != g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_CONTENT_TYPE, &content))
+    {
+      g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
+      errno = ENOENT;
+      return -1;
+    }
+    else
+    {
+      memset(buffer, 0, sizeof(struct __stat64));
+      buffer->st_size = (int64_t)length;
+      if(content && strstr(content, "text/html")) //consider html files directories
+        buffer->st_mode = _S_IFDIR;
+      else
+        buffer->st_mode = _S_IFREG;
+    }
+  }
+  g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
+  return 0;
+}
+
+unsigned int CCurlFile::CReadState::Read(void* lpBuf, int64_t uiBufSize)
+{
+  /* only request 1 byte, for truncated reads (only if not eof) */
+  if((m_fileSize == 0 || m_filePos < m_fileSize) && !FillBuffer(1))
+    return 0;
+
+  /* ensure only available data is considered */
+  unsigned int want = (unsigned int)XMIN(m_buffer.getMaxReadSize(), uiBufSize);
+
+  /* xfer data to caller */
+  if (m_buffer.ReadData((char *)lpBuf, want))
+  {
+    m_filePos += want;
+    return want;
+  }
+
+  /* check if we finished prematurely */
+  if (!m_stillRunning && (m_fileSize == 0 || m_filePos != m_fileSize))
+  {
+    CLog::Log(LOGWARNING, "%s - Transfer ended before entire file was retrieved pos %"PRId64", size %"PRId64, __FUNCTION__, m_filePos, m_fileSize);
+    return 0;
+  }
+
+  return 0;
+}
+
+/* use to attempt to fill the read buffer up to requested number of bytes */
+bool CCurlFile::CReadState::FillBuffer(unsigned int want)
+{
+  int retry=0;
+  fd_set fdread;
+  fd_set fdwrite;
+  fd_set fdexcep;
+
+  // only attempt to fill buffer if transactions still running and buffer
+  // doesnt exceed required size already
+  while ((unsigned int)m_buffer.getMaxReadSize() < want && m_buffer.getMaxWriteSize() > 0 )
+  {
+    if (m_cancelled)
+      return false;
+
+    /* if there is data in overflow buffer, try to use that first */
+    if (m_overflowSize)
+    {
+      unsigned amount = XMIN((unsigned int)m_buffer.getMaxWriteSize(), m_overflowSize);
+      m_buffer.WriteData(m_overflowBuffer, amount);
+
+      if (amount < m_overflowSize)
+        memcpy(m_overflowBuffer, m_overflowBuffer+amount,m_overflowSize-amount);
+
+      m_overflowSize -= amount;
+      m_overflowBuffer = (char*)realloc_simple(m_overflowBuffer, m_overflowSize);
+      continue;
+    }
+
+    CURLMcode result = g_curlInterface.multi_perform(m_multiHandle, &m_stillRunning);
+    if (!m_stillRunning)
+    {
+      if (result == CURLM_OK)
+      {
+        /* if we still have stuff in buffer, we are fine */
+        if (m_buffer.getMaxReadSize())
+          return true;
+
+        /* verify that we are actually okey */
+        int msgs;
+        CURLcode CURLresult = CURLE_OK;
+        CURLMsg* msg;
+        while ((msg = g_curlInterface.multi_info_read(m_multiHandle, &msgs)))
+        {
+          if (msg->msg == CURLMSG_DONE)
+          {
+            if (msg->data.result == CURLE_OK)
+              return true;
+
+            CLog::Log(LOGWARNING, "%s: curl failed with code %i", __FUNCTION__, msg->data.result);
+
+            // We need to check the data.result here as we don't want to retry on every error
+            if ( (msg->data.result == CURLE_OPERATION_TIMEDOUT ||
+                  msg->data.result == CURLE_PARTIAL_FILE       ||
+                  msg->data.result == CURLE_RECV_ERROR)        &&
+                  !m_bFirstLoop)
+              CURLresult=msg->data.result;
+            else
+              return false;
+          }
+        }
+
+        // Don't retry, when we didn't "see" any error
+        if (CURLresult == CURLE_OK)
+          return false;
+
+        // Close handle
+        if (m_multiHandle && m_easyHandle)
+          g_curlInterface.multi_remove_handle(m_multiHandle, m_easyHandle);
+
+        // Reset all the stuff like we would in Disconnect()
+        m_buffer.Clear();
+        free(m_overflowBuffer);
+        m_overflowBuffer = NULL;
+        m_overflowSize = 0;
+
+        // If we got here something is wrong
+        if (++retry > g_advancedSettings.m_curlretries)
+        {
+          CLog::Log(LOGWARNING, "%s: Reconnect failed!", __FUNCTION__);
+          // Reset the rest of the variables like we would in Disconnect()
+          m_filePos = 0;
+          m_fileSize = 0;
+          m_bufferSize = 0;
+
+          return false;
+        }
+
+        CLog::Log(LOGDEBUG, "%s: Reconnect, (re)try %i", __FUNCTION__, retry);
+
+        // Connect + seek to current position (again)
+        g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
+        g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
+
+        // Return to the beginning of the loop:
+        continue;
+      }
+      return false;
+    }
+
+    // We've finished out first loop
+    if(m_bFirstLoop && m_buffer.getMaxReadSize() > 0)
+      m_bFirstLoop = false;
+
+    switch (result)
+    {
+      case CURLM_OK:
+      {
+        int maxfd = -1;
+        FD_ZERO(&fdread);
+        FD_ZERO(&fdwrite);
+        FD_ZERO(&fdexcep);
+
+        // get file descriptors from the transfers
+        g_curlInterface.multi_fdset(m_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
+
+        long timeout = 0;
+        if (CURLM_OK != g_curlInterface.multi_timeout(m_multiHandle, &timeout) || timeout == -1)
+          timeout = 200;
+
+        struct timeval t = { timeout / 1000, (timeout % 1000) * 1000 };
+
+        /* Wait until data is available or a timeout occurs.
+           We call dllselect(maxfd + 1, ...), specially in case of (maxfd == -1),
+           we call dllselect(0, ...), which is basically equal to sleep. */
+        if (SOCKET_ERROR == dllselect(maxfd + 1, &fdread, &fdwrite, &fdexcep, &t))
+        {
+          CLog::Log(LOGERROR, "%s - curl failed with socket error", __FUNCTION__);
+          return false;
+        }
+      }
+      break;
+      case CURLM_CALL_MULTI_PERFORM:
+      {
+        // we don't keep calling here as that can easily overwrite our buffer which we want to avoid
+        // docs says we should call it soon after, but aslong as we are reading data somewhere
+        // this aught to be soon enough. should stay in socket otherwise
+        continue;
+      }
+      break;
+      default:
+      {
+        CLog::Log(LOGERROR, "%s - curl multi perform failed with code %d, aborting", __FUNCTION__, result);
+        return false;
+      }
+      break;
+    }
+  }
+  return true;
+}
+
+void CCurlFile::ClearRequestHeaders()
+{
+  m_requestheaders.clear();
+}
+
+void CCurlFile::SetRequestHeader(CStdString header, CStdString value)
+{
+  m_requestheaders[header] = value;
+}
+
+void CCurlFile::SetRequestHeader(CStdString header, long value)
+{
+  CStdString buffer;
+  buffer.Format("%ld", value);
+  m_requestheaders[header] = buffer;
+}
+
+/* STATIC FUNCTIONS */
+bool CCurlFile::GetHttpHeader(const CURL &url, CHttpHeader &headers)
+{
+  try
+  {
+    CCurlFile file;
+    if(file.Stat(url, NULL) == 0)
+    {
+      headers = file.GetHttpHeader();
+      return true;
+    }
+    return false;
+  }
+  catch(...)
+  {
+    CLog::Log(LOGERROR, "%s - Exception thrown while trying to retrieve header url: %s", __FUNCTION__, url.Get().c_str());
+    return false;
+  }
+}
+
+bool CCurlFile::GetMimeType(const CURL &url, CStdString &content, CStdString useragent)
+{
+  CCurlFile file;
+  if (!useragent.IsEmpty())
+    file.SetUserAgent(useragent);
+
+  struct __stat64 buffer;
+  if( file.Stat(url, &buffer) == 0 )
+  {
+    if (buffer.st_mode == _S_IFDIR)
+      content = "x-directory/normal";
+    else
+      content = file.GetMimeType();
+    CLog::Log(LOGDEBUG, "CCurlFile::GetMimeType - %s -> %s", url.Get().c_str(), content.c_str());
+    return true;
+  }
+  CLog::Log(LOGDEBUG, "CCurlFile::GetMimeType - %s -> failed", url.Get().c_str());
+  content = "";
+  return false;
+}
+
+int CCurlFile::IoControl(EIoControl request, void* param)
+{
+  if(request == IOCTRL_SEEK_POSSIBLE)
+    return m_seekable ? 1 : 0;
+
+  return -1;
+}
diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h
new file mode 100644 (file)
index 0000000..158e750
--- /dev/null
@@ -0,0 +1,173 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+#include "utils/RingBuffer.h"
+#include <map>
+#include "utils/HttpHeader.h"
+
+namespace XCURL
+{
+  typedef void CURL_HANDLE;
+  typedef void CURLM;
+  struct curl_slist;
+}
+
+class CHttpHeader;
+
+namespace XFILE
+{
+  class CCurlFile : public IFile
+  {
+    public:
+      CCurlFile();
+      virtual ~CCurlFile();
+      virtual bool Open(const CURL& url);
+      virtual bool Exists(const CURL& url);
+      virtual int64_t  Seek(int64_t iFilePosition, int iWhence=SEEK_SET);
+      virtual int64_t GetPosition();
+      virtual int64_t  GetLength();
+      virtual int  Stat(const CURL& url, struct __stat64* buffer);
+      virtual void Close();
+      virtual bool ReadString(char *szLine, int iLineLength)     { return m_state->ReadString(szLine, iLineLength); }
+      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize)  { return m_state->Read(lpBuf, uiBufSize); }
+      virtual CStdString GetMimeType()                           { return m_state->m_httpheader.GetMimeType(); }
+      virtual int IoControl(EIoControl request, void* param);
+
+      bool Post(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML);
+      bool Get(const CStdString& strURL, CStdString& strHTML);
+      bool ReadData(CStdString& strHTML);
+      bool Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize = NULL);
+      bool IsInternet(bool checkDNS = true);
+      void Cancel();
+      void Reset();
+      void SetUserAgent(CStdString sUserAgent)                   { m_userAgent = sUserAgent; }
+      void SetProxy(CStdString &proxy)                           { m_proxy = proxy; }
+      void SetProxyUserPass(CStdString &proxyuserpass)           { m_proxyuserpass = proxyuserpass; }
+      void SetCustomRequest(CStdString &request)                 { m_customrequest = request; }
+      void UseOldHttpVersion(bool bUse)                          { m_useOldHttpVersion = bUse; }
+      void SetContentEncoding(CStdString encoding)               { m_contentencoding = encoding; }
+      void SetTimeout(int connecttimeout)                        { m_connecttimeout = connecttimeout; }
+      void SetLowSpeedTime(int lowspeedtime)                     { m_lowspeedtime = lowspeedtime; }
+      void SetPostData(CStdString postdata)                      { m_postdata = postdata; }
+      void SetReferer(CStdString referer)                        { m_referer = referer; }
+      void SetCookie(CStdString cookie)                          { m_cookie = cookie; }
+      void SetMimeType(CStdString mimetype)                      { SetRequestHeader("Content-Type", m_mimetype); }
+      void SetRequestHeader(CStdString header, CStdString value);
+      void SetRequestHeader(CStdString header, long value);
+
+      void ClearRequestHeaders();
+      void SetBufferSize(unsigned int size);
+
+      const CHttpHeader& GetHttpHeader() { return m_state->m_httpheader; }
+
+      /* static function that will get content type of a file */
+      static bool GetHttpHeader(const CURL &url, CHttpHeader &headers);
+      static bool GetMimeType(const CURL &url, CStdString &content, CStdString useragent="");
+
+      class CReadState
+      {
+      public:
+          CReadState();
+          ~CReadState();
+          XCURL::CURL_HANDLE*    m_easyHandle;
+          XCURL::CURLM*          m_multiHandle;
+
+          CRingBuffer     m_buffer;           // our ringhold buffer
+          unsigned int    m_bufferSize;
+
+          char *          m_overflowBuffer;   // in the rare case we would overflow the above buffer
+          unsigned int    m_overflowSize;     // size of the overflow buffer
+          int             m_stillRunning;     // Is background url fetch still in progress
+          bool            m_cancelled;
+          int64_t         m_fileSize;
+          int64_t         m_filePos;
+          bool            m_bFirstLoop;
+
+          /* returned http header */
+          CHttpHeader m_httpheader;
+          bool        m_headerdone;
+
+          size_t WriteCallback(char *buffer, size_t size, size_t nitems);
+          size_t HeaderCallback(void *ptr, size_t size, size_t nmemb);
+
+          bool         Seek(int64_t pos);
+          unsigned int Read(void* lpBuf, int64_t uiBufSize);
+          bool         ReadString(char *szLine, int iLineLength);
+          bool         FillBuffer(unsigned int want);
+
+          long         Connect(unsigned int size);
+          void         Disconnect();
+      };
+
+    protected:
+      void ParseAndCorrectUrl(CURL &url);
+      void SetCommonOptions(CReadState* state);
+      void SetRequestHeaders(CReadState* state);
+      void SetCorrectHeaders(CReadState* state);
+      bool Service(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML);
+
+    private:
+      CReadState*     m_state;
+      unsigned int    m_bufferSize;
+
+      CStdString      m_url;
+      CStdString      m_userAgent;
+      CStdString      m_proxy;
+      CStdString      m_proxyuserpass;
+      CStdString      m_customrequest;
+      CStdString      m_contentencoding;
+      CStdString      m_ftpauth;
+      CStdString      m_ftpport;
+      CStdString      m_binary;
+      CStdString      m_postdata;
+      CStdString      m_referer;
+      CStdString      m_cookie;
+      CStdString      m_mimetype;
+      CStdString      m_username;
+      CStdString      m_password;
+      CStdString      m_httpauth;
+      bool            m_ftppasvip;
+      int             m_connecttimeout;
+      int             m_lowspeedtime;
+      bool            m_opened;
+      bool            m_useOldHttpVersion;
+      bool            m_seekable;
+      bool            m_multisession;
+      bool            m_skipshout;
+
+      CRingBuffer     m_buffer;           // our ringhold buffer
+      char *          m_overflowBuffer;   // in the rare case we would overflow the above buffer
+      unsigned int    m_overflowSize;     // size of the overflow buffer
+
+      int             m_stillRunning;     // Is background url fetch still in progress?
+
+      struct XCURL::curl_slist* m_curlAliasList;
+      struct XCURL::curl_slist* m_curlHeaderList;
+
+      typedef std::map<CStdString, CStdString> MAPHTTPHEADERS;
+      MAPHTTPHEADERS m_requestheaders;
+  };
+}
+
+
+
index ddb6183..492abcb 100644 (file)
@@ -18,7 +18,7 @@
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include "FileDAAP.h"
+#include "DAAPFile.h"
 #include "DAAPDirectory.h"
 #include "music/tags/MusicInfoTag.h"
 #include "FileItem.h"
diff --git a/xbmc/filesystem/DAAPFile.cpp b/xbmc/filesystem/DAAPFile.cpp
new file mode 100644 (file)
index 0000000..46b2220
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+* DAAP Support for XBMC
+* Copyright (c) 2004 Forza (Chris Barnett)
+* Portions Copyright (c) by the authors of libOpenDAAP
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "DAAPFile.h"
+#include "SectionLoader.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include <sys/stat.h>
+
+#include "lib/libXDAAP/private.h"
+
+using namespace XFILE;
+
+#define HEDAER_VERSION       "Client-DAAP-Version"
+#define HEADER_REQUESTID     "Client-DAAP-Request-ID"
+#define HEADER_VALIDATE      "Client-DAAP-Validation"
+#define HEADER_ACCESS_INDEX  "Client-DAAP-Access-Index"
+#define DAAP_USERAGENT       "iTunes/4.6 (Windows; N)"
+#define DAAP_PORT            3689
+
+extern "C"
+{
+/* prototype of function in LIBXDAAP to generate the has needed for requests */
+void GenerateHash(short version_major,
+                  const unsigned char *url, unsigned char hashSelect,
+                  unsigned char *outhash,
+                  int request_id);
+}
+
+CDaapClient g_DaapClient;
+
+CDaapClient::CDaapClient()
+{
+  m_pClient = NULL;
+  m_Status = DAAP_STATUS_error;
+
+  m_pArtistsHead = NULL;
+  m_iDatabase = 0;
+}
+CDaapClient::~CDaapClient()
+{
+
+}
+void CDaapClient::Release()
+{
+  m_mapHosts.clear();
+
+  if( m_pClient )
+  {
+    try
+    {
+      while( DAAP_Client_Release(m_pClient) != 0 ) {}
+    }
+    catch(...)
+    {
+      CLog::Log(LOGINFO, "CDaapClient::Disconnect - Unexpected exception");
+    }
+
+    m_pClient = NULL;
+  }
+}
+
+DAAP_SClientHost* CDaapClient::GetHost(const CStdString &strHost)
+{
+  //We need this section from now on
+  if( !CSectionLoader::IsLoaded("LIBXDAAP") ) CSectionLoader::Load("LIBXDAAP");
+  try
+  {
+
+    ITHOST it;
+    it = m_mapHosts.find(strHost);
+    if( it != m_mapHosts.end() )
+      return it->second;
+
+
+    if( !m_pClient )
+      m_pClient = DAAP_Client_Create((DAAP_fnClientStatus)StatusCallback, (void*)this);
+
+    DAAP_SClientHost* pHost = DAAP_Client_AddHost(m_pClient, (char *)strHost.c_str(), (char *)"A", (char *)"A");
+    if( !pHost )
+      throw("Unable to add host");
+
+    if( DAAP_ClientHost_Connect(pHost) != 0 )
+      throw("Unable to connect");
+
+    m_mapHosts[strHost] = pHost;
+
+    return pHost;
+
+  }
+  catch(char* err)
+  {
+    CLog::Log(LOGERROR, "CDaapClient::GetHost(%s) - %s", strHost.c_str(), err );
+    return NULL;
+  }
+  catch(...)
+  {
+    CLog::Log(LOGERROR, "CDaapClient::GetHost(%s) - Unknown Exception", strHost.c_str());
+    return NULL;
+  }
+
+}
+
+void CDaapClient::StatusCallback(DAAP_SClient *pClient, DAAP_Status status, int value, void* pContext)
+{
+  ((CDaapClient*)pContext)->m_Status = status;
+  switch(status)
+  {
+    case DAAP_STATUS_connecting:
+      CLog::Log(LOGINFO, "CDaapClient::Callback - Connecting");
+    case DAAP_STATUS_downloading:
+      CLog::Log(LOGINFO, "CDaapClient::Callback - Downlading");
+    case DAAP_STATUS_idle:
+      CLog::Log(LOGINFO, "CDaapClient::Callback - Idle");
+    default:
+      CLog::Log(LOGINFO, "CDaapClient::Callback - Status %d", status);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CDAAPFile::CDAAPFile()
+{
+  m_thisHost = NULL;
+  m_thisClient = NULL;
+
+  m_bOpened = false;
+}
+
+CDAAPFile::~CDAAPFile()
+{
+  Close();
+}
+
+
+
+//*********************************************************************************************
+bool CDAAPFile::Open(const CURL& url)
+{
+  CSingleLock lock(g_DaapClient);
+
+  if (m_bOpened) Close();
+
+  m_url = url;
+
+  CLog::Log(LOGDEBUG, "CDAAPFile::Open(%s)", url.GetFileName().c_str());
+  CStdString host = url.GetHostName();
+  if (url.HasPort())
+    host.Format("%s:%i",url.GetHostName(),url.GetPort());
+  m_thisHost = g_DaapClient.GetHost(host);
+  if (!m_thisHost)
+    return false;
+
+  /* get us a new request id */
+  int requestid = ++m_thisHost->request_id;
+
+  m_hashurl = "/" + m_url.GetFileName();
+  m_hashurl += m_url.GetOptions();
+
+  char hash[33] = {0};
+  GenerateHash(m_thisHost->version_major, (unsigned char*)(m_hashurl.c_str()), 2, (unsigned char*)hash, requestid);
+
+  m_curl.SetUserAgent(DAAP_USERAGENT);
+
+  //m_curl.SetRequestHeader(HEADER_VERSION, "3.0");
+  m_curl.SetRequestHeader(HEADER_REQUESTID, requestid);
+  m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash));
+  m_curl.SetRequestHeader(HEADER_ACCESS_INDEX, 2);
+
+  m_url.SetProtocol("http");
+  if(!m_url.HasPort())
+    m_url.SetPort(DAAP_PORT);
+
+
+  m_bOpened = true;
+
+  return m_curl.Open(m_url);
+}
+
+
+//*********************************************************************************************
+unsigned int CDAAPFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  return m_curl.Read(lpBuf, uiBufSize);
+}
+
+//*********************************************************************************************
+void CDAAPFile::Close()
+{
+  m_curl.Close();
+  m_bOpened = false;
+}
+
+//*********************************************************************************************
+int64_t CDAAPFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  CSingleLock lock(g_DaapClient);
+
+  int requestid = ++m_thisHost->request_id;
+
+  char hash[33] = {0};
+  GenerateHash(m_thisHost->version_major, (unsigned char*)(m_hashurl.c_str()), 2, (unsigned char*)hash, requestid);
+
+  m_curl.SetRequestHeader(HEADER_REQUESTID, requestid);
+  m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash));
+
+  return m_curl.Seek(iFilePosition, iWhence);
+}
+
+//*********************************************************************************************
+int64_t CDAAPFile::GetLength()
+{
+  return m_curl.GetLength();
+}
+
+//*********************************************************************************************
+int64_t CDAAPFile::GetPosition()
+{
+  return m_curl.GetPosition();
+}
+
+bool CDAAPFile::Exists(const CURL& url)
+{
+  return false;
+}
+
+int CDAAPFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  return -1;
+}
+
+int CDAAPFile::IoControl(EIoControl request, void* param)
+{
+  if(request == IOCTRL_SEEK_POSSIBLE)
+    return 1;
+
+  return -1;
+}
diff --git a/xbmc/filesystem/DAAPFile.h b/xbmc/filesystem/DAAPFile.h
new file mode 100644 (file)
index 0000000..e347bbe
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+* DAAP Support for XBMC
+* Copyright (c) 2004 Forza (Chris Barnett)
+* Portions Copyright (c) by the authors of libOpenDAAP
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+// FileDAAP.h: interface for the CDAAPFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILEDAAP_H___INCLUDED_)
+#define AFX_FILEDAAP_H___INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "lib/libXDAAP/client.h"
+#include "CurlFile.h"
+#include "URL.h"
+#include "threads/CriticalSection.h"
+
+class CDaapClient : public CCriticalSection
+{
+public:
+
+  CDaapClient();
+  ~CDaapClient();
+
+  DAAP_SClient *m_pClient;
+  DAAP_SClientHost* GetHost(const CStdString &srtHost);
+  std::map<CStdString, DAAP_SClientHost*> m_mapHosts;
+  typedef std::map<CStdString, DAAP_SClientHost*>::iterator ITHOST;
+
+  DAAP_Status m_Status;
+
+  //Buffers
+  int m_iDatabase;
+  void *m_pArtistsHead;
+
+  void Release();
+
+protected:
+  static void StatusCallback(DAAP_SClient *pClient, DAAP_Status status, int value, void* pContext);
+};
+
+extern CDaapClient g_DaapClient;
+
+
+#include "IFile.h"
+
+namespace XFILE
+{
+class CDAAPFile : public IFile
+{
+public:
+  CDAAPFile();
+  virtual ~CDAAPFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual int  IoControl(EIoControl request, void* param);
+
+protected:
+
+  bool StartStreaming();
+  bool StopStreaming();
+
+  int64_t m_fileSize; //holds full size
+  int64_t m_filePos; //holds current position in file
+
+
+  DAAP_SClient *m_thisClient;
+  DAAP_SClientHost *m_thisHost;
+  DAAP_ClientHost_Song m_song;
+
+  bool m_bOpened;
+
+  CStdString m_hashurl; // the url that should be used in hash calculation
+  CURL       m_url;     // the complete url we have connected too
+  CCurlFile  m_curl;
+};
+}
+
+#endif // !defined(AFX_FILEDAAP_H___INCLUDED_)
+
+
index 9a456c8..94e901c 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "DAVDirectory.h"
 #include "URL.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "FileItem.h"
 #include "utils/RegExp.h"
 #include "utils/StringUtils.h"
index 7510267..b996e75 100644 (file)
  */
 
 #include "Directory.h"
-#include "FactoryDirectory.h"
-#include "FactoryFileDirectory.h"
+#include "DirectoryFactory.h"
+#include "FileDirectoryFactory.h"
 #ifndef _LINUX
 #include "utils/Win32Exception.h"
 #endif
 #include "FileItem.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "settings/GUISettings.h"
 #include "utils/log.h"
 #include "utils/Job.h"
index 84bc32e..c4a60cb 100644 (file)
@@ -19,7 +19,7 @@
  *
  */
 
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "settings/Settings.h"
 #include "FileItem.h"
 #include "threads/SingleLock.h"
@@ -30,7 +30,7 @@
 using namespace std;
 using namespace XFILE;
 
-CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType)
+CCacheDirectory::CDir::CDir(DIR_CACHE_TYPE cacheType)
 {
   m_cacheType = cacheType;
   m_lastAccess = 0;
@@ -38,17 +38,17 @@ CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType)
   m_Items->SetFastLookup(true);
 }
 
-CDirectoryCache::CDir::~CDir()
+CCacheDirectory::CDir::~CDir()
 {
   delete m_Items;
 }
 
-void CDirectoryCache::CDir::SetLastAccess(unsigned int &accessCounter)
+void CCacheDirectory::CDir::SetLastAccess(unsigned int &accessCounter)
 {
   m_lastAccess = accessCounter++;
 }
 
-CDirectoryCache::CDirectoryCache(void)
+CCacheDirectory::CCacheDirectory(void)
 {
   m_iThumbCacheRefCount = 0;
   m_iMusicThumbCacheRefCount = 0;
@@ -59,11 +59,11 @@ CDirectoryCache::CDirectoryCache(void)
 #endif
 }
 
-CDirectoryCache::~CDirectoryCache(void)
+CCacheDirectory::~CCacheDirectory(void)
 {
 }
 
-bool CDirectoryCache::GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll)
+bool CCacheDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll)
 {
   CSingleLock lock (m_cs);
 
@@ -88,7 +88,7 @@ bool CDirectoryCache::GetDirectory(const CStdString& strPath, CFileItemList &ite
   return false;
 }
 
-void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType)
+void CCacheDirectory::SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType)
 {
   if (cacheType == DIR_CACHE_NEVER)
     return; // nothing to do
@@ -98,7 +98,7 @@ void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemLis
   // processing on the items (stacking, transparent rars/zips for instance) that
   // alters the URL of the items.  If we shared the pointers, we'd have problems
   // as the URLs in the cache would have changed, so things such as
-  // CDirectoryCache::FileExists() would fail for files that really do exist (just their
+  // CCacheDirectory::FileExists() would fail for files that really do exist (just their
   // URL's have been altered).  This is called from CFile::Exists() which causes
   // all sorts of hassles.
   // IDEALLY, any further processing on the item would actually create a new item
@@ -119,14 +119,14 @@ void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemLis
   m_cache.insert(pair<CStdString, CDir*>(storedPath, dir));
 }
 
-void CDirectoryCache::ClearFile(const CStdString& strFile)
+void CCacheDirectory::ClearFile(const CStdString& strFile)
 {
   CStdString strPath;
   URIUtils::GetDirectory(strFile, strPath);
   ClearDirectory(strPath);
 }
 
-void CDirectoryCache::ClearDirectory(const CStdString& strPath)
+void CCacheDirectory::ClearDirectory(const CStdString& strPath)
 {
   CSingleLock lock (m_cs);
 
@@ -138,7 +138,7 @@ void CDirectoryCache::ClearDirectory(const CStdString& strPath)
     Delete(i);
 }
 
-void CDirectoryCache::ClearSubPaths(const CStdString& strPath)
+void CCacheDirectory::ClearSubPaths(const CStdString& strPath)
 {
   CSingleLock lock (m_cs);
 
@@ -156,7 +156,7 @@ void CDirectoryCache::ClearSubPaths(const CStdString& strPath)
   }
 }
 
-void CDirectoryCache::AddFile(const CStdString& strFile)
+void CCacheDirectory::AddFile(const CStdString& strFile)
 {
   CSingleLock lock (m_cs);
 
@@ -174,7 +174,7 @@ void CDirectoryCache::AddFile(const CStdString& strFile)
   }
 }
 
-bool CDirectoryCache::FileExists(const CStdString& strFile, bool& bInCache)
+bool CCacheDirectory::FileExists(const CStdString& strFile, bool& bInCache)
 {
   CSingleLock lock (m_cs);
   bInCache = false;
@@ -200,7 +200,7 @@ bool CDirectoryCache::FileExists(const CStdString& strFile, bool& bInCache)
   return false;
 }
 
-void CDirectoryCache::Clear()
+void CCacheDirectory::Clear()
 {
   // this routine clears everything except things we always cache
   CSingleLock lock (m_cs);
@@ -215,7 +215,7 @@ void CDirectoryCache::Clear()
   }
 }
 
-void CDirectoryCache::InitCache(set<CStdString>& dirs)
+void CCacheDirectory::InitCache(set<CStdString>& dirs)
 {
   set<CStdString>::iterator it;
   for (it = dirs.begin(); it != dirs.end(); ++it)
@@ -227,7 +227,7 @@ void CDirectoryCache::InitCache(set<CStdString>& dirs)
   }
 }
 
-void CDirectoryCache::ClearCache(set<CStdString>& dirs)
+void CCacheDirectory::ClearCache(set<CStdString>& dirs)
 {
   iCache i = m_cache.begin();
   while (i != m_cache.end())
@@ -239,7 +239,7 @@ void CDirectoryCache::ClearCache(set<CStdString>& dirs)
   }
 }
 
-bool CDirectoryCache::IsCacheDir(const CStdString &strPath) const
+bool CCacheDirectory::IsCacheDir(const CStdString &strPath) const
 {
   if (m_thumbDirs.find(strPath) == m_thumbDirs.end())
     return false;
@@ -249,7 +249,7 @@ bool CDirectoryCache::IsCacheDir(const CStdString &strPath) const
   return true;
 }
 
-void CDirectoryCache::InitThumbCache()
+void CCacheDirectory::InitThumbCache()
 {
   CSingleLock lock (m_cs);
 
@@ -276,7 +276,7 @@ void CDirectoryCache::InitThumbCache()
   InitCache(m_thumbDirs);
 }
 
-void CDirectoryCache::ClearThumbCache()
+void CCacheDirectory::ClearThumbCache()
 {
   CSingleLock lock (m_cs);
 
@@ -290,7 +290,7 @@ void CDirectoryCache::ClearThumbCache()
   ClearCache(m_thumbDirs);
 }
 
-void CDirectoryCache::InitMusicThumbCache()
+void CCacheDirectory::InitMusicThumbCache()
 {
   CSingleLock lock (m_cs);
 
@@ -317,7 +317,7 @@ void CDirectoryCache::InitMusicThumbCache()
   InitCache(m_musicThumbDirs);
 }
 
-void CDirectoryCache::ClearMusicThumbCache()
+void CCacheDirectory::ClearMusicThumbCache()
 {
   CSingleLock lock (m_cs);
 
@@ -331,7 +331,7 @@ void CDirectoryCache::ClearMusicThumbCache()
   ClearCache(m_musicThumbDirs);
 }
 
-void CDirectoryCache::CheckIfFull()
+void CCacheDirectory::CheckIfFull()
 {
   CSingleLock lock (m_cs);
   static const unsigned int max_cached_dirs = 10;
@@ -353,7 +353,7 @@ void CDirectoryCache::CheckIfFull()
     Delete(lastAccessed);
 }
 
-void CDirectoryCache::Delete(iCache it)
+void CCacheDirectory::Delete(iCache it)
 {
   CDir* dir = it->second;
   delete dir;
@@ -361,7 +361,7 @@ void CDirectoryCache::Delete(iCache it)
 }
 
 #ifdef _DEBUG
-void CDirectoryCache::PrintStats() const
+void CCacheDirectory::PrintStats() const
 {
   CSingleLock lock (m_cs);
   CLog::Log(LOGDEBUG, "%s - total of %u cache hits, and %u cache misses", __FUNCTION__, m_cacheHits, m_cacheMisses);
index 075333f..4efe9c3 100644 (file)
@@ -31,7 +31,7 @@ class CFileItem;
 
 namespace XFILE
 {
-  class CDirectoryCache
+  class CCacheDirectory
   {
     class CDir
     {
@@ -48,8 +48,8 @@ namespace XFILE
       unsigned int m_lastAccess;
     };
   public:
-    CDirectoryCache(void);
-    virtual ~CDirectoryCache(void);
+    CCacheDirectory(void);
+    virtual ~CCacheDirectory(void);
     bool GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll = false);
     void SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType);
     void ClearDirectory(const CStdString& strPath);
@@ -90,4 +90,4 @@ namespace XFILE
 #endif
   };
 }
-extern XFILE::CDirectoryCache g_directoryCache;
+extern XFILE::CCacheDirectory g_directoryCache;
diff --git a/xbmc/filesystem/DirectoryFactory.cpp b/xbmc/filesystem/DirectoryFactory.cpp
new file mode 100644 (file)
index 0000000..d7ba5a5
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#if (defined HAVE_CONFIG_H) && (!defined WIN32)
+  #include "config.h"
+#endif
+#include "system.h"
+#include "DirectoryFactory.h"
+#include "HDDirectory.h"
+#include "SpecialProtocolDirectory.h"
+#include "MultiPathDirectory.h"
+#include "StackDirectory.h"
+#include "FileDirectoryFactory.h"
+#include "PlaylistDirectory.h"
+#include "MusicDatabaseDirectory.h"
+#include "MusicSearchDirectory.h"
+#include "VideoDatabaseDirectory.h"
+#include "AddonsDirectory.h"
+#include "SourcesDirectory.h"
+#include "LastFMDirectory.h"
+#include "FTPDirectory.h"
+#include "HTTPDirectory.h"
+#include "DAVDirectory.h"
+#include "UDFDirectory.h"
+#include "Application.h"
+#include "addons/Addon.h"
+#include "utils/log.h"
+
+#ifdef HAS_FILESYSTEM_SMB
+#ifdef _WIN32
+#include "windows/WINSMBDirectory.h"
+#else
+#include "SMBDirectory.h"
+#endif
+#endif
+#ifdef HAS_FILESYSTEM_CDDA
+#include "CDDADirectory.h"
+#endif
+#include "PluginDirectory.h"
+#ifdef HAS_FILESYSTEM
+#include "ISO9660Directory.h"
+#ifdef HAS_FILESYSTEM_RTV
+#include "RTVDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_DAAP
+#include "DAAPDirectory.h"
+#endif
+#endif
+#ifdef HAS_UPNP
+#include "UPnPDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_SAP
+#include "SAPDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_VTP
+#include "VTPDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_HTSP
+#include "HTSPDirectory.h"
+#endif
+#include "ZipDirectory.h"
+#ifdef HAS_FILESYSTEM_RAR
+#include "RarDirectory.h"
+#endif
+#include "TuxBoxDirectory.h"
+#include "HDHomeRunDirectory.h"
+#include "SlingboxDirectory.h"
+#include "MythDirectory.h"
+#include "FileItem.h"
+#include "URL.h"
+#include "RSSDirectory.h"
+#ifdef HAS_ZEROCONF
+#include "ZeroconfDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_SFTP
+#include "SFTPDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_NFS
+#include "NFSDirectory.h"
+#endif
+#ifdef HAS_FILESYSTEM_AFP
+#include "AFPDirectory.h"
+#endif
+
+using namespace XFILE;
+
+/*!
+ \brief Create a IDirectory object of the share type specified in \e strPath .
+ \param strPath Specifies the share type to access, can be a share or share with path.
+ \return IDirectory object to access the directories on the share.
+ \sa IDirectory
+ */
+IDirectory* CDirectoryFactory::Create(const CStdString& strPath)
+{
+  CURL url(strPath);
+
+  CFileItem item(strPath, false);
+  IFileDirectory* pDir=CFileDirectoryFactory::Create(strPath, &item);
+  if (pDir)
+    return pDir;
+
+  CStdString strProtocol = url.GetProtocol();
+
+  if (strProtocol.size() == 0 || strProtocol == "file") return new CHDDirectory();
+  if (strProtocol == "special") return new CSpecialProtocolDirectory();
+  if (strProtocol == "sources") return new CSourcesDirectory();
+  if (strProtocol == "addons") return new CAddonsDirectory();
+#if defined(HAS_FILESYSTEM_CDDA) && defined(HAS_DVD_DRIVE)
+  if (strProtocol == "cdda") return new CCDDADirectory();
+#endif
+#ifdef HAS_FILESYSTEM
+  if (strProtocol == "iso9660") return new CISO9660Directory();
+#endif
+  if (strProtocol == "udf") return new CUDFDirectory();
+  if (strProtocol == "plugin") return new CPluginDirectory();
+  if (strProtocol == "zip") return new CZipDirectory();
+#ifdef HAS_FILESYSTEM_RAR
+  if (strProtocol == "rar") return new CRarDirectory();
+#endif
+  if (strProtocol == "multipath") return new CMultiPathDirectory();
+  if (strProtocol == "stack") return new CStackDirectory();
+  if (strProtocol == "playlistmusic") return new CPlaylistDirectory();
+  if (strProtocol == "playlistvideo") return new CPlaylistDirectory();
+  if (strProtocol == "musicdb") return new CMusicDatabaseDirectory();
+  if (strProtocol == "musicsearch") return new CMusicSearchDirectory();
+  if (strProtocol == "videodb") return new CVideoDatabaseDirectory();
+  if (strProtocol == "filereader")
+    return CDirectoryFactory::Create(url.GetFileName());
+
+  if( g_application.getNetwork().IsAvailable(true) )  // true to wait for the network (if possible)
+  {
+    if (strProtocol == "lastfm") return new CLastFMDirectory();
+    if (strProtocol == "tuxbox") return new CTuxBoxDirectory();
+    if (strProtocol == "ftp" ||  strProtocol == "ftpx" ||  strProtocol == "ftps") return new CFTPDirectory();
+    if (strProtocol == "http" || strProtocol == "https") return new CHTTPDirectory();
+    if (strProtocol == "dav" || strProtocol == "davs") return new CDAVDirectory();
+#ifdef HAS_FILESYSTEM_SFTP
+    if (strProtocol == "sftp" || strProtocol == "ssh") return new CSFTPDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_SMB
+#ifdef _WIN32
+    if (strProtocol == "smb") return new CWINSMBDirectory();
+#else
+    if (strProtocol == "smb") return new CSMBDirectory();
+#endif
+#endif
+#ifdef HAS_FILESYSTEM
+#ifdef HAS_FILESYSTEM_DAAP
+    if (strProtocol == "daap") return new CDAAPDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_RTV
+    if (strProtocol == "rtv") return new CRTVDirectory();
+#endif
+#endif
+#ifdef HAS_UPNP
+    if (strProtocol == "upnp") return new CUPnPDirectory();
+#endif
+    if (strProtocol == "hdhomerun") return new CHomeRunDirectory();
+    if (strProtocol == "sling") return new CSlingboxDirectory();
+    if (strProtocol == "myth") return new CMythDirectory();
+    if (strProtocol == "cmyth") return new CMythDirectory();
+    if (strProtocol == "rss") return new CRSSDirectory();
+#ifdef HAS_FILESYSTEM_SAP
+    if (strProtocol == "sap") return new CSAPDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_VTP
+    if (strProtocol == "vtp") return new CVTPDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_HTSP
+    if (strProtocol == "htsp") return new CHTSPDirectory();
+#endif
+#ifdef HAS_ZEROCONF
+    if (strProtocol == "zeroconf") return new CZeroconfDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_NFS
+    if (strProtocol == "nfs") return new CNFSDirectory();
+#endif
+#ifdef HAS_FILESYSTEM_AFP
+      if (strProtocol == "afp") return new CAFPDirectory();
+#endif
+  }
+
+  CLog::Log(LOGWARNING, "%s - Unsupported protocol(%s) in %s", __FUNCTION__, strProtocol.c_str(), url.Get().c_str() );
+  return NULL;
+}
+
diff --git a/xbmc/filesystem/DirectoryFactory.h b/xbmc/filesystem/DirectoryFactory.h
new file mode 100644 (file)
index 0000000..6ff0776
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IDirectory.h"
+
+namespace XFILE
+{
+/*!
+ \ingroup filesystem
+ \brief Get access to a directory of a file system.
+
+ The Factory can be used to create a directory object
+ for every file system accessable. \n
+ \n
+ Example:
+
+ \verbatim
+ CStdString strShare="iso9660://";
+
+ IDirectory* pDir=CDirectoryFactory::Create(strShare);
+ \endverbatim
+ The \e pDir pointer can be used to access a directory and retrieve it's content.
+
+ When different types of shares have to be accessed use CVirtualDirectory.
+ \sa IDirectory
+ */
+class CDirectoryFactory
+{
+public:
+  static IDirectory* Create(const CStdString& strPath);
+};
+}
diff --git a/xbmc/filesystem/DirectoryTuxBox.cpp b/xbmc/filesystem/DirectoryTuxBox.cpp
deleted file mode 100644 (file)
index 70d4392..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-#include "DirectoryTuxBox.h"
-#include "DirectoryCache.h"
-#include "FileCurl.h"
-#include "utils/HttpHeader.h"
-#include "utils/TuxBoxUtil.h"
-#include "URL.h"
-#include "tinyXML/tinyxml.h"
-#include "settings/AdvancedSettings.h"
-#include "FileItem.h"
-#include "utils/log.h"
-#include "utils/URIUtils.h"
-
-using namespace XFILE;
-
-CDirectoryTuxBox::CDirectoryTuxBox(void)
-{
-}
-
-CDirectoryTuxBox::~CDirectoryTuxBox(void)
-{
-}
-
-bool CDirectoryTuxBox::GetDirectory(const CStdString& strPath, CFileItemList &items)
-{
-  // so we know that we have enigma2
-  static bool enigma2 = false;
-  // Detect and delete slash at end
-  CStdString strRoot = strPath;
-  URIUtils::RemoveSlashAtEnd(strRoot);
-
-  //Get the request strings
-  CStdString strBQRequest;
-  CStdString strXMLRootString;
-  CStdString strXMLChildString;
-  if(!GetRootAndChildString(strRoot, strBQRequest, strXMLRootString, strXMLChildString))
-    return false;
-
-  //Set url Protocol
-  CURL url(strRoot);
-  CStdString strFilter;
-  CStdString protocol = url.GetProtocol();
-  CStdString strOptions = url.GetOptions();
-  url.SetProtocol("http");
-  bool bIsBouquet=false;
-
-  int ipoint = strOptions.Find("?path=");
-  if (ipoint >=0)
-  {
-    // send Zap!
-    return g_tuxbox.ZapToUrl(url, strOptions, ipoint);
-  }
-  else
-  {
-    ipoint = strOptions.Find("&reference=");
-    if (ipoint >=0 || enigma2)
-    {
-      //List reference
-      strFilter = strOptions.Right((strOptions.size()-(ipoint+11)));
-      bIsBouquet = false; //On Empty is Bouquet
-      if (enigma2)
-      {
-        CStdString strPort;
-        strPort.Format(":%i",url.GetPort());
-        if (strRoot.Right(strPort.GetLength()) != strPort) // If not root dir, enable Channels
-          strFilter = "e2"; // Disable Bouquets for Enigma2
-
-        GetRootAndChildStringEnigma2(strBQRequest, strXMLRootString, strXMLChildString);
-        url.SetOptions("");
-        url.SetFileName(strBQRequest);
-      }
-    }
-  }
-  if(strFilter.IsEmpty())
-  {
-    url.SetOptions(strBQRequest);
-    bIsBouquet = true;
-  }
-  //Open
-  CFileCurl http;
-  int iTryConnect = 0;
-  int iWaitTimer = 20;
-  bool result = false;
-
-  while (iTryConnect < 4)
-  {
-    http.SetTimeout(iWaitTimer);
-    if(http.Open(url))
-    {
-      //We are connected!
-      iTryConnect = 4;
-
-      // restore protocol
-      url.SetProtocol(protocol);
-
-      int size_read = 0;
-      int size_total = (int)http.GetLength();
-      int data_size = 0;
-      CStdString data;
-      data.reserve(size_total);
-
-      // read response from server into string buffer
-      char buffer[16384];
-      while ((size_read = http.Read(buffer, sizeof(buffer)-1)) > 0)
-      {
-        buffer[size_read] = 0;
-        data += buffer;
-        data_size += size_read;
-      }
-      http.Close();
-
-      // parse returned xml
-      TiXmlDocument doc;
-      data.Replace("></",">-</"); //FILL EMPTY ELEMENTS WITH "-"!
-      doc.Parse(data.c_str());
-      TiXmlElement *root = doc.RootElement();
-      if(root == NULL)
-      {
-        CLog::Log(LOGERROR, "%s - Unable to parse xml", __FUNCTION__);
-        CLog::Log(LOGERROR, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str());
-        return false;
-      }
-      if( strXMLRootString.Equals(root->Value()) && bIsBouquet)
-      {
-        data.Empty();
-        if (enigma2)
-          result = g_tuxbox.ParseBouquetsEnigma2(root, items, url, strFilter, strXMLChildString);
-        else
-          result = g_tuxbox.ParseBouquets(root, items, url, strFilter, strXMLChildString);
-      }
-      else if( strXMLRootString.Equals(root->Value()) && !strFilter.IsEmpty() )
-      {
-        data.Empty();
-        if (enigma2)
-          result = g_tuxbox.ParseChannelsEnigma2(root, items, url, strFilter, strXMLChildString);
-        else
-          result = g_tuxbox.ParseChannels(root, items, url, strFilter, strXMLChildString);
-      }
-      else
-      {
-        CLog::Log(LOGERROR, "%s - Invalid root xml element for TuxBox", __FUNCTION__);
-        CLog::Log(LOGERROR, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str());
-        data.Empty();
-        result = false;
-      }
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Unable to get XML structure! Try count:%i, Wait Timer:%is",__FUNCTION__, iTryConnect, iWaitTimer);
-      iTryConnect++;
-      if (iTryConnect == 2) //try enigma2 instead of enigma1, best entrypoint here i thought
-      {        
-        enigma2 = true;
-        GetRootAndChildStringEnigma2(strBQRequest, strXMLRootString, strXMLChildString);
-        url.SetOptions("");
-        url.SetFileName(strBQRequest);
-//        iTryConnect = 0;
-        iWaitTimer = 20;
-      }
-      else
-        iWaitTimer = iWaitTimer+10;
-
-      result = false;
-      http.Close(); // Close old connections
-    }
-  }
-  items.SetContent("movies");
-  return result;
-}
-
-void CDirectoryTuxBox::GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
-{
-  // Allways take getallservices for Enigma2
-  strBQRequest = "web/getallservices"; //Bouquets and Channels
-  strXMLRootString.Format("e2servicelistrecursive");
-  strXMLChildString.Format("e2bouquet");
-}
-
-bool CDirectoryTuxBox::GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
-{
-  //Advanced Settings: RootMode! Movies:
-  if(g_advancedSettings.m_iTuxBoxDefaultRootMenu == 3) //Movies! Fixed-> mode=3&submode=4
-  {
-    CLog::Log(LOGDEBUG, "%s - Default defined RootMenu : (3) Movies", __FUNCTION__);
-    strBQRequest = "xml/services?mode=3&submode=4";
-    strXMLRootString.Format("movies");
-    strXMLChildString.Format("service");
-  }
-  else if(g_advancedSettings.m_iTuxBoxDefaultRootMenu <= 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu == 1 ||
-    g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4 )
-  {
-    //Falling Back to the Default RootMenu => 0 Bouquets
-    if(g_advancedSettings.m_iTuxBoxDefaultRootMenu < 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4)
-    {
-      g_advancedSettings.m_iTuxBoxDefaultRootMenu = 0;
-    }
-
-    //Advanced Settings: SubMenu!
-    if(g_advancedSettings.m_bTuxBoxSubMenuSelection)
-    {
-      CLog::Log(LOGDEBUG, "%s SubMenu Channel Selection is Enabled! Requesting Submenu!", __FUNCTION__);
-      // DeActivated: Timing Problems, bug in TuxBox.. etc.!
-      bool bReqMoRe = true;
-      // Detect the RootMode !
-      if (strPath.Find("?mode=")>=0)
-      {
-        CStdString strMode;
-        bReqMoRe=false;
-        strMode = g_tuxbox.DetectSubMode(strPath, strXMLRootString, strXMLChildString);
-      }
-      if(bReqMoRe)
-      {
-        //PopUp Context and Request SubMode with root and child string
-        strBQRequest = g_tuxbox.GetSubMode(g_advancedSettings.m_iTuxBoxDefaultRootMenu, strXMLRootString, strXMLChildString);
-        if(strBQRequest.IsEmpty())
-        {
-          strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
-          strXMLRootString.Format("bouquets");
-          strXMLChildString.Format("bouquet");
-        }
-      }
-    }
-    else
-    {
-      //Advanced Settings: Set Default Subemnu
-      if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 1)
-      {
-        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (1) Services", __FUNCTION__);
-        strBQRequest = "xml/services?mode=0&submode=1"; //Services
-        strXMLRootString.Format("services");
-        strXMLChildString.Format("service");
-      }
-      else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 2)
-      {
-        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (2) Satellites", __FUNCTION__);
-        strBQRequest = "xml/services?mode=0&submode=2"; //Satellites
-        strXMLRootString.Format("satellites");
-        strXMLChildString.Format("satellite");
-      }
-      else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 3)
-      {
-        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (3) Providers", __FUNCTION__);
-        strBQRequest = "xml/services?mode=0&submode=3"; //Providers
-        strXMLRootString.Format("providers");
-        strXMLChildString.Format("provider");
-      }
-      else
-      {
-        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (4) Bouquets", __FUNCTION__);
-        strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
-        strXMLRootString.Format("bouquets");
-        strXMLChildString.Format("bouquet");
-      }
-    }
-  }
-  if(strBQRequest.IsEmpty() || strXMLRootString.IsEmpty() || strXMLChildString.IsEmpty())
-    return false;
-  else
-    return true;
-}
diff --git a/xbmc/filesystem/DirectoryTuxBox.h b/xbmc/filesystem/DirectoryTuxBox.h
deleted file mode 100644 (file)
index eb3f92b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IDirectory.h"
-
-class CURL;
-class TiXmlElement;
-
-namespace XFILE
-{
-  class CDirectoryTuxBox : public IDirectory
-  {
-    public:
-      CDirectoryTuxBox(void);
-      virtual ~CDirectoryTuxBox(void);
-      virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
-      virtual bool IsAllowed(const CStdString &strFile) const { return true; };
-      virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const { return DIR_CACHE_ALWAYS; };
-    private:
-      bool GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString );
-      void GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString );
-  };
-}
-
index 4b7ce40..e46792a 100644 (file)
@@ -23,7 +23,7 @@
 #include "FTPParse.h"
 #include "URL.h"
 #include "utils/URIUtils.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "FileItem.h"
 #include "utils/StringUtils.h"
 #include "utils/CharsetConverter.h"
diff --git a/xbmc/filesystem/FactoryDirectory.cpp b/xbmc/filesystem/FactoryDirectory.cpp
deleted file mode 100644 (file)
index 4eff97f..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#if (defined HAVE_CONFIG_H) && (!defined WIN32)
-  #include "config.h"
-#endif
-#include "system.h"
-#include "FactoryDirectory.h"
-#include "HDDirectory.h"
-#include "SpecialProtocolDirectory.h"
-#include "MultiPathDirectory.h"
-#include "StackDirectory.h"
-#include "FactoryFileDirectory.h"
-#include "PlaylistDirectory.h"
-#include "MusicDatabaseDirectory.h"
-#include "MusicSearchDirectory.h"
-#include "VideoDatabaseDirectory.h"
-#include "AddonsDirectory.h"
-#include "SourcesDirectory.h"
-#include "LastFMDirectory.h"
-#include "FTPDirectory.h"
-#include "HTTPDirectory.h"
-#include "DAVDirectory.h"
-#include "UDFDirectory.h"
-#include "Application.h"
-#include "addons/Addon.h"
-#include "utils/log.h"
-
-#ifdef HAS_FILESYSTEM_SMB
-#ifdef _WIN32
-#include "windows/WINSMBDirectory.h"
-#else
-#include "SMBDirectory.h"
-#endif
-#endif
-#ifdef HAS_FILESYSTEM_CDDA
-#include "CDDADirectory.h"
-#endif
-#include "PluginDirectory.h"
-#ifdef HAS_FILESYSTEM
-#include "ISO9660Directory.h"
-#ifdef HAS_FILESYSTEM_RTV
-#include "RTVDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_DAAP
-#include "DAAPDirectory.h"
-#endif
-#endif
-#ifdef HAS_UPNP
-#include "UPnPDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_SAP
-#include "SAPDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_VTP
-#include "VTPDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_HTSP
-#include "HTSPDirectory.h"
-#endif
-#include "ZipDirectory.h"
-#ifdef HAS_FILESYSTEM_RAR
-#include "RarDirectory.h"
-#endif
-#include "DirectoryTuxBox.h"
-#include "HDHomeRun.h"
-#include "Slingbox.h"
-#include "MythDirectory.h"
-#include "FileItem.h"
-#include "URL.h"
-#include "RSSDirectory.h"
-#ifdef HAS_ZEROCONF
-#include "ZeroconfDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_SFTP
-#include "SFTPDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_NFS
-#include "NFSDirectory.h"
-#endif
-#ifdef HAS_FILESYSTEM_AFP
-#include "AFPDirectory.h"
-#endif
-
-using namespace XFILE;
-
-/*!
- \brief Create a IDirectory object of the share type specified in \e strPath .
- \param strPath Specifies the share type to access, can be a share or share with path.
- \return IDirectory object to access the directories on the share.
- \sa IDirectory
- */
-IDirectory* CFactoryDirectory::Create(const CStdString& strPath)
-{
-  CURL url(strPath);
-
-  CFileItem item(strPath, false);
-  IFileDirectory* pDir=CFactoryFileDirectory::Create(strPath, &item);
-  if (pDir)
-    return pDir;
-
-  CStdString strProtocol = url.GetProtocol();
-
-  if (strProtocol.size() == 0 || strProtocol == "file") return new CHDDirectory();
-  if (strProtocol == "special") return new CSpecialProtocolDirectory();
-  if (strProtocol == "sources") return new CSourcesDirectory();
-  if (strProtocol == "addons") return new CAddonsDirectory();
-#if defined(HAS_FILESYSTEM_CDDA) && defined(HAS_DVD_DRIVE)
-  if (strProtocol == "cdda") return new CCDDADirectory();
-#endif
-#ifdef HAS_FILESYSTEM
-  if (strProtocol == "iso9660") return new CISO9660Directory();
-#endif
-  if (strProtocol == "udf") return new CUDFDirectory();
-  if (strProtocol == "plugin") return new CPluginDirectory();
-  if (strProtocol == "zip") return new CZipDirectory();
-#ifdef HAS_FILESYSTEM_RAR
-  if (strProtocol == "rar") return new CRarDirectory();
-#endif
-  if (strProtocol == "multipath") return new CMultiPathDirectory();
-  if (strProtocol == "stack") return new CStackDirectory();
-  if (strProtocol == "playlistmusic") return new CPlaylistDirectory();
-  if (strProtocol == "playlistvideo") return new CPlaylistDirectory();
-  if (strProtocol == "musicdb") return new CMusicDatabaseDirectory();
-  if (strProtocol == "musicsearch") return new CMusicSearchDirectory();
-  if (strProtocol == "videodb") return new CVideoDatabaseDirectory();
-  if (strProtocol == "filereader")
-    return CFactoryDirectory::Create(url.GetFileName());
-
-  if( g_application.getNetwork().IsAvailable(true) )  // true to wait for the network (if possible)
-  {
-    if (strProtocol == "lastfm") return new CLastFMDirectory();
-    if (strProtocol == "tuxbox") return new CDirectoryTuxBox();
-    if (strProtocol == "ftp" ||  strProtocol == "ftpx" ||  strProtocol == "ftps") return new CFTPDirectory();
-    if (strProtocol == "http" || strProtocol == "https") return new CHTTPDirectory();
-    if (strProtocol == "dav" || strProtocol == "davs") return new CDAVDirectory();
-#ifdef HAS_FILESYSTEM_SFTP
-    if (strProtocol == "sftp" || strProtocol == "ssh") return new CSFTPDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_SMB
-#ifdef _WIN32
-    if (strProtocol == "smb") return new CWINSMBDirectory();
-#else
-    if (strProtocol == "smb") return new CSMBDirectory();
-#endif
-#endif
-#ifdef HAS_FILESYSTEM
-#ifdef HAS_FILESYSTEM_DAAP
-    if (strProtocol == "daap") return new CDAAPDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_RTV
-    if (strProtocol == "rtv") return new CRTVDirectory();
-#endif
-#endif
-#ifdef HAS_UPNP
-    if (strProtocol == "upnp") return new CUPnPDirectory();
-#endif
-    if (strProtocol == "hdhomerun") return new CDirectoryHomeRun();
-    if (strProtocol == "sling") return new CSlingboxDirectory();
-    if (strProtocol == "myth") return new CMythDirectory();
-    if (strProtocol == "cmyth") return new CMythDirectory();
-    if (strProtocol == "rss") return new CRSSDirectory();
-#ifdef HAS_FILESYSTEM_SAP
-    if (strProtocol == "sap") return new CSAPDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_VTP
-    if (strProtocol == "vtp") return new CVTPDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_HTSP
-    if (strProtocol == "htsp") return new CHTSPDirectory();
-#endif
-#ifdef HAS_ZEROCONF
-    if (strProtocol == "zeroconf") return new CZeroconfDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_NFS
-    if (strProtocol == "nfs") return new CNFSDirectory();
-#endif
-#ifdef HAS_FILESYSTEM_AFP
-      if (strProtocol == "afp") return new CAFPDirectory();
-#endif
-  }
-
-  CLog::Log(LOGWARNING, "%s - Unsupported protocol(%s) in %s", __FUNCTION__, strProtocol.c_str(), url.Get().c_str() );
-  return NULL;
-}
-
diff --git a/xbmc/filesystem/FactoryDirectory.h b/xbmc/filesystem/FactoryDirectory.h
deleted file mode 100644 (file)
index f525917..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IDirectory.h"
-
-namespace XFILE
-{
-/*!
- \ingroup filesystem
- \brief Get access to a directory of a file system.
-
- The Factory can be used to create a directory object
- for every file system accessable. \n
- \n
- Example:
-
- \verbatim
- CStdString strShare="iso9660://";
-
- IDirectory* pDir=CFactoryDirectory::Create(strShare);
- \endverbatim
- The \e pDir pointer can be used to access a directory and retrieve it's content.
-
- When different types of shares have to be accessed use CVirtualDirectory.
- \sa IDirectory
- */
-class CFactoryDirectory
-{
-public:
-  static IDirectory* Create(const CStdString& strPath);
-};
-}
diff --git a/xbmc/filesystem/FactoryFileDirectory.cpp b/xbmc/filesystem/FactoryFileDirectory.cpp
deleted file mode 100644 (file)
index 7b36b3a..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-#include "system.h"
-#include "Util.h"
-#include "utils/URIUtils.h"
-#include "FactoryFileDirectory.h"
-#ifdef HAS_FILESYSTEM
-#include "OGGFileDirectory.h"
-#include "NSFFileDirectory.h"
-#include "SIDFileDirectory.h"
-#include "ASAPFileDirectory.h"
-#include "RSSDirectory.h"
-#include "cores/paplayer/ASAPCodec.h"
-#endif
-#ifdef HAS_FILESYSTEM_RAR
-#include "RarDirectory.h"
-#endif
-#include "ZipDirectory.h"
-#include "SmartPlaylistDirectory.h"
-#include "playlists/SmartPlayList.h"
-#include "PlaylistFileDirectory.h"
-#include "playlists/PlayListFactory.h"
-#include "Directory.h"
-#include "File.h"
-#include "ZipManager.h"
-#include "settings/AdvancedSettings.h"
-#include "FileItem.h"
-
-using namespace XFILE;
-using namespace PLAYLIST;
-using namespace std;
-
-CFactoryFileDirectory::CFactoryFileDirectory(void)
-{}
-
-CFactoryFileDirectory::~CFactoryFileDirectory(void)
-{}
-
-// return NULL + set pItem->m_bIsFolder to remove it completely from list.
-IFileDirectory* CFactoryFileDirectory::Create(const CStdString& strPath, CFileItem* pItem, const CStdString& strMask)
-{
-  CStdString strExtension=URIUtils::GetExtension(strPath);
-  strExtension.MakeLower();
-
-#ifdef HAS_FILESYSTEM
-  if ((strExtension.Equals(".ogg") || strExtension.Equals(".oga")) && CFile::Exists(strPath))
-  {
-    IFileDirectory* pDir=new COGGFileDirectory;
-    //  Has the ogg file more than one bitstream?
-    if (pDir->ContainsFiles(strPath))
-    {
-      return pDir; // treat as directory
-    }
-
-    delete pDir;
-    return NULL;
-  }
-  if (strExtension.Equals(".nsf") && CFile::Exists(strPath))
-  {
-    IFileDirectory* pDir=new CNSFFileDirectory;
-    //  Has the nsf file more than one track?
-    if (pDir->ContainsFiles(strPath))
-      return pDir; // treat as directory
-
-    delete pDir;
-    return NULL;
-  }
-  if (strExtension.Equals(".sid") && CFile::Exists(strPath))
-  {
-    IFileDirectory* pDir=new CSIDFileDirectory;
-    //  Has the sid file more than one track?
-    if (pDir->ContainsFiles(strPath))
-      return pDir; // treat as directory
-
-    delete pDir;
-    return NULL;
-  }
-#ifdef HAS_ASAP_CODEC
-  if (ASAPCodec::IsSupportedFormat(strExtension) && CFile::Exists(strPath))
-  {
-    IFileDirectory* pDir=new CASAPFileDirectory;
-    //  Has the asap file more than one track?
-    if (pDir->ContainsFiles(strPath))
-      return pDir; // treat as directory
-
-    delete pDir;
-    return NULL;
-  }
-#endif
-
-  if (pItem->IsRSS())
-    return new CRSSDirectory();
-
-#endif
-  if (strExtension.Equals(".zip"))
-  {
-    CStdString strUrl;
-    URIUtils::CreateArchivePath(strUrl, "zip", strPath, "");
-
-    CFileItemList items;
-    CDirectory::GetDirectory(strUrl, items, strMask);
-    if (items.Size() == 0) // no files
-      pItem->m_bIsFolder = true;
-    else if (items.Size() == 1 && items[0]->m_idepth == 0)
-    {
-      // one STORED file - collapse it down
-      *pItem = *items[0];
-    }
-    else
-    { // compressed or more than one file -> create a zip dir
-      pItem->SetPath(strUrl);
-      return new CZipDirectory;
-    }
-    return NULL;
-  }
-  if (strExtension.Equals(".rar") || strExtension.Equals(".001"))
-  {
-    CStdString strUrl;
-    URIUtils::CreateArchivePath(strUrl, "rar", strPath, "");
-
-    vector<CStdString> tokens;
-    CUtil::Tokenize(strPath,tokens,".");
-    if (tokens.size() > 2)
-    {
-      if (strExtension.Equals(".001"))
-      {
-        if (tokens[tokens.size()-2].Equals("ts")) // .ts.001 - treat as a movie file to scratch some users itch
-          return NULL;
-      }
-      CStdString token = tokens[tokens.size()-2];
-      if (token.Left(4).CompareNoCase("part") == 0) // only list '.part01.rar'
-      {
-        // need this crap to avoid making mistakes - yeyh for the new rar naming scheme :/
-        struct __stat64 stat;
-        int digits = token.size()-4;
-        CStdString strNumber, strFormat;
-        strFormat.Format("part%%0%ii",digits);
-        strNumber.Format(strFormat.c_str(),1);
-        CStdString strPath2=strPath;
-        strPath2.Replace(token,strNumber);
-        if (atoi(token.substr(4).c_str()) > 1 && CFile::Stat(strPath2,&stat) == 0)
-        {
-          pItem->m_bIsFolder = true;
-          return NULL;
-        }
-      }
-    }
-
-    CFileItemList items;
-    CDirectory::GetDirectory(strUrl, items, strMask);
-    if (items.Size() == 0) // no files - hide this
-      pItem->m_bIsFolder = true;
-    else if (items.Size() == 1 && items[0]->m_idepth == 0x30)
-    {
-      // one STORED file - collapse it down
-      *pItem = *items[0];
-    }
-    else
-    {
-#ifdef HAS_FILESYSTEM_RAR
-      // compressed or more than one file -> create a rar dir
-      pItem->SetPath(strUrl);
-      return new CRarDirectory;
-#else
-      return NULL;
-#endif
-    }
-    return NULL;
-  }
-  if (strExtension.Equals(".xsp"))
-  { // XBMC Smart playlist - just XML renamed to XSP
-    // read the name of the playlist in
-    CSmartPlaylist playlist;
-    if (playlist.OpenAndReadName(strPath))
-    {
-      pItem->SetLabel(playlist.GetName());
-      pItem->SetLabelPreformated(true);
-    }
-    IFileDirectory* pDir=new CSmartPlaylistDirectory;
-    return pDir; // treat as directory
-  }
-  if (g_advancedSettings.m_playlistAsFolders && CPlayListFactory::IsPlaylist(strPath))
-  { // Playlist file
-    // currently we only return the directory if it contains
-    // more than one file.  Reason is that .pls and .m3u may be used
-    // for links to http streams etc.
-    IFileDirectory *pDir = new CPlaylistFileDirectory();
-    CFileItemList items;
-    if (pDir->GetDirectory(strPath, items))
-    {
-      if (items.Size() > 1)
-        return pDir;
-    }
-    delete pDir;
-    return NULL;
-  }
-  return NULL;
-}
-
diff --git a/xbmc/filesystem/FactoryFileDirectory.h b/xbmc/filesystem/FactoryFileDirectory.h
deleted file mode 100644 (file)
index d426430..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IFileDirectory.h"
-
-class CFileItem;
-
-namespace XFILE
-{
-class CFactoryFileDirectory
-{
-public:
-  CFactoryFileDirectory(void);
-  virtual ~CFactoryFileDirectory(void);
-  static IFileDirectory* Create(const CStdString& strPath, CFileItem* pItem, const CStdString& strMask="");
-};
-}
index 6bfe7da..3890338 100644 (file)
@@ -21,9 +21,9 @@
 #include "File.h"
 #include "FileFactory.h"
 #include "Application.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "Directory.h"
-#include "FileCache.h"
+#include "CacheFile.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
 #include "utils/BitstreamStats.h"
diff --git a/xbmc/filesystem/FileAFP.cpp b/xbmc/filesystem/FileAFP.cpp
deleted file mode 100644 (file)
index ff45413..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileAFP.cpp: implementation of the CFileAFP class.
-//
-//////////////////////////////////////////////////////////////////////
-#ifdef _LINUX
-#include "system.h"
-
-#if defined(HAS_FILESYSTEM_AFP)
-#include "FileAFP.h"
-#include "PasswordManager.h"
-#include "AFPDirectory.h"
-#include "Util.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include "utils/TimeUtils.h"
-
-using namespace XFILE;
-
-#define AFP_MAX_READ_SIZE 131072
-
-CStdString URLEncode(const CStdString value)
-{
-  CStdString encoded(value);
-  CURL::Encode(encoded);
-  return encoded;
-}
-
-void AfpConnectionLog(void *priv, enum loglevels loglevel, int logtype, const char *message)
-{
-  if (!message) return;
-  CStdString msg = "LIBAFPCLIENT: " + CStdString(message);
-
-  switch(logtype)
-  {
-    case LOG_WARNING:
-      CLog::Log(LOGWARNING, "%s", msg.c_str());
-      break;
-    case LOG_ERR:
-      CLog::Log(LOGERROR, "%s", msg.c_str());
-      break;
-    default:
-      CLog::Log(LOGDEBUG, "%s", msg.c_str());
-      break;
-  }
-}
-
-CAfpConnection::CAfpConnection()
- : m_OpenConnections(0)
- , m_IdleTimeout(0)
- , m_pAfpServer(NULL)
- , m_pAfpVol(NULL)
- , m_pAfpUrl((struct afp_url*)malloc(sizeof(struct afp_url)))
- , m_pAfpClient((struct libafpclient*)malloc(sizeof(struct libafpclient)))
- , m_pLibAfp(new DllLibAfp())
- , m_bDllInited(false)
-{
-}
-
-CAfpConnection::~CAfpConnection()
-{
-  Disconnect();
-  free(m_pAfpClient);
-  free(m_pAfpUrl);
-  if (m_pLibAfp->IsLoaded())
-    m_pLibAfp->Unload();
-  delete m_pLibAfp;
-}
-
-bool CAfpConnection::initLib()
-{
-  if (!m_bDllInited)
-  {
-    if (m_pLibAfp->Load())
-    {
-      m_pAfpClient->unmount_volume = NULL;
-      m_pAfpClient->log_for_client = AfpConnectionLog;
-      m_pAfpClient->forced_ending_hook = NULL;
-      m_pAfpClient->scan_extra_fds = NULL;
-      m_pAfpClient->loop_started = NULL;
-
-      m_pLibAfp->libafpclient_register(m_pAfpClient);
-      m_pLibAfp->init_uams();
-      m_pLibAfp->afp_main_quick_startup(NULL);
-      CLog::Log(LOGDEBUG, "AFP: Supported UAMs: %s", m_pLibAfp->get_uam_names_list());
-      m_bDllInited = true;
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "AFP: Error loading afpclient lib.");
-    }
-  }
-
-  return m_bDllInited;
-}
-
-//only unmount here - afpclient lib is not
-//stoppable (no afp_main_quick_shutdown as counter part
-//for afp_main_quick_startup)
-void CAfpConnection::Deinit()
-{
-  if(m_pAfpVol && m_pLibAfp->IsLoaded())
-  {
-    disconnectVolume();
-    Disconnect();
-    m_pAfpUrl->servername[0] = '\0';
-  }        
-}
-
-void CAfpConnection::Disconnect()
-{
-  CSingleLock lock(*this);
-  m_pAfpServer = NULL;
-}
-
-void CAfpConnection::disconnectVolume()
-{
-  if (m_pAfpVol)
-  {
-    // afp_unmount_volume(m_pAfpVol);
-    m_pLibAfp->afp_unmount_all_volumes(m_pAfpServer);
-    m_pAfpVol = NULL;
-  }
-}
-
-// taken from cmdline tool
-bool CAfpConnection::connectVolume(const char *volumename, struct afp_volume *&pVolume)
-{
-  bool ret = false;
-  if (strlen(volumename) != 0)
-  {
-    // Ah, we're not connected to a volume
-    unsigned int len = 0;
-    char mesg[1024];
-
-    if ((pVolume = m_pLibAfp->find_volume_by_name(m_pAfpServer, volumename)) == NULL)
-    {
-      CLog::Log(LOGDEBUG, "AFP: Could not find a volume called %s\n", volumename);
-    }
-    else
-    {
-      pVolume->mapping = AFP_MAPPING_LOGINIDS;
-      pVolume->extra_flags |= VOLUME_EXTRA_FLAGS_NO_LOCKING;
-
-      if (m_pLibAfp->afp_connect_volume(pVolume, m_pAfpServer, mesg, &len, 1024 ))
-      {
-        CLog::Log(LOGDEBUG, "AFP: Could not access volume %s (error: %s)\n", pVolume->volume_name, mesg);
-        pVolume = NULL;
-      }
-      else
-      {
-        CLog::Log(LOGDEBUG, "AFP: Connected to volume %s\n", pVolume->volume_name_printable);
-        ret = true;
-      }
-    }
-  }
-
-  return ret;
-}
-
-CStdString CAfpConnection::getAuthenticatedPath(const CURL &url)
-{
-  CURL authURL(url);
-  CStdString ret;
-  CPasswordManager::GetInstance().AuthenticateURL(authURL);
-  ret = authURL.Get();
-  return ret;
-}
-
-CAfpConnection::afpConnnectError CAfpConnection::Connect(const CURL& url)
-{
-  CSingleLock lock(*this);
-  struct afp_connection_request *conn_req = NULL;
-  struct afp_url tmpurl;
-  CURL nonConstUrl(getAuthenticatedPath(url)); // we need a editable copy of the url
-  bool serverChanged=false;
-
-  if (!initLib())
-    return AfpFailed;
-
-  m_pLibAfp->afp_default_url(&tmpurl);
-
-  // if hostname has changed - assume server changed
-  if (!nonConstUrl.GetHostName().Equals(m_pAfpUrl->servername, false)|| (m_pAfpServer && m_pAfpServer->connect_state == 0))
-  {
-    serverChanged = true;
-    Disconnect();
-  }
-
-  // if volume changed - also assume server changed (afpclient can't reuse old servobject it seems)
-  if (!nonConstUrl.GetShareName().Equals(m_pAfpUrl->volumename, false))
-  {
-   // no reusing of old server object possible with libafpclient it seems...
-    serverChanged = true;
-    Disconnect();
-  }
-
-  // first, try to parse the URL
-  if (m_pLibAfp->afp_parse_url(&tmpurl, nonConstUrl.Get().c_str(), 0) != 0)
-  {
-    // Okay, this isn't a real URL
-    CLog::Log(LOGDEBUG, "AFP: Could not parse url: %s!\n", nonConstUrl.Get().c_str());
-    return AfpFailed;
-  }
-  else // parsed sucessfull
-  {
-    // this is our current url object whe are connected to (at least we try)
-    *m_pAfpUrl = tmpurl;
-  }
-
-  // if no username and password is set - use no user authent uam
-  if (strlen(m_pAfpUrl->password) == 0 && strlen(m_pAfpUrl->username) == 0)
-  {
-    // try anonymous
-    strncpy(m_pAfpUrl->uamname, "No User Authent", sizeof(m_pAfpUrl->uamname));
-    CLog::Log(LOGDEBUG, "AFP: Using anonymous authentication.");
-  }
-  else if ((nonConstUrl.GetPassWord().IsEmpty() || nonConstUrl.GetUserName().IsEmpty()) && serverChanged)
-  {
-    // this is our current url object whe are connected to (at least we try)
-    return AfpAuth;
-  }
-
-  // we got a password in the url
-  if (!nonConstUrl.GetPassWord().IsEmpty())
-  {
-    // copy password because afp_parse_url just puts garbage into the password field :(
-    strncpy(m_pAfpUrl->password, nonConstUrl.GetPassWord().c_str(), 127);
-  }
-
-  // whe are not connected or we want to connect to another server
-  if (!m_pAfpServer || serverChanged)
-  {
-    // code from cmdline tool
-    conn_req = (struct afp_connection_request*)malloc(sizeof(struct afp_connection_request));
-    memset(conn_req, 0, sizeof(struct afp_connection_request));
-
-    conn_req->url = *m_pAfpUrl;
-    conn_req->url.requested_version = 31;
-
-    if (strlen(m_pAfpUrl->uamname)>0)
-    {
-      if ((conn_req->uam_mask = m_pLibAfp->find_uam_by_name(m_pAfpUrl->uamname)) == 0)
-      {
-        CLog::Log(LOGDEBUG, "AFP:I don't know about UAM %s\n", m_pAfpUrl->uamname);
-        m_pAfpUrl->volumename[0] = '\0';
-        m_pAfpUrl->servername[0] = '\0';
-        free(conn_req);
-        return AfpFailed;
-      }
-    }
-    else
-    {
-      conn_req->uam_mask = m_pLibAfp->default_uams_mask();
-    }
-
-    // try to connect
-#ifdef USE_CVS_AFPFS
-    if ((m_pAfpServer = m_pLibAfp->afp_wrap_server_full_connect(NULL, conn_req, NULL)) == NULL)
-#else
-    if ((m_pAfpServer = m_pLibAfp->afp_wrap_server_full_connect(NULL, conn_req)) == NULL)
-#endif
-    {
-      m_pAfpUrl->volumename[0] = '\0';
-      m_pAfpUrl->servername[0] = '\0';
-      free(conn_req);
-      CLog::Log(LOGERROR, "AFP: Error connecting to %s", url.Get().c_str());
-      return AfpFailed;
-    }
-    // success!
-    CLog::Log(LOGDEBUG, "AFP: Connected to server %s using UAM \"%s\"\n",
-      m_pAfpServer->server_name, m_pLibAfp->uam_bitmap_to_string(m_pAfpServer->using_uam));
-    // we don't need it after here ...
-    free(conn_req);
-  }
-
-  // if server changed reconnect volume
-  if (serverChanged)
-  {
-    connectVolume(m_pAfpUrl->volumename, m_pAfpVol); // connect new volume
-  }
-  return AfpOk;
-}
-
-int CAfpConnection::stat(const CURL &url, struct stat *statbuff)
-{
-  CSingleLock lock(*this);
-  CStdString strPath = gAfpConnection.GetPath(url);
-  struct afp_volume *pTmpVol = NULL;
-  struct afp_url tmpurl;
-  int iResult = -1;
-  CURL nonConstUrl(getAuthenticatedPath(url)); // we need a editable copy of the url
-
-  if (!initLib() || !m_pAfpServer)
-    return -1;
-
-  m_pLibAfp->afp_default_url(&tmpurl);
-
-  // first, try to parse the URL
-  if (m_pLibAfp->afp_parse_url(&tmpurl, nonConstUrl.Get().c_str(), 0) != 0)
-  {
-    // Okay, this isn't a real URL
-    CLog::Log(LOGDEBUG, "AFP: Could not parse url: %s!\n", nonConstUrl.Get().c_str());
-    return -1;
-  }
-
-  // if no username and password is set - use no user authent uam
-  if (strlen(tmpurl.password) == 0 && strlen(tmpurl.username) == 0)
-  {
-    // try anonymous
-    strncpy(tmpurl.uamname, "No User Authent", sizeof(tmpurl.uamname));
-    CLog::Log(LOGDEBUG, "AFP: Using anonymous authentication.");
-  }
-  else if ((nonConstUrl.GetPassWord().IsEmpty() || nonConstUrl.GetUserName().IsEmpty()))
-  {
-    // this is our current url object whe are connected to (at least we try)
-    return -1;
-  }
-
-  // we got a password in the url
-  if (!nonConstUrl.GetPassWord().IsEmpty())
-  {
-    // copy password because afp_parse_url just puts garbage into the password field :(
-    strncpy(tmpurl.password, nonConstUrl.GetPassWord().c_str(), 127);
-  }
-
-  // connect new volume
-  if(connectVolume(tmpurl.volumename, pTmpVol) && pTmpVol)
-  {
-    iResult = m_pLibAfp->afp_wrap_getattr(pTmpVol, strPath.c_str(), statbuff);
-    //unmount single volume crashs
-    //we will get rid of the mounted volume
-    //once the context is changed in connect function
-    //ppppooooorrrr!!
-    //m_pLibAfp->afp_unmount_volume(pTmpVol);
-  }
-  return iResult;
-}
-
-
-/* This is called from CApplication::ProcessSlow() and is used to tell if afp have been idle for too long */
-void CAfpConnection::CheckIfIdle()
-{
-  /* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
-   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
-  if (m_OpenConnections == 0 && m_pAfpVol != NULL)
-  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
-    CSingleLock lock(*this);
-    if (m_OpenConnections == 0 /* check again - when locked */)
-    {
-      if (m_IdleTimeout > 0)
-      {
-        m_IdleTimeout--;
-      }
-      else
-      {
-        CLog::Log(LOGNOTICE, "AFP is idle. Closing the remaining connections.");
-        gAfpConnection.Deinit();
-      }
-    }
-  }
-}
-
-/* The following two function is used to keep track on how many Opened files/directories there are.
-needed for unloading the dylib*/
-void CAfpConnection::AddActiveConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections++;
-}
-
-void CAfpConnection::AddIdleConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections--;
-  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
-   leaves the movie paused for a long while and then press stop */
-  m_IdleTimeout = 180;
-}
-
-CStdString CAfpConnection::GetPath(const CURL &url)
-{
-  struct afp_url tmpurl;
-  CStdString ret = "";
-
-  m_pLibAfp->afp_default_url(&tmpurl);
-
-  // First, try to parse the URL
-  if (m_pLibAfp->afp_parse_url(&tmpurl, url.Get().c_str(), 0) != 0 )
-  {
-    // Okay, this isn't a real URL
-    CLog::Log(LOGDEBUG, "AFP: Could not parse url.\n");
-  }
-  else
-  {
-    ret = CStdString(tmpurl.path);
-  }
-  return ret;
-}
-
-CAfpConnection gAfpConnection;
-
-CFileAFP::CFileAFP()
- : m_fileSize(0)
- , m_fileOffset(0)
- , m_pFp(NULL)
- , m_pAfpVol(NULL)
-{
-  gAfpConnection.AddActiveConnection();
-}
-
-CFileAFP::~CFileAFP()
-{
-  gAfpConnection.AddIdleConnection();
-  Close();
-}
-
-int64_t CFileAFP::GetPosition()
-{
-  if (m_pFp == NULL) return 0;
-  return m_fileOffset;
-}
-
-int64_t CFileAFP::GetLength()
-{
-  if (m_pFp == NULL) return 0;
-  return m_fileSize;
-}
-
-bool CFileAFP::Open(const CURL& url)
-{
-  Close();
-  // we can't open files like afp://file.f or afp://server/file.f
-  // if a file matches the if below return false, it can't exist on a afp share.
-  if (!IsValidFile(url.GetFileName()))
-  {
-    CLog::Log(LOGNOTICE, "FileAfp: Bad URL : '%s'", url.GetFileName().c_str());
-    return false;
-  }
-
-  CSingleLock lock(gAfpConnection);
-  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
-    return false;
-  m_pAfpVol = gAfpConnection.GetVolume();
-
-  CStdString strPath = gAfpConnection.GetPath(url);
-
-  if (gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, strPath.c_str(), O_RDONLY, &m_pFp))
-  {
-    if (gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, URLEncode(strPath.c_str()).c_str(), O_RDONLY, &m_pFp))
-    {
-      // write error to logfile
-      CLog::Log(LOGINFO, "CFileAFP::Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strPath.c_str(), errno, strerror(errno));
-      return false;
-    }
-  }
-  
-  CLog::Log(LOGDEBUG,"CFileAFP::Open - opened %s, fd=%d",url.GetFileName().c_str(), m_pFp ? m_pFp->fileid:-1);
-  m_url = url;
-  
-#ifdef _LINUX
-  struct __stat64 tmpBuffer;
-#else
-  struct stat tmpBuffer;
-#endif  
-  if(Stat(&tmpBuffer))
-  {
-    m_url.Reset();
-    Close();
-    return false;
-  }
-
-  m_fileSize = tmpBuffer.st_size;
-  m_fileOffset = 0;
-  // We've successfully opened the file!
-  return true;
-}
-
-
-bool CFileAFP::Exists(const CURL& url)
-{
-  return Stat(url, NULL) == 0;
-}
-
-int CFileAFP::Stat(struct __stat64* buffer)
-{
-  if (m_pFp == NULL)
-    return -1;
-  return Stat(m_url, buffer);
-}
-
-// TODO - maybe check returncode!
-int CFileAFP::Stat(const CURL& url, struct __stat64* buffer)
-{
-  CSingleLock lock(gAfpConnection);
-  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
-    return -1;
-
-  CStdString strPath = gAfpConnection.GetPath(url);
-
-  struct stat tmpBuffer = {0};
-  int iResult = gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), strPath.c_str(), &tmpBuffer);
-
-  if (buffer)
-  {
-    memset(buffer, 0, sizeof(struct __stat64));
-    buffer->st_dev   = tmpBuffer.st_dev;
-    buffer->st_ino   = tmpBuffer.st_ino;
-    buffer->st_mode  = tmpBuffer.st_mode;
-    buffer->st_nlink = tmpBuffer.st_nlink;
-    buffer->st_uid   = tmpBuffer.st_uid;
-    buffer->st_gid   = tmpBuffer.st_gid;
-    buffer->st_rdev  = tmpBuffer.st_rdev;
-    buffer->st_size  = tmpBuffer.st_size;
-    buffer->st_atime = tmpBuffer.st_atime;
-    buffer->st_mtime = tmpBuffer.st_mtime;
-    buffer->st_ctime = tmpBuffer.st_ctime;
-  }
-
-  return iResult;
-}
-
-unsigned int CFileAFP::Read(void *lpBuf, int64_t uiBufSize)
-{
-  CSingleLock lock(gAfpConnection);
-  if (m_pFp == NULL || !m_pAfpVol)
-    return 0;
-
-  if (uiBufSize > AFP_MAX_READ_SIZE)
-    uiBufSize = AFP_MAX_READ_SIZE;
-
-#ifdef USE_CVS_AFPFS
-  char *name = m_pFp->basename;
-#else
-  char *name = m_pFp->name;
-  if (strlen(name) == 0)
-    name = m_pFp->basename;
-
-#endif
-  int eof = 0;
-  int bytesRead = gAfpConnection.GetImpl()->afp_wrap_read(m_pAfpVol,
-    name, (char *)lpBuf,(size_t)uiBufSize, m_fileOffset, m_pFp, &eof);
-  if (bytesRead > 0)
-    m_fileOffset += bytesRead;
-
-  if (bytesRead < 0)
-  {
-    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s )", __FUNCTION__, bytesRead, errno, strerror(errno));
-    return 0;
-  }
-
-  return (unsigned int)bytesRead;
-}
-
-int64_t CFileAFP::Seek(int64_t iFilePosition, int iWhence)
-{
-  off_t newOffset = m_fileOffset;
-  if (m_pFp == NULL) return -1;
-
-  switch(iWhence)
-  {
-    case SEEK_SET:
-      newOffset = iFilePosition;
-      break;
-    case SEEK_END:
-      newOffset = m_fileSize+iFilePosition;
-      break;
-    case SEEK_CUR:
-      newOffset += iFilePosition;
-      break;
-  }
-
-  if ( newOffset < 0 || newOffset > m_fileSize)
-  {
-    CLog::Log(LOGERROR, "%s - Error( %"PRId64")", __FUNCTION__, newOffset);
-    return -1;
-  }
-
-  m_fileOffset = newOffset;
-  return (int64_t)m_fileOffset;
-}
-
-void CFileAFP::Close()
-{
-  CSingleLock lock(gAfpConnection);
-  if (m_pFp != NULL && m_pAfpVol)
-  {
-    CLog::Log(LOGDEBUG, "CFileAFP::Close closing fd %d", m_pFp->fileid);
-#ifdef USE_CVS_AFPFS
-    char *name = m_pFp->basename;
-#else
-    char *name = m_pFp->name;
-    if (strlen(name) == 0)
-      name = m_pFp->basename;
-#endif
-    gAfpConnection.GetImpl()->afp_wrap_close(m_pAfpVol, name, m_pFp);
-    delete m_pFp;
-    m_pFp = NULL;
-    m_pAfpVol = NULL;
-  }
-}
-
-int CFileAFP::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  CSingleLock lock(gAfpConnection);
-  if (m_pFp == NULL || !m_pAfpVol)
-   return -1;
-
-  int numberOfBytesWritten = 0;
-  uid_t uid;
-  gid_t gid;
-
-  // FIXME need a better way to get server's uid/gid
-  uid = getuid();
-  gid = getgid();
-#ifdef USE_CVS_AFPFS
-  char *name = m_pFp->basename;
-#else
-  char *name = m_pFp->name;
-  if (strlen(name) == 0)
-    name = m_pFp->basename;
-#endif
-  numberOfBytesWritten = gAfpConnection.GetImpl()->afp_wrap_write(m_pAfpVol,
-    name, (const char *)lpBuf, (size_t)uiBufSize, m_fileOffset, m_pFp, uid, gid);
-
-  return numberOfBytesWritten;
-}
-
-bool CFileAFP::Delete(const CURL& url)
-{
-  CSingleLock lock(gAfpConnection);
-  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
-    return false;
-
-  CStdString strPath = gAfpConnection.GetPath(url);
-
-  int result = gAfpConnection.GetImpl()->afp_wrap_unlink(gAfpConnection.GetVolume(), strPath.c_str());
-
-  if (result != 0)
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
-
-  return (result == 0);
-}
-
-bool CFileAFP::Rename(const CURL& url, const CURL& urlnew)
-{
-  CSingleLock lock(gAfpConnection);
-  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
-    return false;
-
-  CStdString strFile = gAfpConnection.GetPath(url);
-  CStdString strFileNew = gAfpConnection.GetPath(urlnew);
-
-  int result = gAfpConnection.GetImpl()->afp_wrap_rename(gAfpConnection.GetVolume(), strFile.c_str(), strFileNew.c_str());
-
-  if (result != 0)
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
-
-  return (result == 0);
-}
-
-bool CFileAFP::OpenForWrite(const CURL& url, bool bOverWrite)
-{
-
-  int ret = 0;
-  m_fileSize = 0;
-  m_fileOffset = 0;
-
-  Close();
-  CSingleLock lock(gAfpConnection);
-  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
-    return false;
-
-  // we can't open files like afp://file.f or afp://server/file.f
-  // if a file matches the if below return false, it can't exist on a afp share.
-  if (!IsValidFile(url.GetFileName()))
-    return false;
-
-  m_pAfpVol = gAfpConnection.GetVolume();
-
-  CStdString strPath = gAfpConnection.GetPath(url);
-
-  if (bOverWrite)
-  {
-    CLog::Log(LOGWARNING, "FileAFP::OpenForWrite() called with overwriting enabled! - %s", strPath.c_str());
-    ret = gAfpConnection.GetImpl()->afp_wrap_creat(m_pAfpVol, strPath.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-  }
-
-  ret = gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, strPath.c_str(), O_RDWR, &m_pFp);
-
-  if (ret || m_pFp == NULL)
-  {
-    // write error to logfile
-    CLog::Log(LOGERROR, "CFileAFP::Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strPath.c_str(), errno, strerror(errno));
-    return false;
-  }
-
-  // We've successfully opened the file!
-  return true;
-}
-
-bool CFileAFP::IsValidFile(const CStdString& strFileName)
-{
-  if (strFileName.Find('/') == -1   || // doesn't have sharename
-      strFileName.Right(2)  == "/." || // not current folder
-      strFileName.Right(3)  == "/..")  // not parent folder
-  {
-    return false;
-  }
-
-  return true;
-}
-#endif // HAS_FILESYSTEM_AFP
-#endif // _LINUX
diff --git a/xbmc/filesystem/FileAFP.h b/xbmc/filesystem/FileAFP.h
deleted file mode 100644 (file)
index bf6e0f9..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileAFP.h: interface for the CFileAFP class.
-#ifndef FILEAFP_H_
-#define FILEAFP_H_
-
-
-#ifdef _LINUX
-
-#include "IFile.h"
-#include "URL.h"
-#include "threads/CriticalSection.h"
-#include "DllLibAfp.h"
-
-// libafpclient includes
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-CStdString URLEncode(CStdString str);
-
-class CAfpConnection : public CCriticalSection
-{
-public:
-    enum eAfpConnectError
-    {
-      AfpOk     = 0,
-      AfpFailed = 1,
-      AfpAuth   = 2,
-    };
-    typedef enum eAfpConnectError afpConnnectError;
-
-   CAfpConnection();
-  ~CAfpConnection();
-
-  afpConnnectError      Connect(const CURL &url);
-  void                  Disconnect(void);
-  struct afp_server     *GetServer()    {return m_pAfpServer;}
-  struct afp_volume     *GetVolume()    {return m_pAfpVol;};
-  struct afp_url        *GetUrl()       {return m_pAfpUrl;};
-  CStdString            GetPath(const CURL &url);
-  DllLibAfp             *GetImpl()      {return m_pLibAfp;}
-  
-  const char            *GetConnectedIp() const { if(m_pAfpUrl) return m_pAfpUrl->servername;else return "";}
-  
-  //special stat which uses its own context
-  //needed for getting intervolume symlinks to work
-  //it uses the same global server connection
-  //but its own volume
-  int                   stat(const CURL &url, struct stat *statbuff);
-  
-  void AddActiveConnection();
-  void AddIdleConnection();
-  void CheckIfIdle();  
-  void Deinit();  
-
-private:
-  bool                  initLib(void);
-  bool                  connectVolume(const char *volumename, struct afp_volume *&pVolume);
-  void                  disconnectVolume(void);
-  CStdString            getAuthenticatedPath(const CURL &url);
-
-  int                   m_OpenConnections;
-  int                   m_IdleTimeout;
-  struct afp_server     *m_pAfpServer;
-  struct afp_volume     *m_pAfpVol;
-  struct afp_url        *m_pAfpUrl;
-  struct libafpclient   *m_pAfpClient;
-  DllLibAfp             *m_pLibAfp;
-  bool                  m_bDllInited;
-};
-
-extern CAfpConnection gAfpConnection;
-
-namespace XFILE
-{
-class CFileAFP : public IFile
-{
-public:
-  CFileAFP();
-  virtual ~CFileAFP();
-  virtual void          Close();
-  virtual int64_t       Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
-  virtual bool          Open(const CURL& url);
-  virtual bool          Exists(const CURL& url);
-  virtual int           Stat(const CURL& url, struct __stat64* buffer);
-  virtual int           Stat(struct __stat64* buffer);
-  virtual int64_t       GetLength();
-  virtual int64_t       GetPosition();
-  virtual int           Write(const void* lpBuf, int64_t uiBufSize);
-
-  virtual bool          OpenForWrite(const CURL& url, bool bOverWrite = false);
-  virtual bool          Delete(const CURL& url);
-  virtual bool          Rename(const CURL& url, const CURL& urlnew);
-  virtual int           GetChunkSize() {return 1;}
-  // implement iocontrol for seek_possible for preventing the stat in File class for
-  // getting this info ...
-  virtual int           IoControl(EIoControl request, void* param)
-                        { if (request == IOCTRL_SEEK_POSSIBLE) return 1;
-                          return -1;
-                        };
-
-protected:
-  bool                  IsValidFile(const CStdString& strFileName);
-
-  CURL                  m_url;
-  int64_t               m_fileSize;
-  off_t                 m_fileOffset; // current SEEK pointer
-  struct afp_file_info *m_pFp;
-  struct afp_volume    *m_pAfpVol;  
-};
-}
-#endif // _LINUX
-#endif // FILEAFP_H_
diff --git a/xbmc/filesystem/FileCDDA.cpp b/xbmc/filesystem/FileCDDA.cpp
deleted file mode 100644 (file)
index bae2d87..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "system.h"
-
-#ifdef HAS_DVD_DRIVE
-
-#include "FileCDDA.h"
-#include <sys/stat.h>
-#include "Util.h"
-#include "URL.h"
-#include "storage/MediaManager.h"
-#include "utils/log.h"
-#include "utils/URIUtils.h"
-
-using namespace MEDIA_DETECT;
-using namespace XFILE;
-
-CFileCDDA::CFileCDDA(void)
-{
-  m_pCdIo = NULL;
-  m_lsnStart = CDIO_INVALID_LSN;
-  m_lsnCurrent = CDIO_INVALID_LSN;
-  m_lsnEnd = CDIO_INVALID_LSN;
-  m_cdio = CLibcdio::GetInstance();
-}
-
-CFileCDDA::~CFileCDDA(void)
-{
-  Close();
-}
-
-bool CFileCDDA::Open(const CURL& url)
-{
-  CStdString strURL = url.GetWithoutFilename();
-
-  if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url))
-    return false;
-
-  // Open the dvd drive
-#ifdef _LINUX
-  m_pCdIo = m_cdio->cdio_open(g_mediaManager.TranslateDevicePath(strURL), DRIVER_UNKNOWN);
-#elif defined(_WIN32)
-  m_pCdIo = m_cdio->cdio_open_win32(g_mediaManager.TranslateDevicePath(strURL, true));
-#else
-  m_pCdIo = m_cdio->cdio_open_win32("D:");
-#endif
-  if (!m_pCdIo)
-  {
-    CLog::Log(LOGERROR, "file cdda: Opening the dvd drive failed");
-    return false;
-  }
-
-  int iTrack = GetTrackNum(url);
-
-  m_lsnStart = m_cdio->cdio_get_track_lsn(m_pCdIo, iTrack);
-  m_lsnEnd = m_cdio->cdio_get_track_last_lsn(m_pCdIo, iTrack);
-  m_lsnCurrent = m_lsnStart;
-
-  if (m_lsnStart == CDIO_INVALID_LSN || m_lsnEnd == CDIO_INVALID_LSN)
-  {
-    m_cdio->cdio_destroy(m_pCdIo);
-    m_pCdIo = NULL;
-    return false;
-  }
-
-  return true;
-}
-
-bool CFileCDDA::Exists(const CURL& url)
-{
-  if (!IsValidFile(url))
-    return false;
-
-  int iTrack = GetTrackNum(url);
-
-  if (!Open(url))
-    return false;
-
-  int iLastTrack = m_cdio->cdio_get_last_track_num(m_pCdIo);
-  if (iLastTrack == CDIO_INVALID_TRACK)
-    return false;
-
-  return (iTrack > 0 && iTrack <= iLastTrack);
-}
-
-int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer)
-{
-  if (Open(url))
-  {
-    memset(buffer, 0, sizeof(struct __stat64));
-    buffer->st_size = GetLength();
-    buffer->st_mode = _S_IFREG;
-    Close();
-    return 0;
-  }
-  errno = ENOENT;
-  return -1;
-}
-
-unsigned int CFileCDDA::Read(void* lpBuf, int64_t uiBufSize)
-{
-  if (!m_pCdIo || !g_mediaManager.IsDiscInDrive())
-    return 0;
-
-  int iSectorCount = (int)uiBufSize / CDIO_CD_FRAMESIZE_RAW;
-
-  if (iSectorCount <= 0)
-    return 0;
-
-  // Are there enough sectors left to read
-  if (m_lsnCurrent + iSectorCount > m_lsnEnd)
-    iSectorCount = m_lsnEnd - m_lsnCurrent;
-
-  int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount);
-
-  if ( iret != DRIVER_OP_SUCCESS)
-  {
-    CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret);
-    return 0;
-  }
-
-  m_lsnCurrent += iSectorCount;
-
-  return iSectorCount*CDIO_CD_FRAMESIZE_RAW;
-}
-
-int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
-{
-  if (!m_pCdIo)
-    return -1;
-
-  lsn_t lsnPosition = (int)iFilePosition / CDIO_CD_FRAMESIZE_RAW;
-
-  switch (iWhence)
-  {
-  case SEEK_SET:
-    // cur = pos
-    m_lsnCurrent = m_lsnStart + lsnPosition;
-    break;
-  case SEEK_CUR:
-    // cur += pos
-    m_lsnCurrent += lsnPosition;
-    break;
-  case SEEK_END:
-    // end += pos
-    m_lsnCurrent = m_lsnEnd + lsnPosition;
-    break;
-  default:
-    return -1;
-  }
-
-  return ((m_lsnCurrent -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
-}
-
-void CFileCDDA::Close()
-{
-  if (m_pCdIo)
-  {
-    m_cdio->cdio_destroy(m_pCdIo);
-    m_pCdIo = NULL;
-  }
-}
-
-int64_t CFileCDDA::GetPosition()
-{
-  if (!m_pCdIo)
-    return 0;
-
-  return ((m_lsnCurrent -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
-}
-
-int64_t CFileCDDA::GetLength()
-{
-  if (!m_pCdIo)
-    return 0;
-
-  return ((m_lsnEnd -m_lsnStart)*CDIO_CD_FRAMESIZE_RAW);
-}
-
-bool CFileCDDA::IsValidFile(const CURL& url)
-{
-  // Only .cdda files are supported
-  CStdString strExtension;
-  URIUtils::GetExtension(url.Get(), strExtension);
-  strExtension.MakeLower();
-
-  return (strExtension == ".cdda");
-}
-
-int CFileCDDA::GetTrackNum(const CURL& url)
-{
-  CStdString strFileName = url.Get();
-
-  // get track number from "cdda://local/01.cdda"
-  return atoi(strFileName.substr(13, strFileName.size() - 13 - 5).c_str());
-}
-
-#define SECTOR_COUNT 52 // max. sectors that can be read at once
-int CFileCDDA::GetChunkSize()
-{
-  return SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW;
-}
-
-#endif
-
diff --git a/xbmc/filesystem/FileCDDA.h b/xbmc/filesystem/FileCDDA.h
deleted file mode 100644 (file)
index e10e517..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "system.h" // for HAS_DVD_DRIVE
-
-#ifdef HAS_DVD_DRIVE
-
-#include "IFile.h"
-#include "storage/cdioSupport.h"
-
-namespace XFILE
-{
-class CFileCDDA : public IFile
-{
-public:
-  CFileCDDA(void);
-  virtual ~CFileCDDA(void);
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual int GetChunkSize();
-
-protected:
-  bool IsValidFile(const CURL& url);
-  int GetTrackNum(const CURL& url);
-
-protected:
-  CdIo_t* m_pCdIo;
-  lsn_t m_lsnStart;  // Start of m_iTrack in logical sector number
-  lsn_t m_lsnCurrent; // Position inside the track in logical sector number
-  lsn_t m_lsnEnd;   // End of m_iTrack in logical sector number
-  MEDIA_DETECT::CLibcdio* m_cdio;
-};
-}
-
-#endif
-
index fa47836..2911f0f 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "threads/SystemClock.h"
 #include "utils/AutoPtrHandle.h"
-#include "FileCache.h"
+#include "CacheFile.h"
 #include "threads/Thread.h"
 #include "File.h"
 #include "URL.h"
@@ -79,7 +79,7 @@ private:
 };
 
 
-CFileCache::CFileCache()
+CCacheFile::CCacheFile()
 {
    m_bDeleteCache = true;
    m_nSeekResult = 0;
@@ -95,7 +95,7 @@ CFileCache::CFileCache()
    m_cacheFull = false;
 }
 
-CFileCache::CFileCache(CCacheStrategy *pCache, bool bDeleteCache)
+CCacheFile::CCacheFile(CCacheStrategy *pCache, bool bDeleteCache)
 {
   m_pCache = pCache;
   m_bDeleteCache = bDeleteCache;
@@ -106,7 +106,7 @@ CFileCache::CFileCache(CCacheStrategy *pCache, bool bDeleteCache)
   m_chunkSize = 0;
 }
 
-CFileCache::~CFileCache()
+CCacheFile::~CCacheFile()
 {
   Close();
 
@@ -116,7 +116,7 @@ CFileCache::~CFileCache()
   m_pCache = NULL;
 }
 
-void CFileCache::SetCacheStrategy(CCacheStrategy *pCache, bool bDeleteCache)
+void CCacheFile::SetCacheStrategy(CCacheStrategy *pCache, bool bDeleteCache)
 {
   if (m_bDeleteCache && m_pCache)
     delete m_pCache;
@@ -125,22 +125,22 @@ void CFileCache::SetCacheStrategy(CCacheStrategy *pCache, bool bDeleteCache)
   m_bDeleteCache = bDeleteCache;
 }
 
-IFile *CFileCache::GetFileImp()
+IFile *CCacheFile::GetFileImp()
 {
   return m_source.GetImplemenation();
 }
 
-bool CFileCache::Open(const CURL& url)
+bool CCacheFile::Open(const CURL& url)
 {
   Close();
 
   CSingleLock lock(m_sync);
 
-  CLog::Log(LOGDEBUG,"CFileCache::Open - opening <%s> using cache", url.GetFileName().c_str());
+  CLog::Log(LOGDEBUG,"CCacheFile::Open - opening <%s> using cache", url.GetFileName().c_str());
 
   if (!m_pCache)
   {
-    CLog::Log(LOGERROR,"CFileCache::Open - no cache strategy defined");
+    CLog::Log(LOGERROR,"CCacheFile::Open - no cache strategy defined");
     return false;
   }
 
@@ -149,7 +149,7 @@ bool CFileCache::Open(const CURL& url)
   // open cache strategy
   if (m_pCache->Open() != CACHE_RC_OK)
   {
-    CLog::Log(LOGERROR,"CFileCache::Open - failed to open cache");
+    CLog::Log(LOGERROR,"CCacheFile::Open - failed to open cache");
     Close();
     return false;
   }
@@ -179,11 +179,11 @@ bool CFileCache::Open(const CURL& url)
   return true;
 }
 
-void CFileCache::Process()
+void CCacheFile::Process()
 {
   if (!m_pCache)
   {
-    CLog::Log(LOGERROR,"CFileCache::Process - sanity failed. no cache strategy");
+    CLog::Log(LOGERROR,"CCacheFile::Process - sanity failed. no cache strategy");
     return;
   }
 
@@ -245,7 +245,7 @@ void CFileCache::Process()
     int iRead = m_source.Read(buffer.get(), m_chunkSize);
     if (iRead == 0)
     {
-      CLog::Log(LOGINFO, "CFileCache::Process - Hit eof.");
+      CLog::Log(LOGINFO, "CCacheFile::Process - Hit eof.");
       m_pCache->EndOfInput();
 
       // The thread event will now also cause the wait of an event to return a false.
@@ -270,7 +270,7 @@ void CFileCache::Process()
       // done inside the cache strategy. only if unrecoverable error happened, WriteToCache would return error and we break.
       if (iWrite < 0)
       {
-        CLog::Log(LOGERROR,"CFileCache::Process - error writing to cache");
+        CLog::Log(LOGERROR,"CCacheFile::Process - error writing to cache");
         m_bStop = true;
         break;
       }
@@ -302,7 +302,7 @@ void CFileCache::Process()
   }
 }
 
-void CFileCache::OnExit()
+void CCacheFile::OnExit()
 {
   m_bStop = true;
 
@@ -314,17 +314,17 @@ void CFileCache::OnExit()
   m_seekEnded.Set();
 }
 
-bool CFileCache::Exists(const CURL& url)
+bool CCacheFile::Exists(const CURL& url)
 {
   return CFile::Exists(url.Get());
 }
 
-int CFileCache::Stat(const CURL& url, struct __stat64* buffer)
+int CCacheFile::Stat(const CURL& url, struct __stat64* buffer)
 {
   return CFile::Stat(url.Get(), buffer);
 }
 
-unsigned int CFileCache::Read(void* lpBuf, int64_t uiBufSize)
+unsigned int CCacheFile::Read(void* lpBuf, int64_t uiBufSize)
 {
   CSingleLock lock(m_sync);
   if (!m_pCache)
@@ -365,7 +365,7 @@ retry:
   return 0;
 }
 
-int64_t CFileCache::Seek(int64_t iFilePosition, int iWhence)
+int64_t CCacheFile::Seek(int64_t iFilePosition, int iWhence)
 {
   CSingleLock lock(m_sync);
 
@@ -422,7 +422,7 @@ int64_t CFileCache::Seek(int64_t iFilePosition, int iWhence)
   return m_nSeekResult;
 }
 
-void CFileCache::Close()
+void CCacheFile::Close()
 {
   StopThread();
 
@@ -433,17 +433,17 @@ void CFileCache::Close()
   m_source.Close();
 }
 
-int64_t CFileCache::GetPosition()
+int64_t CCacheFile::GetPosition()
 {
   return m_readPos;
 }
 
-int64_t CFileCache::GetLength()
+int64_t CCacheFile::GetLength()
 {
   return m_source.GetLength();
 }
 
-void CFileCache::StopThread(bool bWait /*= true*/)
+void CCacheFile::StopThread(bool bWait /*= true*/)
 {
   m_bStop = true;
   //Process could be waiting for seekEvent
@@ -451,7 +451,7 @@ void CFileCache::StopThread(bool bWait /*= true*/)
   CThread::StopThread(bWait);
 }
 
-CStdString CFileCache::GetContent()
+CStdString CCacheFile::GetContent()
 {
   if (!m_source.GetImplemenation())
     return IFile::GetContent();
@@ -459,7 +459,7 @@ CStdString CFileCache::GetContent()
   return m_source.GetImplemenation()->GetContent();
 }
 
-int CFileCache::IoControl(EIoControl request, void* param)
+int CCacheFile::IoControl(EIoControl request, void* param)
 {
   if (request == IOCTRL_CACHE_STATUS)
   {
index 5509f82..c4b414d 100644 (file)
 namespace XFILE
 {
 
-  class CFileCache : public IFile, public CThread
+  class CCacheFile : public IFile, public CThread
   {
   public:
-    CFileCache();
-    CFileCache(CCacheStrategy *pCache, bool bDeleteCache=true);
-    virtual ~CFileCache();
+    CCacheFile();
+    CCacheFile(CCacheStrategy *pCache, bool bDeleteCache=true);
+    virtual ~CCacheFile();
 
     void SetCacheStrategy(CCacheStrategy *pCache, bool bDeleteCache=true);
 
diff --git a/xbmc/filesystem/FileCurl.cpp b/xbmc/filesystem/FileCurl.cpp
deleted file mode 100644 (file)
index e8783e7..0000000
+++ /dev/null
@@ -1,1400 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileCurl.h"
-#include "utils/URIUtils.h"
-#include "Util.h"
-#include "URL.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
-#include "File.h"
-
-#include <vector>
-#include <climits>
-
-#ifdef _LINUX
-#include <errno.h>
-#include <inttypes.h>
-#include "../linux/XFileUtils.h"
-#include "../linux/XTimeUtils.h"
-#include "../linux/ConvUtils.h"
-#endif
-
-#include "DllLibCurl.h"
-#include "FileShoutcast.h"
-#include "SpecialProtocol.h"
-#include "utils/CharsetConverter.h"
-#include "utils/log.h"
-
-using namespace XFILE;
-using namespace XCURL;
-
-#define XMIN(a,b) ((a)<(b)?(a):(b))
-#define FITS_INT(a) (((a) <= INT_MAX) && ((a) >= INT_MIN))
-
-#define dllselect select
-
-// curl calls this routine to debug
-extern "C" int debug_callback(CURL_HANDLE *handle, curl_infotype info, char *output, size_t size, void *data)
-{
-  if (info == CURLINFO_DATA_IN || info == CURLINFO_DATA_OUT)
-    return 0;
-
-  // Only shown cURL debug into with loglevel DEBUG_SAMBA or higher
-  if( g_advancedSettings.m_logLevel < LOG_LEVEL_DEBUG_SAMBA )
-    return 0;
-
-  CStdString strLine;
-  strLine.append(output, size);
-  std::vector<CStdString> vecLines;
-  CUtil::Tokenize(strLine, vecLines, "\r\n");
-  std::vector<CStdString>::const_iterator it = vecLines.begin();
-
-  while (it != vecLines.end()) {
-    CLog::Log(LOGDEBUG, "Curl::Debug %s", (*it).c_str());
-    it++;
-  }
-  return 0;
-}
-
-/* curl calls this routine to get more data */
-extern "C" size_t write_callback(char *buffer,
-               size_t size,
-               size_t nitems,
-               void *userp)
-{
-  if(userp == NULL) return 0;
-
-  CFileCurl::CReadState *state = (CFileCurl::CReadState *)userp;
-  return state->WriteCallback(buffer, size, nitems);
-}
-
-extern "C" size_t header_callback(void *ptr, size_t size, size_t nmemb, void *stream)
-{
-  CFileCurl::CReadState *state = (CFileCurl::CReadState *)stream;
-  return state->HeaderCallback(ptr, size, nmemb);
-}
-
-/* fix for silly behavior of realloc */
-static inline void* realloc_simple(void *ptr, size_t size)
-{
-  void *ptr2 = realloc(ptr, size);
-  if(ptr && !ptr2 && size > 0)
-  {
-    free(ptr);
-    return NULL;
-  }
-  else
-    return ptr2;
-}
-
-size_t CFileCurl::CReadState::HeaderCallback(void *ptr, size_t size, size_t nmemb)
-{
-  // clear any previous header
-  if(m_headerdone)
-  {
-    m_httpheader.Clear();
-    m_headerdone = false;
-  }
-
-  // libcurl doc says that this info is not always \0 terminated
-  char* strData = (char*)ptr;
-  int iSize = size * nmemb;
-
-  if (strData[iSize] != 0)
-  {
-    strData = (char*)malloc(iSize + 1);
-    strncpy(strData, (char*)ptr, iSize);
-    strData[iSize] = 0;
-  }
-  else strData = strdup((char*)ptr);
-
-  if(strcmp(strData, "\r\n") == 0)
-    m_headerdone = true;
-
-  m_httpheader.Parse(strData);
-
-  free(strData);
-
-  return iSize;
-}
-
-size_t CFileCurl::CReadState::WriteCallback(char *buffer, size_t size, size_t nitems)
-{
-  unsigned int amount = size * nitems;
-//  CLog::Log(LOGDEBUG, "CFileCurl::WriteCallback (%p) with %i bytes, readsize = %i, writesize = %i", this, amount, m_buffer.getMaxReadSize(), m_buffer.getMaxWriteSize() - m_overflowSize);
-  if (m_overflowSize)
-  {
-    // we have our overflow buffer - first get rid of as much as we can
-    unsigned int maxWriteable = XMIN((unsigned int)m_buffer.getMaxWriteSize(), m_overflowSize);
-    if (maxWriteable)
-    {
-      if (!m_buffer.WriteData(m_overflowBuffer, maxWriteable))
-        CLog::Log(LOGERROR, "Unable to write to buffer - what's up?");
-      if (m_overflowSize > maxWriteable)
-      { // still have some more - copy it down
-        memmove(m_overflowBuffer, m_overflowBuffer + maxWriteable, m_overflowSize - maxWriteable);
-      }
-      m_overflowSize -= maxWriteable;
-    }
-  }
-  // ok, now copy the data into our ring buffer
-  unsigned int maxWriteable = XMIN((unsigned int)m_buffer.getMaxWriteSize(), amount);
-  if (maxWriteable)
-  {
-    if (!m_buffer.WriteData(buffer, maxWriteable))
-    {
-      CLog::Log(LOGERROR, "%s - Unable to write to buffer with %i bytes - what's up?", __FUNCTION__, maxWriteable);
-    }
-    else
-    {
-      amount -= maxWriteable;
-      buffer += maxWriteable;
-    }
-  }
-  if (amount)
-  {
-//    CLog::Log(LOGDEBUG, "CFileCurl::WriteCallback(%p) not enough free space for %i bytes", (void*)this,  amount);
-
-    m_overflowBuffer = (char*)realloc_simple(m_overflowBuffer, amount + m_overflowSize);
-    if(m_overflowBuffer == NULL)
-    {
-      CLog::Log(LOGWARNING, "%s - Failed to grow overflow buffer from %i bytes to %i bytes", __FUNCTION__, m_overflowSize, amount + m_overflowSize);
-      return 0;
-    }
-    memcpy(m_overflowBuffer + m_overflowSize, buffer, amount);
-    m_overflowSize += amount;
-  }
-  return size * nitems;
-}
-
-CFileCurl::CReadState::CReadState()
-{
-  m_easyHandle = NULL;
-  m_multiHandle = NULL;
-  m_overflowBuffer = NULL;
-  m_overflowSize = 0;
-  m_filePos = 0;
-  m_fileSize = 0;
-  m_bufferSize = 0;
-  m_cancelled = false;
-  m_bFirstLoop = true;
-  m_headerdone = false;
-}
-
-CFileCurl::CReadState::~CReadState()
-{
-  Disconnect();
-
-  if(m_easyHandle)
-    g_curlInterface.easy_release(&m_easyHandle, &m_multiHandle);
-}
-
-bool CFileCurl::CReadState::Seek(int64_t pos)
-{
-  if(pos == m_filePos)
-    return true;
-
-  if(FITS_INT(pos - m_filePos) && m_buffer.SkipBytes((int)(pos - m_filePos)))
-  {
-    m_filePos = pos;
-    return true;
-  }
-
-  if(pos > m_filePos && pos < m_filePos + m_bufferSize)
-  {
-    int len = m_buffer.getMaxReadSize();
-    m_filePos += len;
-    m_buffer.SkipBytes(len);
-    if(!FillBuffer(m_bufferSize))
-    {
-      if(!m_buffer.SkipBytes(-len))
-        CLog::Log(LOGERROR, "%s - Failed to restore position after failed fill", __FUNCTION__);
-      else
-        m_filePos -= len;
-      return false;
-    }
-
-    if(!FITS_INT(pos - m_filePos) || !m_buffer.SkipBytes((int)(pos - m_filePos)))
-    {
-      CLog::Log(LOGERROR, "%s - Failed to skip to position after having filled buffer", __FUNCTION__);
-      if(!m_buffer.SkipBytes(-len))
-        CLog::Log(LOGERROR, "%s - Failed to restore position after failed seek", __FUNCTION__);
-      else
-        m_filePos -= len;
-      return false;
-    }
-    m_filePos = pos;
-    return true;
-  }
-  return false;
-}
-
-long CFileCurl::CReadState::Connect(unsigned int size)
-{
-  g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
-  g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
-
-  m_bufferSize = size;
-  m_buffer.Destroy();
-  m_buffer.Create(size * 3);
-  m_headerdone = false;
-
-  // read some data in to try and obtain the length
-  // maybe there's a better way to get this info??
-  m_stillRunning = 1;
-  if (!FillBuffer(1))
-  {
-    CLog::Log(LOGERROR, "CFileCurl::CReadState::Open, didn't get any data from stream.");
-    return -1;
-  }
-
-  double length;
-  if (CURLE_OK == g_curlInterface.easy_getinfo(m_easyHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &length))
-  {
-    if (length < 0)
-      length = 0.0;
-    m_fileSize = m_filePos + (int64_t)length;
-  }
-
-  long response;
-  if (CURLE_OK == g_curlInterface.easy_getinfo(m_easyHandle, CURLINFO_RESPONSE_CODE, &response))
-    return response;
-
-  return -1;
-}
-
-void CFileCurl::CReadState::Disconnect()
-{
-  if(m_multiHandle && m_easyHandle)
-    g_curlInterface.multi_remove_handle(m_multiHandle, m_easyHandle);
-
-  m_buffer.Clear();
-  free(m_overflowBuffer);
-  m_overflowBuffer = NULL;
-  m_overflowSize = 0;
-  m_filePos = 0;
-  m_fileSize = 0;
-  m_bufferSize = 0;
-}
-
-
-CFileCurl::~CFileCurl()
-{
-  if (m_opened)
-    Close();
-  delete m_state;
-  g_curlInterface.Unload();
-}
-
-CFileCurl::CFileCurl()
-{
-  g_curlInterface.Load(); // loads the curl dll and resolves exports etc.
-  m_curlAliasList = NULL;
-  m_curlHeaderList = NULL;
-  m_opened = false;
-  m_multisession  = true;
-  m_seekable = true;
-  m_useOldHttpVersion = false;
-  m_connecttimeout = 0;
-  m_lowspeedtime = 0;
-  m_ftpauth = "";
-  m_ftpport = "";
-  m_ftppasvip = false;
-  m_bufferSize = 32768;
-  m_binary = true;
-  m_postdata = "";
-  m_username = "";
-  m_password = "";
-  m_httpauth = "";
-  m_state = new CReadState();
-  m_skipshout = false;
-}
-
-//Has to be called before Open()
-void CFileCurl::SetBufferSize(unsigned int size)
-{
-  m_bufferSize = size;
-}
-
-void CFileCurl::Close()
-{
-  m_state->Disconnect();
-
-  m_url.Empty();
-  m_referer.Empty();
-  m_cookie.Empty();
-
-  /* cleanup */
-  if( m_curlAliasList )
-    g_curlInterface.slist_free_all(m_curlAliasList);
-  if( m_curlHeaderList )
-    g_curlInterface.slist_free_all(m_curlHeaderList);
-
-  m_curlAliasList = NULL;
-  m_curlHeaderList = NULL;
-  m_opened = false;
-}
-
-void CFileCurl::SetCommonOptions(CReadState* state)
-{
-  CURL_HANDLE* h = state->m_easyHandle;
-
-  g_curlInterface.easy_reset(h);
-
-  g_curlInterface.easy_setopt(h, CURLOPT_DEBUGFUNCTION, debug_callback);
-
-  if( g_advancedSettings.m_logLevel >= LOG_LEVEL_DEBUG )
-    g_curlInterface.easy_setopt(h, CURLOPT_VERBOSE, TRUE);
-  else
-    g_curlInterface.easy_setopt(h, CURLOPT_VERBOSE, FALSE);
-
-  g_curlInterface.easy_setopt(h, CURLOPT_WRITEDATA, state);
-  g_curlInterface.easy_setopt(h, CURLOPT_WRITEFUNCTION, write_callback);
-
-  // set username and password for current handle
-  if (m_username.length() > 0 && m_password.length() > 0)
-  {
-    CStdString userpwd = m_username + ":" + m_password;
-    g_curlInterface.easy_setopt(h, CURLOPT_USERPWD, userpwd.c_str());
-  }
-
-  // make sure headers are seperated from the data stream
-  g_curlInterface.easy_setopt(h, CURLOPT_WRITEHEADER, state);
-  g_curlInterface.easy_setopt(h, CURLOPT_HEADERFUNCTION, header_callback);
-  g_curlInterface.easy_setopt(h, CURLOPT_HEADER, FALSE);
-
-  g_curlInterface.easy_setopt(h, CURLOPT_FTP_USE_EPSV, 0); // turn off epsv
-
-  // Allow us to follow two redirects
-  g_curlInterface.easy_setopt(h, CURLOPT_FOLLOWLOCATION, TRUE);
-  g_curlInterface.easy_setopt(h, CURLOPT_MAXREDIRS, 5);
-
-  // Enable cookie engine for current handle to re-use them in future requests
-  CStdString strCookieFile;
-  CStdString strTempPath = CSpecialProtocol::TranslatePath(g_advancedSettings.m_cachePath);
-  URIUtils::AddFileToFolder(strTempPath, "cookies.dat", strCookieFile);
-
-  g_curlInterface.easy_setopt(h, CURLOPT_COOKIEFILE, strCookieFile.c_str());
-  g_curlInterface.easy_setopt(h, CURLOPT_COOKIEJAR, strCookieFile.c_str());
-
-  // Set custom cookie if requested
-  if (!m_cookie.IsEmpty())
-    g_curlInterface.easy_setopt(h, CURLOPT_COOKIE, m_cookie.c_str());
-
-  g_curlInterface.easy_setopt(h, CURLOPT_COOKIELIST, "FLUSH");
-
-  // When using multiple threads you should set the CURLOPT_NOSIGNAL option to
-  // TRUE for all handles. Everything will work fine except that timeouts are not
-  // honored during the DNS lookup - which you can work around by building libcurl
-  // with c-ares support. c-ares is a library that provides asynchronous name
-  // resolves. Unfortunately, c-ares does not yet support IPv6.
-  g_curlInterface.easy_setopt(h, CURLOPT_NOSIGNAL, TRUE);
-
-  // not interested in failed requests
-  g_curlInterface.easy_setopt(h, CURLOPT_FAILONERROR, 1);
-
-  // enable support for icecast / shoutcast streams
-  m_curlAliasList = g_curlInterface.slist_append(m_curlAliasList, "ICY 200 OK");
-  g_curlInterface.easy_setopt(h, CURLOPT_HTTP200ALIASES, m_curlAliasList);
-
-  // never verify peer, we don't have any certificates to do this
-  g_curlInterface.easy_setopt(h, CURLOPT_SSL_VERIFYPEER, 0);
-  g_curlInterface.easy_setopt(h, CURLOPT_SSL_VERIFYHOST, 0);
-
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_URL, m_url.c_str());
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TRANSFERTEXT, FALSE);
-
-  // setup POST data if it exists
-  if (!m_postdata.IsEmpty())
-  {
-    g_curlInterface.easy_setopt(h, CURLOPT_POST, 1 );
-    g_curlInterface.easy_setopt(h, CURLOPT_POSTFIELDSIZE, m_postdata.length());
-    g_curlInterface.easy_setopt(h, CURLOPT_POSTFIELDS, m_postdata.c_str());
-  }
-
-  // setup Referer header if needed
-  if (!m_referer.IsEmpty())
-    g_curlInterface.easy_setopt(h, CURLOPT_REFERER, m_referer.c_str());
-  else
-  {
-    g_curlInterface.easy_setopt(h, CURLOPT_REFERER, NULL);
-    g_curlInterface.easy_setopt(h, CURLOPT_AUTOREFERER, TRUE);
-  }
-
-  // setup any requested authentication
-  if( m_ftpauth.length() > 0 )
-  {
-    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
-    if( m_ftpauth.Equals("any") )
-      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_DEFAULT);
-    else if( m_ftpauth.Equals("ssl") )
-      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_SSL);
-    else if( m_ftpauth.Equals("tls") )
-      g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS);
-  }
-
-  // setup requested http authentication method
-  if(m_httpauth.length() > 0)
-  {
-    if( m_httpauth.Equals("any") )
-      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
-    else if( m_httpauth.Equals("anysafe") )
-      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
-    else if( m_httpauth.Equals("digest") )
-      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
-    else if( m_httpauth.Equals("ntlm") )
-      g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
-  }
-
-  // allow passive mode for ftp
-  if( m_ftpport.length() > 0 )
-    g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, m_ftpport.c_str());
-  else
-    g_curlInterface.easy_setopt(h, CURLOPT_FTPPORT, NULL);
-
-  // allow curl to not use the ip address in the returned pasv response
-  if( m_ftppasvip )
-    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SKIP_PASV_IP, 0);
-  else
-    g_curlInterface.easy_setopt(h, CURLOPT_FTP_SKIP_PASV_IP, 1);
-
-  // setup Content-Encoding if requested
-  if( m_contentencoding.length() > 0 )
-    g_curlInterface.easy_setopt(h, CURLOPT_ENCODING, m_contentencoding.c_str());
-
-  if (m_userAgent.length() > 0)
-    g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, m_userAgent.c_str());
-  else /* set some default agent as shoutcast doesn't return proper stuff otherwise */
-    g_curlInterface.easy_setopt(h, CURLOPT_USERAGENT, g_settings.m_userAgent.c_str());
-
-  if (m_useOldHttpVersion)
-    g_curlInterface.easy_setopt(h, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-  else
-    SetRequestHeader("Connection", "keep-alive");
-
-  if (g_advancedSettings.m_curlDisableIPV6)
-    g_curlInterface.easy_setopt(h, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
-
-  if (m_proxy.length() > 0)
-  {
-    g_curlInterface.easy_setopt(h, CURLOPT_PROXY, m_proxy.c_str());
-    if (m_proxyuserpass.length() > 0)
-      g_curlInterface.easy_setopt(h, CURLOPT_PROXYUSERPWD, m_proxyuserpass.c_str());
-
-  }
-  if (m_customrequest.length() > 0)
-    g_curlInterface.easy_setopt(h, CURLOPT_CUSTOMREQUEST, m_customrequest.c_str());
-
-  if (m_connecttimeout == 0)
-    m_connecttimeout = g_advancedSettings.m_curlconnecttimeout;
-
-  // set our timeouts, we abort connection after m_timeout, and reads after no data for m_timeout seconds
-  g_curlInterface.easy_setopt(h, CURLOPT_CONNECTTIMEOUT, m_connecttimeout);
-
-  // We abort in case we transfer less than 1byte/second
-  g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_LIMIT, 1);
-
-  if (m_lowspeedtime == 0)
-    m_lowspeedtime = g_advancedSettings.m_curllowspeedtime;
-
-  // Set the lowspeed time very low as it seems Curl takes much longer to detect a lowspeed condition
-  g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_TIME, m_lowspeedtime);
-}
-
-void CFileCurl::SetRequestHeaders(CReadState* state)
-{
-  if(m_curlHeaderList)
-  {
-    g_curlInterface.slist_free_all(m_curlHeaderList);
-    m_curlHeaderList = NULL;
-  }
-
-  MAPHTTPHEADERS::iterator it;
-  for(it = m_requestheaders.begin(); it != m_requestheaders.end(); it++)
-  {
-    CStdString buffer = it->first + ": " + it->second;
-    m_curlHeaderList = g_curlInterface.slist_append(m_curlHeaderList, buffer.c_str());
-  }
-
-  // add user defined headers
-  if (m_curlHeaderList && state->m_easyHandle)
-    g_curlInterface.easy_setopt(state->m_easyHandle, CURLOPT_HTTPHEADER, m_curlHeaderList);
-
-}
-
-void CFileCurl::SetCorrectHeaders(CReadState* state)
-{
-  CHttpHeader& h = state->m_httpheader;
-  /* workaround for shoutcast server wich doesn't set content type on standard mp3 */
-  if( h.GetMimeType().IsEmpty() )
-  {
-    if( !h.GetValue("icy-notice1").IsEmpty()
-    || !h.GetValue("icy-name").IsEmpty()
-    || !h.GetValue("icy-br").IsEmpty() )
-    h.Parse("Content-Type: audio/mpeg\r\n");
-  }
-
-  /* hack for google video */
-  if ( h.GetMimeType().Equals("text/html")
-  &&  !h.GetValue("Content-Disposition").IsEmpty() )
-  {
-    CStdString strValue = h.GetValue("Content-Disposition");
-    if (strValue.Find("filename=") > -1 && strValue.Find(".flv") > -1)
-      h.Parse("Content-Type: video/flv\r\n");
-  }
-}
-
-void CFileCurl::ParseAndCorrectUrl(CURL &url2)
-{
-  CStdString strProtocol = url2.GetTranslatedProtocol();
-  url2.SetProtocol(strProtocol);
-
-  if( strProtocol.Equals("ftp")
-  ||  strProtocol.Equals("ftps") )
-  {
-    /* this is uggly, depending on from where   */
-    /* we get the link it may or may not be     */
-    /* url encoded. if handed from ftpdirectory */
-    /* it won't be so let's handle that case    */
-
-    CStdString partial, filename(url2.GetFileName());
-    CStdStringArray array;
-
-    /* our current client doesn't support utf8 */
-    g_charsetConverter.utf8ToStringCharset(filename);
-
-    /* TODO: create a tokenizer that doesn't skip empty's */
-    CUtil::Tokenize(filename, array, "/");
-    filename.Empty();
-    for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
-    {
-      if(it != array.begin())
-        filename += "/";
-
-      partial = *it;
-      CURL::Encode(partial);
-      filename += partial;
-    }
-
-    /* make sure we keep slashes */
-    if(url2.GetFileName().Right(1) == "/")
-      filename += "/";
-
-    url2.SetFileName(filename);
-
-    CStdString options = url2.GetOptions().Mid(1);
-    options.TrimRight('/'); // hack for trailing slashes being added from source
-
-    m_ftpauth = "";
-    m_ftpport = "";
-    m_ftppasvip = false;
-
-    /* parse options given */
-    CUtil::Tokenize(options, array, "&");
-    for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
-    {
-      CStdString name, value;
-      int pos = it->Find('=');
-      if(pos >= 0)
-      {
-        name = it->Left(pos);
-        value = it->Mid(pos+1, it->size());
-      }
-      else
-      {
-        name = (*it);
-        value = "";
-      }
-
-      if(name.Equals("auth"))
-      {
-        m_ftpauth = value;
-        if(m_ftpauth.IsEmpty())
-          m_ftpauth = "any";
-      }
-      else if(name.Equals("active"))
-      {
-        m_ftpport = value;
-        if(value.IsEmpty())
-          m_ftpport = "-";
-      }
-      else if(name.Equals("pasvip"))
-      {
-        if(value == "0")
-          m_ftppasvip = false;
-        else
-          m_ftppasvip = true;
-      }
-    }
-
-    /* ftp has no options */
-    url2.SetOptions("");
-  }
-  else if( strProtocol.Equals("http")
-       ||  strProtocol.Equals("https"))
-  {
-    if (g_guiSettings.GetBool("network.usehttpproxy") && m_proxy.IsEmpty())
-    {
-      m_proxy = "http://" + g_guiSettings.GetString("network.httpproxyserver");
-      m_proxy += ":" + g_guiSettings.GetString("network.httpproxyport");
-      if (g_guiSettings.GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
-      {
-        m_proxyuserpass = g_guiSettings.GetString("network.httpproxyusername");
-        m_proxyuserpass += ":" + g_guiSettings.GetString("network.httpproxypassword");
-      }
-      CLog::Log(LOGDEBUG, "Using proxy %s", m_proxy.c_str());
-    }
-
-    // get username and password
-    m_username = url2.GetUserName();
-    m_password = url2.GetPassWord();
-
-    // handle any protocol options
-    CStdString options = url2.GetProtocolOptions();
-    options.TrimRight('/'); // hack for trailing slashes being added from source
-    if (options.length() > 0)
-    {
-      // clear protocol options
-      url2.SetProtocolOptions("");
-      // set xbmc headers
-      CStdStringArray array;
-      CUtil::Tokenize(options, array, "&");
-      for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
-      {
-        // parse name, value
-        CStdString name, value;
-        int pos = it->Find('=');
-        if(pos >= 0)
-        {
-          name = it->Left(pos);
-          value = it->Mid(pos+1, it->size());
-        }
-        else
-        {
-          name = (*it);
-          value = "";
-        }
-
-        // url decode value
-        CURL::Decode(value);
-
-        if(name.Equals("auth"))
-        {
-          m_httpauth = value;
-          if(m_httpauth.IsEmpty())
-            m_httpauth = "any";
-        }
-        else if (name.Equals("Referer"))
-          SetReferer(value);
-        else if (name.Equals("User-Agent"))
-          SetUserAgent(value);
-        else if (name.Equals("Cookie"))
-          SetCookie(value);
-        else if (name.Equals("Encoding"))
-          SetContentEncoding(value);
-        else if (name.Equals("noshout") && value.Equals("true"))
-          m_skipshout = true;
-        else
-          SetRequestHeader(name, value);
-      }
-    }
-  }
-
-  if (m_username.length() > 0 && m_password.length() > 0)
-    m_url = url2.GetWithoutUserDetails();
-  else
-    m_url = url2.Get();
-}
-
-bool CFileCurl::Post(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML)
-{
-  return Service(strURL, strPostData, strHTML);
-}
-
-bool CFileCurl::Get(const CStdString& strURL, CStdString& strHTML)
-{
-  return Service(strURL, "", strHTML);
-}
-
-bool CFileCurl::Service(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML)
-{
-  m_postdata = strPostData;
-  if (Open(strURL))
-  {
-    if (ReadData(strHTML))
-    {
-      Close();
-      return true;
-    }
-  }
-  Close();
-  return false;
-}
-
-bool CFileCurl::ReadData(CStdString& strHTML)
-{
-  int size_read = 0;
-  int data_size = 0;
-  strHTML = "";
-  char buffer[16384];
-  while( (size_read = Read(buffer, sizeof(buffer)-1) ) > 0 )
-  {
-    buffer[size_read] = 0;
-    strHTML.append(buffer, size_read);
-    data_size += size_read;
-  }
-  if (m_state->m_cancelled)
-    return false;
-  return true;
-}
-
-bool CFileCurl::Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize)
-{
-  CLog::Log(LOGINFO, "Download: %s->%s", strURL.c_str(), strFileName.c_str());
-
-  CStdString strData;
-  if (!Get(strURL, strData))
-    return false;
-
-  XFILE::CFile file;
-  if (!file.OpenForWrite(strFileName, true))
-  {
-    CLog::Log(LOGERROR, "Unable to open file %s: %u",
-    strFileName.c_str(), GetLastError());
-    return false;
-  }
-  if (strData.size())
-    file.Write(strData.c_str(), strData.size());
-  file.Close();
-
-  if (pdwSize != NULL)
-  {
-    *pdwSize = strData.size();
-  }
-
-  return true;
-}
-
-// Detect whether we are "online" or not! Very simple and dirty!
-bool CFileCurl::IsInternet(bool checkDNS /* = true */)
-{
-  CStdString strURL = "http://www.google.com";
-  if (!checkDNS)
-    strURL = "http://74.125.19.103"; // www.google.com ip
-
-  bool found = Exists(strURL);
-  Close();
-
-  return found;
-}
-
-void CFileCurl::Cancel()
-{
-  m_state->m_cancelled = true;
-  while (m_opened)
-    Sleep(1);
-}
-
-void CFileCurl::Reset()
-{
-  m_state->m_cancelled = false;
-}
-
-bool CFileCurl::Open(const CURL& url)
-{
-
-  m_opened = true;
-
-  CURL url2(url);
-  ParseAndCorrectUrl(url2);
-
-  CLog::Log(LOGDEBUG, "FileCurl::Open(%p) %s", (void*)this, m_url.c_str());
-
-  ASSERT(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle));
-  if( m_state->m_easyHandle == NULL )
-    g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, &m_state->m_multiHandle );
-
-  // setup common curl options
-  SetCommonOptions(m_state);
-  SetRequestHeaders(m_state);
-
-  long response = m_state->Connect(m_bufferSize);
-  if( response < 0 || response >= 400)
-    return false;
-
-  SetCorrectHeaders(m_state);
-
-  // since we can't know the stream size up front if we're gzipped/deflated
-  // flag the stream with an unknown file size rather than the compressed
-  // file size.
-  if (m_contentencoding.size() > 0)
-    m_state->m_fileSize = 0;
-
-  // check if this stream is a shoutcast stream. sometimes checking the protocol line is not enough so examine other headers as well.
-  // shoutcast streams should be handled by FileShoutcast.
-  if ((m_state->m_httpheader.GetProtoLine().Left(3) == "ICY" || !m_state->m_httpheader.GetValue("icy-notice1").IsEmpty()
-     || !m_state->m_httpheader.GetValue("icy-name").IsEmpty()
-     || !m_state->m_httpheader.GetValue("icy-br").IsEmpty()) && !m_skipshout)
-  {
-    CLog::Log(LOGDEBUG,"FileCurl - file <%s> is a shoutcast stream. re-opening", m_url.c_str());
-    throw new CRedirectException(new CFileShoutcast);
-  }
-
-  m_multisession = false;
-  if(m_url.Left(5).Equals("http:") || m_url.Left(6).Equals("https:"))
-  {
-    m_multisession = true;
-    if(m_state->m_httpheader.GetValue("Server").Find("Portable SDK for UPnP devices") >= 0)
-    {
-      CLog::Log(LOGWARNING, "FileCurl - disabling multi session due to broken libupnp server");
-      m_multisession = false;
-    }
-  }
-
-  if(m_state->m_httpheader.GetValue("Transfer-Encoding").Equals("chunked"))
-    m_state->m_fileSize = 0;
-
-  m_seekable = false;
-  if(m_state->m_fileSize > 0)
-  {
-    m_seekable = true;
-
-    if(url2.GetProtocol().Equals("http")
-    || url2.GetProtocol().Equals("https"))
-    {
-      // if server says explicitly it can't seek, respect that
-      if(m_state->m_httpheader.GetValue("Accept-Ranges").Equals("none"))
-        m_seekable = false;
-    }
-  }
-
-  char* efurl;
-  if (CURLE_OK == g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_EFFECTIVE_URL,&efurl) && efurl)
-    m_url = efurl;
-
-  return true;
-}
-
-bool CFileCurl::CReadState::ReadString(char *szLine, int iLineLength)
-{
-  unsigned int want = (unsigned int)iLineLength;
-
-  if((m_fileSize == 0 || m_filePos < m_fileSize) && !FillBuffer(want))
-    return false;
-
-  // ensure only available data is considered
-  want = XMIN((unsigned int)m_buffer.getMaxReadSize(), want);
-
-  /* check if we finished prematurely */
-  if (!m_stillRunning && (m_fileSize == 0 || m_filePos != m_fileSize) && !want)
-  {
-    if (m_fileSize != 0)
-      CLog::Log(LOGWARNING, "%s - Transfer ended before entire file was retrieved pos %"PRId64", size %"PRId64, __FUNCTION__, m_filePos, m_fileSize);
-
-    return false;
-  }
-
-  char* pLine = szLine;
-  do
-  {
-    if (!m_buffer.ReadData(pLine, 1))
-      break;
-
-    pLine++;
-  } while (((pLine - 1)[0] != '\n') && ((unsigned int)(pLine - szLine) < want));
-  pLine[0] = 0;
-  m_filePos += (pLine - szLine);
-  return (bool)((pLine - szLine) > 0);
-}
-
-bool CFileCurl::Exists(const CURL& url)
-{
-  // if file is already running, get info from it
-  if( m_opened )
-  {
-    CLog::Log(LOGWARNING, "%s - Exist called on open file", __FUNCTION__);
-    return true;
-  }
-
-  CURL url2(url);
-  ParseAndCorrectUrl(url2);
-
-  ASSERT(m_state->m_easyHandle == NULL);
-  g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, NULL);
-
-  SetCommonOptions(m_state);
-  SetRequestHeaders(m_state);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_NOBODY, 1);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
-
-  if(url2.GetProtocol() == "ftp")
-  {
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
-  }
-
-  CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
-  g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
-
-  if (result == CURLE_WRITE_ERROR || result == CURLE_OK)
-    return true;
-
-  errno = ENOENT;
-  return false;
-}
-
-int64_t CFileCurl::Seek(int64_t iFilePosition, int iWhence)
-{
-  int64_t nextPos = m_state->m_filePos;
-  switch(iWhence)
-  {
-    case SEEK_SET:
-      nextPos = iFilePosition;
-      break;
-    case SEEK_CUR:
-      nextPos += iFilePosition;
-      break;
-    case SEEK_END:
-      if (m_state->m_fileSize)
-        nextPos = m_state->m_fileSize + iFilePosition;
-      else
-        return -1;
-      break;
-    default:
-      return -1;
-  }
-
-  // We can't seek beyond EOF
-  if (m_state->m_fileSize && nextPos > m_state->m_fileSize) return -1;
-
-  if(m_state->Seek(nextPos))
-    return nextPos;
-
-  if(!m_seekable)
-    return -1;
-
-  CReadState* oldstate = NULL;
-  if(m_multisession)
-  {
-    CURL url(m_url);
-    oldstate = m_state;
-    m_state = new CReadState();
-
-    g_curlInterface.easy_aquire(url.GetProtocol(), url.GetHostName(), &m_state->m_easyHandle, &m_state->m_multiHandle );
-
-    // setup common curl options
-    SetCommonOptions(m_state);
-  }
-  else
-    m_state->Disconnect();
-
-  /* caller might have changed some headers (needed for daap)*/
-  SetRequestHeaders(m_state);
-
-  m_state->m_filePos = nextPos;
-  if (oldstate)
-    m_state->m_fileSize = oldstate->m_fileSize;
-
-  long response = m_state->Connect(m_bufferSize);
-  if(response < 0 && (m_state->m_fileSize == 0 || m_state->m_fileSize != m_state->m_filePos))
-  {
-    m_seekable = false;
-    if(oldstate)
-    {
-      delete m_state;
-      m_state = oldstate;
-    }
-    return -1;
-  }
-
-  SetCorrectHeaders(m_state);
-  delete oldstate;
-
-  return m_state->m_filePos;
-}
-
-int64_t CFileCurl::GetLength()
-{
-  if (!m_opened) return 0;
-  return m_state->m_fileSize;
-}
-
-int64_t CFileCurl::GetPosition()
-{
-  if (!m_opened) return 0;
-  return m_state->m_filePos;
-}
-
-int CFileCurl::Stat(const CURL& url, struct __stat64* buffer)
-{
-  // if file is already running, get info from it
-  if( m_opened )
-  {
-    CLog::Log(LOGWARNING, "%s - Stat called on open file", __FUNCTION__);
-    if (buffer)
-    {
-      memset(buffer, 0, sizeof(struct __stat64));
-      buffer->st_size = GetLength();
-      buffer->st_mode = _S_IFREG;
-    }
-    return 0;
-  }
-
-  CURL url2(url);
-  ParseAndCorrectUrl(url2);
-
-  ASSERT(m_state->m_easyHandle == NULL);
-  g_curlInterface.easy_aquire(url2.GetProtocol(), url2.GetHostName(), &m_state->m_easyHandle, NULL);
-
-  SetCommonOptions(m_state);
-  SetRequestHeaders(m_state);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_NOBODY, 1);
-  g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
-
-  if(url2.GetProtocol() == "ftp")
-  {
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
-  }
-
-  CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
-
-
-  if(result == CURLE_HTTP_RETURNED_ERROR)
-  {
-    long code;
-    if(g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_RESPONSE_CODE, &code) == CURLE_OK && code == 404 )
-      return -1;
-  }
-
-  if(result == CURLE_GOT_NOTHING 
-  || result == CURLE_HTTP_RETURNED_ERROR 
-  || result == CURLE_RECV_ERROR /* some silly shoutcast servers */ )
-  {
-    /* some http servers and shoutcast servers don't give us any data on a head request */
-    /* request normal and just fail out, it's their loss */
-    /* somehow curl doesn't reset CURLOPT_NOBODY properly so reset everything */
-    SetCommonOptions(m_state);
-    SetRequestHeaders(m_state);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_TIMEOUT, 5);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_RANGE, "0-0");
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_WRITEDATA, NULL); /* will cause write failure*/
-    result = g_curlInterface.easy_perform(m_state->m_easyHandle);
-  }
-
-  if( result == CURLE_HTTP_RANGE_ERROR )
-  {
-    /* crap can't use the range option, disable it and try again */
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_RANGE, NULL);
-    result = g_curlInterface.easy_perform(m_state->m_easyHandle);
-  }
-
-  if( result != CURLE_WRITE_ERROR && result != CURLE_OK )
-  {
-    g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
-    errno = ENOENT;
-    return -1;
-  }
-
-  double length;
-  if (CURLE_OK != g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &length) || length < 0.0)
-  {
-    if (url.GetProtocol() == "ftp")
-    {
-      g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
-      errno = ENOENT;
-      return -1;
-    }
-    else
-      length = 0.0;
-  }
-
-  SetCorrectHeaders(m_state);
-
-  if(buffer)
-  {
-    char *content;
-    if (CURLE_OK != g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_CONTENT_TYPE, &content))
-    {
-      g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
-      errno = ENOENT;
-      return -1;
-    }
-    else
-    {
-      memset(buffer, 0, sizeof(struct __stat64));
-      buffer->st_size = (int64_t)length;
-      if(content && strstr(content, "text/html")) //consider html files directories
-        buffer->st_mode = _S_IFDIR;
-      else
-        buffer->st_mode = _S_IFREG;
-    }
-  }
-  g_curlInterface.easy_release(&m_state->m_easyHandle, NULL);
-  return 0;
-}
-
-unsigned int CFileCurl::CReadState::Read(void* lpBuf, int64_t uiBufSize)
-{
-  /* only request 1 byte, for truncated reads (only if not eof) */
-  if((m_fileSize == 0 || m_filePos < m_fileSize) && !FillBuffer(1))
-    return 0;
-
-  /* ensure only available data is considered */
-  unsigned int want = (unsigned int)XMIN(m_buffer.getMaxReadSize(), uiBufSize);
-
-  /* xfer data to caller */
-  if (m_buffer.ReadData((char *)lpBuf, want))
-  {
-    m_filePos += want;
-    return want;
-  }
-
-  /* check if we finished prematurely */
-  if (!m_stillRunning && (m_fileSize == 0 || m_filePos != m_fileSize))
-  {
-    CLog::Log(LOGWARNING, "%s - Transfer ended before entire file was retrieved pos %"PRId64", size %"PRId64, __FUNCTION__, m_filePos, m_fileSize);
-    return 0;
-  }
-
-  return 0;
-}
-
-/* use to attempt to fill the read buffer up to requested number of bytes */
-bool CFileCurl::CReadState::FillBuffer(unsigned int want)
-{
-  int retry=0;
-  fd_set fdread;
-  fd_set fdwrite;
-  fd_set fdexcep;
-
-  // only attempt to fill buffer if transactions still running and buffer
-  // doesnt exceed required size already
-  while ((unsigned int)m_buffer.getMaxReadSize() < want && m_buffer.getMaxWriteSize() > 0 )
-  {
-    if (m_cancelled)
-      return false;
-
-    /* if there is data in overflow buffer, try to use that first */
-    if (m_overflowSize)
-    {
-      unsigned amount = XMIN((unsigned int)m_buffer.getMaxWriteSize(), m_overflowSize);
-      m_buffer.WriteData(m_overflowBuffer, amount);
-
-      if (amount < m_overflowSize)
-        memcpy(m_overflowBuffer, m_overflowBuffer+amount,m_overflowSize-amount);
-
-      m_overflowSize -= amount;
-      m_overflowBuffer = (char*)realloc_simple(m_overflowBuffer, m_overflowSize);
-      continue;
-    }
-
-    CURLMcode result = g_curlInterface.multi_perform(m_multiHandle, &m_stillRunning);
-    if (!m_stillRunning)
-    {
-      if (result == CURLM_OK)
-      {
-        /* if we still have stuff in buffer, we are fine */
-        if (m_buffer.getMaxReadSize())
-          return true;
-
-        /* verify that we are actually okey */
-        int msgs;
-        CURLcode CURLresult = CURLE_OK;
-        CURLMsg* msg;
-        while ((msg = g_curlInterface.multi_info_read(m_multiHandle, &msgs)))
-        {
-          if (msg->msg == CURLMSG_DONE)
-          {
-            if (msg->data.result == CURLE_OK)
-              return true;
-
-            CLog::Log(LOGWARNING, "%s: curl failed with code %i", __FUNCTION__, msg->data.result);
-
-            // We need to check the data.result here as we don't want to retry on every error
-            if ( (msg->data.result == CURLE_OPERATION_TIMEDOUT ||
-                  msg->data.result == CURLE_PARTIAL_FILE       ||
-                  msg->data.result == CURLE_RECV_ERROR)        &&
-                  !m_bFirstLoop)
-              CURLresult=msg->data.result;
-            else
-              return false;
-          }
-        }
-
-        // Don't retry, when we didn't "see" any error
-        if (CURLresult == CURLE_OK)
-          return false;
-
-        // Close handle
-        if (m_multiHandle && m_easyHandle)
-          g_curlInterface.multi_remove_handle(m_multiHandle, m_easyHandle);
-
-        // Reset all the stuff like we would in Disconnect()
-        m_buffer.Clear();
-        free(m_overflowBuffer);
-        m_overflowBuffer = NULL;
-        m_overflowSize = 0;
-
-        // If we got here something is wrong
-        if (++retry > g_advancedSettings.m_curlretries)
-        {
-          CLog::Log(LOGWARNING, "%s: Reconnect failed!", __FUNCTION__);
-          // Reset the rest of the variables like we would in Disconnect()
-          m_filePos = 0;
-          m_fileSize = 0;
-          m_bufferSize = 0;
-
-          return false;
-        }
-
-        CLog::Log(LOGDEBUG, "%s: Reconnect, (re)try %i", __FUNCTION__, retry);
-
-        // Connect + seek to current position (again)
-        g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
-        g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
-
-        // Return to the beginning of the loop:
-        continue;
-      }
-      return false;
-    }
-
-    // We've finished out first loop
-    if(m_bFirstLoop && m_buffer.getMaxReadSize() > 0)
-      m_bFirstLoop = false;
-
-    switch (result)
-    {
-      case CURLM_OK:
-      {
-        int maxfd = -1;
-        FD_ZERO(&fdread);
-        FD_ZERO(&fdwrite);
-        FD_ZERO(&fdexcep);
-
-        // get file descriptors from the transfers
-        g_curlInterface.multi_fdset(m_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
-
-        long timeout = 0;
-        if (CURLM_OK != g_curlInterface.multi_timeout(m_multiHandle, &timeout) || timeout == -1)
-          timeout = 200;
-
-        struct timeval t = { timeout / 1000, (timeout % 1000) * 1000 };
-
-        /* Wait until data is available or a timeout occurs.
-           We call dllselect(maxfd + 1, ...), specially in case of (maxfd == -1),
-           we call dllselect(0, ...), which is basically equal to sleep. */
-        if (SOCKET_ERROR == dllselect(maxfd + 1, &fdread, &fdwrite, &fdexcep, &t))
-        {
-          CLog::Log(LOGERROR, "%s - curl failed with socket error", __FUNCTION__);
-          return false;
-        }
-      }
-      break;
-      case CURLM_CALL_MULTI_PERFORM:
-      {
-        // we don't keep calling here as that can easily overwrite our buffer which we want to avoid
-        // docs says we should call it soon after, but aslong as we are reading data somewhere
-        // this aught to be soon enough. should stay in socket otherwise
-        continue;
-      }
-      break;
-      default:
-      {
-        CLog::Log(LOGERROR, "%s - curl multi perform failed with code %d, aborting", __FUNCTION__, result);
-        return false;
-      }
-      break;
-    }
-  }
-  return true;
-}
-
-void CFileCurl::ClearRequestHeaders()
-{
-  m_requestheaders.clear();
-}
-
-void CFileCurl::SetRequestHeader(CStdString header, CStdString value)
-{
-  m_requestheaders[header] = value;
-}
-
-void CFileCurl::SetRequestHeader(CStdString header, long value)
-{
-  CStdString buffer;
-  buffer.Format("%ld", value);
-  m_requestheaders[header] = buffer;
-}
-
-/* STATIC FUNCTIONS */
-bool CFileCurl::GetHttpHeader(const CURL &url, CHttpHeader &headers)
-{
-  try
-  {
-    CFileCurl file;
-    if(file.Stat(url, NULL) == 0)
-    {
-      headers = file.GetHttpHeader();
-      return true;
-    }
-    return false;
-  }
-  catch(...)
-  {
-    CLog::Log(LOGERROR, "%s - Exception thrown while trying to retrieve header url: %s", __FUNCTION__, url.Get().c_str());
-    return false;
-  }
-}
-
-bool CFileCurl::GetMimeType(const CURL &url, CStdString &content, CStdString useragent)
-{
-  CFileCurl file;
-  if (!useragent.IsEmpty())
-    file.SetUserAgent(useragent);
-
-  struct __stat64 buffer;
-  if( file.Stat(url, &buffer) == 0 )
-  {
-    if (buffer.st_mode == _S_IFDIR)
-      content = "x-directory/normal";
-    else
-      content = file.GetMimeType();
-    CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> %s", url.Get().c_str(), content.c_str());
-    return true;
-  }
-  CLog::Log(LOGDEBUG, "CFileCurl::GetMimeType - %s -> failed", url.Get().c_str());
-  content = "";
-  return false;
-}
-
-int CFileCurl::IoControl(EIoControl request, void* param)
-{
-  if(request == IOCTRL_SEEK_POSSIBLE)
-    return m_seekable ? 1 : 0;
-
-  return -1;
-}
diff --git a/xbmc/filesystem/FileCurl.h b/xbmc/filesystem/FileCurl.h
deleted file mode 100644 (file)
index 126f7bf..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IFile.h"
-#include "utils/RingBuffer.h"
-#include <map>
-#include "utils/HttpHeader.h"
-
-namespace XCURL
-{
-  typedef void CURL_HANDLE;
-  typedef void CURLM;
-  struct curl_slist;
-}
-
-class CHttpHeader;
-
-namespace XFILE
-{
-  class CFileCurl : public IFile
-  {
-    public:
-      CFileCurl();
-      virtual ~CFileCurl();
-      virtual bool Open(const CURL& url);
-      virtual bool Exists(const CURL& url);
-      virtual int64_t  Seek(int64_t iFilePosition, int iWhence=SEEK_SET);
-      virtual int64_t GetPosition();
-      virtual int64_t  GetLength();
-      virtual int  Stat(const CURL& url, struct __stat64* buffer);
-      virtual void Close();
-      virtual bool ReadString(char *szLine, int iLineLength)     { return m_state->ReadString(szLine, iLineLength); }
-      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize)  { return m_state->Read(lpBuf, uiBufSize); }
-      virtual CStdString GetMimeType()                           { return m_state->m_httpheader.GetMimeType(); }
-      virtual int IoControl(EIoControl request, void* param);
-
-      bool Post(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML);
-      bool Get(const CStdString& strURL, CStdString& strHTML);
-      bool ReadData(CStdString& strHTML);
-      bool Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize = NULL);
-      bool IsInternet(bool checkDNS = true);
-      void Cancel();
-      void Reset();
-      void SetUserAgent(CStdString sUserAgent)                   { m_userAgent = sUserAgent; }
-      void SetProxy(CStdString &proxy)                           { m_proxy = proxy; }
-      void SetProxyUserPass(CStdString &proxyuserpass)           { m_proxyuserpass = proxyuserpass; }
-      void SetCustomRequest(CStdString &request)                 { m_customrequest = request; }
-      void UseOldHttpVersion(bool bUse)                          { m_useOldHttpVersion = bUse; }
-      void SetContentEncoding(CStdString encoding)               { m_contentencoding = encoding; }
-      void SetTimeout(int connecttimeout)                        { m_connecttimeout = connecttimeout; }
-      void SetLowSpeedTime(int lowspeedtime)                     { m_lowspeedtime = lowspeedtime; }
-      void SetPostData(CStdString postdata)                      { m_postdata = postdata; }
-      void SetReferer(CStdString referer)                        { m_referer = referer; }
-      void SetCookie(CStdString cookie)                          { m_cookie = cookie; }
-      void SetMimeType(CStdString mimetype)                      { SetRequestHeader("Content-Type", m_mimetype); }
-      void SetRequestHeader(CStdString header, CStdString value);
-      void SetRequestHeader(CStdString header, long value);
-
-      void ClearRequestHeaders();
-      void SetBufferSize(unsigned int size);
-
-      const CHttpHeader& GetHttpHeader() { return m_state->m_httpheader; }
-
-      /* static function that will get content type of a file */
-      static bool GetHttpHeader(const CURL &url, CHttpHeader &headers);
-      static bool GetMimeType(const CURL &url, CStdString &content, CStdString useragent="");
-
-      class CReadState
-      {
-      public:
-          CReadState();
-          ~CReadState();
-          XCURL::CURL_HANDLE*    m_easyHandle;
-          XCURL::CURLM*          m_multiHandle;
-
-          CRingBuffer     m_buffer;           // our ringhold buffer
-          unsigned int    m_bufferSize;
-
-          char *          m_overflowBuffer;   // in the rare case we would overflow the above buffer
-          unsigned int    m_overflowSize;     // size of the overflow buffer
-          int             m_stillRunning;     // Is background url fetch still in progress
-          bool            m_cancelled;
-          int64_t         m_fileSize;
-          int64_t         m_filePos;
-          bool            m_bFirstLoop;
-
-          /* returned http header */
-          CHttpHeader m_httpheader;
-          bool        m_headerdone;
-
-          size_t WriteCallback(char *buffer, size_t size, size_t nitems);
-          size_t HeaderCallback(void *ptr, size_t size, size_t nmemb);
-
-          bool         Seek(int64_t pos);
-          unsigned int Read(void* lpBuf, int64_t uiBufSize);
-          bool         ReadString(char *szLine, int iLineLength);
-          bool         FillBuffer(unsigned int want);
-
-          long         Connect(unsigned int size);
-          void         Disconnect();
-      };
-
-    protected:
-      void ParseAndCorrectUrl(CURL &url);
-      void SetCommonOptions(CReadState* state);
-      void SetRequestHeaders(CReadState* state);
-      void SetCorrectHeaders(CReadState* state);
-      bool Service(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML);
-
-    private:
-      CReadState*     m_state;
-      unsigned int    m_bufferSize;
-
-      CStdString      m_url;
-      CStdString      m_userAgent;
-      CStdString      m_proxy;
-      CStdString      m_proxyuserpass;
-      CStdString      m_customrequest;
-      CStdString      m_contentencoding;
-      CStdString      m_ftpauth;
-      CStdString      m_ftpport;
-      CStdString      m_binary;
-      CStdString      m_postdata;
-      CStdString      m_referer;
-      CStdString      m_cookie;
-      CStdString      m_mimetype;
-      CStdString      m_username;
-      CStdString      m_password;
-      CStdString      m_httpauth;
-      bool            m_ftppasvip;
-      int             m_connecttimeout;
-      int             m_lowspeedtime;
-      bool            m_opened;
-      bool            m_useOldHttpVersion;
-      bool            m_seekable;
-      bool            m_multisession;
-      bool            m_skipshout;
-
-      CRingBuffer     m_buffer;           // our ringhold buffer
-      char *          m_overflowBuffer;   // in the rare case we would overflow the above buffer
-      unsigned int    m_overflowSize;     // size of the overflow buffer
-
-      int             m_stillRunning;     // Is background url fetch still in progress?
-
-      struct XCURL::curl_slist* m_curlAliasList;
-      struct XCURL::curl_slist* m_curlHeaderList;
-
-      typedef std::map<CStdString, CStdString> MAPHTTPHEADERS;
-      MAPHTTPHEADERS m_requestheaders;
-  };
-}
-
-
-
diff --git a/xbmc/filesystem/FileDAAP.cpp b/xbmc/filesystem/FileDAAP.cpp
deleted file mode 100644 (file)
index 0f8b522..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
-* DAAP Support for XBMC
-* Copyright (c) 2004 Forza (Chris Barnett)
-* Portions Copyright (c) by the authors of libOpenDAAP
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "FileDAAP.h"
-#include "SectionLoader.h"
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include <sys/stat.h>
-
-#include "lib/libXDAAP/private.h"
-
-using namespace XFILE;
-
-#define HEDAER_VERSION       "Client-DAAP-Version"
-#define HEADER_REQUESTID     "Client-DAAP-Request-ID"
-#define HEADER_VALIDATE      "Client-DAAP-Validation"
-#define HEADER_ACCESS_INDEX  "Client-DAAP-Access-Index"
-#define DAAP_USERAGENT       "iTunes/4.6 (Windows; N)"
-#define DAAP_PORT            3689
-
-extern "C"
-{
-/* prototype of function in LIBXDAAP to generate the has needed for requests */
-void GenerateHash(short version_major,
-                  const unsigned char *url, unsigned char hashSelect,
-                  unsigned char *outhash,
-                  int request_id);
-}
-
-CDaapClient g_DaapClient;
-
-CDaapClient::CDaapClient()
-{
-  m_pClient = NULL;
-  m_Status = DAAP_STATUS_error;
-
-  m_pArtistsHead = NULL;
-  m_iDatabase = 0;
-}
-CDaapClient::~CDaapClient()
-{
-
-}
-void CDaapClient::Release()
-{
-  m_mapHosts.clear();
-
-  if( m_pClient )
-  {
-    try
-    {
-      while( DAAP_Client_Release(m_pClient) != 0 ) {}
-    }
-    catch(...)
-    {
-      CLog::Log(LOGINFO, "CDaapClient::Disconnect - Unexpected exception");
-    }
-
-    m_pClient = NULL;
-  }
-}
-
-DAAP_SClientHost* CDaapClient::GetHost(const CStdString &strHost)
-{
-  //We need this section from now on
-  if( !CSectionLoader::IsLoaded("LIBXDAAP") ) CSectionLoader::Load("LIBXDAAP");
-  try
-  {
-
-    ITHOST it;
-    it = m_mapHosts.find(strHost);
-    if( it != m_mapHosts.end() )
-      return it->second;
-
-
-    if( !m_pClient )
-      m_pClient = DAAP_Client_Create((DAAP_fnClientStatus)StatusCallback, (void*)this);
-
-    DAAP_SClientHost* pHost = DAAP_Client_AddHost(m_pClient, (char *)strHost.c_str(), (char *)"A", (char *)"A");
-    if( !pHost )
-      throw("Unable to add host");
-
-    if( DAAP_ClientHost_Connect(pHost) != 0 )
-      throw("Unable to connect");
-
-    m_mapHosts[strHost] = pHost;
-
-    return pHost;
-
-  }
-  catch(char* err)
-  {
-    CLog::Log(LOGERROR, "CDaapClient::GetHost(%s) - %s", strHost.c_str(), err );
-    return NULL;
-  }
-  catch(...)
-  {
-    CLog::Log(LOGERROR, "CDaapClient::GetHost(%s) - Unknown Exception", strHost.c_str());
-    return NULL;
-  }
-
-}
-
-void CDaapClient::StatusCallback(DAAP_SClient *pClient, DAAP_Status status, int value, void* pContext)
-{
-  ((CDaapClient*)pContext)->m_Status = status;
-  switch(status)
-  {
-    case DAAP_STATUS_connecting:
-      CLog::Log(LOGINFO, "CDaapClient::Callback - Connecting");
-    case DAAP_STATUS_downloading:
-      CLog::Log(LOGINFO, "CDaapClient::Callback - Downlading");
-    case DAAP_STATUS_idle:
-      CLog::Log(LOGINFO, "CDaapClient::Callback - Idle");
-    default:
-      CLog::Log(LOGINFO, "CDaapClient::Callback - Status %d", status);
-  }
-}
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CFileDAAP::CFileDAAP()
-{
-  m_thisHost = NULL;
-  m_thisClient = NULL;
-
-  m_bOpened = false;
-}
-
-CFileDAAP::~CFileDAAP()
-{
-  Close();
-}
-
-
-
-//*********************************************************************************************
-bool CFileDAAP::Open(const CURL& url)
-{
-  CSingleLock lock(g_DaapClient);
-
-  if (m_bOpened) Close();
-
-  m_url = url;
-
-  CLog::Log(LOGDEBUG, "CFileDAAP::Open(%s)", url.GetFileName().c_str());
-  CStdString host = url.GetHostName();
-  if (url.HasPort())
-    host.Format("%s:%i",url.GetHostName(),url.GetPort());
-  m_thisHost = g_DaapClient.GetHost(host);
-  if (!m_thisHost)
-    return false;
-
-  /* get us a new request id */
-  int requestid = ++m_thisHost->request_id;
-
-  m_hashurl = "/" + m_url.GetFileName();
-  m_hashurl += m_url.GetOptions();
-
-  char hash[33] = {0};
-  GenerateHash(m_thisHost->version_major, (unsigned char*)(m_hashurl.c_str()), 2, (unsigned char*)hash, requestid);
-
-  m_curl.SetUserAgent(DAAP_USERAGENT);
-
-  //m_curl.SetRequestHeader(HEADER_VERSION, "3.0");
-  m_curl.SetRequestHeader(HEADER_REQUESTID, requestid);
-  m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash));
-  m_curl.SetRequestHeader(HEADER_ACCESS_INDEX, 2);
-
-  m_url.SetProtocol("http");
-  if(!m_url.HasPort())
-    m_url.SetPort(DAAP_PORT);
-
-
-  m_bOpened = true;
-
-  return m_curl.Open(m_url);
-}
-
-
-//*********************************************************************************************
-unsigned int CFileDAAP::Read(void *lpBuf, int64_t uiBufSize)
-{
-  return m_curl.Read(lpBuf, uiBufSize);
-}
-
-//*********************************************************************************************
-void CFileDAAP::Close()
-{
-  m_curl.Close();
-  m_bOpened = false;
-}
-
-//*********************************************************************************************
-int64_t CFileDAAP::Seek(int64_t iFilePosition, int iWhence)
-{
-  CSingleLock lock(g_DaapClient);
-
-  int requestid = ++m_thisHost->request_id;
-
-  char hash[33] = {0};
-  GenerateHash(m_thisHost->version_major, (unsigned char*)(m_hashurl.c_str()), 2, (unsigned char*)hash, requestid);
-
-  m_curl.SetRequestHeader(HEADER_REQUESTID, requestid);
-  m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash));
-
-  return m_curl.Seek(iFilePosition, iWhence);
-}
-
-//*********************************************************************************************
-int64_t CFileDAAP::GetLength()
-{
-  return m_curl.GetLength();
-}
-
-//*********************************************************************************************
-int64_t CFileDAAP::GetPosition()
-{
-  return m_curl.GetPosition();
-}
-
-bool CFileDAAP::Exists(const CURL& url)
-{
-  return false;
-}
-
-int CFileDAAP::Stat(const CURL& url, struct __stat64* buffer)
-{
-  return -1;
-}
-
-int CFileDAAP::IoControl(EIoControl request, void* param)
-{
-  if(request == IOCTRL_SEEK_POSSIBLE)
-    return 1;
-
-  return -1;
-}
diff --git a/xbmc/filesystem/FileDAAP.h b/xbmc/filesystem/FileDAAP.h
deleted file mode 100644 (file)
index efa6f15..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* DAAP Support for XBMC
-* Copyright (c) 2004 Forza (Chris Barnett)
-* Portions Copyright (c) by the authors of libOpenDAAP
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-// FileDAAP.h: interface for the CFileDAAP class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_FILEDAAP_H___INCLUDED_)
-#define AFX_FILEDAAP_H___INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "lib/libXDAAP/client.h"
-#include "FileCurl.h"
-#include "URL.h"
-#include "threads/CriticalSection.h"
-
-class CDaapClient : public CCriticalSection
-{
-public:
-
-  CDaapClient();
-  ~CDaapClient();
-
-  DAAP_SClient *m_pClient;
-  DAAP_SClientHost* GetHost(const CStdString &srtHost);
-  std::map<CStdString, DAAP_SClientHost*> m_mapHosts;
-  typedef std::map<CStdString, DAAP_SClientHost*>::iterator ITHOST;
-
-  DAAP_Status m_Status;
-
-  //Buffers
-  int m_iDatabase;
-  void *m_pArtistsHead;
-
-  void Release();
-
-protected:
-  static void StatusCallback(DAAP_SClient *pClient, DAAP_Status status, int value, void* pContext);
-};
-
-extern CDaapClient g_DaapClient;
-
-
-#include "IFile.h"
-
-namespace XFILE
-{
-class CFileDAAP : public IFile
-{
-public:
-  CFileDAAP();
-  virtual ~CFileDAAP();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual int  IoControl(EIoControl request, void* param);
-
-protected:
-
-  bool StartStreaming();
-  bool StopStreaming();
-
-  int64_t m_fileSize; //holds full size
-  int64_t m_filePos; //holds current position in file
-
-
-  DAAP_SClient *m_thisClient;
-  DAAP_SClientHost *m_thisHost;
-  DAAP_ClientHost_Song m_song;
-
-  bool m_bOpened;
-
-  CStdString m_hashurl; // the url that should be used in hash calculation
-  CURL       m_url;     // the complete url we have connected too
-  CFileCurl  m_curl;
-};
-}
-
-#endif // !defined(AFX_FILEDAAP_H___INCLUDED_)
-
-
diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp
new file mode 100644 (file)
index 0000000..843691b
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "system.h"
+#include "Util.h"
+#include "utils/URIUtils.h"
+#include "FileDirectoryFactory.h"
+#ifdef HAS_FILESYSTEM
+#include "OGGFileDirectory.h"
+#include "NSFFileDirectory.h"
+#include "SIDFileDirectory.h"
+#include "ASAPFileDirectory.h"
+#include "RSSDirectory.h"
+#include "cores/paplayer/ASAPCodec.h"
+#endif
+#ifdef HAS_FILESYSTEM_RAR
+#include "RarDirectory.h"
+#endif
+#include "ZipDirectory.h"
+#include "SmartPlaylistDirectory.h"
+#include "playlists/SmartPlayList.h"
+#include "PlaylistFileDirectory.h"
+#include "playlists/PlayListFactory.h"
+#include "Directory.h"
+#include "File.h"
+#include "ZipManager.h"
+#include "settings/AdvancedSettings.h"
+#include "FileItem.h"
+
+using namespace XFILE;
+using namespace PLAYLIST;
+using namespace std;
+
+CFileDirectoryFactory::CFileDirectoryFactory(void)
+{}
+
+CFileDirectoryFactory::~CFileDirectoryFactory(void)
+{}
+
+// return NULL + set pItem->m_bIsFolder to remove it completely from list.
+IFileDirectory* CFileDirectoryFactory::Create(const CStdString& strPath, CFileItem* pItem, const CStdString& strMask)
+{
+  CStdString strExtension=URIUtils::GetExtension(strPath);
+  strExtension.MakeLower();
+
+#ifdef HAS_FILESYSTEM
+  if ((strExtension.Equals(".ogg") || strExtension.Equals(".oga")) && CFile::Exists(strPath))
+  {
+    IFileDirectory* pDir=new COGGFileDirectory;
+    //  Has the ogg file more than one bitstream?
+    if (pDir->ContainsFiles(strPath))
+    {
+      return pDir; // treat as directory
+    }
+
+    delete pDir;
+    return NULL;
+  }
+  if (strExtension.Equals(".nsf") && CFile::Exists(strPath))
+  {
+    IFileDirectory* pDir=new CNSFFileDirectory;
+    //  Has the nsf file more than one track?
+    if (pDir->ContainsFiles(strPath))
+      return pDir; // treat as directory
+
+    delete pDir;
+    return NULL;
+  }
+  if (strExtension.Equals(".sid") && CFile::Exists(strPath))
+  {
+    IFileDirectory* pDir=new CSIDFileDirectory;
+    //  Has the sid file more than one track?
+    if (pDir->ContainsFiles(strPath))
+      return pDir; // treat as directory
+
+    delete pDir;
+    return NULL;
+  }
+#ifdef HAS_ASAP_CODEC
+  if (ASAPCodec::IsSupportedFormat(strExtension) && CFile::Exists(strPath))
+  {
+    IFileDirectory* pDir=new CASAPFileDirectory;
+    //  Has the asap file more than one track?
+    if (pDir->ContainsFiles(strPath))
+      return pDir; // treat as directory
+
+    delete pDir;
+    return NULL;
+  }
+#endif
+
+  if (pItem->IsRSS())
+    return new CRSSDirectory();
+
+#endif
+  if (strExtension.Equals(".zip"))
+  {
+    CStdString strUrl;
+    URIUtils::CreateArchivePath(strUrl, "zip", strPath, "");
+
+    CFileItemList items;
+    CDirectory::GetDirectory(strUrl, items, strMask);
+    if (items.Size() == 0) // no files
+      pItem->m_bIsFolder = true;
+    else if (items.Size() == 1 && items[0]->m_idepth == 0)
+    {
+      // one STORED file - collapse it down
+      *pItem = *items[0];
+    }
+    else
+    { // compressed or more than one file -> create a zip dir
+      pItem->SetPath(strUrl);
+      return new CZipDirectory;
+    }
+    return NULL;
+  }
+  if (strExtension.Equals(".rar") || strExtension.Equals(".001"))
+  {
+    CStdString strUrl;
+    URIUtils::CreateArchivePath(strUrl, "rar", strPath, "");
+
+    vector<CStdString> tokens;
+    CUtil::Tokenize(strPath,tokens,".");
+    if (tokens.size() > 2)
+    {
+      if (strExtension.Equals(".001"))
+      {
+        if (tokens[tokens.size()-2].Equals("ts")) // .ts.001 - treat as a movie file to scratch some users itch
+          return NULL;
+      }
+      CStdString token = tokens[tokens.size()-2];
+      if (token.Left(4).CompareNoCase("part") == 0) // only list '.part01.rar'
+      {
+        // need this crap to avoid making mistakes - yeyh for the new rar naming scheme :/
+        struct __stat64 stat;
+        int digits = token.size()-4;
+        CStdString strNumber, strFormat;
+        strFormat.Format("part%%0%ii",digits);
+        strNumber.Format(strFormat.c_str(),1);
+        CStdString strPath2=strPath;
+        strPath2.Replace(token,strNumber);
+        if (atoi(token.substr(4).c_str()) > 1 && CFile::Stat(strPath2,&stat) == 0)
+        {
+          pItem->m_bIsFolder = true;
+          return NULL;
+        }
+      }
+    }
+
+    CFileItemList items;
+    CDirectory::GetDirectory(strUrl, items, strMask);
+    if (items.Size() == 0) // no files - hide this
+      pItem->m_bIsFolder = true;
+    else if (items.Size() == 1 && items[0]->m_idepth == 0x30)
+    {
+      // one STORED file - collapse it down
+      *pItem = *items[0];
+    }
+    else
+    {
+#ifdef HAS_FILESYSTEM_RAR
+      // compressed or more than one file -> create a rar dir
+      pItem->SetPath(strUrl);
+      return new CRarDirectory;
+#else
+      return NULL;
+#endif
+    }
+    return NULL;
+  }
+  if (strExtension.Equals(".xsp"))
+  { // XBMC Smart playlist - just XML renamed to XSP
+    // read the name of the playlist in
+    CSmartPlaylist playlist;
+    if (playlist.OpenAndReadName(strPath))
+    {
+      pItem->SetLabel(playlist.GetName());
+      pItem->SetLabelPreformated(true);
+    }
+    IFileDirectory* pDir=new CSmartPlaylistDirectory;
+    return pDir; // treat as directory
+  }
+  if (g_advancedSettings.m_playlistAsFolders && CPlayListFactory::IsPlaylist(strPath))
+  { // Playlist file
+    // currently we only return the directory if it contains
+    // more than one file.  Reason is that .pls and .m3u may be used
+    // for links to http streams etc.
+    IFileDirectory *pDir = new CPlaylistFileDirectory();
+    CFileItemList items;
+    if (pDir->GetDirectory(strPath, items))
+    {
+      if (items.Size() > 1)
+        return pDir;
+    }
+    delete pDir;
+    return NULL;
+  }
+  return NULL;
+}
+
diff --git a/xbmc/filesystem/FileDirectoryFactory.h b/xbmc/filesystem/FileDirectoryFactory.h
new file mode 100644 (file)
index 0000000..4c816ef
--- /dev/null
@@ -0,0 +1,36 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFileDirectory.h"
+
+class CFileItem;
+
+namespace XFILE
+{
+class CFileDirectoryFactory
+{
+public:
+  CFileDirectoryFactory(void);
+  virtual ~CFileDirectoryFactory(void);
+  static IFileDirectory* Create(const CStdString& strPath, CFileItem* pItem, const CStdString& strMask="");
+};
+}
index 7fc2e36..e51fc50 100644 (file)
 #endif
 #include "system.h"
 #include "FileFactory.h"
-#include "FileHD.h"
-#include "FileCurl.h"
-#include "FileShoutcast.h"
-#include "FileLastFM.h"
-#include "FileFileReader.h"
+#include "HDFile.h"
+#include "CurlFile.h"
+#include "ShoutcastFile.h"
+#include "LastFMFile.h"
+#include "FileReaderFile.h"
 #ifdef HAS_FILESYSTEM_SMB
 #ifdef _WIN32
 #include "windows/WINFileSmb.h"
 #else
-#include "FileSmb.h"
+#include "SmbFile.h"
 #endif
 #endif
 #ifdef HAS_FILESYSTEM_CDDA
-#include "FileCDDA.h"
+#include "CDDAFile.h"
 #endif
 #ifdef HAS_FILESYSTEM
-#include "FileISO.h"
+#include "ISOFile.h"
 #ifdef HAS_FILESYSTEM_RTV
-#include "FileRTV.h"
+#include "RTVFile.h"
 #endif
 #ifdef HAS_FILESYSTEM_DAAP
-#include "FileDAAP.h"
+#include "DAAPFile.h"
 #endif
 #endif
 #ifdef HAS_FILESYSTEM_SAP
 #ifdef HAS_FILESYSTEM_VTP
 #include "VTPFile.h"
 #endif
-#include "FileZip.h"
+#include "ZipFile.h"
 #ifdef HAS_FILESYSTEM_RAR
-#include "FileRar.h"
+#include "RarFile.h"
 #endif
 #ifdef HAS_FILESYSTEM_SFTP
-#include "FileSFTP.h"
+#include "SFTPFile.h"
 #endif
 #ifdef HAS_FILESYSTEM_NFS
-#include "FileNFS.h"
+#include "NFSFile.h"
 #endif
 #ifdef HAS_FILESYSTEM_AFP
-#include "FileAFP.h"
+#include "AFPFile.h"
 #endif
-#include "FileUPnP.h"
+#include "UPnPFile.h"
 #include "PipesManager.h"
-#include "FilePipe.h"
-#include "FileMusicDatabase.h"
-#include "FileSpecialProtocol.h"
+#include "PipeFile.h"
+#include "MusicDatabaseFile.h"
+#include "SpecialProtocolFile.h"
 #include "MultiPathFile.h"
-#include "FileTuxBox.h"
-#include "FileUDF.h"
+#include "TuxBoxFile.h"
+#include "UDFFile.h"
 #include "MythFile.h"
-#include "HDHomeRun.h"
-#include "Slingbox.h"
+#include "HDHomeRunFile.h"
+#include "SlingboxFile.h"
 #include "Application.h"
 #include "URL.h"
 #include "utils/log.h"
diff --git a/xbmc/filesystem/FileFileReader.cpp b/xbmc/filesystem/FileFileReader.cpp
deleted file mode 100644 (file)
index 1579939..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * XBMC Media Center
- * Copyright (c) 2002 Frodo
- * Portions Copyright (c) by the authors of ffmpeg and xvid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-#include "FileFileReader.h"
-#include "URL.h"
-
-using namespace XFILE;
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-//*********************************************************************************************
-CFileFileReader::CFileFileReader()
-{
-}
-
-//*********************************************************************************************
-CFileFileReader::~CFileFileReader()
-{
-  Close();
-}
-
-//*********************************************************************************************
-bool CFileFileReader::Open(const CURL& url)
-{
-  CStdString strURL = url.Get();
-  strURL = strURL.Mid(13);
-  return m_reader.Open(strURL,READ_CACHED);
-}
-
-bool CFileFileReader::Exists(const CURL& url)
-{
-  return CFile::Exists(url.Get().Mid(13));
-}
-
-int CFileFileReader::Stat(const CURL& url, struct __stat64* buffer)
-{
-  return CFile::Stat(url.Get().Mid(13),buffer);
-}
-
-
-//*********************************************************************************************
-bool CFileFileReader::OpenForWrite(const CURL& url, bool bOverWrite)
-{
-  return false;
-}
-
-//*********************************************************************************************
-unsigned int CFileFileReader::Read(void *lpBuf, int64_t uiBufSize)
-{
-  return m_reader.Read(lpBuf,uiBufSize);
-}
-
-//*********************************************************************************************
-int CFileFileReader::Write(const void *lpBuf, int64_t uiBufSize)
-{
-  return 0;
-}
-
-//*********************************************************************************************
-void CFileFileReader::Close()
-{
-  m_reader.Close();
-}
-
-//*********************************************************************************************
-int64_t CFileFileReader::Seek(int64_t iFilePosition, int iWhence)
-{
-  return m_reader.Seek(iFilePosition,iWhence);
-}
-
-//*********************************************************************************************
-int64_t CFileFileReader::GetLength()
-{
-  return m_reader.GetLength();
-}
-
-//*********************************************************************************************
-int64_t CFileFileReader::GetPosition()
-{
-  return m_reader.GetPosition();
-}
-
-
diff --git a/xbmc/filesystem/FileFileReader.h b/xbmc/filesystem/FileFileReader.h
deleted file mode 100644 (file)
index b9c9234..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma once
-/*
- * XBMC Media Center
- * Copyright (c) 2002 Frodo
- * Portions Copyright (c) by the authors of ffmpeg and xvid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "File.h"
-
-namespace XFILE
-{
-class CFileFileReader : public IFile
-{
-public:
-  CFileFileReader();
-  virtual ~CFileFileReader();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int Write(const void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-
-  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-  protected:
-  CFile m_reader;
-};
-
-}
-
-
diff --git a/xbmc/filesystem/FileHD.cpp b/xbmc/filesystem/FileHD.cpp
deleted file mode 100644 (file)
index 4380797..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * XBMC Media Center
- * Copyright (c) 2002 Frodo
- * Portions Copyright (c) by the authors of ffmpeg and xvid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "system.h"
-#include "FileHD.h"
-#include "Util.h"
-#include "URL.h"
-#include "utils/AliasShortcutUtils.h"
-#ifdef _LINUX
-#include "XHandle.h"
-#endif
-
-#include <sys/stat.h>
-#ifdef _LINUX
-#include <sys/ioctl.h>
-#else
-#include <io.h>
-#include "utils/CharsetConverter.h"
-#include "utils/URIUtils.h"
-#endif
-#include "utils/log.h"
-
-
-using namespace XFILE;
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-//*********************************************************************************************
-CFileHD::CFileHD()
-    : m_hFile(INVALID_HANDLE_VALUE)
-{}
-
-//*********************************************************************************************
-CFileHD::~CFileHD()
-{
-  if (m_hFile != INVALID_HANDLE_VALUE) Close();
-}
-//*********************************************************************************************
-CStdString CFileHD::GetLocal(const CURL &url)
-{
-  CStdString path( url.GetFileName() );
-
-  if( url.GetProtocol().Equals("file", false) )
-  {
-    // file://drive[:]/path
-    // file:///drive:/path
-    CStdString host( url.GetHostName() );
-
-    if(host.size() > 0)
-    {
-      if(host.Right(1) == ":")
-        path = host + "/" + path;
-      else
-        path = host + ":/" + path;
-    }
-  }
-
-#ifndef _LINUX
-  path.Replace('/', '\\');
-#endif
-
-  if (IsAliasShortcut(path))
-    TranslateAliasShortcut(path);
-
-  return path;
-}
-
-//*********************************************************************************************
-bool CFileHD::Open(const CURL& url)
-{
-  CStdString strFile = GetLocal(url);
-
-#ifdef _WIN32
-  CStdStringW strWFile;
-  g_charsetConverter.utf8ToW(strFile, strWFile, false);
-  m_hFile.attach(CreateFileW(strWFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));
-#else
-  m_hFile.attach(CreateFile(strFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));
-#endif
-  if (!m_hFile.isValid()) return false;
-
-  m_i64FilePos = 0;
-  m_i64FileLen = 0;
-
-  return true;
-}
-
-bool CFileHD::Exists(const CURL& url)
-{
-  struct __stat64 buffer;
-  CStdString strFile = GetLocal(url);
-
-#ifdef _WIN32
-  CStdStringW strWFile;
-  URIUtils::RemoveSlashAtEnd(strFile);
-  g_charsetConverter.utf8ToW(strFile, strWFile, false);
-  return (_wstat64(strWFile.c_str(), &buffer)==0);
-#else
-  return (_stat64(strFile.c_str(), &buffer)==0);
-#endif
-}
-
-int CFileHD::Stat(struct __stat64* buffer)
-{
-#ifdef _LINUX
-  return _fstat64((*m_hFile).fd, buffer);
-#else
-  // Duplicate the handle, as retrieving and closing a matching crt handle closes the crt handle AND the original Windows handle.
-  HANDLE hFileDup;
-  if (0 == DuplicateHandle(GetCurrentProcess(), (HANDLE)m_hFile, GetCurrentProcess(), &hFileDup, 0, FALSE, DUPLICATE_SAME_ACCESS))
-  {
-    CLog::Log(LOGERROR, __FUNCTION__" - DuplicateHandle()");
-    return -1;
-  }
-
-  int fd;
-  fd = _open_osfhandle((intptr_t)((HANDLE)hFileDup), 0);
-  if (fd == -1)
-  {
-    CLog::Log(LOGERROR, "Stat: fd == -1");
-    return -1;
-  }
-  int result = _fstat64(fd, buffer);
-  _close(fd);
-  return result;
-#endif
-}
-
-int CFileHD::Stat(const CURL& url, struct __stat64* buffer)
-{
-  CStdString strFile = GetLocal(url);
-
-#ifdef _WIN32
-  CStdStringW strWFile;
-  // win32 can only stat root drives with a slash at the end
-  if(strFile.length() == 2 && strFile[1] ==':')
-    URIUtils::AddSlashAtEnd(strFile);
-  /* _wstat64 calls FindFirstFileEx. According to MSDN, the path should not end in a trailing backslash.
-    Remove it before calling _wstat64 */
-  if (strFile.length() > 3 && URIUtils::HasSlashAtEnd(strFile))
-    URIUtils::RemoveSlashAtEnd(strFile);
-  g_charsetConverter.utf8ToW(strFile, strWFile, false);
-  return _wstat64(strWFile.c_str(), buffer);
-#else
-  return _stat64(strFile.c_str(), buffer);
-#endif
-}
-
-bool CFileHD::SetHidden(const CURL &url, bool hidden)
-{
-#ifdef _WIN32
-  CStdStringW path;
-  g_charsetConverter.utf8ToW(GetLocal(url), path, false);
-  DWORD attributes = hidden ? FILE_ATTRIBUTE_HIDDEN : FILE_ATTRIBUTE_NORMAL;
-  if (SetFileAttributesW(path.c_str(), attributes))
-    return true;
-#endif
-  return false;
-}
-
-//*********************************************************************************************
-bool CFileHD::OpenForWrite(const CURL& url, bool bOverWrite)
-{
-  // make sure it's a legal FATX filename (we are writing to the harddisk)
-  CStdString strPath = GetLocal(url);
-
-#ifdef _WIN32
-  CStdStringW strWPath;
-  g_charsetConverter.utf8ToW(strPath, strWPath, false);
-  m_hFile.attach(CreateFileW(strWPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
-#else
-  m_hFile.attach(CreateFile(strPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
-#endif
-  if (!m_hFile.isValid())
-    return false;
-
-  m_i64FilePos = 0;
-  Seek(0, SEEK_SET);
-
-  return true;
-}
-
-//*********************************************************************************************
-unsigned int CFileHD::Read(void *lpBuf, int64_t uiBufSize)
-{
-  if (!m_hFile.isValid()) return 0;
-  DWORD nBytesRead;
-  if ( ReadFile((HANDLE)m_hFile, lpBuf, (DWORD)uiBufSize, &nBytesRead, NULL) )
-  {
-    m_i64FilePos += nBytesRead;
-    return nBytesRead;
-  }
-  return 0;
-}
-
-//*********************************************************************************************
-int CFileHD::Write(const void *lpBuf, int64_t uiBufSize)
-{
-  if (!m_hFile.isValid())
-    return 0;
-
-  DWORD nBytesWriten;
-  if ( WriteFile((HANDLE)m_hFile, (void*) lpBuf, (DWORD)uiBufSize, &nBytesWriten, NULL) )
-    return nBytesWriten;
-
-  return 0;
-}
-
-//*********************************************************************************************
-void CFileHD::Close()
-{
-  m_hFile.reset();
-}
-
-//*********************************************************************************************
-int64_t CFileHD::Seek(int64_t iFilePosition, int iWhence)
-{
-  LARGE_INTEGER lPos, lNewPos;
-  lPos.QuadPart = iFilePosition;
-  int bSuccess;
-
-  switch (iWhence)
-  {
-  case SEEK_SET:
-    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_BEGIN);
-    break;
-
-  case SEEK_CUR:
-    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_CURRENT);
-    break;
-
-  case SEEK_END:
-    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_END);
-    break;
-
-  default:
-    return -1;
-  }
-  if (bSuccess)
-  {
-    m_i64FilePos = lNewPos.QuadPart;
-    return m_i64FilePos;
-  }
-  else
-    return -1;
-}
-
-//*********************************************************************************************
-int64_t CFileHD::GetLength()
-{
-  if(m_i64FileLen <= m_i64FilePos || m_i64FileLen == 0)
-  {
-    LARGE_INTEGER i64Size;
-    if(GetFileSizeEx((HANDLE)m_hFile, &i64Size))
-      m_i64FileLen = i64Size.QuadPart;
-    else
-      CLog::Log(LOGERROR, "CFileHD::GetLength - GetFileSizeEx failed with error %d", GetLastError());
-  }
-  return m_i64FileLen;
-}
-
-//*********************************************************************************************
-int64_t CFileHD::GetPosition()
-{
-  return m_i64FilePos;
-}
-
-bool CFileHD::Delete(const CURL& url)
-{
-  CStdString strFile=GetLocal(url);
-
-#ifdef _WIN32
-  CStdStringW strWFile;
-  g_charsetConverter.utf8ToW(strFile, strWFile, false);
-  return ::DeleteFileW(strWFile.c_str()) ? true : false;
-#else
-  return ::DeleteFile(strFile.c_str()) ? true : false;
-#endif
-}
-
-bool CFileHD::Rename(const CURL& url, const CURL& urlnew)
-{
-  CStdString strFile=GetLocal(url);
-  CStdString strNewFile=GetLocal(urlnew);
-
-#ifdef _WIN32
-  CStdStringW strWFile;
-  CStdStringW strWNewFile;
-  g_charsetConverter.utf8ToW(strFile, strWFile, false);
-  g_charsetConverter.utf8ToW(strNewFile, strWNewFile, false);
-  return ::MoveFileW(strWFile.c_str(), strWNewFile.c_str()) ? true : false;
-#else
-  return ::MoveFile(strFile.c_str(), strNewFile.c_str()) ? true : false;
-#endif
-}
-
-void CFileHD::Flush()
-{
-  ::FlushFileBuffers(m_hFile);
-}
-
-int CFileHD::IoControl(EIoControl request, void* param)
-{
-#ifdef _LINUX
-  if(request == IOCTRL_NATIVE && param)
-  {
-    SNativeIoControl* s = (SNativeIoControl*)param;
-    return ioctl((*m_hFile).fd, s->request, s->param);
-  }
-#endif
-  return -1;
-}
diff --git a/xbmc/filesystem/FileHD.h b/xbmc/filesystem/FileHD.h
deleted file mode 100644 (file)
index 84f7db8..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * XBMC Media Center
- * Copyright (c) 2002 Frodo
- * Portions Copyright (c) by the authors of ffmpeg and xvid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-// FileHD.h: interface for the CFileHD class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
-#define AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "IFile.h"
-#include "utils/AutoPtrHandle.h"
-
-namespace XFILE
-{
-class CFileHD : public IFile
-{
-public:
-  CFileHD();
-  virtual ~CFileHD();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual int Stat(struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int Write(const void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual void Flush();
-
-  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-
-  virtual bool Delete(const CURL& url);
-  virtual bool Rename(const CURL& url, const CURL& urlnew);
-  virtual bool SetHidden(const CURL& url, bool hidden);
-
-  virtual int IoControl(EIoControl request, void* param);
-protected:
-  CStdString GetLocal(const CURL &url); /* crate a properly format path from an url */
-  AUTOPTR::CAutoPtrHandle m_hFile;
-  int64_t m_i64FilePos;
-  int64_t m_i64FileLen;
-};
-
-}
-#endif // !defined(AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
diff --git a/xbmc/filesystem/FileISO.cpp b/xbmc/filesystem/FileISO.cpp
deleted file mode 100644 (file)
index 61f047f..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-* XBMC Media Center
-* Copyright (c) 2002 Frodo
-* Portions Copyright (c) by the authors of ffmpeg and xvid
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "FileISO.h"
-#include "URL.h"
-#include "iso9660.h"
-
-#include <sys/stat.h>
-
-using namespace std;
-using namespace XFILE;
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-//*********************************************************************************************
-CFileISO::CFileISO()
-{
-  m_bOpened = false;
-}
-
-//*********************************************************************************************
-CFileISO::~CFileISO()
-{
-  if (m_bOpened)
-  {
-    Close();
-  }
-}
-//*********************************************************************************************
-bool CFileISO::Open(const CURL& url)
-{
-  string strFName = "\\";
-  strFName += url.GetFileName();
-  for (int i = 0; i < (int)strFName.size(); ++i )
-  {
-    if (strFName[i] == '/') strFName[i] = '\\';
-  }
-  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
-  if (m_hFile == INVALID_HANDLE_VALUE)
-  {
-    m_bOpened = false;
-    return false;
-  }
-
-  m_bOpened = true;
-  return true;
-}
-
-//*********************************************************************************************
-unsigned int CFileISO::Read(void *lpBuf, int64_t uiBufSize)
-{
-  if (!m_bOpened) return 0;
-  char *pData = (char *)lpBuf;
-
-  if (m_cache.getSize() > 0)
-  {
-    long lTotalBytesRead = 0;
-    while (uiBufSize > 0)
-    {
-      if (m_cache.getMaxReadSize() )
-      {
-        long lBytes2Read = m_cache.getMaxReadSize();
-        if (lBytes2Read > uiBufSize) lBytes2Read = (long)uiBufSize;
-        m_cache.ReadData(pData, lBytes2Read );
-        uiBufSize -= lBytes2Read ;
-        pData += lBytes2Read;
-        lTotalBytesRead += lBytes2Read ;
-      }
-
-      if (m_cache.getMaxWriteSize() > 5000)
-      {
-        byte buffer[5000];
-        long lBytesRead = m_isoReader.ReadFile( m_hFile, buffer, sizeof(buffer));
-        if (lBytesRead > 0)
-          m_cache.WriteData((char*)buffer, lBytesRead);
-        else
-          return 0;
-      }
-    }
-    return lTotalBytesRead;
-  }
-  int iResult = m_isoReader.ReadFile( m_hFile, (byte*)pData, (long)uiBufSize);
-  if (iResult == -1)
-    return 0;
-  return iResult;
-}
-
-//*********************************************************************************************
-void CFileISO::Close()
-{
-  if (!m_bOpened) return ;
-  m_isoReader.CloseFile( m_hFile);
-}
-
-//*********************************************************************************************
-int64_t CFileISO::Seek(int64_t iFilePosition, int iWhence)
-{
-  if (!m_bOpened) return -1;
-  int64_t lNewPos = m_isoReader.Seek(m_hFile, iFilePosition, iWhence);
-  if(lNewPos >= 0)
-    m_cache.Clear();
-  return lNewPos;
-}
-
-//*********************************************************************************************
-int64_t CFileISO::GetLength()
-{
-  if (!m_bOpened) return -1;
-  return m_isoReader.GetFileSize(m_hFile);
-}
-
-//*********************************************************************************************
-int64_t CFileISO::GetPosition()
-{
-  if (!m_bOpened) return -1;
-  return m_isoReader.GetFilePosition(m_hFile);
-}
-
-bool CFileISO::Exists(const CURL& url)
-{
-  string strFName = "\\";
-  strFName += url.GetFileName();
-  for (int i = 0; i < (int)strFName.size(); ++i )
-  {
-    if (strFName[i] == '/') strFName[i] = '\\';
-  }
-  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
-  if (m_hFile == INVALID_HANDLE_VALUE)
-    return false;
-
-  m_isoReader.CloseFile(m_hFile);
-  return true;
-}
-
-int CFileISO::Stat(const CURL& url, struct __stat64* buffer)
-{
-  string strFName = "\\";
-  strFName += url.GetFileName();
-  for (int i = 0; i < (int)strFName.size(); ++i )
-  {
-    if (strFName[i] == '/') strFName[i] = '\\';
-  }
-  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
-  if (m_hFile != INVALID_HANDLE_VALUE)
-  {
-    memset(buffer, 0, sizeof(struct __stat64));
-    buffer->st_size = m_isoReader.GetFileSize(m_hFile);
-    buffer->st_mode = _S_IFREG;
-    m_isoReader.CloseFile(m_hFile);
-    return 0;
-  }
-  errno = ENOENT;
-  return -1;
-}
diff --git a/xbmc/filesystem/FileISO.h b/xbmc/filesystem/FileISO.h
deleted file mode 100644 (file)
index 8fec921..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* XBMC Media Center
-* Copyright (c) 2002 Frodo
-* Portions Copyright (c) by the authors of ffmpeg and xvid
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-// FileISO.h: interface for the CFileISO class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_)
-#define AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "IFile.h"
-#include "utils/RingBuffer.h"
-
-namespace XFILE
-{
-
-class CFileISO : public IFile
-{
-public:
-  CFileISO();
-  virtual ~CFileISO();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-protected:
-  bool m_bOpened;
-  HANDLE m_hFile;
-  CRingBuffer m_cache;
-};
-}
-
-#endif // !defined(AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_)
diff --git a/xbmc/filesystem/FileLastFM.cpp b/xbmc/filesystem/FileLastFM.cpp
deleted file mode 100644 (file)
index d1c4cbd..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileLastFM.h"
-
-namespace XFILE
-{
-
-CFileLastFM::CFileLastFM() : CFileCurl()
-{
-  SetUserAgent("");
-  SetBufferSize(8192);
-}
-
-CFileLastFM::~CFileLastFM()
-{
-}
-
-}
-
diff --git a/xbmc/filesystem/FileLastFM.h b/xbmc/filesystem/FileLastFM.h
deleted file mode 100644 (file)
index b12839e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileCurl.h"
-#include "utils/RingBuffer.h"
-
-namespace XFILE
-{
-
-  class CFileLastFM : public CFileCurl
-  {
-  public:
-    CFileLastFM();
-    virtual ~CFileLastFM();
-  protected:
-  };
-
-}
diff --git a/xbmc/filesystem/FileMusicDatabase.cpp b/xbmc/filesystem/FileMusicDatabase.cpp
deleted file mode 100644 (file)
index 5273d4f..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileMusicDatabase.h"
-#include "music/MusicDatabase.h"
-#include "URL.h"
-#include "utils/StringUtils.h"
-#include "utils/URIUtils.h"
-
-#include <sys/stat.h>
-
-using namespace XFILE;
-
-CFileMusicDatabase::CFileMusicDatabase(void)
-{
-}
-
-CFileMusicDatabase::~CFileMusicDatabase(void)
-{
-  Close();
-}
-
-CStdString CFileMusicDatabase::TranslateUrl(const CURL& url)
-{
-  CMusicDatabase musicDatabase;
-  if (!musicDatabase.Open())
-    return "";
-
-  CStdString strFileName=URIUtils::GetFileName(url.Get());
-  CStdString strExtension;
-  URIUtils::GetExtension(strFileName, strExtension);
-  URIUtils::RemoveExtension(strFileName);
-
-  if (!StringUtils::IsNaturalNumber(strFileName))
-    return "";
-
-  long idSong=atol(strFileName.c_str());
-
-  CSong song;
-  if (!musicDatabase.GetSongById(idSong, song))
-    return "";
-
-  CStdString strExtensionFromDb;
-  URIUtils::GetExtension(song.strFileName, strExtensionFromDb);
-
-  if (!strExtensionFromDb.Equals(strExtension))
-    return "";
-
-  return song.strFileName;
-}
-
-bool CFileMusicDatabase::Open(const CURL& url)
-{
-  return m_file.Open(TranslateUrl(url));
-}
-
-bool CFileMusicDatabase::Exists(const CURL& url)
-{
-  return !TranslateUrl(url).IsEmpty();
-}
-
-int CFileMusicDatabase::Stat(const CURL& url, struct __stat64* buffer)
-{
-  return m_file.Stat(TranslateUrl(url), buffer);
-}
-
-unsigned int CFileMusicDatabase::Read(void* lpBuf, int64_t uiBufSize)
-{
-  return m_file.Read(lpBuf, uiBufSize);
-}
-
-int64_t CFileMusicDatabase::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
-{
-  return m_file.Seek(iFilePosition, iWhence);
-}
-
-void CFileMusicDatabase::Close()
-{
-  m_file.Close();
-}
-
-int64_t CFileMusicDatabase::GetPosition()
-{
-  return m_file.GetPosition();
-}
-
-int64_t CFileMusicDatabase::GetLength()
-{
-  return m_file.GetLength();
-}
-
diff --git a/xbmc/filesystem/FileMusicDatabase.h b/xbmc/filesystem/FileMusicDatabase.h
deleted file mode 100644 (file)
index 3d890bb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "File.h"
-
-namespace XFILE
-{
-class CFileMusicDatabase : public IFile
-{
-public:
-  CFileMusicDatabase(void);
-  virtual ~CFileMusicDatabase(void);
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-
-  static CStdString TranslateUrl(const CURL& url);
-protected:
-  CFile m_file;
-};
-}
diff --git a/xbmc/filesystem/FileNFS.cpp b/xbmc/filesystem/FileNFS.cpp
deleted file mode 100644 (file)
index 271c363..0000000
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileNFS.cpp: implementation of the CFileNFS class.
-//
-//////////////////////////////////////////////////////////////////////
-#include "system.h"
-
-#ifdef HAS_FILESYSTEM_NFS
-#include "DllLibNfs.h"
-#include "FileNFS.h"
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include "utils/URIUtils.h"
-#include "network/DNSNameCache.h"
-#include "threads/SystemClock.h"
-
-#include <nfsc/libnfs-raw-mount.h>
-
-#ifdef TARGET_WINDOWS
-#include <fcntl.h>
-#include <sys\stat.h>
-#endif
-
-//KEEP_ALIVE_TIMEOUT is decremented every half a second
-//480 * 0.5s == 240s == 4mins
-//so when no read was done for 4mins and files are open
-//do the nfs keep alive for the open files
-#define KEEP_ALIVE_TIMEOUT 480
-
-//4 mins cached context timeout
-#define CONTEXT_TIMEOUT 240000
-
-//return codes for getContextForExport
-#define CONTEXT_INVALID  0    //getcontext failed
-#define CONTEXT_NEW      1    //new context created
-#define CONTEXT_CACHED   2    //context cached and therefore already mounted (no new mount needed)
-
-using namespace XFILE;
-
-CNfsConnection::CNfsConnection()
-: m_pNfsContext(NULL)
-, m_exportPath("")
-, m_hostName("")
-, m_resolvedHostName("")
-, m_readChunkSize(0)
-, m_writeChunkSize(0)
-, m_OpenConnections(0)
-, m_IdleTimeout(0)
-, m_pLibNfs(new DllLibNfs())
-{
-}
-
-CNfsConnection::~CNfsConnection()
-{
-  Deinit();
-  delete m_pLibNfs;
-}
-
-void CNfsConnection::resolveHost(const CURL &url)
-{ 
-  //resolve if hostname has changed
-  CDNSNameCache::Lookup(url.GetHostName(), m_resolvedHostName);
-}
-
-std::list<CStdString> CNfsConnection::GetExportList(const CURL &url)
-{
-    std::list<CStdString> retList;
-
-    if(HandleDyLoad())
-    {
-      struct exportnode *exportlist, *tmp;
-      exportlist = m_pLibNfs->mount_getexports(m_resolvedHostName);
-      tmp = exportlist;
-
-      for(tmp = exportlist; tmp!=NULL; tmp=tmp->ex_next)
-      {
-        retList.push_back(CStdString(tmp->ex_dir));
-      }      
-
-      gNfsConnection.GetImpl()->mount_free_export_list(exportlist);
-    }
-    
-    return retList;
-}
-
-bool CNfsConnection::HandleDyLoad()
-{
-  bool ret = true;
-  
-  if(!m_pLibNfs->IsLoaded())
-  {
-    if(!m_pLibNfs->Load())
-    {
-      CLog::Log(LOGERROR,"NFS: Error loading libnfs (%s).",__FUNCTION__);    
-      ret = false; //fatal
-    }    
-  }
-  return ret;
-}
-
-void CNfsConnection::clearMembers()
-{
-    m_exportPath.clear();
-    m_hostName.clear();
-    m_exportList.clear();
-    m_writeChunkSize = 0;
-    m_readChunkSize = 0;  
-    m_pNfsContext = NULL;
-    m_KeepAliveTimeouts.clear();
-}
-
-void CNfsConnection::destroyOpenContexts()
-{
-  for(tOpenContextMap::iterator it = m_openContextMap.begin();it!=m_openContextMap.end();it++)
-  {
-    m_pLibNfs->nfs_destroy_context(it->second.pContext);
-  }
-  m_openContextMap.clear();
-}
-
-struct nfs_context *CNfsConnection::getContextFromMap(const CStdString &exportname)
-{
-  struct nfs_context *pRet = NULL;
-
-  tOpenContextMap::iterator it = m_openContextMap.find(exportname.c_str());
-  if(it != m_openContextMap.end())
-  {
-    //check if context has timed out already
-    uint64_t now = XbmcThreads::SystemClockMillis();
-    if((now - it->second.lastAccessedTime) < CONTEXT_TIMEOUT)
-    {
-      //its not timedout yet
-      //refresh access time of that
-      //context and return it
-      CLog::Log(LOGDEBUG, "NFS: Refreshing context for %s, old: %"PRId64", new: %"PRId64, exportname.c_str(), it->second.lastAccessedTime, now);
-      it->second.lastAccessedTime = now;
-      pRet = it->second.pContext;
-    }
-    else 
-    {
-      //context is timed out
-      //destroy it and return NULL
-      CLog::Log(LOGDEBUG, "NFS: Old context timed out - destroying it");
-      m_pLibNfs->nfs_destroy_context(it->second.pContext);
-    }
-  }
-  return pRet;
-}
-
-int CNfsConnection::getContextForExport(const CStdString &exportname)
-{
-  int ret = CONTEXT_INVALID; 
-    
-  if(HandleDyLoad())
-  {
-    clearMembers();  
-    
-    m_pNfsContext = getContextFromMap(exportname);
-
-    if(!m_pNfsContext)
-    {
-      CLog::Log(LOGDEBUG,"NFS: Context for %s not open - get a new context.", exportname.c_str());
-      m_pNfsContext = m_pLibNfs->nfs_init_context();
-    
-      if(!m_pNfsContext) 
-      {
-        CLog::Log(LOGERROR,"NFS: Error initcontext in getContextForExport.");
-      }
-      else 
-      {
-        struct contextTimeout tmp;
-        tmp.pContext = m_pNfsContext;
-        tmp.lastAccessedTime = XbmcThreads::SystemClockMillis();
-        m_openContextMap[exportname] = tmp; //add context to list of all contexts      
-        ret = CONTEXT_NEW;
-      }
-    }
-    else
-    {
-      ret = CONTEXT_CACHED;
-      CLog::Log(LOGDEBUG,"NFS: Using cached context.");
-    }
-  }
-  return ret;
-}
-
-bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath)
-{
-    bool ret = false;
-    
-    //refresh exportlist if empty or hostname change
-    if(m_exportList.empty() || !url.GetHostName().Equals(m_hostName,false))
-    {
-      m_exportList = GetExportList(url);
-    }
-
-    if(!m_exportList.empty())
-    {
-      relativePath = "";
-      exportPath = "";
-      
-      CStdString path = url.GetFileName();
-      
-      //GetFileName returns path without leading "/"
-      //but we need it because the export paths start with "/"
-      //and path.Find(*it) wouldn't work else
-      if(!path.empty() && path[0] != '/')
-      {
-        path = "/" + path;
-      }
-      
-      std::list<CStdString>::iterator it;
-      
-      for(it=m_exportList.begin();it!=m_exportList.end();it++)
-      {
-        //if path starts with the current export path
-        if( path.Find(*it) ==  0 )
-        {
-          exportPath = *it;
-          relativePath = "//" + path.Right((path.length()-1) - exportPath.length());
-          ret = true;
-          break;          
-        }
-      }
-    }
-    return ret;
-}
-
-bool CNfsConnection::Connect(const CURL& url, CStdString &relativePath)
-{
-  CSingleLock lock(*this);
-  bool ret = false;
-  int nfsRet = 0;
-  CStdString exportPath = "";
-
-  resolveHost(url);
-  ret = splitUrlIntoExportAndPath(url, exportPath, relativePath);
-  
-  if(ret && (!exportPath.Equals(m_exportPath,true) || !url.GetHostName().Equals(m_hostName,false)) )
-  {
-    int contextRet = getContextForExport(url.GetHostName() + exportPath);
-    
-    if(contextRet == CONTEXT_INVALID)//we need a new context because sharename or hostname has changed
-    {
-      return false;
-    }
-    
-    if(contextRet == CONTEXT_NEW) //new context was created - we need to mount it
-    {
-      //we connect to the directory of the path. This will be the "root" path of this connection then.
-      //So all fileoperations are relative to this mountpoint...
-      nfsRet = m_pLibNfs->nfs_mount(m_pNfsContext, m_resolvedHostName.c_str(), exportPath.c_str());
-
-      if(nfsRet != 0) 
-      {
-        CLog::Log(LOGERROR,"NFS: Failed to mount nfs share: %s (%s)\n", exportPath.c_str(), m_pLibNfs->nfs_get_error(m_pNfsContext));
-        return false;
-      }
-      CLog::Log(LOGDEBUG,"NFS: Connected to server %s and export %s\n", url.GetHostName().c_str(), exportPath.c_str());
-    }
-    m_exportPath = exportPath;
-    m_hostName = url.GetHostName();
-    //read chunksize only works after mount
-    m_readChunkSize = m_pLibNfs->nfs_get_readmax(m_pNfsContext);
-    m_writeChunkSize = m_pLibNfs->nfs_get_writemax(m_pNfsContext);
-
-    if(contextRet == CONTEXT_NEW)
-    {
-      CLog::Log(LOGDEBUG,"NFS: chunks: r/w %i/%i\n", (int)m_readChunkSize,(int)m_writeChunkSize);          
-    }
-  }
-  return ret; 
-}
-
-void CNfsConnection::Deinit()
-{
-  if(m_pNfsContext && m_pLibNfs->IsLoaded())
-  {
-    destroyOpenContexts();
-    m_pNfsContext = NULL;
-    m_pLibNfs->Unload();    
-  }        
-  clearMembers();
-}
-
-/* This is called from CApplication::ProcessSlow() and is used to tell if nfs have been idle for too long */
-void CNfsConnection::CheckIfIdle()
-{
-  /* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
-   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
-  if (m_OpenConnections == 0 && m_pNfsContext != NULL)
-  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
-    CSingleLock lock(*this);
-    if (m_OpenConnections == 0 /* check again - when locked */)
-    {
-      if (m_IdleTimeout > 0)
-      {
-        m_IdleTimeout--;
-      }
-      else
-      {
-        CLog::Log(LOGNOTICE, "NFS is idle. Closing the remaining connections.");
-        gNfsConnection.Deinit();
-      }
-    }
-  }
-  
-  if( m_pNfsContext != NULL )
-  {
-    //handle keep alive on opened files
-    for( tFileKeepAliveMap::iterator it = m_KeepAliveTimeouts.begin();it!=m_KeepAliveTimeouts.end();it++)
-    {
-      CSingleLock lock(keepAliveLock);
-      if(it->second > 0)
-      {
-        it->second--;
-      }
-      else
-      {
-        lock.Leave();
-        keepAlive(it->first);
-        //reset timeout
-        resetKeepAlive(it->first);
-      }
-    }
-  }
-}
-
-//remove file handle from keep alive list on file close
-void CNfsConnection::removeFromKeepAliveList(struct nfsfh  *_pFileHandle)
-{
-  CSingleLock lock(keepAliveLock);
-  m_KeepAliveTimeouts.erase(_pFileHandle);
-}
-
-//reset timeouts on read
-void CNfsConnection::resetKeepAlive(struct nfsfh  *_pFileHandle)
-{
-  CSingleLock lock(keepAliveLock);
-  //adds new keys - refreshs existing ones  
-  m_KeepAliveTimeouts[_pFileHandle] = KEEP_ALIVE_TIMEOUT;
-}
-
-//keep alive the filehandles nfs connection
-//by blindly doing a read 32bytes - seek back to where
-//we were before
-void CNfsConnection::keepAlive(struct nfsfh  *_pFileHandle)
-{
-  off64_t offset = 0;
-  char buffer[32];
-  CLog::Log(LOGNOTICE, "NFS: sending keep alive after %i s.",KEEP_ALIVE_TIMEOUT/2);
-  CSingleLock lock(*this);
-  m_pLibNfs->nfs_lseek(m_pNfsContext, _pFileHandle, 0, SEEK_CUR, &offset);
-  m_pLibNfs->nfs_read(m_pNfsContext, _pFileHandle, 32, buffer);
-  m_pLibNfs->nfs_lseek(m_pNfsContext, _pFileHandle, offset, SEEK_SET, &offset);
-}
-
-int CNfsConnection::stat(const CURL &url, struct stat *statbuff)
-{
-  CSingleLock lock(*this);
-  int nfsRet = 0;
-  CStdString exportPath;
-  CStdString relativePath;
-  struct nfs_context *pTmpContext = NULL;
-  
-  if(!HandleDyLoad())
-  {
-    return -1;
-  }
-  
-  resolveHost(url);
-  
-  if(splitUrlIntoExportAndPath(url, exportPath, relativePath))
-  {    
-    pTmpContext = m_pLibNfs->nfs_init_context();
-    
-    if(pTmpContext)
-    {  
-      //we connect to the directory of the path. This will be the "root" path of this connection then.
-      //So all fileoperations are relative to this mountpoint...
-      nfsRet = m_pLibNfs->nfs_mount(pTmpContext, m_resolvedHostName.c_str(), exportPath.c_str());
-      
-      if(nfsRet == 0) 
-      {
-        nfsRet = m_pLibNfs->nfs_stat(pTmpContext, relativePath.c_str(), statbuff);      
-      }
-      else
-      {
-        CLog::Log(LOGERROR,"NFS: Failed to mount nfs share: %s (%s)\n", exportPath.c_str(), m_pLibNfs->nfs_get_error(m_pNfsContext));
-      }
-      
-      m_pLibNfs->nfs_destroy_context(pTmpContext);
-      CLog::Log(LOGDEBUG,"NFS: Connected to server %s and export %s in tmpContext\n", url.GetHostName().c_str(), exportPath.c_str());
-    }
-  }
-  return nfsRet;
-}
-
-/* The following two function is used to keep track on how many Opened files/directories there are.
-needed for unloading the dylib*/
-void CNfsConnection::AddActiveConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections++;
-}
-
-void CNfsConnection::AddIdleConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections--;
-  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
-   leaves the movie paused for a long while and then press stop */
-  m_IdleTimeout = 180;
-}
-
-CNfsConnection gNfsConnection;
-
-CFileNFS::CFileNFS()
-: m_fileSize(0)
-, m_pFileHandle(NULL)
-, m_pNfsContext(NULL)
-{
-  gNfsConnection.AddActiveConnection();
-}
-
-CFileNFS::~CFileNFS()
-{
-  Close();
-  gNfsConnection.AddIdleConnection();
-}
-
-int64_t CFileNFS::GetPosition()
-{
-  int ret = 0;
-  off64_t offset = 0;
-  CSingleLock lock(gNfsConnection);
-  
-  if (gNfsConnection.GetNfsContext() == NULL || m_pFileHandle == NULL) return 0;
-  
-  ret = (int)gNfsConnection.GetImpl()->nfs_lseek(gNfsConnection.GetNfsContext(), m_pFileHandle, 0, SEEK_CUR, &offset);
-  
-  if (ret < 0) 
-  {
-    CLog::Log(LOGERROR, "NFS: Failed to lseek(%s)",gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
-  }
-  return offset;
-}
-
-int64_t CFileNFS::GetLength()
-{
-  if (m_pFileHandle == NULL) return 0;
-  return m_fileSize;
-}
-
-bool CFileNFS::Open(const CURL& url)
-{
-  int ret = 0;
-  Close();
-  // we can't open files like nfs://file.f or nfs://server/file.f
-  // if a file matches the if below return false, it can't exist on a nfs share.
-  if (!IsValidFile(url.GetFileName()))
-  {
-    CLog::Log(LOGNOTICE,"NFS: Bad URL : '%s'",url.GetFileName().c_str());
-    return false;
-  }
-  
-  CStdString filename = "";
-   
-  CSingleLock lock(gNfsConnection);
-  
-  if(!gNfsConnection.Connect(url, filename))
-    return false;
-  
-  m_pNfsContext = gNfsConnection.GetNfsContext(); 
-  
-  ret = gNfsConnection.GetImpl()->nfs_open(m_pNfsContext, filename.c_str(), O_RDONLY, &m_pFileHandle);
-  
-  if (ret != 0) 
-  {
-    CLog::Log(LOGINFO, "CFileNFS::Open: Unable to open file : '%s'  error : '%s'", url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
-    return false;
-  } 
-  
-  CLog::Log(LOGDEBUG,"CFileNFS::Open - opened %s",url.GetFileName().c_str());
-  m_url=url;
-  
-  struct __stat64 tmpBuffer;
-
-  if( Stat(&tmpBuffer) )
-  {
-    m_url.Reset();
-    Close();
-    return false;
-  }
-  
-  m_fileSize = tmpBuffer.st_size;//cache the size of this file
-  // We've successfully opened the file!
-  return true;
-}
-
-
-bool CFileNFS::Exists(const CURL& url)
-{
-  return Stat(url,NULL) == 0;
-}
-
-int CFileNFS::Stat(struct __stat64* buffer)
-{
-  return Stat(m_url,buffer);
-}
-
-
-int CFileNFS::Stat(const CURL& url, struct __stat64* buffer)
-{
-  int ret = 0;
-  CSingleLock lock(gNfsConnection);
-  CStdString filename = "";
-  
-  if(!gNfsConnection.Connect(url,filename))
-    return -1;
-   
-
-  struct stat tmpBuffer = {0};
-
-  ret = gNfsConnection.GetImpl()->nfs_stat(gNfsConnection.GetNfsContext(), filename.c_str(), &tmpBuffer);
-  
-  //if buffer == NULL we where called from Exists - in that case don't spam the log with errors
-  if (ret != 0 && buffer != NULL) 
-  {
-    CLog::Log(LOGERROR, "NFS: Failed to stat(%s) %s\n", url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
-    ret = -1;
-  }
-  else
-  {  
-    if(buffer)
-    {
-      memset(buffer, 0, sizeof(struct __stat64));
-      buffer->st_dev = tmpBuffer.st_dev;
-      buffer->st_ino = tmpBuffer.st_ino;
-      buffer->st_mode = tmpBuffer.st_mode;
-      buffer->st_nlink = tmpBuffer.st_nlink;
-      buffer->st_uid = tmpBuffer.st_uid;
-      buffer->st_gid = tmpBuffer.st_gid;
-      buffer->st_rdev = tmpBuffer.st_rdev;
-      buffer->st_size = tmpBuffer.st_size;
-      buffer->st_atime = tmpBuffer.st_atime;
-      buffer->st_mtime = tmpBuffer.st_mtime;
-      buffer->st_ctime = tmpBuffer.st_ctime;
-    }
-  }
-  return ret;
-}
-
-unsigned int CFileNFS::Read(void *lpBuf, int64_t uiBufSize)
-{
-  int numberOfBytesRead = 0;
-  CSingleLock lock(gNfsConnection);
-  
-  if (m_pFileHandle == NULL || m_pNfsContext == NULL ) return 0;
-
-  numberOfBytesRead = gNfsConnection.GetImpl()->nfs_read(m_pNfsContext, m_pFileHandle, (size_t)uiBufSize, (char *)lpBuf);  
-
-  lock.Leave();//no need to keep the connection lock after that
-  
-  gNfsConnection.resetKeepAlive(m_pFileHandle);//triggers keep alive timer reset for this filehandle
-  
-  //something went wrong ...
-  if (numberOfBytesRead < 0) 
-  {
-    CLog::Log(LOGERROR, "%s - Error( %d, %s )", __FUNCTION__, numberOfBytesRead, gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
-    return 0;
-  }
-  return (unsigned int)numberOfBytesRead;
-}
-
-int64_t CFileNFS::Seek(int64_t iFilePosition, int iWhence)
-{
-  int ret = 0;
-  off64_t offset = 0;
-
-  CSingleLock lock(gNfsConnection);  
-  if (m_pFileHandle == NULL || m_pNfsContext == NULL) return -1;
-  
-  ret = (int)gNfsConnection.GetImpl()->nfs_lseek(m_pNfsContext, m_pFileHandle, iFilePosition, iWhence, &offset);
-  if (ret < 0) 
-  {
-    CLog::Log(LOGERROR, "%s - Error( seekpos: %"PRId64", whence: %i, fsize: %"PRId64", %s)", __FUNCTION__, iFilePosition, iWhence, m_fileSize, gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
-    return -1;
-  }
-  return (int64_t)offset;
-}
-
-void CFileNFS::Close()
-{
-  CSingleLock lock(gNfsConnection);
-  
-  if (m_pFileHandle != NULL && m_pNfsContext != NULL)
-  {
-    int ret = 0;
-    CLog::Log(LOGDEBUG,"CFileNFS::Close closing file %s", m_url.GetFileName().c_str());
-    ret = gNfsConnection.GetImpl()->nfs_close(m_pNfsContext, m_pFileHandle);
-    gNfsConnection.removeFromKeepAliveList(m_pFileHandle);
-        
-         if (ret < 0) 
-    {
-      CLog::Log(LOGERROR, "Failed to close(%s) - %s\n", m_url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
-    }
-    m_pFileHandle = NULL;
-    m_pNfsContext = NULL;    
-    m_fileSize = 0;
-  }
-}
-
-//this was a bitch!
-//for nfs write to work we have to write chunked
-//otherwise this could crash on big files
-int CFileNFS::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  int numberOfBytesWritten = 0;
-  int writtenBytes = 0;
-  int64_t leftBytes = uiBufSize;
-  //clamp max write chunksize to 32kb - fixme - this might be superfluious with future libnfs versions
-  int64_t chunkSize = gNfsConnection.GetMaxWriteChunkSize() > 32768 ? 32768 : gNfsConnection.GetMaxWriteChunkSize();
-  
-  CSingleLock lock(gNfsConnection);
-  
-  if (m_pFileHandle == NULL || m_pNfsContext == NULL) return -1;
-  
-  //write as long as some bytes are left to be written
-  while( leftBytes )
-  {
-    //the last chunk could be smalle than chunksize
-    if(leftBytes < chunkSize)
-    {
-      chunkSize = leftBytes;//write last chunk with correct size
-    }
-    //write chunk
-    writtenBytes = gNfsConnection.GetImpl()->nfs_write(m_pNfsContext,
-                                  m_pFileHandle, 
-                                  (size_t)chunkSize, 
-                                  (char *)lpBuf + numberOfBytesWritten);
-    //decrease left bytes
-    leftBytes-= writtenBytes;
-    //increase overall written bytes
-    numberOfBytesWritten += writtenBytes;
-        
-    //danger - something went wrong
-    if (writtenBytes < 0) 
-    {
-      CLog::Log(LOGERROR, "Failed to pwrite(%s) %s\n", m_url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));        
-      break;
-    }     
-  }
-  //return total number of written bytes
-  return numberOfBytesWritten;
-}
-
-bool CFileNFS::Delete(const CURL& url)
-{
-  int ret = 0;
-  CSingleLock lock(gNfsConnection);
-  CStdString filename = "";
-  
-  if(!gNfsConnection.Connect(url, filename))
-    return false;
-  
-  
-  ret = gNfsConnection.GetImpl()->nfs_unlink(gNfsConnection.GetNfsContext(), filename.c_str());
-  
-  if(ret != 0)
-  {
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
-  }
-  return (ret == 0);
-}
-
-bool CFileNFS::Rename(const CURL& url, const CURL& urlnew)
-{
-  int ret = 0;
-  CSingleLock lock(gNfsConnection);
-  CStdString strFile = "";
-  
-  if(!gNfsConnection.Connect(url,strFile))
-    return false;
-  
-  CStdString strFileNew;
-  CStdString strDummy;
-  gNfsConnection.splitUrlIntoExportAndPath(urlnew, strDummy, strFileNew);
-  
-  ret = gNfsConnection.GetImpl()->nfs_rename(gNfsConnection.GetNfsContext() , strFile.c_str(), strFileNew.c_str());
-  
-  if(ret != 0)
-  {
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
-  } 
-  return (ret == 0);
-}
-
-bool CFileNFS::OpenForWrite(const CURL& url, bool bOverWrite)
-{ 
-  int ret = 0;
-  // we can't open files like nfs://file.f or nfs://server/file.f
-  // if a file matches the if below return false, it can't exist on a nfs share.
-  if (!IsValidFile(url.GetFileName())) return false;
-  
-  Close();
-  CSingleLock lock(gNfsConnection);
-  CStdString filename = "";
-  
-  if(!gNfsConnection.Connect(url,filename))
-    return false;
-  
-  m_pNfsContext = gNfsConnection.GetNfsContext();
-  
-  if (bOverWrite)
-  {
-    CLog::Log(LOGWARNING, "FileNFS::OpenForWrite() called with overwriting enabled! - %s", filename.c_str());
-    //create file with proper permissions
-    ret = gNfsConnection.GetImpl()->nfs_creat(m_pNfsContext, filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, &m_pFileHandle);    
-    //if file was created the file handle isn't valid ... so close it and open later
-    if(ret == 0)
-    {
-      gNfsConnection.GetImpl()->nfs_close(m_pNfsContext,m_pFileHandle);
-    }
-  }
-
-  ret = gNfsConnection.GetImpl()->nfs_open(m_pNfsContext, filename.c_str(), O_RDWR, &m_pFileHandle);
-  
-  if (ret || m_pFileHandle == NULL)
-  {
-    // write error to logfile
-    CLog::Log(LOGERROR, "CFileNFS::Open: Unable to open file : '%s' error : '%s'", filename.c_str(), gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
-    return false;
-  }
-  m_url=url;
-  
-  struct __stat64 tmpBuffer = {0};
-
-  //only stat if file was not created
-  if(!bOverWrite) 
-  {
-    if(Stat(&tmpBuffer))
-    {
-      m_url.Reset();
-      Close();
-      return false;
-    }
-    m_fileSize = tmpBuffer.st_size;//cache filesize of this file    
-  }
-  else//file was created - filesize is zero
-  {
-    m_fileSize = 0;    
-  }
-  
-  // We've successfully opened the file!
-  return true;
-}
-
-bool CFileNFS::IsValidFile(const CStdString& strFileName)
-{
-  if (strFileName.Find('/') == -1 || /* doesn't have sharename */
-      strFileName.Right(2) == "/." || /* not current folder */
-      strFileName.Right(3) == "/..")  /* not parent folder */
-    return false;
-  return true;
-}
-#endif//HAS_FILESYSTEM_NFS
-
diff --git a/xbmc/filesystem/FileNFS.h b/xbmc/filesystem/FileNFS.h
deleted file mode 100644 (file)
index ca42686..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileNFS.h: interface for the CFileNFS class.
-#ifndef FILENFS_H_
-#define FILENFS_H_
-
-#include "IFile.h"
-#include "URL.h"
-#include "threads/CriticalSection.h"
-#include <list>
-#include "SectionLoader.h"
-#include <map>
-
-#ifdef TARGET_WINDOWS
-#define S_IRGRP 0
-#define S_IROTH 0
-#define S_IWUSR _S_IWRITE
-#define S_IRUSR _S_IREAD
-#define        S_IFLNK 0120000
-
-#define S_ISBLK(m) (0)
-#define S_ISSOCK(m) (0)
-#define S_ISLNK(m) ((m & S_IFLNK) != 0)
-#define S_ISCHR(m) ((m & _S_IFCHR) != 0)
-#define S_ISDIR(m) ((m & _S_IFDIR) != 0)
-#define S_ISFIFO(m) ((m & _S_IFIFO) != 0)
-#define S_ISREG(m) ((m & _S_IFREG) != 0)
-#endif
-
-class DllLibNfs;
-
-class CNfsConnection : public CCriticalSection
-{     
-public:
-  typedef std::map<struct nfsfh  *, unsigned int> tFileKeepAliveMap;  
-
-  struct contextTimeout
-  {
-    struct nfs_context *pContext;
-    uint64_t lastAccessedTime;
-  };
-
-  typedef std::map<std::string, struct contextTimeout> tOpenContextMap;    
-  
-  CNfsConnection();
-  ~CNfsConnection();
-  bool Connect(const CURL &url, CStdString &relativePath);
-  struct nfs_context *GetNfsContext(){return m_pNfsContext;}
-  size_t            GetMaxReadChunkSize(){return m_readChunkSize;}
-  size_t            GetMaxWriteChunkSize(){return m_writeChunkSize;} 
-  DllLibNfs        *GetImpl(){return m_pLibNfs;}
-  std::list<CStdString> GetExportList(const CURL &url);
-  //this functions splits the url into the exportpath (feed to mount) and the rest of the path
-  //relative to the mounted export
-  bool splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath);
-  
-  //special stat which uses its own context
-  //needed for getting intervolume symlinks to work
-  int stat(const CURL &url, struct stat *statbuff);
-
-  void AddActiveConnection();
-  void AddIdleConnection();
-  void CheckIfIdle();
-  void Deinit();
-  bool HandleDyLoad();//loads the lib if needed
-  //adds the filehandle to the keep alive list or resets
-  //the timeout for this filehandle if already in list
-  void resetKeepAlive(struct nfsfh  *_pFileHandle);
-  //removes file handle from keep alive list
-  void removeFromKeepAliveList(struct nfsfh  *_pFileHandle);  
-  
-  const CStdString& GetConnectedIp() const {return m_resolvedHostName;}
-  const CStdString& GetConnectedExport() const {return m_exportPath;}
-
-private:
-  struct nfs_context *m_pNfsContext;//current nfs context
-  CStdString m_exportPath;//current connected export path
-  CStdString m_hostName;//current connected host
-  CStdString m_resolvedHostName;//current connected host - as ip
-  size_t m_readChunkSize;//current read chunksize of connected server
-  size_t m_writeChunkSize;//current write chunksize of connected server
-  int m_OpenConnections;//number of open connections
-  unsigned int m_IdleTimeout;//timeout for idle connection close and dyunload
-  tFileKeepAliveMap m_KeepAliveTimeouts;//mapping filehandles to its idle timeout
-  tOpenContextMap m_openContextMap;//unique map for tracking all open contexts
-  DllLibNfs *m_pLibNfs;//the lib
-  std::list<CStdString> m_exportList;//list of exported pathes of current connected servers
-  CCriticalSection keepAliveLock;
-  void clearMembers();
-  struct nfs_context *getContextFromMap(const CStdString &exportname);
-  int  getContextForExport(const CStdString &exportname);//get context for given export and add to open contexts map - sets m_pNfsContext (my return a already mounted cached context)
-  void destroyOpenContexts();
-  void resolveHost(const CURL &url);//resolve hostname by dnslookup
-  void keepAlive(struct nfsfh  *_pFileHandle);
-};
-
-extern CNfsConnection gNfsConnection;
-
-namespace XFILE
-{
-  class CFileNFS : public IFile
-  {
-  public:
-    CFileNFS();
-    virtual ~CFileNFS();
-    virtual void Close();
-    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-    virtual bool Open(const CURL& url);
-    virtual bool Exists(const CURL& url);
-    virtual int Stat(const CURL& url, struct __stat64* buffer);
-    virtual int Stat(struct __stat64* buffer);
-    virtual int64_t GetLength();
-    virtual int64_t GetPosition();
-    virtual int Write(const void* lpBuf, int64_t uiBufSize);
-    //implement iocontrol for seek_possible for preventing the stat in File class for
-    //getting this info ...
-    virtual int IoControl(EIoControl request, void* param){ if(request == IOCTRL_SEEK_POSSIBLE) return 1;return -1;};    
-    virtual int  GetChunkSize() {return 1;}
-    
-    virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-    virtual bool Delete(const CURL& url);
-    virtual bool Rename(const CURL& url, const CURL& urlnew);    
-  protected:
-    CURL m_url;
-    bool IsValidFile(const CStdString& strFileName);
-    int64_t m_fileSize;
-    struct nfsfh  *m_pFileHandle;
-    struct nfs_context *m_pNfsContext;//current nfs context    
-  };
-}
-#endif // FILENFS_H_
-
-
diff --git a/xbmc/filesystem/FilePipe.cpp b/xbmc/filesystem/FilePipe.cpp
deleted file mode 100644 (file)
index 1a55336..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FilePipe.h"
-#include "threads/SingleLock.h"
-#include "PipesManager.h"
-#include "utils/StringUtils.h"
-
-using namespace XFILE;
-
-CFilePipe::CFilePipe() : m_pos(0), m_length(-1), m_pipe(NULL)
-{
-}
-
-CFilePipe::~CFilePipe()
-{
-  Close();
-}
-
-int64_t CFilePipe::GetPosition()
-{
-  return m_pos;
-}
-
-int64_t CFilePipe::GetLength()
-{
-  return m_length;
-}
-
-void CFilePipe::SetLength(int64_t len)
-{
-  m_length = len;
-}
-
-bool CFilePipe::Open(const CURL& url)
-{
-  CStdString name = url.Get();
-  m_pipe = PipesManager::GetInstance().OpenPipe(name);
-  if (m_pipe)
-    m_pipe->AddListener(this);
-  return (m_pipe != NULL);
-}
-
-bool CFilePipe::Exists(const CURL& url)
-{
-  CStdString name = url.Get();
-  return PipesManager::GetInstance().Exists(name);
-}
-
-int CFilePipe::Stat(const CURL& url, struct __stat64* buffer)
-{
-  return -1;
-}
-
-int CFilePipe::Stat(struct __stat64* buffer)
-{
-  memset(buffer,0,sizeof(struct __stat64));
-  buffer->st_size = m_length;
-  return 0;
-}
-
-unsigned int CFilePipe::Read(void* lpBuf, int64_t uiBufSize)
-{
-  if (!m_pipe)
-    return -1;
-  
-  return m_pipe->Read((char *)lpBuf,(int)uiBufSize,INFINITE);
-}
-
-int CFilePipe::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  if (!m_pipe)
-    return -1;
-  
-  return (int)(m_pipe->Write((const char *)lpBuf,(int)uiBufSize,INFINITE)); // its not the size. its bool. either all was written or not.
-}
-
-void CFilePipe::SetEof()
-{
-  if (!m_pipe)
-    return ;
-  m_pipe->SetEof();
-}
-
-bool CFilePipe::IsEof()
-{
-  if (!m_pipe)
-    return true;
-  return m_pipe->IsEof();
-}
-
-bool CFilePipe::IsEmpty()
-{
-  if (!m_pipe)
-    return true;
-  return m_pipe->IsEmpty();
-}
-
-int64_t CFilePipe::Seek(int64_t iFilePosition, int iWhence)
-{
-  return -1;
-}
-
-void CFilePipe::Close()
-{
-  if (m_pipe)
-  {
-    m_pipe->RemoveListener(this);
-    PipesManager::GetInstance().ClosePipe(m_pipe);    
-  }
-  m_pipe = NULL;
-}
-
-bool CFilePipe::IsClosed()
-{
-  return (m_pipe == NULL);
-}
-
-void CFilePipe::Flush()
-{
-  if (m_pipe)
-    m_pipe->Flush();
-}
-
-bool CFilePipe::OpenForWrite(const CURL& url, bool bOverWrite)
-{
-  CStdString name = url.Get();
-
-  m_pipe = PipesManager::GetInstance().CreatePipe(name);
-  if (m_pipe)
-    m_pipe->AddListener(this);
-  return (m_pipe != NULL);
-}
-
-bool CFilePipe::Delete(const CURL& url)
-{
-  return false;
-}
-
-bool CFilePipe::Rename(const CURL& url, const CURL& urlnew)
-{
-  return false;
-}
-
-int CFilePipe::IoControl(int request, void* param)
-{
-  return -1;
-}
-
-CStdString CFilePipe::GetName() const
-{
-  if (!m_pipe)
-    return StringUtils::EmptyString;
-  return m_pipe->GetName();
-}
-
-void CFilePipe::OnPipeOverFlow()
-{
-  CSingleLock lock(m_lock);
-  for (size_t l=0; l<m_listeners.size(); l++)
-    m_listeners[l]->OnPipeOverFlow();
-}
-
-__int64        CFilePipe::GetAvailableRead()
-{
-  return m_pipe->GetAvailableRead();
-}
-
-void CFilePipe::OnPipeUnderFlow()
-{
-  for (size_t l=0; l<m_listeners.size(); l++)
-    m_listeners[l]->OnPipeUnderFlow();
-}
-
-void CFilePipe::AddListener(IPipeListener *l)
-{
-  CSingleLock lock(m_lock);
-  for (size_t i=0; i<m_listeners.size(); i++)
-  {
-    if (m_listeners[i] == l)
-      return;
-  }
-  m_listeners.push_back(l);
-}
-
-void CFilePipe::RemoveListener(IPipeListener *l)
-{
-  CSingleLock lock(m_lock);
-  std::vector<XFILE::IPipeListener *>::iterator i = m_listeners.begin();
-  while(i != m_listeners.end())
-  {
-    if ( (*i) == l)
-      i = m_listeners.erase(i);
-    else
-      i++;
-  }
-}
-
-void CFilePipe::SetOpenThreashold(int threashold)
-{
-  m_pipe->SetOpenThreashold(threashold);
-}
-
diff --git a/xbmc/filesystem/FilePipe.h b/xbmc/filesystem/FilePipe.h
deleted file mode 100644 (file)
index 01a0957..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * XBMC Media Center
- * Copyright (c) 2002 Frodo
- * Portions Copyright (c) by the authors of ffmpeg and xvid
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-// FilePipe.h: interface for the CFilePipe class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
-#define AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "IFile.h"
-#include "utils/AutoPtrHandle.h"
-#include "utils/StdString.h"
-#include "threads/Event.h"
-#include "threads/CriticalSection.h"
-#include "utils/RingBuffer.h"
-#include "PipesManager.h"
-
-namespace XFILE
-{
-  
-class CFilePipe : public IFile, public IPipeListener
-{
-public:
-  CFilePipe();
-  virtual ~CFilePipe();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual void SetLength(int64_t len);
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual int Stat(struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int Write(const void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual void Flush();
-  virtual __int64      GetAvailableRead();
-
-  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-
-  virtual bool Delete(const CURL& url);
-  virtual bool Rename(const CURL& url, const CURL& urlnew);
-  virtual int IoControl(int request, void* param);
-  
-  CStdString GetName() const;
-  
-  virtual void OnPipeOverFlow();
-  virtual void OnPipeUnderFlow();
-
-  void AddListener(IPipeListener *l);
-  void RemoveListener(IPipeListener *l);
-
-  void SetEof();
-  bool IsEof();
-  bool IsEmpty();
-  bool IsClosed();
-  
-  void SetOpenThreashold(int threashold);
-
-protected:
-  int64_t m_pos;
-  int64_t m_length;
-  
-  XFILE::Pipe *m_pipe;
-  
-  CCriticalSection m_lock;
-  std::vector<XFILE::IPipeListener *> m_listeners;
-};
-
-}
-#endif // !defined(AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
diff --git a/xbmc/filesystem/FileRTV.cpp b/xbmc/filesystem/FileRTV.cpp
deleted file mode 100644 (file)
index b1a7e4f..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileRTV.cpp: implementation of the CFileRTV class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "FileRTV.h"
-#include "SectionLoader.h"
-#include "URL.h"
-#include "utils/log.h"
-#include <errno.h>
-#include <sys/stat.h>
-#ifdef _WIN32
-#include "PlatformDefs.h" //for PRIdS
-#endif
-extern "C"
-{
-#include "lib/libRTV/interface.h"
-}
-
-
-using namespace XFILE;
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CFileRTV::CFileRTV()
-{
-  CSectionLoader::Load("LIBRTV");
-  m_filePos = 0;
-  m_fileSize = 0;
-  m_bOpened = false;
-  m_rtvd = NULL;
-}
-
-CFileRTV::~CFileRTV()
-{
-  Close();
-  CSectionLoader::Unload("LIBRTV");
-}
-
-//*********************************************************************************************
-bool CFileRTV::Open(const char* strHostName, const char* strFileName, int iport)
-{
-  // Close any existing connection
-  if (m_bOpened) Close();
-
-  m_bOpened = false;
-
-  // Set up global variables.  Don't set m_filePos to 0 because we use it to SEEK!
-  m_fileSize = 0;
-  m_rtvd = NULL;
-  strcpy(m_hostName, strHostName);
-  strcpy(m_fileName, strFileName);
-  m_iport = iport;
-
-  // Allow for ReplayTVs on ports other than 80
-  CStdString strHostAndPort;
-  strHostAndPort = strHostName;
-  if (iport)
-  {
-    char buffer[10];
-    sprintf(buffer,"%i",iport);
-    strHostAndPort += ':';
-    strHostAndPort += buffer;
-  }
-
-  // Get the file size of strFileName.  If size is 0 or negative, file doesn't exist so exit.
-  u64 size;
-  size = rtv_get_filesize(strHostAndPort.c_str(), strFileName);
-  if (!size)
-  {
-    CLog::Log(LOGERROR, "%s - Failed to get filesize of %s on %s", __FUNCTION__, strHostName, strFileName);
-    return false;
-  }
-  m_fileSize = size;
-
-  // Open a connection to strFileName stating at position m_filePos
-  // Store the handle to the connection in m_rtvd.  Exit if handle invalid.
-  m_rtvd = rtv_open_file(strHostAndPort.c_str(), strFileName, m_filePos);
-  if (!m_rtvd)
-  {
-    CLog::Log(LOGERROR, "%s - Failed to open %s on %s", __FUNCTION__, strHostName, strFileName);
-    return false;
-  }
-  m_bOpened = true;
-
-  CLog::Log(LOGDEBUG, "%s - Opened %s on %s, Size %"PRIu64", Position %"PRIu64"", __FUNCTION__, strHostName, strFileName, m_fileSize, m_filePos);
-  return true;
-}
-
-bool CFileRTV::Open(const CURL& url)
-{
-  return Open(url.GetHostName(), url.GetFileName(), url.GetPort());
-}
-
-bool CFileRTV::Exists(const CURL& url)
-{
-  return true;
-}
-
-int CFileRTV::Stat(const CURL& url, struct __stat64* buffer)
-{
-  errno = ENOENT;
-  return -1;
-}
-
-//*********************************************************************************************
-unsigned int CFileRTV::Read(void *lpBuf, int64_t uiBufSize)
-{
-  size_t lenread;
-
-  // Don't read if no connection is open!
-  if (!m_bOpened) return 0;
-
-  // Read uiBufSize bytes from the m_rtvd connection
-  lenread = rtv_read_file(m_rtvd, (char *) lpBuf, (size_t) uiBufSize);
-
-  CLog::Log(LOGDEBUG, "%s - Requested %"PRIdS", Recieved %"PRIdS"", __FUNCTION__, (size_t)uiBufSize, lenread);
-
-  // Some extra checking so library behaves
-  if(m_filePos + lenread > m_fileSize)
-  {
-    CLog::Log(LOGWARNING, "%s - RTV library read passed filesize, returning last chunk", __FUNCTION__);
-    lenread = (size_t)(m_fileSize - m_filePos);
-    m_filePos = m_fileSize;
-    return lenread;
-  }
-
-  // Increase the file position by the number of bytes we just read
-  m_filePos += lenread;
-
-  // Return the number of bytes we just read
-  return lenread;
-}
-
-//*********************************************************************************************
-void CFileRTV::Close()
-{
-  m_bOpened = false;
-
-  // Only try to close a valid handle!
-  if (m_rtvd)
-  {
-    rtv_close_file(m_rtvd);
-  }
-  m_rtvd = NULL;
-}
-
-//*********************************************************************************************
-int64_t CFileRTV::Seek(int64_t iFilePosition, int iWhence)
-{
-  UINT64 newpos;
-
-  if (!m_bOpened) return 0;
-  switch (iWhence)
-  {
-  case SEEK_SET:
-    // cur = pos
-    newpos = iFilePosition;
-    break;
-  case SEEK_CUR:
-    // cur += pos
-    newpos = m_filePos + iFilePosition;
-    break;
-  case SEEK_END:
-    // end += pos
-    newpos = m_fileSize + iFilePosition;
-    break;
-  default:
-    return -1;
-  }
-  // Return offset from beginning
-  if (newpos > m_fileSize) newpos = m_fileSize;
-
-  // NEW CODE
-  // If the new file position is different from the old, then we must SEEK there!
-  if (m_filePos != newpos)
-  {
-    m_filePos = newpos;
-    Open(m_hostName, m_fileName, m_iport);
-  }
-
-  // OLD CODE
-  // Below is old code that may be useful again.  For some reason I'm not sure of, XBMC
-  // does a few seeks to the beginning and end of the stream before it ever starts playing.
-  // When used instead of the code above, this code seeks only after playing begins.
-  // Theoretically, this saves some time because it prevents needless re-opening of the
-  // connection to the RTV, but in practice it seems to be the same.
-  //m_filePos = newpos;
-
-  //if (m_rtvd->firstReadDone && iWhence == SEEK_SET) {
-  // Open(NULL, NULL, m_hostName, m_fileName, m_iport, true);
-  //}
-
-  // Return the new file position after the seek
-  return m_filePos;
-}
-
-//*********************************************************************************************
-int64_t CFileRTV::GetLength()
-{
-  if (!m_bOpened) return 0;
-  return m_fileSize;
-}
-
-//*********************************************************************************************
-int64_t CFileRTV::GetPosition()
-{
-  if (!m_bOpened) return 0;
-  return m_filePos;
-}
diff --git a/xbmc/filesystem/FileRTV.h b/xbmc/filesystem/FileRTV.h
deleted file mode 100644 (file)
index 40c5ae8..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileRTV.h: interface for the CFileRTV class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_FILERTV_H___INCLUDED_)
-#define AFX_FILERTV_H___INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include "IFile.h"
-
-typedef struct rtv_data * RTVD;
-
-namespace XFILE
-{
-
-class CFileRTV : public IFile
-{
-public:
-  CFileRTV();
-  virtual ~CFileRTV();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  bool Open(const char* strHostName, const char* strFileName, int iport);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-protected:
-  uint64_t m_fileSize;
-  uint64_t m_filePos;
-  char m_hostName[255];
-  char m_fileName[255];
-  int m_iport;
-private:
-  RTVD m_rtvd;
-  bool m_bOpened;
-
-};
-}
-
-#endif // !defined(AFX_FILERTV_H___INCLUDED_)
diff --git a/xbmc/filesystem/FileRar.cpp b/xbmc/filesystem/FileRar.cpp
deleted file mode 100644 (file)
index 9c87a35..0000000
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "system.h"
-#include "FileRar.h"
-#include <sys/stat.h>
-#include "Util.h"
-#include "utils/CharsetConverter.h"
-#include "utils/URIUtils.h"
-#include "URL.h"
-#include "Directory.h"
-#include "RarManager.h"
-#include "settings/AdvancedSettings.h"
-#include "FileItem.h"
-#include "utils/log.h"
-#include "UnrarXLib/rar.hpp"
-
-#ifndef _LINUX
-#include <process.h>
-#endif
-
-using namespace XFILE;
-using namespace std;
-
-#define SEEKTIMOUT 30000
-
-#ifdef HAS_FILESYSTEM_RAR
-CFileRarExtractThread::CFileRarExtractThread() : hRunning(true), hQuit(true)
-{
-  m_pArc = NULL;
-  m_pCmd = NULL;
-  m_pExtract = NULL;
-  StopThread();
-  Create();
-}
-
-CFileRarExtractThread::~CFileRarExtractThread()
-{
-  hQuit.Set();
-  AbortableWait(hRestart);
-  StopThread();
-}
-
-void CFileRarExtractThread::Start(Archive* pArc, CommandData* pCmd, CmdExtract* pExtract, int iSize)
-{
-  m_pArc = pArc;
-  m_pCmd = pCmd;
-  m_pExtract = pExtract;
-  m_iSize = iSize;
-
-  m_pExtract->GetDataIO().hBufferFilled = new CEvent;
-  m_pExtract->GetDataIO().hBufferEmpty = new CEvent;
-  m_pExtract->GetDataIO().hSeek = new CEvent(true);
-  m_pExtract->GetDataIO().hSeekDone = new CEvent;
-  m_pExtract->GetDataIO().hQuit = new CEvent(true);
-
-  hRunning.Set();
-  hRestart.Set();
-}
-
-void CFileRarExtractThread::OnStartup()
-{
-}
-
-void CFileRarExtractThread::OnExit()
-{
-}
-
-void CFileRarExtractThread::Process()
-{
-  while (AbortableWait(hQuit,1) != WAIT_SIGNALED)
-  {
-    if (AbortableWait(hRestart,1) == WAIT_SIGNALED)
-    {
-      bool Repeat = false;
-      try
-      {
-        m_pExtract->ExtractCurrentFile(m_pCmd,*m_pArc,m_iSize,Repeat);
-      }
-      catch (int rarErrCode)
-      {
-        CLog::Log(LOGERROR,"filerar CFileRarExtractThread::Process failed. CmdExtract::ExtractCurrentFile threw a UnrarXLib error code of %d",rarErrCode);
-      }
-      catch (...)
-      {
-        CLog::Log(LOGERROR,"filerar CFileRarExtractThread::Process failed. CmdExtract::ExtractCurrentFile threw an Unknown exception");
-      }
-
-      hRunning.Reset();
-    }
-  }
-  hRestart.Set();
-}
-#endif
-
-CFileRar::CFileRar()
-{
-  m_strCacheDir.Empty();
-  m_strRarPath.Empty();
-  m_strPassword.Empty();
-  m_strPathInRar.Empty();
-  m_bFileOptions = 0;
-#ifdef HAS_FILESYSTEM_RAR
-  m_pArc = NULL;
-  m_pCmd = NULL;
-  m_pExtract = NULL;
-  m_pExtractThread = NULL;
-#endif
-  m_szBuffer = NULL;
-  m_szStartOfBuffer = NULL;
-  m_iDataInBuffer = 0;
-  m_bUseFile = false;
-  m_bOpen = false;
-  m_bSeekable = true;
-}
-
-CFileRar::~CFileRar()
-{
-#ifdef HAS_FILESYSTEM_RAR
-  if (!m_bOpen)
-    return;
-
-  if (m_bUseFile)
-  {
-    m_File.Close();
-    g_RarManager.ClearCachedFile(m_strRarPath,m_strPathInRar);
-  }
-  else
-  {
-    CleanUp();
-    if (m_pExtractThread)
-    {
-      delete m_pExtractThread;
-      m_pExtractThread = NULL;
-    }
-  }
-#endif
-}
-
-bool CFileRar::Open(const CURL& url)
-{
-  InitFromUrl(url);
-  CFileItemList items;
-  g_RarManager.GetFilesInRar(items,m_strRarPath,false);
-  int i;
-  for (i=0;i<items.Size();++i)
-  {
-    if (items[i]->GetLabel() == m_strPathInRar)
-      break;
-  }
-
-  if (i<items.Size())
-  {
-    if (items[i]->m_idepth == 0x30) // stored
-    {
-      if (!OpenInArchive())
-        return false;
-
-      m_iFileSize = items[i]->m_dwSize;
-      m_bOpen = true;
-
-      // perform 'noidx' check
-      CFileInfo* pFile = g_RarManager.GetFileInRar(m_strRarPath,m_strPathInRar);
-      if (pFile)
-      {
-        if (pFile->m_iIsSeekable == -1)
-        {
-          if (Seek(-1,SEEK_END) == -1)
-          {
-            m_bSeekable = false;
-            pFile->m_iIsSeekable = 0;
-          }
-        }
-        else
-          m_bSeekable = (pFile->m_iIsSeekable == 1);
-      }
-      return true;
-    }
-    else
-    {
-      CFileInfo* info = g_RarManager.GetFileInRar(m_strRarPath,m_strPathInRar);
-      if ((!info || !CFile::Exists(info->m_strCachedPath)) && m_bFileOptions & EXFILE_NOCACHE)
-        return false;
-      m_bUseFile = true;
-      CStdString strPathInCache;
-
-      if (!g_RarManager.CacheRarredFile(strPathInCache, m_strRarPath, m_strPathInRar,
-                                        EXFILE_AUTODELETE | m_bFileOptions, m_strCacheDir,
-                                        items[i]->m_dwSize))
-      {
-        CLog::Log(LOGERROR,"filerar::open failed to cache file %s",m_strPathInRar.c_str());
-        return false;
-      }
-
-      if (!m_File.Open( strPathInCache ))
-      {
-        CLog::Log(LOGERROR,"filerar::open failed to open file in cache: %s",strPathInCache.c_str());
-        return false;
-      }
-
-      m_bOpen = true;
-      return true;
-    }
-  }
-  return false;
-}
-
-bool CFileRar::Exists(const CURL& url)
-{
-  InitFromUrl(url);
-  bool bResult;
-
-  if (!g_RarManager.IsFileInRar(bResult, m_strRarPath, m_strPathInRar))
-    return false;
-
-  return bResult;
-}
-
-int CFileRar::Stat(const CURL& url, struct __stat64* buffer)
-{
-  memset(buffer, 0, sizeof(struct __stat64));
-  if (Open(url))
-  {
-    buffer->st_size = GetLength();
-    buffer->st_mode = _S_IFREG;
-    Close();
-    errno = 0;
-    return 0;
-  }
-
-  if (CDirectory::Exists(url.Get()))
-  {
-    buffer->st_mode = _S_IFDIR;
-    return 0;
-  }
-
-  errno = ENOENT;
-  return -1;
-}
-
-bool CFileRar::OpenForWrite(const CURL& url)
-{
-  return false;
-}
-
-unsigned int CFileRar::Read(void *lpBuf, int64_t uiBufSize)
-{
-#ifdef HAS_FILESYSTEM_RAR
-  if (!m_bOpen)
-    return 0;
-
-  if (m_bUseFile)
-    return m_File.Read(lpBuf,uiBufSize);
-
-  if (m_iFilePosition >= GetLength()) // we are done
-    return 0;
-
-  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(5000) )
-  {
-    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
-    return 0;
-  }
-
-
-  byte* pBuf = (byte*)lpBuf;
-  int64_t uicBufSize = uiBufSize;
-  if (m_iDataInBuffer > 0)
-  {
-    int64_t iCopy = uiBufSize<m_iDataInBuffer?uiBufSize:m_iDataInBuffer;
-    memcpy(lpBuf,m_szStartOfBuffer,size_t(iCopy));
-    m_szStartOfBuffer += iCopy;
-    m_iDataInBuffer -= int(iCopy);
-    pBuf += iCopy;
-    uicBufSize -= iCopy;
-    m_iFilePosition += iCopy;
-  }
-
-  while ((uicBufSize > 0) && m_iFilePosition < GetLength() )
-  {
-    if (m_iDataInBuffer <= 0)
-    {
-      m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,MAXWINMEMSIZE);
-      m_szStartOfBuffer = m_szBuffer;
-      m_iBufferStart = m_iFilePosition;
-    }
-
-    m_pExtract->GetDataIO().hBufferFilled->Set();
-    m_pExtract->GetDataIO().hBufferEmpty->Wait();
-
-    if (m_pExtract->GetDataIO().NextVolumeMissing)
-      break;
-
-    m_iDataInBuffer = MAXWINMEMSIZE-m_pExtract->GetDataIO().UnpackToMemorySize;
-
-    if (m_iDataInBuffer == 0)
-      break;
-
-    if (m_iDataInBuffer > uicBufSize)
-    {
-      memcpy(pBuf,m_szStartOfBuffer,int(uicBufSize));
-      m_szStartOfBuffer += uicBufSize;
-      pBuf += int(uicBufSize);
-      m_iFilePosition += uicBufSize;
-      m_iDataInBuffer -= int(uicBufSize);
-      uicBufSize = 0;
-    }
-    else
-    {
-      memcpy(pBuf,m_szStartOfBuffer,size_t(m_iDataInBuffer));
-      m_iFilePosition += m_iDataInBuffer;
-      m_szStartOfBuffer += m_iDataInBuffer;
-      uicBufSize -= m_iDataInBuffer;
-      pBuf += m_iDataInBuffer;
-      m_iDataInBuffer = 0;
-    }
-  }
-
-  m_pExtract->GetDataIO().hBufferEmpty->Set();
-
-  return static_cast<unsigned int>(uiBufSize-uicBufSize);
-#else
-  return 0;
-#endif
-}
-
-unsigned int CFileRar::Write(void *lpBuf, int64_t uiBufSize)
-{
-  return 0;
-}
-
-void CFileRar::Close()
-{
-#ifdef HAS_FILESYSTEM_RAR
-  if (!m_bOpen)
-    return;
-
-  if (m_bUseFile)
-  {
-    m_File.Close();
-    g_RarManager.ClearCachedFile(m_strRarPath,m_strPathInRar);
-    m_bOpen = false;
-  }
-  else
-  {
-    CleanUp();
-    if (m_pExtractThread)
-    {
-      delete m_pExtractThread;
-      m_pExtractThread = NULL;
-    }
-    m_bOpen = false;
-  }
-#endif
-}
-
-int64_t CFileRar::Seek(int64_t iFilePosition, int iWhence)
-{
-#ifdef HAS_FILESYSTEM_RAR
-  if (!m_bOpen)
-    return -1;
-
-  if (!m_bSeekable)
-    return -1;
-
-  if (m_bUseFile)
-    return m_File.Seek(iFilePosition,iWhence);
-
-  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
-  {
-    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
-    return -1;
-  }
-
-  m_pExtract->GetDataIO().hBufferEmpty->Set();
-
-  switch (iWhence)
-  {
-    case SEEK_CUR:
-      if (iFilePosition == 0)
-        return m_iFilePosition; // happens sometimes
-
-      iFilePosition += m_iFilePosition;
-      break;
-    case SEEK_END:
-      if (iFilePosition == 0) // do not seek to end
-      {
-        m_iFilePosition = this->GetLength();
-        m_iDataInBuffer = 0;
-        m_iBufferStart = this->GetLength();
-
-        return this->GetLength();
-      }
-
-      iFilePosition += GetLength();
-    case SEEK_SET:
-      break;
-    default:
-      return -1;
-  }
-
-  if (iFilePosition > this->GetLength())
-    return -1;
-
-  if (iFilePosition == m_iFilePosition) // happens a lot
-    return m_iFilePosition;
-
-  if ((iFilePosition >= m_iBufferStart) && (iFilePosition < m_iBufferStart+MAXWINMEMSIZE)
-                                        && (m_iDataInBuffer > 0)) // we are within current buffer
-  {
-    m_iDataInBuffer = MAXWINMEMSIZE-(iFilePosition-m_iBufferStart);
-    m_szStartOfBuffer = m_szBuffer+MAXWINMEMSIZE-m_iDataInBuffer;
-    m_iFilePosition = iFilePosition;
-
-    return m_iFilePosition;
-  }
-
-  if (iFilePosition < m_iBufferStart )
-  {
-    CleanUp();
-    if (!OpenInArchive())
-      return -1;
-
-    if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
-    {
-      CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
-      return -1;
-    }
-    m_pExtract->GetDataIO().hBufferEmpty->Set();
-    m_pExtract->GetDataIO().m_iSeekTo = iFilePosition;
-  }
-  else
-    m_pExtract->GetDataIO().m_iSeekTo = iFilePosition;
-
-  m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,MAXWINMEMSIZE);
-  m_pExtract->GetDataIO().hSeek->Set();
-  m_pExtract->GetDataIO().hBufferFilled->Set();
-  if( !m_pExtract->GetDataIO().hSeekDone->WaitMSec(SEEKTIMOUT))
-  {
-    CLog::Log(LOGERROR, "%s - Timeout waiting for seek to finish", __FUNCTION__);
-    return -1;
-  }
-
-  if (m_pExtract->GetDataIO().NextVolumeMissing)
-  {
-    m_iFilePosition = m_iFileSize;
-    return -1;
-  }
-
-  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
-  {
-    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
-    return -1;
-  }
-  m_iDataInBuffer = m_pExtract->GetDataIO().m_iSeekTo; // keep data
-  m_iBufferStart = m_pExtract->GetDataIO().m_iStartOfBuffer;
-  m_szStartOfBuffer = m_szBuffer+MAXWINMEMSIZE-m_iDataInBuffer;
-  m_iFilePosition = iFilePosition;
-
-  return m_iFilePosition;
-#else
-  return -1;
-#endif
-}
-
-int64_t CFileRar::GetLength()
-{
-  if (!m_bOpen)
-    return 0;
-
-  if (m_bUseFile)
-    return m_File.GetLength();
-
-  return m_iFileSize;
-}
-
-int64_t CFileRar::GetPosition()
-{
-  if (!m_bOpen)
-    return -1;
-
-  if (m_bUseFile)
-    return m_File.GetPosition();
-
-  return m_iFilePosition;
-}
-
-int CFileRar::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  return -1;
-}
-
-void CFileRar::Flush()
-{
-  if (m_bUseFile)
-    m_File.Flush();
-}
-
-void CFileRar::InitFromUrl(const CURL& url)
-{
-  m_strCacheDir = g_advancedSettings.m_cachePath;//url.GetDomain();
-  URIUtils::AddSlashAtEnd(m_strCacheDir);
-  m_strRarPath = url.GetHostName();
-  m_strPassword = url.GetUserName();
-  m_strPathInRar = url.GetFileName();
-
-  vector<CStdString> options;
-  CUtil::Tokenize(url.GetOptions().Mid(1), options, "&");
-
-  m_bFileOptions = 0;
-
-  for( vector<CStdString>::iterator it = options.begin();it != options.end(); it++)
-  {
-    int iEqual = (*it).Find('=');
-    if( iEqual >= 0 )
-    {
-      CStdString strOption = (*it).Left(iEqual);
-      CStdString strValue = (*it).Mid(iEqual+1);
-
-      if( strOption.Equals("flags") )
-        m_bFileOptions = atoi(strValue.c_str());
-      else if( strOption.Equals("cache") )
-        m_strCacheDir = strValue;
-    }
-  }
-
-}
-
-void CFileRar::CleanUp()
-{
-#ifdef HAS_FILESYSTEM_RAR
-  try
-  {
-    if (m_pExtractThread)
-    {
-      if (m_pExtractThread->hRunning.WaitMSec(1))
-      {
-        m_pExtract->GetDataIO().hQuit->Set();
-        while (m_pExtractThread->hRunning.WaitMSec(1))
-          Sleep(1);
-      }
-      delete m_pExtract->GetDataIO().hBufferFilled;
-      delete m_pExtract->GetDataIO().hBufferEmpty;
-      delete m_pExtract->GetDataIO().hSeek;
-      delete m_pExtract->GetDataIO().hSeekDone;
-      delete m_pExtract->GetDataIO().hQuit;
-    }
-    if (m_pExtract)
-    {
-      delete m_pExtract;
-      m_pExtract = NULL;
-    }
-    if (m_pArc)
-    {
-      delete m_pArc;
-      m_pArc = NULL;
-    }
-    if (m_pCmd)
-    {
-      delete m_pCmd;
-      m_pCmd = NULL;
-    }
-    if (m_szBuffer)
-    {
-      delete[] m_szBuffer;
-      m_szBuffer = NULL;
-      m_szStartOfBuffer = NULL;
-    }
-  }
-  catch (int rarErrCode)
-  {
-    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while deleting CFileRar with an UnrarXLib error code of %d",rarErrCode);
-  }
-  catch (...)
-  {
-    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while deleting CFileRar with an Unknown exception");
-  }
-#endif
-}
-
-bool CFileRar::OpenInArchive()
-{
-#ifdef HAS_FILESYSTEM_RAR
-  try
-  {
-    int iHeaderSize;
-
-    InitCRC();
-
-    m_pCmd = new CommandData;
-    if (!m_pCmd)
-    {
-      CleanUp();
-      return false;
-    }
-
-    // Set the arguments for the extract command
-    strcpy(m_pCmd->Command, "X");
-
-    m_pCmd->AddArcName(const_cast<char*>(m_strRarPath.c_str()),NULL);
-
-    strncpy(m_pCmd->ExtrPath, m_strCacheDir.c_str(), sizeof (m_pCmd->ExtrPath) - 2);
-    m_pCmd->ExtrPath[sizeof (m_pCmd->ExtrPath) - 2] = 0;
-    AddEndSlash(m_pCmd->ExtrPath);
-
-    // Set password for encrypted archives
-    if ((m_strPassword.size() > 0) &&
-        (m_strPassword.size() < sizeof (m_pCmd->Password)))
-    {
-      strcpy(m_pCmd->Password, m_strPassword.c_str());
-    }
-
-    m_pCmd->ParseDone();
-
-    // Open the archive
-    m_pArc = new Archive(m_pCmd);
-    if (!m_pArc)
-    {
-      CleanUp();
-      return false;
-    }
-    if (!m_pArc->WOpen(m_strRarPath.c_str(),NULL))
-    {
-      CleanUp();
-      return false;
-    }
-    if (!(m_pArc->IsOpened() && m_pArc->IsArchive(true)))
-    {
-      CleanUp();
-      return false;
-    }
-
-    m_pExtract = new CmdExtract;
-    if (!m_pExtract)
-    {
-      CleanUp();
-      return false;
-    }
-    m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,0);
-    m_pExtract->GetDataIO().SetCurrentCommand(*(m_pCmd->Command));
-    struct FindData FD;
-    if (FindFile::FastFind(m_strRarPath.c_str(),NULL,&FD))
-      m_pExtract->GetDataIO().TotalArcSize+=FD.Size;
-    m_pExtract->ExtractArchiveInit(m_pCmd,*m_pArc);
-
-    while (true)
-    {
-      if ((iHeaderSize = m_pArc->ReadHeader()) <= 0)
-      {
-        CleanUp();
-        return false;
-      }
-
-      if (m_pArc->GetHeaderType() == FILE_HEAD)
-      {
-        CStdString strFileName;
-
-        if (m_pArc->NewLhd.FileNameW && wcslen(m_pArc->NewLhd.FileNameW) > 0)
-        {
-          g_charsetConverter.wToUTF8(m_pArc->NewLhd.FileNameW, strFileName);
-        }
-        else
-        {
-          g_charsetConverter.unknownToUTF8(m_pArc->NewLhd.FileName, strFileName);
-        }
-
-        /* replace back slashes into forward slashes */
-        /* this could get us into troubles, file could two different files, one with / and one with \ */
-        strFileName.Replace('\\', '/');
-
-        if (strFileName == m_strPathInRar)
-        {
-          break;
-        }
-      }
-
-      m_pArc->SeekToNext();
-    }
-
-    m_szBuffer = new byte[MAXWINMEMSIZE];
-    m_szStartOfBuffer = m_szBuffer;
-    m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,0);
-    m_iDataInBuffer = -1;
-    m_iFilePosition = 0;
-    m_iBufferStart = 0;
-
-    delete m_pExtractThread;
-    m_pExtractThread = new CFileRarExtractThread();
-    m_pExtractThread->Start(m_pArc,m_pCmd,m_pExtract,iHeaderSize);
-
-    return true;
-  }
-  catch (int rarErrCode)
-  {
-    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while CFileRar::OpenInArchive with an UnrarXLib error code of %d",rarErrCode);
-    return false;
-  }
-  catch (...)
-  {
-    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while CFileRar::OpenInArchive with an Unknown exception");
-    return false;
-  }
-#else
-  return false;
-#endif
-}
-
diff --git a/xbmc/filesystem/FileRar.h b/xbmc/filesystem/FileRar.h
deleted file mode 100644 (file)
index 83941dc..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileRar.h: interface for the CFileRar class.
-
-#pragma once
-#ifndef FILERAR_H_
-#define FILERAR_H_
-
-#include "File.h"
-#include "threads/Thread.h"
-#include "threads/Event.h"
-
-class CmdExtract;
-class CommandData;
-class Archive;
-
-namespace XFILE
-{
-#ifdef HAS_FILESYSTEM_RAR
-  class CFileRarExtractThread : public CThread
-  {
-  public:
-    CFileRarExtractThread();
-    ~CFileRarExtractThread();
-
-    void Start(Archive* pArc, CommandData* pCmd, CmdExtract* pExtract, int iSize);
-
-    virtual void OnStartup();
-    virtual void OnExit();
-    virtual void Process();
-
-    CEvent hRunning;
-    CEvent hRestart;
-    CEvent hQuit;
-
-  protected:
-    Archive* m_pArc;
-    CommandData* m_pCmd;
-    CmdExtract* m_pExtract;
-    int m_iSize;
-  };
-#endif
-
-  class CFileRar : public IFile
-  {
-  public:
-    CFileRar();
-    CFileRar(bool bSeekable); // used for caching files
-    virtual ~CFileRar();
-    virtual int64_t       GetPosition();
-    virtual int64_t       GetLength();
-    virtual bool          Open(const CURL& url);
-    virtual bool          Exists(const CURL& url);
-    virtual int           Stat(const CURL& url, struct __stat64* buffer);
-    virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
-    virtual int           Write(const void* lpBuf, int64_t uiBufSize);
-    virtual int64_t       Seek(int64_t iFilePosition, int iWhence=SEEK_SET);
-    virtual void          Close();
-    virtual void          Flush();
-
-    virtual bool          OpenForWrite(const CURL& url);
-    unsigned int          Write(void *lpBuf, int64_t uiBufSize);
-
-  protected:
-    CStdString m_strCacheDir;
-    CStdString m_strRarPath;
-    CStdString m_strPassword;
-    CStdString m_strPathInRar;
-    BYTE m_bFileOptions;
-    void Init();
-    void InitFromUrl(const CURL& url);
-    bool OpenInArchive();
-    void CleanUp();
-
-    int64_t m_iFilePosition;
-    int64_t m_iFileSize;
-    // rar stuff
-    bool m_bUseFile;
-    bool m_bOpen;
-    bool m_bSeekable;
-    CFile m_File; // for packed source
-#ifdef HAS_FILESYSTEM_RAR
-    Archive* m_pArc;
-    CommandData* m_pCmd;
-    CmdExtract* m_pExtract;
-    CFileRarExtractThread* m_pExtractThread;
-#endif
-    byte* m_szBuffer;
-    byte* m_szStartOfBuffer;
-    int64_t m_iDataInBuffer;
-    int64_t m_iBufferStart;
-  };
-
-}
-
-#endif  // FILERAR_H_
-
diff --git a/xbmc/filesystem/FileReaderFile.cpp b/xbmc/filesystem/FileReaderFile.cpp
new file mode 100644 (file)
index 0000000..2da9d57
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * XBMC Media Center
+ * Copyright (c) 2002 Frodo
+ * Portions Copyright (c) by the authors of ffmpeg and xvid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+#include "FileReaderFile.h"
+#include "URL.h"
+
+using namespace XFILE;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//*********************************************************************************************
+CFileReaderFile::CFileReaderFile()
+{
+}
+
+//*********************************************************************************************
+CFileReaderFile::~CFileReaderFile()
+{
+  Close();
+}
+
+//*********************************************************************************************
+bool CFileReaderFile::Open(const CURL& url)
+{
+  CStdString strURL = url.Get();
+  strURL = strURL.Mid(13);
+  return m_reader.Open(strURL,READ_CACHED);
+}
+
+bool CFileReaderFile::Exists(const CURL& url)
+{
+  return CFile::Exists(url.Get().Mid(13));
+}
+
+int CFileReaderFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  return CFile::Stat(url.Get().Mid(13),buffer);
+}
+
+
+//*********************************************************************************************
+bool CFileReaderFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{
+  return false;
+}
+
+//*********************************************************************************************
+unsigned int CFileReaderFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  return m_reader.Read(lpBuf,uiBufSize);
+}
+
+//*********************************************************************************************
+int CFileReaderFile::Write(const void *lpBuf, int64_t uiBufSize)
+{
+  return 0;
+}
+
+//*********************************************************************************************
+void CFileReaderFile::Close()
+{
+  m_reader.Close();
+}
+
+//*********************************************************************************************
+int64_t CFileReaderFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  return m_reader.Seek(iFilePosition,iWhence);
+}
+
+//*********************************************************************************************
+int64_t CFileReaderFile::GetLength()
+{
+  return m_reader.GetLength();
+}
+
+//*********************************************************************************************
+int64_t CFileReaderFile::GetPosition()
+{
+  return m_reader.GetPosition();
+}
+
+
diff --git a/xbmc/filesystem/FileReaderFile.h b/xbmc/filesystem/FileReaderFile.h
new file mode 100644 (file)
index 0000000..9ad8c9b
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once
+/*
+ * XBMC Media Center
+ * Copyright (c) 2002 Frodo
+ * Portions Copyright (c) by the authors of ffmpeg and xvid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "File.h"
+
+namespace XFILE
+{
+class CFileReaderFile : public IFile
+{
+public:
+  CFileReaderFile();
+  virtual ~CFileReaderFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int Write(const void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+
+  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+  protected:
+  CFile m_reader;
+};
+
+}
+
+
diff --git a/xbmc/filesystem/FileSFTP.cpp b/xbmc/filesystem/FileSFTP.cpp
deleted file mode 100644 (file)
index 36c622e..0000000
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- *      Copyright (C) 2005-2010 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-#include "threads/SystemClock.h"
-#include "FileSFTP.h"
-#ifdef HAS_FILESYSTEM_SFTP
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include "utils/TimeUtils.h"
-#include "utils/Variant.h"
-#include "Util.h"
-#include <fcntl.h>
-#include <sstream>
-
-#ifdef _WIN32
-#pragma comment(lib, "ssh.lib")
-#endif
-
-#ifdef _MSC_VER
-#define O_RDONLY _O_RDONLY
-#endif
-
-using namespace XFILE;
-using namespace std;
-
-
-static CStdString CorrectPath(const CStdString path)
-{
-  if(path == "~" || path.Left(2) == "~/")
-    return "./" + path.Mid(2);
-  else
-    return "/" + path;
-}
-
-CSFTPSession::CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
-{
-  CLog::Log(LOGINFO, "SFTPSession: Creating new session on host '%s:%d' with user '%s'", host.c_str(), port, username.c_str());
-  CSingleLock lock(m_critSect);
-  if (!Connect(host, port, username, password))
-    Disconnect();
-
-  m_LastActive = XbmcThreads::SystemClockMillis();
-}
-
-CSFTPSession::~CSFTPSession()
-{
-  CSingleLock lock(m_critSect);
-  Disconnect();
-}
-
-sftp_file CSFTPSession::CreateFileHande(const CStdString &file)
-{
-  if (m_connected)
-  {
-    CSingleLock lock(m_critSect);
-    m_LastActive = XbmcThreads::SystemClockMillis();
-    sftp_file handle = sftp_open(m_sftp_session, CorrectPath(file).c_str(), O_RDONLY, 0);
-    if (handle)
-    {
-      sftp_file_set_blocking(handle);
-      return handle;
-    }
-    else
-      CLog::Log(LOGERROR, "SFTPSession: Was connected but couldn't create filehandle\n");
-  }
-  else
-    CLog::Log(LOGERROR, "SFTPSession: Not connected and can't create file handle");
-
-  return NULL;
-}
-
-void CSFTPSession::CloseFileHandle(sftp_file handle)
-{
-  CSingleLock lock(m_critSect);
-  sftp_close(handle);
-}
-
-bool CSFTPSession::GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items)
-{
-  if (m_connected)
-  {
-    sftp_dir dir = NULL;
-
-    {
-      CSingleLock lock(m_critSect);
-      m_LastActive = XbmcThreads::SystemClockMillis();
-      dir = sftp_opendir(m_sftp_session, CorrectPath(folder).c_str());
-    }
-
-    if (dir)
-    {
-      bool read = true;
-      while (read)
-      {
-        sftp_attributes attributes = NULL;
-
-        {
-          CSingleLock lock(m_critSect);
-          read = sftp_dir_eof(dir) == 0;
-          attributes = sftp_readdir(m_sftp_session, dir);
-        }
-
-        if (attributes && (attributes->name == NULL || strcmp(attributes->name, "..") == 0 || strcmp(attributes->name, ".") == 0))
-        {
-          CSingleLock lock(m_critSect);
-          sftp_attributes_free(attributes);
-          continue;
-        }
-        
-        if (attributes)
-        {
-          CStdString itemName = attributes->name;
-          CStdString localPath = folder;
-          localPath.append(itemName);
-
-          if (attributes->type == SSH_FILEXFER_TYPE_SYMLINK)
-          {
-            CSingleLock lock(m_critSect);
-            sftp_attributes_free(attributes);
-            attributes = sftp_stat(m_sftp_session, CorrectPath(localPath).c_str());
-            if (attributes == NULL)
-              continue;
-          }
-
-          CFileItemPtr pItem(new CFileItem);
-          pItem->SetLabel(itemName);
-
-          if (itemName[0] == '.')
-            pItem->SetProperty("file:hidden", true);
-
-          if (attributes->flags & SSH_FILEXFER_ATTR_ACMODTIME)
-            pItem->m_dateTime = attributes->mtime;
-
-          if (attributes->type & SSH_FILEXFER_TYPE_DIRECTORY)
-          {
-            localPath.append("/");
-            pItem->m_bIsFolder = true;
-            pItem->m_dwSize = 0;
-          }
-          else
-          {
-            pItem->m_dwSize = attributes->size;
-          }
-
-          pItem->SetPath(base + localPath);
-          items.Add(pItem);
-
-          {
-            CSingleLock lock(m_critSect);
-            sftp_attributes_free(attributes);
-          }
-        }
-        else
-          read = false;
-      }
-
-      {
-        CSingleLock lock(m_critSect);
-        sftp_closedir(dir);
-      }
-
-      return true;
-    }
-  }
-  else
-    CLog::Log(LOGERROR, "SFTPSession: Not connected, can't list directory");
-
-  return false;
-}
-
-bool CSFTPSession::Exists(const char *path)
-{
-  bool exists = false;
-  CSingleLock lock(m_critSect);
-  if(m_connected)
-  {
-    sftp_attributes attributes = sftp_stat(m_sftp_session, CorrectPath(path).c_str());
-    exists = attributes != NULL;
-
-    if (attributes)
-      sftp_attributes_free(attributes);
-  }
-  return exists;
-}
-
-int CSFTPSession::Stat(const char *path, struct __stat64* buffer)
-{
-  CSingleLock lock(m_critSect);
-  if(m_connected)
-  {
-    m_LastActive = XbmcThreads::SystemClockMillis();
-    sftp_attributes attributes = sftp_stat(m_sftp_session, CorrectPath(path).c_str());
-
-    if (attributes)
-    {
-      memset(buffer, 0, sizeof(struct __stat64));
-      buffer->st_size = attributes->size;
-      buffer->st_mtime = attributes->mtime;
-      buffer->st_atime = attributes->atime;
-
-      sftp_attributes_free(attributes);
-      return 0;
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "SFTPSession: STAT - Failed to get attributes");
-      return -1;
-    }
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "SFTPSession: STAT - Not connected");
-    return -1;
-  }
-}
-
-int CSFTPSession::Seek(sftp_file handle, uint64_t position)
-{
-  CSingleLock lock(m_critSect);
-  m_LastActive = XbmcThreads::SystemClockMillis();
-  return sftp_seek64(handle, position);
-}
-
-int CSFTPSession::Read(sftp_file handle, void *buffer, size_t length)
-{
-  CSingleLock lock(m_critSect);
-  m_LastActive = XbmcThreads::SystemClockMillis();
-  return sftp_read(handle, buffer, length);
-}
-
-int64_t CSFTPSession::GetPosition(sftp_file handle)
-{
-  CSingleLock lock(m_critSect);
-  m_LastActive = XbmcThreads::SystemClockMillis();
-  return sftp_tell64(handle);
-}
-
-bool CSFTPSession::IsIdle()
-{
-  return (XbmcThreads::SystemClockMillis() - m_LastActive) > 90000;
-}
-
-bool CSFTPSession::VerifyKnownHost(ssh_session session)
-{
-  switch (ssh_is_server_known(session))
-  {
-    case SSH_SERVER_KNOWN_OK:
-      return true;
-    case SSH_SERVER_KNOWN_CHANGED:
-      CLog::Log(LOGERROR, "SFTPSession: Server that was known has changed");
-      return false;
-    case SSH_SERVER_FOUND_OTHER:
-      CLog::Log(LOGERROR, "SFTPSession: The host key for this server was not found but an other type of key exists. An attacker might change the default server key to confuse your client into thinking the key does not exist");
-      return false;
-    case SSH_SERVER_FILE_NOT_FOUND:
-      CLog::Log(LOGINFO, "SFTPSession: Server file was not found, creating a new one");
-    case SSH_SERVER_NOT_KNOWN:
-      CLog::Log(LOGINFO, "SFTPSession: Server unkown, we trust it for now");
-      if (ssh_write_knownhost(session) < 0)
-      {
-        CLog::Log(LOGERROR, "CSFTPSession: Failed to save host '%s'", strerror(errno));
-        return false;
-      }
-
-      return true;
-    case SSH_SERVER_ERROR:
-      CLog::Log(LOGERROR, "SFTPSession: Failed to verify host '%s'", ssh_get_error(session));
-      return false;
-  }
-
-  return false;
-}
-
-bool CSFTPSession::Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
-{
-  int timeout     = SFTP_TIMEOUT;
-  m_connected     = false;
-  m_session       = NULL;
-  m_sftp_session  = NULL;
-
-  m_session=ssh_new();
-  if (m_session == NULL)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to initialize session");
-    return false;
-  }
-
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,4,0)
-  if (ssh_options_set(m_session, SSH_OPTIONS_USER, username.c_str()) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set username '%s' for session", username.c_str());
-    return false;
-  }
-
-  if (ssh_options_set(m_session, SSH_OPTIONS_HOST, host.c_str()) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set host '%s' for session", host.c_str());
-    return false;
-  }
-
-  if (ssh_options_set(m_session, SSH_OPTIONS_PORT, &port) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set port '%d' for session", port);
-    return false;
-  }
-
-  ssh_options_set(m_session, SSH_OPTIONS_LOG_VERBOSITY, 0);
-  ssh_options_set(m_session, SSH_OPTIONS_TIMEOUT, &timeout);  
-#else
-  SSH_OPTIONS* options = ssh_options_new();
-
-  if (ssh_options_set_username(options, username.c_str()) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set username '%s' for session", username.c_str());
-    return false;
-  }
-
-  if (ssh_options_set_host(options, host.c_str()) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set host '%s' for session", host.c_str());
-    return false;
-  }
-
-  if (ssh_options_set_port(options, port) < 0)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to set port '%d' for session", port);
-    return false;
-  }
-  
-  ssh_options_set_timeout(options, timeout, 0);
-
-  ssh_options_set_log_verbosity(options, 0);
-
-  ssh_set_options(m_session, options);
-#endif
-
-  if(ssh_connect(m_session))
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to connect '%s'", ssh_get_error(m_session));
-    return false;
-  }
-
-  if (!VerifyKnownHost(m_session))
-    return false;
-
-
-  int noAuth = SSH_AUTH_DENIED;
-  if ((noAuth = ssh_userauth_none(m_session, NULL)) == SSH_AUTH_ERROR)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via guest '%s'", ssh_get_error(m_session));
-    return false;
-  }
-
-  int method = ssh_auth_list(m_session);
-
-  // Try to authenticate with public key first
-  int publicKeyAuth = SSH_AUTH_DENIED;
-  if (method & SSH_AUTH_METHOD_PUBLICKEY && (publicKeyAuth = ssh_userauth_autopubkey(m_session, NULL)) == SSH_AUTH_ERROR)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via publickey '%s'", ssh_get_error(m_session));
-    return false;
-  }
-
-  // Try to authenticate with password
-  int passwordAuth = SSH_AUTH_DENIED;
-  if (method & SSH_AUTH_METHOD_PASSWORD && publicKeyAuth != SSH_AUTH_SUCCESS && (passwordAuth = ssh_userauth_password(m_session, username.c_str(), password.c_str())) == SSH_AUTH_ERROR)
-  {
-    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via password '%s'", ssh_get_error(m_session));
-    return false;
-  }
-
-  if (noAuth == SSH_AUTH_SUCCESS || publicKeyAuth == SSH_AUTH_SUCCESS || passwordAuth == SSH_AUTH_SUCCESS)
-  {
-    m_sftp_session = sftp_new(m_session);
-
-    if (m_sftp_session == NULL)
-    {
-      CLog::Log(LOGERROR, "SFTPSession: Failed to initialize channel '%s'", ssh_get_error(m_session));
-      return false;
-    }
-
-    if (sftp_init(m_sftp_session))
-    {
-      CLog::Log(LOGERROR, "SFTPSession: Failed to initialize sftp '%s'", ssh_get_error(m_session));
-      return false;
-    }
-
-    m_connected = true;
-  }
-
-  return m_connected;
-}
-
-void CSFTPSession::Disconnect()
-{
-  if (m_sftp_session)
-    sftp_free(m_sftp_session);
-
-  if (m_session)
-    ssh_disconnect(m_session);
-
-  m_sftp_session = NULL;
-  m_session = NULL;
-}
-
-CCriticalSection CSFTPSessionManager::m_critSect;
-map<CStdString, CSFTPSessionPtr> CSFTPSessionManager::sessions;
-
-CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url)
-{
-  string username = url.GetUserName().c_str();
-  string password = url.GetPassWord().c_str();
-  string hostname = url.GetHostName().c_str();
-  unsigned int port = url.HasPort() ? url.GetPort() : 22;
-
-  return CSFTPSessionManager::CreateSession(hostname, port, username, password);
-}
-
-CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
-{
-  // Convert port number to string
-  stringstream itoa;
-  itoa << port;
-  CStdString portstr = itoa.str();
-
-  CSingleLock lock(m_critSect);
-  CStdString key = username + ":" + password + "@" + host + ":" + portstr;
-  CSFTPSessionPtr ptr = sessions[key];
-  if (ptr == NULL)
-  {
-    ptr = CSFTPSessionPtr(new CSFTPSession(host, port, username, password));
-    sessions[key] = ptr;
-  }
-
-  return ptr;
-}
-
-void CSFTPSessionManager::ClearOutIdleSessions()
-{
-  CSingleLock lock(m_critSect);
-  for(map<CStdString, CSFTPSessionPtr>::iterator iter = sessions.begin(); iter != sessions.end();)
-  {
-    if (iter->second->IsIdle())
-      sessions.erase(iter++);
-    else
-      iter++;
-  }
-}
-
-void CSFTPSessionManager::DisconnectAllSessions()
-{
-  CSingleLock lock(m_critSect);
-  sessions.clear();
-}
-
-CFileSFTP::CFileSFTP()
-{
-  m_sftp_handle = NULL;
-}
-
-CFileSFTP::~CFileSFTP()
-{
-  Close();
-}
-
-bool CFileSFTP::Open(const CURL& url)
-{
-  m_session = CSFTPSessionManager::CreateSession(url);
-  if (m_session)
-  {
-    m_file = url.GetFileName().c_str();
-    m_sftp_handle = m_session->CreateFileHande(m_file);
-
-    return (m_sftp_handle != NULL);
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "SFTPFile: Failed to allocate session");
-    return false;
-  }
-}
-
-void CFileSFTP::Close()
-{
-  if (m_session && m_sftp_handle)
-  {
-    m_session->CloseFileHandle(m_sftp_handle);
-    m_sftp_handle = NULL;
-    m_session = CSFTPSessionPtr();
-  }
-}
-
-int64_t CFileSFTP::Seek(int64_t iFilePosition, int iWhence)
-{
-  if (m_session && m_sftp_handle)
-  {
-    uint64_t position = 0;
-    if (iWhence == SEEK_SET)
-      position = iFilePosition;
-    else if (iWhence == SEEK_CUR)
-      position = GetPosition() + iFilePosition;
-    else if (iWhence == SEEK_END)
-      position = GetLength() + iFilePosition;
-
-    if (m_session->Seek(m_sftp_handle, position) == 0)
-      return GetPosition();
-    else
-      return -1;
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "SFTPFile: Can't seek without a filehandle");
-    return -1;
-  }
-}
-
-unsigned int CFileSFTP::Read(void* lpBuf, int64_t uiBufSize)
-{
-  if (m_session && m_sftp_handle)
-  {
-    int rc = m_session->Read(m_sftp_handle, lpBuf, (size_t)uiBufSize);
-
-    if (rc >= 0)
-      return rc;
-    else
-      CLog::Log(LOGERROR, "SFTPFile: Failed to read %i", rc);
-  }
-  else
-    CLog::Log(LOGERROR, "SFTPFile: Can't read without a filehandle");
-
-  return 0;
-}
-
-bool CFileSFTP::Exists(const CURL& url)
-{
-  CSFTPSessionPtr session = CSFTPSessionManager::CreateSession(url);
-  if (session)
-    return session->Exists(url.GetFileName().c_str());
-  else
-  {
-    CLog::Log(LOGERROR, "SFTPFile: Failed to create session to check exists");
-    return false;
-  }
-}
-
-int CFileSFTP::Stat(const CURL& url, struct __stat64* buffer)
-{
-  CSFTPSessionPtr session = CSFTPSessionManager::CreateSession(url);
-  if (session)
-    return session->Stat(url.GetFileName().c_str(), buffer);
-  else
-  {
-    CLog::Log(LOGERROR, "SFTPFile: Failed to create session to stat");
-    return -1;
-  }
-}
-
-int CFileSFTP::Stat(struct __stat64* buffer)
-{
-  if (m_session)
-    return m_session->Stat(m_file.c_str(), buffer);
-
-  CLog::Log(LOGERROR, "SFTPFile: Can't stat without a session");
-  return -1;
-}
-
-int64_t CFileSFTP::GetLength()
-{
-  struct __stat64 buffer;
-  if (Stat(&buffer) != 0)
-    return 0;
-  else
-  {
-    int64_t length = buffer.st_size;
-    return length;
-  }
-}
-
-int64_t CFileSFTP::GetPosition()
-{
-  if (m_session && m_sftp_handle)
-    return m_session->GetPosition(m_sftp_handle);
-
-  CLog::Log(LOGERROR, "SFTPFile: Can't get position without a filehandle");
-  return 0;
-}
-
-int CFileSFTP::IoControl(EIoControl request, void* param)
-{
-  if(request == IOCTRL_SEEK_POSSIBLE)
-    return 1;
-
-  return -1;
-}
-
-#endif
diff --git a/xbmc/filesystem/FileSFTP.h b/xbmc/filesystem/FileSFTP.h
deleted file mode 100644 (file)
index 1ff25ba..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2010 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-#include "system.h"
-#ifdef HAS_FILESYSTEM_SFTP
-#include "IFile.h"
-#include "URL.h"
-#include "FileItem.h"
-#include "threads/CriticalSection.h"
-
-#include <libssh/libssh.h>
-#include <libssh/sftp.h>
-#include <string>
-#include <map>
-#include <boost/shared_ptr.hpp>
-
-#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0,3,2)
-#define ssh_session SSH_SESSION
-#endif
-
-#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0,4,0)
-#define sftp_file SFTP_FILE*
-#define sftp_session SFTP_SESSION*
-#define sftp_attributes SFTP_ATTRIBUTES*
-#define sftp_dir SFTP_DIR*
-#define ssh_session ssh_session*
-#endif
-
-//five secs timeout for SFTP
-#define SFTP_TIMEOUT 5
-
-class CSFTPSession
-{
-public:
-  CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
-  virtual ~CSFTPSession();
-
-  sftp_file CreateFileHande(const CStdString &file);
-  void CloseFileHandle(sftp_file handle);
-  bool GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items);
-  bool Exists(const char *path);
-  int Stat(const char *path, struct __stat64* buffer);
-  int Seek(sftp_file handle, uint64_t position);
-  int Read(sftp_file handle, void *buffer, size_t length);
-  int64_t GetPosition(sftp_file handle);
-  bool IsIdle();
-private:
-  bool VerifyKnownHost(ssh_session session);
-  bool Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
-  void Disconnect();
-  CCriticalSection m_critSect;
-
-  bool m_connected;
-  ssh_session  m_session;
-  sftp_session m_sftp_session;
-  int m_LastActive;
-};
-
-typedef boost::shared_ptr<CSFTPSession> CSFTPSessionPtr;
-
-class CSFTPSessionManager
-{
-public:
-  static CSFTPSessionPtr CreateSession(const CURL &url);
-  static CSFTPSessionPtr CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
-  static void ClearOutIdleSessions();
-  static void DisconnectAllSessions();
-private:
-  static CCriticalSection m_critSect;
-  static std::map<CStdString, CSFTPSessionPtr> sessions;
-};
-
-namespace XFILE
-{
-  class CFileSFTP : public IFile
-  {
-  public:
-    CFileSFTP();
-    virtual ~CFileSFTP();
-    virtual void Close();
-    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-    virtual bool Open(const CURL& url);
-    virtual bool Exists(const CURL& url);
-    virtual int Stat(const CURL& url, struct __stat64* buffer);
-    virtual int Stat(struct __stat64* buffer);
-    virtual int64_t GetLength();
-    virtual int64_t GetPosition();
-    virtual int     GetChunkSize() {return 1;};
-    virtual int     IoControl(EIoControl request, void* param);
-  private:
-    CStdString m_file;
-    CSFTPSessionPtr m_session;
-    sftp_file m_sftp_handle;
-  };
-}
-#endif
diff --git a/xbmc/filesystem/FileShoutcast.cpp b/xbmc/filesystem/FileShoutcast.cpp
deleted file mode 100644 (file)
index 79fa6ac..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-// FileShoutcast.cpp: implementation of the CFileShoutcast class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "threads/SystemClock.h"
-#include "system.h"
-#include "Application.h"
-#include "FileShoutcast.h"
-#include "settings/GUISettings.h"
-#include "guilib/GUIWindowManager.h"
-#include "URL.h"
-#include "utils/RegExp.h"
-#include "utils/HTMLUtil.h"
-#include "utils/CharsetConverter.h"
-#include "utils/TimeUtils.h"
-#include "GUIInfoManager.h"
-#include "utils/log.h"
-
-using namespace XFILE;
-using namespace MUSIC_INFO;
-
-CFileShoutcast::CFileShoutcast()
-{
-  m_lastTime = XbmcThreads::SystemClockMillis();
-  m_discarded = 0;
-  m_currint = 0;
-  m_buffer = NULL;
-}
-
-CFileShoutcast::~CFileShoutcast()
-{
-  Close();
-}
-
-int64_t CFileShoutcast::GetPosition()
-{
-  return m_file.GetPosition()-m_discarded;
-}
-
-int64_t CFileShoutcast::GetLength()
-{
-  return 0;
-}
-
-bool CFileShoutcast::Open(const CURL& url)
-{
-  CURL url2(url);
-  url2.SetProtocolOptions("noshout=true&Icy-MetaData=1");
-  url2.SetProtocol("http");
-
-  bool result=false;
-  if ((result=m_file.Open(url2.Get())))
-  {
-    m_tag.SetTitle(m_file.GetHttpHeader().GetValue("icy-name"));
-    if (m_tag.GetTitle().IsEmpty())
-      m_tag.SetTitle(m_file.GetHttpHeader().GetValue("ice-name")); // icecast
-    m_tag.SetGenre(m_file.GetHttpHeader().GetValue("icy-genre"));
-    if (m_tag.GetGenre().IsEmpty())
-      m_tag.SetGenre(m_file.GetHttpHeader().GetValue("ice-genre")); // icecast
-    m_tag.SetLoaded(true);
-    g_infoManager.SetCurrentSongTag(m_tag);
-  }
-  m_metaint = atoi(m_file.GetHttpHeader().GetValue("icy-metaint").c_str());
-  if (!m_metaint)
-    m_metaint = -1;
-  m_buffer = new char[16*255];
-
-  return result;
-}
-
-unsigned int CFileShoutcast::Read(void* lpBuf, int64_t uiBufSize)
-{
-  if (m_currint >= m_metaint && m_metaint > 0)
-  {
-    unsigned char header;
-    m_file.Read(&header,1);
-    ReadTruncated(m_buffer, header*16);
-    ExtractTagInfo(m_buffer);
-    m_discarded += header*16+1;
-    m_currint = 0;
-  }
-  if (XbmcThreads::SystemClockMillis() - m_lastTime > 500)
-  {
-    m_lastTime = XbmcThreads::SystemClockMillis();
-    g_infoManager.SetCurrentSongTag(m_tag);
-  }
-
-  unsigned int toRead;
-  if (m_metaint > 0)
-    toRead = std::min((unsigned int)uiBufSize,(unsigned int)m_metaint-m_currint);
-  else
-    toRead = std::min((unsigned int)uiBufSize,(unsigned int)16*255);
-  toRead = m_file.Read(lpBuf,toRead);
-  m_currint += toRead;
-  return toRead;
-}
-
-int64_t CFileShoutcast::Seek(int64_t iFilePosition, int iWhence)
-{
-  return -1;
-}
-
-void CFileShoutcast::Close()
-{
-  delete[] m_buffer;
-  m_file.Close();
-}
-
-void CFileShoutcast::ExtractTagInfo(const char* buf)
-{
-  CStdString strBuffer = buf;
-  g_charsetConverter.unknownToUTF8(strBuffer);
-
-  CStdStringW wBuffer, wConverted;
-  g_charsetConverter.utf8ToW(strBuffer, wBuffer, false);
-  HTML::CHTMLUtil::ConvertHTMLToW(wBuffer, wConverted);
-  g_charsetConverter.wToUTF8(wConverted, strBuffer);
-
-  CRegExp reTitle(true);
-  reTitle.RegComp("StreamTitle=\'(.*?)\';");
-
-  if (reTitle.RegFind(strBuffer.c_str()) != -1)
-    m_tag.SetTitle(reTitle.GetReplaceString("\\1"));
-}
-
-void CFileShoutcast::ReadTruncated(char* buf2, int size)
-{
-  char* buf = buf2;
-  while (size > 0)
-  {
-    int read = m_file.Read(buf,size);
-    size -= read;
-    buf += read;
-  }
-}
-
diff --git a/xbmc/filesystem/FileShoutcast.h b/xbmc/filesystem/FileShoutcast.h
deleted file mode 100644 (file)
index bdd93ec..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileShoutcast.h: interface for the CFileShoutcast class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include "IFile.h"
-#include "FileCurl.h"
-#include "utils/StdString.h"
-#include "music/tags/MusicInfoTag.h"
-
-namespace XFILE
-{
-class CFileShoutcast : public IFile
-{
-public:
-  CFileShoutcast();
-  virtual ~CFileShoutcast();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url) { return true;};
-  virtual int Stat(const CURL& url, struct __stat64* buffer) { errno = ENOENT; return -1; };
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-protected:
-  void ExtractTagInfo(const char* buf);
-  void ReadTruncated(char* buf2, int size);
-
-  unsigned int m_lastTime;
-  CFileCurl m_file;
-  int m_metaint;
-  int m_discarded; // data used for tags
-  int m_currint;
-  char* m_buffer; // buffer used for tags
-  MUSIC_INFO::CMusicInfoTag m_tag;
-};
-}
-
diff --git a/xbmc/filesystem/FileSmb.cpp b/xbmc/filesystem/FileSmb.cpp
deleted file mode 100644 (file)
index f1d7416..0000000
+++ /dev/null
@@ -1,777 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileSmb.cpp: implementation of the CFileSMB class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "system.h"
-#include "FileSmb.h"
-#include "PasswordManager.h"
-#include "SMBDirectory.h"
-#include "Util.h"
-#include <libsmbclient.h>
-#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include "utils/TimeUtils.h"
-
-using namespace XFILE;
-
-void xb_smbc_log(const char* msg)
-{
-  CLog::Log(LOGINFO, "%s%s", "smb: ", msg);
-}
-
-void xb_smbc_auth(const char *srv, const char *shr, char *wg, int wglen,
-                  char *un, int unlen, char *pw, int pwlen)
-{
-  return ;
-}
-
-smbc_get_cached_srv_fn orig_cache;
-
-SMBCSRV* xb_smbc_cache(SMBCCTX* c, const char* server, const char* share, const char* workgroup, const char* username)
-{
-  return orig_cache(c, server, share, workgroup, username);
-}
-
-CSMB::CSMB()
-{
-#ifdef TARGET_POSIX
-  m_IdleTimeout = 0;
-#endif
-  m_context = NULL;
-  smbc_init(xb_smbc_auth, 0);
-}
-
-CSMB::~CSMB()
-{
-  Deinit();
-}
-
-void CSMB::Deinit()
-{
-  CSingleLock lock(*this);
-
-  /* samba goes loco if deinited while it has some files opened */
-  if (m_context)
-  {
-    try
-    {
-      smbc_set_context(NULL);
-      smbc_free_context(m_context, 1);
-    }
-#ifdef TARGET_WINDOWS
-    catch(win32_exception e)
-    {
-      e.writelog(__FUNCTION__);
-    }
-    m_IdleTimeout = 180;
-#else
-    catch(...)
-    {
-      CLog::Log(LOGERROR,"exception on CSMB::Deinit. errno: %d", errno);
-    }
-#endif
-    m_context = NULL;
-  }
-}
-
-void CSMB::Init()
-{
-  CSingleLock lock(*this);
-  if (!m_context)
-  {
-#ifdef TARGET_POSIX
-    // Create ~/.smb/smb.conf. This file is used by libsmbclient.
-    // http://us1.samba.org/samba/docs/man/manpages-3/libsmbclient.7.html
-    // http://us1.samba.org/samba/docs/man/manpages-3/smb.conf.5.html
-    char smb_conf[MAX_PATH];
-    sprintf(smb_conf, "%s/.smb", getenv("HOME"));
-    mkdir(smb_conf, 0755);
-    sprintf(smb_conf, "%s/.smb/smb.conf", getenv("HOME"));
-    FILE* f = fopen(smb_conf, "w");
-    if (f != NULL)
-    {
-      fprintf(f, "[global]\n");
-
-      // make sure we're not acting like a server
-      fprintf(f, "\tpreferred master = no\n");
-      fprintf(f, "\tlocal master = no\n");
-      fprintf(f, "\tdomain master = no\n");
-
-      // use the weaker LANMAN password hash in order to be compatible with older servers
-      fprintf(f, "\tclient lanman auth = yes\n");
-      fprintf(f, "\tlanman auth = yes\n");
-
-      fprintf(f, "\tsocket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536\n");      
-      fprintf(f, "\tlock directory = %s/.smb/\n", getenv("HOME"));
-
-      // set wins server if there's one. name resolve order defaults to 'lmhosts host wins bcast'.
-      // if no WINS server has been specified the wins method will be ignored.
-      if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
-      {
-        fprintf(f, "\twins server = %s\n", g_guiSettings.GetString("smb.winsserver").c_str());
-        fprintf(f, "\tname resolve order = bcast wins host\n");
-      }
-      else
-        fprintf(f, "\tname resolve order = bcast host\n");
-
-      // use user-configured charset. if no charset is specified,
-      // samba tries to use charset 850 but falls back to ASCII in case it is not available
-      if (g_advancedSettings.m_sambadoscodepage.length() > 0)
-        fprintf(f, "\tdos charset = %s\n", g_advancedSettings.m_sambadoscodepage.c_str());
-
-      // if no workgroup string is specified, samba will use the default value 'WORKGROUP'
-      if ( g_guiSettings.GetString("smb.workgroup").length() > 0 )
-        fprintf(f, "\tworkgroup = %s\n", g_guiSettings.GetString("smb.workgroup").c_str());
-      fclose(f);
-    }
-#endif
-
-#ifdef TARGET_WINDOWS
-    // set the log function
-    set_log_callback(xb_smbc_log);
-#endif
-
-    // setup our context
-    m_context = smbc_new_context();
-#ifdef DEPRECATED_SMBC_INTERFACE
-    smbc_setDebug(m_context, g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0);
-    smbc_setFunctionAuthData(m_context, xb_smbc_auth);
-    orig_cache = smbc_getFunctionGetCachedServer(m_context);
-    smbc_setFunctionGetCachedServer(m_context, xb_smbc_cache);
-    smbc_setOptionOneSharePerServer(m_context, false);
-    smbc_setOptionBrowseMaxLmbCount(m_context, 0);
-    smbc_setTimeout(m_context, g_advancedSettings.m_sambaclienttimeout * 1000);
-#else
-    m_context->debug = g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0;
-    m_context->callbacks.auth_fn = xb_smbc_auth;
-    orig_cache = m_context->callbacks.get_cached_srv_fn;
-    m_context->callbacks.get_cached_srv_fn = xb_smbc_cache;
-    m_context->options.one_share_per_server = false;
-    m_context->options.browse_max_lmb_count = 0;
-    m_context->timeout = g_advancedSettings.m_sambaclienttimeout * 1000;
-#endif
-
-    // initialize samba and do some hacking into the settings
-    if (smbc_init_context(m_context))
-    {
-      /* setup old interface to use this context */
-      smbc_set_context(m_context);
-
-#ifdef TARGET_WINDOWS
-      // if a wins-server is set, we have to change name resolve order to
-      if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
-      {
-        lp_do_parameter( -1, "wins server", g_guiSettings.GetString("smb.winsserver").c_str());
-        lp_do_parameter( -1, "name resolve order", "bcast wins host");
-      }
-      else
-        lp_do_parameter( -1, "name resolve order", "bcast host");
-
-      if (g_advancedSettings.m_sambadoscodepage.length() > 0)
-        lp_do_parameter( -1, "dos charset", g_advancedSettings.m_sambadoscodepage.c_str());
-      else
-        lp_do_parameter( -1, "dos charset", "CP850");
-#endif
-    }
-    else
-    {
-      smbc_free_context(m_context, 1);
-      m_context = NULL;
-    }
-  }
-#ifdef TARGET_POSIX
-  m_IdleTimeout = 180;
-#endif
-}
-
-void CSMB::Purge()
-{
-#ifdef TARGET_WINDOWS
-  CSingleLock lock(*this);
-  smbc_purge();
-#endif
-}
-
-/*
- * For each new connection samba creates a new session
- * But this is not what we want, we just want to have one session at the time
- * This means that we have to call smbc_purge() if samba created a new session
- * Samba will create a new session when:
- * - connecting to another server
- * - connecting to another share on the same server (share, not a different folder!)
- *
- * We try to avoid lot's of purge commands because it slow samba down.
- */
-void CSMB::PurgeEx(const CURL& url)
-{
-  CSingleLock lock(*this);
-  CStdString strShare = url.GetFileName().substr(0, url.GetFileName().Find('/'));
-
-#ifdef TARGET_WINDOWS
-  if (m_strLastShare.length() > 0 && (m_strLastShare != strShare || m_strLastHost != url.GetHostName()))
-    smbc_purge();
-#endif
-
-  m_strLastShare = strShare;
-  m_strLastHost = url.GetHostName();
-}
-
-CStdString CSMB::URLEncode(const CURL &url)
-{
-  /* due to smb wanting encoded urls we have to build it manually */
-
-  CStdString flat = "smb://";
-
-  if(url.GetDomain().length() > 0)
-  {
-    flat += URLEncode(url.GetDomain());
-    flat += ";";
-  }
-
-  /* samba messes up of password is set but no username is set. don't know why yet */
-  /* probably the url parser that goes crazy */
-  if(url.GetUserName().length() > 0 /* || url.GetPassWord().length() > 0 */)
-  {
-    flat += URLEncode(url.GetUserName());
-    flat += ":";
-    flat += URLEncode(url.GetPassWord());
-    flat += "@";
-  }
-  flat += URLEncode(url.GetHostName());
-
-  /* okey sadly since a slash is an invalid name we have to tokenize */
-  std::vector<CStdString> parts;
-  std::vector<CStdString>::iterator it;
-  CUtil::Tokenize(url.GetFileName(), parts, "/");
-  for( it = parts.begin(); it != parts.end(); it++ )
-  {
-    flat += "/";
-    flat += URLEncode((*it));
-  }
-
-  /* okey options should go here, thou current samba doesn't support any */
-
-  return flat;
-}
-
-CStdString CSMB::URLEncode(const CStdString &value)
-{
-  CStdString encoded(value);
-  CURL::Encode(encoded);
-  return encoded;
-}
-
-#ifdef TARGET_WINDOWS
-DWORD CSMB::ConvertUnixToNT(int error)
-{
-  DWORD nt_error;
-  if (error == ENODEV || error == ENETUNREACH || error == WSAETIMEDOUT) nt_error = NT_STATUS_INVALID_COMPUTER_NAME;
-  else if(error == WSAECONNREFUSED || error == WSAECONNABORTED) nt_error = NT_STATUS_CONNECTION_REFUSED;
-  else nt_error = map_nt_error_from_unix(error);
-
-  return nt_error;
-}
-#endif
-
-#ifdef TARGET_POSIX
-/* This is called from CApplication::ProcessSlow() and is used to tell if smbclient have been idle for too long */
-void CSMB::CheckIfIdle()
-{
-/* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
-   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
-  if (m_OpenConnections == 0)
-  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
-    CSingleLock lock(*this);
-    if (m_OpenConnections == 0 /* check again - when locked */ && m_context != NULL)
-    {
-      if (m_IdleTimeout > 0)
-         {
-        m_IdleTimeout--;
-      }
-         else
-         {
-        CLog::Log(LOGNOTICE, "Samba is idle. Closing the remaining connections");
-        smb.Deinit();
-      }
-    }
-  }
-}
-
-void CSMB::SetActivityTime()
-{
-  /* Since we get called every 500ms from ProcessSlow we limit the tick count to 180 */
-  /* That means we have 2 ticks per second which equals 180/2 == 90 seconds */
-  m_IdleTimeout = 180;
-}
-
-/* The following two function is used to keep track on how many Opened files/directories there are.
-   This makes the idle timer not count if a movie is paused for example */
-void CSMB::AddActiveConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections++;
-}
-void CSMB::AddIdleConnection()
-{
-  CSingleLock lock(*this);
-  m_OpenConnections--;
-  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
-     leaves the movie paused for a long while and then press stop */
-  m_IdleTimeout = 180;
-}
-#endif
-
-CSMB smb;
-
-CFileSMB::CFileSMB()
-{
-  smb.Init();
-  m_fd = -1;
-#ifdef TARGET_POSIX
-  smb.AddActiveConnection();
-#endif
-}
-
-CFileSMB::~CFileSMB()
-{
-  Close();
-#ifdef TARGET_POSIX
-  smb.AddIdleConnection();
-#endif
-}
-
-int64_t CFileSMB::GetPosition()
-{
-  if (m_fd == -1) return 0;
-  smb.Init();
-  CSingleLock lock(smb);
-  int64_t pos = smbc_lseek(m_fd, 0, SEEK_CUR);
-  if ( pos < 0 )
-    return 0;
-  return pos;
-}
-
-int64_t CFileSMB::GetLength()
-{
-  if (m_fd == -1) return 0;
-  return m_fileSize;
-}
-
-bool CFileSMB::Open(const CURL& url)
-{
-  Close();
-
-  // we can't open files like smb://file.f or smb://server/file.f
-  // if a file matches the if below return false, it can't exist on a samba share.
-  if (!IsValidFile(url.GetFileName()))
-  {
-      CLog::Log(LOGNOTICE,"FileSmb->Open: Bad URL : '%s'",url.GetFileName().c_str());
-      return false;
-  }
-  m_url = url;
-
-  // opening a file to another computer share will create a new session
-  // when opening smb://server xbms will try to find folder.jpg in all shares
-  // listed, which will create lot's of open sessions.
-
-  CStdString strFileName;
-  m_fd = OpenFile(url, strFileName);
-
-  CLog::Log(LOGDEBUG,"CFileSMB::Open - opened %s, fd=%d",url.GetFileName().c_str(), m_fd);
-  if (m_fd == -1)
-  {
-    // write error to logfile
-#ifdef TARGET_WINDOWS
-    int nt_error = smb.ConvertUnixToNT(errno);
-    CLog::Log(LOGINFO, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' nt_err : '%x' error : '%s'", strFileName.c_str(), errno, nt_error, get_friendly_nt_error_msg(nt_error));
-#else
-    CLog::Log(LOGINFO, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strFileName.c_str(), errno, strerror(errno));
-#endif
-    return false;
-  }
-
-  CSingleLock lock(smb);
-#ifdef TARGET_WINDOWS
-  struct __stat64 tmpBuffer = {0};
-#else
-  struct stat tmpBuffer;
-#endif
-  if (smbc_stat(strFileName, &tmpBuffer) < 0)
-  {
-    smbc_close(m_fd);
-    m_fd = -1;
-    return false;
-  }
-
-  m_fileSize = tmpBuffer.st_size;
-
-  int64_t ret = smbc_lseek(m_fd, 0, SEEK_SET);
-  if ( ret < 0 )
-  {
-    smbc_close(m_fd);
-    m_fd = -1;
-    return false;
-  }
-  // We've successfully opened the file!
-  return true;
-}
-
-
-/// \brief Checks authentication against SAMBA share. Reads password cache created in CSMBDirectory::OpenDir().
-/// \param strAuth The SMB style path
-/// \return SMB file descriptor
-/*
-int CFileSMB::OpenFile(CStdString& strAuth)
-{
-  int fd = -1;
-
-  CStdString strPath = g_passwordManager.GetSMBAuthFilename(strAuth);
-
-  fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
-  // TODO: Run a loop here that prompts for our username/password as appropriate?
-  // We have the ability to run a file (eg from a button action) without browsing to
-  // the directory first.  In the case of a password protected share that we do
-  // not have the authentication information for, the above smbc_open() will have
-  // returned negative, and the file will not be opened.  While this is not a particular
-  // likely scenario, we might want to implement prompting for the password in this case.
-  // The code from SMBDirectory can be used for this.
-  if(fd >= 0)
-    strAuth = strPath;
-
-  return fd;
-}
-*/
-
-int CFileSMB::OpenFile(const CURL &url, CStdString& strAuth)
-{
-  int fd = -1;
-  smb.Init();
-
-  strAuth = GetAuthenticatedPath(url);
-  CStdString strPath = strAuth;
-
-  {
-    CSingleLock lock(smb);
-    fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
-  }
-
-  // file open failed, try to open the directory to force authentication
-#ifdef TARGET_WINDOWS
-  if (fd < 0 && smb.ConvertUnixToNT(errno) == NT_STATUS_ACCESS_DENIED)
-#else
-  if (fd < 0 && errno == EACCES)
-#endif
-  {
-    CURL urlshare(url);
-
-    /* just replace the filename with the sharename */
-    urlshare.SetFileName(url.GetShareName());
-
-    CSMBDirectory smbDir;
-    // TODO: Currently we always allow prompting on files.  This may need to
-    // change in the future as background scanners are more prolific.
-    smbDir.SetAllowPrompting(true);
-    fd = smbDir.Open(urlshare);
-
-    // directory open worked, try opening the file again
-    if (fd >= 0)
-    {
-      CSingleLock lock(smb);
-      // close current directory filehandle
-      // dont need to purge since its the same server and share
-      smbc_closedir(fd);
-
-      // set up new filehandle (as CFileSMB::Open does)
-      strPath = GetAuthenticatedPath(url);
-
-      fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
-    }
-  }
-
-  if (fd >= 0)
-    strAuth = strPath;
-
-  return fd;
-}
-
-bool CFileSMB::Exists(const CURL& url)
-{
-  // we can't open files like smb://file.f or smb://server/file.f
-  // if a file matches the if below return false, it can't exist on a samba share.
-  if (!IsValidFile(url.GetFileName())) return false;
-
-  smb.Init();
-  CStdString strFileName = GetAuthenticatedPath(url);
-
-#ifdef TARGET_WINDOWS
-  struct __stat64 info;
-#else
-  struct stat info;
-#endif
-
-  CSingleLock lock(smb);
-  int iResult = smbc_stat(strFileName, &info);
-
-  if (iResult < 0) return false;
-  return true;
-}
-
-int CFileSMB::Stat(struct __stat64* buffer)
-{
-  if (m_fd == -1)
-    return -1;
-
-#ifdef TARGET_WINDOWS
-  struct __stat64 tmpBuffer = {0};
-#else
-  struct stat tmpBuffer = {0};
-#endif
-
-  CSingleLock lock(smb);
-  int iResult = smbc_fstat(m_fd, &tmpBuffer);
-
-  memset(buffer, 0, sizeof(struct __stat64));
-  buffer->st_dev = tmpBuffer.st_dev;
-  buffer->st_ino = tmpBuffer.st_ino;
-  buffer->st_mode = tmpBuffer.st_mode;
-  buffer->st_nlink = tmpBuffer.st_nlink;
-  buffer->st_uid = tmpBuffer.st_uid;
-  buffer->st_gid = tmpBuffer.st_gid;
-  buffer->st_rdev = tmpBuffer.st_rdev;
-  buffer->st_size = tmpBuffer.st_size;
-  buffer->st_atime = tmpBuffer.st_atime;
-  buffer->st_mtime = tmpBuffer.st_mtime;
-  buffer->st_ctime = tmpBuffer.st_ctime;
-
-  return iResult;
-}
-
-int CFileSMB::Stat(const CURL& url, struct __stat64* buffer)
-{
-  smb.Init();
-  CStdString strFileName = GetAuthenticatedPath(url);
-  CSingleLock lock(smb);
-
-#ifdef TARGET_WINDOWS
-  struct __stat64 tmpBuffer = {0};
-#else
-  struct stat tmpBuffer = {0};
-#endif
-  int iResult = smbc_stat(strFileName, &tmpBuffer);
-
-  memset(buffer, 0, sizeof(struct __stat64));
-  buffer->st_dev = tmpBuffer.st_dev;
-  buffer->st_ino = tmpBuffer.st_ino;
-  buffer->st_mode = tmpBuffer.st_mode;
-  buffer->st_nlink = tmpBuffer.st_nlink;
-  buffer->st_uid = tmpBuffer.st_uid;
-  buffer->st_gid = tmpBuffer.st_gid;
-  buffer->st_rdev = tmpBuffer.st_rdev;
-  buffer->st_size = tmpBuffer.st_size;
-  buffer->st_atime = tmpBuffer.st_atime;
-  buffer->st_mtime = tmpBuffer.st_mtime;
-  buffer->st_ctime = tmpBuffer.st_ctime;
-
-  return iResult;
-}
-
-unsigned int CFileSMB::Read(void *lpBuf, int64_t uiBufSize)
-{
-  if (m_fd == -1) return 0;
-  CSingleLock lock(smb); // Init not called since it has to be "inited" by now
-#ifdef TARGET_POSIX
-  smb.SetActivityTime();
-#endif
-  /* work around stupid bug in samba */
-  /* some samba servers has a bug in it where the */
-  /* 17th bit will be ignored in a request of data */
-  /* this can lead to a very small return of data */
-  /* also worse, a request of exactly 64k will return */
-  /* as if eof, client has a workaround for windows */
-  /* thou it seems other servers are affected too */
-  if( uiBufSize >= 64*1024-2 )
-    uiBufSize = 64*1024-2;
-
-  int bytesRead = smbc_read(m_fd, lpBuf, (int)uiBufSize);
-
-  if ( bytesRead < 0 && errno == EINVAL )
-  {
-    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s ) - Retrying", __FUNCTION__, bytesRead, errno, strerror(errno));
-    bytesRead = smbc_read(m_fd, lpBuf, (int)uiBufSize);
-  }
-
-  if ( bytesRead < 0 )
-  {
-#ifdef TARGET_WINDOWS
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
-#else
-    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s )", __FUNCTION__, bytesRead, errno, strerror(errno));
-#endif
-    return 0;
-  }
-
-  return (unsigned int)bytesRead;
-}
-
-int64_t CFileSMB::Seek(int64_t iFilePosition, int iWhence)
-{
-  if (m_fd == -1) return -1;
-
-  CSingleLock lock(smb); // Init not called since it has to be "inited" by now
-#ifdef TARGET_POSIX
-  smb.SetActivityTime();
-#endif
-  int64_t pos = smbc_lseek(m_fd, iFilePosition, iWhence);
-
-  if ( pos < 0 )
-  {
-#ifdef TARGET_WINDOWS
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
-#else
-    CLog::Log(LOGERROR, "%s - Error( %"PRId64", %d, %s )", __FUNCTION__, pos, errno, strerror(errno));
-#endif
-    return -1;
-  }
-
-  return (int64_t)pos;
-}
-
-void CFileSMB::Close()
-{
-  if (m_fd != -1)
-  {
-    CLog::Log(LOGDEBUG,"CFileSMB::Close closing fd %d", m_fd);
-    CSingleLock lock(smb);
-    smbc_close(m_fd);
-  }
-  m_fd = -1;
-}
-
-int CFileSMB::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  if (m_fd == -1) return -1;
-  DWORD dwNumberOfBytesWritten = 0;
-
-  // lpBuf can be safely casted to void* since xmbc_write will only read from it.
-  smb.Init();
-  CSingleLock lock(smb);
-  dwNumberOfBytesWritten = smbc_write(m_fd, (void*)lpBuf, (DWORD)uiBufSize);
-
-  return (int)dwNumberOfBytesWritten;
-}
-
-bool CFileSMB::Delete(const CURL& url)
-{
-  smb.Init();
-  CStdString strFile = GetAuthenticatedPath(url);
-
-  CSingleLock lock(smb);
-
-  int result = smbc_unlink(strFile.c_str());
-
-  if(result != 0)
-#ifdef TARGET_WINDOWS
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
-#else
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
-#endif
-
-  return (result == 0);
-}
-
-bool CFileSMB::Rename(const CURL& url, const CURL& urlnew)
-{
-  smb.Init();
-  CStdString strFile = GetAuthenticatedPath(url);
-  CStdString strFileNew = GetAuthenticatedPath(urlnew);
-  CSingleLock lock(smb);
-
-  int result = smbc_rename(strFile.c_str(), strFileNew.c_str());
-
-  if(result != 0)
-#ifdef TARGET_WINDOWS
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
-#else
-    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
-#endif
-
-  return (result == 0);
-}
-
-bool CFileSMB::OpenForWrite(const CURL& url, bool bOverWrite)
-{
-  m_fileSize = 0;
-
-  Close();
-  smb.Init();
-  // we can't open files like smb://file.f or smb://server/file.f
-  // if a file matches the if below return false, it can't exist on a samba share.
-  if (!IsValidFile(url.GetFileName())) return false;
-
-  CStdString strFileName = GetAuthenticatedPath(url);
-  CSingleLock lock(smb);
-
-  if (bOverWrite)
-  {
-    CLog::Log(LOGWARNING, "FileSmb::OpenForWrite() called with overwriting enabled! - %s", strFileName.c_str());
-    m_fd = smbc_creat(strFileName.c_str(), 0);
-  }
-  else
-  {
-    m_fd = smbc_open(strFileName.c_str(), O_RDWR, 0);
-  }
-
-  if (m_fd == -1)
-  {
-    // write error to logfile
-#ifdef TARGET_WINDOWS
-    int nt_error = map_nt_error_from_unix(errno);
-    CLog::Log(LOGERROR, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' nt_err : '%x' error : '%s'", strFileName.c_str(), errno, nt_error, get_friendly_nt_error_msg(nt_error));
-#else
-    CLog::Log(LOGERROR, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strFileName.c_str(), errno, strerror(errno));
-#endif
-    return false;
-  }
-
-  // We've successfully opened the file!
-  return true;
-}
-
-bool CFileSMB::IsValidFile(const CStdString& strFileName)
-{
-  if (strFileName.Find('/') == -1 || /* doesn't have sharename */
-      strFileName.Right(2) == "/." || /* not current folder */
-      strFileName.Right(3) == "/..")  /* not parent folder */
-      return false;
-  return true;
-}
-
-CStdString CFileSMB::GetAuthenticatedPath(const CURL &url)
-{
-  CURL authURL(url);
-  CPasswordManager::GetInstance().AuthenticateURL(authURL);
-  return smb.URLEncode(authURL);
-}
diff --git a/xbmc/filesystem/FileSmb.h b/xbmc/filesystem/FileSmb.h
deleted file mode 100644 (file)
index 4068199..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-// FileSmb.h: interface for the CFileSMB class.
-
-//
-
-//////////////////////////////////////////////////////////////////////
-
-
-
-#if !defined(AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_)
-
-#define AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_
-
-
-#if _MSC_VER > 1000
-
-#pragma once
-
-#endif // _MSC_VER > 1000
-
-#include "IFile.h"
-#include "URL.h"
-#include "threads/CriticalSection.h"
-
-#define NT_STATUS_CONNECTION_REFUSED long(0xC0000000 | 0x0236)
-#define NT_STATUS_INVALID_HANDLE long(0xC0000000 | 0x0008)
-#define NT_STATUS_ACCESS_DENIED long(0xC0000000 | 0x0022)
-#define NT_STATUS_OBJECT_NAME_NOT_FOUND long(0xC0000000 | 0x0034)
-#ifdef _LINUX
-#define NT_STATUS_INVALID_COMPUTER_NAME long(0xC0000000 | 0x0122)
-#endif
-
-struct _SMBCCTX;
-typedef _SMBCCTX SMBCCTX;
-
-class CSMB : public CCriticalSection
-{
-public:
-  CSMB();
-  ~CSMB();
-  void Init();
-  void Deinit();
-  void Purge();
-  void PurgeEx(const CURL& url);
-#ifdef _LINUX
-  void CheckIfIdle();
-  void SetActivityTime();
-  void AddActiveConnection();
-  void AddIdleConnection();
-#endif
-  CStdString URLEncode(const CStdString &value);
-  CStdString URLEncode(const CURL &url);
-
-  DWORD ConvertUnixToNT(int error);
-private:
-  SMBCCTX *m_context;
-  CStdString m_strLastHost;
-  CStdString m_strLastShare;
-#ifdef _LINUX
-  int m_OpenConnections;
-  unsigned int m_IdleTimeout;
-#endif
-};
-
-extern CSMB smb;
-
-namespace XFILE
-{
-class CFileSMB : public IFile
-{
-public:
-  CFileSMB();
-  int OpenFile(const CURL &url, CStdString& strAuth);
-  virtual ~CFileSMB();
-  virtual void Close();
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual int Stat(struct __stat64* buffer);
-  virtual int64_t GetLength();
-  virtual int64_t GetPosition();
-  virtual int Write(const void* lpBuf, int64_t uiBufSize);
-
-  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-  virtual bool Delete(const CURL& url);
-  virtual bool Rename(const CURL& url, const CURL& urlnew);
-  virtual int  GetChunkSize() {return 1;}
-
-protected:
-  CURL m_url;
-  bool IsValidFile(const CStdString& strFileName);
-  CStdString GetAuthenticatedPath(const CURL &url);
-  int64_t m_fileSize;
-  int m_fd;
-};
-}
-
-#endif // !defined(AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_)
diff --git a/xbmc/filesystem/FileSpecialProtocol.cpp b/xbmc/filesystem/FileSpecialProtocol.cpp
deleted file mode 100644 (file)
index e775689..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileSpecialProtocol.h"
-#include "SpecialProtocol.h"
-#include "URL.h"
-
-#include <sys/stat.h>
-
-using namespace XFILE;
-
-CFileSpecialProtocol::CFileSpecialProtocol(void)
-{
-}
-
-CFileSpecialProtocol::~CFileSpecialProtocol(void)
-{
-  Close();
-}
-
-bool CFileSpecialProtocol::Open(const CURL& url)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-
-  return m_file.Open(strFileName);
-}
-
-bool CFileSpecialProtocol::OpenForWrite(const CURL& url, bool bOverWrite /*=false */)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-
-  return m_file.OpenForWrite(strFileName,bOverWrite);
-}
-
-bool CFileSpecialProtocol::Delete(const CURL& url)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-  
-  return m_file.Delete(strFileName);
-}
-
-bool CFileSpecialProtocol::Exists(const CURL& url)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-
-  return m_file.Exists(strFileName);
-}
-
-int CFileSpecialProtocol::Stat(const CURL& url, struct __stat64* buffer)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-
-  return m_file.Stat(strFileName, buffer);
-}
-
-bool CFileSpecialProtocol::Rename(const CURL& url, const CURL& urlnew)
-{
-  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
-  CStdString strFileName2=CSpecialProtocol::TranslatePath(urlnew);
-
-  return m_file.Rename(strFileName,strFileName2);
-}
-
-int CFileSpecialProtocol::Stat(struct __stat64* buffer)
-{
-  return m_file.Stat(buffer);
-}
-
-unsigned int CFileSpecialProtocol::Read(void* lpBuf, int64_t uiBufSize)
-{
-  return m_file.Read(lpBuf, uiBufSize);
-}
-  
-int CFileSpecialProtocol::Write(const void* lpBuf, int64_t uiBufSize)
-{
-  return m_file.Write(lpBuf,uiBufSize);
-}
-
-int64_t CFileSpecialProtocol::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
-{
-  return m_file.Seek(iFilePosition, iWhence);
-}
-
-void CFileSpecialProtocol::Close()
-{
-  m_file.Close();
-}
-
-int64_t CFileSpecialProtocol::GetPosition()
-{
-  return m_file.GetPosition();
-}
-
-int64_t CFileSpecialProtocol::GetLength()
-{
-  return m_file.GetLength();
-}
-
-
-
diff --git a/xbmc/filesystem/FileSpecialProtocol.h b/xbmc/filesystem/FileSpecialProtocol.h
deleted file mode 100644 (file)
index d9ccc48..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "File.h"
-
-namespace XFILE
-{
-class CFileSpecialProtocol : public IFile
-{
-public:
-  CFileSpecialProtocol(void);
-  virtual ~CFileSpecialProtocol(void);
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual int Stat(struct __stat64* buffer);
-  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
-  virtual bool Delete(const CURL& url);
-  virtual bool Rename(const CURL& url, const CURL& urlnew);
-
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int Write(const void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-
-protected:
-  CFile m_file;
-};
-}
diff --git a/xbmc/filesystem/FileTuxBox.cpp b/xbmc/filesystem/FileTuxBox.cpp
deleted file mode 100644 (file)
index e6257eb..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileTuxBox.h"
-#include <errno.h>
-
-//Reserved for TuxBox Recording!
-
-using namespace XFILE;
-
-CFileTuxBox::CFileTuxBox()
-{}
-
-CFileTuxBox::~CFileTuxBox()
-{
-}
-
-int64_t CFileTuxBox::GetPosition()
-{
-  return 0;
-}
-
-int64_t CFileTuxBox::GetLength()
-{
-  return 0;
-}
-
-bool CFileTuxBox::Open(const CURL& url)
-{
-  return true;
-}
-
-unsigned int CFileTuxBox::Read(void* lpBuf, int64_t uiBufSize)
-{
-  return 0;
-}
-
-int64_t CFileTuxBox::Seek(int64_t iFilePosition, int iWhence)
-{
-  return 0;
-}
-
-void CFileTuxBox::Close()
-{
-}
-
-bool CFileTuxBox::Exists(const CURL& url)
-{
-  return true;
-}
-
-int CFileTuxBox::Stat(const CURL& url, struct __stat64* buffer)
-{
-  errno = ENOENT;
-  return -1;
-}
-
diff --git a/xbmc/filesystem/FileTuxBox.h b/xbmc/filesystem/FileTuxBox.h
deleted file mode 100644 (file)
index be6ff5d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IFile.h"
-
-namespace XFILE
-{
-  class CFileTuxBox : public IFile
-  {
-    public:
-      CFileTuxBox();
-      virtual ~CFileTuxBox();
-      virtual int64_t GetPosition();
-      virtual int64_t GetLength();
-      virtual bool Open(const CURL& url);
-      virtual void Close();
-      virtual bool Exists(const CURL& url);
-      virtual int Stat(const CURL& url, struct __stat64* buffer);
-      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-      virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-    protected:
-  };
-}
-
-
-
diff --git a/xbmc/filesystem/FileUDF.cpp b/xbmc/filesystem/FileUDF.cpp
deleted file mode 100644 (file)
index 112d5ab..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *      Copyright (C) 2010 Team Boxee
- *      http://www.boxee.tv
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileUDF.h"
-#include "URL.h"
-#include "Util.h"
-
-#include <sys/stat.h>
-#include <errno.h>
-
-using namespace std;
-using namespace XFILE;
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-//*********************************************************************************************
-CFileUDF::CFileUDF()
-{
-  m_bOpened = false;
-}
-
-//*********************************************************************************************
-CFileUDF::~CFileUDF()
-{
-  if (m_bOpened)
-  {
-    Close();
-  }
-}
-//*********************************************************************************************
-bool CFileUDF::Open(const CURL& url)
-{
-  CStdString strFName = url.GetHostName();
-
-  CURL::Decode(strFName);
-
-  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
-  if (m_hFile == INVALID_HANDLE_VALUE)
-  {
-    m_bOpened = false;
-    return false;
-  }
-
-  m_bOpened = true;
-  return true;
-}
-
-//*********************************************************************************************
-unsigned int CFileUDF::Read(void *lpBuf, int64_t uiBufSize)
-{
-  if (!m_bOpened) return 0;
-  char *pData = (char *)lpBuf;
-
-  int iResult = m_udfIsoReaderLocal.ReadFile( m_hFile, (unsigned char*)pData, (long)uiBufSize);
-  if (iResult == -1)
-    return 0;
-  return iResult;
-}
-
-//*********************************************************************************************
-void CFileUDF::Close()
-{
-  if (!m_bOpened) return ;
-  m_udfIsoReaderLocal.CloseFile( m_hFile);
-}
-
-//*********************************************************************************************
-int64_t CFileUDF::Seek(int64_t iFilePosition, int iWhence)
-{
-  if (!m_bOpened) return -1;
-  int64_t lNewPos = m_udfIsoReaderLocal.Seek(m_hFile, iFilePosition, iWhence);
-  return lNewPos;
-}
-
-//*********************************************************************************************
-int64_t CFileUDF::GetLength()
-{
-  if (!m_bOpened) return -1;
-  return m_udfIsoReaderLocal.GetFileSize(m_hFile);
-}
-
-//*********************************************************************************************
-int64_t CFileUDF::GetPosition()
-{
-  if (!m_bOpened) return -1;
-  return m_udfIsoReaderLocal.GetFilePosition(m_hFile);
-}
-
-bool CFileUDF::Exists(const CURL& url)
-{
-  string strFName = "\\";
-  strFName += url.GetFileName();
-  for (int i = 0; i < (int)strFName.size(); ++i )
-  {
-    if (strFName[i] == '/') strFName[i] = '\\';
-  }
-  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
-  if (m_hFile == INVALID_HANDLE_VALUE)
-    return false;
-
-  m_udfIsoReaderLocal.CloseFile(m_hFile);
-  return true;
-}
-
-int CFileUDF::Stat(const CURL& url, struct __stat64* buffer)
-{
-  string strFName = "\\";
-  strFName += url.GetFileName();
-  for (int i = 0; i < (int)strFName.size(); ++i )
-  {
-    if (strFName[i] == '/') strFName[i] = '\\';
-  }
-  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
-  if (m_hFile != INVALID_HANDLE_VALUE)
-  {
-    buffer->st_size = m_udfIsoReaderLocal.GetFileSize(m_hFile);
-    buffer->st_mode = _S_IFREG;
-    m_udfIsoReaderLocal.CloseFile(m_hFile);
-    return 0;
-  }
-  errno = ENOENT;
-  return -1;
-}
diff --git a/xbmc/filesystem/FileUDF.h b/xbmc/filesystem/FileUDF.h
deleted file mode 100644 (file)
index fb46b47..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _FILEUDF_H
-#define _FILEUDF_H
-
-/*
- *      Copyright (C) 2010 Team Boxee
- *      http://www.boxee.tv
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IFile.h"
-#include "udf25.h"
-
-namespace XFILE
-{
-
-class CFileUDF : public IFile
-{
-public:
-  CFileUDF();
-  virtual ~CFileUDF();
-  virtual int64_t GetPosition();
-  virtual int64_t GetLength();
-  virtual bool Open(const CURL& url);
-  virtual bool Exists(const CURL& url);
-  virtual int Stat(const CURL& url, struct __stat64* buffer);
-  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-  virtual void Close();
-protected:
-  bool m_bOpened;
-  HANDLE m_hFile;
-  udf25 m_udfIsoReaderLocal;
-};
-}
-
-#endif
diff --git a/xbmc/filesystem/FileUPnP.cpp b/xbmc/filesystem/FileUPnP.cpp
deleted file mode 100644 (file)
index 665e096..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileUPnP.h"
-#include "UPnPDirectory.h"
-#include "FileFactory.h"
-#include "FileItem.h"
-#include "utils/log.h"
-
-using namespace XFILE;
-
-CFileUPnP::CFileUPnP()
-{
-}
-
-CFileUPnP::~CFileUPnP()
-{
-}
-
-bool CFileUPnP::Open(const CURL& url)
-{
-  CFileItem item_new;
-  if (CUPnPDirectory::GetResource(url.Get(), item_new))
-  {
-    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
-    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());    
-    CURL *pNewUrl = new CURL(item_new.GetPath());    
-    if (pNewImp)
-    {
-      throw new CRedirectException(pNewImp, pNewUrl);
-    }
-    SAFE_DELETE(pNewUrl);    
-  }
-  return false;
-}
-
-int CFileUPnP::Stat(const CURL& url, struct __stat64* buffer)
-{
-  CFileItem item_new;
-  if (CUPnPDirectory::GetResource(url.Get(), item_new))
-  {
-    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
-    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
-    CURL *pNewUrl = new CURL(item_new.GetPath());
-    if (pNewImp)
-    {
-      throw new CRedirectException(pNewImp, pNewUrl);
-    }
-    SAFE_DELETE(pNewUrl);
-  }
-  return -1;
-}
-
-bool CFileUPnP::Exists(const CURL& url)
-{
-  CFileItem item_new;
-  if (CUPnPDirectory::GetResource(url.Get(), item_new))
-  {
-    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
-    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
-    CURL *pNewUrl = new CURL(item_new.GetPath());
-    if (pNewImp)
-    {
-      throw new CRedirectException(pNewImp, pNewUrl);
-    }
-    SAFE_DELETE(pNewUrl);
-  }
-  return false;
-}
diff --git a/xbmc/filesystem/FileUPnP.h b/xbmc/filesystem/FileUPnP.h
deleted file mode 100644 (file)
index 3d31364..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IFile.h"
-
-namespace XFILE
-{
-  class CFileUPnP : public IFile
-  {
-    public:
-      CFileUPnP();
-      virtual ~CFileUPnP();
-      virtual bool Open(const CURL& url);      
-      virtual bool Exists(const CURL& url);
-      virtual int Stat(const CURL& url, struct __stat64* buffer);
-      
-      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) {return -1;}
-      virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET) {return -1;}
-      virtual void Close(){}
-      virtual int64_t GetPosition() {return -1;}
-      virtual int64_t GetLength() {return -1;}
-  };
-}
diff --git a/xbmc/filesystem/FileZip.cpp b/xbmc/filesystem/FileZip.cpp
deleted file mode 100644 (file)
index c59a3b1..0000000
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileZip.h"
-#include "URL.h"
-#include "utils/URIUtils.h"
-
-#include <sys/stat.h>
-
-#define ZIP_CACHE_LIMIT 4*1024*1024
-
-using namespace XFILE;
-using namespace std;
-
-CFileZip::CFileZip()
-{
-  m_szStringBuffer = NULL;
-  m_szStartOfStringBuffer = NULL;
-  m_iDataInStringBuffer = 0;
-  m_bCached = false;
-  m_iRead = -1;
-}
-
-CFileZip::~CFileZip()
-{
-  delete[] m_szStringBuffer;
-  Close();
-}
-
-bool CFileZip::Open(const CURL&url)
-{
-  CStdString strOpts = url.GetOptions();
-  CURL url2(url);
-  url2.SetOptions("");
-  CStdString strPath = url2.Get();
-  if (!g_ZipManager.GetZipEntry(strPath,mZipItem))
-    return false;
-
-  if ((mZipItem.flags & 64) == 64)
-  {
-    CLog::Log(LOGERROR,"FileZip: encrypted file, not supported!");
-    return false;
-  }
-
-  if ((mZipItem.method != 8) && (mZipItem.method != 0))
-  {
-    CLog::Log(LOGERROR,"FileZip: unsupported compression method!");
-    return false;
-  }
-
-  if (mZipItem.method != 0 && mZipItem.usize > ZIP_CACHE_LIMIT && strOpts != "?cache=no")
-  {
-    if (!CFile::Exists("special://temp/" + URIUtils::GetFileName(strPath)))
-    {
-      url2.SetOptions("?cache=no");
-      if (!CFile::Cache(url2.Get(), "special://temp/" + URIUtils::GetFileName(strPath)))
-        return false;
-    }
-    m_bCached = true;
-    return mFile.Open("special://temp/" + URIUtils::GetFileName(strPath));
-  }
-
-  if (!mFile.Open(url.GetHostName())) // this is the zip-file, always open binary
-  {
-    CLog::Log(LOGERROR,"FileZip: unable to open zip file %s!",url.GetHostName().c_str());
-    return false;
-  }
-  mFile.Seek(mZipItem.offset,SEEK_SET);
-  return InitDecompress();
-}
-
-bool CFileZip::InitDecompress()
-{
-  m_iRead = 1;
-  m_iFilePos = 0;
-  m_iZipFilePos = 0;
-  m_iAvailBuffer = 0;
-  m_bFlush = false;
-  m_ZStream.zalloc = Z_NULL;
-  m_ZStream.zfree = Z_NULL;
-  m_ZStream.opaque = Z_NULL;
-  if( mZipItem.method != 0 )
-  {
-    if (inflateInit2(&m_ZStream,-MAX_WBITS) != Z_OK)
-    {
-      CLog::Log(LOGERROR,"FileZip: error initializing zlib!");
-      return false;
-    }
-  }
-  m_ZStream.next_in = (Bytef*)m_szBuffer;
-  m_ZStream.avail_in = 0;
-  m_ZStream.total_out = 0;
-
-  return true;
-}
-
-int64_t CFileZip::GetLength()
-{
-  return mZipItem.usize;
-}
-
-int64_t CFileZip::GetPosition()
-{
-  if (m_bCached)
-    return mFile.GetPosition();
-
-  return m_iFilePos;
-}
-
-int64_t CFileZip::Seek(int64_t iFilePosition, int iWhence)
-{
-  if (m_bCached)
-    return mFile.Seek(iFilePosition,iWhence);
-  if (mZipItem.method == 0) // this is easy
-  {
-    int64_t iResult;
-    switch (iWhence)
-    {
-    case SEEK_SET:
-      if (iFilePosition > mZipItem.usize)
-        return -1;
-      m_iFilePos = iFilePosition;
-      m_iZipFilePos = m_iFilePos;
-      iResult = mFile.Seek(iFilePosition+mZipItem.offset,SEEK_SET)-mZipItem.offset;
-      return iResult;
-      break;
-
-    case SEEK_CUR:
-      if (m_iFilePos+iFilePosition > mZipItem.usize)
-        return -1;
-      m_iFilePos += iFilePosition;
-      m_iZipFilePos = m_iFilePos;
-      iResult = mFile.Seek(iFilePosition,SEEK_CUR)-mZipItem.offset;
-      return iResult;
-      break;
-
-    case SEEK_END:
-      if (iFilePosition > mZipItem.usize)
-        return -1;
-      m_iFilePos = mZipItem.usize+iFilePosition;
-      m_iZipFilePos = m_iFilePos;
-      iResult = mFile.Seek(mZipItem.offset+mZipItem.usize+iFilePosition,SEEK_SET)-mZipItem.offset;
-      return iResult;
-      break;
-    default:
-      return -1;
-
-    }
-  }
-  // here goes the stupid part..
-  if (mZipItem.method == 8)
-  {
-    char temp[131072];
-    switch (iWhence)
-    {
-    case SEEK_SET:
-      if (iFilePosition == m_iFilePos)
-        return m_iFilePos; // mp3reader does this lots-of-times
-      if (iFilePosition > mZipItem.usize || iFilePosition < 0)
-        return -1;
-      // read until position in 128k blocks.. only way to do it due to format.
-      // can't start in the middle of data since then we'd have no clue where
-      // we are in uncompressed data..
-      if (iFilePosition < m_iFilePos)
-      {
-        m_iFilePos = 0;
-        m_iZipFilePos = 0;
-        inflateEnd(&m_ZStream);
-        inflateInit2(&m_ZStream,-MAX_WBITS); // simply restart zlib
-        mFile.Seek(mZipItem.offset,SEEK_SET);
-        m_ZStream.next_in = (Bytef*)m_szBuffer;
-        m_ZStream.avail_in = 0;
-        m_ZStream.total_out = 0;
-        while (m_iFilePos < iFilePosition)
-        {
-          unsigned int iToRead = (iFilePosition-m_iFilePos)>131072?131072:(int)(iFilePosition-m_iFilePos);
-          if (Read(temp,iToRead) != iToRead)
-            return -1;
-        }
-        return m_iFilePos;
-      }
-      else // seek forward
-        return Seek(iFilePosition-m_iFilePos,SEEK_CUR);
-      break;
-
-    case SEEK_CUR:
-      if (iFilePosition < 0)
-        return Seek(m_iFilePos+iFilePosition,SEEK_SET); // can't rewind stream
-      // read until requested position, drop data
-      if (m_iFilePos+iFilePosition > mZipItem.usize)
-        return -1;
-      iFilePosition += m_iFilePos;
-      while (m_iFilePos < iFilePosition)
-      {
-        unsigned int iToRead = (iFilePosition-m_iFilePos)>131072?131072:(int)(iFilePosition-m_iFilePos);
-        if (Read(temp,iToRead) != iToRead)
-          return -1;
-      }
-      return m_iFilePos;
-      break;
-
-    case SEEK_END:
-      // now this is a nasty bastard, possibly takes lotsoftime
-      // uncompress, minding m_ZStream.total_out
-
-      while( (int)m_ZStream.total_out < mZipItem.usize+iFilePosition)
-      {
-        unsigned int iToRead = (mZipItem.usize+iFilePosition-m_ZStream.total_out > 131072)?131072:(int)(mZipItem.usize+iFilePosition-m_ZStream.total_out);
-        if (Read(temp,iToRead) != iToRead)
-          return -1;
-      }
-      return m_iFilePos;
-      break;
-    default:
-      return -1;
-    }
-  }
-  return -1;
-}
-
-bool CFileZip::Exists(const CURL& url)
-{
-  SZipEntry item;
-  if (g_ZipManager.GetZipEntry(url.Get(),item))
-    return true;
-  return false;
-}
-
-int CFileZip::Stat(struct __stat64 *buffer)
-{
-  int ret;
-  struct tm tm = {};
-
-  ret = mFile.Stat(buffer);
-  tm.tm_sec = (mZipItem.mod_time & 0x1F) << 1;
-  tm.tm_min = (mZipItem.mod_time & 0x7E0) >> 5;
-  tm.tm_hour = (mZipItem.mod_time & 0xF800) >> 11;
-  tm.tm_mday = (mZipItem.mod_date & 0x1F);
-  tm.tm_mon = (mZipItem.mod_date & 0x1E0) >> 5;
-  tm.tm_year = (mZipItem.mod_date & 0xFE00) >> 9;
-  buffer->st_atime = buffer->st_ctime = buffer->st_mtime = mktime(&tm);
-
-  buffer->st_size = mZipItem.usize;
-  buffer->st_dev = (buffer->st_dev << 16) ^ (buffer->st_ino << 16);
-  buffer->st_ino ^= mZipItem.crc32;
-  return ret;
-}
-
-int CFileZip::Stat(const CURL& url, struct __stat64* buffer)
-{
-  if (!g_ZipManager.GetZipEntry(url.Get(),mZipItem))
-    return -1;
-
-  memset(buffer, 0, sizeof(struct __stat64));
-  buffer->st_gid = 0;
-  buffer->st_atime = buffer->st_ctime = mZipItem.mod_time;
-  buffer->st_size = mZipItem.usize;
-  return 0;
-}
-
-unsigned int CFileZip::Read(void* lpBuf, int64_t uiBufSize)
-{
-  if (m_bCached)
-    return mFile.Read(lpBuf,uiBufSize);
-
-  // flush what might be left in the string buffer
-  if (m_iDataInStringBuffer > 0)
-  {
-    size_t iMax = static_cast<size_t>((uiBufSize>m_iDataInStringBuffer?m_iDataInStringBuffer:uiBufSize));
-    memcpy(lpBuf,m_szStartOfStringBuffer,iMax);
-    uiBufSize -= iMax;
-    m_iDataInStringBuffer -= iMax;
-  }
-  if (mZipItem.method == 8) // deflated
-  {
-    uLong iDecompressed = 0;
-    uLong prevOut = m_ZStream.total_out;
-    while (((int)iDecompressed < uiBufSize) && ((m_iZipFilePos < mZipItem.csize) || (m_bFlush)))
-    {
-      m_ZStream.next_out = (Bytef*)(lpBuf)+iDecompressed;
-      m_ZStream.avail_out = static_cast<uInt>(uiBufSize-iDecompressed);
-      if (m_bFlush) // need to flush buffer !
-      {
-        int iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
-        m_bFlush = ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))?true:false;
-        if (!m_ZStream.avail_out) // flush filled buffer, get out of here
-        {
-          iDecompressed = m_ZStream.total_out-prevOut;
-          break;
-        }
-      }
-
-      if (!m_ZStream.avail_in)
-      {
-        if (!FillBuffer()) // eof!
-        {
-          iDecompressed = m_ZStream.total_out-prevOut;
-          break;
-        }
-      }
-
-      int iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
-      if (iMessage < 0)
-      {
-        Close();
-        return 0; // READ ERROR
-      }
-
-      m_bFlush = ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))?true:false; // more info in input buffer
-
-      iDecompressed = m_ZStream.total_out-prevOut;
-    }
-    m_iFilePos += iDecompressed;
-    return static_cast<unsigned int>(iDecompressed);
-  }
-  else if (mZipItem.method == 0) // uncompressed. just read from file, but mind our boundaries.
-  {
-    if (uiBufSize+m_iFilePos > mZipItem.csize)
-      uiBufSize = mZipItem.csize-m_iFilePos;
-    if (uiBufSize < 0)
-    {
-      return 0; // we are past eof, this shouldn't happen but test anyway
-    }
-    unsigned int iResult = mFile.Read(lpBuf,uiBufSize);
-    m_iZipFilePos += iResult;
-    m_iFilePos += iResult;
-    return iResult;
-  }
-  else
-    return false; // shouldn't happen. compression method checked in open
-}
-
-void CFileZip::Close()
-{
-  if (mZipItem.method == 8 && !m_bCached && m_iRead != -1)
-    inflateEnd(&m_ZStream);
-
-  mFile.Close();
-}
-/* CHANGED: JM - moved to CFile
-bool CFileZip::ReadString(char* szLine, int iLineLength)
-{
-  if (!m_szStringBuffer)
-  {
-    m_szStringBuffer = new char[1024]; // 1024 byte long strings per read
-    m_szStartOfStringBuffer = m_szStringBuffer;
-    m_iDataInStringBuffer = 0;
-    m_iRead = 0;
-  }
-
-  bool bEof = m_iDataInStringBuffer==0;
-  while ((iLineLength > 1) && (m_iRead > -1))
-  {
-    if (m_iDataInStringBuffer > 0)
-    {
-      bEof = false;
-      m_iRead = 1;
-      int iMax = (iLineLength<m_iDataInStringBuffer?iLineLength-1:m_iDataInStringBuffer-1);
-      for( int i=0;i<iMax;++i )
-      {
-        if (m_szStartOfStringBuffer[i] == '\r') // mac or win32 endings
-        {
-          strncpy(szLine,m_szStartOfStringBuffer,i);
-          szLine[i] = '\0';
-          m_iDataInStringBuffer -= i+1;
-          m_szStartOfStringBuffer += i+1;
-          if( m_szStartOfStringBuffer[0] == '\n') // win32 endings
-          {
-            m_szStartOfStringBuffer++;
-            m_iDataInStringBuffer--;
-          }
-          return true;
-        }
-        else if (m_szStartOfStringBuffer[i] == '\n') // unix or fucked up win32 endings
-        {
-          strncpy(szLine,m_szStartOfStringBuffer,i);
-          szLine[i] = '\0';
-          m_iDataInStringBuffer -= i+1;
-          m_szStartOfStringBuffer += i+1;
-          if (m_szStartOfStringBuffer[0] == '\r')
-          {
-            m_szStartOfStringBuffer++;
-            m_iDataInStringBuffer--;
-          }
-          return true;
-        }
-      }
-      strncpy(szLine,m_szStartOfStringBuffer,iMax);
-      szLine += iMax;
-      iLineLength -= iMax;
-      m_iDataInStringBuffer -= iMax;
-    }
-
-    if (m_iRead == 1 && (m_iDataInStringBuffer == 1))
-    {
-      m_szStringBuffer[0] = m_szStringBuffer[1023]; // need to make sure we don't loose any '\r\n' between buffers
-      m_iDataInStringBuffer = Read(m_szStringBuffer+1,1023);
-    }
-    else
-      m_iDataInStringBuffer = Read(m_szStringBuffer,1024);
-    m_szStartOfStringBuffer = m_szStringBuffer;
-    if (m_iDataInStringBuffer)
-      m_iRead = 1;
-    else
-      m_iRead = -1;
-  }
-  szLine[0] = '\0';
-  return !bEof;
-}*/
-
-bool CFileZip::FillBuffer()
-{
-  unsigned int sToRead = 65535;
-  if (m_iZipFilePos+65535 > mZipItem.csize)
-    sToRead = static_cast<int>(mZipItem.csize-m_iZipFilePos);
-
-  if (sToRead <= 0)
-    return false; // eof!
-
-  if (mFile.Read(m_szBuffer,sToRead) != sToRead)
-    return false;
-  m_ZStream.avail_in = sToRead;
-  m_ZStream.next_in = (Bytef*)m_szBuffer;
-  m_iZipFilePos += sToRead;
-  return true;
-}
-
-void CFileZip::DestroyBuffer(void* lpBuffer, int iBufSize)
-{
-  if (!m_bFlush)
-    return;
-  int iMessage = Z_STREAM_END; // whatever != Z_OK
-  while ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))
-  {
-    m_ZStream.next_out = (Bytef*)lpBuffer;
-    m_ZStream.avail_out = iBufSize;
-    iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
-  }
-  m_bFlush = false;
-}
-
-int CFileZip::UnpackFromMemory(string& strDest, const string& strInput, bool isGZ)
-{
-  unsigned int iPos=0;
-  int iResult=0;
-  while( iPos+LHDR_SIZE < strInput.size() || isGZ)
-  {
-    if (!isGZ)
-    {
-      CZipManager::readHeader(strInput.data()+iPos,mZipItem);
-      if( mZipItem.header != ZIP_LOCAL_HEADER )
-        return iResult;
-      if( (mZipItem.flags & 8) == 8 )
-      {
-        CLog::Log(LOGERROR,"FileZip: extended local header, not supported!");
-        return iResult;
-      }
-    }
-    if (!InitDecompress())
-      return iResult;
-    // we have a file - fill the buffer
-    char* temp;
-    int toRead=0;
-    if (isGZ)
-    {
-      m_ZStream.avail_in = strInput.size();
-      m_ZStream.next_in = (Bytef*)strInput.data();
-      temp = new char[8192];
-      toRead = 8191;
-    }
-    else
-    {
-      m_ZStream.avail_in = mZipItem.csize;
-      m_ZStream.next_in = (Bytef*)strInput.data()+iPos+LHDR_SIZE+mZipItem.flength+mZipItem.elength;
-      // init m_zipitem
-      strDest.reserve(mZipItem.usize);
-      temp = new char[mZipItem.usize+1];
-      toRead = mZipItem.usize;
-    }
-    int iCurrResult;
-    while( (iCurrResult=Read(temp,toRead)) > 0)
-    {
-      strDest.append(temp,temp+iCurrResult);
-      iResult += iCurrResult;
-    }
-    Close();
-    delete[] temp;
-    iPos += LHDR_SIZE+mZipItem.flength+mZipItem.elength+mZipItem.csize;
-    if (isGZ)
-      break;
-  }
-
-  return iResult;
-}
-
-
diff --git a/xbmc/filesystem/FileZip.h b/xbmc/filesystem/FileZip.h
deleted file mode 100644 (file)
index 30c4abf..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef FILE_ZIP_H_
-#define FILE_ZIP_H_
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-
-#include "IFile.h"
-#include <zlib.h>
-#include "utils/log.h"
-#include "File.h"
-#include "ZipManager.h"
-
-namespace XFILE
-{
-  class CFileZip : public IFile
-  {
-  public:
-    CFileZip();
-    virtual ~CFileZip();
-
-    virtual int64_t GetPosition();
-    virtual int64_t GetLength();
-    virtual bool Open(const CURL& url);
-    virtual bool Exists(const CURL& url);
-    virtual int Stat(struct __stat64* buffer);
-    virtual int Stat(const CURL& url, struct __stat64* buffer);
-    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
-    //virtual bool ReadString(char *szLine, int iLineLength);
-    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
-    virtual void Close();
-
-    int UnpackFromMemory(std::string& strDest, const std::string& strInput, bool isGZ=false);
-  private:
-    bool InitDecompress();
-    bool FillBuffer();
-    void DestroyBuffer(void* lpBuffer, int iBufSize);
-    CFile mFile;
-    SZipEntry mZipItem;
-    int64_t m_iFilePos; // position in _uncompressed_ data read
-    int64_t m_iZipFilePos; // position in _compressed_ data
-    int m_iAvailBuffer;
-    z_stream m_ZStream;
-    char m_szBuffer[65535];     // 64k buffer for compressed data
-    char* m_szStringBuffer;
-    char* m_szStartOfStringBuffer; // never allocated!
-    int m_iDataInStringBuffer;
-    int m_iRead;
-    bool m_bFlush;
-    bool m_bCached;
-  };
-}
-
-#endif
diff --git a/xbmc/filesystem/HDFile.cpp b/xbmc/filesystem/HDFile.cpp
new file mode 100644 (file)
index 0000000..e47980a
--- /dev/null
@@ -0,0 +1,331 @@
+/*
+ * XBMC Media Center
+ * Copyright (c) 2002 Frodo
+ * Portions Copyright (c) by the authors of ffmpeg and xvid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "system.h"
+#include "HDFile.h"
+#include "Util.h"
+#include "URL.h"
+#include "utils/AliasShortcutUtils.h"
+#ifdef _LINUX
+#include "XHandle.h"
+#endif
+
+#include <sys/stat.h>
+#ifdef _LINUX
+#include <sys/ioctl.h>
+#else
+#include <io.h>
+#include "utils/CharsetConverter.h"
+#include "utils/URIUtils.h"
+#endif
+#include "utils/log.h"
+
+
+using namespace XFILE;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//*********************************************************************************************
+CHDFile::CHDFile()
+    : m_hFile(INVALID_HANDLE_VALUE)
+{}
+
+//*********************************************************************************************
+CHDFile::~CHDFile()
+{
+  if (m_hFile != INVALID_HANDLE_VALUE) Close();
+}
+//*********************************************************************************************
+CStdString CHDFile::GetLocal(const CURL &url)
+{
+  CStdString path( url.GetFileName() );
+
+  if( url.GetProtocol().Equals("file", false) )
+  {
+    // file://drive[:]/path
+    // file:///drive:/path
+    CStdString host( url.GetHostName() );
+
+    if(host.size() > 0)
+    {
+      if(host.Right(1) == ":")
+        path = host + "/" + path;
+      else
+        path = host + ":/" + path;
+    }
+  }
+
+#ifndef _LINUX
+  path.Replace('/', '\\');
+#endif
+
+  if (IsAliasShortcut(path))
+    TranslateAliasShortcut(path);
+
+  return path;
+}
+
+//*********************************************************************************************
+bool CHDFile::Open(const CURL& url)
+{
+  CStdString strFile = GetLocal(url);
+
+#ifdef _WIN32
+  CStdStringW strWFile;
+  g_charsetConverter.utf8ToW(strFile, strWFile, false);
+  m_hFile.attach(CreateFileW(strWFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));
+#else
+  m_hFile.attach(CreateFile(strFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL));
+#endif
+  if (!m_hFile.isValid()) return false;
+
+  m_i64FilePos = 0;
+  m_i64FileLen = 0;
+
+  return true;
+}
+
+bool CHDFile::Exists(const CURL& url)
+{
+  struct __stat64 buffer;
+  CStdString strFile = GetLocal(url);
+
+#ifdef _WIN32
+  CStdStringW strWFile;
+  URIUtils::RemoveSlashAtEnd(strFile);
+  g_charsetConverter.utf8ToW(strFile, strWFile, false);
+  return (_wstat64(strWFile.c_str(), &buffer)==0);
+#else
+  return (_stat64(strFile.c_str(), &buffer)==0);
+#endif
+}
+
+int CHDFile::Stat(struct __stat64* buffer)
+{
+#ifdef _LINUX
+  return _fstat64((*m_hFile).fd, buffer);
+#else
+  // Duplicate the handle, as retrieving and closing a matching crt handle closes the crt handle AND the original Windows handle.
+  HANDLE hFileDup;
+  if (0 == DuplicateHandle(GetCurrentProcess(), (HANDLE)m_hFile, GetCurrentProcess(), &hFileDup, 0, FALSE, DUPLICATE_SAME_ACCESS))
+  {
+    CLog::Log(LOGERROR, __FUNCTION__" - DuplicateHandle()");
+    return -1;
+  }
+
+  int fd;
+  fd = _open_osfhandle((intptr_t)((HANDLE)hFileDup), 0);
+  if (fd == -1)
+  {
+    CLog::Log(LOGERROR, "Stat: fd == -1");
+    return -1;
+  }
+  int result = _fstat64(fd, buffer);
+  _close(fd);
+  return result;
+#endif
+}
+
+int CHDFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  CStdString strFile = GetLocal(url);
+
+#ifdef _WIN32
+  CStdStringW strWFile;
+  // win32 can only stat root drives with a slash at the end
+  if(strFile.length() == 2 && strFile[1] ==':')
+    URIUtils::AddSlashAtEnd(strFile);
+  /* _wstat64 calls FindFirstFileEx. According to MSDN, the path should not end in a trailing backslash.
+    Remove it before calling _wstat64 */
+  if (strFile.length() > 3 && URIUtils::HasSlashAtEnd(strFile))
+    URIUtils::RemoveSlashAtEnd(strFile);
+  g_charsetConverter.utf8ToW(strFile, strWFile, false);
+  return _wstat64(strWFile.c_str(), buffer);
+#else
+  return _stat64(strFile.c_str(), buffer);
+#endif
+}
+
+bool CHDFile::SetHidden(const CURL &url, bool hidden)
+{
+#ifdef _WIN32
+  CStdStringW path;
+  g_charsetConverter.utf8ToW(GetLocal(url), path, false);
+  DWORD attributes = hidden ? FILE_ATTRIBUTE_HIDDEN : FILE_ATTRIBUTE_NORMAL;
+  if (SetFileAttributesW(path.c_str(), attributes))
+    return true;
+#endif
+  return false;
+}
+
+//*********************************************************************************************
+bool CHDFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{
+  // make sure it's a legal FATX filename (we are writing to the harddisk)
+  CStdString strPath = GetLocal(url);
+
+#ifdef _WIN32
+  CStdStringW strWPath;
+  g_charsetConverter.utf8ToW(strPath, strWPath, false);
+  m_hFile.attach(CreateFileW(strWPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
+#else
+  m_hFile.attach(CreateFile(strPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, bOverWrite ? CREATE_ALWAYS : OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
+#endif
+  if (!m_hFile.isValid())
+    return false;
+
+  m_i64FilePos = 0;
+  Seek(0, SEEK_SET);
+
+  return true;
+}
+
+//*********************************************************************************************
+unsigned int CHDFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  if (!m_hFile.isValid()) return 0;
+  DWORD nBytesRead;
+  if ( ReadFile((HANDLE)m_hFile, lpBuf, (DWORD)uiBufSize, &nBytesRead, NULL) )
+  {
+    m_i64FilePos += nBytesRead;
+    return nBytesRead;
+  }
+  return 0;
+}
+
+//*********************************************************************************************
+int CHDFile::Write(const void *lpBuf, int64_t uiBufSize)
+{
+  if (!m_hFile.isValid())
+    return 0;
+
+  DWORD nBytesWriten;
+  if ( WriteFile((HANDLE)m_hFile, (void*) lpBuf, (DWORD)uiBufSize, &nBytesWriten, NULL) )
+    return nBytesWriten;
+
+  return 0;
+}
+
+//*********************************************************************************************
+void CHDFile::Close()
+{
+  m_hFile.reset();
+}
+
+//*********************************************************************************************
+int64_t CHDFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  LARGE_INTEGER lPos, lNewPos;
+  lPos.QuadPart = iFilePosition;
+  int bSuccess;
+
+  switch (iWhence)
+  {
+  case SEEK_SET:
+    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_BEGIN);
+    break;
+
+  case SEEK_CUR:
+    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_CURRENT);
+    break;
+
+  case SEEK_END:
+    bSuccess = SetFilePointerEx((HANDLE)m_hFile, lPos, &lNewPos, FILE_END);
+    break;
+
+  default:
+    return -1;
+  }
+  if (bSuccess)
+  {
+    m_i64FilePos = lNewPos.QuadPart;
+    return m_i64FilePos;
+  }
+  else
+    return -1;
+}
+
+//*********************************************************************************************
+int64_t CHDFile::GetLength()
+{
+  if(m_i64FileLen <= m_i64FilePos || m_i64FileLen == 0)
+  {
+    LARGE_INTEGER i64Size;
+    if(GetFileSizeEx((HANDLE)m_hFile, &i64Size))
+      m_i64FileLen = i64Size.QuadPart;
+    else
+      CLog::Log(LOGERROR, "CHDFile::GetLength - GetFileSizeEx failed with error %d", GetLastError());
+  }
+  return m_i64FileLen;
+}
+
+//*********************************************************************************************
+int64_t CHDFile::GetPosition()
+{
+  return m_i64FilePos;
+}
+
+bool CHDFile::Delete(const CURL& url)
+{
+  CStdString strFile=GetLocal(url);
+
+#ifdef _WIN32
+  CStdStringW strWFile;
+  g_charsetConverter.utf8ToW(strFile, strWFile, false);
+  return ::DeleteFileW(strWFile.c_str()) ? true : false;
+#else
+  return ::DeleteFile(strFile.c_str()) ? true : false;
+#endif
+}
+
+bool CHDFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  CStdString strFile=GetLocal(url);
+  CStdString strNewFile=GetLocal(urlnew);
+
+#ifdef _WIN32
+  CStdStringW strWFile;
+  CStdStringW strWNewFile;
+  g_charsetConverter.utf8ToW(strFile, strWFile, false);
+  g_charsetConverter.utf8ToW(strNewFile, strWNewFile, false);
+  return ::MoveFileW(strWFile.c_str(), strWNewFile.c_str()) ? true : false;
+#else
+  return ::MoveFile(strFile.c_str(), strNewFile.c_str()) ? true : false;
+#endif
+}
+
+void CHDFile::Flush()
+{
+  ::FlushFileBuffers(m_hFile);
+}
+
+int CHDFile::IoControl(EIoControl request, void* param)
+{
+#ifdef _LINUX
+  if(request == IOCTRL_NATIVE && param)
+  {
+    SNativeIoControl* s = (SNativeIoControl*)param;
+    return ioctl((*m_hFile).fd, s->request, s->param);
+  }
+#endif
+  return -1;
+}
diff --git a/xbmc/filesystem/HDFile.h b/xbmc/filesystem/HDFile.h
new file mode 100644 (file)
index 0000000..ababf9e
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * XBMC Media Center
+ * Copyright (c) 2002 Frodo
+ * Portions Copyright (c) by the authors of ffmpeg and xvid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+// FileHD.h: interface for the CHDFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
+#define AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "IFile.h"
+#include "utils/AutoPtrHandle.h"
+
+namespace XFILE
+{
+class CHDFile : public IFile
+{
+public:
+  CHDFile();
+  virtual ~CHDFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual int Stat(struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int Write(const void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual void Flush();
+
+  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+
+  virtual bool Delete(const CURL& url);
+  virtual bool Rename(const CURL& url, const CURL& urlnew);
+  virtual bool SetHidden(const CURL& url, bool hidden);
+
+  virtual int IoControl(EIoControl request, void* param);
+protected:
+  CStdString GetLocal(const CURL &url); /* crate a properly format path from an url */
+  AUTOPTR::CAutoPtrHandle m_hFile;
+  int64_t m_i64FilePos;
+  int64_t m_i64FileLen;
+};
+
+}
+#endif // !defined(AFX_FILEHD_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
diff --git a/xbmc/filesystem/HDHomeRun.cpp b/xbmc/filesystem/HDHomeRun.cpp
deleted file mode 100644 (file)
index ea141d2..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "threads/SystemClock.h"
-#include "system.h"
-#include "URL.h"
-#include "FileItem.h"
-#include "DllHDHomeRun.h"
-#include "HDHomeRun.h"
-#include "utils/TimeUtils.h"
-#include "utils/log.h"
-#include "utils/URIUtils.h"
-#include "Util.h"
-
-using namespace XFILE;
-using namespace std;
-
-class CUrlOptions
-  : public map<CStdString, CStdString>
-{
-public:
-  CUrlOptions(const CStdString& data)
-  {
-    vector<CStdString> options;
-    CUtil::Tokenize(data, options, "&");
-    for(vector<CStdString>::iterator it = options.begin();it != options.end(); it++)
-    {
-      CStdString name, value;
-      unsigned int pos = it->find_first_of('=');
-      if(pos != CStdString::npos)
-      {
-        name = it->substr(0, pos);
-        value = it->substr(pos+1);
-      }
-      else
-      {
-        name = *it;
-        value = "";
-      }
-
-      CURL::Decode(name);
-      CURL::Decode(value);
-      insert(value_type(name, value));
-    }
-  }
-};
-
-
-// -------------------------------------------
-// ---------------- Directory ----------------
-// -------------------------------------------
-
-CDirectoryHomeRun::CDirectoryHomeRun()
-{
-  m_pdll = new DllHdHomeRun;
-  m_pdll->Load();
-}
-
-CDirectoryHomeRun::~CDirectoryHomeRun()
-{
-  m_pdll->Unload();
-  delete m_pdll;
-}
-
-bool CDirectoryHomeRun::GetDirectory(const CStdString& strPath, CFileItemList &items)
-{
-  if(!m_pdll->IsLoaded())
-    return false;
-
-  CURL url(strPath);
-
-  if(url.GetHostName().IsEmpty())
-  {
-    // no hostname, list all available devices
-    int target_ip = 0;
-    struct hdhomerun_discover_device_t result_list[64];
-    int count = m_pdll->discover_find_devices_custom(target_ip, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, result_list, 64);
-    if (count < 0)
-      return false;
-
-    for(int i=0;i<count;i++)
-    {
-      CStdString device, ip;
-      CFileItemPtr item;
-      unsigned int ip_addr = result_list[i].ip_addr;
-
-      device.Format("%x", result_list[i].device_id);
-      ip.Format("%u.%u.%u.%u",
-            (unsigned int)(ip_addr >> 24) & 0xFF, (unsigned int)(ip_addr >> 16) & 0xFF,
-            (unsigned int)(ip_addr >> 8) & 0xFF, (unsigned int)(ip_addr >> 0) & 0xFF);
-
-      item.reset(new CFileItem("hdhomerun://" + device + "/tuner0/", true));
-      item->SetLabel(device + "-0 On " + ip);
-      item->SetLabelPreformated(true);
-      items.Add(item);
-
-      item.reset(new CFileItem("hdhomerun://" + device + "/tuner1/", true));
-      item->SetLabel(device + "-1 On " + ip);
-      item->SetLabelPreformated(true);
-      items.Add(item);
-    }
-    return true;
-  }
-  else
-  {
-    hdhomerun_device_t* device = m_pdll->device_create_from_str(url.GetHostName().c_str(), NULL);
-    if(!device)
-      return false;
-
-    m_pdll->device_set_tuner_from_str(device, url.GetFileName().c_str());
-
-    hdhomerun_tuner_status_t status;
-    if(!m_pdll->device_get_tuner_status(device, NULL, &status))
-    {
-      m_pdll->device_destroy(device);
-      return true;
-    }
-
-    CStdString label;
-    if(status.signal_present)
-      label.Format("Current Stream: N/A");
-    else
-      label.Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
-
-    CStdString path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName();
-    URIUtils::RemoveSlashAtEnd(path);
-    CFileItemPtr item(new CFileItem(path, false));
-    item->SetLabel(label);
-    item->SetLabelPreformated(true);
-    items.Add(item);
-
-    m_pdll->device_destroy(device);
-    return true;
-  }
-
-  return false;
-}
-
-
-// -------------------------------------------
-// ------------------ File -------------------
-// -------------------------------------------
-CFileHomeRun::CFileHomeRun()
-{
-  m_device = NULL;
-  m_pdll = new DllHdHomeRun;
-  m_pdll->Load();
-}
-
-CFileHomeRun::~CFileHomeRun()
-{
-  Close();
-  delete m_pdll;
-}
-
-bool CFileHomeRun::Exists(const CURL& url)
-{
-  CStdString path(url.GetFileName());
-
-  /*
-   * HDHomeRun URLs are of the form hdhomerun://1014F6D1/tuner0?channel=qam:108&program=10
-   * The filename starts with "tuner" and has no extension. This check will cover off requests
-   * for *.tbn, *.jpg, *.jpeg, *.edl etc. that do not exist.
-   */
-  if(path.Left(5) == "tuner"
-  && URIUtils::GetExtension(path).IsEmpty())
-    return true;
-
-  return false;
-}
-
-int64_t CFileHomeRun::Seek(int64_t iFilePosition, int iWhence)
-{
-  return -1;
-}
-
-int CFileHomeRun::Stat(const CURL& url, struct __stat64* buffer)
-{
-  memset(buffer, 0, sizeof(struct __stat64));
-  return 0;
-}
-
-int64_t CFileHomeRun::GetPosition()
-{
-  return 0;
-}
-
-int64_t CFileHomeRun::GetLength()
-{
-  return 0;
-}
-
-bool CFileHomeRun::Open(const CURL &url)
-{
-  if(!m_pdll->IsLoaded())
-    return false;
-
-  m_device = m_pdll->device_create_from_str(url.GetHostName().c_str(), NULL);
-  if(!m_device)
-    return false;
-
-  m_pdll->device_set_tuner_from_str(m_device, url.GetFileName().c_str());
-
-  CUrlOptions options(url.GetOptions().Mid(1));
-  CUrlOptions::iterator it;
-
-  if( (it = options.find("channel")) != options.end() )
-    m_pdll->device_set_tuner_channel(m_device, it->second.c_str());
-
-  if( (it = options.find("program")) != options.end() )
-    m_pdll->device_set_tuner_program(m_device, it->second.c_str());
-
-  // start streaming from selected device and tuner
-  if( m_pdll->device_stream_start(m_device) <= 0 )
-    return false;
-
-  return true;
-}
-
-unsigned int CFileHomeRun::Read(void* lpBuf, int64_t uiBufSize)
-{
-  size_t datasize;
-
-  if(uiBufSize < VIDEO_DATA_PACKET_SIZE)
-    CLog::Log(LOGWARNING, "CFileHomeRun::Read - buffer size too small, will most likely fail");
-
-  // for now, let it it time out after 5 seconds,
-  // neither of the players can be forced to
-  // continue even if read return 0 as can happen
-  // on live streams.
-  XbmcThreads::EndTime timestamp(5000);
-  while(1)
-  {
-    datasize = (size_t) uiBufSize;
-    uint8_t* ptr = m_pdll->device_stream_recv(m_device, datasize, &datasize);
-    if(ptr)
-    {
-      memcpy(lpBuf, ptr, datasize);
-      return (unsigned int)datasize;
-    }
-
-    if(timestamp.IsTimePast())
-      return 0;
-
-    Sleep(64);
-  }
-  return (unsigned int)datasize;
-}
-
-void CFileHomeRun::Close()
-{
-  if(m_device)
-  {
-    m_pdll->device_stream_stop(m_device);
-    m_pdll->device_destroy(m_device);
-    m_device = NULL;
-  }
-}
-
-int CFileHomeRun::GetChunkSize()
-{
-  return VIDEO_DATA_PACKET_SIZE;
-}
diff --git a/xbmc/filesystem/HDHomeRun.h b/xbmc/filesystem/HDHomeRun.h
deleted file mode 100644 (file)
index e3e3a51..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2008 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IDirectory.h"
-#include "IFile.h"
-
-struct hdhomerun_device;
-class DllHdHomeRun;
-
-namespace XFILE
-{
-  class CDirectoryHomeRun : public IDirectory
-  {
-    public:
-      CDirectoryHomeRun(void);
-      virtual ~CDirectoryHomeRun(void);
-      virtual bool IsAllowed(const CStdString &strFile) const { return true; };
-      virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
-    private:
-      DllHdHomeRun* m_pdll;
-  };
-}
-
-namespace XFILE
-{
-  class CFileHomeRun : public IFile
-  {
-    public:
-      CFileHomeRun();
-      ~CFileHomeRun();
-
-      virtual bool          Exists(const CURL& url);
-      virtual int64_t       Seek(int64_t iFilePosition, int iWhence);
-      virtual int           Stat(const CURL& url, struct __stat64* buffer);
-      virtual int64_t       GetPosition();
-      virtual int64_t       GetLength();
-
-      virtual bool          Open(const CURL& url);
-      virtual void          Close();
-      virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
-      virtual int           GetChunkSize();
-    private:
-      struct hdhomerun_device_t* m_device;
-      DllHdHomeRun* m_pdll;
-  };
-}
diff --git a/xbmc/filesystem/HDHomeRunDirectory.cpp b/xbmc/filesystem/HDHomeRunDirectory.cpp
new file mode 100644 (file)
index 0000000..b3864d1
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+#include "DllHDHomeRun.h"
+#include "HDHomeRunDirectory.h"
+#include "URL.h"
+#include "FileItem.h"
+#include "utils/URIUtils.h"
+
+using namespace XFILE;
+using namespace std;
+
+// -------------------------------------------
+// ---------------- Directory ----------------
+// -------------------------------------------
+
+CHomeRunDirectory::CHomeRunDirectory()
+{
+  m_pdll = new DllHdHomeRun;
+  m_pdll->Load();
+}
+
+CHomeRunDirectory::~CHomeRunDirectory()
+{
+  m_pdll->Unload();
+  delete m_pdll;
+}
+
+bool CHomeRunDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
+{
+  if(!m_pdll->IsLoaded())
+    return false;
+
+  CURL url(strPath);
+
+  if(url.GetHostName().IsEmpty())
+  {
+    // no hostname, list all available devices
+    int target_ip = 0;
+    struct hdhomerun_discover_device_t result_list[64];
+    int count = m_pdll->discover_find_devices_custom(target_ip, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, result_list, 64);
+    if (count < 0)
+      return false;
+
+    for(int i=0;i<count;i++)
+    {
+      CStdString device, ip;
+      CFileItemPtr item;
+      unsigned int ip_addr = result_list[i].ip_addr;
+
+      device.Format("%x", result_list[i].device_id);
+      ip.Format("%u.%u.%u.%u",
+            (unsigned int)(ip_addr >> 24) & 0xFF, (unsigned int)(ip_addr >> 16) & 0xFF,
+            (unsigned int)(ip_addr >> 8) & 0xFF, (unsigned int)(ip_addr >> 0) & 0xFF);
+
+      item.reset(new CFileItem("hdhomerun://" + device + "/tuner0/", true));
+      item->SetLabel(device + "-0 On " + ip);
+      item->SetLabelPreformated(true);
+      items.Add(item);
+
+      item.reset(new CFileItem("hdhomerun://" + device + "/tuner1/", true));
+      item->SetLabel(device + "-1 On " + ip);
+      item->SetLabelPreformated(true);
+      items.Add(item);
+    }
+    return true;
+  }
+  else
+  {
+    hdhomerun_device_t* device = m_pdll->device_create_from_str(url.GetHostName().c_str(), NULL);
+    if(!device)
+      return false;
+
+    m_pdll->device_set_tuner_from_str(device, url.GetFileName().c_str());
+
+    hdhomerun_tuner_status_t status;
+    if(!m_pdll->device_get_tuner_status(device, NULL, &status))
+    {
+      m_pdll->device_destroy(device);
+      return true;
+    }
+
+    CStdString label;
+    if(status.signal_present)
+      label.Format("Current Stream: N/A");
+    else
+      label.Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
+
+    CStdString path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName();
+    URIUtils::RemoveSlashAtEnd(path);
+    CFileItemPtr item(new CFileItem(path, false));
+    item->SetLabel(label);
+    item->SetLabelPreformated(true);
+    items.Add(item);
+
+    m_pdll->device_destroy(device);
+    return true;
+  }
+
+  return false;
+}
diff --git a/xbmc/filesystem/HDHomeRunDirectory.h b/xbmc/filesystem/HDHomeRunDirectory.h
new file mode 100644 (file)
index 0000000..44ff76b
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+ #include "IDirectory.h"
+
+class DllHdHomeRun;
+namespace XFILE
+{
+  class CHomeRunDirectory : public IDirectory
+  {
+    public:
+      CHomeRunDirectory(void);
+      virtual ~CHomeRunDirectory(void);
+      virtual bool IsAllowed(const CStdString &strFile) const { return true; };
+      virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
+    private:
+      DllHdHomeRun* m_pdll;
+  };
+}
diff --git a/xbmc/filesystem/HDHomeRunFile.cpp b/xbmc/filesystem/HDHomeRunFile.cpp
new file mode 100644 (file)
index 0000000..5ab518d
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "threads/SystemClock.h"
+#include "system.h"
+#include "URL.h"
+#include "FileItem.h"
+#include "DllHDHomeRun.h"
+#include "HDHomeRunFile.h"
+#include "utils/TimeUtils.h"
+#include "utils/log.h"
+#include "utils/URIUtils.h"
+#include "Util.h"
+
+using namespace XFILE;
+using namespace std;
+
+class CUrlOptions
+  : public map<CStdString, CStdString>
+{
+public:
+  CUrlOptions(const CStdString& data)
+  {
+    vector<CStdString> options;
+    CUtil::Tokenize(data, options, "&");
+    for(vector<CStdString>::iterator it = options.begin();it != options.end(); it++)
+    {
+      CStdString name, value;
+      unsigned int pos = it->find_first_of('=');
+      if(pos != CStdString::npos)
+      {
+        name = it->substr(0, pos);
+        value = it->substr(pos+1);
+      }
+      else
+      {
+        name = *it;
+        value = "";
+      }
+
+      CURL::Decode(name);
+      CURL::Decode(value);
+      insert(value_type(name, value));
+    }
+  }
+};
+
+// -------------------------------------------
+// ------------------ File -------------------
+// -------------------------------------------
+CHomeRunFile::CHomeRunFile()
+{
+  m_device = NULL;
+  m_pdll = new DllHdHomeRun;
+  m_pdll->Load();
+}
+
+CHomeRunFile::~CHomeRunFile()
+{
+  Close();
+  delete m_pdll;
+}
+
+bool CHomeRunFile::Exists(const CURL& url)
+{
+  CStdString path(url.GetFileName());
+
+  /*
+   * HDHomeRun URLs are of the form hdhomerun://1014F6D1/tuner0?channel=qam:108&program=10
+   * The filename starts with "tuner" and has no extension. This check will cover off requests
+   * for *.tbn, *.jpg, *.jpeg, *.edl etc. that do not exist.
+   */
+  if(path.Left(5) == "tuner"
+  && URIUtils::GetExtension(path).IsEmpty())
+    return true;
+
+  return false;
+}
+
+int64_t CHomeRunFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  return -1;
+}
+
+int CHomeRunFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  memset(buffer, 0, sizeof(struct __stat64));
+  return 0;
+}
+
+int64_t CHomeRunFile::GetPosition()
+{
+  return 0;
+}
+
+int64_t CHomeRunFile::GetLength()
+{
+  return 0;
+}
+
+bool CHomeRunFile::Open(const CURL &url)
+{
+  if(!m_pdll->IsLoaded())
+    return false;
+
+  m_device = m_pdll->device_create_from_str(url.GetHostName().c_str(), NULL);
+  if(!m_device)
+    return false;
+
+  m_pdll->device_set_tuner_from_str(m_device, url.GetFileName().c_str());
+
+  CUrlOptions options(url.GetOptions().Mid(1));
+  CUrlOptions::iterator it;
+
+  if( (it = options.find("channel")) != options.end() )
+    m_pdll->device_set_tuner_channel(m_device, it->second.c_str());
+
+  if( (it = options.find("program")) != options.end() )
+    m_pdll->device_set_tuner_program(m_device, it->second.c_str());
+
+  // start streaming from selected device and tuner
+  if( m_pdll->device_stream_start(m_device) <= 0 )
+    return false;
+
+  return true;
+}
+
+unsigned int CHomeRunFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  size_t datasize;
+
+  if(uiBufSize < VIDEO_DATA_PACKET_SIZE)
+    CLog::Log(LOGWARNING, "CHomeRunFile::Read - buffer size too small, will most likely fail");
+
+  // for now, let it it time out after 5 seconds,
+  // neither of the players can be forced to
+  // continue even if read return 0 as can happen
+  // on live streams.
+  XbmcThreads::EndTime timestamp(5000);
+  while(1)
+  {
+    datasize = (size_t) uiBufSize;
+    uint8_t* ptr = m_pdll->device_stream_recv(m_device, datasize, &datasize);
+    if(ptr)
+    {
+      memcpy(lpBuf, ptr, datasize);
+      return (unsigned int)datasize;
+    }
+
+    if(timestamp.IsTimePast())
+      return 0;
+
+    Sleep(64);
+  }
+  return (unsigned int)datasize;
+}
+
+void CHomeRunFile::Close()
+{
+  if(m_device)
+  {
+    m_pdll->device_stream_stop(m_device);
+    m_pdll->device_destroy(m_device);
+    m_device = NULL;
+  }
+}
+
+int CHomeRunFile::GetChunkSize()
+{
+  return VIDEO_DATA_PACKET_SIZE;
+}
diff --git a/xbmc/filesystem/HDHomeRunFile.h b/xbmc/filesystem/HDHomeRunFile.h
new file mode 100644 (file)
index 0000000..abb1688
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+
+struct hdhomerun_device;
+class DllHdHomeRun;
+
+namespace XFILE
+{
+  class CHomeRunFile : public IFile
+  {
+    public:
+      CHomeRunFile();
+      ~CHomeRunFile();
+
+      virtual bool          Exists(const CURL& url);
+      virtual int64_t       Seek(int64_t iFilePosition, int iWhence);
+      virtual int           Stat(const CURL& url, struct __stat64* buffer);
+      virtual int64_t       GetPosition();
+      virtual int64_t       GetLength();
+
+      virtual bool          Open(const CURL& url);
+      virtual void          Close();
+      virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
+      virtual int           GetChunkSize();
+    private:
+      struct hdhomerun_device_t* m_device;
+      DllHdHomeRun* m_pdll;
+  };
+}
index 6b703a4..9a209bd 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "HTTPDirectory.h"
 #include "URL.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "FileItem.h"
 #include "utils/RegExp.h"
 #include "settings/AdvancedSettings.h"
diff --git a/xbmc/filesystem/ISOFile.cpp b/xbmc/filesystem/ISOFile.cpp
new file mode 100644 (file)
index 0000000..9baa95d
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+* XBMC Media Center
+* Copyright (c) 2002 Frodo
+* Portions Copyright (c) by the authors of ffmpeg and xvid
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "ISOFile.h"
+#include "URL.h"
+#include "iso9660.h"
+
+#include <sys/stat.h>
+
+using namespace std;
+using namespace XFILE;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+//*********************************************************************************************
+CISOFile::CISOFile()
+{
+  m_bOpened = false;
+}
+
+//*********************************************************************************************
+CISOFile::~CISOFile()
+{
+  if (m_bOpened)
+  {
+    Close();
+  }
+}
+//*********************************************************************************************
+bool CISOFile::Open(const CURL& url)
+{
+  string strFName = "\\";
+  strFName += url.GetFileName();
+  for (int i = 0; i < (int)strFName.size(); ++i )
+  {
+    if (strFName[i] == '/') strFName[i] = '\\';
+  }
+  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
+  if (m_hFile == INVALID_HANDLE_VALUE)
+  {
+    m_bOpened = false;
+    return false;
+  }
+
+  m_bOpened = true;
+  return true;
+}
+
+//*********************************************************************************************
+unsigned int CISOFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  if (!m_bOpened) return 0;
+  char *pData = (char *)lpBuf;
+
+  if (m_cache.getSize() > 0)
+  {
+    long lTotalBytesRead = 0;
+    while (uiBufSize > 0)
+    {
+      if (m_cache.getMaxReadSize() )
+      {
+        long lBytes2Read = m_cache.getMaxReadSize();
+        if (lBytes2Read > uiBufSize) lBytes2Read = (long)uiBufSize;
+        m_cache.ReadData(pData, lBytes2Read );
+        uiBufSize -= lBytes2Read ;
+        pData += lBytes2Read;
+        lTotalBytesRead += lBytes2Read ;
+      }
+
+      if (m_cache.getMaxWriteSize() > 5000)
+      {
+        byte buffer[5000];
+        long lBytesRead = m_isoReader.ReadFile( m_hFile, buffer, sizeof(buffer));
+        if (lBytesRead > 0)
+          m_cache.WriteData((char*)buffer, lBytesRead);
+        else
+          return 0;
+      }
+    }
+    return lTotalBytesRead;
+  }
+  int iResult = m_isoReader.ReadFile( m_hFile, (byte*)pData, (long)uiBufSize);
+  if (iResult == -1)
+    return 0;
+  return iResult;
+}
+
+//*********************************************************************************************
+void CISOFile::Close()
+{
+  if (!m_bOpened) return ;
+  m_isoReader.CloseFile( m_hFile);
+}
+
+//*********************************************************************************************
+int64_t CISOFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  if (!m_bOpened) return -1;
+  int64_t lNewPos = m_isoReader.Seek(m_hFile, iFilePosition, iWhence);
+  if(lNewPos >= 0)
+    m_cache.Clear();
+  return lNewPos;
+}
+
+//*********************************************************************************************
+int64_t CISOFile::GetLength()
+{
+  if (!m_bOpened) return -1;
+  return m_isoReader.GetFileSize(m_hFile);
+}
+
+//*********************************************************************************************
+int64_t CISOFile::GetPosition()
+{
+  if (!m_bOpened) return -1;
+  return m_isoReader.GetFilePosition(m_hFile);
+}
+
+bool CISOFile::Exists(const CURL& url)
+{
+  string strFName = "\\";
+  strFName += url.GetFileName();
+  for (int i = 0; i < (int)strFName.size(); ++i )
+  {
+    if (strFName[i] == '/') strFName[i] = '\\';
+  }
+  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
+  if (m_hFile == INVALID_HANDLE_VALUE)
+    return false;
+
+  m_isoReader.CloseFile(m_hFile);
+  return true;
+}
+
+int CISOFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  string strFName = "\\";
+  strFName += url.GetFileName();
+  for (int i = 0; i < (int)strFName.size(); ++i )
+  {
+    if (strFName[i] == '/') strFName[i] = '\\';
+  }
+  m_hFile = m_isoReader.OpenFile((char*)strFName.c_str());
+  if (m_hFile != INVALID_HANDLE_VALUE)
+  {
+    memset(buffer, 0, sizeof(struct __stat64));
+    buffer->st_size = m_isoReader.GetFileSize(m_hFile);
+    buffer->st_mode = _S_IFREG;
+    m_isoReader.CloseFile(m_hFile);
+    return 0;
+  }
+  errno = ENOENT;
+  return -1;
+}
diff --git a/xbmc/filesystem/ISOFile.h b/xbmc/filesystem/ISOFile.h
new file mode 100644 (file)
index 0000000..6e87dff
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+* XBMC Media Center
+* Copyright (c) 2002 Frodo
+* Portions Copyright (c) by the authors of ffmpeg and xvid
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+// FileISO.h: interface for the CISOFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_)
+#define AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "IFile.h"
+#include "utils/RingBuffer.h"
+
+namespace XFILE
+{
+
+class CISOFile : public IFile
+{
+public:
+  CISOFile();
+  virtual ~CISOFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+protected:
+  bool m_bOpened;
+  HANDLE m_hFile;
+  CRingBuffer m_cache;
+};
+}
+
+#endif // !defined(AFX_FILEISO_H__C2FB9C6D_3319_4182_AB45_65E57EFAC8D1__INCLUDED_)
index af5621c..983d6df 100644 (file)
  */
 
 #include "LastFMDirectory.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "music/tags/MusicInfoTag.h"
 #include "URL.h"
 #include "guilib/GUIWindowManager.h"
 #include "dialogs/GUIDialogProgress.h"
 #include "settings/GUISettings.h"
 #include "FileItem.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "utils/StringUtils.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
index e50178d..fc9eab6 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include "IDirectory.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "tinyXML/tinyxml.h"
 #include "threads/Thread.h"
 
diff --git a/xbmc/filesystem/LastFMFile.cpp b/xbmc/filesystem/LastFMFile.cpp
new file mode 100644 (file)
index 0000000..1586e26
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "LastFMFile.h"
+
+namespace XFILE
+{
+
+CLastFMFile::CLastFMFile() : CCurlFile()
+{
+  SetUserAgent("");
+  SetBufferSize(8192);
+}
+
+CLastFMFile::~CLastFMFile()
+{
+}
+
+}
+
diff --git a/xbmc/filesystem/LastFMFile.h b/xbmc/filesystem/LastFMFile.h
new file mode 100644 (file)
index 0000000..7746799
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "CurlFile.h"
+#include "utils/RingBuffer.h"
+
+namespace XFILE
+{
+
+  class CLastFMFile : public CCurlFile
+  {
+  public:
+    CLastFMFile();
+    virtual ~CLastFMFile();
+  protected:
+  };
+
+}
index 467df2b..7a50054 100644 (file)
@@ -4,43 +4,30 @@ CXXFLAGS+=-D__STDC_FORMAT_MACROS \
 
 SRCS=AddonsDirectory.cpp \
      ASAPFileDirectory.cpp \
-     CacheCircular.cpp \
-     CacheMemBuffer.cpp \
      CacheStrategy.cpp \
+     CircularCache.cpp \
      CDDADirectory.cpp \
+     CDDAFile.cpp \
+     CurlFile.cpp \
      DAAPDirectory.cpp \
+     DAAPFile.cpp \
      DAVDirectory.cpp \
-     DirectoryCache.cpp \
      Directory.cpp \
+     DirectoryCache.cpp \
+     DirectoryFactory.cpp \
      DirectoryHistory.cpp \
-     DirectoryTuxBox.cpp \
      DllLibCurl.cpp \
-     FactoryDirectory.cpp \
-     FactoryFileDirectory.cpp \
-     FileCache.cpp \
-     FileCDDA.cpp \
      File.cpp \
-     FileCurl.cpp \
-     FileDAAP.cpp \
+     FileCache.cpp \
+     FileDirectoryFactory.cpp \
      FileFactory.cpp \
-     FileFileReader.cpp \
-     FileHD.cpp \
-     FileISO.cpp \
-     FileLastFM.cpp \
-     FileMusicDatabase.cpp \
-     FilePipe.cpp \
-     FileRTV.cpp \
-     FileShoutcast.cpp \
-     FileSFTP.cpp \
-     FileSpecialProtocol.cpp \
-     FileTuxBox.cpp \
-     FileUDF.cpp \
-     FileUPnP.cpp \
-     FileZip.cpp \
+     FileReaderFile.cpp \
      FTPDirectory.cpp \
      FTPParse.cpp \
      HDDirectory.cpp \
-     HDHomeRun.cpp \
+     HDFile.cpp \
+     HDHomeRunDirectory.cpp \
+     HDHomeRunFile.cpp \
      HTSPDirectory.cpp \
      HTSPSession.cpp \
      HTTPDirectory.cpp \
@@ -48,10 +35,14 @@ SRCS=AddonsDirectory.cpp \
      IFile.cpp \
      iso9660.cpp \
      ISO9660Directory.cpp \
+     ISOFile.cpp \
      LastFMDirectory.cpp \
+     LastFMFile.cpp \
+     MemBufferCache.cpp \
      MultiPathDirectory.cpp \
      MultiPathFile.cpp \
      MusicDatabaseDirectory.cpp \
+     MusicDatabaseFile.cpp \
      MusicFileDirectory.cpp \
      MusicSearchDirectory.cpp \
      MythDirectory.cpp \
@@ -62,23 +53,33 @@ SRCS=AddonsDirectory.cpp \
      OGGFileDirectory.cpp \
      PlaylistDirectory.cpp \
      PlaylistFileDirectory.cpp \
+     PipeFile.cpp \
      PipesManager.cpp \
      PluginDirectory.cpp \
      RSSDirectory.cpp \
      RTVDirectory.cpp \
+     RTVFile.cpp \
      SAPDirectory.cpp \
      SAPFile.cpp \
      SFTPDirectory.cpp \
+     SFTPFile.cpp \
      SIDFileDirectory.cpp \
-     Slingbox.cpp \
+     ShoutcastFile.cpp \
+     SlingboxDirectory.cpp \
+     SlingboxFile.cpp \
      SmartPlaylistDirectory.cpp \
      SourcesDirectory.cpp \
      SpecialProtocol.cpp \
      SpecialProtocolDirectory.cpp \
+     SpecialProtocolFile.cpp \
      StackDirectory.cpp \
+     TuxBoxDirectory.cpp \
+     TuxBoxFile.cpp \
      udf25.cpp \
      UDFDirectory.cpp \
+     UDFFile.cpp \
      UPnPDirectory.cpp \
+     UPnPFile.cpp \
      VideoDatabaseDirectory.cpp \
      VirtualDirectory.cpp \
      VTPDirectory.cpp \
@@ -86,26 +87,27 @@ SRCS=AddonsDirectory.cpp \
      VTPSession.cpp \
      ZeroconfDirectory.cpp \
      ZipDirectory.cpp \
+     ZipFile.cpp \
      ZipManager.cpp
 
 ifeq (@HAVE_XBMC_NONFREE@,1)
-SRCS+=FileRar.cpp
+SRCS+=RarFile.cpp
 SRCS+=RarDirectory.cpp
 SRCS+=RarManager.cpp
 endif
 
 ifeq (@USE_LIBSMBCLIENT@,1)
-SRCS+=FileSmb.cpp
+SRCS+=SmbFile.cpp
 SRCS+=SMBDirectory.cpp
 endif
 
 ifeq (@USE_LIBNFS@,1)
-SRCS+=FileNFS.cpp
+SRCS+=NFSFile.cpp
 SRCS+=NFSDirectory.cpp
 endif
 
 ifeq (@USE_LIBAFPCLIENT@,1)
-SRCS+=FileAFP.cpp
+SRCS+=AFPFile.cpp
 SRCS+=AFPDirectory.cpp
 endif
 
diff --git a/xbmc/filesystem/MemBufferCache.cpp b/xbmc/filesystem/MemBufferCache.cpp
new file mode 100644 (file)
index 0000000..65bd005
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifdef _LINUX
+#include "threads/SystemClock.h"
+#include "linux/PlatformDefs.h"
+#endif
+#include "settings/AdvancedSettings.h"
+#include "CacheMemBuffer.h"
+#include "utils/log.h"
+#include "threads/SingleLock.h"
+#include "utils/TimeUtils.h"
+
+#include <math.h>
+
+using namespace XFILE;
+
+#define SEEK_CHECK_RET(x) if (!(x)) return -1;
+
+CacheMemBuffer::CacheMemBuffer()
+ : CCacheStrategy()
+{
+  m_nStartPosition = 0;
+  m_buffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
+  m_HistoryBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
+  m_forwardBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
+}
+
+
+CacheMemBuffer::~CacheMemBuffer()
+{
+  m_buffer.Destroy();
+  m_HistoryBuffer.Destroy();
+  m_forwardBuffer.Destroy();
+}
+
+int CacheMemBuffer::Open()
+{
+  m_nStartPosition = 0;
+  m_buffer.Clear();
+  m_HistoryBuffer.Clear();
+  m_forwardBuffer.Clear();
+  return CACHE_RC_OK;
+}
+
+void CacheMemBuffer::Close()
+{
+  m_buffer.Clear();
+  m_HistoryBuffer.Clear();
+  m_forwardBuffer.Clear();
+}
+
+int CacheMemBuffer::WriteToCache(const char *pBuffer, size_t iSize)
+{
+  CSingleLock lock(m_sync);
+  unsigned int nToWrite = m_buffer.getMaxWriteSize() ;
+
+  // must also check the forward buffer.
+  // if we have leftovers from the previous seek - we need not read anymore until they are utilized
+  if (nToWrite == 0 || m_forwardBuffer.getMaxReadSize() > 0)
+    return 0;
+
+  if (nToWrite > iSize)
+    nToWrite = iSize;
+
+  if (!m_buffer.WriteData((char*)pBuffer, nToWrite))
+  {
+    CLog::Log(LOGWARNING,"%s, failed to write %d bytes to buffer. max buffer size: %d", __FUNCTION__, nToWrite, m_buffer.getMaxWriteSize());
+    nToWrite = 0;
+  }
+
+  m_written.Set();
+
+  return nToWrite;
+}
+
+int CacheMemBuffer::ReadFromCache(char *pBuffer, size_t iMaxSize)
+{
+  CSingleLock lock(m_sync);
+  if ( m_buffer.getMaxReadSize() == 0 ) {
+    return m_bEndOfInput ? 0 : CACHE_RC_WOULD_BLOCK;
+  }
+
+  int nRead = iMaxSize;
+  if ((size_t) m_buffer.getMaxReadSize() < iMaxSize)
+    nRead = m_buffer.getMaxReadSize();
+
+  if (nRead > 0)
+  {
+    if (!m_buffer.ReadData(pBuffer, nRead))
+    {
+      CLog::Log(LOGWARNING, "%s, failed to read %d bytes from buffer. max read size: %d", __FUNCTION__, nRead, m_buffer.getMaxReadSize());
+      return 0;
+    }
+
+    // copy to history so we can seek back
+    if ((int) m_HistoryBuffer.getMaxWriteSize() < nRead)
+      m_HistoryBuffer.SkipBytes(nRead);
+    m_HistoryBuffer.WriteData(pBuffer, nRead);
+
+    m_nStartPosition += nRead;
+  }
+
+  // check forward buffer and copy it when enough space is available
+  if (m_forwardBuffer.getMaxReadSize() > 0 && m_buffer.getMaxWriteSize() >= m_forwardBuffer.getMaxReadSize())
+  {
+    m_buffer.Append(m_forwardBuffer);
+    m_forwardBuffer.Clear();
+  }
+
+  if (nRead > 0)
+    m_space.Set();
+
+  return nRead;
+}
+
+int64_t CacheMemBuffer::WaitForData(unsigned int iMinAvail, unsigned int millis)
+{
+  if (millis == 0 || IsEndOfInput())
+    return m_buffer.getMaxReadSize();
+
+  XbmcThreads::EndTime endTime(millis);
+  while (!IsEndOfInput() && (unsigned int) m_buffer.getMaxReadSize() < iMinAvail && !endTime.IsTimePast() )
+    m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
+
+  return m_buffer.getMaxReadSize();
+}
+
+int64_t CacheMemBuffer::Seek(int64_t iFilePosition)
+{
+  CSingleLock lock(m_sync);
+
+  // if seek is a bit over what we have, try to wait a few seconds for the data to be available.
+  // we try to avoid a (heavy) seek on the source
+  if (iFilePosition > m_nStartPosition + m_buffer.getMaxReadSize() &&
+      iFilePosition < m_nStartPosition + m_buffer.getMaxReadSize() + 100000)
+  {
+    int nRequired = (int)(iFilePosition - (m_nStartPosition + m_buffer.getMaxReadSize()));
+    lock.Leave();
+    WaitForData(nRequired + 1, 5000);
+    lock.Enter();
+  }
+
+  // check if seek is inside the current buffer
+  if (iFilePosition >= m_nStartPosition && iFilePosition < m_nStartPosition + m_buffer.getMaxReadSize())
+  {
+    unsigned int nOffset = (unsigned int)(iFilePosition - m_nStartPosition);
+    // copy to history so we can seek back
+    if (m_HistoryBuffer.getMaxWriteSize() < nOffset)
+      m_HistoryBuffer.SkipBytes(nOffset);
+
+    if (!m_buffer.ReadData(m_HistoryBuffer, nOffset))
+    {
+      CLog::Log(LOGERROR, "%s, failed to copy %d bytes to history", __FUNCTION__, nOffset);
+    }
+
+    m_nStartPosition = iFilePosition;
+    m_space.Set();
+    return m_nStartPosition;
+  }
+
+  int64_t iHistoryStart = m_nStartPosition - m_HistoryBuffer.getMaxReadSize();
+  if (iFilePosition < m_nStartPosition && iFilePosition >= iHistoryStart)
+  {
+    CRingBuffer saveHist, saveUnRead;
+    int64_t nToSkip = iFilePosition - iHistoryStart;
+    SEEK_CHECK_RET(m_HistoryBuffer.ReadData(saveHist, (int)nToSkip));
+
+    SEEK_CHECK_RET(saveUnRead.Copy(m_buffer));
+
+    SEEK_CHECK_RET(m_buffer.Copy(m_HistoryBuffer));
+    int nSpace = m_buffer.getMaxWriteSize();
+    int nToCopy = saveUnRead.getMaxReadSize();
+
+    if (nToCopy < nSpace)
+      nSpace = nToCopy;
+
+    SEEK_CHECK_RET(saveUnRead.ReadData(m_buffer, nSpace));
+    nToCopy -= nSpace;
+    if (nToCopy > 0)
+      m_forwardBuffer.Copy(saveUnRead);
+
+    m_nStartPosition = iFilePosition;
+    m_space.Set();
+    return m_nStartPosition;
+  }
+
+  // seek outside the buffer. return error.
+  return CACHE_RC_ERROR;
+}
+
+void CacheMemBuffer::Reset(int64_t iSourcePosition)
+{
+  CSingleLock lock(m_sync);
+  m_nStartPosition = iSourcePosition;
+  m_buffer.Clear();
+  m_HistoryBuffer.Clear();
+  m_forwardBuffer.Clear();
+}
+
+
diff --git a/xbmc/filesystem/MemBufferCache.h b/xbmc/filesystem/MemBufferCache.h
new file mode 100644 (file)
index 0000000..c2fc109
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifndef CACHEMEMBUFFER_H
+#define CACHEMEMBUFFER_H
+
+#include "CacheStrategy.h"
+#include "threads/CriticalSection.h"
+#include "threads/Event.h"
+#include "utils/RingBuffer.h"
+
+/**
+  @author Team XBMC
+*/
+namespace XFILE {
+
+class CacheMemBuffer : public CCacheStrategy
+{
+public:
+    CacheMemBuffer();
+    virtual ~CacheMemBuffer();
+
+    virtual int Open() ;
+    virtual void Close();
+
+    virtual int WriteToCache(const char *pBuffer, size_t iSize) ;
+    virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ;
+    virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ;
+
+    virtual int64_t Seek(int64_t iFilePosition) ;
+    virtual void Reset(int64_t iSourcePosition) ;
+
+protected:
+    int64_t m_nStartPosition;
+    CRingBuffer m_buffer;
+    CRingBuffer m_HistoryBuffer;
+    CRingBuffer m_forwardBuffer; // for seek cases, to store data already read
+    CCriticalSection m_sync;
+    CEvent m_written;
+};
+
+} // namespace XFILE
+#endif
diff --git a/xbmc/filesystem/MusicDatabaseFile.cpp b/xbmc/filesystem/MusicDatabaseFile.cpp
new file mode 100644 (file)
index 0000000..1711520
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "MusicDatabaseFile.h"
+#include "music/MusicDatabase.h"
+#include "URL.h"
+#include "utils/StringUtils.h"
+#include "utils/URIUtils.h"
+
+#include <sys/stat.h>
+
+using namespace XFILE;
+
+CMusicDatabaseFile::CMusicDatabaseFile(void)
+{
+}
+
+CMusicDatabaseFile::~CMusicDatabaseFile(void)
+{
+  Close();
+}
+
+CStdString CMusicDatabaseFile::TranslateUrl(const CURL& url)
+{
+  CMusicDatabase musicDatabase;
+  if (!musicDatabase.Open())
+    return "";
+
+  CStdString strFileName=URIUtils::GetFileName(url.Get());
+  CStdString strExtension;
+  URIUtils::GetExtension(strFileName, strExtension);
+  URIUtils::RemoveExtension(strFileName);
+
+  if (!StringUtils::IsNaturalNumber(strFileName))
+    return "";
+
+  long idSong=atol(strFileName.c_str());
+
+  CSong song;
+  if (!musicDatabase.GetSongById(idSong, song))
+    return "";
+
+  CStdString strExtensionFromDb;
+  URIUtils::GetExtension(song.strFileName, strExtensionFromDb);
+
+  if (!strExtensionFromDb.Equals(strExtension))
+    return "";
+
+  return song.strFileName;
+}
+
+bool CMusicDatabaseFile::Open(const CURL& url)
+{
+  return m_file.Open(TranslateUrl(url));
+}
+
+bool CMusicDatabaseFile::Exists(const CURL& url)
+{
+  return !TranslateUrl(url).IsEmpty();
+}
+
+int CMusicDatabaseFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  return m_file.Stat(TranslateUrl(url), buffer);
+}
+
+unsigned int CMusicDatabaseFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  return m_file.Read(lpBuf, uiBufSize);
+}
+
+int64_t CMusicDatabaseFile::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
+{
+  return m_file.Seek(iFilePosition, iWhence);
+}
+
+void CMusicDatabaseFile::Close()
+{
+  m_file.Close();
+}
+
+int64_t CMusicDatabaseFile::GetPosition()
+{
+  return m_file.GetPosition();
+}
+
+int64_t CMusicDatabaseFile::GetLength()
+{
+  return m_file.GetLength();
+}
+
diff --git a/xbmc/filesystem/MusicDatabaseFile.h b/xbmc/filesystem/MusicDatabaseFile.h
new file mode 100644 (file)
index 0000000..ccc555b
--- /dev/null
@@ -0,0 +1,46 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "File.h"
+
+namespace XFILE
+{
+class CMusicDatabaseFile : public IFile
+{
+public:
+  CMusicDatabaseFile(void);
+  virtual ~CMusicDatabaseFile(void);
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+
+  static CStdString TranslateUrl(const CURL& url);
+protected:
+  CFile m_file;
+};
+}
index 3478b3d..d8b0cc5 100644 (file)
@@ -31,7 +31,7 @@
 #include "utils/StringUtils.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/log.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "utils/TimeUtils.h"
 
 extern "C"
index 9711981..d4328c0 100644 (file)
@@ -26,7 +26,7 @@
 #include "utils/URIUtils.h"
 #include "DllLibCMyth.h"
 #include "URL.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "threads/SingleLock.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
index 6337c32..16b21f5 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include "IDirectory.h"
-#include "FileNFS.h"
+#include "NFSFile.h"
 
 namespace XFILE
 {
diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp
new file mode 100644 (file)
index 0000000..b6136d4
--- /dev/null
@@ -0,0 +1,788 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileNFS.cpp: implementation of the CNFSFile class.
+//
+//////////////////////////////////////////////////////////////////////
+#include "system.h"
+
+#ifdef HAS_FILESYSTEM_NFS
+#include "DllLibNfs.h"
+#include "NFSFile.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/URIUtils.h"
+#include "network/DNSNameCache.h"
+#include "threads/SystemClock.h"
+
+#include <nfsc/libnfs-raw-mount.h>
+
+#ifdef TARGET_WINDOWS
+#include <fcntl.h>
+#include <sys\stat.h>
+#endif
+
+//KEEP_ALIVE_TIMEOUT is decremented every half a second
+//480 * 0.5s == 240s == 4mins
+//so when no read was done for 4mins and files are open
+//do the nfs keep alive for the open files
+#define KEEP_ALIVE_TIMEOUT 480
+
+//4 mins cached context timeout
+#define CONTEXT_TIMEOUT 240000
+
+//return codes for getContextForExport
+#define CONTEXT_INVALID  0    //getcontext failed
+#define CONTEXT_NEW      1    //new context created
+#define CONTEXT_CACHED   2    //context cached and therefore already mounted (no new mount needed)
+
+using namespace XFILE;
+
+CNfsConnection::CNfsConnection()
+: m_pNfsContext(NULL)
+, m_exportPath("")
+, m_hostName("")
+, m_resolvedHostName("")
+, m_readChunkSize(0)
+, m_writeChunkSize(0)
+, m_OpenConnections(0)
+, m_IdleTimeout(0)
+, m_pLibNfs(new DllLibNfs())
+{
+}
+
+CNfsConnection::~CNfsConnection()
+{
+  Deinit();
+  delete m_pLibNfs;
+}
+
+void CNfsConnection::resolveHost(const CURL &url)
+{ 
+  //resolve if hostname has changed
+  CDNSNameCache::Lookup(url.GetHostName(), m_resolvedHostName);
+}
+
+std::list<CStdString> CNfsConnection::GetExportList(const CURL &url)
+{
+    std::list<CStdString> retList;
+
+    if(HandleDyLoad())
+    {
+      struct exportnode *exportlist, *tmp;
+      exportlist = m_pLibNfs->mount_getexports(m_resolvedHostName);
+      tmp = exportlist;
+
+      for(tmp = exportlist; tmp!=NULL; tmp=tmp->ex_next)
+      {
+        retList.push_back(CStdString(tmp->ex_dir));
+      }      
+
+      gNfsConnection.GetImpl()->mount_free_export_list(exportlist);
+    }
+    
+    return retList;
+}
+
+bool CNfsConnection::HandleDyLoad()
+{
+  bool ret = true;
+  
+  if(!m_pLibNfs->IsLoaded())
+  {
+    if(!m_pLibNfs->Load())
+    {
+      CLog::Log(LOGERROR,"NFS: Error loading libnfs (%s).",__FUNCTION__);    
+      ret = false; //fatal
+    }    
+  }
+  return ret;
+}
+
+void CNfsConnection::clearMembers()
+{
+    m_exportPath.clear();
+    m_hostName.clear();
+    m_exportList.clear();
+    m_writeChunkSize = 0;
+    m_readChunkSize = 0;  
+    m_pNfsContext = NULL;
+    m_KeepAliveTimeouts.clear();
+}
+
+void CNfsConnection::destroyOpenContexts()
+{
+  for(tOpenContextMap::iterator it = m_openContextMap.begin();it!=m_openContextMap.end();it++)
+  {
+    m_pLibNfs->nfs_destroy_context(it->second.pContext);
+  }
+  m_openContextMap.clear();
+}
+
+struct nfs_context *CNfsConnection::getContextFromMap(const CStdString &exportname)
+{
+  struct nfs_context *pRet = NULL;
+
+  tOpenContextMap::iterator it = m_openContextMap.find(exportname.c_str());
+  if(it != m_openContextMap.end())
+  {
+    //check if context has timed out already
+    uint64_t now = XbmcThreads::SystemClockMillis();
+    if((now - it->second.lastAccessedTime) < CONTEXT_TIMEOUT)
+    {
+      //its not timedout yet
+      //refresh access time of that
+      //context and return it
+      CLog::Log(LOGDEBUG, "NFS: Refreshing context for %s, old: %"PRId64", new: %"PRId64, exportname.c_str(), it->second.lastAccessedTime, now);
+      it->second.lastAccessedTime = now;
+      pRet = it->second.pContext;
+    }
+    else 
+    {
+      //context is timed out
+      //destroy it and return NULL
+      CLog::Log(LOGDEBUG, "NFS: Old context timed out - destroying it");
+      m_pLibNfs->nfs_destroy_context(it->second.pContext);
+    }
+  }
+  return pRet;
+}
+
+int CNfsConnection::getContextForExport(const CStdString &exportname)
+{
+  int ret = CONTEXT_INVALID; 
+    
+  if(HandleDyLoad())
+  {
+    clearMembers();  
+    
+    m_pNfsContext = getContextFromMap(exportname);
+
+    if(!m_pNfsContext)
+    {
+      CLog::Log(LOGDEBUG,"NFS: Context for %s not open - get a new context.", exportname.c_str());
+      m_pNfsContext = m_pLibNfs->nfs_init_context();
+    
+      if(!m_pNfsContext) 
+      {
+        CLog::Log(LOGERROR,"NFS: Error initcontext in getContextForExport.");
+      }
+      else 
+      {
+        struct contextTimeout tmp;
+        tmp.pContext = m_pNfsContext;
+        tmp.lastAccessedTime = XbmcThreads::SystemClockMillis();
+        m_openContextMap[exportname] = tmp; //add context to list of all contexts      
+        ret = CONTEXT_NEW;
+      }
+    }
+    else
+    {
+      ret = CONTEXT_CACHED;
+      CLog::Log(LOGDEBUG,"NFS: Using cached context.");
+    }
+  }
+  return ret;
+}
+
+bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath)
+{
+    bool ret = false;
+    
+    //refresh exportlist if empty or hostname change
+    if(m_exportList.empty() || !url.GetHostName().Equals(m_hostName,false))
+    {
+      m_exportList = GetExportList(url);
+    }
+
+    if(!m_exportList.empty())
+    {
+      relativePath = "";
+      exportPath = "";
+      
+      CStdString path = url.GetFileName();
+      
+      //GetFileName returns path without leading "/"
+      //but we need it because the export paths start with "/"
+      //and path.Find(*it) wouldn't work else
+      if(!path.empty() && path[0] != '/')
+      {
+        path = "/" + path;
+      }
+      
+      std::list<CStdString>::iterator it;
+      
+      for(it=m_exportList.begin();it!=m_exportList.end();it++)
+      {
+        //if path starts with the current export path
+        if( path.Find(*it) ==  0 )
+        {
+          exportPath = *it;
+          relativePath = "//" + path.Right((path.length()-1) - exportPath.length());
+          ret = true;
+          break;          
+        }
+      }
+    }
+    return ret;
+}
+
+bool CNfsConnection::Connect(const CURL& url, CStdString &relativePath)
+{
+  CSingleLock lock(*this);
+  bool ret = false;
+  int nfsRet = 0;
+  CStdString exportPath = "";
+
+  resolveHost(url);
+  ret = splitUrlIntoExportAndPath(url, exportPath, relativePath);
+  
+  if(ret && (!exportPath.Equals(m_exportPath,true) || !url.GetHostName().Equals(m_hostName,false)) )
+  {
+    int contextRet = getContextForExport(url.GetHostName() + exportPath);
+    
+    if(contextRet == CONTEXT_INVALID)//we need a new context because sharename or hostname has changed
+    {
+      return false;
+    }
+    
+    if(contextRet == CONTEXT_NEW) //new context was created - we need to mount it
+    {
+      //we connect to the directory of the path. This will be the "root" path of this connection then.
+      //So all fileoperations are relative to this mountpoint...
+      nfsRet = m_pLibNfs->nfs_mount(m_pNfsContext, m_resolvedHostName.c_str(), exportPath.c_str());
+
+      if(nfsRet != 0) 
+      {
+        CLog::Log(LOGERROR,"NFS: Failed to mount nfs share: %s (%s)\n", exportPath.c_str(), m_pLibNfs->nfs_get_error(m_pNfsContext));
+        return false;
+      }
+      CLog::Log(LOGDEBUG,"NFS: Connected to server %s and export %s\n", url.GetHostName().c_str(), exportPath.c_str());
+    }
+    m_exportPath = exportPath;
+    m_hostName = url.GetHostName();
+    //read chunksize only works after mount
+    m_readChunkSize = m_pLibNfs->nfs_get_readmax(m_pNfsContext);
+    m_writeChunkSize = m_pLibNfs->nfs_get_writemax(m_pNfsContext);
+
+    if(contextRet == CONTEXT_NEW)
+    {
+      CLog::Log(LOGDEBUG,"NFS: chunks: r/w %i/%i\n", (int)m_readChunkSize,(int)m_writeChunkSize);          
+    }
+  }
+  return ret; 
+}
+
+void CNfsConnection::Deinit()
+{
+  if(m_pNfsContext && m_pLibNfs->IsLoaded())
+  {
+    destroyOpenContexts();
+    m_pNfsContext = NULL;
+    m_pLibNfs->Unload();    
+  }        
+  clearMembers();
+}
+
+/* This is called from CApplication::ProcessSlow() and is used to tell if nfs have been idle for too long */
+void CNfsConnection::CheckIfIdle()
+{
+  /* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
+   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
+  if (m_OpenConnections == 0 && m_pNfsContext != NULL)
+  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
+    CSingleLock lock(*this);
+    if (m_OpenConnections == 0 /* check again - when locked */)
+    {
+      if (m_IdleTimeout > 0)
+      {
+        m_IdleTimeout--;
+      }
+      else
+      {
+        CLog::Log(LOGNOTICE, "NFS is idle. Closing the remaining connections.");
+        gNfsConnection.Deinit();
+      }
+    }
+  }
+  
+  if( m_pNfsContext != NULL )
+  {
+    //handle keep alive on opened files
+    for( tFileKeepAliveMap::iterator it = m_KeepAliveTimeouts.begin();it!=m_KeepAliveTimeouts.end();it++)
+    {
+      CSingleLock lock(keepAliveLock);
+      if(it->second > 0)
+      {
+        it->second--;
+      }
+      else
+      {
+        lock.Leave();
+        keepAlive(it->first);
+        //reset timeout
+        resetKeepAlive(it->first);
+      }
+    }
+  }
+}
+
+//remove file handle from keep alive list on file close
+void CNfsConnection::removeFromKeepAliveList(struct nfsfh  *_pFileHandle)
+{
+  CSingleLock lock(keepAliveLock);
+  m_KeepAliveTimeouts.erase(_pFileHandle);
+}
+
+//reset timeouts on read
+void CNfsConnection::resetKeepAlive(struct nfsfh  *_pFileHandle)
+{
+  CSingleLock lock(keepAliveLock);
+  //adds new keys - refreshs existing ones  
+  m_KeepAliveTimeouts[_pFileHandle] = KEEP_ALIVE_TIMEOUT;
+}
+
+//keep alive the filehandles nfs connection
+//by blindly doing a read 32bytes - seek back to where
+//we were before
+void CNfsConnection::keepAlive(struct nfsfh  *_pFileHandle)
+{
+  off64_t offset = 0;
+  char buffer[32];
+  CLog::Log(LOGNOTICE, "NFS: sending keep alive after %i s.",KEEP_ALIVE_TIMEOUT/2);
+  CSingleLock lock(*this);
+  m_pLibNfs->nfs_lseek(m_pNfsContext, _pFileHandle, 0, SEEK_CUR, &offset);
+  m_pLibNfs->nfs_read(m_pNfsContext, _pFileHandle, 32, buffer);
+  m_pLibNfs->nfs_lseek(m_pNfsContext, _pFileHandle, offset, SEEK_SET, &offset);
+}
+
+int CNfsConnection::stat(const CURL &url, struct stat *statbuff)
+{
+  CSingleLock lock(*this);
+  int nfsRet = 0;
+  CStdString exportPath;
+  CStdString relativePath;
+  struct nfs_context *pTmpContext = NULL;
+  
+  if(!HandleDyLoad())
+  {
+    return -1;
+  }
+  
+  resolveHost(url);
+  
+  if(splitUrlIntoExportAndPath(url, exportPath, relativePath))
+  {    
+    pTmpContext = m_pLibNfs->nfs_init_context();
+    
+    if(pTmpContext)
+    {  
+      //we connect to the directory of the path. This will be the "root" path of this connection then.
+      //So all fileoperations are relative to this mountpoint...
+      nfsRet = m_pLibNfs->nfs_mount(pTmpContext, m_resolvedHostName.c_str(), exportPath.c_str());
+      
+      if(nfsRet == 0) 
+      {
+        nfsRet = m_pLibNfs->nfs_stat(pTmpContext, relativePath.c_str(), statbuff);      
+      }
+      else
+      {
+        CLog::Log(LOGERROR,"NFS: Failed to mount nfs share: %s (%s)\n", exportPath.c_str(), m_pLibNfs->nfs_get_error(m_pNfsContext));
+      }
+      
+      m_pLibNfs->nfs_destroy_context(pTmpContext);
+      CLog::Log(LOGDEBUG,"NFS: Connected to server %s and export %s in tmpContext\n", url.GetHostName().c_str(), exportPath.c_str());
+    }
+  }
+  return nfsRet;
+}
+
+/* The following two function is used to keep track on how many Opened files/directories there are.
+needed for unloading the dylib*/
+void CNfsConnection::AddActiveConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections++;
+}
+
+void CNfsConnection::AddIdleConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections--;
+  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
+   leaves the movie paused for a long while and then press stop */
+  m_IdleTimeout = 180;
+}
+
+CNfsConnection gNfsConnection;
+
+CNFSFile::CNFSFile()
+: m_fileSize(0)
+, m_pFileHandle(NULL)
+, m_pNfsContext(NULL)
+{
+  gNfsConnection.AddActiveConnection();
+}
+
+CNFSFile::~CNFSFile()
+{
+  Close();
+  gNfsConnection.AddIdleConnection();
+}
+
+int64_t CNFSFile::GetPosition()
+{
+  int ret = 0;
+  off64_t offset = 0;
+  CSingleLock lock(gNfsConnection);
+  
+  if (gNfsConnection.GetNfsContext() == NULL || m_pFileHandle == NULL) return 0;
+  
+  ret = (int)gNfsConnection.GetImpl()->nfs_lseek(gNfsConnection.GetNfsContext(), m_pFileHandle, 0, SEEK_CUR, &offset);
+  
+  if (ret < 0) 
+  {
+    CLog::Log(LOGERROR, "NFS: Failed to lseek(%s)",gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
+  }
+  return offset;
+}
+
+int64_t CNFSFile::GetLength()
+{
+  if (m_pFileHandle == NULL) return 0;
+  return m_fileSize;
+}
+
+bool CNFSFile::Open(const CURL& url)
+{
+  int ret = 0;
+  Close();
+  // we can't open files like nfs://file.f or nfs://server/file.f
+  // if a file matches the if below return false, it can't exist on a nfs share.
+  if (!IsValidFile(url.GetFileName()))
+  {
+    CLog::Log(LOGNOTICE,"NFS: Bad URL : '%s'",url.GetFileName().c_str());
+    return false;
+  }
+  
+  CStdString filename = "";
+   
+  CSingleLock lock(gNfsConnection);
+  
+  if(!gNfsConnection.Connect(url, filename))
+    return false;
+  
+  m_pNfsContext = gNfsConnection.GetNfsContext(); 
+  
+  ret = gNfsConnection.GetImpl()->nfs_open(m_pNfsContext, filename.c_str(), O_RDONLY, &m_pFileHandle);
+  
+  if (ret != 0) 
+  {
+    CLog::Log(LOGINFO, "CNFSFile::Open: Unable to open file : '%s'  error : '%s'", url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
+    return false;
+  } 
+  
+  CLog::Log(LOGDEBUG,"CNFSFile::Open - opened %s",url.GetFileName().c_str());
+  m_url=url;
+  
+  struct __stat64 tmpBuffer;
+
+  if( Stat(&tmpBuffer) )
+  {
+    m_url.Reset();
+    Close();
+    return false;
+  }
+  
+  m_fileSize = tmpBuffer.st_size;//cache the size of this file
+  // We've successfully opened the file!
+  return true;
+}
+
+
+bool CNFSFile::Exists(const CURL& url)
+{
+  return Stat(url,NULL) == 0;
+}
+
+int CNFSFile::Stat(struct __stat64* buffer)
+{
+  return Stat(m_url,buffer);
+}
+
+
+int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  int ret = 0;
+  CSingleLock lock(gNfsConnection);
+  CStdString filename = "";
+  
+  if(!gNfsConnection.Connect(url,filename))
+    return -1;
+   
+
+  struct stat tmpBuffer = {0};
+
+  ret = gNfsConnection.GetImpl()->nfs_stat(gNfsConnection.GetNfsContext(), filename.c_str(), &tmpBuffer);
+  
+  //if buffer == NULL we where called from Exists - in that case don't spam the log with errors
+  if (ret != 0 && buffer != NULL) 
+  {
+    CLog::Log(LOGERROR, "NFS: Failed to stat(%s) %s\n", url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
+    ret = -1;
+  }
+  else
+  {  
+    if(buffer)
+    {
+      memset(buffer, 0, sizeof(struct __stat64));
+      buffer->st_dev = tmpBuffer.st_dev;
+      buffer->st_ino = tmpBuffer.st_ino;
+      buffer->st_mode = tmpBuffer.st_mode;
+      buffer->st_nlink = tmpBuffer.st_nlink;
+      buffer->st_uid = tmpBuffer.st_uid;
+      buffer->st_gid = tmpBuffer.st_gid;
+      buffer->st_rdev = tmpBuffer.st_rdev;
+      buffer->st_size = tmpBuffer.st_size;
+      buffer->st_atime = tmpBuffer.st_atime;
+      buffer->st_mtime = tmpBuffer.st_mtime;
+      buffer->st_ctime = tmpBuffer.st_ctime;
+    }
+  }
+  return ret;
+}
+
+unsigned int CNFSFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  int numberOfBytesRead = 0;
+  CSingleLock lock(gNfsConnection);
+  
+  if (m_pFileHandle == NULL || m_pNfsContext == NULL ) return 0;
+
+  numberOfBytesRead = gNfsConnection.GetImpl()->nfs_read(m_pNfsContext, m_pFileHandle, (size_t)uiBufSize, (char *)lpBuf);  
+
+  lock.Leave();//no need to keep the connection lock after that
+  
+  gNfsConnection.resetKeepAlive(m_pFileHandle);//triggers keep alive timer reset for this filehandle
+  
+  //something went wrong ...
+  if (numberOfBytesRead < 0) 
+  {
+    CLog::Log(LOGERROR, "%s - Error( %d, %s )", __FUNCTION__, numberOfBytesRead, gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
+    return 0;
+  }
+  return (unsigned int)numberOfBytesRead;
+}
+
+int64_t CNFSFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  int ret = 0;
+  off64_t offset = 0;
+
+  CSingleLock lock(gNfsConnection);  
+  if (m_pFileHandle == NULL || m_pNfsContext == NULL) return -1;
+  
+  ret = (int)gNfsConnection.GetImpl()->nfs_lseek(m_pNfsContext, m_pFileHandle, iFilePosition, iWhence, &offset);
+  if (ret < 0) 
+  {
+    CLog::Log(LOGERROR, "%s - Error( seekpos: %"PRId64", whence: %i, fsize: %"PRId64", %s)", __FUNCTION__, iFilePosition, iWhence, m_fileSize, gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
+    return -1;
+  }
+  return (int64_t)offset;
+}
+
+void CNFSFile::Close()
+{
+  CSingleLock lock(gNfsConnection);
+  
+  if (m_pFileHandle != NULL && m_pNfsContext != NULL)
+  {
+    int ret = 0;
+    CLog::Log(LOGDEBUG,"CNFSFile::Close closing file %s", m_url.GetFileName().c_str());
+    ret = gNfsConnection.GetImpl()->nfs_close(m_pNfsContext, m_pFileHandle);
+    gNfsConnection.removeFromKeepAliveList(m_pFileHandle);
+        
+         if (ret < 0) 
+    {
+      CLog::Log(LOGERROR, "Failed to close(%s) - %s\n", m_url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));
+    }
+    m_pFileHandle = NULL;
+    m_pNfsContext = NULL;    
+    m_fileSize = 0;
+  }
+}
+
+//this was a bitch!
+//for nfs write to work we have to write chunked
+//otherwise this could crash on big files
+int CNFSFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  int numberOfBytesWritten = 0;
+  int writtenBytes = 0;
+  int64_t leftBytes = uiBufSize;
+  //clamp max write chunksize to 32kb - fixme - this might be superfluious with future libnfs versions
+  int64_t chunkSize = gNfsConnection.GetMaxWriteChunkSize() > 32768 ? 32768 : gNfsConnection.GetMaxWriteChunkSize();
+  
+  CSingleLock lock(gNfsConnection);
+  
+  if (m_pFileHandle == NULL || m_pNfsContext == NULL) return -1;
+  
+  //write as long as some bytes are left to be written
+  while( leftBytes )
+  {
+    //the last chunk could be smalle than chunksize
+    if(leftBytes < chunkSize)
+    {
+      chunkSize = leftBytes;//write last chunk with correct size
+    }
+    //write chunk
+    writtenBytes = gNfsConnection.GetImpl()->nfs_write(m_pNfsContext,
+                                  m_pFileHandle, 
+                                  (size_t)chunkSize, 
+                                  (char *)lpBuf + numberOfBytesWritten);
+    //decrease left bytes
+    leftBytes-= writtenBytes;
+    //increase overall written bytes
+    numberOfBytesWritten += writtenBytes;
+        
+    //danger - something went wrong
+    if (writtenBytes < 0) 
+    {
+      CLog::Log(LOGERROR, "Failed to pwrite(%s) %s\n", m_url.GetFileName().c_str(), gNfsConnection.GetImpl()->nfs_get_error(m_pNfsContext));        
+      break;
+    }     
+  }
+  //return total number of written bytes
+  return numberOfBytesWritten;
+}
+
+bool CNFSFile::Delete(const CURL& url)
+{
+  int ret = 0;
+  CSingleLock lock(gNfsConnection);
+  CStdString filename = "";
+  
+  if(!gNfsConnection.Connect(url, filename))
+    return false;
+  
+  
+  ret = gNfsConnection.GetImpl()->nfs_unlink(gNfsConnection.GetNfsContext(), filename.c_str());
+  
+  if(ret != 0)
+  {
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
+  }
+  return (ret == 0);
+}
+
+bool CNFSFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  int ret = 0;
+  CSingleLock lock(gNfsConnection);
+  CStdString strFile = "";
+  
+  if(!gNfsConnection.Connect(url,strFile))
+    return false;
+  
+  CStdString strFileNew;
+  CStdString strDummy;
+  gNfsConnection.splitUrlIntoExportAndPath(urlnew, strDummy, strFileNew);
+  
+  ret = gNfsConnection.GetImpl()->nfs_rename(gNfsConnection.GetNfsContext() , strFile.c_str(), strFileNew.c_str());
+  
+  if(ret != 0)
+  {
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
+  } 
+  return (ret == 0);
+}
+
+bool CNFSFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{ 
+  int ret = 0;
+  // we can't open files like nfs://file.f or nfs://server/file.f
+  // if a file matches the if below return false, it can't exist on a nfs share.
+  if (!IsValidFile(url.GetFileName())) return false;
+  
+  Close();
+  CSingleLock lock(gNfsConnection);
+  CStdString filename = "";
+  
+  if(!gNfsConnection.Connect(url,filename))
+    return false;
+  
+  m_pNfsContext = gNfsConnection.GetNfsContext();
+  
+  if (bOverWrite)
+  {
+    CLog::Log(LOGWARNING, "FileNFS::OpenForWrite() called with overwriting enabled! - %s", filename.c_str());
+    //create file with proper permissions
+    ret = gNfsConnection.GetImpl()->nfs_creat(m_pNfsContext, filename.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, &m_pFileHandle);    
+    //if file was created the file handle isn't valid ... so close it and open later
+    if(ret == 0)
+    {
+      gNfsConnection.GetImpl()->nfs_close(m_pNfsContext,m_pFileHandle);
+    }
+  }
+
+  ret = gNfsConnection.GetImpl()->nfs_open(m_pNfsContext, filename.c_str(), O_RDWR, &m_pFileHandle);
+  
+  if (ret || m_pFileHandle == NULL)
+  {
+    // write error to logfile
+    CLog::Log(LOGERROR, "CNFSFile::Open: Unable to open file : '%s' error : '%s'", filename.c_str(), gNfsConnection.GetImpl()->nfs_get_error(gNfsConnection.GetNfsContext()));
+    return false;
+  }
+  m_url=url;
+  
+  struct __stat64 tmpBuffer = {0};
+
+  //only stat if file was not created
+  if(!bOverWrite) 
+  {
+    if(Stat(&tmpBuffer))
+    {
+      m_url.Reset();
+      Close();
+      return false;
+    }
+    m_fileSize = tmpBuffer.st_size;//cache filesize of this file    
+  }
+  else//file was created - filesize is zero
+  {
+    m_fileSize = 0;    
+  }
+  
+  // We've successfully opened the file!
+  return true;
+}
+
+bool CNFSFile::IsValidFile(const CStdString& strFileName)
+{
+  if (strFileName.Find('/') == -1 || /* doesn't have sharename */
+      strFileName.Right(2) == "/." || /* not current folder */
+      strFileName.Right(3) == "/..")  /* not parent folder */
+    return false;
+  return true;
+}
+#endif//HAS_FILESYSTEM_NFS
+
diff --git a/xbmc/filesystem/NFSFile.h b/xbmc/filesystem/NFSFile.h
new file mode 100644 (file)
index 0000000..67c7e82
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileNFS.h: interface for the CNFSFile class.
+#ifndef FILENFS_H_
+#define FILENFS_H_
+
+#include "IFile.h"
+#include "URL.h"
+#include "threads/CriticalSection.h"
+#include <list>
+#include "SectionLoader.h"
+#include <map>
+
+#ifdef TARGET_WINDOWS
+#define S_IRGRP 0
+#define S_IROTH 0
+#define S_IWUSR _S_IWRITE
+#define S_IRUSR _S_IREAD
+#define        S_IFLNK 0120000
+
+#define S_ISBLK(m) (0)
+#define S_ISSOCK(m) (0)
+#define S_ISLNK(m) ((m & S_IFLNK) != 0)
+#define S_ISCHR(m) ((m & _S_IFCHR) != 0)
+#define S_ISDIR(m) ((m & _S_IFDIR) != 0)
+#define S_ISFIFO(m) ((m & _S_IFIFO) != 0)
+#define S_ISREG(m) ((m & _S_IFREG) != 0)
+#endif
+
+class DllLibNfs;
+
+class CNfsConnection : public CCriticalSection
+{     
+public:
+  typedef std::map<struct nfsfh  *, unsigned int> tFileKeepAliveMap;  
+
+  struct contextTimeout
+  {
+    struct nfs_context *pContext;
+    uint64_t lastAccessedTime;
+  };
+
+  typedef std::map<std::string, struct contextTimeout> tOpenContextMap;    
+  
+  CNfsConnection();
+  ~CNfsConnection();
+  bool Connect(const CURL &url, CStdString &relativePath);
+  struct nfs_context *GetNfsContext(){return m_pNfsContext;}
+  size_t            GetMaxReadChunkSize(){return m_readChunkSize;}
+  size_t            GetMaxWriteChunkSize(){return m_writeChunkSize;} 
+  DllLibNfs        *GetImpl(){return m_pLibNfs;}
+  std::list<CStdString> GetExportList(const CURL &url);
+  //this functions splits the url into the exportpath (feed to mount) and the rest of the path
+  //relative to the mounted export
+  bool splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath);
+  
+  //special stat which uses its own context
+  //needed for getting intervolume symlinks to work
+  int stat(const CURL &url, struct stat *statbuff);
+
+  void AddActiveConnection();
+  void AddIdleConnection();
+  void CheckIfIdle();
+  void Deinit();
+  bool HandleDyLoad();//loads the lib if needed
+  //adds the filehandle to the keep alive list or resets
+  //the timeout for this filehandle if already in list
+  void resetKeepAlive(struct nfsfh  *_pFileHandle);
+  //removes file handle from keep alive list
+  void removeFromKeepAliveList(struct nfsfh  *_pFileHandle);  
+  
+  const CStdString& GetConnectedIp() const {return m_resolvedHostName;}
+  const CStdString& GetConnectedExport() const {return m_exportPath;}
+
+private:
+  struct nfs_context *m_pNfsContext;//current nfs context
+  CStdString m_exportPath;//current connected export path
+  CStdString m_hostName;//current connected host
+  CStdString m_resolvedHostName;//current connected host - as ip
+  size_t m_readChunkSize;//current read chunksize of connected server
+  size_t m_writeChunkSize;//current write chunksize of connected server
+  int m_OpenConnections;//number of open connections
+  unsigned int m_IdleTimeout;//timeout for idle connection close and dyunload
+  tFileKeepAliveMap m_KeepAliveTimeouts;//mapping filehandles to its idle timeout
+  tOpenContextMap m_openContextMap;//unique map for tracking all open contexts
+  DllLibNfs *m_pLibNfs;//the lib
+  std::list<CStdString> m_exportList;//list of exported pathes of current connected servers
+  CCriticalSection keepAliveLock;
+  void clearMembers();
+  struct nfs_context *getContextFromMap(const CStdString &exportname);
+  int  getContextForExport(const CStdString &exportname);//get context for given export and add to open contexts map - sets m_pNfsContext (my return a already mounted cached context)
+  void destroyOpenContexts();
+  void resolveHost(const CURL &url);//resolve hostname by dnslookup
+  void keepAlive(struct nfsfh  *_pFileHandle);
+};
+
+extern CNfsConnection gNfsConnection;
+
+namespace XFILE
+{
+  class CNFSFile : public IFile
+  {
+  public:
+    CNFSFile();
+    virtual ~CNFSFile();
+    virtual void Close();
+    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+    virtual bool Open(const CURL& url);
+    virtual bool Exists(const CURL& url);
+    virtual int Stat(const CURL& url, struct __stat64* buffer);
+    virtual int Stat(struct __stat64* buffer);
+    virtual int64_t GetLength();
+    virtual int64_t GetPosition();
+    virtual int Write(const void* lpBuf, int64_t uiBufSize);
+    //implement iocontrol for seek_possible for preventing the stat in File class for
+    //getting this info ...
+    virtual int IoControl(EIoControl request, void* param){ if(request == IOCTRL_SEEK_POSSIBLE) return 1;return -1;};    
+    virtual int  GetChunkSize() {return 1;}
+    
+    virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+    virtual bool Delete(const CURL& url);
+    virtual bool Rename(const CURL& url, const CURL& urlnew);    
+  protected:
+    CURL m_url;
+    bool IsValidFile(const CStdString& strFileName);
+    int64_t m_fileSize;
+    struct nfsfh  *m_pFileHandle;
+    struct nfs_context *m_pNfsContext;//current nfs context    
+  };
+}
+#endif // FILENFS_H_
+
+
diff --git a/xbmc/filesystem/PipeFile.cpp b/xbmc/filesystem/PipeFile.cpp
new file mode 100644 (file)
index 0000000..7fb39ab
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "PipeFile.h"
+#include "threads/SingleLock.h"
+#include "PipesManager.h"
+#include "utils/StringUtils.h"
+
+using namespace XFILE;
+
+CPipeFile::CPipeFile() : m_pos(0), m_length(-1), m_pipe(NULL)
+{
+}
+
+CPipeFile::~CPipeFile()
+{
+  Close();
+}
+
+int64_t CPipeFile::GetPosition()
+{
+  return m_pos;
+}
+
+int64_t CPipeFile::GetLength()
+{
+  return m_length;
+}
+
+void CPipeFile::SetLength(int64_t len)
+{
+  m_length = len;
+}
+
+bool CPipeFile::Open(const CURL& url)
+{
+  CStdString name = url.Get();
+  m_pipe = PipesManager::GetInstance().OpenPipe(name);
+  if (m_pipe)
+    m_pipe->AddListener(this);
+  return (m_pipe != NULL);
+}
+
+bool CPipeFile::Exists(const CURL& url)
+{
+  CStdString name = url.Get();
+  return PipesManager::GetInstance().Exists(name);
+}
+
+int CPipeFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  return -1;
+}
+
+int CPipeFile::Stat(struct __stat64* buffer)
+{
+  memset(buffer,0,sizeof(struct __stat64));
+  buffer->st_size = m_length;
+  return 0;
+}
+
+unsigned int CPipeFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  if (!m_pipe)
+    return -1;
+  
+  return m_pipe->Read((char *)lpBuf,(int)uiBufSize,INFINITE);
+}
+
+int CPipeFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  if (!m_pipe)
+    return -1;
+  
+  return (int)(m_pipe->Write((const char *)lpBuf,(int)uiBufSize,INFINITE)); // its not the size. its bool. either all was written or not.
+}
+
+void CPipeFile::SetEof()
+{
+  if (!m_pipe)
+    return ;
+  m_pipe->SetEof();
+}
+
+bool CPipeFile::IsEof()
+{
+  if (!m_pipe)
+    return true;
+  return m_pipe->IsEof();
+}
+
+bool CPipeFile::IsEmpty()
+{
+  if (!m_pipe)
+    return true;
+  return m_pipe->IsEmpty();
+}
+
+int64_t CPipeFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  return -1;
+}
+
+void CPipeFile::Close()
+{
+  if (m_pipe)
+  {
+    m_pipe->RemoveListener(this);
+    PipesManager::GetInstance().ClosePipe(m_pipe);    
+  }
+  m_pipe = NULL;
+}
+
+bool CPipeFile::IsClosed()
+{
+  return (m_pipe == NULL);
+}
+
+void CPipeFile::Flush()
+{
+  if (m_pipe)
+    m_pipe->Flush();
+}
+
+bool CPipeFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{
+  CStdString name = url.Get();
+
+  m_pipe = PipesManager::GetInstance().CreatePipe(name);
+  if (m_pipe)
+    m_pipe->AddListener(this);
+  return (m_pipe != NULL);
+}
+
+bool CPipeFile::Delete(const CURL& url)
+{
+  return false;
+}
+
+bool CPipeFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  return false;
+}
+
+int CPipeFile::IoControl(int request, void* param)
+{
+  return -1;
+}
+
+CStdString CPipeFile::GetName() const
+{
+  if (!m_pipe)
+    return StringUtils::EmptyString;
+  return m_pipe->GetName();
+}
+
+void CPipeFile::OnPipeOverFlow()
+{
+  CSingleLock lock(m_lock);
+  for (size_t l=0; l<m_listeners.size(); l++)
+    m_listeners[l]->OnPipeOverFlow();
+}
+
+__int64        CPipeFile::GetAvailableRead()
+{
+  return m_pipe->GetAvailableRead();
+}
+
+void CPipeFile::OnPipeUnderFlow()
+{
+  for (size_t l=0; l<m_listeners.size(); l++)
+    m_listeners[l]->OnPipeUnderFlow();
+}
+
+void CPipeFile::AddListener(IPipeListener *l)
+{
+  CSingleLock lock(m_lock);
+  for (size_t i=0; i<m_listeners.size(); i++)
+  {
+    if (m_listeners[i] == l)
+      return;
+  }
+  m_listeners.push_back(l);
+}
+
+void CPipeFile::RemoveListener(IPipeListener *l)
+{
+  CSingleLock lock(m_lock);
+  std::vector<XFILE::IPipeListener *>::iterator i = m_listeners.begin();
+  while(i != m_listeners.end())
+  {
+    if ( (*i) == l)
+      i = m_listeners.erase(i);
+    else
+      i++;
+  }
+}
+
+void CPipeFile::SetOpenThreashold(int threashold)
+{
+  m_pipe->SetOpenThreashold(threashold);
+}
+
diff --git a/xbmc/filesystem/PipeFile.h b/xbmc/filesystem/PipeFile.h
new file mode 100644 (file)
index 0000000..62ebdc0
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * XBMC Media Center
+ * Copyright (c) 2002 Frodo
+ * Portions Copyright (c) by the authors of ffmpeg and xvid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+// FilePipe.h: interface for the CPipeFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
+#define AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "IFile.h"
+#include "utils/AutoPtrHandle.h"
+#include "utils/StdString.h"
+#include "threads/Event.h"
+#include "threads/CriticalSection.h"
+#include "utils/RingBuffer.h"
+#include "PipesManager.h"
+
+namespace XFILE
+{
+  
+class CPipeFile : public IFile, public IPipeListener
+{
+public:
+  CPipeFile();
+  virtual ~CPipeFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual void SetLength(int64_t len);
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual int Stat(struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int Write(const void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual void Flush();
+  virtual __int64      GetAvailableRead();
+
+  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+
+  virtual bool Delete(const CURL& url);
+  virtual bool Rename(const CURL& url, const CURL& urlnew);
+  virtual int IoControl(int request, void* param);
+  
+  CStdString GetName() const;
+  
+  virtual void OnPipeOverFlow();
+  virtual void OnPipeUnderFlow();
+
+  void AddListener(IPipeListener *l);
+  void RemoveListener(IPipeListener *l);
+
+  void SetEof();
+  bool IsEof();
+  bool IsEmpty();
+  bool IsClosed();
+  
+  void SetOpenThreashold(int threashold);
+
+protected:
+  int64_t m_pos;
+  int64_t m_length;
+  
+  XFILE::Pipe *m_pipe;
+  
+  CCriticalSection m_lock;
+  std::vector<XFILE::IPipeListener *> m_listeners;
+};
+
+}
+#endif // !defined(AFX_FILEPIPE_H__DD2B0A9E_4971_4A29_B525_78CEFCDAF4A1__INCLUDED_)
index 4bbd265..a4ef8c5 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "RSSDirectory.h"
 #include "FileItem.h"
-#include "FileCurl.h"
+#include "CurlFile.h"
 #include "settings/Settings.h"
 #include "utils/URIUtils.h"
 #include "tinyXML/tinyxml.h"
diff --git a/xbmc/filesystem/RTVFile.cpp b/xbmc/filesystem/RTVFile.cpp
new file mode 100644 (file)
index 0000000..2eee45b
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileRTV.cpp: implementation of the CRTVFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "RTVFile.h"
+#include "SectionLoader.h"
+#include "URL.h"
+#include "utils/log.h"
+#include <errno.h>
+#include <sys/stat.h>
+#ifdef _WIN32
+#include "PlatformDefs.h" //for PRIdS
+#endif
+extern "C"
+{
+#include "lib/libRTV/interface.h"
+}
+
+
+using namespace XFILE;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CRTVFile::CRTVFile()
+{
+  CSectionLoader::Load("LIBRTV");
+  m_filePos = 0;
+  m_fileSize = 0;
+  m_bOpened = false;
+  m_rtvd = NULL;
+}
+
+CRTVFile::~CRTVFile()
+{
+  Close();
+  CSectionLoader::Unload("LIBRTV");
+}
+
+//*********************************************************************************************
+bool CRTVFile::Open(const char* strHostName, const char* strFileName, int iport)
+{
+  // Close any existing connection
+  if (m_bOpened) Close();
+
+  m_bOpened = false;
+
+  // Set up global variables.  Don't set m_filePos to 0 because we use it to SEEK!
+  m_fileSize = 0;
+  m_rtvd = NULL;
+  strcpy(m_hostName, strHostName);
+  strcpy(m_fileName, strFileName);
+  m_iport = iport;
+
+  // Allow for ReplayTVs on ports other than 80
+  CStdString strHostAndPort;
+  strHostAndPort = strHostName;
+  if (iport)
+  {
+    char buffer[10];
+    sprintf(buffer,"%i",iport);
+    strHostAndPort += ':';
+    strHostAndPort += buffer;
+  }
+
+  // Get the file size of strFileName.  If size is 0 or negative, file doesn't exist so exit.
+  u64 size;
+  size = rtv_get_filesize(strHostAndPort.c_str(), strFileName);
+  if (!size)
+  {
+    CLog::Log(LOGERROR, "%s - Failed to get filesize of %s on %s", __FUNCTION__, strHostName, strFileName);
+    return false;
+  }
+  m_fileSize = size;
+
+  // Open a connection to strFileName stating at position m_filePos
+  // Store the handle to the connection in m_rtvd.  Exit if handle invalid.
+  m_rtvd = rtv_open_file(strHostAndPort.c_str(), strFileName, m_filePos);
+  if (!m_rtvd)
+  {
+    CLog::Log(LOGERROR, "%s - Failed to open %s on %s", __FUNCTION__, strHostName, strFileName);
+    return false;
+  }
+  m_bOpened = true;
+
+  CLog::Log(LOGDEBUG, "%s - Opened %s on %s, Size %"PRIu64", Position %"PRIu64"", __FUNCTION__, strHostName, strFileName, m_fileSize, m_filePos);
+  return true;
+}
+
+bool CRTVFile::Open(const CURL& url)
+{
+  return Open(url.GetHostName(), url.GetFileName(), url.GetPort());
+}
+
+bool CRTVFile::Exists(const CURL& url)
+{
+  return true;
+}
+
+int CRTVFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  errno = ENOENT;
+  return -1;
+}
+
+//*********************************************************************************************
+unsigned int CRTVFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  size_t lenread;
+
+  // Don't read if no connection is open!
+  if (!m_bOpened) return 0;
+
+  // Read uiBufSize bytes from the m_rtvd connection
+  lenread = rtv_read_file(m_rtvd, (char *) lpBuf, (size_t) uiBufSize);
+
+  CLog::Log(LOGDEBUG, "%s - Requested %"PRIdS", Recieved %"PRIdS"", __FUNCTION__, (size_t)uiBufSize, lenread);
+
+  // Some extra checking so library behaves
+  if(m_filePos + lenread > m_fileSize)
+  {
+    CLog::Log(LOGWARNING, "%s - RTV library read passed filesize, returning last chunk", __FUNCTION__);
+    lenread = (size_t)(m_fileSize - m_filePos);
+    m_filePos = m_fileSize;
+    return lenread;
+  }
+
+  // Increase the file position by the number of bytes we just read
+  m_filePos += lenread;
+
+  // Return the number of bytes we just read
+  return lenread;
+}
+
+//*********************************************************************************************
+void CRTVFile::Close()
+{
+  m_bOpened = false;
+
+  // Only try to close a valid handle!
+  if (m_rtvd)
+  {
+    rtv_close_file(m_rtvd);
+  }
+  m_rtvd = NULL;
+}
+
+//*********************************************************************************************
+int64_t CRTVFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  UINT64 newpos;
+
+  if (!m_bOpened) return 0;
+  switch (iWhence)
+  {
+  case SEEK_SET:
+    // cur = pos
+    newpos = iFilePosition;
+    break;
+  case SEEK_CUR:
+    // cur += pos
+    newpos = m_filePos + iFilePosition;
+    break;
+  case SEEK_END:
+    // end += pos
+    newpos = m_fileSize + iFilePosition;
+    break;
+  default:
+    return -1;
+  }
+  // Return offset from beginning
+  if (newpos > m_fileSize) newpos = m_fileSize;
+
+  // NEW CODE
+  // If the new file position is different from the old, then we must SEEK there!
+  if (m_filePos != newpos)
+  {
+    m_filePos = newpos;
+    Open(m_hostName, m_fileName, m_iport);
+  }
+
+  // OLD CODE
+  // Below is old code that may be useful again.  For some reason I'm not sure of, XBMC
+  // does a few seeks to the beginning and end of the stream before it ever starts playing.
+  // When used instead of the code above, this code seeks only after playing begins.
+  // Theoretically, this saves some time because it prevents needless re-opening of the
+  // connection to the RTV, but in practice it seems to be the same.
+  //m_filePos = newpos;
+
+  //if (m_rtvd->firstReadDone && iWhence == SEEK_SET) {
+  // Open(NULL, NULL, m_hostName, m_fileName, m_iport, true);
+  //}
+
+  // Return the new file position after the seek
+  return m_filePos;
+}
+
+//*********************************************************************************************
+int64_t CRTVFile::GetLength()
+{
+  if (!m_bOpened) return 0;
+  return m_fileSize;
+}
+
+//*********************************************************************************************
+int64_t CRTVFile::GetPosition()
+{
+  if (!m_bOpened) return 0;
+  return m_filePos;
+}
diff --git a/xbmc/filesystem/RTVFile.h b/xbmc/filesystem/RTVFile.h
new file mode 100644 (file)
index 0000000..cadf3d8
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileRTV.h: interface for the CRTVFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILERTV_H___INCLUDED_)
+#define AFX_FILERTV_H___INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "IFile.h"
+
+typedef struct rtv_data * RTVD;
+
+namespace XFILE
+{
+
+class CRTVFile : public IFile
+{
+public:
+  CRTVFile();
+  virtual ~CRTVFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  bool Open(const char* strHostName, const char* strFileName, int iport);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+protected:
+  uint64_t m_fileSize;
+  uint64_t m_filePos;
+  char m_hostName[255];
+  char m_fileName[255];
+  int m_iport;
+private:
+  RTVD m_rtvd;
+  bool m_bOpened;
+
+};
+}
+
+#endif // !defined(AFX_FILERTV_H___INCLUDED_)
diff --git a/xbmc/filesystem/RarFile.cpp b/xbmc/filesystem/RarFile.cpp
new file mode 100644 (file)
index 0000000..3fca340
--- /dev/null
@@ -0,0 +1,724 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "system.h"
+#include "RarFile.h"
+#include <sys/stat.h>
+#include "Util.h"
+#include "utils/CharsetConverter.h"
+#include "utils/URIUtils.h"
+#include "URL.h"
+#include "Directory.h"
+#include "RarManager.h"
+#include "settings/AdvancedSettings.h"
+#include "FileItem.h"
+#include "utils/log.h"
+#include "UnrarXLib/rar.hpp"
+
+#ifndef _LINUX
+#include <process.h>
+#endif
+
+using namespace XFILE;
+using namespace std;
+
+#define SEEKTIMOUT 30000
+
+#ifdef HAS_FILESYSTEM_RAR
+CRarFileExtractThread::CRarFileExtractThread() : hRunning(true), hQuit(true)
+{
+  m_pArc = NULL;
+  m_pCmd = NULL;
+  m_pExtract = NULL;
+  StopThread();
+  Create();
+}
+
+CRarFileExtractThread::~CRarFileExtractThread()
+{
+  hQuit.Set();
+  AbortableWait(hRestart);
+  StopThread();
+}
+
+void CRarFileExtractThread::Start(Archive* pArc, CommandData* pCmd, CmdExtract* pExtract, int iSize)
+{
+  m_pArc = pArc;
+  m_pCmd = pCmd;
+  m_pExtract = pExtract;
+  m_iSize = iSize;
+
+  m_pExtract->GetDataIO().hBufferFilled = new CEvent;
+  m_pExtract->GetDataIO().hBufferEmpty = new CEvent;
+  m_pExtract->GetDataIO().hSeek = new CEvent(true);
+  m_pExtract->GetDataIO().hSeekDone = new CEvent;
+  m_pExtract->GetDataIO().hQuit = new CEvent(true);
+
+  hRunning.Set();
+  hRestart.Set();
+}
+
+void CRarFileExtractThread::OnStartup()
+{
+}
+
+void CRarFileExtractThread::OnExit()
+{
+}
+
+void CRarFileExtractThread::Process()
+{
+  while (AbortableWait(hQuit,1) != WAIT_SIGNALED)
+  {
+    if (AbortableWait(hRestart,1) == WAIT_SIGNALED)
+    {
+      bool Repeat = false;
+      try
+      {
+        m_pExtract->ExtractCurrentFile(m_pCmd,*m_pArc,m_iSize,Repeat);
+      }
+      catch (int rarErrCode)
+      {
+        CLog::Log(LOGERROR,"filerar CFileRarExtractThread::Process failed. CmdExtract::ExtractCurrentFile threw a UnrarXLib error code of %d",rarErrCode);
+      }
+      catch (...)
+      {
+        CLog::Log(LOGERROR,"filerar CFileRarExtractThread::Process failed. CmdExtract::ExtractCurrentFile threw an Unknown exception");
+      }
+
+      hRunning.Reset();
+    }
+  }
+  hRestart.Set();
+}
+#endif
+
+CRarFile::CRarFile()
+{
+  m_strCacheDir.Empty();
+  m_strRarPath.Empty();
+  m_strPassword.Empty();
+  m_strPathInRar.Empty();
+  m_bFileOptions = 0;
+#ifdef HAS_FILESYSTEM_RAR
+  m_pArc = NULL;
+  m_pCmd = NULL;
+  m_pExtract = NULL;
+  m_pExtractThread = NULL;
+#endif
+  m_szBuffer = NULL;
+  m_szStartOfBuffer = NULL;
+  m_iDataInBuffer = 0;
+  m_bUseFile = false;
+  m_bOpen = false;
+  m_bSeekable = true;
+}
+
+CRarFile::~CRarFile()
+{
+#ifdef HAS_FILESYSTEM_RAR
+  if (!m_bOpen)
+    return;
+
+  if (m_bUseFile)
+  {
+    m_File.Close();
+    g_RarManager.ClearCachedFile(m_strRarPath,m_strPathInRar);
+  }
+  else
+  {
+    CleanUp();
+    if (m_pExtractThread)
+    {
+      delete m_pExtractThread;
+      m_pExtractThread = NULL;
+    }
+  }
+#endif
+}
+
+bool CRarFile::Open(const CURL& url)
+{
+  InitFromUrl(url);
+  CFileItemList items;
+  g_RarManager.GetFilesInRar(items,m_strRarPath,false);
+  int i;
+  for (i=0;i<items.Size();++i)
+  {
+    if (items[i]->GetLabel() == m_strPathInRar)
+      break;
+  }
+
+  if (i<items.Size())
+  {
+    if (items[i]->m_idepth == 0x30) // stored
+    {
+      if (!OpenInArchive())
+        return false;
+
+      m_iFileSize = items[i]->m_dwSize;
+      m_bOpen = true;
+
+      // perform 'noidx' check
+      CFileInfo* pFile = g_RarManager.GetFileInRar(m_strRarPath,m_strPathInRar);
+      if (pFile)
+      {
+        if (pFile->m_iIsSeekable == -1)
+        {
+          if (Seek(-1,SEEK_END) == -1)
+          {
+            m_bSeekable = false;
+            pFile->m_iIsSeekable = 0;
+          }
+        }
+        else
+          m_bSeekable = (pFile->m_iIsSeekable == 1);
+      }
+      return true;
+    }
+    else
+    {
+      CFileInfo* info = g_RarManager.GetFileInRar(m_strRarPath,m_strPathInRar);
+      if ((!info || !CFile::Exists(info->m_strCachedPath)) && m_bFileOptions & EXFILE_NOCACHE)
+        return false;
+      m_bUseFile = true;
+      CStdString strPathInCache;
+
+      if (!g_RarManager.CacheRarredFile(strPathInCache, m_strRarPath, m_strPathInRar,
+                                        EXFILE_AUTODELETE | m_bFileOptions, m_strCacheDir,
+                                        items[i]->m_dwSize))
+      {
+        CLog::Log(LOGERROR,"filerar::open failed to cache file %s",m_strPathInRar.c_str());
+        return false;
+      }
+
+      if (!m_File.Open( strPathInCache ))
+      {
+        CLog::Log(LOGERROR,"filerar::open failed to open file in cache: %s",strPathInCache.c_str());
+        return false;
+      }
+
+      m_bOpen = true;
+      return true;
+    }
+  }
+  return false;
+}
+
+bool CRarFile::Exists(const CURL& url)
+{
+  InitFromUrl(url);
+  bool bResult;
+
+  if (!g_RarManager.IsFileInRar(bResult, m_strRarPath, m_strPathInRar))
+    return false;
+
+  return bResult;
+}
+
+int CRarFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  memset(buffer, 0, sizeof(struct __stat64));
+  if (Open(url))
+  {
+    buffer->st_size = GetLength();
+    buffer->st_mode = _S_IFREG;
+    Close();
+    errno = 0;
+    return 0;
+  }
+
+  if (CDirectory::Exists(url.Get()))
+  {
+    buffer->st_mode = _S_IFDIR;
+    return 0;
+  }
+
+  errno = ENOENT;
+  return -1;
+}
+
+bool CRarFile::OpenForWrite(const CURL& url)
+{
+  return false;
+}
+
+unsigned int CRarFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+#ifdef HAS_FILESYSTEM_RAR
+  if (!m_bOpen)
+    return 0;
+
+  if (m_bUseFile)
+    return m_File.Read(lpBuf,uiBufSize);
+
+  if (m_iFilePosition >= GetLength()) // we are done
+    return 0;
+
+  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(5000) )
+  {
+    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
+    return 0;
+  }
+
+
+  byte* pBuf = (byte*)lpBuf;
+  int64_t uicBufSize = uiBufSize;
+  if (m_iDataInBuffer > 0)
+  {
+    int64_t iCopy = uiBufSize<m_iDataInBuffer?uiBufSize:m_iDataInBuffer;
+    memcpy(lpBuf,m_szStartOfBuffer,size_t(iCopy));
+    m_szStartOfBuffer += iCopy;
+    m_iDataInBuffer -= int(iCopy);
+    pBuf += iCopy;
+    uicBufSize -= iCopy;
+    m_iFilePosition += iCopy;
+  }
+
+  while ((uicBufSize > 0) && m_iFilePosition < GetLength() )
+  {
+    if (m_iDataInBuffer <= 0)
+    {
+      m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,MAXWINMEMSIZE);
+      m_szStartOfBuffer = m_szBuffer;
+      m_iBufferStart = m_iFilePosition;
+    }
+
+    m_pExtract->GetDataIO().hBufferFilled->Set();
+    m_pExtract->GetDataIO().hBufferEmpty->Wait();
+
+    if (m_pExtract->GetDataIO().NextVolumeMissing)
+      break;
+
+    m_iDataInBuffer = MAXWINMEMSIZE-m_pExtract->GetDataIO().UnpackToMemorySize;
+
+    if (m_iDataInBuffer == 0)
+      break;
+
+    if (m_iDataInBuffer > uicBufSize)
+    {
+      memcpy(pBuf,m_szStartOfBuffer,int(uicBufSize));
+      m_szStartOfBuffer += uicBufSize;
+      pBuf += int(uicBufSize);
+      m_iFilePosition += uicBufSize;
+      m_iDataInBuffer -= int(uicBufSize);
+      uicBufSize = 0;
+    }
+    else
+    {
+      memcpy(pBuf,m_szStartOfBuffer,size_t(m_iDataInBuffer));
+      m_iFilePosition += m_iDataInBuffer;
+      m_szStartOfBuffer += m_iDataInBuffer;
+      uicBufSize -= m_iDataInBuffer;
+      pBuf += m_iDataInBuffer;
+      m_iDataInBuffer = 0;
+    }
+  }
+
+  m_pExtract->GetDataIO().hBufferEmpty->Set();
+
+  return static_cast<unsigned int>(uiBufSize-uicBufSize);
+#else
+  return 0;
+#endif
+}
+
+unsigned int CRarFile::Write(void *lpBuf, int64_t uiBufSize)
+{
+  return 0;
+}
+
+void CRarFile::Close()
+{
+#ifdef HAS_FILESYSTEM_RAR
+  if (!m_bOpen)
+    return;
+
+  if (m_bUseFile)
+  {
+    m_File.Close();
+    g_RarManager.ClearCachedFile(m_strRarPath,m_strPathInRar);
+    m_bOpen = false;
+  }
+  else
+  {
+    CleanUp();
+    if (m_pExtractThread)
+    {
+      delete m_pExtractThread;
+      m_pExtractThread = NULL;
+    }
+    m_bOpen = false;
+  }
+#endif
+}
+
+int64_t CRarFile::Seek(int64_t iFilePosition, int iWhence)
+{
+#ifdef HAS_FILESYSTEM_RAR
+  if (!m_bOpen)
+    return -1;
+
+  if (!m_bSeekable)
+    return -1;
+
+  if (m_bUseFile)
+    return m_File.Seek(iFilePosition,iWhence);
+
+  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
+  {
+    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
+    return -1;
+  }
+
+  m_pExtract->GetDataIO().hBufferEmpty->Set();
+
+  switch (iWhence)
+  {
+    case SEEK_CUR:
+      if (iFilePosition == 0)
+        return m_iFilePosition; // happens sometimes
+
+      iFilePosition += m_iFilePosition;
+      break;
+    case SEEK_END:
+      if (iFilePosition == 0) // do not seek to end
+      {
+        m_iFilePosition = this->GetLength();
+        m_iDataInBuffer = 0;
+        m_iBufferStart = this->GetLength();
+
+        return this->GetLength();
+      }
+
+      iFilePosition += GetLength();
+    case SEEK_SET:
+      break;
+    default:
+      return -1;
+  }
+
+  if (iFilePosition > this->GetLength())
+    return -1;
+
+  if (iFilePosition == m_iFilePosition) // happens a lot
+    return m_iFilePosition;
+
+  if ((iFilePosition >= m_iBufferStart) && (iFilePosition < m_iBufferStart+MAXWINMEMSIZE)
+                                        && (m_iDataInBuffer > 0)) // we are within current buffer
+  {
+    m_iDataInBuffer = MAXWINMEMSIZE-(iFilePosition-m_iBufferStart);
+    m_szStartOfBuffer = m_szBuffer+MAXWINMEMSIZE-m_iDataInBuffer;
+    m_iFilePosition = iFilePosition;
+
+    return m_iFilePosition;
+  }
+
+  if (iFilePosition < m_iBufferStart )
+  {
+    CleanUp();
+    if (!OpenInArchive())
+      return -1;
+
+    if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
+    {
+      CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
+      return -1;
+    }
+    m_pExtract->GetDataIO().hBufferEmpty->Set();
+    m_pExtract->GetDataIO().m_iSeekTo = iFilePosition;
+  }
+  else
+    m_pExtract->GetDataIO().m_iSeekTo = iFilePosition;
+
+  m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,MAXWINMEMSIZE);
+  m_pExtract->GetDataIO().hSeek->Set();
+  m_pExtract->GetDataIO().hBufferFilled->Set();
+  if( !m_pExtract->GetDataIO().hSeekDone->WaitMSec(SEEKTIMOUT))
+  {
+    CLog::Log(LOGERROR, "%s - Timeout waiting for seek to finish", __FUNCTION__);
+    return -1;
+  }
+
+  if (m_pExtract->GetDataIO().NextVolumeMissing)
+  {
+    m_iFilePosition = m_iFileSize;
+    return -1;
+  }
+
+  if( !m_pExtract->GetDataIO().hBufferEmpty->WaitMSec(SEEKTIMOUT) )
+  {
+    CLog::Log(LOGERROR, "%s - Timeout waiting for buffer to empty", __FUNCTION__);
+    return -1;
+  }
+  m_iDataInBuffer = m_pExtract->GetDataIO().m_iSeekTo; // keep data
+  m_iBufferStart = m_pExtract->GetDataIO().m_iStartOfBuffer;
+  m_szStartOfBuffer = m_szBuffer+MAXWINMEMSIZE-m_iDataInBuffer;
+  m_iFilePosition = iFilePosition;
+
+  return m_iFilePosition;
+#else
+  return -1;
+#endif
+}
+
+int64_t CRarFile::GetLength()
+{
+  if (!m_bOpen)
+    return 0;
+
+  if (m_bUseFile)
+    return m_File.GetLength();
+
+  return m_iFileSize;
+}
+
+int64_t CRarFile::GetPosition()
+{
+  if (!m_bOpen)
+    return -1;
+
+  if (m_bUseFile)
+    return m_File.GetPosition();
+
+  return m_iFilePosition;
+}
+
+int CRarFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  return -1;
+}
+
+void CRarFile::Flush()
+{
+  if (m_bUseFile)
+    m_File.Flush();
+}
+
+void CRarFile::InitFromUrl(const CURL& url)
+{
+  m_strCacheDir = g_advancedSettings.m_cachePath;//url.GetDomain();
+  URIUtils::AddSlashAtEnd(m_strCacheDir);
+  m_strRarPath = url.GetHostName();
+  m_strPassword = url.GetUserName();
+  m_strPathInRar = url.GetFileName();
+
+  vector<CStdString> options;
+  CUtil::Tokenize(url.GetOptions().Mid(1), options, "&");
+
+  m_bFileOptions = 0;
+
+  for( vector<CStdString>::iterator it = options.begin();it != options.end(); it++)
+  {
+    int iEqual = (*it).Find('=');
+    if( iEqual >= 0 )
+    {
+      CStdString strOption = (*it).Left(iEqual);
+      CStdString strValue = (*it).Mid(iEqual+1);
+
+      if( strOption.Equals("flags") )
+        m_bFileOptions = atoi(strValue.c_str());
+      else if( strOption.Equals("cache") )
+        m_strCacheDir = strValue;
+    }
+  }
+
+}
+
+void CRarFile::CleanUp()
+{
+#ifdef HAS_FILESYSTEM_RAR
+  try
+  {
+    if (m_pExtractThread)
+    {
+      if (m_pExtractThread->hRunning.WaitMSec(1))
+      {
+        m_pExtract->GetDataIO().hQuit->Set();
+        while (m_pExtractThread->hRunning.WaitMSec(1))
+          Sleep(1);
+      }
+      delete m_pExtract->GetDataIO().hBufferFilled;
+      delete m_pExtract->GetDataIO().hBufferEmpty;
+      delete m_pExtract->GetDataIO().hSeek;
+      delete m_pExtract->GetDataIO().hSeekDone;
+      delete m_pExtract->GetDataIO().hQuit;
+    }
+    if (m_pExtract)
+    {
+      delete m_pExtract;
+      m_pExtract = NULL;
+    }
+    if (m_pArc)
+    {
+      delete m_pArc;
+      m_pArc = NULL;
+    }
+    if (m_pCmd)
+    {
+      delete m_pCmd;
+      m_pCmd = NULL;
+    }
+    if (m_szBuffer)
+    {
+      delete[] m_szBuffer;
+      m_szBuffer = NULL;
+      m_szStartOfBuffer = NULL;
+    }
+  }
+  catch (int rarErrCode)
+  {
+    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while deleting CFileRar with an UnrarXLib error code of %d",rarErrCode);
+  }
+  catch (...)
+  {
+    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while deleting CFileRar with an Unknown exception");
+  }
+#endif
+}
+
+bool CRarFile::OpenInArchive()
+{
+#ifdef HAS_FILESYSTEM_RAR
+  try
+  {
+    int iHeaderSize;
+
+    InitCRC();
+
+    m_pCmd = new CommandData;
+    if (!m_pCmd)
+    {
+      CleanUp();
+      return false;
+    }
+
+    // Set the arguments for the extract command
+    strcpy(m_pCmd->Command, "X");
+
+    m_pCmd->AddArcName(const_cast<char*>(m_strRarPath.c_str()),NULL);
+
+    strncpy(m_pCmd->ExtrPath, m_strCacheDir.c_str(), sizeof (m_pCmd->ExtrPath) - 2);
+    m_pCmd->ExtrPath[sizeof (m_pCmd->ExtrPath) - 2] = 0;
+    AddEndSlash(m_pCmd->ExtrPath);
+
+    // Set password for encrypted archives
+    if ((m_strPassword.size() > 0) &&
+        (m_strPassword.size() < sizeof (m_pCmd->Password)))
+    {
+      strcpy(m_pCmd->Password, m_strPassword.c_str());
+    }
+
+    m_pCmd->ParseDone();
+
+    // Open the archive
+    m_pArc = new Archive(m_pCmd);
+    if (!m_pArc)
+    {
+      CleanUp();
+      return false;
+    }
+    if (!m_pArc->WOpen(m_strRarPath.c_str(),NULL))
+    {
+      CleanUp();
+      return false;
+    }
+    if (!(m_pArc->IsOpened() && m_pArc->IsArchive(true)))
+    {
+      CleanUp();
+      return false;
+    }
+
+    m_pExtract = new CmdExtract;
+    if (!m_pExtract)
+    {
+      CleanUp();
+      return false;
+    }
+    m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,0);
+    m_pExtract->GetDataIO().SetCurrentCommand(*(m_pCmd->Command));
+    struct FindData FD;
+    if (FindFile::FastFind(m_strRarPath.c_str(),NULL,&FD))
+      m_pExtract->GetDataIO().TotalArcSize+=FD.Size;
+    m_pExtract->ExtractArchiveInit(m_pCmd,*m_pArc);
+
+    while (true)
+    {
+      if ((iHeaderSize = m_pArc->ReadHeader()) <= 0)
+      {
+        CleanUp();
+        return false;
+      }
+
+      if (m_pArc->GetHeaderType() == FILE_HEAD)
+      {
+        CStdString strFileName;
+
+        if (m_pArc->NewLhd.FileNameW && wcslen(m_pArc->NewLhd.FileNameW) > 0)
+        {
+          g_charsetConverter.wToUTF8(m_pArc->NewLhd.FileNameW, strFileName);
+        }
+        else
+        {
+          g_charsetConverter.unknownToUTF8(m_pArc->NewLhd.FileName, strFileName);
+        }
+
+        /* replace back slashes into forward slashes */
+        /* this could get us into troubles, file could two different files, one with / and one with \ */
+        strFileName.Replace('\\', '/');
+
+        if (strFileName == m_strPathInRar)
+        {
+          break;
+        }
+      }
+
+      m_pArc->SeekToNext();
+    }
+
+    m_szBuffer = new byte[MAXWINMEMSIZE];
+    m_szStartOfBuffer = m_szBuffer;
+    m_pExtract->GetDataIO().SetUnpackToMemory(m_szBuffer,0);
+    m_iDataInBuffer = -1;
+    m_iFilePosition = 0;
+    m_iBufferStart = 0;
+
+    delete m_pExtractThread;
+    m_pExtractThread = new CRarFileExtractThread();
+    m_pExtractThread->Start(m_pArc,m_pCmd,m_pExtract,iHeaderSize);
+
+    return true;
+  }
+  catch (int rarErrCode)
+  {
+    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while CFileRar::OpenInArchive with an UnrarXLib error code of %d",rarErrCode);
+    return false;
+  }
+  catch (...)
+  {
+    CLog::Log(LOGERROR,"filerar failed in UnrarXLib while CFileRar::OpenInArchive with an Unknown exception");
+    return false;
+  }
+#else
+  return false;
+#endif
+}
+
diff --git a/xbmc/filesystem/RarFile.h b/xbmc/filesystem/RarFile.h
new file mode 100644 (file)
index 0000000..30beab4
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileRar.h: interface for the CRarFile class.
+
+#pragma once
+#ifndef FILERAR_H_
+#define FILERAR_H_
+
+#include "File.h"
+#include "threads/Thread.h"
+#include "threads/Event.h"
+
+class CmdExtract;
+class CommandData;
+class Archive;
+
+namespace XFILE
+{
+#ifdef HAS_FILESYSTEM_RAR
+  class CRarFileExtractThread : public CThread
+  {
+  public:
+    CRarFileExtractThread();
+    ~CRarFileExtractThread();
+
+    void Start(Archive* pArc, CommandData* pCmd, CmdExtract* pExtract, int iSize);
+
+    virtual void OnStartup();
+    virtual void OnExit();
+    virtual void Process();
+
+    CEvent hRunning;
+    CEvent hRestart;
+    CEvent hQuit;
+
+  protected:
+    Archive* m_pArc;
+    CommandData* m_pCmd;
+    CmdExtract* m_pExtract;
+    int m_iSize;
+  };
+#endif
+
+  class CRarFile : public IFile
+  {
+  public:
+    CRarFile();
+    CRarFile(bool bSeekable); // used for caching files
+    virtual ~CRarFile();
+    virtual int64_t       GetPosition();
+    virtual int64_t       GetLength();
+    virtual bool          Open(const CURL& url);
+    virtual bool          Exists(const CURL& url);
+    virtual int           Stat(const CURL& url, struct __stat64* buffer);
+    virtual unsigned int  Read(void* lpBuf, int64_t uiBufSize);
+    virtual int           Write(const void* lpBuf, int64_t uiBufSize);
+    virtual int64_t       Seek(int64_t iFilePosition, int iWhence=SEEK_SET);
+    virtual void          Close();
+    virtual void          Flush();
+
+    virtual bool          OpenForWrite(const CURL& url);
+    unsigned int          Write(void *lpBuf, int64_t uiBufSize);
+
+  protected:
+    CStdString m_strCacheDir;
+    CStdString m_strRarPath;
+    CStdString m_strPassword;
+    CStdString m_strPathInRar;
+    BYTE m_bFileOptions;
+    void Init();
+    void InitFromUrl(const CURL& url);
+    bool OpenInArchive();
+    void CleanUp();
+
+    int64_t m_iFilePosition;
+    int64_t m_iFileSize;
+    // rar stuff
+    bool m_bUseFile;
+    bool m_bOpen;
+    bool m_bSeekable;
+    CFile m_File; // for packed source
+#ifdef HAS_FILESYSTEM_RAR
+    Archive* m_pArc;
+    CommandData* m_pCmd;
+    CmdExtract* m_pExtract;
+    CRarFileExtractThread* m_pExtractThread;
+#endif
+    byte* m_szBuffer;
+    byte* m_szStartOfBuffer;
+    int64_t m_iDataInBuffer;
+    int64_t m_iBufferStart;
+  };
+
+}
+
+#endif  // FILERAR_H_
+
index a0eb1a4..8a50ea5 100644 (file)
@@ -23,7 +23,7 @@
 #include "system.h"
 #ifdef HAS_FILESYSTEM_SFTP
 #include "IDirectory.h"
-#include "FileSFTP.h"
+#include "SFTPFile.h"
 
 class CURL;
 class TiXmlElement;
diff --git a/xbmc/filesystem/SFTPFile.cpp b/xbmc/filesystem/SFTPFile.cpp
new file mode 100644 (file)
index 0000000..a948b4f
--- /dev/null
@@ -0,0 +1,615 @@
+/*
+ *      Copyright (C) 2005-2010 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "threads/SystemClock.h"
+#include "SFTPFile.h"
+#ifdef HAS_FILESYSTEM_SFTP
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/TimeUtils.h"
+#include "utils/Variant.h"
+#include "Util.h"
+#include <fcntl.h>
+#include <sstream>
+
+#ifdef _WIN32
+#pragma comment(lib, "ssh.lib")
+#endif
+
+#ifdef _MSC_VER
+#define O_RDONLY _O_RDONLY
+#endif
+
+using namespace XFILE;
+using namespace std;
+
+
+static CStdString CorrectPath(const CStdString path)
+{
+  if(path == "~" || path.Left(2) == "~/")
+    return "./" + path.Mid(2);
+  else
+    return "/" + path;
+}
+
+CSFTPSession::CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
+{
+  CLog::Log(LOGINFO, "SFTPSession: Creating new session on host '%s:%d' with user '%s'", host.c_str(), port, username.c_str());
+  CSingleLock lock(m_critSect);
+  if (!Connect(host, port, username, password))
+    Disconnect();
+
+  m_LastActive = XbmcThreads::SystemClockMillis();
+}
+
+CSFTPSession::~CSFTPSession()
+{
+  CSingleLock lock(m_critSect);
+  Disconnect();
+}
+
+sftp_file CSFTPSession::CreateFileHande(const CStdString &file)
+{
+  if (m_connected)
+  {
+    CSingleLock lock(m_critSect);
+    m_LastActive = XbmcThreads::SystemClockMillis();
+    sftp_file handle = sftp_open(m_sftp_session, CorrectPath(file).c_str(), O_RDONLY, 0);
+    if (handle)
+    {
+      sftp_file_set_blocking(handle);
+      return handle;
+    }
+    else
+      CLog::Log(LOGERROR, "SFTPSession: Was connected but couldn't create filehandle\n");
+  }
+  else
+    CLog::Log(LOGERROR, "SFTPSession: Not connected and can't create file handle");
+
+  return NULL;
+}
+
+void CSFTPSession::CloseFileHandle(sftp_file handle)
+{
+  CSingleLock lock(m_critSect);
+  sftp_close(handle);
+}
+
+bool CSFTPSession::GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items)
+{
+  if (m_connected)
+  {
+    sftp_dir dir = NULL;
+
+    {
+      CSingleLock lock(m_critSect);
+      m_LastActive = XbmcThreads::SystemClockMillis();
+      dir = sftp_opendir(m_sftp_session, CorrectPath(folder).c_str());
+    }
+
+    if (dir)
+    {
+      bool read = true;
+      while (read)
+      {
+        sftp_attributes attributes = NULL;
+
+        {
+          CSingleLock lock(m_critSect);
+          read = sftp_dir_eof(dir) == 0;
+          attributes = sftp_readdir(m_sftp_session, dir);
+        }
+
+        if (attributes && (attributes->name == NULL || strcmp(attributes->name, "..") == 0 || strcmp(attributes->name, ".") == 0))
+        {
+          CSingleLock lock(m_critSect);
+          sftp_attributes_free(attributes);
+          continue;
+        }
+        
+        if (attributes)
+        {
+          CStdString itemName = attributes->name;
+          CStdString localPath = folder;
+          localPath.append(itemName);
+
+          if (attributes->type == SSH_FILEXFER_TYPE_SYMLINK)
+          {
+            CSingleLock lock(m_critSect);
+            sftp_attributes_free(attributes);
+            attributes = sftp_stat(m_sftp_session, CorrectPath(localPath).c_str());
+            if (attributes == NULL)
+              continue;
+          }
+
+          CFileItemPtr pItem(new CFileItem);
+          pItem->SetLabel(itemName);
+
+          if (itemName[0] == '.')
+            pItem->SetProperty("file:hidden", true);
+
+          if (attributes->flags & SSH_FILEXFER_ATTR_ACMODTIME)
+            pItem->m_dateTime = attributes->mtime;
+
+          if (attributes->type & SSH_FILEXFER_TYPE_DIRECTORY)
+          {
+            localPath.append("/");
+            pItem->m_bIsFolder = true;
+            pItem->m_dwSize = 0;
+          }
+          else
+          {
+            pItem->m_dwSize = attributes->size;
+          }
+
+          pItem->SetPath(base + localPath);
+          items.Add(pItem);
+
+          {
+            CSingleLock lock(m_critSect);
+            sftp_attributes_free(attributes);
+          }
+        }
+        else
+          read = false;
+      }
+
+      {
+        CSingleLock lock(m_critSect);
+        sftp_closedir(dir);
+      }
+
+      return true;
+    }
+  }
+  else
+    CLog::Log(LOGERROR, "SFTPSession: Not connected, can't list directory");
+
+  return false;
+}
+
+bool CSFTPSession::Exists(const char *path)
+{
+  bool exists = false;
+  CSingleLock lock(m_critSect);
+  if(m_connected)
+  {
+    sftp_attributes attributes = sftp_stat(m_sftp_session, CorrectPath(path).c_str());
+    exists = attributes != NULL;
+
+    if (attributes)
+      sftp_attributes_free(attributes);
+  }
+  return exists;
+}
+
+int CSFTPSession::Stat(const char *path, struct __stat64* buffer)
+{
+  CSingleLock lock(m_critSect);
+  if(m_connected)
+  {
+    m_LastActive = XbmcThreads::SystemClockMillis();
+    sftp_attributes attributes = sftp_stat(m_sftp_session, CorrectPath(path).c_str());
+
+    if (attributes)
+    {
+      memset(buffer, 0, sizeof(struct __stat64));
+      buffer->st_size = attributes->size;
+      buffer->st_mtime = attributes->mtime;
+      buffer->st_atime = attributes->atime;
+
+      sftp_attributes_free(attributes);
+      return 0;
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "SFTPSession: STAT - Failed to get attributes");
+      return -1;
+    }
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "SFTPSession: STAT - Not connected");
+    return -1;
+  }
+}
+
+int CSFTPSession::Seek(sftp_file handle, uint64_t position)
+{
+  CSingleLock lock(m_critSect);
+  m_LastActive = XbmcThreads::SystemClockMillis();
+  return sftp_seek64(handle, position);
+}
+
+int CSFTPSession::Read(sftp_file handle, void *buffer, size_t length)
+{
+  CSingleLock lock(m_critSect);
+  m_LastActive = XbmcThreads::SystemClockMillis();
+  return sftp_read(handle, buffer, length);
+}
+
+int64_t CSFTPSession::GetPosition(sftp_file handle)
+{
+  CSingleLock lock(m_critSect);
+  m_LastActive = XbmcThreads::SystemClockMillis();
+  return sftp_tell64(handle);
+}
+
+bool CSFTPSession::IsIdle()
+{
+  return (XbmcThreads::SystemClockMillis() - m_LastActive) > 90000;
+}
+
+bool CSFTPSession::VerifyKnownHost(ssh_session session)
+{
+  switch (ssh_is_server_known(session))
+  {
+    case SSH_SERVER_KNOWN_OK:
+      return true;
+    case SSH_SERVER_KNOWN_CHANGED:
+      CLog::Log(LOGERROR, "SFTPSession: Server that was known has changed");
+      return false;
+    case SSH_SERVER_FOUND_OTHER:
+      CLog::Log(LOGERROR, "SFTPSession: The host key for this server was not found but an other type of key exists. An attacker might change the default server key to confuse your client into thinking the key does not exist");
+      return false;
+    case SSH_SERVER_FILE_NOT_FOUND:
+      CLog::Log(LOGINFO, "SFTPSession: Server file was not found, creating a new one");
+    case SSH_SERVER_NOT_KNOWN:
+      CLog::Log(LOGINFO, "SFTPSession: Server unkown, we trust it for now");
+      if (ssh_write_knownhost(session) < 0)
+      {
+        CLog::Log(LOGERROR, "CSFTPSession: Failed to save host '%s'", strerror(errno));
+        return false;
+      }
+
+      return true;
+    case SSH_SERVER_ERROR:
+      CLog::Log(LOGERROR, "SFTPSession: Failed to verify host '%s'", ssh_get_error(session));
+      return false;
+  }
+
+  return false;
+}
+
+bool CSFTPSession::Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
+{
+  int timeout     = SFTP_TIMEOUT;
+  m_connected     = false;
+  m_session       = NULL;
+  m_sftp_session  = NULL;
+
+  m_session=ssh_new();
+  if (m_session == NULL)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to initialize session");
+    return false;
+  }
+
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,4,0)
+  if (ssh_options_set(m_session, SSH_OPTIONS_USER, username.c_str()) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set username '%s' for session", username.c_str());
+    return false;
+  }
+
+  if (ssh_options_set(m_session, SSH_OPTIONS_HOST, host.c_str()) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set host '%s' for session", host.c_str());
+    return false;
+  }
+
+  if (ssh_options_set(m_session, SSH_OPTIONS_PORT, &port) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set port '%d' for session", port);
+    return false;
+  }
+
+  ssh_options_set(m_session, SSH_OPTIONS_LOG_VERBOSITY, 0);
+  ssh_options_set(m_session, SSH_OPTIONS_TIMEOUT, &timeout);  
+#else
+  SSH_OPTIONS* options = ssh_options_new();
+
+  if (ssh_options_set_username(options, username.c_str()) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set username '%s' for session", username.c_str());
+    return false;
+  }
+
+  if (ssh_options_set_host(options, host.c_str()) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set host '%s' for session", host.c_str());
+    return false;
+  }
+
+  if (ssh_options_set_port(options, port) < 0)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to set port '%d' for session", port);
+    return false;
+  }
+  
+  ssh_options_set_timeout(options, timeout, 0);
+
+  ssh_options_set_log_verbosity(options, 0);
+
+  ssh_set_options(m_session, options);
+#endif
+
+  if(ssh_connect(m_session))
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to connect '%s'", ssh_get_error(m_session));
+    return false;
+  }
+
+  if (!VerifyKnownHost(m_session))
+    return false;
+
+
+  int noAuth = SSH_AUTH_DENIED;
+  if ((noAuth = ssh_userauth_none(m_session, NULL)) == SSH_AUTH_ERROR)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via guest '%s'", ssh_get_error(m_session));
+    return false;
+  }
+
+  int method = ssh_auth_list(m_session);
+
+  // Try to authenticate with public key first
+  int publicKeyAuth = SSH_AUTH_DENIED;
+  if (method & SSH_AUTH_METHOD_PUBLICKEY && (publicKeyAuth = ssh_userauth_autopubkey(m_session, NULL)) == SSH_AUTH_ERROR)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via publickey '%s'", ssh_get_error(m_session));
+    return false;
+  }
+
+  // Try to authenticate with password
+  int passwordAuth = SSH_AUTH_DENIED;
+  if (method & SSH_AUTH_METHOD_PASSWORD && publicKeyAuth != SSH_AUTH_SUCCESS && (passwordAuth = ssh_userauth_password(m_session, username.c_str(), password.c_str())) == SSH_AUTH_ERROR)
+  {
+    CLog::Log(LOGERROR, "SFTPSession: Failed to authenticate via password '%s'", ssh_get_error(m_session));
+    return false;
+  }
+
+  if (noAuth == SSH_AUTH_SUCCESS || publicKeyAuth == SSH_AUTH_SUCCESS || passwordAuth == SSH_AUTH_SUCCESS)
+  {
+    m_sftp_session = sftp_new(m_session);
+
+    if (m_sftp_session == NULL)
+    {
+      CLog::Log(LOGERROR, "SFTPSession: Failed to initialize channel '%s'", ssh_get_error(m_session));
+      return false;
+    }
+
+    if (sftp_init(m_sftp_session))
+    {
+      CLog::Log(LOGERROR, "SFTPSession: Failed to initialize sftp '%s'", ssh_get_error(m_session));
+      return false;
+    }
+
+    m_connected = true;
+  }
+
+  return m_connected;
+}
+
+void CSFTPSession::Disconnect()
+{
+  if (m_sftp_session)
+    sftp_free(m_sftp_session);
+
+  if (m_session)
+    ssh_disconnect(m_session);
+
+  m_sftp_session = NULL;
+  m_session = NULL;
+}
+
+CCriticalSection CSFTPSessionManager::m_critSect;
+map<CStdString, CSFTPSessionPtr> CSFTPSessionManager::sessions;
+
+CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url)
+{
+  string username = url.GetUserName().c_str();
+  string password = url.GetPassWord().c_str();
+  string hostname = url.GetHostName().c_str();
+  unsigned int port = url.HasPort() ? url.GetPort() : 22;
+
+  return CSFTPSessionManager::CreateSession(hostname, port, username, password);
+}
+
+CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password)
+{
+  // Convert port number to string
+  stringstream itoa;
+  itoa << port;
+  CStdString portstr = itoa.str();
+
+  CSingleLock lock(m_critSect);
+  CStdString key = username + ":" + password + "@" + host + ":" + portstr;
+  CSFTPSessionPtr ptr = sessions[key];
+  if (ptr == NULL)
+  {
+    ptr = CSFTPSessionPtr(new CSFTPSession(host, port, username, password));
+    sessions[key] = ptr;
+  }
+
+  return ptr;
+}
+
+void CSFTPSessionManager::ClearOutIdleSessions()
+{
+  CSingleLock lock(m_critSect);
+  for(map<CStdString, CSFTPSessionPtr>::iterator iter = sessions.begin(); iter != sessions.end();)
+  {
+    if (iter->second->IsIdle())
+      sessions.erase(iter++);
+    else
+      iter++;
+  }
+}
+
+void CSFTPSessionManager::DisconnectAllSessions()
+{
+  CSingleLock lock(m_critSect);
+  sessions.clear();
+}
+
+CSFTPFile::CSFTPFile()
+{
+  m_sftp_handle = NULL;
+}
+
+CSFTPFile::~CSFTPFile()
+{
+  Close();
+}
+
+bool CSFTPFile::Open(const CURL& url)
+{
+  m_session = CSFTPSessionManager::CreateSession(url);
+  if (m_session)
+  {
+    m_file = url.GetFileName().c_str();
+    m_sftp_handle = m_session->CreateFileHande(m_file);
+
+    return (m_sftp_handle != NULL);
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "SFTPFile: Failed to allocate session");
+    return false;
+  }
+}
+
+void CSFTPFile::Close()
+{
+  if (m_session && m_sftp_handle)
+  {
+    m_session->CloseFileHandle(m_sftp_handle);
+    m_sftp_handle = NULL;
+    m_session = CSFTPSessionPtr();
+  }
+}
+
+int64_t CSFTPFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  if (m_session && m_sftp_handle)
+  {
+    uint64_t position = 0;
+    if (iWhence == SEEK_SET)
+      position = iFilePosition;
+    else if (iWhence == SEEK_CUR)
+      position = GetPosition() + iFilePosition;
+    else if (iWhence == SEEK_END)
+      position = GetLength() + iFilePosition;
+
+    if (m_session->Seek(m_sftp_handle, position) == 0)
+      return GetPosition();
+    else
+      return -1;
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "SFTPFile: Can't seek without a filehandle");
+    return -1;
+  }
+}
+
+unsigned int CSFTPFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  if (m_session && m_sftp_handle)
+  {
+    int rc = m_session->Read(m_sftp_handle, lpBuf, (size_t)uiBufSize);
+
+    if (rc >= 0)
+      return rc;
+    else
+      CLog::Log(LOGERROR, "SFTPFile: Failed to read %i", rc);
+  }
+  else
+    CLog::Log(LOGERROR, "SFTPFile: Can't read without a filehandle");
+
+  return 0;
+}
+
+bool CSFTPFile::Exists(const CURL& url)
+{
+  CSFTPSessionPtr session = CSFTPSessionManager::CreateSession(url);
+  if (session)
+    return session->Exists(url.GetFileName().c_str());
+  else
+  {
+    CLog::Log(LOGERROR, "SFTPFile: Failed to create session to check exists");
+    return false;
+  }
+}
+
+int CSFTPFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  CSFTPSessionPtr session = CSFTPSessionManager::CreateSession(url);
+  if (session)
+    return session->Stat(url.GetFileName().c_str(), buffer);
+  else
+  {
+    CLog::Log(LOGERROR, "SFTPFile: Failed to create session to stat");
+    return -1;
+  }
+}
+
+int CSFTPFile::Stat(struct __stat64* buffer)
+{
+  if (m_session)
+    return m_session->Stat(m_file.c_str(), buffer);
+
+  CLog::Log(LOGERROR, "SFTPFile: Can't stat without a session");
+  return -1;
+}
+
+int64_t CSFTPFile::GetLength()
+{
+  struct __stat64 buffer;
+  if (Stat(&buffer) != 0)
+    return 0;
+  else
+  {
+    int64_t length = buffer.st_size;
+    return length;
+  }
+}
+
+int64_t CSFTPFile::GetPosition()
+{
+  if (m_session && m_sftp_handle)
+    return m_session->GetPosition(m_sftp_handle);
+
+  CLog::Log(LOGERROR, "SFTPFile: Can't get position without a filehandle");
+  return 0;
+}
+
+int CSFTPFile::IoControl(EIoControl request, void* param)
+{
+  if(request == IOCTRL_SEEK_POSSIBLE)
+    return 1;
+
+  return -1;
+}
+
+#endif
diff --git a/xbmc/filesystem/SFTPFile.h b/xbmc/filesystem/SFTPFile.h
new file mode 100644 (file)
index 0000000..bf29db6
--- /dev/null
@@ -0,0 +1,117 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2010 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "system.h"
+#ifdef HAS_FILESYSTEM_SFTP
+#include "IFile.h"
+#include "URL.h"
+#include "FileItem.h"
+#include "threads/CriticalSection.h"
+
+#include <libssh/libssh.h>
+#include <libssh/sftp.h>
+#include <string>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0,3,2)
+#define ssh_session SSH_SESSION
+#endif
+
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0,4,0)
+#define sftp_file SFTP_FILE*
+#define sftp_session SFTP_SESSION*
+#define sftp_attributes SFTP_ATTRIBUTES*
+#define sftp_dir SFTP_DIR*
+#define ssh_session ssh_session*
+#endif
+
+//five secs timeout for SFTP
+#define SFTP_TIMEOUT 5
+
+class CSFTPSession
+{
+public:
+  CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
+  virtual ~CSFTPSession();
+
+  sftp_file CreateFileHande(const CStdString &file);
+  void CloseFileHandle(sftp_file handle);
+  bool GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items);
+  bool Exists(const char *path);
+  int Stat(const char *path, struct __stat64* buffer);
+  int Seek(sftp_file handle, uint64_t position);
+  int Read(sftp_file handle, void *buffer, size_t length);
+  int64_t GetPosition(sftp_file handle);
+  bool IsIdle();
+private:
+  bool VerifyKnownHost(ssh_session session);
+  bool Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
+  void Disconnect();
+  CCriticalSection m_critSect;
+
+  bool m_connected;
+  ssh_session  m_session;
+  sftp_session m_sftp_session;
+  int m_LastActive;
+};
+
+typedef boost::shared_ptr<CSFTPSession> CSFTPSessionPtr;
+
+class CSFTPSessionManager
+{
+public:
+  static CSFTPSessionPtr CreateSession(const CURL &url);
+  static CSFTPSessionPtr CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password);
+  static void ClearOutIdleSessions();
+  static void DisconnectAllSessions();
+private:
+  static CCriticalSection m_critSect;
+  static std::map<CStdString, CSFTPSessionPtr> sessions;
+};
+
+namespace XFILE
+{
+  class CSFTPFile : public IFile
+  {
+  public:
+    CSFTPFile();
+    virtual ~CSFTPFile();
+    virtual void Close();
+    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+    virtual bool Open(const CURL& url);
+    virtual bool Exists(const CURL& url);
+    virtual int Stat(const CURL& url, struct __stat64* buffer);
+    virtual int Stat(struct __stat64* buffer);
+    virtual int64_t GetLength();
+    virtual int64_t GetPosition();
+    virtual int     GetChunkSize() {return 1;};
+    virtual int     IoControl(EIoControl request, void* param);
+  private:
+    CStdString m_file;
+    CSFTPSessionPtr m_session;
+    sftp_file m_sftp_handle;
+  };
+}
+#endif
index 3232f6c..49fa7e5 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include "IDirectory.h"
-#include "FileSmb.h"
+#include "SmbFile.h"
 #include "MediaSource.h"
 
 namespace XFILE
diff --git a/xbmc/filesystem/ShoutcastFile.cpp b/xbmc/filesystem/ShoutcastFile.cpp
new file mode 100644 (file)
index 0000000..eeb461f
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+// FileShoutcast.cpp: implementation of the CShoutcastFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "threads/SystemClock.h"
+#include "system.h"
+#include "Application.h"
+#include "ShoutcastFile.h"
+#include "settings/GUISettings.h"
+#include "guilib/GUIWindowManager.h"
+#include "URL.h"
+#include "utils/RegExp.h"
+#include "utils/HTMLUtil.h"
+#include "utils/CharsetConverter.h"
+#include "utils/TimeUtils.h"
+#include "GUIInfoManager.h"
+#include "utils/log.h"
+
+using namespace XFILE;
+using namespace MUSIC_INFO;
+
+CShoutcastFile::CShoutcastFile()
+{
+  m_lastTime = XbmcThreads::SystemClockMillis();
+  m_discarded = 0;
+  m_currint = 0;
+  m_buffer = NULL;
+}
+
+CShoutcastFile::~CShoutcastFile()
+{
+  Close();
+}
+
+int64_t CShoutcastFile::GetPosition()
+{
+  return m_file.GetPosition()-m_discarded;
+}
+
+int64_t CShoutcastFile::GetLength()
+{
+  return 0;
+}
+
+bool CShoutcastFile::Open(const CURL& url)
+{
+  CURL url2(url);
+  url2.SetProtocolOptions("noshout=true&Icy-MetaData=1");
+  url2.SetProtocol("http");
+
+  bool result=false;
+  if ((result=m_file.Open(url2.Get())))
+  {
+    m_tag.SetTitle(m_file.GetHttpHeader().GetValue("icy-name"));
+    if (m_tag.GetTitle().IsEmpty())
+      m_tag.SetTitle(m_file.GetHttpHeader().GetValue("ice-name")); // icecast
+    m_tag.SetGenre(m_file.GetHttpHeader().GetValue("icy-genre"));
+    if (m_tag.GetGenre().IsEmpty())
+      m_tag.SetGenre(m_file.GetHttpHeader().GetValue("ice-genre")); // icecast
+    m_tag.SetLoaded(true);
+    g_infoManager.SetCurrentSongTag(m_tag);
+  }
+  m_metaint = atoi(m_file.GetHttpHeader().GetValue("icy-metaint").c_str());
+  if (!m_metaint)
+    m_metaint = -1;
+  m_buffer = new char[16*255];
+
+  return result;
+}
+
+unsigned int CShoutcastFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  if (m_currint >= m_metaint && m_metaint > 0)
+  {
+    unsigned char header;
+    m_file.Read(&header,1);
+    ReadTruncated(m_buffer, header*16);
+    ExtractTagInfo(m_buffer);
+    m_discarded += header*16+1;
+    m_currint = 0;
+  }
+  if (XbmcThreads::SystemClockMillis() - m_lastTime > 500)
+  {
+    m_lastTime = XbmcThreads::SystemClockMillis();
+    g_infoManager.SetCurrentSongTag(m_tag);
+  }
+
+  unsigned int toRead;
+  if (m_metaint > 0)
+    toRead = std::min((unsigned int)uiBufSize,(unsigned int)m_metaint-m_currint);
+  else
+    toRead = std::min((unsigned int)uiBufSize,(unsigned int)16*255);
+  toRead = m_file.Read(lpBuf,toRead);
+  m_currint += toRead;
+  return toRead;
+}
+
+int64_t CShoutcastFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  return -1;
+}
+
+void CShoutcastFile::Close()
+{
+  delete[] m_buffer;
+  m_file.Close();
+}
+
+void CShoutcastFile::ExtractTagInfo(const char* buf)
+{
+  CStdString strBuffer = buf;
+  g_charsetConverter.unknownToUTF8(strBuffer);
+
+  CStdStringW wBuffer, wConverted;
+  g_charsetConverter.utf8ToW(strBuffer, wBuffer, false);
+  HTML::CHTMLUtil::ConvertHTMLToW(wBuffer, wConverted);
+  g_charsetConverter.wToUTF8(wConverted, strBuffer);
+
+  CRegExp reTitle(true);
+  reTitle.RegComp("StreamTitle=\'(.*?)\';");
+
+  if (reTitle.RegFind(strBuffer.c_str()) != -1)
+    m_tag.SetTitle(reTitle.GetReplaceString("\\1"));
+}
+
+void CShoutcastFile::ReadTruncated(char* buf2, int size)
+{
+  char* buf = buf2;
+  while (size > 0)
+  {
+    int read = m_file.Read(buf,size);
+    size -= read;
+    buf += read;
+  }
+}
+
diff --git a/xbmc/filesystem/ShoutcastFile.h b/xbmc/filesystem/ShoutcastFile.h
new file mode 100644 (file)
index 0000000..5068e57
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileShoutcast.h: interface for the CShoutcastFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "IFile.h"
+#include "CurlFile.h"
+#include "utils/StdString.h"
+#include "music/tags/MusicInfoTag.h"
+
+namespace XFILE
+{
+class CShoutcastFile : public IFile
+{
+public:
+  CShoutcastFile();
+  virtual ~CShoutcastFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url) { return true;};
+  virtual int Stat(const CURL& url, struct __stat64* buffer) { errno = ENOENT; return -1; };
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+protected:
+  void ExtractTagInfo(const char* buf);
+  void ReadTruncated(char* buf2, int size);
+
+  unsigned int m_lastTime;
+  CCurlFile m_file;
+  int m_metaint;
+  int m_discarded; // data used for tags
+  int m_currint;
+  char* m_buffer; // buffer used for tags
+  MUSIC_INFO::CMusicInfoTag m_tag;
+};
+}
+
diff --git a/xbmc/filesystem/Slingbox.cpp b/xbmc/filesystem/Slingbox.cpp
deleted file mode 100644 (file)
index d7e8763..0000000
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "FileItem.h"
-#include "Slingbox.h"
-#include "filesystem/File.h"
-#include "lib/SlingboxLib/SlingboxLib.h"
-#include "settings/Settings.h"
-#include "utils/log.h"
-#include "utils/XMLUtils.h"
-
-using namespace XFILE;
-using namespace std;
-
-CSlingboxDirectory::CSlingboxDirectory()
-{
-}
-
-CSlingboxDirectory::~CSlingboxDirectory()
-{
-}
-
-bool CSlingboxDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
-{
-  // Create generic Watch Slingbox item
-  CFileItemPtr item(new CFileItem(strPath, false));
-  item->SetLabel("Watch Slingbox");
-  item->SetLabelPreformated(true);
-  items.Add(item);
-
-  return true;
-}
-
-CSlingboxFile::CSlingboxFile()
-{
-  // Create the Slingbox object
-  m_pSlingbox = new CSlingbox();
-}
-
-CSlingboxFile::~CSlingboxFile()
-{
-  // Destroy the Slingbox object
-  delete m_pSlingbox;
-}
-
-bool CSlingboxFile::Open(const CURL& url)
-{
-  // Setup the IP/hostname and port (setup default port if none specified)
-  unsigned int uiPort;
-  if (url.HasPort())
-    uiPort = (unsigned int)url.GetPort();
-  else
-    uiPort = 5001;
-  m_pSlingbox->SetAddress(url.GetHostName(), uiPort);
-
-  // Prepare to connect to the Slingbox
-  bool bAdmin;
-  if (url.GetUserName().CompareNoCase("administrator") == 0)
-    bAdmin = true;
-  else if (url.GetUserName().CompareNoCase("viewer") == 0)
-    bAdmin = false;
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Invalid or no username specified for Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-    return false;
-  }
-
-  // Connect to the Slingbox
-  if (m_pSlingbox->Connect(bAdmin, url.GetPassWord()))
-  {
-    CLog::Log(LOGDEBUG, "%s - Sucessfully connected to Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error connecting to Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-    return false;
-  }
-
-  // Initialize the stream
-  if (m_pSlingbox->InitializeStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully initialized stream on Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error initializing stream on Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-    return false;
-  }
-
-  // Set correct input
-  if (url.GetFileNameWithoutPath() != "")
-  {
-    if (m_pSlingbox->SetInput(atoi(url.GetFileNameWithoutPath())))
-      CLog::Log(LOGDEBUG, "%s - Successfully requested change to input %i on Slingbox: %s",
-        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
-    else
-      CLog::Log(LOGERROR, "%s - Error requesting change to input %i on Slingbox: %s",
-        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
-  }
-
-  // Load the video settings
-  LoadSettings(url.GetHostName());
-
-  // Setup video options  
-  if (m_pSlingbox->StreamSettings((CSlingbox::Resolution)m_sSlingboxSettings.iVideoResolution,
-    m_sSlingboxSettings.iVideoBitrate, m_sSlingboxSettings.iVideoFramerate,
-    m_sSlingboxSettings.iVideoSmoothing, m_sSlingboxSettings.iAudioBitrate,
-    m_sSlingboxSettings.iIFrameInterval))
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully set stream options (resolution: %ix%i; "
-      "video bitrate: %i kbit/s; fps: %i; smoothing: %i%%; audio bitrate %i kbit/s; "
-      "I frame interval: %i) on Slingbox: %s", __FUNCTION__,
-      m_sSlingboxSettings.iVideoWidth, m_sSlingboxSettings.iVideoHeight,
-      m_sSlingboxSettings.iVideoBitrate, m_sSlingboxSettings.iVideoFramerate,
-      m_sSlingboxSettings.iVideoSmoothing, m_sSlingboxSettings.iAudioBitrate,
-      m_sSlingboxSettings.iIFrameInterval, url.GetHostName().c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error setting stream options on Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-  }
-
-  // Start the stream
-  if (m_pSlingbox->StartStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully started stream on Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error starting stream on Slingbox: %s",
-      __FUNCTION__, url.GetHostName().c_str());
-    return false;
-  }
-
-  // Check for correct input
-  if (url.GetFileNameWithoutPath() != "")
-  {
-    if (m_pSlingbox->GetInput() == -1)
-      CLog::Log(LOGDEBUG, "%s - Unable to confirm change to input %i on Slingbox: %s",
-        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
-    else if (m_pSlingbox->GetInput() == atoi(url.GetFileNameWithoutPath()))
-      CLog::Log(LOGDEBUG, "%s - Comfirmed change to input %i on Slingbox: %s",
-        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
-    else
-      CLog::Log(LOGERROR, "%s - Error changing to input %i on Slingbox: %s",
-        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
-  }
-
-  return true;
-}
-
-unsigned int CSlingboxFile::Read(void * pBuffer, int64_t iSize)
-{
-  // Read the data and check for any errors
-  int iRead = m_pSlingbox->ReadStream(pBuffer, (unsigned int)iSize);
-  if (iRead < 0)
-  {
-    CLog::Log(LOGERROR, "%s - Error reading stream from Slingbox: %s", __FUNCTION__,
-      m_sSlingboxSettings.strHostname.c_str());
-    return 0;
-  }
-
-  return iRead;
-}
-
-void CSlingboxFile::Close()
-{
-  // Stop the stream
-  if (m_pSlingbox->StopStream())
-    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream on Slingbox: %s", __FUNCTION__,
-    m_sSlingboxSettings.strHostname.c_str());
-  else
-    CLog::Log(LOGERROR, "%s - Error stopping stream on Slingbox: %s", __FUNCTION__,
-    m_sSlingboxSettings.strHostname.c_str());
-
-  // Disconnect from the Slingbox
-  if (m_pSlingbox->Disconnect())
-    CLog::Log(LOGDEBUG, "%s - Successfully disconnected from Slingbox: %s", __FUNCTION__,
-    m_sSlingboxSettings.strHostname.c_str());
-  else
-    CLog::Log(LOGERROR, "%s - Error disconnecting from Slingbox: %s", __FUNCTION__,
-    m_sSlingboxSettings.strHostname.c_str());
-}
-
-bool CSlingboxFile::SkipNext()
-{
-  return m_pSlingbox->IsConnected();
-}
-
-bool CSlingboxFile::NextChannel()
-{
-  // Prepare variables
-  bool bSuccess = true;
-  int iPrevChannel = m_pSlingbox->GetChannel();
-
-  // Stop the stream
-  if (m_pSlingbox->StopStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  // Figure out which method to use
-  if (m_sSlingboxSettings.uiCodeChannelUp == 0)
-  {
-    // Change the channel
-    if (m_pSlingbox->ChannelUp())
-    {
-      CLog::Log(LOGDEBUG, "%s - Successfully requested channel change on Slingbox: %s",
-        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-
-      if (m_pSlingbox->GetChannel() == -1)
-      {
-        CLog::Log(LOGDEBUG, "%s - Unable to confirm channel change on Slingbox: %s",
-          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-      }
-      else if (m_pSlingbox->GetChannel() != iPrevChannel)
-      {
-        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
-          __FUNCTION__, m_pSlingbox->GetChannel(), m_sSlingboxSettings.strHostname.c_str());
-      }
-      else
-      {
-        CLog::Log(LOGERROR, "%s - Error changing channel on Slingbox: %s",
-          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-        bSuccess = false;
-      }
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Error requesting channel change on Slingbox: %s",
-        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-      bSuccess = false;
-    }
-  }
-  else
-  {
-    // Change the channel using IR command
-    if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeChannelUp))
-    {
-      CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
-        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelUp,
-        m_sSlingboxSettings.strHostname.c_str());
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Error sending IR command (code: 0x%.2X) from "
-        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelUp,
-        m_sSlingboxSettings.strHostname.c_str());
-      bSuccess = false;
-    }
-  }
-
-  // Start the stream again
-  if (m_pSlingbox->StartStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error starting stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  return bSuccess;
-}
-
-bool CSlingboxFile::PrevChannel()
-{
-  // Prepare variables
-  bool bSuccess = true;
-  int iPrevChannel = m_pSlingbox->GetChannel();
-
-  // Stop the stream
-  if (m_pSlingbox->StopStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  // Figure out which method to use
-  if (m_sSlingboxSettings.uiCodeChannelDown == 0)
-  {
-    // Change the channel
-    if (m_pSlingbox->ChannelDown())
-    {
-      CLog::Log(LOGDEBUG, "%s - Successfully requested channel change on Slingbox: %s",
-        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-
-      if (m_pSlingbox->GetChannel() == -1)
-      {
-        CLog::Log(LOGDEBUG, "%s - Unable to confirm channel change on Slingbox: %s",
-          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-      }
-      else if (m_pSlingbox->GetChannel() != iPrevChannel)
-      {
-        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
-          __FUNCTION__, m_pSlingbox->GetChannel(), m_sSlingboxSettings.strHostname.c_str());
-      }
-      else
-      {
-        CLog::Log(LOGERROR, "%s - Error changing channel on Slingbox: %s",
-          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-        bSuccess = false;
-      }
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Error requesting channel change on Slingbox: %s",
-        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-      bSuccess = false;
-    }
-  }
-  else
-  {
-    // Change the channel using IR command
-    if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeChannelDown))
-    {
-      CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
-        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelDown,
-        m_sSlingboxSettings.strHostname.c_str());
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Error sending IR command (code: 0x%.2X) from "
-        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelDown,
-        m_sSlingboxSettings.strHostname.c_str());
-      bSuccess = false;
-    }
-  }    
-
-  // Start the stream again
-  if (m_pSlingbox->StartStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error starting Slingbox stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  return bSuccess;
-}
-
-bool CSlingboxFile::SelectChannel(unsigned int uiChannel)
-{
-  // Check if a channel change is required
-  if (m_pSlingbox->GetChannel() == (int)uiChannel)
-    return false;
-
-  // Prepare variables
-  bool bSuccess = true;
-
-  // Stop the stream
-  if (m_pSlingbox->StopStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  // Figure out which method to use
-  unsigned int uiButtonsWithCode = 0;
-  for (unsigned int i = 0; i < 10; i++)
-  {
-    if (m_sSlingboxSettings.uiCodeNumber[i] != 0)
-      uiButtonsWithCode++;
-  }
-  if (uiButtonsWithCode == 0)
-  {
-    // Change the channel
-    if (m_pSlingbox->SetChannel(uiChannel))
-    {
-      CLog::Log(LOGDEBUG, "%s - Successfully requested change to channel %i on Slingbox: %s",
-        __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
-
-      if (m_pSlingbox->GetChannel() == -1)
-      {
-        CLog::Log(LOGDEBUG, "%s - Unable to confirm change to channel %i on Slingbox: %s",
-          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
-      }
-      else if (m_pSlingbox->GetChannel() == (int)uiChannel)
-      {
-        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
-          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
-      }
-      else
-      {
-        CLog::Log(LOGERROR, "%s - Error changing to channel %i on Slingbox: %s",
-          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
-        bSuccess = false;
-      }
-    }
-    else
-    {
-      CLog::Log(LOGERROR, "%s - Error requesting change to channel %i on Slingbox: %s",
-        __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
-      bSuccess = false;
-    }
-  }
-  else if (uiButtonsWithCode == 10)
-  {
-    // Prepare variables
-    CStdString strDigits;
-    strDigits.Format("%u", uiChannel);
-    unsigned int uiNumberOfDigits = strDigits.GetLength();
-
-    // Change the channel using IR commands
-    for (unsigned int i = 0; i < uiNumberOfDigits; i++)
-    {
-      if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0']))
-      {
-        CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
-          "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0'],
-          m_sSlingboxSettings.strHostname.c_str());
-      }
-      else
-      {
-        CLog::Log(LOGDEBUG, "%s - Error sending IR command (code: 0x%.2X) from "
-          "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0'],
-          m_sSlingboxSettings.strHostname.c_str());
-        bSuccess = false;
-      }
-    }
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error requesting change to channel %i on Slingbox due to one or more "
-      "missing button codes from advancedsettings.xml for Slingbox: %s", __FUNCTION__, uiChannel,
-      m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  // Start the stream again
-  if (m_pSlingbox->StartStream())
-  {
-    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  }
-  else
-  {
-    CLog::Log(LOGERROR, "%s - Error starting stream after channel change request on "
-      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-    bSuccess = false;
-  }
-
-  return bSuccess;
-}
-
-void CSlingboxFile::LoadSettings(const CStdString& strHostname)
-{
-  // Load default settings
-  m_sSlingboxSettings.strHostname = strHostname;
-  m_sSlingboxSettings.iVideoWidth = 320;
-  m_sSlingboxSettings.iVideoHeight = 240;
-  m_sSlingboxSettings.iVideoResolution = (int)CSlingbox::RESOLUTION320X240;
-  m_sSlingboxSettings.iVideoBitrate = 704;
-  m_sSlingboxSettings.iVideoFramerate = 30;
-  m_sSlingboxSettings.iVideoSmoothing = 50;
-  m_sSlingboxSettings.iAudioBitrate = 64;
-  m_sSlingboxSettings.iIFrameInterval = 10;
-  m_sSlingboxSettings.uiCodeChannelUp = 0;
-  m_sSlingboxSettings.uiCodeChannelDown = 0;
-  for (unsigned int i = 0; i < 10; i++)
-    m_sSlingboxSettings.uiCodeNumber[i] = 0;
-
-  // Check if a SlingboxSettings.xml file exists
-  CStdString slingboxXMLFile = g_settings.GetUserDataItem("SlingboxSettings.xml");
-  if (!CFile::Exists(slingboxXMLFile))
-  {
-    CLog::Log(LOGNOTICE, "No SlingboxSettings.xml file (%s) found - using default settings",
-      slingboxXMLFile.c_str());
-    return;
-  }
-
-  // Load the XML file
-  TiXmlDocument slingboxXML;
-  if (!slingboxXML.LoadFile(slingboxXMLFile))
-  {
-    CLog::Log(LOGERROR, "%s - Error loading %s - line %d\n%s", __FUNCTION__, 
-      slingboxXMLFile.c_str(), slingboxXML.ErrorRow(), slingboxXML.ErrorDesc());
-    return;
-  }
-
-  // Check to make sure layout is correct
-  TiXmlElement * pRootElement = slingboxXML.RootElement();
-  if (!pRootElement || strcmpi(pRootElement->Value(), "slingboxsettings") != 0)
-  {
-    CLog::Log(LOGERROR, "%s - Error loading %s - no <slingboxsettings> node found",
-      __FUNCTION__, slingboxXMLFile.c_str());
-    return;
-  }
-
-  // Success so far
-  CLog::Log(LOGNOTICE, "Loaded SlingboxSettings.xml from %s", slingboxXMLFile.c_str());
-
-  // Search for the first settings that specify no hostname or match our hostname
-  TiXmlElement *pElement;
-  for (pElement = pRootElement->FirstChildElement("slingbox"); pElement;
-    pElement = pElement->NextSiblingElement("slingbox"))
-  {
-    if (pElement->Attribute("hostname") == NULL ||      
-      !m_sSlingboxSettings.strHostname.CompareNoCase(pElement->Attribute("hostname")))
-    {
-      // Load setting values
-      XMLUtils::GetInt(pElement, "width", m_sSlingboxSettings.iVideoWidth, 0, 640);
-      XMLUtils::GetInt(pElement, "height", m_sSlingboxSettings.iVideoHeight, 0, 480);
-      XMLUtils::GetInt(pElement, "videobitrate", m_sSlingboxSettings.iVideoBitrate, 50, 8000);
-      XMLUtils::GetInt(pElement, "framerate", m_sSlingboxSettings.iVideoFramerate, 1, 30);
-      XMLUtils::GetInt(pElement, "smoothing", m_sSlingboxSettings.iVideoSmoothing, 0, 100);
-      XMLUtils::GetInt(pElement, "audiobitrate", m_sSlingboxSettings.iAudioBitrate, 16, 96);
-      XMLUtils::GetInt(pElement, "iframeinterval", m_sSlingboxSettings.iIFrameInterval, 1, 30);
-
-      // Load any button code values
-      TiXmlElement * pCodes = pElement->FirstChildElement("buttons");
-      if (pCodes)
-      {
-        XMLUtils::GetHex(pCodes, "channelup", m_sSlingboxSettings.uiCodeChannelUp);
-        XMLUtils::GetHex(pCodes, "channeldown", m_sSlingboxSettings.uiCodeChannelDown);
-        XMLUtils::GetHex(pCodes, "zero", m_sSlingboxSettings.uiCodeNumber[0]);
-        XMLUtils::GetHex(pCodes, "one", m_sSlingboxSettings.uiCodeNumber[1]);
-        XMLUtils::GetHex(pCodes, "two", m_sSlingboxSettings.uiCodeNumber[2]);
-        XMLUtils::GetHex(pCodes, "three", m_sSlingboxSettings.uiCodeNumber[3]);
-        XMLUtils::GetHex(pCodes, "four", m_sSlingboxSettings.uiCodeNumber[4]);
-        XMLUtils::GetHex(pCodes, "five", m_sSlingboxSettings.uiCodeNumber[5]);
-        XMLUtils::GetHex(pCodes, "six", m_sSlingboxSettings.uiCodeNumber[6]);
-        XMLUtils::GetHex(pCodes, "seven", m_sSlingboxSettings.uiCodeNumber[7]);
-        XMLUtils::GetHex(pCodes, "eight", m_sSlingboxSettings.uiCodeNumber[8]);
-        XMLUtils::GetHex(pCodes, "nine", m_sSlingboxSettings.uiCodeNumber[9]);
-      }
-
-      break;
-    }
-  }
-
-  // Prepare our resolution enum mapping array
-  const struct
-  {
-    unsigned int uiWidth;
-    unsigned int uiHeight;
-    CSlingbox::Resolution eEnum;
-  } m_resolutionMap[11] = {
-    {0, 0, CSlingbox::NOVIDEO},
-    {128, 96, CSlingbox::RESOLUTION128X96},
-    {160, 120, CSlingbox::RESOLUTION160X120},
-    {176, 120, CSlingbox::RESOLUTION176X120},
-    {224, 176, CSlingbox::RESOLUTION224X176},
-    {256, 192, CSlingbox::RESOLUTION256X192},
-    {320, 240, CSlingbox::RESOLUTION320X240},
-    {352, 240, CSlingbox::RESOLUTION352X240},
-    {320, 480, CSlingbox::RESOLUTION320X480},
-    {640, 240, CSlingbox::RESOLUTION640X240},
-    {640, 480, CSlingbox::RESOLUTION640X480}
-  };
-
-  // See if the specified resolution matches something in our mapping array and
-  // setup things accordingly
-  for (unsigned int i = 0; i < 11; i++)
-  {
-    if (m_sSlingboxSettings.iVideoWidth == (int)m_resolutionMap[i].uiWidth &&
-      m_sSlingboxSettings.iVideoHeight == (int)m_resolutionMap[i].uiHeight)
-    {
-      m_sSlingboxSettings.iVideoResolution = (int)m_resolutionMap[i].eEnum;
-      return;
-    }
-  }
-
-  // If it didn't match anything setup safe defaults
-  CLog::Log(LOGERROR, "%s - Defaulting to 320x240 resolution due to invalid "
-    "resolution specified in SlingboxSettings.xml for Slingbox: %s",
-    __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
-  m_sSlingboxSettings.iVideoWidth = 320;
-  m_sSlingboxSettings.iVideoHeight = 240;
-  m_sSlingboxSettings.iVideoResolution = (int)CSlingbox::RESOLUTION320X240;
-}
diff --git a/xbmc/filesystem/Slingbox.h b/xbmc/filesystem/Slingbox.h
deleted file mode 100644 (file)
index 22ad11f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2011 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "IDirectory.h"
-#include "IFile.h"
-#include "ILiveTV.h"
-
-class CSlingbox;
-
-namespace XFILE
-{
-
-class CSlingboxDirectory
-  : public IDirectory
-{
-public:
-  CSlingboxDirectory();
-  virtual ~CSlingboxDirectory();
-
-  virtual bool IsAllowed(const CStdString &strFile) const    { return true; }
-  virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
-};
-
-class CSlingboxFile
-  : public IFile, ILiveTVInterface
-{
-public:
-  CSlingboxFile();
-  virtual ~CSlingboxFile();
-  virtual bool Open(const CURL& url);
-  virtual unsigned int Read(void * buffer, int64_t size);
-  virtual void Close();
-  virtual bool SkipNext();
-
-  virtual int GetStartTime()                                 { return 0; }
-  virtual int GetTotalTime()                                 { return 0; }
-  virtual int64_t GetLength()                                { return -1; }
-  virtual int64_t GetPosition()                              { return -1; }
-  virtual int64_t Seek(int64_t pos, int whence)              { return -1; }
-  virtual bool UpdateItem(CFileItem& item)                   { return false; }
-    
-  virtual bool Exists(const CURL& url)                       { return false; }
-  virtual int Stat(const CURL& url, struct __stat64* buffer) { return -1; }
-
-  virtual ILiveTVInterface * GetLiveTV()                     { return (ILiveTVInterface *)this; }
-
-  virtual bool NextChannel();
-  virtual bool PrevChannel();
-  virtual bool SelectChannel(unsigned int uiChannel);
-
-protected:
-  struct
-  {
-    CStdString strHostname;
-    int iVideoWidth;
-    int iVideoHeight;
-    int iVideoResolution;
-    int iVideoBitrate;
-    int iVideoFramerate;
-    int iVideoSmoothing;
-    int iAudioBitrate;
-    int iIFrameInterval;
-    unsigned int uiCodeChannelUp;
-    unsigned int uiCodeChannelDown;
-    unsigned int uiCodeNumber[10];
-  } m_sSlingboxSettings;
-
-  void LoadSettings(const CStdString& strSlingbox);
-  CSlingbox * m_pSlingbox;
-};
-
-}
diff --git a/xbmc/filesystem/SlingboxDirectory.cpp b/xbmc/filesystem/SlingboxDirectory.cpp
new file mode 100644 (file)
index 0000000..7085a2e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "SlingboxDirectory.h"
+#include "FileItem.h"
+
+using namespace XFILE;
+using namespace std;
+
+CSlingboxDirectory::CSlingboxDirectory()
+{
+}
+
+CSlingboxDirectory::~CSlingboxDirectory()
+{
+}
+
+bool CSlingboxDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
+{
+  // Create generic Watch Slingbox item
+  CFileItemPtr item(new CFileItem(strPath, false));
+  item->SetLabel("Watch Slingbox");
+  item->SetLabelPreformated(true);
+  items.Add(item);
+
+  return true;
+}
\ No newline at end of file
diff --git a/xbmc/filesystem/SlingboxDirectory.h b/xbmc/filesystem/SlingboxDirectory.h
new file mode 100644 (file)
index 0000000..22bfd23
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+ #include "IDirectory.h"
+namespace XFILE
+{
+  
+  class CSlingboxDirectory
+  : public IDirectory
+  {
+  public:
+    CSlingboxDirectory();
+    virtual ~CSlingboxDirectory();
+    
+    virtual bool IsAllowed(const CStdString &strFile) const    { return true; }
+    virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
+  };
+}
\ No newline at end of file
diff --git a/xbmc/filesystem/SlingboxFile.cpp b/xbmc/filesystem/SlingboxFile.cpp
new file mode 100644 (file)
index 0000000..d392b29
--- /dev/null
@@ -0,0 +1,603 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "FileItem.h"
+#include "SlingboxFile.h"
+#include "filesystem/File.h"
+#include "lib/SlingboxLib/SlingboxLib.h"
+#include "settings/Settings.h"
+#include "utils/log.h"
+#include "utils/XMLUtils.h"
+
+using namespace XFILE;
+using namespace std;
+
+CSlingboxFile::CSlingboxFile()
+{
+  // Create the Slingbox object
+  m_pSlingbox = new CSlingbox();
+}
+
+CSlingboxFile::~CSlingboxFile()
+{
+  // Destroy the Slingbox object
+  delete m_pSlingbox;
+}
+
+bool CSlingboxFile::Open(const CURL& url)
+{
+  // Setup the IP/hostname and port (setup default port if none specified)
+  unsigned int uiPort;
+  if (url.HasPort())
+    uiPort = (unsigned int)url.GetPort();
+  else
+    uiPort = 5001;
+  m_pSlingbox->SetAddress(url.GetHostName(), uiPort);
+
+  // Prepare to connect to the Slingbox
+  bool bAdmin;
+  if (url.GetUserName().CompareNoCase("administrator") == 0)
+    bAdmin = true;
+  else if (url.GetUserName().CompareNoCase("viewer") == 0)
+    bAdmin = false;
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Invalid or no username specified for Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+    return false;
+  }
+
+  // Connect to the Slingbox
+  if (m_pSlingbox->Connect(bAdmin, url.GetPassWord()))
+  {
+    CLog::Log(LOGDEBUG, "%s - Sucessfully connected to Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error connecting to Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+    return false;
+  }
+
+  // Initialize the stream
+  if (m_pSlingbox->InitializeStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully initialized stream on Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error initializing stream on Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+    return false;
+  }
+
+  // Set correct input
+  if (url.GetFileNameWithoutPath() != "")
+  {
+    if (m_pSlingbox->SetInput(atoi(url.GetFileNameWithoutPath())))
+      CLog::Log(LOGDEBUG, "%s - Successfully requested change to input %i on Slingbox: %s",
+        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
+    else
+      CLog::Log(LOGERROR, "%s - Error requesting change to input %i on Slingbox: %s",
+        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
+  }
+
+  // Load the video settings
+  LoadSettings(url.GetHostName());
+
+  // Setup video options  
+  if (m_pSlingbox->StreamSettings((CSlingbox::Resolution)m_sSlingboxSettings.iVideoResolution,
+    m_sSlingboxSettings.iVideoBitrate, m_sSlingboxSettings.iVideoFramerate,
+    m_sSlingboxSettings.iVideoSmoothing, m_sSlingboxSettings.iAudioBitrate,
+    m_sSlingboxSettings.iIFrameInterval))
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully set stream options (resolution: %ix%i; "
+      "video bitrate: %i kbit/s; fps: %i; smoothing: %i%%; audio bitrate %i kbit/s; "
+      "I frame interval: %i) on Slingbox: %s", __FUNCTION__,
+      m_sSlingboxSettings.iVideoWidth, m_sSlingboxSettings.iVideoHeight,
+      m_sSlingboxSettings.iVideoBitrate, m_sSlingboxSettings.iVideoFramerate,
+      m_sSlingboxSettings.iVideoSmoothing, m_sSlingboxSettings.iAudioBitrate,
+      m_sSlingboxSettings.iIFrameInterval, url.GetHostName().c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error setting stream options on Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+  }
+
+  // Start the stream
+  if (m_pSlingbox->StartStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully started stream on Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error starting stream on Slingbox: %s",
+      __FUNCTION__, url.GetHostName().c_str());
+    return false;
+  }
+
+  // Check for correct input
+  if (url.GetFileNameWithoutPath() != "")
+  {
+    if (m_pSlingbox->GetInput() == -1)
+      CLog::Log(LOGDEBUG, "%s - Unable to confirm change to input %i on Slingbox: %s",
+        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
+    else if (m_pSlingbox->GetInput() == atoi(url.GetFileNameWithoutPath()))
+      CLog::Log(LOGDEBUG, "%s - Comfirmed change to input %i on Slingbox: %s",
+        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
+    else
+      CLog::Log(LOGERROR, "%s - Error changing to input %i on Slingbox: %s",
+        __FUNCTION__, atoi(url.GetFileNameWithoutPath()), url.GetHostName().c_str());
+  }
+
+  return true;
+}
+
+unsigned int CSlingboxFile::Read(void * pBuffer, int64_t iSize)
+{
+  // Read the data and check for any errors
+  int iRead = m_pSlingbox->ReadStream(pBuffer, (unsigned int)iSize);
+  if (iRead < 0)
+  {
+    CLog::Log(LOGERROR, "%s - Error reading stream from Slingbox: %s", __FUNCTION__,
+      m_sSlingboxSettings.strHostname.c_str());
+    return 0;
+  }
+
+  return iRead;
+}
+
+void CSlingboxFile::Close()
+{
+  // Stop the stream
+  if (m_pSlingbox->StopStream())
+    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream on Slingbox: %s", __FUNCTION__,
+    m_sSlingboxSettings.strHostname.c_str());
+  else
+    CLog::Log(LOGERROR, "%s - Error stopping stream on Slingbox: %s", __FUNCTION__,
+    m_sSlingboxSettings.strHostname.c_str());
+
+  // Disconnect from the Slingbox
+  if (m_pSlingbox->Disconnect())
+    CLog::Log(LOGDEBUG, "%s - Successfully disconnected from Slingbox: %s", __FUNCTION__,
+    m_sSlingboxSettings.strHostname.c_str());
+  else
+    CLog::Log(LOGERROR, "%s - Error disconnecting from Slingbox: %s", __FUNCTION__,
+    m_sSlingboxSettings.strHostname.c_str());
+}
+
+bool CSlingboxFile::SkipNext()
+{
+  return m_pSlingbox->IsConnected();
+}
+
+bool CSlingboxFile::NextChannel()
+{
+  // Prepare variables
+  bool bSuccess = true;
+  int iPrevChannel = m_pSlingbox->GetChannel();
+
+  // Stop the stream
+  if (m_pSlingbox->StopStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  // Figure out which method to use
+  if (m_sSlingboxSettings.uiCodeChannelUp == 0)
+  {
+    // Change the channel
+    if (m_pSlingbox->ChannelUp())
+    {
+      CLog::Log(LOGDEBUG, "%s - Successfully requested channel change on Slingbox: %s",
+        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+
+      if (m_pSlingbox->GetChannel() == -1)
+      {
+        CLog::Log(LOGDEBUG, "%s - Unable to confirm channel change on Slingbox: %s",
+          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+      }
+      else if (m_pSlingbox->GetChannel() != iPrevChannel)
+      {
+        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
+          __FUNCTION__, m_pSlingbox->GetChannel(), m_sSlingboxSettings.strHostname.c_str());
+      }
+      else
+      {
+        CLog::Log(LOGERROR, "%s - Error changing channel on Slingbox: %s",
+          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+        bSuccess = false;
+      }
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Error requesting channel change on Slingbox: %s",
+        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+      bSuccess = false;
+    }
+  }
+  else
+  {
+    // Change the channel using IR command
+    if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeChannelUp))
+    {
+      CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
+        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelUp,
+        m_sSlingboxSettings.strHostname.c_str());
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Error sending IR command (code: 0x%.2X) from "
+        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelUp,
+        m_sSlingboxSettings.strHostname.c_str());
+      bSuccess = false;
+    }
+  }
+
+  // Start the stream again
+  if (m_pSlingbox->StartStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error starting stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  return bSuccess;
+}
+
+bool CSlingboxFile::PrevChannel()
+{
+  // Prepare variables
+  bool bSuccess = true;
+  int iPrevChannel = m_pSlingbox->GetChannel();
+
+  // Stop the stream
+  if (m_pSlingbox->StopStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  // Figure out which method to use
+  if (m_sSlingboxSettings.uiCodeChannelDown == 0)
+  {
+    // Change the channel
+    if (m_pSlingbox->ChannelDown())
+    {
+      CLog::Log(LOGDEBUG, "%s - Successfully requested channel change on Slingbox: %s",
+        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+
+      if (m_pSlingbox->GetChannel() == -1)
+      {
+        CLog::Log(LOGDEBUG, "%s - Unable to confirm channel change on Slingbox: %s",
+          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+      }
+      else if (m_pSlingbox->GetChannel() != iPrevChannel)
+      {
+        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
+          __FUNCTION__, m_pSlingbox->GetChannel(), m_sSlingboxSettings.strHostname.c_str());
+      }
+      else
+      {
+        CLog::Log(LOGERROR, "%s - Error changing channel on Slingbox: %s",
+          __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+        bSuccess = false;
+      }
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Error requesting channel change on Slingbox: %s",
+        __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+      bSuccess = false;
+    }
+  }
+  else
+  {
+    // Change the channel using IR command
+    if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeChannelDown))
+    {
+      CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
+        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelDown,
+        m_sSlingboxSettings.strHostname.c_str());
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Error sending IR command (code: 0x%.2X) from "
+        "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeChannelDown,
+        m_sSlingboxSettings.strHostname.c_str());
+      bSuccess = false;
+    }
+  }    
+
+  // Start the stream again
+  if (m_pSlingbox->StartStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error starting Slingbox stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  return bSuccess;
+}
+
+bool CSlingboxFile::SelectChannel(unsigned int uiChannel)
+{
+  // Check if a channel change is required
+  if (m_pSlingbox->GetChannel() == (int)uiChannel)
+    return false;
+
+  // Prepare variables
+  bool bSuccess = true;
+
+  // Stop the stream
+  if (m_pSlingbox->StopStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully stopped stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error stopping stream before channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  // Figure out which method to use
+  unsigned int uiButtonsWithCode = 0;
+  for (unsigned int i = 0; i < 10; i++)
+  {
+    if (m_sSlingboxSettings.uiCodeNumber[i] != 0)
+      uiButtonsWithCode++;
+  }
+  if (uiButtonsWithCode == 0)
+  {
+    // Change the channel
+    if (m_pSlingbox->SetChannel(uiChannel))
+    {
+      CLog::Log(LOGDEBUG, "%s - Successfully requested change to channel %i on Slingbox: %s",
+        __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
+
+      if (m_pSlingbox->GetChannel() == -1)
+      {
+        CLog::Log(LOGDEBUG, "%s - Unable to confirm change to channel %i on Slingbox: %s",
+          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
+      }
+      else if (m_pSlingbox->GetChannel() == (int)uiChannel)
+      {
+        CLog::Log(LOGDEBUG, "%s - Confirmed change to channel %i on Slingbox: %s",
+          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
+      }
+      else
+      {
+        CLog::Log(LOGERROR, "%s - Error changing to channel %i on Slingbox: %s",
+          __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
+        bSuccess = false;
+      }
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Error requesting change to channel %i on Slingbox: %s",
+        __FUNCTION__, uiChannel, m_sSlingboxSettings.strHostname.c_str());
+      bSuccess = false;
+    }
+  }
+  else if (uiButtonsWithCode == 10)
+  {
+    // Prepare variables
+    CStdString strDigits;
+    strDigits.Format("%u", uiChannel);
+    unsigned int uiNumberOfDigits = strDigits.GetLength();
+
+    // Change the channel using IR commands
+    for (unsigned int i = 0; i < uiNumberOfDigits; i++)
+    {
+      if (m_pSlingbox->SendIRCommand(m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0']))
+      {
+        CLog::Log(LOGDEBUG, "%s - Successfully sent IR command (code: 0x%.2X) from "
+          "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0'],
+          m_sSlingboxSettings.strHostname.c_str());
+      }
+      else
+      {
+        CLog::Log(LOGDEBUG, "%s - Error sending IR command (code: 0x%.2X) from "
+          "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.uiCodeNumber[strDigits[i] - '0'],
+          m_sSlingboxSettings.strHostname.c_str());
+        bSuccess = false;
+      }
+    }
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error requesting change to channel %i on Slingbox due to one or more "
+      "missing button codes from advancedsettings.xml for Slingbox: %s", __FUNCTION__, uiChannel,
+      m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  // Start the stream again
+  if (m_pSlingbox->StartStream())
+  {
+    CLog::Log(LOGDEBUG, "%s - Successfully started stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Error starting stream after channel change request on "
+      "Slingbox: %s", __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+    bSuccess = false;
+  }
+
+  return bSuccess;
+}
+
+void CSlingboxFile::LoadSettings(const CStdString& strHostname)
+{
+  // Load default settings
+  m_sSlingboxSettings.strHostname = strHostname;
+  m_sSlingboxSettings.iVideoWidth = 320;
+  m_sSlingboxSettings.iVideoHeight = 240;
+  m_sSlingboxSettings.iVideoResolution = (int)CSlingbox::RESOLUTION320X240;
+  m_sSlingboxSettings.iVideoBitrate = 704;
+  m_sSlingboxSettings.iVideoFramerate = 30;
+  m_sSlingboxSettings.iVideoSmoothing = 50;
+  m_sSlingboxSettings.iAudioBitrate = 64;
+  m_sSlingboxSettings.iIFrameInterval = 10;
+  m_sSlingboxSettings.uiCodeChannelUp = 0;
+  m_sSlingboxSettings.uiCodeChannelDown = 0;
+  for (unsigned int i = 0; i < 10; i++)
+    m_sSlingboxSettings.uiCodeNumber[i] = 0;
+
+  // Check if a SlingboxSettings.xml file exists
+  CStdString slingboxXMLFile = g_settings.GetUserDataItem("SlingboxSettings.xml");
+  if (!CFile::Exists(slingboxXMLFile))
+  {
+    CLog::Log(LOGNOTICE, "No SlingboxSettings.xml file (%s) found - using default settings",
+      slingboxXMLFile.c_str());
+    return;
+  }
+
+  // Load the XML file
+  TiXmlDocument slingboxXML;
+  if (!slingboxXML.LoadFile(slingboxXMLFile))
+  {
+    CLog::Log(LOGERROR, "%s - Error loading %s - line %d\n%s", __FUNCTION__, 
+      slingboxXMLFile.c_str(), slingboxXML.ErrorRow(), slingboxXML.ErrorDesc());
+    return;
+  }
+
+  // Check to make sure layout is correct
+  TiXmlElement * pRootElement = slingboxXML.RootElement();
+  if (!pRootElement || strcmpi(pRootElement->Value(), "slingboxsettings") != 0)
+  {
+    CLog::Log(LOGERROR, "%s - Error loading %s - no <slingboxsettings> node found",
+      __FUNCTION__, slingboxXMLFile.c_str());
+    return;
+  }
+
+  // Success so far
+  CLog::Log(LOGNOTICE, "Loaded SlingboxSettings.xml from %s", slingboxXMLFile.c_str());
+
+  // Search for the first settings that specify no hostname or match our hostname
+  TiXmlElement *pElement;
+  for (pElement = pRootElement->FirstChildElement("slingbox"); pElement;
+    pElement = pElement->NextSiblingElement("slingbox"))
+  {
+    if (pElement->Attribute("hostname") == NULL ||      
+      !m_sSlingboxSettings.strHostname.CompareNoCase(pElement->Attribute("hostname")))
+    {
+      // Load setting values
+      XMLUtils::GetInt(pElement, "width", m_sSlingboxSettings.iVideoWidth, 0, 640);
+      XMLUtils::GetInt(pElement, "height", m_sSlingboxSettings.iVideoHeight, 0, 480);
+      XMLUtils::GetInt(pElement, "videobitrate", m_sSlingboxSettings.iVideoBitrate, 50, 8000);
+      XMLUtils::GetInt(pElement, "framerate", m_sSlingboxSettings.iVideoFramerate, 1, 30);
+      XMLUtils::GetInt(pElement, "smoothing", m_sSlingboxSettings.iVideoSmoothing, 0, 100);
+      XMLUtils::GetInt(pElement, "audiobitrate", m_sSlingboxSettings.iAudioBitrate, 16, 96);
+      XMLUtils::GetInt(pElement, "iframeinterval", m_sSlingboxSettings.iIFrameInterval, 1, 30);
+
+      // Load any button code values
+      TiXmlElement * pCodes = pElement->FirstChildElement("buttons");
+      if (pCodes)
+      {
+        XMLUtils::GetHex(pCodes, "channelup", m_sSlingboxSettings.uiCodeChannelUp);
+        XMLUtils::GetHex(pCodes, "channeldown", m_sSlingboxSettings.uiCodeChannelDown);
+        XMLUtils::GetHex(pCodes, "zero", m_sSlingboxSettings.uiCodeNumber[0]);
+        XMLUtils::GetHex(pCodes, "one", m_sSlingboxSettings.uiCodeNumber[1]);
+        XMLUtils::GetHex(pCodes, "two", m_sSlingboxSettings.uiCodeNumber[2]);
+        XMLUtils::GetHex(pCodes, "three", m_sSlingboxSettings.uiCodeNumber[3]);
+        XMLUtils::GetHex(pCodes, "four", m_sSlingboxSettings.uiCodeNumber[4]);
+        XMLUtils::GetHex(pCodes, "five", m_sSlingboxSettings.uiCodeNumber[5]);
+        XMLUtils::GetHex(pCodes, "six", m_sSlingboxSettings.uiCodeNumber[6]);
+        XMLUtils::GetHex(pCodes, "seven", m_sSlingboxSettings.uiCodeNumber[7]);
+        XMLUtils::GetHex(pCodes, "eight", m_sSlingboxSettings.uiCodeNumber[8]);
+        XMLUtils::GetHex(pCodes, "nine", m_sSlingboxSettings.uiCodeNumber[9]);
+      }
+
+      break;
+    }
+  }
+
+  // Prepare our resolution enum mapping array
+  const struct
+  {
+    unsigned int uiWidth;
+    unsigned int uiHeight;
+    CSlingbox::Resolution eEnum;
+  } m_resolutionMap[11] = {
+    {0, 0, CSlingbox::NOVIDEO},
+    {128, 96, CSlingbox::RESOLUTION128X96},
+    {160, 120, CSlingbox::RESOLUTION160X120},
+    {176, 120, CSlingbox::RESOLUTION176X120},
+    {224, 176, CSlingbox::RESOLUTION224X176},
+    {256, 192, CSlingbox::RESOLUTION256X192},
+    {320, 240, CSlingbox::RESOLUTION320X240},
+    {352, 240, CSlingbox::RESOLUTION352X240},
+    {320, 480, CSlingbox::RESOLUTION320X480},
+    {640, 240, CSlingbox::RESOLUTION640X240},
+    {640, 480, CSlingbox::RESOLUTION640X480}
+  };
+
+  // See if the specified resolution matches something in our mapping array and
+  // setup things accordingly
+  for (unsigned int i = 0; i < 11; i++)
+  {
+    if (m_sSlingboxSettings.iVideoWidth == (int)m_resolutionMap[i].uiWidth &&
+      m_sSlingboxSettings.iVideoHeight == (int)m_resolutionMap[i].uiHeight)
+    {
+      m_sSlingboxSettings.iVideoResolution = (int)m_resolutionMap[i].eEnum;
+      return;
+    }
+  }
+
+  // If it didn't match anything setup safe defaults
+  CLog::Log(LOGERROR, "%s - Defaulting to 320x240 resolution due to invalid "
+    "resolution specified in SlingboxSettings.xml for Slingbox: %s",
+    __FUNCTION__, m_sSlingboxSettings.strHostname.c_str());
+  m_sSlingboxSettings.iVideoWidth = 320;
+  m_sSlingboxSettings.iVideoHeight = 240;
+  m_sSlingboxSettings.iVideoResolution = (int)CSlingbox::RESOLUTION320X240;
+}
diff --git a/xbmc/filesystem/SlingboxFile.h b/xbmc/filesystem/SlingboxFile.h
new file mode 100644 (file)
index 0000000..45082c9
--- /dev/null
@@ -0,0 +1,78 @@
+#pragma once
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+#include "ILiveTV.h"
+
+class CSlingbox;
+
+namespace XFILE
+{
+  class CSlingboxFile
+  : public IFile, ILiveTVInterface
+  {
+  public:
+    CSlingboxFile();
+    virtual ~CSlingboxFile();
+    virtual bool Open(const CURL& url);
+    virtual unsigned int Read(void * buffer, int64_t size);
+    virtual void Close();
+    virtual bool SkipNext();
+    
+    virtual int GetStartTime()                                 { return 0; }
+    virtual int GetTotalTime()                                 { return 0; }
+    virtual int64_t GetLength()                                { return -1; }
+    virtual int64_t GetPosition()                              { return -1; }
+    virtual int64_t Seek(int64_t pos, int whence)              { return -1; }
+    virtual bool UpdateItem(CFileItem& item)                   { return false; }
+    
+    virtual bool Exists(const CURL& url)                       { return false; }
+    virtual int Stat(const CURL& url, struct __stat64* buffer) { return -1; }
+    
+    virtual ILiveTVInterface * GetLiveTV()                     { return (ILiveTVInterface *)this; }
+    
+    virtual bool NextChannel();
+    virtual bool PrevChannel();
+    virtual bool SelectChannel(unsigned int uiChannel);
+    
+  protected:
+    struct
+    {
+      CStdString strHostname;
+      int iVideoWidth;
+      int iVideoHeight;
+      int iVideoResolution;
+      int iVideoBitrate;
+      int iVideoFramerate;
+      int iVideoSmoothing;
+      int iAudioBitrate;
+      int iIFrameInterval;
+      unsigned int uiCodeChannelUp;
+      unsigned int uiCodeChannelDown;
+      unsigned int uiCodeNumber[10];
+    } m_sSlingboxSettings;
+    
+    void LoadSettings(const CStdString& strSlingbox);
+    CSlingbox * m_pSlingbox;
+  };
+  
+}
diff --git a/xbmc/filesystem/SmbFile.cpp b/xbmc/filesystem/SmbFile.cpp
new file mode 100644 (file)
index 0000000..4ab5f76
--- /dev/null
@@ -0,0 +1,777 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileSmb.cpp: implementation of the CSmbFile class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "system.h"
+#include "SmbFile.h"
+#include "PasswordManager.h"
+#include "SMBDirectory.h"
+#include "Util.h"
+#include <libsmbclient.h>
+#include "settings/AdvancedSettings.h"
+#include "settings/GUISettings.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/TimeUtils.h"
+
+using namespace XFILE;
+
+void xb_smbc_log(const char* msg)
+{
+  CLog::Log(LOGINFO, "%s%s", "smb: ", msg);
+}
+
+void xb_smbc_auth(const char *srv, const char *shr, char *wg, int wglen,
+                  char *un, int unlen, char *pw, int pwlen)
+{
+  return ;
+}
+
+smbc_get_cached_srv_fn orig_cache;
+
+SMBCSRV* xb_smbc_cache(SMBCCTX* c, const char* server, const char* share, const char* workgroup, const char* username)
+{
+  return orig_cache(c, server, share, workgroup, username);
+}
+
+CSMB::CSMB()
+{
+#ifdef TARGET_POSIX
+  m_IdleTimeout = 0;
+#endif
+  m_context = NULL;
+  smbc_init(xb_smbc_auth, 0);
+}
+
+CSMB::~CSMB()
+{
+  Deinit();
+}
+
+void CSMB::Deinit()
+{
+  CSingleLock lock(*this);
+
+  /* samba goes loco if deinited while it has some files opened */
+  if (m_context)
+  {
+    try
+    {
+      smbc_set_context(NULL);
+      smbc_free_context(m_context, 1);
+    }
+#ifdef TARGET_WINDOWS
+    catch(win32_exception e)
+    {
+      e.writelog(__FUNCTION__);
+    }
+    m_IdleTimeout = 180;
+#else
+    catch(...)
+    {
+      CLog::Log(LOGERROR,"exception on CSMB::Deinit. errno: %d", errno);
+    }
+#endif
+    m_context = NULL;
+  }
+}
+
+void CSMB::Init()
+{
+  CSingleLock lock(*this);
+  if (!m_context)
+  {
+#ifdef TARGET_POSIX
+    // Create ~/.smb/smb.conf. This file is used by libsmbclient.
+    // http://us1.samba.org/samba/docs/man/manpages-3/libsmbclient.7.html
+    // http://us1.samba.org/samba/docs/man/manpages-3/smb.conf.5.html
+    char smb_conf[MAX_PATH];
+    sprintf(smb_conf, "%s/.smb", getenv("HOME"));
+    mkdir(smb_conf, 0755);
+    sprintf(smb_conf, "%s/.smb/smb.conf", getenv("HOME"));
+    FILE* f = fopen(smb_conf, "w");
+    if (f != NULL)
+    {
+      fprintf(f, "[global]\n");
+
+      // make sure we're not acting like a server
+      fprintf(f, "\tpreferred master = no\n");
+      fprintf(f, "\tlocal master = no\n");
+      fprintf(f, "\tdomain master = no\n");
+
+      // use the weaker LANMAN password hash in order to be compatible with older servers
+      fprintf(f, "\tclient lanman auth = yes\n");
+      fprintf(f, "\tlanman auth = yes\n");
+
+      fprintf(f, "\tsocket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536\n");      
+      fprintf(f, "\tlock directory = %s/.smb/\n", getenv("HOME"));
+
+      // set wins server if there's one. name resolve order defaults to 'lmhosts host wins bcast'.
+      // if no WINS server has been specified the wins method will be ignored.
+      if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
+      {
+        fprintf(f, "\twins server = %s\n", g_guiSettings.GetString("smb.winsserver").c_str());
+        fprintf(f, "\tname resolve order = bcast wins host\n");
+      }
+      else
+        fprintf(f, "\tname resolve order = bcast host\n");
+
+      // use user-configured charset. if no charset is specified,
+      // samba tries to use charset 850 but falls back to ASCII in case it is not available
+      if (g_advancedSettings.m_sambadoscodepage.length() > 0)
+        fprintf(f, "\tdos charset = %s\n", g_advancedSettings.m_sambadoscodepage.c_str());
+
+      // if no workgroup string is specified, samba will use the default value 'WORKGROUP'
+      if ( g_guiSettings.GetString("smb.workgroup").length() > 0 )
+        fprintf(f, "\tworkgroup = %s\n", g_guiSettings.GetString("smb.workgroup").c_str());
+      fclose(f);
+    }
+#endif
+
+#ifdef TARGET_WINDOWS
+    // set the log function
+    set_log_callback(xb_smbc_log);
+#endif
+
+    // setup our context
+    m_context = smbc_new_context();
+#ifdef DEPRECATED_SMBC_INTERFACE
+    smbc_setDebug(m_context, g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0);
+    smbc_setFunctionAuthData(m_context, xb_smbc_auth);
+    orig_cache = smbc_getFunctionGetCachedServer(m_context);
+    smbc_setFunctionGetCachedServer(m_context, xb_smbc_cache);
+    smbc_setOptionOneSharePerServer(m_context, false);
+    smbc_setOptionBrowseMaxLmbCount(m_context, 0);
+    smbc_setTimeout(m_context, g_advancedSettings.m_sambaclienttimeout * 1000);
+#else
+    m_context->debug = g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0;
+    m_context->callbacks.auth_fn = xb_smbc_auth;
+    orig_cache = m_context->callbacks.get_cached_srv_fn;
+    m_context->callbacks.get_cached_srv_fn = xb_smbc_cache;
+    m_context->options.one_share_per_server = false;
+    m_context->options.browse_max_lmb_count = 0;
+    m_context->timeout = g_advancedSettings.m_sambaclienttimeout * 1000;
+#endif
+
+    // initialize samba and do some hacking into the settings
+    if (smbc_init_context(m_context))
+    {
+      /* setup old interface to use this context */
+      smbc_set_context(m_context);
+
+#ifdef TARGET_WINDOWS
+      // if a wins-server is set, we have to change name resolve order to
+      if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
+      {
+        lp_do_parameter( -1, "wins server", g_guiSettings.GetString("smb.winsserver").c_str());
+        lp_do_parameter( -1, "name resolve order", "bcast wins host");
+      }
+      else
+        lp_do_parameter( -1, "name resolve order", "bcast host");
+
+      if (g_advancedSettings.m_sambadoscodepage.length() > 0)
+        lp_do_parameter( -1, "dos charset", g_advancedSettings.m_sambadoscodepage.c_str());
+      else
+        lp_do_parameter( -1, "dos charset", "CP850");
+#endif
+    }
+    else
+    {
+      smbc_free_context(m_context, 1);
+      m_context = NULL;
+    }
+  }
+#ifdef TARGET_POSIX
+  m_IdleTimeout = 180;
+#endif
+}
+
+void CSMB::Purge()
+{
+#ifdef TARGET_WINDOWS
+  CSingleLock lock(*this);
+  smbc_purge();
+#endif
+}
+
+/*
+ * For each new connection samba creates a new session
+ * But this is not what we want, we just want to have one session at the time
+ * This means that we have to call smbc_purge() if samba created a new session
+ * Samba will create a new session when:
+ * - connecting to another server
+ * - connecting to another share on the same server (share, not a different folder!)
+ *
+ * We try to avoid lot's of purge commands because it slow samba down.
+ */
+void CSMB::PurgeEx(const CURL& url)
+{
+  CSingleLock lock(*this);
+  CStdString strShare = url.GetFileName().substr(0, url.GetFileName().Find('/'));
+
+#ifdef TARGET_WINDOWS
+  if (m_strLastShare.length() > 0 && (m_strLastShare != strShare || m_strLastHost != url.GetHostName()))
+    smbc_purge();
+#endif
+
+  m_strLastShare = strShare;
+  m_strLastHost = url.GetHostName();
+}
+
+CStdString CSMB::URLEncode(const CURL &url)
+{
+  /* due to smb wanting encoded urls we have to build it manually */
+
+  CStdString flat = "smb://";
+
+  if(url.GetDomain().length() > 0)
+  {
+    flat += URLEncode(url.GetDomain());
+    flat += ";";
+  }
+
+  /* samba messes up of password is set but no username is set. don't know why yet */
+  /* probably the url parser that goes crazy */
+  if(url.GetUserName().length() > 0 /* || url.GetPassWord().length() > 0 */)
+  {
+    flat += URLEncode(url.GetUserName());
+    flat += ":";
+    flat += URLEncode(url.GetPassWord());
+    flat += "@";
+  }
+  flat += URLEncode(url.GetHostName());
+
+  /* okey sadly since a slash is an invalid name we have to tokenize */
+  std::vector<CStdString> parts;
+  std::vector<CStdString>::iterator it;
+  CUtil::Tokenize(url.GetFileName(), parts, "/");
+  for( it = parts.begin(); it != parts.end(); it++ )
+  {
+    flat += "/";
+    flat += URLEncode((*it));
+  }
+
+  /* okey options should go here, thou current samba doesn't support any */
+
+  return flat;
+}
+
+CStdString CSMB::URLEncode(const CStdString &value)
+{
+  CStdString encoded(value);
+  CURL::Encode(encoded);
+  return encoded;
+}
+
+#ifdef TARGET_WINDOWS
+DWORD CSMB::ConvertUnixToNT(int error)
+{
+  DWORD nt_error;
+  if (error == ENODEV || error == ENETUNREACH || error == WSAETIMEDOUT) nt_error = NT_STATUS_INVALID_COMPUTER_NAME;
+  else if(error == WSAECONNREFUSED || error == WSAECONNABORTED) nt_error = NT_STATUS_CONNECTION_REFUSED;
+  else nt_error = map_nt_error_from_unix(error);
+
+  return nt_error;
+}
+#endif
+
+#ifdef TARGET_POSIX
+/* This is called from CApplication::ProcessSlow() and is used to tell if smbclient have been idle for too long */
+void CSMB::CheckIfIdle()
+{
+/* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
+   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
+  if (m_OpenConnections == 0)
+  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
+    CSingleLock lock(*this);
+    if (m_OpenConnections == 0 /* check again - when locked */ && m_context != NULL)
+    {
+      if (m_IdleTimeout > 0)
+         {
+        m_IdleTimeout--;
+      }
+         else
+         {
+        CLog::Log(LOGNOTICE, "Samba is idle. Closing the remaining connections");
+        smb.Deinit();
+      }
+    }
+  }
+}
+
+void CSMB::SetActivityTime()
+{
+  /* Since we get called every 500ms from ProcessSlow we limit the tick count to 180 */
+  /* That means we have 2 ticks per second which equals 180/2 == 90 seconds */
+  m_IdleTimeout = 180;
+}
+
+/* The following two function is used to keep track on how many Opened files/directories there are.
+   This makes the idle timer not count if a movie is paused for example */
+void CSMB::AddActiveConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections++;
+}
+void CSMB::AddIdleConnection()
+{
+  CSingleLock lock(*this);
+  m_OpenConnections--;
+  /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user
+     leaves the movie paused for a long while and then press stop */
+  m_IdleTimeout = 180;
+}
+#endif
+
+CSMB smb;
+
+CSmbFile::CSmbFile()
+{
+  smb.Init();
+  m_fd = -1;
+#ifdef TARGET_POSIX
+  smb.AddActiveConnection();
+#endif
+}
+
+CSmbFile::~CSmbFile()
+{
+  Close();
+#ifdef TARGET_POSIX
+  smb.AddIdleConnection();
+#endif
+}
+
+int64_t CSmbFile::GetPosition()
+{
+  if (m_fd == -1) return 0;
+  smb.Init();
+  CSingleLock lock(smb);
+  int64_t pos = smbc_lseek(m_fd, 0, SEEK_CUR);
+  if ( pos < 0 )
+    return 0;
+  return pos;
+}
+
+int64_t CSmbFile::GetLength()
+{
+  if (m_fd == -1) return 0;
+  return m_fileSize;
+}
+
+bool CSmbFile::Open(const CURL& url)
+{
+  Close();
+
+  // we can't open files like smb://file.f or smb://server/file.f
+  // if a file matches the if below return false, it can't exist on a samba share.
+  if (!IsValidFile(url.GetFileName()))
+  {
+      CLog::Log(LOGNOTICE,"FileSmb->Open: Bad URL : '%s'",url.GetFileName().c_str());
+      return false;
+  }
+  m_url = url;
+
+  // opening a file to another computer share will create a new session
+  // when opening smb://server xbms will try to find folder.jpg in all shares
+  // listed, which will create lot's of open sessions.
+
+  CStdString strFileName;
+  m_fd = OpenFile(url, strFileName);
+
+  CLog::Log(LOGDEBUG,"CSmbFile::Open - opened %s, fd=%d",url.GetFileName().c_str(), m_fd);
+  if (m_fd == -1)
+  {
+    // write error to logfile
+#ifdef TARGET_WINDOWS
+    int nt_error = smb.ConvertUnixToNT(errno);
+    CLog::Log(LOGINFO, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' nt_err : '%x' error : '%s'", strFileName.c_str(), errno, nt_error, get_friendly_nt_error_msg(nt_error));
+#else
+    CLog::Log(LOGINFO, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strFileName.c_str(), errno, strerror(errno));
+#endif
+    return false;
+  }
+
+  CSingleLock lock(smb);
+#ifdef TARGET_WINDOWS
+  struct __stat64 tmpBuffer = {0};
+#else
+  struct stat tmpBuffer;
+#endif
+  if (smbc_stat(strFileName, &tmpBuffer) < 0)
+  {
+    smbc_close(m_fd);
+    m_fd = -1;
+    return false;
+  }
+
+  m_fileSize = tmpBuffer.st_size;
+
+  int64_t ret = smbc_lseek(m_fd, 0, SEEK_SET);
+  if ( ret < 0 )
+  {
+    smbc_close(m_fd);
+    m_fd = -1;
+    return false;
+  }
+  // We've successfully opened the file!
+  return true;
+}
+
+
+/// \brief Checks authentication against SAMBA share. Reads password cache created in CSMBDirectory::OpenDir().
+/// \param strAuth The SMB style path
+/// \return SMB file descriptor
+/*
+int CSmbFile::OpenFile(CStdString& strAuth)
+{
+  int fd = -1;
+
+  CStdString strPath = g_passwordManager.GetSMBAuthFilename(strAuth);
+
+  fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
+  // TODO: Run a loop here that prompts for our username/password as appropriate?
+  // We have the ability to run a file (eg from a button action) without browsing to
+  // the directory first.  In the case of a password protected share that we do
+  // not have the authentication information for, the above smbc_open() will have
+  // returned negative, and the file will not be opened.  While this is not a particular
+  // likely scenario, we might want to implement prompting for the password in this case.
+  // The code from SMBDirectory can be used for this.
+  if(fd >= 0)
+    strAuth = strPath;
+
+  return fd;
+}
+*/
+
+int CSmbFile::OpenFile(const CURL &url, CStdString& strAuth)
+{
+  int fd = -1;
+  smb.Init();
+
+  strAuth = GetAuthenticatedPath(url);
+  CStdString strPath = strAuth;
+
+  {
+    CSingleLock lock(smb);
+    fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
+  }
+
+  // file open failed, try to open the directory to force authentication
+#ifdef TARGET_WINDOWS
+  if (fd < 0 && smb.ConvertUnixToNT(errno) == NT_STATUS_ACCESS_DENIED)
+#else
+  if (fd < 0 && errno == EACCES)
+#endif
+  {
+    CURL urlshare(url);
+
+    /* just replace the filename with the sharename */
+    urlshare.SetFileName(url.GetShareName());
+
+    CSMBDirectory smbDir;
+    // TODO: Currently we always allow prompting on files.  This may need to
+    // change in the future as background scanners are more prolific.
+    smbDir.SetAllowPrompting(true);
+    fd = smbDir.Open(urlshare);
+
+    // directory open worked, try opening the file again
+    if (fd >= 0)
+    {
+      CSingleLock lock(smb);
+      // close current directory filehandle
+      // dont need to purge since its the same server and share
+      smbc_closedir(fd);
+
+      // set up new filehandle (as CSmbFile::Open does)
+      strPath = GetAuthenticatedPath(url);
+
+      fd = smbc_open(strPath.c_str(), O_RDONLY, 0);
+    }
+  }
+
+  if (fd >= 0)
+    strAuth = strPath;
+
+  return fd;
+}
+
+bool CSmbFile::Exists(const CURL& url)
+{
+  // we can't open files like smb://file.f or smb://server/file.f
+  // if a file matches the if below return false, it can't exist on a samba share.
+  if (!IsValidFile(url.GetFileName())) return false;
+
+  smb.Init();
+  CStdString strFileName = GetAuthenticatedPath(url);
+
+#ifdef TARGET_WINDOWS
+  struct __stat64 info;
+#else
+  struct stat info;
+#endif
+
+  CSingleLock lock(smb);
+  int iResult = smbc_stat(strFileName, &info);
+
+  if (iResult < 0) return false;
+  return true;
+}
+
+int CSmbFile::Stat(struct __stat64* buffer)
+{
+  if (m_fd == -1)
+    return -1;
+
+#ifdef TARGET_WINDOWS
+  struct __stat64 tmpBuffer = {0};
+#else
+  struct stat tmpBuffer = {0};
+#endif
+
+  CSingleLock lock(smb);
+  int iResult = smbc_fstat(m_fd, &tmpBuffer);
+
+  memset(buffer, 0, sizeof(struct __stat64));
+  buffer->st_dev = tmpBuffer.st_dev;
+  buffer->st_ino = tmpBuffer.st_ino;
+  buffer->st_mode = tmpBuffer.st_mode;
+  buffer->st_nlink = tmpBuffer.st_nlink;
+  buffer->st_uid = tmpBuffer.st_uid;
+  buffer->st_gid = tmpBuffer.st_gid;
+  buffer->st_rdev = tmpBuffer.st_rdev;
+  buffer->st_size = tmpBuffer.st_size;
+  buffer->st_atime = tmpBuffer.st_atime;
+  buffer->st_mtime = tmpBuffer.st_mtime;
+  buffer->st_ctime = tmpBuffer.st_ctime;
+
+  return iResult;
+}
+
+int CSmbFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  smb.Init();
+  CStdString strFileName = GetAuthenticatedPath(url);
+  CSingleLock lock(smb);
+
+#ifdef TARGET_WINDOWS
+  struct __stat64 tmpBuffer = {0};
+#else
+  struct stat tmpBuffer = {0};
+#endif
+  int iResult = smbc_stat(strFileName, &tmpBuffer);
+
+  memset(buffer, 0, sizeof(struct __stat64));
+  buffer->st_dev = tmpBuffer.st_dev;
+  buffer->st_ino = tmpBuffer.st_ino;
+  buffer->st_mode = tmpBuffer.st_mode;
+  buffer->st_nlink = tmpBuffer.st_nlink;
+  buffer->st_uid = tmpBuffer.st_uid;
+  buffer->st_gid = tmpBuffer.st_gid;
+  buffer->st_rdev = tmpBuffer.st_rdev;
+  buffer->st_size = tmpBuffer.st_size;
+  buffer->st_atime = tmpBuffer.st_atime;
+  buffer->st_mtime = tmpBuffer.st_mtime;
+  buffer->st_ctime = tmpBuffer.st_ctime;
+
+  return iResult;
+}
+
+unsigned int CSmbFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  if (m_fd == -1) return 0;
+  CSingleLock lock(smb); // Init not called since it has to be "inited" by now
+#ifdef TARGET_POSIX
+  smb.SetActivityTime();
+#endif
+  /* work around stupid bug in samba */
+  /* some samba servers has a bug in it where the */
+  /* 17th bit will be ignored in a request of data */
+  /* this can lead to a very small return of data */
+  /* also worse, a request of exactly 64k will return */
+  /* as if eof, client has a workaround for windows */
+  /* thou it seems other servers are affected too */
+  if( uiBufSize >= 64*1024-2 )
+    uiBufSize = 64*1024-2;
+
+  int bytesRead = smbc_read(m_fd, lpBuf, (int)uiBufSize);
+
+  if ( bytesRead < 0 && errno == EINVAL )
+  {
+    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s ) - Retrying", __FUNCTION__, bytesRead, errno, strerror(errno));
+    bytesRead = smbc_read(m_fd, lpBuf, (int)uiBufSize);
+  }
+
+  if ( bytesRead < 0 )
+  {
+#ifdef TARGET_WINDOWS
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
+#else
+    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s )", __FUNCTION__, bytesRead, errno, strerror(errno));
+#endif
+    return 0;
+  }
+
+  return (unsigned int)bytesRead;
+}
+
+int64_t CSmbFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  if (m_fd == -1) return -1;
+
+  CSingleLock lock(smb); // Init not called since it has to be "inited" by now
+#ifdef TARGET_POSIX
+  smb.SetActivityTime();
+#endif
+  int64_t pos = smbc_lseek(m_fd, iFilePosition, iWhence);
+
+  if ( pos < 0 )
+  {
+#ifdef TARGET_WINDOWS
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
+#else
+    CLog::Log(LOGERROR, "%s - Error( %"PRId64", %d, %s )", __FUNCTION__, pos, errno, strerror(errno));
+#endif
+    return -1;
+  }
+
+  return (int64_t)pos;
+}
+
+void CSmbFile::Close()
+{
+  if (m_fd != -1)
+  {
+    CLog::Log(LOGDEBUG,"CSmbFile::Close closing fd %d", m_fd);
+    CSingleLock lock(smb);
+    smbc_close(m_fd);
+  }
+  m_fd = -1;
+}
+
+int CSmbFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  if (m_fd == -1) return -1;
+  DWORD dwNumberOfBytesWritten = 0;
+
+  // lpBuf can be safely casted to void* since xmbc_write will only read from it.
+  smb.Init();
+  CSingleLock lock(smb);
+  dwNumberOfBytesWritten = smbc_write(m_fd, (void*)lpBuf, (DWORD)uiBufSize);
+
+  return (int)dwNumberOfBytesWritten;
+}
+
+bool CSmbFile::Delete(const CURL& url)
+{
+  smb.Init();
+  CStdString strFile = GetAuthenticatedPath(url);
+
+  CSingleLock lock(smb);
+
+  int result = smbc_unlink(strFile.c_str());
+
+  if(result != 0)
+#ifdef TARGET_WINDOWS
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
+#else
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
+#endif
+
+  return (result == 0);
+}
+
+bool CSmbFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  smb.Init();
+  CStdString strFile = GetAuthenticatedPath(url);
+  CStdString strFileNew = GetAuthenticatedPath(urlnew);
+  CSingleLock lock(smb);
+
+  int result = smbc_rename(strFile.c_str(), strFileNew.c_str());
+
+  if(result != 0)
+#ifdef TARGET_WINDOWS
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, get_friendly_nt_error_msg(smb.ConvertUnixToNT(errno)));
+#else
+    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));
+#endif
+
+  return (result == 0);
+}
+
+bool CSmbFile::OpenForWrite(const CURL& url, bool bOverWrite)
+{
+  m_fileSize = 0;
+
+  Close();
+  smb.Init();
+  // we can't open files like smb://file.f or smb://server/file.f
+  // if a file matches the if below return false, it can't exist on a samba share.
+  if (!IsValidFile(url.GetFileName())) return false;
+
+  CStdString strFileName = GetAuthenticatedPath(url);
+  CSingleLock lock(smb);
+
+  if (bOverWrite)
+  {
+    CLog::Log(LOGWARNING, "FileSmb::OpenForWrite() called with overwriting enabled! - %s", strFileName.c_str());
+    m_fd = smbc_creat(strFileName.c_str(), 0);
+  }
+  else
+  {
+    m_fd = smbc_open(strFileName.c_str(), O_RDWR, 0);
+  }
+
+  if (m_fd == -1)
+  {
+    // write error to logfile
+#ifdef TARGET_WINDOWS
+    int nt_error = map_nt_error_from_unix(errno);
+    CLog::Log(LOGERROR, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' nt_err : '%x' error : '%s'", strFileName.c_str(), errno, nt_error, get_friendly_nt_error_msg(nt_error));
+#else
+    CLog::Log(LOGERROR, "FileSmb->Open: Unable to open file : '%s'\nunix_err:'%x' error : '%s'", strFileName.c_str(), errno, strerror(errno));
+#endif
+    return false;
+  }
+
+  // We've successfully opened the file!
+  return true;
+}
+
+bool CSmbFile::IsValidFile(const CStdString& strFileName)
+{
+  if (strFileName.Find('/') == -1 || /* doesn't have sharename */
+      strFileName.Right(2) == "/." || /* not current folder */
+      strFileName.Right(3) == "/..")  /* not parent folder */
+      return false;
+  return true;
+}
+
+CStdString CSmbFile::GetAuthenticatedPath(const CURL &url)
+{
+  CURL authURL(url);
+  CPasswordManager::GetInstance().AuthenticateURL(authURL);
+  return smb.URLEncode(authURL);
+}
diff --git a/xbmc/filesystem/SmbFile.h b/xbmc/filesystem/SmbFile.h
new file mode 100644 (file)
index 0000000..8cfbc78
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileSmb.h: interface for the CSmbFile class.
+
+//
+
+//////////////////////////////////////////////////////////////////////
+
+
+
+#if !defined(AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_)
+
+#define AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_
+
+
+#if _MSC_VER > 1000
+
+#pragma once
+
+#endif // _MSC_VER > 1000
+
+#include "IFile.h"
+#include "URL.h"
+#include "threads/CriticalSection.h"
+
+#define NT_STATUS_CONNECTION_REFUSED long(0xC0000000 | 0x0236)
+#define NT_STATUS_INVALID_HANDLE long(0xC0000000 | 0x0008)
+#define NT_STATUS_ACCESS_DENIED long(0xC0000000 | 0x0022)
+#define NT_STATUS_OBJECT_NAME_NOT_FOUND long(0xC0000000 | 0x0034)
+#ifdef _LINUX
+#define NT_STATUS_INVALID_COMPUTER_NAME long(0xC0000000 | 0x0122)
+#endif
+
+struct _SMBCCTX;
+typedef _SMBCCTX SMBCCTX;
+
+class CSMB : public CCriticalSection
+{
+public:
+  CSMB();
+  ~CSMB();
+  void Init();
+  void Deinit();
+  void Purge();
+  void PurgeEx(const CURL& url);
+#ifdef _LINUX
+  void CheckIfIdle();
+  void SetActivityTime();
+  void AddActiveConnection();
+  void AddIdleConnection();
+#endif
+  CStdString URLEncode(const CStdString &value);
+  CStdString URLEncode(const CURL &url);
+
+  DWORD ConvertUnixToNT(int error);
+private:
+  SMBCCTX *m_context;
+  CStdString m_strLastHost;
+  CStdString m_strLastShare;
+#ifdef _LINUX
+  int m_OpenConnections;
+  unsigned int m_IdleTimeout;
+#endif
+};
+
+extern CSMB smb;
+
+namespace XFILE
+{
+class CSmbFile : public IFile
+{
+public:
+  CSmbFile();
+  int OpenFile(const CURL &url, CStdString& strAuth);
+  virtual ~CSmbFile();
+  virtual void Close();
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual int Stat(struct __stat64* buffer);
+  virtual int64_t GetLength();
+  virtual int64_t GetPosition();
+  virtual int Write(const void* lpBuf, int64_t uiBufSize);
+
+  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+  virtual bool Delete(const CURL& url);
+  virtual bool Rename(const CURL& url, const CURL& urlnew);
+  virtual int  GetChunkSize() {return 1;}
+
+protected:
+  CURL m_url;
+  bool IsValidFile(const CStdString& strFileName);
+  CStdString GetAuthenticatedPath(const CURL &url);
+  int64_t m_fileSize;
+  int m_fd;
+};
+}
+
+#endif // !defined(AFX_FILESMB_H__2C4AB5BC_0742_458D_95EA_E9C77BA5663D__INCLUDED_)
diff --git a/xbmc/filesystem/SpecialProtocolFile.cpp b/xbmc/filesystem/SpecialProtocolFile.cpp
new file mode 100644 (file)
index 0000000..ebcb941
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "SpecialProtocolFile.h"
+#include "SpecialProtocol.h"
+#include "URL.h"
+
+#include <sys/stat.h>
+
+using namespace XFILE;
+
+CSpecialProtocolFile::CSpecialProtocolFile(void)
+{
+}
+
+CSpecialProtocolFile::~CSpecialProtocolFile(void)
+{
+  Close();
+}
+
+bool CSpecialProtocolFile::Open(const CURL& url)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+
+  return m_file.Open(strFileName);
+}
+
+bool CSpecialProtocolFile::OpenForWrite(const CURL& url, bool bOverWrite /*=false */)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+
+  return m_file.OpenForWrite(strFileName,bOverWrite);
+}
+
+bool CSpecialProtocolFile::Delete(const CURL& url)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+  
+  return m_file.Delete(strFileName);
+}
+
+bool CSpecialProtocolFile::Exists(const CURL& url)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+
+  return m_file.Exists(strFileName);
+}
+
+int CSpecialProtocolFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+
+  return m_file.Stat(strFileName, buffer);
+}
+
+bool CSpecialProtocolFile::Rename(const CURL& url, const CURL& urlnew)
+{
+  CStdString strFileName=CSpecialProtocol::TranslatePath(url);
+  CStdString strFileName2=CSpecialProtocol::TranslatePath(urlnew);
+
+  return m_file.Rename(strFileName,strFileName2);
+}
+
+int CSpecialProtocolFile::Stat(struct __stat64* buffer)
+{
+  return m_file.Stat(buffer);
+}
+
+unsigned int CSpecialProtocolFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  return m_file.Read(lpBuf, uiBufSize);
+}
+  
+int CSpecialProtocolFile::Write(const void* lpBuf, int64_t uiBufSize)
+{
+  return m_file.Write(lpBuf,uiBufSize);
+}
+
+int64_t CSpecialProtocolFile::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
+{
+  return m_file.Seek(iFilePosition, iWhence);
+}
+
+void CSpecialProtocolFile::Close()
+{
+  m_file.Close();
+}
+
+int64_t CSpecialProtocolFile::GetPosition()
+{
+  return m_file.GetPosition();
+}
+
+int64_t CSpecialProtocolFile::GetLength()
+{
+  return m_file.GetLength();
+}
+
+
+
diff --git a/xbmc/filesystem/SpecialProtocolFile.h b/xbmc/filesystem/SpecialProtocolFile.h
new file mode 100644 (file)
index 0000000..d9e05de
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "File.h"
+
+namespace XFILE
+{
+class CSpecialProtocolFile : public IFile
+{
+public:
+  CSpecialProtocolFile(void);
+  virtual ~CSpecialProtocolFile(void);
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual int Stat(struct __stat64* buffer);
+  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false);
+  virtual bool Delete(const CURL& url);
+  virtual bool Rename(const CURL& url, const CURL& urlnew);
+
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int Write(const void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+
+protected:
+  CFile m_file;
+};
+}
diff --git a/xbmc/filesystem/TuxBoxDirectory.cpp b/xbmc/filesystem/TuxBoxDirectory.cpp
new file mode 100644 (file)
index 0000000..aa12226
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "TuxBoxDirectory.h"
+#include "CacheDirectory.h"
+#include "CurlFile.h"
+#include "utils/HttpHeader.h"
+#include "utils/TuxBoxUtil.h"
+#include "URL.h"
+#include "tinyXML/tinyxml.h"
+#include "settings/AdvancedSettings.h"
+#include "FileItem.h"
+#include "utils/log.h"
+#include "utils/URIUtils.h"
+
+using namespace XFILE;
+
+CTuxBoxDirectory::CTuxBoxDirectory(void)
+{
+}
+
+CTuxBoxDirectory::~CTuxBoxDirectory(void)
+{
+}
+
+bool CTuxBoxDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
+{
+  // so we know that we have enigma2
+  static bool enigma2 = false;
+  // Detect and delete slash at end
+  CStdString strRoot = strPath;
+  URIUtils::RemoveSlashAtEnd(strRoot);
+
+  //Get the request strings
+  CStdString strBQRequest;
+  CStdString strXMLRootString;
+  CStdString strXMLChildString;
+  if(!GetRootAndChildString(strRoot, strBQRequest, strXMLRootString, strXMLChildString))
+    return false;
+
+  //Set url Protocol
+  CURL url(strRoot);
+  CStdString strFilter;
+  CStdString protocol = url.GetProtocol();
+  CStdString strOptions = url.GetOptions();
+  url.SetProtocol("http");
+  bool bIsBouquet=false;
+
+  int ipoint = strOptions.Find("?path=");
+  if (ipoint >=0)
+  {
+    // send Zap!
+    return g_tuxbox.ZapToUrl(url, strOptions, ipoint);
+  }
+  else
+  {
+    ipoint = strOptions.Find("&reference=");
+    if (ipoint >=0 || enigma2)
+    {
+      //List reference
+      strFilter = strOptions.Right((strOptions.size()-(ipoint+11)));
+      bIsBouquet = false; //On Empty is Bouquet
+      if (enigma2)
+      {
+        CStdString strPort;
+        strPort.Format(":%i",url.GetPort());
+        if (strRoot.Right(strPort.GetLength()) != strPort) // If not root dir, enable Channels
+          strFilter = "e2"; // Disable Bouquets for Enigma2
+
+        GetRootAndChildStringEnigma2(strBQRequest, strXMLRootString, strXMLChildString);
+        url.SetOptions("");
+        url.SetFileName(strBQRequest);
+      }
+    }
+  }
+  if(strFilter.IsEmpty())
+  {
+    url.SetOptions(strBQRequest);
+    bIsBouquet = true;
+  }
+  //Open
+  CCurlFile http;
+  int iTryConnect = 0;
+  int iWaitTimer = 20;
+  bool result = false;
+
+  while (iTryConnect < 4)
+  {
+    http.SetTimeout(iWaitTimer);
+    if(http.Open(url))
+    {
+      //We are connected!
+      iTryConnect = 4;
+
+      // restore protocol
+      url.SetProtocol(protocol);
+
+      int size_read = 0;
+      int size_total = (int)http.GetLength();
+      int data_size = 0;
+      CStdString data;
+      data.reserve(size_total);
+
+      // read response from server into string buffer
+      char buffer[16384];
+      while ((size_read = http.Read(buffer, sizeof(buffer)-1)) > 0)
+      {
+        buffer[size_read] = 0;
+        data += buffer;
+        data_size += size_read;
+      }
+      http.Close();
+
+      // parse returned xml
+      TiXmlDocument doc;
+      data.Replace("></",">-</"); //FILL EMPTY ELEMENTS WITH "-"!
+      doc.Parse(data.c_str());
+      TiXmlElement *root = doc.RootElement();
+      if(root == NULL)
+      {
+        CLog::Log(LOGERROR, "%s - Unable to parse xml", __FUNCTION__);
+        CLog::Log(LOGERROR, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str());
+        return false;
+      }
+      if( strXMLRootString.Equals(root->Value()) && bIsBouquet)
+      {
+        data.Empty();
+        if (enigma2)
+          result = g_tuxbox.ParseBouquetsEnigma2(root, items, url, strFilter, strXMLChildString);
+        else
+          result = g_tuxbox.ParseBouquets(root, items, url, strFilter, strXMLChildString);
+      }
+      else if( strXMLRootString.Equals(root->Value()) && !strFilter.IsEmpty() )
+      {
+        data.Empty();
+        if (enigma2)
+          result = g_tuxbox.ParseChannelsEnigma2(root, items, url, strFilter, strXMLChildString);
+        else
+          result = g_tuxbox.ParseChannels(root, items, url, strFilter, strXMLChildString);
+      }
+      else
+      {
+        CLog::Log(LOGERROR, "%s - Invalid root xml element for TuxBox", __FUNCTION__);
+        CLog::Log(LOGERROR, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str());
+        data.Empty();
+        result = false;
+      }
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Unable to get XML structure! Try count:%i, Wait Timer:%is",__FUNCTION__, iTryConnect, iWaitTimer);
+      iTryConnect++;
+      if (iTryConnect == 2) //try enigma2 instead of enigma1, best entrypoint here i thought
+      {        
+        enigma2 = true;
+        GetRootAndChildStringEnigma2(strBQRequest, strXMLRootString, strXMLChildString);
+        url.SetOptions("");
+        url.SetFileName(strBQRequest);
+//        iTryConnect = 0;
+        iWaitTimer = 20;
+      }
+      else
+        iWaitTimer = iWaitTimer+10;
+
+      result = false;
+      http.Close(); // Close old connections
+    }
+  }
+  items.SetContent("movies");
+  return result;
+}
+
+void CTuxBoxDirectory::GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
+{
+  // Allways take getallservices for Enigma2
+  strBQRequest = "web/getallservices"; //Bouquets and Channels
+  strXMLRootString.Format("e2servicelistrecursive");
+  strXMLChildString.Format("e2bouquet");
+}
+
+bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
+{
+  //Advanced Settings: RootMode! Movies:
+  if(g_advancedSettings.m_iTuxBoxDefaultRootMenu == 3) //Movies! Fixed-> mode=3&submode=4
+  {
+    CLog::Log(LOGDEBUG, "%s - Default defined RootMenu : (3) Movies", __FUNCTION__);
+    strBQRequest = "xml/services?mode=3&submode=4";
+    strXMLRootString.Format("movies");
+    strXMLChildString.Format("service");
+  }
+  else if(g_advancedSettings.m_iTuxBoxDefaultRootMenu <= 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu == 1 ||
+    g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4 )
+  {
+    //Falling Back to the Default RootMenu => 0 Bouquets
+    if(g_advancedSettings.m_iTuxBoxDefaultRootMenu < 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4)
+    {
+      g_advancedSettings.m_iTuxBoxDefaultRootMenu = 0;
+    }
+
+    //Advanced Settings: SubMenu!
+    if(g_advancedSettings.m_bTuxBoxSubMenuSelection)
+    {
+      CLog::Log(LOGDEBUG, "%s SubMenu Channel Selection is Enabled! Requesting Submenu!", __FUNCTION__);
+      // DeActivated: Timing Problems, bug in TuxBox.. etc.!
+      bool bReqMoRe = true;
+      // Detect the RootMode !
+      if (strPath.Find("?mode=")>=0)
+      {
+        CStdString strMode;
+        bReqMoRe=false;
+        strMode = g_tuxbox.DetectSubMode(strPath, strXMLRootString, strXMLChildString);
+      }
+      if(bReqMoRe)
+      {
+        //PopUp Context and Request SubMode with root and child string
+        strBQRequest = g_tuxbox.GetSubMode(g_advancedSettings.m_iTuxBoxDefaultRootMenu, strXMLRootString, strXMLChildString);
+        if(strBQRequest.IsEmpty())
+        {
+          strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
+          strXMLRootString.Format("bouquets");
+          strXMLChildString.Format("bouquet");
+        }
+      }
+    }
+    else
+    {
+      //Advanced Settings: Set Default Subemnu
+      if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 1)
+      {
+        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (1) Services", __FUNCTION__);
+        strBQRequest = "xml/services?mode=0&submode=1"; //Services
+        strXMLRootString.Format("services");
+        strXMLChildString.Format("service");
+      }
+      else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 2)
+      {
+        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (2) Satellites", __FUNCTION__);
+        strBQRequest = "xml/services?mode=0&submode=2"; //Satellites
+        strXMLRootString.Format("satellites");
+        strXMLChildString.Format("satellite");
+      }
+      else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 3)
+      {
+        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (3) Providers", __FUNCTION__);
+        strBQRequest = "xml/services?mode=0&submode=3"; //Providers
+        strXMLRootString.Format("providers");
+        strXMLChildString.Format("provider");
+      }
+      else
+      {
+        CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (4) Bouquets", __FUNCTION__);
+        strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
+        strXMLRootString.Format("bouquets");
+        strXMLChildString.Format("bouquet");
+      }
+    }
+  }
+  if(strBQRequest.IsEmpty() || strXMLRootString.IsEmpty() || strXMLChildString.IsEmpty())
+    return false;
+  else
+    return true;
+}
diff --git a/xbmc/filesystem/TuxBoxDirectory.h b/xbmc/filesystem/TuxBoxDirectory.h
new file mode 100644 (file)
index 0000000..eebb8c9
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IDirectory.h"
+
+class CURL;
+class TiXmlElement;
+
+namespace XFILE
+{
+  class CTuxBoxDirectory : public IDirectory
+  {
+    public:
+      CTuxBoxDirectory(void);
+      virtual ~CTuxBoxDirectory(void);
+      virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
+      virtual bool IsAllowed(const CStdString &strFile) const { return true; };
+      virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const { return DIR_CACHE_ALWAYS; };
+    private:
+      bool GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString );
+      void GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString );
+  };
+}
+
diff --git a/xbmc/filesystem/TuxBoxFile.cpp b/xbmc/filesystem/TuxBoxFile.cpp
new file mode 100644 (file)
index 0000000..877df91
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "TuxBoxFile.h"
+#include <errno.h>
+
+//Reserved for TuxBox Recording!
+
+using namespace XFILE;
+
+CTuxBoxFile::CTuxBoxFile()
+{}
+
+CTuxBoxFile::~CTuxBoxFile()
+{
+}
+
+int64_t CTuxBoxFile::GetPosition()
+{
+  return 0;
+}
+
+int64_t CTuxBoxFile::GetLength()
+{
+  return 0;
+}
+
+bool CTuxBoxFile::Open(const CURL& url)
+{
+  return true;
+}
+
+unsigned int CTuxBoxFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  return 0;
+}
+
+int64_t CTuxBoxFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  return 0;
+}
+
+void CTuxBoxFile::Close()
+{
+}
+
+bool CTuxBoxFile::Exists(const CURL& url)
+{
+  return true;
+}
+
+int CTuxBoxFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  errno = ENOENT;
+  return -1;
+}
+
diff --git a/xbmc/filesystem/TuxBoxFile.h b/xbmc/filesystem/TuxBoxFile.h
new file mode 100644 (file)
index 0000000..9e0aa3a
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+
+namespace XFILE
+{
+  class CTuxBoxFile : public IFile
+  {
+    public:
+      CTuxBoxFile();
+      virtual ~CTuxBoxFile();
+      virtual int64_t GetPosition();
+      virtual int64_t GetLength();
+      virtual bool Open(const CURL& url);
+      virtual void Close();
+      virtual bool Exists(const CURL& url);
+      virtual int Stat(const CURL& url, struct __stat64* buffer);
+      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+      virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+    protected:
+  };
+}
+
+
+
diff --git a/xbmc/filesystem/UDFFile.cpp b/xbmc/filesystem/UDFFile.cpp
new file mode 100644 (file)
index 0000000..863ac37
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ *      Copyright (C) 2010 Team Boxee
+ *      http://www.boxee.tv
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "UDFFile.h"
+#include "URL.h"
+#include "Util.h"
+
+#include <sys/stat.h>
+#include <errno.h>
+
+using namespace std;
+using namespace XFILE;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+//*********************************************************************************************
+CUDFFile::CUDFFile()
+{
+  m_bOpened = false;
+}
+
+//*********************************************************************************************
+CUDFFile::~CUDFFile()
+{
+  if (m_bOpened)
+  {
+    Close();
+  }
+}
+//*********************************************************************************************
+bool CUDFFile::Open(const CURL& url)
+{
+  CStdString strFName = url.GetHostName();
+
+  CURL::Decode(strFName);
+
+  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
+  if (m_hFile == INVALID_HANDLE_VALUE)
+  {
+    m_bOpened = false;
+    return false;
+  }
+
+  m_bOpened = true;
+  return true;
+}
+
+//*********************************************************************************************
+unsigned int CUDFFile::Read(void *lpBuf, int64_t uiBufSize)
+{
+  if (!m_bOpened) return 0;
+  char *pData = (char *)lpBuf;
+
+  int iResult = m_udfIsoReaderLocal.ReadFile( m_hFile, (unsigned char*)pData, (long)uiBufSize);
+  if (iResult == -1)
+    return 0;
+  return iResult;
+}
+
+//*********************************************************************************************
+void CUDFFile::Close()
+{
+  if (!m_bOpened) return ;
+  m_udfIsoReaderLocal.CloseFile( m_hFile);
+}
+
+//*********************************************************************************************
+int64_t CUDFFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  if (!m_bOpened) return -1;
+  int64_t lNewPos = m_udfIsoReaderLocal.Seek(m_hFile, iFilePosition, iWhence);
+  return lNewPos;
+}
+
+//*********************************************************************************************
+int64_t CUDFFile::GetLength()
+{
+  if (!m_bOpened) return -1;
+  return m_udfIsoReaderLocal.GetFileSize(m_hFile);
+}
+
+//*********************************************************************************************
+int64_t CUDFFile::GetPosition()
+{
+  if (!m_bOpened) return -1;
+  return m_udfIsoReaderLocal.GetFilePosition(m_hFile);
+}
+
+bool CUDFFile::Exists(const CURL& url)
+{
+  string strFName = "\\";
+  strFName += url.GetFileName();
+  for (int i = 0; i < (int)strFName.size(); ++i )
+  {
+    if (strFName[i] == '/') strFName[i] = '\\';
+  }
+  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
+  if (m_hFile == INVALID_HANDLE_VALUE)
+    return false;
+
+  m_udfIsoReaderLocal.CloseFile(m_hFile);
+  return true;
+}
+
+int CUDFFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  string strFName = "\\";
+  strFName += url.GetFileName();
+  for (int i = 0; i < (int)strFName.size(); ++i )
+  {
+    if (strFName[i] == '/') strFName[i] = '\\';
+  }
+  m_hFile = m_udfIsoReaderLocal.OpenFile((char*)strFName.c_str());
+  if (m_hFile != INVALID_HANDLE_VALUE)
+  {
+    buffer->st_size = m_udfIsoReaderLocal.GetFileSize(m_hFile);
+    buffer->st_mode = _S_IFREG;
+    m_udfIsoReaderLocal.CloseFile(m_hFile);
+    return 0;
+  }
+  errno = ENOENT;
+  return -1;
+}
diff --git a/xbmc/filesystem/UDFFile.h b/xbmc/filesystem/UDFFile.h
new file mode 100644 (file)
index 0000000..a8deba1
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef _FILEUDF_H
+#define _FILEUDF_H
+
+/*
+ *      Copyright (C) 2010 Team Boxee
+ *      http://www.boxee.tv
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+#include "udf25.h"
+
+namespace XFILE
+{
+
+class CUDFFile : public IFile
+{
+public:
+  CUDFFile();
+  virtual ~CUDFFile();
+  virtual int64_t GetPosition();
+  virtual int64_t GetLength();
+  virtual bool Open(const CURL& url);
+  virtual bool Exists(const CURL& url);
+  virtual int Stat(const CURL& url, struct __stat64* buffer);
+  virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+  virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+  virtual void Close();
+protected:
+  bool m_bOpened;
+  HANDLE m_hFile;
+  udf25 m_udfIsoReaderLocal;
+};
+}
+
+#endif
diff --git a/xbmc/filesystem/UPnPFile.cpp b/xbmc/filesystem/UPnPFile.cpp
new file mode 100644 (file)
index 0000000..3d7db4b
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "UPnPFile.h"
+#include "UPnPDirectory.h"
+#include "FileFactory.h"
+#include "FileItem.h"
+#include "utils/log.h"
+
+using namespace XFILE;
+
+CUPnPFile::CUPnPFile()
+{
+}
+
+CUPnPFile::~CUPnPFile()
+{
+}
+
+bool CUPnPFile::Open(const CURL& url)
+{
+  CFileItem item_new;
+  if (CUPnPDirectory::GetResource(url.Get(), item_new))
+  {
+    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
+    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());    
+    CURL *pNewUrl = new CURL(item_new.GetPath());    
+    if (pNewImp)
+    {
+      throw new CRedirectException(pNewImp, pNewUrl);
+    }
+    SAFE_DELETE(pNewUrl);    
+  }
+  return false;
+}
+
+int CUPnPFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  CFileItem item_new;
+  if (CUPnPDirectory::GetResource(url.Get(), item_new))
+  {
+    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
+    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
+    CURL *pNewUrl = new CURL(item_new.GetPath());
+    if (pNewImp)
+    {
+      throw new CRedirectException(pNewImp, pNewUrl);
+    }
+    SAFE_DELETE(pNewUrl);
+  }
+  return -1;
+}
+
+bool CUPnPFile::Exists(const CURL& url)
+{
+  CFileItem item_new;
+  if (CUPnPDirectory::GetResource(url.Get(), item_new))
+  {
+    //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
+    IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
+    CURL *pNewUrl = new CURL(item_new.GetPath());
+    if (pNewImp)
+    {
+      throw new CRedirectException(pNewImp, pNewUrl);
+    }
+    SAFE_DELETE(pNewUrl);
+  }
+  return false;
+}
diff --git a/xbmc/filesystem/UPnPFile.h b/xbmc/filesystem/UPnPFile.h
new file mode 100644 (file)
index 0000000..e98e091
--- /dev/null
@@ -0,0 +1,42 @@
+#pragma once
+/*
+ *      Copyright (C) 2011 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "IFile.h"
+
+namespace XFILE
+{
+  class CUPnPFile : public IFile
+  {
+    public:
+      CUPnPFile();
+      virtual ~CUPnPFile();
+      virtual bool Open(const CURL& url);      
+      virtual bool Exists(const CURL& url);
+      virtual int Stat(const CURL& url, struct __stat64* buffer);
+      
+      virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) {return -1;}
+      virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET) {return -1;}
+      virtual void Close(){}
+      virtual int64_t GetPosition() {return -1;}
+      virtual int64_t GetLength() {return -1;}
+  };
+}
index 3e3a49c..0f3969a 100644 (file)
 
 #include "system.h"
 #include "VirtualDirectory.h"
-#include "FactoryDirectory.h"
+#include "DirectoryFactory.h"
 #include "Util.h"
 #include "utils/URIUtils.h"
 #include "Directory.h"
-#include "DirectoryCache.h"
+#include "CacheDirectory.h"
 #include "SourcesDirectory.h"
 #include "storage/MediaManager.h"
 #include "File.h"
diff --git a/xbmc/filesystem/ZipFile.cpp b/xbmc/filesystem/ZipFile.cpp
new file mode 100644 (file)
index 0000000..25ef89d
--- /dev/null
@@ -0,0 +1,514 @@
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "ZipFile.h"
+#include "URL.h"
+#include "utils/URIUtils.h"
+
+#include <sys/stat.h>
+
+#define ZIP_CACHE_LIMIT 4*1024*1024
+
+using namespace XFILE;
+using namespace std;
+
+CZipFile::CZipFile()
+{
+  m_szStringBuffer = NULL;
+  m_szStartOfStringBuffer = NULL;
+  m_iDataInStringBuffer = 0;
+  m_bCached = false;
+  m_iRead = -1;
+}
+
+CZipFile::~CZipFile()
+{
+  delete[] m_szStringBuffer;
+  Close();
+}
+
+bool CZipFile::Open(const CURL&url)
+{
+  CStdString strOpts = url.GetOptions();
+  CURL url2(url);
+  url2.SetOptions("");
+  CStdString strPath = url2.Get();
+  if (!g_ZipManager.GetZipEntry(strPath,mZipItem))
+    return false;
+
+  if ((mZipItem.flags & 64) == 64)
+  {
+    CLog::Log(LOGERROR,"FileZip: encrypted file, not supported!");
+    return false;
+  }
+
+  if ((mZipItem.method != 8) && (mZipItem.method != 0))
+  {
+    CLog::Log(LOGERROR,"FileZip: unsupported compression method!");
+    return false;
+  }
+
+  if (mZipItem.method != 0 && mZipItem.usize > ZIP_CACHE_LIMIT && strOpts != "?cache=no")
+  {
+    if (!CFile::Exists("special://temp/" + URIUtils::GetFileName(strPath)))
+    {
+      url2.SetOptions("?cache=no");
+      if (!CFile::Cache(url2.Get(), "special://temp/" + URIUtils::GetFileName(strPath)))
+        return false;
+    }
+    m_bCached = true;
+    return mFile.Open("special://temp/" + URIUtils::GetFileName(strPath));
+  }
+
+  if (!mFile.Open(url.GetHostName())) // this is the zip-file, always open binary
+  {
+    CLog::Log(LOGERROR,"FileZip: unable to open zip file %s!",url.GetHostName().c_str());
+    return false;
+  }
+  mFile.Seek(mZipItem.offset,SEEK_SET);
+  return InitDecompress();
+}
+
+bool CZipFile::InitDecompress()
+{
+  m_iRead = 1;
+  m_iFilePos = 0;
+  m_iZipFilePos = 0;
+  m_iAvailBuffer = 0;
+  m_bFlush = false;
+  m_ZStream.zalloc = Z_NULL;
+  m_ZStream.zfree = Z_NULL;
+  m_ZStream.opaque = Z_NULL;
+  if( mZipItem.method != 0 )
+  {
+    if (inflateInit2(&m_ZStream,-MAX_WBITS) != Z_OK)
+    {
+      CLog::Log(LOGERROR,"FileZip: error initializing zlib!");
+      return false;
+    }
+  }
+  m_ZStream.next_in = (Bytef*)m_szBuffer;
+  m_ZStream.avail_in = 0;
+  m_ZStream.total_out = 0;
+
+  return true;
+}
+
+int64_t CZipFile::GetLength()
+{
+  return mZipItem.usize;
+}
+
+int64_t CZipFile::GetPosition()
+{
+  if (m_bCached)
+    return mFile.GetPosition();
+
+  return m_iFilePos;
+}
+
+int64_t CZipFile::Seek(int64_t iFilePosition, int iWhence)
+{
+  if (m_bCached)
+    return mFile.Seek(iFilePosition,iWhence);
+  if (mZipItem.method == 0) // this is easy
+  {
+    int64_t iResult;
+    switch (iWhence)
+    {
+    case SEEK_SET:
+      if (iFilePosition > mZipItem.usize)
+        return -1;
+      m_iFilePos = iFilePosition;
+      m_iZipFilePos = m_iFilePos;
+      iResult = mFile.Seek(iFilePosition+mZipItem.offset,SEEK_SET)-mZipItem.offset;
+      return iResult;
+      break;
+
+    case SEEK_CUR:
+      if (m_iFilePos+iFilePosition > mZipItem.usize)
+        return -1;
+      m_iFilePos += iFilePosition;
+      m_iZipFilePos = m_iFilePos;
+      iResult = mFile.Seek(iFilePosition,SEEK_CUR)-mZipItem.offset;
+      return iResult;
+      break;
+
+    case SEEK_END:
+      if (iFilePosition > mZipItem.usize)
+        return -1;
+      m_iFilePos = mZipItem.usize+iFilePosition;
+      m_iZipFilePos = m_iFilePos;
+      iResult = mFile.Seek(mZipItem.offset+mZipItem.usize+iFilePosition,SEEK_SET)-mZipItem.offset;
+      return iResult;
+      break;
+    default:
+      return -1;
+
+    }
+  }
+  // here goes the stupid part..
+  if (mZipItem.method == 8)
+  {
+    char temp[131072];
+    switch (iWhence)
+    {
+    case SEEK_SET:
+      if (iFilePosition == m_iFilePos)
+        return m_iFilePos; // mp3reader does this lots-of-times
+      if (iFilePosition > mZipItem.usize || iFilePosition < 0)
+        return -1;
+      // read until position in 128k blocks.. only way to do it due to format.
+      // can't start in the middle of data since then we'd have no clue where
+      // we are in uncompressed data..
+      if (iFilePosition < m_iFilePos)
+      {
+        m_iFilePos = 0;
+        m_iZipFilePos = 0;
+        inflateEnd(&m_ZStream);
+        inflateInit2(&m_ZStream,-MAX_WBITS); // simply restart zlib
+        mFile.Seek(mZipItem.offset,SEEK_SET);
+        m_ZStream.next_in = (Bytef*)m_szBuffer;
+        m_ZStream.avail_in = 0;
+        m_ZStream.total_out = 0;
+        while (m_iFilePos < iFilePosition)
+        {
+          unsigned int iToRead = (iFilePosition-m_iFilePos)>131072?131072:(int)(iFilePosition-m_iFilePos);
+          if (Read(temp,iToRead) != iToRead)
+            return -1;
+        }
+        return m_iFilePos;
+      }
+      else // seek forward
+        return Seek(iFilePosition-m_iFilePos,SEEK_CUR);
+      break;
+
+    case SEEK_CUR:
+      if (iFilePosition < 0)
+        return Seek(m_iFilePos+iFilePosition,SEEK_SET); // can't rewind stream
+      // read until requested position, drop data
+      if (m_iFilePos+iFilePosition > mZipItem.usize)
+        return -1;
+      iFilePosition += m_iFilePos;
+      while (m_iFilePos < iFilePosition)
+      {
+        unsigned int iToRead = (iFilePosition-m_iFilePos)>131072?131072:(int)(iFilePosition-m_iFilePos);
+        if (Read(temp,iToRead) != iToRead)
+          return -1;
+      }
+      return m_iFilePos;
+      break;
+
+    case SEEK_END:
+      // now this is a nasty bastard, possibly takes lotsoftime
+      // uncompress, minding m_ZStream.total_out
+
+      while( (int)m_ZStream.total_out < mZipItem.usize+iFilePosition)
+      {
+        unsigned int iToRead = (mZipItem.usize+iFilePosition-m_ZStream.total_out > 131072)?131072:(int)(mZipItem.usize+iFilePosition-m_ZStream.total_out);
+        if (Read(temp,iToRead) != iToRead)
+          return -1;
+      }
+      return m_iFilePos;
+      break;
+    default:
+      return -1;
+    }
+  }
+  return -1;
+}
+
+bool CZipFile::Exists(const CURL& url)
+{
+  SZipEntry item;
+  if (g_ZipManager.GetZipEntry(url.Get(),item))
+    return true;
+  return false;
+}
+
+int CZipFile::Stat(struct __stat64 *buffer)
+{
+  int ret;
+  struct tm tm = {};
+
+  ret = mFile.Stat(buffer);
+  tm.tm_sec = (mZipItem.mod_time & 0x1F) << 1;
+  tm.tm_min = (mZipItem.mod_time & 0x7E0) >> 5;
+  tm.tm_hour = (mZipItem.mod_time & 0xF800) >> 11;
+  tm.tm_mday = (mZipItem.mod_date & 0x1F);
+  tm.tm_mon = (mZipItem.mod_date & 0x1E0) >> 5;
+  tm.tm_year = (mZipItem.mod_date & 0xFE00) >> 9;
+  buffer->st_atime = buffer->st_ctime = buffer->st_mtime = mktime(&tm);
+
+  buffer->st_size = mZipItem.usize;
+  buffer->st_dev = (buffer->st_dev << 16) ^ (buffer->st_ino << 16);
+  buffer->st_ino ^= mZipItem.crc32;
+  return ret;
+}
+
+int CZipFile::Stat(const CURL& url, struct __stat64* buffer)
+{
+  if (!g_ZipManager.GetZipEntry(url.Get(),mZipItem))
+    return -1;
+
+  memset(buffer, 0, sizeof(struct __stat64));
+  buffer->st_gid = 0;
+  buffer->st_atime = buffer->st_ctime = mZipItem.mod_time;
+  buffer->st_size = mZipItem.usize;
+  return 0;
+}
+
+unsigned int CZipFile::Read(void* lpBuf, int64_t uiBufSize)
+{
+  if (m_bCached)
+    return mFile.Read(lpBuf,uiBufSize);
+
+  // flush what might be left in the string buffer
+  if (m_iDataInStringBuffer > 0)
+  {
+    size_t iMax = static_cast<size_t>((uiBufSize>m_iDataInStringBuffer?m_iDataInStringBuffer:uiBufSize));
+    memcpy(lpBuf,m_szStartOfStringBuffer,iMax);
+    uiBufSize -= iMax;
+    m_iDataInStringBuffer -= iMax;
+  }
+  if (mZipItem.method == 8) // deflated
+  {
+    uLong iDecompressed = 0;
+    uLong prevOut = m_ZStream.total_out;
+    while (((int)iDecompressed < uiBufSize) && ((m_iZipFilePos < mZipItem.csize) || (m_bFlush)))
+    {
+      m_ZStream.next_out = (Bytef*)(lpBuf)+iDecompressed;
+      m_ZStream.avail_out = static_cast<uInt>(uiBufSize-iDecompressed);
+      if (m_bFlush) // need to flush buffer !
+      {
+        int iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
+        m_bFlush = ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))?true:false;
+        if (!m_ZStream.avail_out) // flush filled buffer, get out of here
+        {
+          iDecompressed = m_ZStream.total_out-prevOut;
+          break;
+        }
+      }
+
+      if (!m_ZStream.avail_in)
+      {
+        if (!FillBuffer()) // eof!
+        {
+          iDecompressed = m_ZStream.total_out-prevOut;
+          break;
+        }
+      }
+
+      int iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
+      if (iMessage < 0)
+      {
+        Close();
+        return 0; // READ ERROR
+      }
+
+      m_bFlush = ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))?true:false; // more info in input buffer
+
+      iDecompressed = m_ZStream.total_out-prevOut;
+    }
+    m_iFilePos += iDecompressed;
+    return static_cast<unsigned int>(iDecompressed);
+  }
+  else if (mZipItem.method == 0) // uncompressed. just read from file, but mind our boundaries.
+  {
+    if (uiBufSize+m_iFilePos > mZipItem.csize)
+      uiBufSize = mZipItem.csize-m_iFilePos;
+    if (uiBufSize < 0)
+    {
+      return 0; // we are past eof, this shouldn't happen but test anyway
+    }
+    unsigned int iResult = mFile.Read(lpBuf,uiBufSize);
+    m_iZipFilePos += iResult;
+    m_iFilePos += iResult;
+    return iResult;
+  }
+  else
+    return false; // shouldn't happen. compression method checked in open
+}
+
+void CZipFile::Close()
+{
+  if (mZipItem.method == 8 && !m_bCached && m_iRead != -1)
+    inflateEnd(&m_ZStream);
+
+  mFile.Close();
+}
+/* CHANGED: JM - moved to CFile
+bool CZipFile::ReadString(char* szLine, int iLineLength)
+{
+  if (!m_szStringBuffer)
+  {
+    m_szStringBuffer = new char[1024]; // 1024 byte long strings per read
+    m_szStartOfStringBuffer = m_szStringBuffer;
+    m_iDataInStringBuffer = 0;
+    m_iRead = 0;
+  }
+
+  bool bEof = m_iDataInStringBuffer==0;
+  while ((iLineLength > 1) && (m_iRead > -1))
+  {
+    if (m_iDataInStringBuffer > 0)
+    {
+      bEof = false;
+      m_iRead = 1;
+      int iMax = (iLineLength<m_iDataInStringBuffer?iLineLength-1:m_iDataInStringBuffer-1);
+      for( int i=0;i<iMax;++i )
+      {
+        if (m_szStartOfStringBuffer[i] == '\r') // mac or win32 endings
+        {
+          strncpy(szLine,m_szStartOfStringBuffer,i);
+          szLine[i] = '\0';
+          m_iDataInStringBuffer -= i+1;
+          m_szStartOfStringBuffer += i+1;
+          if( m_szStartOfStringBuffer[0] == '\n') // win32 endings
+          {
+            m_szStartOfStringBuffer++;
+            m_iDataInStringBuffer--;
+          }
+          return true;
+        }
+        else if (m_szStartOfStringBuffer[i] == '\n') // unix or fucked up win32 endings
+        {
+          strncpy(szLine,m_szStartOfStringBuffer,i);
+          szLine[i] = '\0';
+          m_iDataInStringBuffer -= i+1;
+          m_szStartOfStringBuffer += i+1;
+          if (m_szStartOfStringBuffer[0] == '\r')
+          {
+            m_szStartOfStringBuffer++;
+            m_iDataInStringBuffer--;
+          }
+          return true;
+        }
+      }
+      strncpy(szLine,m_szStartOfStringBuffer,iMax);
+      szLine += iMax;
+      iLineLength -= iMax;
+      m_iDataInStringBuffer -= iMax;
+    }
+
+    if (m_iRead == 1 && (m_iDataInStringBuffer == 1))
+    {
+      m_szStringBuffer[0] = m_szStringBuffer[1023]; // need to make sure we don't loose any '\r\n' between buffers
+      m_iDataInStringBuffer = Read(m_szStringBuffer+1,1023);
+    }
+    else
+      m_iDataInStringBuffer = Read(m_szStringBuffer,1024);
+    m_szStartOfStringBuffer = m_szStringBuffer;
+    if (m_iDataInStringBuffer)
+      m_iRead = 1;
+    else
+      m_iRead = -1;
+  }
+  szLine[0] = '\0';
+  return !bEof;
+}*/
+
+bool CZipFile::FillBuffer()
+{
+  unsigned int sToRead = 65535;
+  if (m_iZipFilePos+65535 > mZipItem.csize)
+    sToRead = static_cast<int>(mZipItem.csize-m_iZipFilePos);
+
+  if (sToRead <= 0)
+    return false; // eof!
+
+  if (mFile.Read(m_szBuffer,sToRead) != sToRead)
+    return false;
+  m_ZStream.avail_in = sToRead;
+  m_ZStream.next_in = (Bytef*)m_szBuffer;
+  m_iZipFilePos += sToRead;
+  return true;
+}
+
+void CZipFile::DestroyBuffer(void* lpBuffer, int iBufSize)
+{
+  if (!m_bFlush)
+    return;
+  int iMessage = Z_STREAM_END; // whatever != Z_OK
+  while ((iMessage == Z_OK) && (m_ZStream.avail_out == 0))
+  {
+    m_ZStream.next_out = (Bytef*)lpBuffer;
+    m_ZStream.avail_out = iBufSize;
+    iMessage = inflate(&m_ZStream,Z_SYNC_FLUSH);
+  }
+  m_bFlush = false;
+}
+
+int CZipFile::UnpackFromMemory(string& strDest, const string& strInput, bool isGZ)
+{
+  unsigned int iPos=0;
+  int iResult=0;
+  while( iPos+LHDR_SIZE < strInput.size() || isGZ)
+  {
+    if (!isGZ)
+    {
+      CZipManager::readHeader(strInput.data()+iPos,mZipItem);
+      if( mZipItem.header != ZIP_LOCAL_HEADER )
+        return iResult;
+      if( (mZipItem.flags & 8) == 8 )
+      {
+        CLog::Log(LOGERROR,"FileZip: extended local header, not supported!");
+        return iResult;
+      }
+    }
+    if (!InitDecompress())
+      return iResult;
+    // we have a file - fill the buffer
+    char* temp;
+    int toRead=0;
+    if (isGZ)
+    {
+      m_ZStream.avail_in = strInput.size();
+      m_ZStream.next_in = (Bytef*)strInput.data();
+      temp = new char[8192];
+      toRead = 8191;
+    }
+    else
+    {
+      m_ZStream.avail_in = mZipItem.csize;
+      m_ZStream.next_in = (Bytef*)strInput.data()+iPos+LHDR_SIZE+mZipItem.flength+mZipItem.elength;
+      // init m_zipitem
+      strDest.reserve(mZipItem.usize);
+      temp = new char[mZipItem.usize+1];
+      toRead = mZipItem.usize;
+    }
+    int iCurrResult;
+    while( (iCurrResult=Read(temp,toRead)) > 0)
+    {
+      strDest.append(temp,temp+iCurrResult);
+      iResult += iCurrResult;
+    }
+    Close();
+    delete[] temp;
+    iPos += LHDR_SIZE+mZipItem.flength+mZipItem.elength+mZipItem.csize;
+    if (isGZ)
+      break;
+  }
+
+  return iResult;
+}
+
+
diff --git a/xbmc/filesystem/ZipFile.h b/xbmc/filesystem/ZipFile.h
new file mode 100644 (file)
index 0000000..f4fb1ee
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef FILE_ZIP_H_
+#define FILE_ZIP_H_
+/*
+ *      Copyright (C) 2005-2008 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "IFile.h"
+#include <zlib.h>
+#include "utils/log.h"
+#include "File.h"
+#include "ZipManager.h"
+
+namespace XFILE
+{
+  class CZipFile : public IFile
+  {
+  public:
+    CZipFile();
+    virtual ~CZipFile();
+
+    virtual int64_t GetPosition();
+    virtual int64_t GetLength();
+    virtual bool Open(const CURL& url);
+    virtual bool Exists(const CURL& url);
+    virtual int Stat(struct __stat64* buffer);
+    virtual int Stat(const CURL& url, struct __stat64* buffer);
+    virtual unsigned int Read(void* lpBuf, int64_t uiBufSize);
+    //virtual bool ReadString(char *szLine, int iLineLength);
+    virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET);
+    virtual void Close();
+
+    int UnpackFromMemory(std::string& strDest, const std::string& strInput, bool isGZ=false);
+  private:
+    bool InitDecompress();
+    bool FillBuffer();
+    void DestroyBuffer(void* lpBuffer, int iBufSize);
+    CFile mFile;
+    SZipEntry mZipItem;
+    int64_t m_iFilePos; // position in _uncompressed_ data read
+    int64_t m_iZipFilePos; // position in _compressed_ data
+    int m_iAvailBuffer;
+    z_stream m_ZStream;
+    char m_szBuffer[65535];     // 64k buffer for compressed data
+    char* m_szStringBuffer;
+    char* m_szStartOfStringBuffer; // never allocated!
+    int m_iDataInStringBuffer;
+    int m_iRead;
+    bool m_bFlush;
+    bool m_bCached;
+  };
+}
+
+#endif
index 28a84a6..5944c22 100644 (file)
@@ -44,7 +44,7 @@
 #include "settings/Settings.h"
 #include "settings/AdvancedSettings.h"
 #include "settings/GUISettings.h"
-#include "filesystem/FactoryDirectory.h"
+#include "filesystem/DirectoryFactory.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/StringUtils.h"
 #include "utils/TimeUtils.h"
index 700f28a..6df634b 100644 (file)
@@ -29,7 +29,7 @@
 #include "pictures/Picture.h"
 #include "utils/md5.h"
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "GUIInfoManager.h"
 #include "MusicDatabase.h"
 #include "music/tags/MusicInfoTag.h"
index 7cf8156..992ffa1 100644 (file)
@@ -23,7 +23,7 @@
 #include "system.h"
 #include "MusicDatabase.h"
 #include "network/cddb.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/MusicDatabaseDirectory/DirectoryNode.h"
 #include "filesystem/MusicDatabaseDirectory/QueryParams.h"
 #include "filesystem/MusicDatabaseDirectory.h"
index d8b205f..02e3eaf 100644 (file)
@@ -22,7 +22,7 @@
 #include "MusicInfoLoader.h"
 #include "MusicDatabase.h"
 #include "music/tags/MusicInfoTagLoaderFactory.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/MusicDatabaseDirectory.h"
 #include "filesystem/MusicDatabaseDirectory/DirectoryNode.h"
 #include "filesystem/MusicDatabaseDirectory/QueryParams.h"
index 5dfe4ab..26333c9 100644 (file)
@@ -31,7 +31,7 @@
 #include "music/tags/MusicInfoTag.h"
 #include "guilib/GUIWindowManager.h"
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "FileItem.h"
 #include "settings/Settings.h"
 #include "settings/AdvancedSettings.h"
index 3400f27..8a78ee7 100644 (file)
@@ -24,7 +24,7 @@
 #include "music/tags/MusicInfoTagLoaderFactory.h"
 #include "MusicAlbumInfo.h"
 #include "MusicInfoScraper.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "filesystem/MusicDatabaseDirectory.h"
 #include "filesystem/MusicDatabaseDirectory/DirectoryNode.h"
 #include "Util.h"
index ed34d53..191550b 100644 (file)
@@ -25,7 +25,7 @@
 #include "MusicArtistInfo.h"
 #include "addons/Scraper.h"
 #include "threads/Thread.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 
 namespace MUSIC_GRABBER
 {
index ee5d71e..9af41f1 100644 (file)
@@ -33,7 +33,7 @@
 #include "playlists/PlayListM3U.h"
 #include "Application.h"
 #include "PlayListPlayer.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #ifdef HAS_CDDA_RIPPER
 #include "cdrip/CDDARipper.h"
 #endif
index f092bb4..06808d8 100644 (file)
@@ -31,7 +31,7 @@
 #include "utils/StdString.h"
 #include "network/Zeroconf.h"
 #include "ApplicationMessenger.h"
-#include "filesystem/FilePipe.h"
+#include "filesystem/PipeFile.h"
 #include "Application.h"
 #include "cores/paplayer/BXAcodec.h"
 #include "music/tags/MusicInfoTag.h"
index 08d1d59..da893df 100644 (file)
@@ -37,7 +37,7 @@
 #include "threads/CriticalSection.h"
 #include "utils/HttpParser.h"
 #include "utils/StdString.h"
-#include "filesystem/FilePipe.h"
+#include "filesystem/PipeFile.h"
 
 class DllLibShairport;
 
index cb08d1b..391a825 100644 (file)
@@ -33,7 +33,7 @@
 #include "threads/SingleLock.h"
 #include "guilib/LocalizeStrings.h"
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 
 #define SCROBBLER_CLIENT              "xbm"
 //#define SCROBBLER_CLIENT              "tst"     // For testing ONLY!
index 54212d8..8b1e742 100644 (file)
@@ -24,7 +24,7 @@
 #include "settings/GUISettings.h"
 #include "FileItem.h"
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "DllImageLib.h"
 #include "utils/log.h"
 #include "utils/URIUtils.h"
index 4101090..596699d 100644 (file)
@@ -24,7 +24,7 @@
 #include "log.h"
 
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "threads/SingleLock.h"
 
 using namespace std;
index 578aee9..0946f01 100644 (file)
@@ -23,7 +23,7 @@
 #include "tinyXML/tinyxml.h"
 #include "URIUtils.h"
 #include "pictures/Picture.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "StringUtils.h"
 #include "filesystem/File.h"
 
index c8ff417..5990c4d 100644 (file)
@@ -23,7 +23,7 @@
 #include "filesystem/File.h"
 #include "filesystem/Directory.h"
 #include "filesystem/ZipManager.h"
-#include "filesystem/FactoryFileDirectory.h"
+#include "filesystem/FileDirectoryFactory.h"
 #include "filesystem/MultiPathDirectory.h"
 #include "filesystem/SpecialProtocol.h"
 #include "log.h"
index 18fcdb4..08a3678 100644 (file)
@@ -26,7 +26,7 @@
 #include "CharsetConverter.h"
 #include "URL.h"
 #include "filesystem/File.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #ifdef __APPLE__
 #include "CocoaInterface.h"
 #endif
index 04e09b6..5d37a09 100644 (file)
@@ -25,8 +25,8 @@
 #include "HTMLUtil.h"
 #include "CharsetConverter.h"
 #include "URL.h"
-#include "filesystem/FileCurl.h"
-#include "filesystem/FileZip.h"
+#include "filesystem/CurlFile.h"
+#include "filesystem/ZipFile.h"
 #include "pictures/Picture.h"
 #include "URIUtils.h"
 
index f4aacd1..2dfa8ed 100644 (file)
@@ -28,7 +28,7 @@
 #include <sys/utsname.h>
 #endif
 #include "GUIInfoManager.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "network/Network.h"
 #include "Application.h"
 #include "windowing/WindowingFactory.h"
index c15b634..2ef507e 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "TuxBoxUtil.h"
 #include "URIUtils.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 #include "dialogs/GUIDialogContextMenu.h"
 #include "Application.h"
 #include "GUIInfoManager.h"
index b91477d..498a88f 100644 (file)
@@ -26,7 +26,7 @@
 #include "addons/Scraper.h"
 #include "Episode.h"
 #include "XBDateTime.h"
-#include "filesystem/FileCurl.h"
+#include "filesystem/CurlFile.h"
 
 // forward declarations
 class TiXmlDocument;
index 6c9320a..78b222d 100644 (file)
@@ -23,7 +23,7 @@
 #include "FileItem.h"
 #include "VideoInfoScanner.h"
 #include "addons/AddonManager.h"
-#include "filesystem/DirectoryCache.h"
+#include "filesystem/CacheDirectory.h"
 #include "Util.h"
 #include "NfoFile.h"
 #include "utils/RegExp.h"
index 0af0748..072a2d3 100644 (file)
@@ -53,7 +53,7 @@
 #include "utils/URIUtils.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/TimeUtils.h"
-#include "filesystem/FactoryFileDirectory.h"
+#include "filesystem/FileDirectoryFactory.h"
 #include "utils/log.h"
 #include "utils/FileUtils.h"
 #include "guilib/GUIEditControl.h"