Add a generic video player widget.
This commit is contained in:
committed by
abcdefg30
parent
514652bb6a
commit
7bc17b59f5
37
OpenRA.Game/Graphics/Video.cs
Normal file
37
OpenRA.Game/Graphics/Video.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Video
|
||||
{
|
||||
public interface IVideo
|
||||
{
|
||||
ushort Frames { get; }
|
||||
byte Framerate { get; }
|
||||
ushort Width { get; }
|
||||
ushort Height { get; }
|
||||
uint[,] FrameData { get; }
|
||||
|
||||
int CurrentFrame { get; }
|
||||
void AdvanceFrame();
|
||||
|
||||
bool HasAudio { get; }
|
||||
byte[] AudioData { get; }
|
||||
int AudioChannels { get; }
|
||||
int SampleBits { get; }
|
||||
int SampleRate { get; }
|
||||
|
||||
void Reset();
|
||||
}
|
||||
}
|
||||
32
OpenRA.Game/Graphics/VideoLoader.cs
Normal file
32
OpenRA.Game/Graphics/VideoLoader.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRA.Video
|
||||
{
|
||||
public interface IVideoLoader
|
||||
{
|
||||
bool TryParseVideo(Stream s, out IVideo video);
|
||||
}
|
||||
|
||||
public static class VideoLoader
|
||||
{
|
||||
public static IVideo GetVideo(Stream stream, IVideoLoader[] loaders)
|
||||
{
|
||||
foreach (var loader in loaders)
|
||||
if (loader.TryParseVideo(stream, out var video))
|
||||
return video;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,13 +70,14 @@ namespace OpenRA
|
||||
public readonly string[] SoundFormats = { };
|
||||
public readonly string[] SpriteFormats = { };
|
||||
public readonly string[] PackageFormats = { };
|
||||
public readonly string[] VideoFormats = { };
|
||||
|
||||
readonly string[] reservedModuleNames =
|
||||
{
|
||||
"Include", "Metadata", "Folders", "MapFolders", "Packages", "Rules",
|
||||
"Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
|
||||
"Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys",
|
||||
"ServerTraits", "LoadScreen", "SupportsMapsFrom", "SoundFormats", "SpriteFormats",
|
||||
"ServerTraits", "LoadScreen", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", "VideoFormats",
|
||||
"RequiresMods", "PackageFormats"
|
||||
};
|
||||
|
||||
@@ -154,6 +155,9 @@ namespace OpenRA
|
||||
|
||||
if (yaml.ContainsKey("SpriteFormats"))
|
||||
SpriteFormats = FieldLoader.GetValue<string[]>("SpriteFormats", yaml["SpriteFormats"].Value);
|
||||
|
||||
if (yaml.ContainsKey("VideoFormats"))
|
||||
VideoFormats = FieldLoader.GetValue<string[]>("VideoFormats", yaml["VideoFormats"].Value);
|
||||
}
|
||||
|
||||
public void LoadCustomData(ObjectCreator oc)
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
using FS = OpenRA.FileSystem.FileSystem;
|
||||
|
||||
@@ -31,6 +32,7 @@ namespace OpenRA
|
||||
public readonly ISpriteLoader[] SpriteLoaders;
|
||||
public readonly ISpriteSequenceLoader SpriteSequenceLoader;
|
||||
public readonly IModelSequenceLoader ModelSequenceLoader;
|
||||
public readonly IVideoLoader[] VideoLoaders;
|
||||
public readonly HotkeyManager Hotkeys;
|
||||
public ILoadScreen LoadScreen { get; private set; }
|
||||
public CursorProvider CursorProvider { get; private set; }
|
||||
@@ -71,6 +73,7 @@ namespace OpenRA
|
||||
|
||||
SoundLoaders = ObjectCreator.GetLoaders<ISoundLoader>(Manifest.SoundFormats, "sound");
|
||||
SpriteLoaders = ObjectCreator.GetLoaders<ISpriteLoader>(Manifest.SpriteFormats, "sprite");
|
||||
VideoLoaders = ObjectCreator.GetLoaders<IVideoLoader>(Manifest.VideoFormats, "video");
|
||||
|
||||
var sequenceFormat = Manifest.Get<SpriteSequenceFormat>();
|
||||
var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");
|
||||
|
||||
@@ -11,15 +11,22 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Video;
|
||||
|
||||
namespace OpenRA.Mods.Common.FileFormats
|
||||
namespace OpenRA.Mods.Cnc.FileFormats
|
||||
{
|
||||
public class VqaReader
|
||||
public class VqaReader : IVideo
|
||||
{
|
||||
public readonly ushort Frames;
|
||||
public readonly byte Framerate;
|
||||
public readonly ushort Width;
|
||||
public readonly ushort Height;
|
||||
public ushort Frames { get { return frames; } }
|
||||
public byte Framerate { get { return framerate; } }
|
||||
public ushort Width { get { return width; } }
|
||||
public ushort Height { get { return height; } }
|
||||
|
||||
readonly ushort frames;
|
||||
readonly byte framerate;
|
||||
readonly ushort width;
|
||||
readonly ushort height;
|
||||
|
||||
Stream stream;
|
||||
int currentFrame;
|
||||
@@ -80,15 +87,15 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
|
||||
/*var version = */stream.ReadUInt16();
|
||||
videoFlags = stream.ReadUInt16();
|
||||
Frames = stream.ReadUInt16();
|
||||
Width = stream.ReadUInt16();
|
||||
Height = stream.ReadUInt16();
|
||||
frames = stream.ReadUInt16();
|
||||
width = stream.ReadUInt16();
|
||||
height = stream.ReadUInt16();
|
||||
|
||||
blockWidth = stream.ReadUInt8();
|
||||
blockHeight = stream.ReadUInt8();
|
||||
Framerate = stream.ReadUInt8();
|
||||
framerate = stream.ReadUInt8();
|
||||
chunkBufferParts = stream.ReadUInt8();
|
||||
blocks = new int2(Width / blockWidth, Height / blockHeight);
|
||||
blocks = new int2(width / blockWidth, height / blockHeight);
|
||||
|
||||
numColors = stream.ReadUInt16();
|
||||
/*var maxBlocks = */stream.ReadUInt16();
|
||||
@@ -106,7 +113,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
|
||||
/*var unknown5 =*/stream.ReadUInt32();
|
||||
|
||||
var frameSize = Exts.NextPowerOf2(Math.Max(Width, Height));
|
||||
var frameSize = Exts.NextPowerOf2(Math.Max(width, height));
|
||||
|
||||
if (IsHqVqa)
|
||||
{
|
||||
@@ -116,9 +123,9 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
else
|
||||
{
|
||||
cbfBuffer = new byte[Width * Height];
|
||||
cbf = new byte[Width * Height];
|
||||
cbp = new byte[Width * Height];
|
||||
cbfBuffer = new byte[width * height];
|
||||
cbf = new byte[width * height];
|
||||
cbp = new byte[width * height];
|
||||
origData = new byte[2 * blocks.X * blocks.Y];
|
||||
}
|
||||
|
||||
@@ -142,8 +149,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
/*var unknown4 = */stream.ReadUInt16();
|
||||
|
||||
// Frame offsets
|
||||
offsets = new uint[Frames];
|
||||
for (var i = 0; i < Frames; i++)
|
||||
offsets = new uint[frames];
|
||||
for (var i = 0; i < frames; i++)
|
||||
{
|
||||
offsets[i] = stream.ReadUInt32();
|
||||
if (offsets[i] > 0x40000000)
|
||||
@@ -168,10 +175,10 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
var audio2 = new MemoryStream(); // right channel
|
||||
var adpcmIndex = 0;
|
||||
var compressed = false;
|
||||
for (var i = 0; i < Frames; i++)
|
||||
for (var i = 0; i < frames; i++)
|
||||
{
|
||||
stream.Seek(offsets[i], SeekOrigin.Begin);
|
||||
var end = (i < Frames - 1) ? offsets[i + 1] : stream.Length;
|
||||
var end = (i < frames - 1) ? offsets[i + 1] : stream.Length;
|
||||
|
||||
while (stream.Position < end)
|
||||
{
|
||||
@@ -261,12 +268,12 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
|
||||
void LoadFrame()
|
||||
{
|
||||
if (currentFrame >= Frames)
|
||||
if (currentFrame >= frames)
|
||||
return;
|
||||
|
||||
// Seek to the start of the frame
|
||||
stream.Seek(offsets[currentFrame], SeekOrigin.Begin);
|
||||
var end = (currentFrame < Frames - 1) ? offsets[currentFrame + 1] : stream.Length;
|
||||
var end = (currentFrame < frames - 1) ? offsets[currentFrame + 1] : stream.Length;
|
||||
|
||||
while (stream.Position < end)
|
||||
{
|
||||
@@ -344,8 +351,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
s.ReadBytes(fileBuffer, 0, subchunkLength);
|
||||
Array.Clear(cbf, 0, cbf.Length);
|
||||
Array.Clear(cbfBuffer, 0, cbfBuffer.Length);
|
||||
var decodeCount = 0;
|
||||
decodeCount = LCWDecodeInto(fileBuffer, cbfBuffer, decodeMode ? 1 : 0, decodeMode);
|
||||
var decodeCount = LCWDecodeInto(fileBuffer, cbfBuffer, decodeMode ? 1 : 0, decodeMode);
|
||||
if ((videoFlags & 0x10) == 16)
|
||||
{
|
||||
var p = 0;
|
||||
58
OpenRA.Mods.Cnc/VideoLoaders/VqaLoader.cs
Normal file
58
OpenRA.Mods.Cnc/VideoLoaders/VqaLoader.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.IO;
|
||||
using OpenRA.Mods.Cnc.FileFormats;
|
||||
using OpenRA.Video;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.VideoLoaders
|
||||
{
|
||||
public class VqaLoader : IVideoLoader
|
||||
{
|
||||
public bool TryParseVideo(Stream s, out IVideo video)
|
||||
{
|
||||
video = null;
|
||||
|
||||
if (!IsWestwoodVqa(s))
|
||||
return false;
|
||||
|
||||
video = new VqaReader(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsWestwoodVqa(Stream s)
|
||||
{
|
||||
var start = s.Position;
|
||||
|
||||
if (s.ReadASCII(4) != "FORM")
|
||||
{
|
||||
s.Position = start;
|
||||
return false;
|
||||
}
|
||||
|
||||
var length = s.ReadUInt32();
|
||||
if (length == 0)
|
||||
{
|
||||
s.Position = start;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.ReadASCII(4) != "WVQA")
|
||||
{
|
||||
s.Position = start;
|
||||
return false;
|
||||
}
|
||||
|
||||
s.Position = start;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@ using Eluant;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Video;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
@@ -175,12 +175,12 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return false;
|
||||
}
|
||||
|
||||
AsyncLoader l = new AsyncLoader(Media.LoadVqa);
|
||||
AsyncLoader l = new AsyncLoader(Media.LoadVideo);
|
||||
IAsyncResult ar = l.BeginInvoke(s, null, null);
|
||||
Action onLoadComplete = () =>
|
||||
{
|
||||
Media.StopFMVInRadar();
|
||||
world.AddFrameEndTask(_ => Media.PlayFMVInRadar(world, l.EndInvoke(ar), onCompleteRadar));
|
||||
world.AddFrameEndTask(_ => Media.PlayFMVInRadar(l.EndInvoke(ar), onCompleteRadar));
|
||||
};
|
||||
|
||||
world.AddFrameEndTask(w => w.Add(new AsyncAction(ar, onLoadComplete)));
|
||||
@@ -228,6 +228,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
world.AddFrameEndTask(w => w.Add(new FloatingText(position, c, text, duration)));
|
||||
}
|
||||
|
||||
public delegate VqaReader AsyncLoader(Stream s);
|
||||
public delegate IVideo AsyncLoader(Stream s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public static void PlayFMVFullscreen(World w, string movie, Action onComplete)
|
||||
{
|
||||
var playerRoot = Game.OpenWindow(w, "FMVPLAYER");
|
||||
var player = playerRoot.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = playerRoot.Get<VideoPlayerWidget>("PLAYER");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
});
|
||||
}
|
||||
|
||||
public static void PlayFMVInRadar(World w, VqaReader movie, Action onComplete)
|
||||
public static void PlayFMVInRadar(IVideo movie, Action onComplete)
|
||||
{
|
||||
var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = Ui.Root.Get<VideoPlayerWidget>("PLAYER");
|
||||
player.Open(movie);
|
||||
|
||||
player.PlayThen(() =>
|
||||
@@ -74,13 +74,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public static void StopFMVInRadar()
|
||||
{
|
||||
var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER");
|
||||
var player = Ui.Root.Get<VideoPlayerWidget>("PLAYER");
|
||||
player.Stop();
|
||||
}
|
||||
|
||||
public static VqaReader LoadVqa(Stream s)
|
||||
public static IVideo LoadVideo(Stream s)
|
||||
{
|
||||
return new VqaReader(s);
|
||||
return VideoLoader.GetVideo(s, Game.ModData.VideoLoaders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
@@ -44,7 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
IReadOnlyPackage currentPackage;
|
||||
Sprite[] currentSprites;
|
||||
IModel currentVoxel;
|
||||
VqaPlayerWidget player = null;
|
||||
VideoPlayerWidget player = null;
|
||||
bool isVideoLoaded = false;
|
||||
bool isLoadError = false;
|
||||
int currentFrame;
|
||||
@@ -84,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
spriteWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentSprites != null;
|
||||
}
|
||||
|
||||
var playerWidget = panel.GetOrNull<VqaPlayerWidget>("PLAYER");
|
||||
var playerWidget = panel.GetOrNull<VideoPlayerWidget>("PLAYER");
|
||||
if (playerWidget != null)
|
||||
playerWidget.IsVisible = () => isVideoLoaded && !isLoadError;
|
||||
|
||||
@@ -379,9 +380,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
prefix += "|";
|
||||
}
|
||||
|
||||
if (Path.GetExtension(filename.ToLowerInvariant()) == ".vqa")
|
||||
var video = VideoLoader.GetVideo(Game.ModData.DefaultFileSystem.Open(filename), Game.ModData.VideoLoaders);
|
||||
if (video != null)
|
||||
{
|
||||
player = panel.Get<VqaPlayerWidget>("PLAYER");
|
||||
player = panel.Get<VideoPlayerWidget>("PLAYER");
|
||||
player.Load(prefix + filename);
|
||||
player.DrawOverlay = false;
|
||||
isVideoLoaded = true;
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Threading;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
@@ -36,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly ButtonWidget stopBriefingVideoButton;
|
||||
readonly ButtonWidget startInfoVideoButton;
|
||||
readonly ButtonWidget stopInfoVideoButton;
|
||||
readonly VqaPlayerWidget videoPlayer;
|
||||
readonly VideoPlayerWidget videoPlayer;
|
||||
readonly BackgroundWidget fullscreenVideoPlayer;
|
||||
|
||||
readonly ScrollPanelWidget missionList;
|
||||
@@ -71,7 +72,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
previewWidget.Preview = () => selectedMap;
|
||||
previewWidget.IsVisible = () => playingVideo == PlayingVideo.None;
|
||||
|
||||
videoPlayer = widget.Get<VqaPlayerWidget>("MISSION_VIDEO");
|
||||
videoPlayer = widget.Get<VideoPlayerWidget>("MISSION_VIDEO");
|
||||
widget.Get("MISSION_BIN").IsVisible = () => playingVideo != PlayingVideo.None;
|
||||
fullscreenVideoPlayer = Ui.LoadWidget<BackgroundWidget>("FULLSCREEN_PLAYER", Ui.Root, new WidgetArgs { { "world", world } });
|
||||
|
||||
@@ -329,7 +330,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Game.Sound.MusicVolume = cachedMusicVolume;
|
||||
}
|
||||
|
||||
void PlayVideo(VqaPlayerWidget player, string video, PlayingVideo pv, Action onComplete = null)
|
||||
void PlayVideo(VideoPlayerWidget player, string video, PlayingVideo pv, Action onComplete = null)
|
||||
{
|
||||
if (!modData.DefaultFileSystem.Exists(video))
|
||||
{
|
||||
@@ -358,7 +359,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
}
|
||||
|
||||
void StopVideo(VqaPlayerWidget player)
|
||||
void StopVideo(VideoPlayerWidget player)
|
||||
{
|
||||
if (playingVideo == PlayingVideo.None)
|
||||
return;
|
||||
@@ -385,7 +386,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var missionData = selectedMap.Rules.Actors["world"].TraitInfoOrDefault<MissionDataInfo>();
|
||||
if (missionData != null && missionData.StartVideo != null && modData.DefaultFileSystem.Exists(missionData.StartVideo))
|
||||
{
|
||||
var fsPlayer = fullscreenVideoPlayer.Get<VqaPlayerWidget>("PLAYER");
|
||||
var fsPlayer = fullscreenVideoPlayer.Get<VideoPlayerWidget>("PLAYER");
|
||||
fullscreenVideoPlayer.Visible = true;
|
||||
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
|
||||
{
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
using System;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Video;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
public class VqaPlayerWidget : Widget
|
||||
public class VideoPlayerWidget : Widget
|
||||
{
|
||||
public Hotkey CancelKey = new Hotkey(Keycode.ESCAPE, Modifiers.None);
|
||||
public float AspectRatio = 1.2f;
|
||||
@@ -25,11 +25,11 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public bool Skippable = true;
|
||||
|
||||
public bool Paused { get { return paused; } }
|
||||
public VqaReader Video { get { return video; } }
|
||||
public IVideo Video { get { return video; } }
|
||||
|
||||
Sprite videoSprite, overlaySprite;
|
||||
Sheet overlaySheet;
|
||||
VqaReader video = null;
|
||||
IVideo video = null;
|
||||
string cachedVideo;
|
||||
float invLength;
|
||||
float2 videoOrigin, videoSize;
|
||||
@@ -44,13 +44,14 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
if (filename == cachedVideo)
|
||||
return;
|
||||
var video = new VqaReader(Game.ModData.DefaultFileSystem.Open(filename));
|
||||
|
||||
var video = VideoLoader.GetVideo(Game.ModData.DefaultFileSystem.Open(filename), Game.ModData.VideoLoaders);
|
||||
Open(video);
|
||||
|
||||
cachedVideo = filename;
|
||||
Open(video);
|
||||
}
|
||||
|
||||
public void Open(VqaReader video)
|
||||
public void Open(IVideo video)
|
||||
{
|
||||
this.video = video;
|
||||
|
||||
@@ -104,7 +104,7 @@ Container@ASSETBROWSER_PANEL:
|
||||
Sprite@SPRITE:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
AspectRatio: 1
|
||||
|
||||
@@ -160,7 +160,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Y: 1
|
||||
Width: PARENT_RIGHT - 2
|
||||
Height: PARENT_BOTTOM - 2
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 1
|
||||
Y: 1
|
||||
Width: PARENT_RIGHT - 2
|
||||
@@ -1632,7 +1632,7 @@ Container@PLAYER_WIDGETS:
|
||||
Height: 194
|
||||
SoundUp: RadarUp
|
||||
SoundDown: RadarDown
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
Width: 194
|
||||
Height: 194
|
||||
Skippable: false
|
||||
@@ -1856,7 +1856,7 @@ Background@FMVPLAYER:
|
||||
Height: WINDOW_BOTTOM
|
||||
Background: panel-allblack
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 0
|
||||
Y: 0
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -146,7 +146,7 @@ Container@MISSIONBROWSER_PANEL:
|
||||
Font: Bold
|
||||
Container@MISSION_BIN:
|
||||
Children:
|
||||
VqaPlayer@MISSION_VIDEO:
|
||||
VideoPlayer@MISSION_VIDEO:
|
||||
X: 1
|
||||
Y: 1
|
||||
Width: 712
|
||||
@@ -159,7 +159,7 @@ Background@FULLSCREEN_PLAYER:
|
||||
Background: panel-allblack
|
||||
Visible: False
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 0
|
||||
Y: 0
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -212,6 +212,8 @@ SoundFormats: Aud, Wav
|
||||
|
||||
SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA
|
||||
|
||||
VideoFormats: Vqa
|
||||
|
||||
SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence
|
||||
TilesetExtensions:
|
||||
TEMPERAT: .tem
|
||||
|
||||
@@ -99,7 +99,7 @@ Background@ASSETBROWSER_PANEL:
|
||||
Sprite@SPRITE:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
AspectRatio: 1
|
||||
|
||||
@@ -3,7 +3,7 @@ Background@FMVPLAYER:
|
||||
Height: WINDOW_BOTTOM
|
||||
Background: dialog5
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 0
|
||||
Y: 0
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -44,7 +44,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Width: PARENT_RIGHT - 19
|
||||
Height: PARENT_BOTTOM - 19
|
||||
WorldInteractionController: INTERACTION_CONTROLLER
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 10
|
||||
Y: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
|
||||
@@ -147,7 +147,7 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Height: 377
|
||||
Background: dialog3
|
||||
Children:
|
||||
VqaPlayer@MISSION_VIDEO:
|
||||
VideoPlayer@MISSION_VIDEO:
|
||||
X: 1
|
||||
Y: 1
|
||||
Width: 640
|
||||
@@ -160,7 +160,7 @@ Background@FULLSCREEN_PLAYER:
|
||||
Background: dialog5
|
||||
Visible: False
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 0
|
||||
Y: 0
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -64,7 +64,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Width: PARENT_RIGHT - 19
|
||||
Height: PARENT_BOTTOM - 19
|
||||
WorldInteractionController: INTERACTION_CONTROLLER
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 10
|
||||
Y: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
|
||||
@@ -383,7 +383,7 @@ Container@PLAYER_WIDGETS:
|
||||
SoundUp: RadarUp
|
||||
SoundDown: RadarDown
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 12
|
||||
Y: 32
|
||||
Width: 202
|
||||
|
||||
@@ -148,7 +148,7 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Height: 483
|
||||
Background: dialog3
|
||||
Children:
|
||||
VqaPlayer@MISSION_VIDEO:
|
||||
VideoPlayer@MISSION_VIDEO:
|
||||
X: 1
|
||||
Y: 1
|
||||
Width: 640
|
||||
@@ -163,7 +163,7 @@ Background@FULLSCREEN_PLAYER:
|
||||
Background: dialog5
|
||||
Visible: False
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 0
|
||||
Y: 0
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -194,6 +194,8 @@ SoundFormats: Aud, Wav
|
||||
|
||||
SpriteFormats: R8, ShpTD, TmpRA
|
||||
|
||||
VideoFormats: Vqa
|
||||
|
||||
SpriteSequenceFormat: DefaultSpriteSequence
|
||||
|
||||
ModelSequenceFormat: PlaceholderModelSequence
|
||||
|
||||
@@ -81,7 +81,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Y: 41
|
||||
Width: 220
|
||||
Height: 220
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 9
|
||||
Y: 41
|
||||
Width: 220
|
||||
|
||||
@@ -406,7 +406,7 @@ Container@PLAYER_WIDGETS:
|
||||
SoundUp: RadarUp
|
||||
SoundDown: RadarDown
|
||||
Children:
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 1
|
||||
Y: 1
|
||||
Width: 220
|
||||
|
||||
@@ -218,6 +218,8 @@ SoundFormats: Aud, Wav
|
||||
|
||||
SpriteFormats: ShpD2, ShpTD, TmpRA, TmpTD, ShpTS
|
||||
|
||||
VideoFormats: Vqa
|
||||
|
||||
SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence
|
||||
TilesetExtensions:
|
||||
TEMPERAT: .tem
|
||||
|
||||
@@ -64,7 +64,7 @@ Container@OBSERVER_WIDGETS:
|
||||
Width: PARENT_RIGHT - 19
|
||||
Height: PARENT_BOTTOM - 19
|
||||
WorldInteractionController: INTERACTION_CONTROLLER
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 10
|
||||
Y: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
|
||||
@@ -404,7 +404,7 @@ Container@PLAYER_WIDGETS:
|
||||
Height: 161
|
||||
SoundUp: RadarUp
|
||||
SoundDown: RadarDown
|
||||
VqaPlayer@PLAYER:
|
||||
VideoPlayer@PLAYER:
|
||||
X: 16
|
||||
Y: 64
|
||||
Width: 206
|
||||
|
||||
@@ -247,6 +247,8 @@ SoundFormats: Aud, Wav
|
||||
|
||||
SpriteFormats: ShpTS, TmpTS, ShpTD
|
||||
|
||||
VideoFormats: Vqa
|
||||
|
||||
SpriteSequenceFormat: TilesetSpecificSpriteSequence
|
||||
TilesetExtensions:
|
||||
TEMPERATE: .tem
|
||||
|
||||
Reference in New Issue
Block a user