fna-workbench

fna-workbench Commit Details


Date:2016-02-25 13:19:34 (8 years 9 months ago)
Author:Ethan Lee
Branch:master
Commit:a53ad65e4348b7553088bad82848683f6e0bb60f
Parents: fef7759983c3b01f86deec8f628c7a0c3580478b
Message:VideoPlayer GL accuracy fixes

Changes:

File differences

src/Content/ContentManager.cs
380380
381381
382382
383
383
384384
385385
386386
else if ((typeof(T) == typeof(Video)))
{
// FIXME: Not using the stream! -flibit
result = new Video(modifiedAssetName);
result = new Video(modifiedAssetName, graphicsDeviceService.GraphicsDevice);
}
else
{
src/Content/ContentReaders/VideoReader.cs
6363
6464
6565
66
66
67
68
69
70
71
72
73
74
6775
6876
6977
float framesPerSecond = input.ReadObject<float>();
VideoSoundtrackType soundTrackType = (VideoSoundtrackType) input.ReadObject<int>();
return new Video(path, durationMS, width, height, framesPerSecond, soundTrackType);
return new Video(
path,
input.GraphicsDevice,
durationMS,
width,
height,
framesPerSecond,
soundTrackType
);
}
#endregion
src/Game.cs
211211
212212
213213
214
215
216
217214
218215
219216
......
278275
279276
280277
281
282
283278
284279
285280
......
362357
363358
364359
365
366360
367361
368362
#region Internal Fields
/* This variable solely exists for the VideoPlayer -flibit */
internal static Game Instance = null;
internal bool RunApplication;
#endregion
public Game()
{
Instance = this;
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
LaunchParameters = new LaunchParameters();
AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;
_isDisposed = true;
Instance = null;
}
}
src/Media/Xiph/Video.cs
1111
1212
1313
14
15
1416
1517
1618
......
6668
6769
6870
71
72
73
74
75
76
6977
7078
7179
......
8391
8492
8593
86
94
8795
8896
97
8998
9099
91100
......
102111
103112
104113
114
105115
106116
107117
108118
109119
110
120
111121
112122
113123
using System;
using System.IO;
using System.Threading;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace Microsoft.Xna.Framework.Media
set;
}
internal GraphicsDevice GraphicsDevice
{
get;
private set;
}
#endregion
#region Internal Variables: TheoraPlay
#region Internal Constructors
internal Video(string fileName)
internal Video(string fileName, GraphicsDevice device)
{
this.fileName = fileName;
GraphicsDevice = device;
// Set everything to NULL. Yes, this actually matters later.
theoraDecoder = IntPtr.Zero;
internal Video(
string fileName,
GraphicsDevice device,
int durationMS,
int width,
int height,
float framesPerSecond,
VideoSoundtrackType soundtrackType
) : this(fileName) {
) : 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...?
src/Media/Xiph/VideoPlayer.cs
382382
383383
384384
385
386
387
388
389
390385
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406386
407387
408388
......
431411
432412
433413
414
415
416
417
418
434419
435420
436421
......
617602
618603
619604
605
606
607
608
609
610
611
612
613
614
615
620616
621617
622618
......
630626
631627
632628
633
629
630
631
632
634633
635634
636635
// Initialize private members.
timer = new Stopwatch();
// The VideoPlayer will use the GraphicsDevice that is set now.
currentDevice = Game.Instance.GraphicsDevice;
// Initialize this here to prevent null GetTexture returns.
videoTexture = new RenderTargetBinding[1];
videoTexture[0] = new RenderTargetBinding(
new RenderTarget2D(
currentDevice,
1280,
720,
false,
SurfaceFormat.Color,
DepthFormat.None,
0,
RenderTargetUsage.PreserveContents
)
);
// Initialize the other GL bits.
GL_initialize();
}
public void Dispose()
{
checkDisposed();
if (Video == null)
{
throw new InvalidOperationException();
}
// Be sure we can even get something from TheoraPlay...
if (State == MediaState.Stopped ||
Video.theoraDecoder == IntPtr.Zero ||
} while (Video.videoStream == IntPtr.Zero);
nextVideo = TheoraPlay.getVideoFrame(Video.videoStream);
// The VideoPlayer will use the GraphicsDevice that is set now.
if (currentDevice != Video.GraphicsDevice)
{
if (currentDevice != null)
{
GL_dispose();
}
currentDevice = Video.GraphicsDevice;
GL_initialize();
}
RenderTargetBinding overlap = videoTexture[0];
videoTexture[0] = new RenderTargetBinding(
new RenderTarget2D(
RenderTargetUsage.PreserveContents
)
);
overlap.RenderTarget.Dispose();
if (overlap.RenderTarget != null)
{
overlap.RenderTarget.Dispose();
}
GL_setupTextures(
(int) currentVideo.width,
(int) currentVideo.height

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06883s using 13 queries.