Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CMediaManager Class Reference

#include <MediaManager.h>

Inheritance diagram for CMediaManager:
IStorageEventsCallback IJobCallback

Public Member Functions

 CMediaManager ()
 
void Initialize ()
 
void Stop ()
 
bool LoadSources ()
 
bool SaveSources ()
 
void GetLocalDrives (VECSOURCES &localDrives, bool includeQ=true)
 
void GetRemovableDrives (VECSOURCES &removableDrives)
 
void GetNetworkLocations (VECSOURCES &locations, bool autolocations=true)
 
bool AddNetworkLocation (const std::string &path)
 
bool HasLocation (const std::string &path) const
 
bool RemoveLocation (const std::string &path)
 
bool SetLocationPath (const std::string &oldPath, const std::string &newPath)
 
void AddAutoSource (const CMediaSource &share, bool bAutorun=false)
 
void RemoveAutoSource (const CMediaSource &share)
 
bool IsDiscInDrive (const std::string &devicePath="")
 
bool IsAudio (const std::string &devicePath="")
 
bool HasOpticalDrive ()
 
std::string TranslateDevicePath (const std::string &devicePath, bool bReturnAsDevice=false)
 
DriveState GetDriveStatus (const std::string &devicePath="")
 
std::string GetDiscPath ()
 
void SetHasOpticalDrive (bool bstatus)
 
bool Eject (const std::string &mountpath)
 
void EjectTray (const bool bEject=true, const char cDriveLetter='\0')
 
void CloseTray (const char cDriveLetter='\0')
 
void ToggleTray (const char cDriveLetter='\0')
 
void ProcessEvents ()
 
std::vector< std::string > GetDiskUsage ()
 
void OnStorageAdded (const MEDIA_DETECT::STORAGE::StorageDevice &device) override
 Callback executed when a new storage device is added.
 
void OnStorageSafelyRemoved (const MEDIA_DETECT::STORAGE::StorageDevice &device) override
 Callback executed when a new storage device is safely removed.
 
void OnStorageUnsafelyRemoved (const MEDIA_DETECT::STORAGE::StorageDevice &device) override
 Callback executed when a new storage device is unsafely removed.
 
void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 The callback used when a job completes.
 
bool playStubFile (const CFileItem &item)
 
- Public Member Functions inherited from IStorageEventsCallback
virtual ~IStorageEventsCallback ()=default
 
- Public Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects.
 
virtual void OnJobAbort (unsigned int jobID, CJob *job)
 An optional callback function used when a job will be aborted.
 
virtual void OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job)
 An optional callback function that a job may call while processing.
 

Protected Attributes

std::vector< CNetworkLocationm_locations
 
CCriticalSection m_muAutoSource
 
CCriticalSection m_CritSecStorageProvider
 
bool m_bhasoptical
 
std::string m_strFirstAvailDrive
 

Constructor & Destructor Documentation

◆ CMediaManager()

CMediaManager::CMediaManager ( )

Member Function Documentation

◆ AddAutoSource()

void CMediaManager::AddAutoSource ( const CMediaSource & share,
bool bAutorun = false )

◆ AddNetworkLocation()

bool CMediaManager::AddNetworkLocation ( const std::string & path)

◆ CloseTray()

void CMediaManager::CloseTray ( const char cDriveLetter = '\0')

◆ Eject()

bool CMediaManager::Eject ( const std::string & mountpath)

◆ EjectTray()

void CMediaManager::EjectTray ( const bool bEject = true,
const char cDriveLetter = '\0' )

◆ GetDiscPath()

std::string CMediaManager::GetDiscPath ( )

◆ GetDiskUsage()

std::vector< std::string > CMediaManager::GetDiskUsage ( )

◆ GetDriveStatus()

DriveState CMediaManager::GetDriveStatus ( const std::string & devicePath = "")

◆ GetLocalDrives()

void CMediaManager::GetLocalDrives ( VECSOURCES & localDrives,
bool includeQ = true )

◆ GetNetworkLocations()

void CMediaManager::GetNetworkLocations ( VECSOURCES & locations,
bool autolocations = true )

◆ GetRemovableDrives()

void CMediaManager::GetRemovableDrives ( VECSOURCES & removableDrives)

◆ HasLocation()

bool CMediaManager::HasLocation ( const std::string & path) const

◆ HasOpticalDrive()

bool CMediaManager::HasOpticalDrive ( )

◆ Initialize()

void CMediaManager::Initialize ( )

◆ IsAudio()

bool CMediaManager::IsAudio ( const std::string & devicePath = "")

◆ IsDiscInDrive()

bool CMediaManager::IsDiscInDrive ( const std::string & devicePath = "")

◆ LoadSources()

bool CMediaManager::LoadSources ( )

◆ OnJobComplete()

void CMediaManager::OnJobComplete ( unsigned int jobID,
bool success,
CJob * job )
inlineoverridevirtual

The callback used when a job completes.

OnJobComplete is called at the completion of the job's DoWork() function, and is used to return information to the caller on the result of the job. On returning form this function the CJobManager will destroy this job.

Parameters
jobIDthe unique id of the job (as retrieved from CJobManager::AddJob)
successthe result from the DoWork call
jobthe job that has been processed. The job will be destroyed after this function returns
See also
CJobManager and CJob

Implements IJobCallback.

◆ OnStorageAdded()

void CMediaManager::OnStorageAdded ( const MEDIA_DETECT::STORAGE::StorageDevice & device)
overridevirtual

Callback executed when a new storage device is added.

See also
IStorageEventsCallback
Parameters
devicethe storage device

Implements IStorageEventsCallback.

◆ OnStorageSafelyRemoved()

void CMediaManager::OnStorageSafelyRemoved ( const MEDIA_DETECT::STORAGE::StorageDevice & device)
overridevirtual

Callback executed when a new storage device is safely removed.

See also
IStorageEventsCallback
Parameters
devicethe storage device

Implements IStorageEventsCallback.

◆ OnStorageUnsafelyRemoved()

void CMediaManager::OnStorageUnsafelyRemoved ( const MEDIA_DETECT::STORAGE::StorageDevice & device)
overridevirtual

Callback executed when a new storage device is unsafely removed.

See also
IStorageEventsCallback
Parameters
devicethe storage device

Implements IStorageEventsCallback.

◆ playStubFile()

bool CMediaManager::playStubFile ( const CFileItem & item)

◆ ProcessEvents()

void CMediaManager::ProcessEvents ( )

◆ RemoveAutoSource()

void CMediaManager::RemoveAutoSource ( const CMediaSource & share)

◆ RemoveLocation()

bool CMediaManager::RemoveLocation ( const std::string & path)

◆ SaveSources()

bool CMediaManager::SaveSources ( )

◆ SetHasOpticalDrive()

void CMediaManager::SetHasOpticalDrive ( bool bstatus)

◆ SetLocationPath()

bool CMediaManager::SetLocationPath ( const std::string & oldPath,
const std::string & newPath )

◆ Stop()

void CMediaManager::Stop ( )

◆ ToggleTray()

void CMediaManager::ToggleTray ( const char cDriveLetter = '\0')

◆ TranslateDevicePath()

std::string CMediaManager::TranslateDevicePath ( const std::string & devicePath,
bool bReturnAsDevice = false )
Todo
translate cdda://<device>/

Member Data Documentation

◆ m_bhasoptical

bool CMediaManager::m_bhasoptical
protected

◆ m_CritSecStorageProvider

CCriticalSection CMediaManager::m_CritSecStorageProvider
protected

◆ m_locations

std::vector<CNetworkLocation> CMediaManager::m_locations
protected

◆ m_muAutoSource

CCriticalSection CMediaManager::m_muAutoSource
protected

◆ m_strFirstAvailDrive

std::string CMediaManager::m_strFirstAvailDrive
protected

The documentation for this class was generated from the following files: