xbmc
MediaSource.h
1 /*
2  * Copyright (C) 2005-2020 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "LockType.h"
12 #include "media/MediaLockState.h"
13 
14 #include <string>
15 #include <vector>
16 
22 class CMediaSource final
23 {
24 public:
25  enum SourceType
26  {
27  SOURCE_TYPE_UNKNOWN = 0,
28  SOURCE_TYPE_LOCAL = 1,
29  SOURCE_TYPE_DVD = 2,
30  SOURCE_TYPE_VIRTUAL_DVD = 3,
31  SOURCE_TYPE_REMOTE = 4,
32  SOURCE_TYPE_VPATH = 5,
33  SOURCE_TYPE_REMOVABLE = 6
34  };
35 
36  bool operator==(const CMediaSource &right) const;
37 
38  void FromNameAndPaths(const std::string &category, const std::string &name, const std::vector<std::string> &paths);
39  bool IsWritable() const;
40  std::string strName;
41  std::string strStatus;
42  std::string strDiskUniqueId;
43  std::string strPath;
44 
60  SourceType m_iDriveType = SOURCE_TYPE_UNKNOWN;
61 
81  LockType m_iLockMode = LOCK_MODE_EVERYONE;
82  std::string m_strLockCode;
83  int m_iHasLock = LOCK_STATE_NO_LOCK;
84  int m_iBadPwdCount = 0;
85 
86  std::string m_strThumbnailImage;
87 
88  std::vector<std::string> vecPaths;
89  bool m_ignore = false;
90  bool m_allowSharing = true;
91 };
92 
98 typedef std::vector<CMediaSource> VECSOURCES;
99 
105 typedef std::vector<CMediaSource>::iterator IVECSOURCES;
106 typedef std::vector<CMediaSource>::const_iterator CIVECSOURCES;
107 
108 void AddOrReplace(VECSOURCES& sources, const VECSOURCES& extras);
109 void AddOrReplace(VECSOURCES& sources, const CMediaSource& source);
std::string strPath
Path of the share, eg. iso9660:// or F:
Definition: MediaSource.h:43
std::string m_strThumbnailImage
Path to a thumbnail image for the share, or blank for default.
Definition: MediaSource.h:86
std::string m_strLockCode
Input code for Lock UI to verify, can be chosen freely.
Definition: MediaSource.h:82
std::string strName
Name of the share, can be chosen freely.
Definition: MediaSource.h:40
std::vector< CMediaSource >::iterator IVECSOURCES
Iterator of VECSOURCES.
Definition: MediaSource.h:105
Represents a share.
Definition: MediaSource.h:22
int m_iBadPwdCount
Number of wrong passwords user has entered since share was last unlocked.
Definition: MediaSource.h:84
bool m_allowSharing
<Do not store in xml
Definition: MediaSource.h:90
std::string strDiskUniqueId
removable:// + DVD Label + DVD ID for resume point storage, if available
Definition: MediaSource.h:42
std::vector< CMediaSource > VECSOURCES
A vector to hold CMediaSource objects.
Definition: MediaSource.h:98
SourceType m_iDriveType
The type of the media source.
Definition: MediaSource.h:60
LockType m_iLockMode
The type of Lock UI to show when accessing the media source.
Definition: MediaSource.h:81
std::string strStatus
Status of the share (eg has disk etc.)
Definition: MediaSource.h:41