Skip to content

Commit

Permalink
cleanup unused HashDVD code
Browse files Browse the repository at this point in the history
  • Loading branch information
Voyager1 committed Jul 18, 2013
1 parent 27ce6cc commit dfa455c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
54 changes: 0 additions & 54 deletions xbmc/storage/MediaManager.cpp
Expand Up @@ -50,7 +50,6 @@
#include "filesystem/File.h"
#include "filesystem/DirectoryFactory.h"
#include "filesystem/Directory.h"
#include "utils/Crc32.h"

#include "cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h"

Expand Down Expand Up @@ -547,59 +546,6 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath)
return strID;
}

bool CMediaManager::HashDVD(const CStdString& dvdpath, uint32_t& crc)
{
CFileItemList vecItemsTS;
bool success = false;

// first try to open the VIDEO_TS folder of the DVD
if (!CDirectory::GetDirectory( dvdpath, vecItemsTS, ".ifo" ))
{
CLog::Log(LOGERROR, "%s - Cannot open dvd VIDEO_TS folder -- ABORTING", __FUNCTION__);
return false;
}

Crc32 crc32;
bool dataRead = false;

vecItemsTS.Sort(SORT_METHOD_FILE, SortOrderAscending);
for (int i = 0; i < vecItemsTS.Size(); i++)
{
CFileItemPtr videoTSItem = vecItemsTS[i];
success = true;

// get the file name for logging purposes
CStdString fileName = URIUtils::GetFileName(videoTSItem->GetPath());
CLog::Log(LOGDEBUG, "%s - Adding file content for dvd file: %s", __FUNCTION__, fileName.c_str());
CFile file;
if(!file.Open(videoTSItem->GetPath()))
{
CLog::Log(LOGERROR, "%s - Cannot open dvd file: %s -- ABORTING", __FUNCTION__, fileName.c_str());
return false;
}
int res;
char buf[2048];
while( (res = file.Read(buf, sizeof(buf))) > 0)
{
dataRead = true;
crc32.Compute(buf, res);
}
file.Close();
}

if (!dataRead)
{
CLog::Log(LOGERROR, "%s - Did not read any data from the IFO files -- ABORTING", __FUNCTION__);
return false;
}

// put result back in reference parameter
crc = (uint32_t) crc32;

return success;
}


CStdString CMediaManager::GetDiscPath()
{
#ifdef TARGET_WINDOWS
Expand Down
1 change: 0 additions & 1 deletion xbmc/storage/MediaManager.h
Expand Up @@ -104,7 +104,6 @@ class CMediaManager : public IStorageEventsCallback, public IJobCallback
CCriticalSection m_muAutoSource, m_CritSecStorageProvider;
#ifdef HAS_DVD_DRIVE
std::map<CStdString,CCdInfo*> m_mapCdInfo;
bool HashDVD(const CStdString& dvdpath, uint32_t& crc);
#endif
bool m_bhasoptical;
CStdString m_strFirstAvailDrive;
Expand Down

0 comments on commit dfa455c

Please sign in to comment.