MediaPlayer_Upgrade.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using UnityEngine;
  2. //-----------------------------------------------------------------------------
  3. // Copyright 2015-2022 RenderHeads Ltd. All rights reserved.
  4. //-----------------------------------------------------------------------------
  5. namespace RenderHeads.Media.AVProVideo
  6. {
  7. public partial class MediaPlayer : MonoBehaviour, ISerializationCallbackReceiver
  8. {
  9. #region Upgrade from Version 1.x
  10. [SerializeField, HideInInspector]
  11. private string m_VideoPath;
  12. [SerializeField, HideInInspector]
  13. private FileLocation m_VideoLocation = FileLocation.RelativeToStreamingAssetsFolder;
  14. private enum FileLocation
  15. {
  16. AbsolutePathOrURL,
  17. RelativeToProjectFolder,
  18. RelativeToStreamingAssetsFolder,
  19. RelativeToDataFolder,
  20. RelativeToPersistentDataFolder,
  21. }
  22. /*
  23. [SerializeField, HideInInspector]
  24. private StereoPacking m_StereoPacking;
  25. [SerializeField, HideInInspector]
  26. private AlphaPacking m_AlphaPacking;
  27. */
  28. void ISerializationCallbackReceiver.OnBeforeSerialize()
  29. {
  30. /*
  31. m_StereoPacking = _fallbackMediaHints.stereoPacking;
  32. m_AlphaPacking = _fallbackMediaHints.alphaPacking;
  33. */
  34. }
  35. void ISerializationCallbackReceiver.OnAfterDeserialize()
  36. {
  37. if (!string.IsNullOrEmpty(m_VideoPath))
  38. {
  39. MediaPathType mediaPathType = MediaPathType.AbsolutePathOrURL;
  40. switch (m_VideoLocation)
  41. {
  42. default:
  43. case FileLocation.AbsolutePathOrURL:
  44. mediaPathType = MediaPathType.AbsolutePathOrURL;
  45. break;
  46. case FileLocation.RelativeToProjectFolder:
  47. mediaPathType = MediaPathType.RelativeToProjectFolder;
  48. break;
  49. case FileLocation.RelativeToStreamingAssetsFolder:
  50. mediaPathType = MediaPathType.RelativeToStreamingAssetsFolder;
  51. break;
  52. case FileLocation.RelativeToDataFolder:
  53. mediaPathType = MediaPathType.RelativeToDataFolder;
  54. break;
  55. case FileLocation.RelativeToPersistentDataFolder:
  56. mediaPathType = MediaPathType.RelativeToPersistentDataFolder;
  57. break;
  58. }
  59. _mediaPath = new MediaPath(m_VideoPath, mediaPathType);
  60. _mediaSource = MediaSource.Path;
  61. m_VideoPath = null;
  62. }
  63. /*
  64. if (m_StereoPacking != _fallbackMediaHints.stereoPacking)
  65. {
  66. _fallbackMediaHints.stereoPacking = m_StereoPacking;
  67. }
  68. if (m_AlphaPacking != _fallbackMediaHints.alphaPacking)
  69. {
  70. _fallbackMediaHints.alphaPacking = m_AlphaPacking;
  71. }
  72. */
  73. }
  74. #endregion // Upgrade from Version 1.x
  75. }
  76. }