Ejemplo n.º 1
0
        internal Video(
            string fileName,
            GraphicsDevice device,
            int durationMS,
            int width,
            int height,
            float framesPerSecond,
            VideoSoundtrackType soundtrackType
            ) : this(fileName, device)
        {
            /* If you got here, you've still got the XNB file! Well done!
             * Except if you're running FNA, you're not using the WMV anymore.
             * But surely it's the same video, right...?
             * Well, consider this a check more than anything. If this bothers
             * you, just remove the XNB file and we'll read the OGV straight up.
             * -flibit
             */
            if (width != Width || height != Height)
            {
                throw new InvalidOperationException("XNB/OGV width/height mismatch!");
            }
            if (Math.Abs(FramesPerSecond - framesPerSecond) >= 1.0f)
            {
                throw new InvalidOperationException("XNB/OGV framesPerSecond mismatch!");
            }

            // FIXME: Oh, hey! I wish we had this info in Theora!
            Duration          = TimeSpan.FromMilliseconds(durationMS);
            needsDurationHack = false;

            VideoSoundtrackType = soundtrackType;
        }
Ejemplo n.º 2
0
        protected internal override Video Read(
            ContentReader input,
            Video existingInstance
            )
        {
            string path = input.ReadString();

            path = Path.Combine(input.ContentManager.RootDirectory, path);
            path = TitleContainer.GetFilename(path);

            /* The path string includes the ".wmv" extension. Let's see if this
             * file exists in a format we actually support...
             */
            path = Normalize(Path.GetFileNameWithoutExtension(path));
            if (String.IsNullOrEmpty(path))
            {
                throw new ContentLoadException();
            }

            int   durationMS      = input.ReadObject <int>();
            int   width           = input.ReadObject <int>();
            int   height          = input.ReadObject <int>();
            float framesPerSecond = input.ReadObject <Single>();
            VideoSoundtrackType soundTrackType = (VideoSoundtrackType)input.ReadObject <int>();

            return(new Video(path, durationMS, width, height, framesPerSecond, soundTrackType));
        }
Ejemplo n.º 3
0
        protected internal override Video Read(
            ContentReader input,
            Video existingInstance
            )
        {
            string path = FileHelpers.ResolveRelativePath(
                Path.Combine(
                    input.ContentManager.RootDirectoryFullPath,
                    input.AssetName
                    ),
                input.ReadObject <string>()
                );

            /* The path string includes the ".wmv" extension. Let's see if this
             * file exists in a format we actually support...
             */
            path = Normalize(path.Substring(0, path.Length - 4));
            if (String.IsNullOrEmpty(path))
            {
                throw new ContentLoadException();
            }

            int   durationMS      = input.ReadObject <int>();
            int   width           = input.ReadObject <int>();
            int   height          = input.ReadObject <int>();
            float framesPerSecond = input.ReadObject <float>();
            VideoSoundtrackType soundTrackType = (VideoSoundtrackType)input.ReadObject <int>();

            return(new Video(path, durationMS, width, height, framesPerSecond, soundTrackType));
        }
Ejemplo n.º 4
0
        internal Video(
			string fileName,
			int durationMS,
			int width,
			int height,
			float framesPerSecond,
			VideoSoundtrackType soundtrackType
		)
            : this(fileName)
        {
            /* If you got here, you've still got the XNB file! Well done!
             * Except if you're running FNA, you're not using the WMV anymore.
             * But surely it's the same video, right...?
             * Well, consider this a check more than anything. If this bothers
             * you, just remove the XNB file and we'll read the OGV straight up.
             * -flibit
             */
            if (width != Width || height != Height)
            {
                throw new Exception("XNB/OGV width/height mismatch!");
            }
            if (Math.Abs(FramesPerSecond - framesPerSecond) >= 1.0f)
            {
                throw new Exception("XNB/OGV framesPerSecond mismatch!");
            }

            // FIXME: Oh, hey! I wish we had this info in TheoraPlay!
            Duration = TimeSpan.FromMilliseconds(durationMS);

            VideoSoundtrackType = soundtrackType;
        }
Ejemplo n.º 5
0
        internal Video(
            string fileName,
            GraphicsDevice device,
            int durationMS,
            int width,
            int height,
            float framesPerSecond,
            VideoSoundtrackType soundtrackType
            ) : this(fileName, device)
        {
            // FIXME: Oh, hey! I wish we had this info in Theora!
            Duration          = TimeSpan.FromMilliseconds(durationMS);
            needsDurationHack = false;

            VideoSoundtrackType = soundtrackType;
        }