/xbmc/MediaSource.h

http://github.com/xbmc/xbmc · C Header · 109 lines · 40 code · 13 blank · 56 comment · 0 complexity · d2b375ca7e208ca7f19d88630a7c6e96 MD5 · raw file

  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. #pragma once
  9. #include "LockType.h"
  10. #include "media/MediaLockState.h"
  11. #include <string>
  12. #include <vector>
  13. /*!
  14. \ingroup windows
  15. \brief Represents a share.
  16. \sa VECMediaSource, IVECSOURCES
  17. */
  18. class CMediaSource final
  19. {
  20. public:
  21. enum SourceType
  22. {
  23. SOURCE_TYPE_UNKNOWN = 0,
  24. SOURCE_TYPE_LOCAL = 1,
  25. SOURCE_TYPE_DVD = 2,
  26. SOURCE_TYPE_VIRTUAL_DVD = 3,
  27. SOURCE_TYPE_REMOTE = 4,
  28. SOURCE_TYPE_VPATH = 5,
  29. SOURCE_TYPE_REMOVABLE = 6
  30. };
  31. bool operator==(const CMediaSource &right) const;
  32. void FromNameAndPaths(const std::string &category, const std::string &name, const std::vector<std::string> &paths);
  33. bool IsWritable() const;
  34. std::string strName; ///< Name of the share, can be chosen freely.
  35. std::string strStatus; ///< Status of the share (eg has disk etc.)
  36. std::string strDiskUniqueId; ///< removable:// + DVD Label + DVD ID for resume point storage, if available
  37. std::string strPath; ///< Path of the share, eg. iso9660:// or F:
  38. /*!
  39. \brief The type of the media source.
  40. Value can be:
  41. - SOURCE_TYPE_UNKNOWN \n
  42. Unknown source, maybe a wrong path.
  43. - SOURCE_TYPE_LOCAL \n
  44. Harddisk source.
  45. - SOURCE_TYPE_DVD \n
  46. DVD-ROM source of the build in drive, strPath may vary.
  47. - SOURCE_TYPE_VIRTUAL_DVD \n
  48. DVD-ROM source, strPath is fix.
  49. - SOURCE_TYPE_REMOTE \n
  50. Network source.
  51. */
  52. SourceType m_iDriveType = SOURCE_TYPE_UNKNOWN;
  53. /*!
  54. \brief The type of Lock UI to show when accessing the media source.
  55. Value can be:
  56. - CMediaSource::LOCK_MODE_EVERYONE \n
  57. Default value. No lock UI is shown, user can freely access the source.
  58. - LOCK_MODE_NUMERIC \n
  59. Lock code is entered via OSD numpad or IrDA remote buttons.
  60. - LOCK_MODE_GAMEPAD \n
  61. Lock code is entered via XBOX gamepad buttons.
  62. - LOCK_MODE_QWERTY \n
  63. Lock code is entered via OSD keyboard or PC USB keyboard.
  64. - LOCK_MODE_SAMBA \n
  65. Lock code is entered via OSD keyboard or PC USB keyboard and passed directly to SMB for authentication.
  66. - LOCK_MODE_EEPROM_PARENTAL \n
  67. Lock code is retrieved from XBOX EEPROM and entered via XBOX gamepad or remote.
  68. - LOCK_MODE_UNKNOWN \n
  69. Value is unknown or unspecified.
  70. */
  71. LockType m_iLockMode = LOCK_MODE_EVERYONE;
  72. std::string m_strLockCode; ///< Input code for Lock UI to verify, can be chosen freely.
  73. int m_iHasLock = LOCK_STATE_NO_LOCK;
  74. int m_iBadPwdCount = 0; ///< Number of wrong passwords user has entered since share was last unlocked
  75. std::string m_strThumbnailImage; ///< Path to a thumbnail image for the share, or blank for default
  76. std::vector<std::string> vecPaths;
  77. bool m_ignore = false; /// <Do not store in xml
  78. bool m_allowSharing = true; /// <Allow browsing of source from UPnP / WebServer
  79. };
  80. /*!
  81. \ingroup windows
  82. \brief A vector to hold CMediaSource objects.
  83. \sa CMediaSource, IVECSOURCES
  84. */
  85. typedef std::vector<CMediaSource> VECSOURCES;
  86. /*!
  87. \ingroup windows
  88. \brief Iterator of VECSOURCES.
  89. \sa CMediaSource, VECSOURCES
  90. */
  91. typedef std::vector<CMediaSource>::iterator IVECSOURCES;
  92. typedef std::vector<CMediaSource>::const_iterator CIVECSOURCES;
  93. void AddOrReplace(VECSOURCES& sources, const VECSOURCES& extras);
  94. void AddOrReplace(VECSOURCES& sources, const CMediaSource& source);