diff --git a/src/Media/Xiph/Video.cs b/src/Media/Xiph/Video.cs index 8e3a9a4a5..773177cf2 100644 --- a/src/Media/Xiph/Video.cs +++ b/src/Media/Xiph/Video.cs @@ -23,19 +23,19 @@ public sealed class Video public int Width { get; - internal set; + private set; } public int Height { get; - internal set; + private set; } public float FramesPerSecond { get; - internal set; + private set; } public VideoSoundtrackType VideoSoundtrackType @@ -87,6 +87,20 @@ internal Video(string fileName, GraphicsDevice device) { throw new FileNotFoundException(fileName); } + int width; + int height; + double fps; + Theorafile.th_pixel_fmt fmt; + Theorafile.tf_videoinfo( + theora, + out width, + out height, + out fps, + out fmt + ); + Width = width; + Height = height; + FramesPerSecond = (float) fps; Theorafile.tf_close(ref theora); // FIXME: This is a part of the Duration hack! diff --git a/src/Media/Xiph/VideoPlayer.cs b/src/Media/Xiph/VideoPlayer.cs index 1813c5e99..5b36a6975 100644 --- a/src/Media/Xiph/VideoPlayer.cs +++ b/src/Media/Xiph/VideoPlayer.cs @@ -662,37 +662,20 @@ out fmt } // Sanity checks for video metadata - if (Video.Width > 0 && Video.Height > 0) + if (Video.Width != yWidth || Video.Height != yHeight) { - if (Video.Width != yWidth || Video.Height != yHeight) - { - throw new InvalidOperationException( - "XNB/OGV width/height mismatch!" + - " Width: " + Video.Width.ToString() + - " Height: " + Video.Height.ToString() - ); - } - } - else - { - // Probably the raw path, fill it in - Video.Width = yWidth; - Video.Height = yHeight; - } - if (Video.FramesPerSecond > 0) - { - if (Math.Abs(Video.FramesPerSecond - fps) >= 1.0f) - { - throw new InvalidOperationException( - "XNB/OGV framesPerSecond mismatch!" + - " FPS: " + Video.FramesPerSecond.ToString() - ); - } + throw new InvalidOperationException( + "XNB/OGV width/height mismatch!" + + " Width: " + Video.Width.ToString() + + " Height: " + Video.Height.ToString() + ); } - else + if (Math.Abs(Video.FramesPerSecond - fps) >= 1.0f) { - // Probably the raw path, fill it in - Video.FramesPerSecond = (float) fps; + throw new InvalidOperationException( + "XNB/OGV framesPerSecond mismatch!" + + " FPS: " + Video.FramesPerSecond.ToString() + ); } // Per-video track settings should always take priority