Skip to content

Commit

Permalink
Consolidate Video's use of Theorafile API
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jun 3, 2024
1 parent 6f23d9a commit a72fe7b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Media/Xiph/Video.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,29 @@ internal Video(string fileName, GraphicsDevice device)
* constructor we can be up front about files not
* existing, so let's do that!
*/
IntPtr theora;
Theorafile.tf_fopen(fileName, out theora);
if (theora == IntPtr.Zero)
if (!File.Exists(fileName))
{
throw new FileNotFoundException(fileName);
}

IntPtr theora;
int width;
int height;
double fps;
Theorafile.th_pixel_fmt fmt;
Theorafile.tf_fopen(fileName, out theora);
Theorafile.tf_videoinfo(
theora,
out width,
out height,
out fps,
out fmt
);
Theorafile.tf_close(ref theora);

Width = width;
Height = height;
FramesPerSecond = (float) fps;
Theorafile.tf_close(ref theora);

// FIXME: This is a part of the Duration hack!
Duration = TimeSpan.MaxValue;
Expand Down

0 comments on commit a72fe7b

Please sign in to comment.