forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoContent.cs
106 lines (93 loc) · 2.96 KB
/
VideoContent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using Microsoft.Xna.Framework.Media;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
/// <summary>
/// Provides a base class for all video objects.
/// </summary>
public class VideoContent : ContentItem, IDisposable
{
bool disposed;
int bitsPerSecond;
TimeSpan duration;
float framesPerSecond;
int height;
int width;
/// <summary>
/// Gets the bit rate for this video.
/// </summary>
public int BitsPerSecond { get { return bitsPerSecond; } }
/// <summary>
/// Gets the duration of this video.
/// </summary>
public TimeSpan Duration { get { return duration; } }
/// <summary>
/// Gets or sets the file name for this video.
/// </summary>
[ContentSerializerAttribute]
public string Filename { get; set; }
/// <summary>
/// Gets the frame rate for this video.
/// </summary>
public float FramesPerSecond { get { return framesPerSecond; } }
/// <summary>
/// Gets the height of this video.
/// </summary>
public int Height { get { return height; } }
/// <summary>
/// Gets or sets the type of soundtrack accompanying the video.
/// </summary>
[ContentSerializerAttribute]
public VideoSoundtrackType VideoSoundtrackType { get; set; }
/// <summary>
/// Gets the width of this video.
/// </summary>
public int Width { get { return width; } }
/// <summary>
/// Initializes a new copy of the VideoContent class for the specified video file.
/// </summary>
/// <param name="filename">The file name of the video to import.</param>
public VideoContent(
string filename
)
{
Filename = filename;
// TODO: Open video and fill in properties
// ...
bitsPerSecond = 0;
duration = TimeSpan.Zero;
framesPerSecond = 0.0f;
height = 0;
width = 0;
}
~VideoContent()
{
Dispose(false);
}
/// <summary>
/// Immediately releases the unmanaged resources used by this object.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
// TODO: Free managed resources here
// ...
}
// TODO: Free unmanaged resources here
// ...
disposed = true;
}
}
}
}