/ContentSystem/Multimedia/VideoData.cs
C# | 95 lines | 46 code | 9 blank | 40 comment | 0 complexity | 220fb891dc6a5d806a065b64f59d283f MD5 | raw file
Possible License(s): Apache-2.0
- using Delta.Engine;
-
- namespace Delta.ContentSystem.Multimedia
- {
- /// <summary>
- /// Video data class, does not contain any native data as this is usually
- /// done with some external library or platform module that handles
- /// everything from loading to displaying the video for us.
- /// </summary>
- public class VideoData : Content
- {
- #region Get (Static)
- /// <summary>
- /// Get and load content based on the content name. This method makes sure
- /// we do not load the same content twice (the constructor is protected).
- /// </summary>
- /// <param name="contentName">Content name we want to load, this is
- /// passed onto the Content System, which will do the actual loading with
- /// help of the Load method in this class.</param>
- /// <returns>The loaded Content object, always unique for the same
- /// name, this helps comparing data.</returns>
- public static VideoData Get(string contentName)
- {
- return Get<VideoData>(contentName, ContentType.Video);
- }
- #endregion
-
- #region TimeLength (Public)
- /// <summary>
- /// The length in seconds this video data plays.
- /// </summary>
- public float TimeLength
- {
- get
- {
- return data.TimeLength;
- }
- }
- #endregion
-
- #region Protected
-
- #region MemorySize (Protected)
- /// <summary>
- /// Change the memory size from the file size to just a small buffer
- /// that is used by each native implementation.
- /// </summary>
- protected override int MemorySize
- {
- get
- {
- // We probably need at least 2 textures worth of data (times 4 for
- // RGBA), but instead of multiplying by 8 we can assume a compression
- // with about 1:8 is used (e.g. DXT1, PVR4Bpp, etc.).
- return (int)(Settings.Resolution.Width * Settings.Resolution.Height);
- }
- }
- #endregion
-
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create base video
- /// </summary>
- /// <param name="contentName">Name of the content.</param>
- public VideoData(string contentName)
- : base(contentName, ContentType.Video)
- {
- }
- #endregion
-
- #region Methods (Private)
-
- #region Load
- /// <summary>
- /// Load video content data, does nothing. Only properties are assigned.
- /// No loading happens here (it all happens in Sound), we can obviously
- /// clone all SoundDatas with the same name as they are not loaded here.
- /// Note: If a class is interested in the content reload functionality,
- /// it can just attach itself to the ContentChanged event.
- /// </summary>
- /// <param name="alreadyLoadedNativeData">If we already have native data
- /// loaded, clone it from this instance. Only used if not null. Please
- /// note that this is only used for other objects that had the same
- /// RawFileId and are already loaded and returned true for this method.
- /// </param>
- protected override void Load(Content alreadyLoadedNativeData)
- {
- }
- #endregion
-
- #endregion
- }
- }