Add a generic video player widget.

This commit is contained in:
Matthias Mailänder
2021-01-10 09:49:52 +01:00
committed by abcdefg30
parent 514652bb6a
commit 7bc17b59f5
29 changed files with 222 additions and 70 deletions

View 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();
}
}

View 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;
}
}
}

View File

@@ -70,13 +70,14 @@ namespace OpenRA
public readonly string[] SoundFormats = { }; public readonly string[] SoundFormats = { };
public readonly string[] SpriteFormats = { }; public readonly string[] SpriteFormats = { };
public readonly string[] PackageFormats = { }; public readonly string[] PackageFormats = { };
public readonly string[] VideoFormats = { };
readonly string[] reservedModuleNames = readonly string[] reservedModuleNames =
{ {
"Include", "Metadata", "Folders", "MapFolders", "Packages", "Rules", "Include", "Metadata", "Folders", "MapFolders", "Packages", "Rules",
"Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons", "Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
"Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys", "Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys",
"ServerTraits", "LoadScreen", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", "ServerTraits", "LoadScreen", "SupportsMapsFrom", "SoundFormats", "SpriteFormats", "VideoFormats",
"RequiresMods", "PackageFormats" "RequiresMods", "PackageFormats"
}; };
@@ -154,6 +155,9 @@ namespace OpenRA
if (yaml.ContainsKey("SpriteFormats")) if (yaml.ContainsKey("SpriteFormats"))
SpriteFormats = FieldLoader.GetValue<string[]>("SpriteFormats", yaml["SpriteFormats"].Value); 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) public void LoadCustomData(ObjectCreator oc)

View File

@@ -15,6 +15,7 @@ using System.IO;
using System.Linq; using System.Linq;
using OpenRA.FileSystem; using OpenRA.FileSystem;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Video;
using OpenRA.Widgets; using OpenRA.Widgets;
using FS = OpenRA.FileSystem.FileSystem; using FS = OpenRA.FileSystem.FileSystem;
@@ -31,6 +32,7 @@ namespace OpenRA
public readonly ISpriteLoader[] SpriteLoaders; public readonly ISpriteLoader[] SpriteLoaders;
public readonly ISpriteSequenceLoader SpriteSequenceLoader; public readonly ISpriteSequenceLoader SpriteSequenceLoader;
public readonly IModelSequenceLoader ModelSequenceLoader; public readonly IModelSequenceLoader ModelSequenceLoader;
public readonly IVideoLoader[] VideoLoaders;
public readonly HotkeyManager Hotkeys; public readonly HotkeyManager Hotkeys;
public ILoadScreen LoadScreen { get; private set; } public ILoadScreen LoadScreen { get; private set; }
public CursorProvider CursorProvider { get; private set; } public CursorProvider CursorProvider { get; private set; }
@@ -71,6 +73,7 @@ namespace OpenRA
SoundLoaders = ObjectCreator.GetLoaders<ISoundLoader>(Manifest.SoundFormats, "sound"); SoundLoaders = ObjectCreator.GetLoaders<ISoundLoader>(Manifest.SoundFormats, "sound");
SpriteLoaders = ObjectCreator.GetLoaders<ISpriteLoader>(Manifest.SpriteFormats, "sprite"); SpriteLoaders = ObjectCreator.GetLoaders<ISpriteLoader>(Manifest.SpriteFormats, "sprite");
VideoLoaders = ObjectCreator.GetLoaders<IVideoLoader>(Manifest.VideoFormats, "video");
var sequenceFormat = Manifest.Get<SpriteSequenceFormat>(); var sequenceFormat = Manifest.Get<SpriteSequenceFormat>();
var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader"); var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");

View File

@@ -11,15 +11,22 @@
using System; using System;
using System.IO; 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 ushort Frames { get { return frames; } }
public readonly byte Framerate; public byte Framerate { get { return framerate; } }
public readonly ushort Width; public ushort Width { get { return width; } }
public readonly ushort Height; public ushort Height { get { return height; } }
readonly ushort frames;
readonly byte framerate;
readonly ushort width;
readonly ushort height;
Stream stream; Stream stream;
int currentFrame; int currentFrame;
@@ -80,15 +87,15 @@ namespace OpenRA.Mods.Common.FileFormats
/*var version = */stream.ReadUInt16(); /*var version = */stream.ReadUInt16();
videoFlags = stream.ReadUInt16(); videoFlags = stream.ReadUInt16();
Frames = stream.ReadUInt16(); frames = stream.ReadUInt16();
Width = stream.ReadUInt16(); width = stream.ReadUInt16();
Height = stream.ReadUInt16(); height = stream.ReadUInt16();
blockWidth = stream.ReadUInt8(); blockWidth = stream.ReadUInt8();
blockHeight = stream.ReadUInt8(); blockHeight = stream.ReadUInt8();
Framerate = stream.ReadUInt8(); framerate = stream.ReadUInt8();
chunkBufferParts = stream.ReadUInt8(); chunkBufferParts = stream.ReadUInt8();
blocks = new int2(Width / blockWidth, Height / blockHeight); blocks = new int2(width / blockWidth, height / blockHeight);
numColors = stream.ReadUInt16(); numColors = stream.ReadUInt16();
/*var maxBlocks = */stream.ReadUInt16(); /*var maxBlocks = */stream.ReadUInt16();
@@ -106,7 +113,7 @@ namespace OpenRA.Mods.Common.FileFormats
/*var unknown5 =*/stream.ReadUInt32(); /*var unknown5 =*/stream.ReadUInt32();
var frameSize = Exts.NextPowerOf2(Math.Max(Width, Height)); var frameSize = Exts.NextPowerOf2(Math.Max(width, height));
if (IsHqVqa) if (IsHqVqa)
{ {
@@ -116,9 +123,9 @@ namespace OpenRA.Mods.Common.FileFormats
} }
else else
{ {
cbfBuffer = new byte[Width * Height]; cbfBuffer = new byte[width * height];
cbf = new byte[Width * Height]; cbf = new byte[width * height];
cbp = new byte[Width * Height]; cbp = new byte[width * height];
origData = new byte[2 * blocks.X * blocks.Y]; origData = new byte[2 * blocks.X * blocks.Y];
} }
@@ -142,8 +149,8 @@ namespace OpenRA.Mods.Common.FileFormats
/*var unknown4 = */stream.ReadUInt16(); /*var unknown4 = */stream.ReadUInt16();
// Frame offsets // Frame offsets
offsets = new uint[Frames]; offsets = new uint[frames];
for (var i = 0; i < Frames; i++) for (var i = 0; i < frames; i++)
{ {
offsets[i] = stream.ReadUInt32(); offsets[i] = stream.ReadUInt32();
if (offsets[i] > 0x40000000) if (offsets[i] > 0x40000000)
@@ -168,10 +175,10 @@ namespace OpenRA.Mods.Common.FileFormats
var audio2 = new MemoryStream(); // right channel var audio2 = new MemoryStream(); // right channel
var adpcmIndex = 0; var adpcmIndex = 0;
var compressed = false; var compressed = false;
for (var i = 0; i < Frames; i++) for (var i = 0; i < frames; i++)
{ {
stream.Seek(offsets[i], SeekOrigin.Begin); 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) while (stream.Position < end)
{ {
@@ -261,12 +268,12 @@ namespace OpenRA.Mods.Common.FileFormats
void LoadFrame() void LoadFrame()
{ {
if (currentFrame >= Frames) if (currentFrame >= frames)
return; return;
// Seek to the start of the frame // Seek to the start of the frame
stream.Seek(offsets[currentFrame], SeekOrigin.Begin); 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) while (stream.Position < end)
{ {
@@ -344,8 +351,7 @@ namespace OpenRA.Mods.Common.FileFormats
s.ReadBytes(fileBuffer, 0, subchunkLength); s.ReadBytes(fileBuffer, 0, subchunkLength);
Array.Clear(cbf, 0, cbf.Length); Array.Clear(cbf, 0, cbf.Length);
Array.Clear(cbfBuffer, 0, cbfBuffer.Length); Array.Clear(cbfBuffer, 0, cbfBuffer.Length);
var decodeCount = 0; var decodeCount = LCWDecodeInto(fileBuffer, cbfBuffer, decodeMode ? 1 : 0, decodeMode);
decodeCount = LCWDecodeInto(fileBuffer, cbfBuffer, decodeMode ? 1 : 0, decodeMode);
if ((videoFlags & 0x10) == 16) if ((videoFlags & 0x10) == 16)
{ {
var p = 0; var p = 0;

View 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;
}
}
}

View File

@@ -15,10 +15,10 @@ using Eluant;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.FileFormats;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Scripting; using OpenRA.Scripting;
using OpenRA.Video;
namespace OpenRA.Mods.Common.Scripting namespace OpenRA.Mods.Common.Scripting
{ {
@@ -175,12 +175,12 @@ namespace OpenRA.Mods.Common.Scripting
return false; return false;
} }
AsyncLoader l = new AsyncLoader(Media.LoadVqa); AsyncLoader l = new AsyncLoader(Media.LoadVideo);
IAsyncResult ar = l.BeginInvoke(s, null, null); IAsyncResult ar = l.BeginInvoke(s, null, null);
Action onLoadComplete = () => Action onLoadComplete = () =>
{ {
Media.StopFMVInRadar(); 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))); 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))); world.AddFrameEndTask(w => w.Add(new FloatingText(position, c, text, duration)));
} }
public delegate VqaReader AsyncLoader(Stream s); public delegate IVideo AsyncLoader(Stream s);
} }
} }

View File

@@ -11,8 +11,8 @@
using System; using System;
using System.IO; using System.IO;
using OpenRA.Mods.Common.FileFormats;
using OpenRA.Mods.Common.Widgets; using OpenRA.Mods.Common.Widgets;
using OpenRA.Video;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Scripting namespace OpenRA.Mods.Common.Scripting
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
public static void PlayFMVFullscreen(World w, string movie, Action onComplete) public static void PlayFMVFullscreen(World w, string movie, Action onComplete)
{ {
var playerRoot = Game.OpenWindow(w, "FMVPLAYER"); var playerRoot = Game.OpenWindow(w, "FMVPLAYER");
var player = playerRoot.Get<VqaPlayerWidget>("PLAYER"); var player = playerRoot.Get<VideoPlayerWidget>("PLAYER");
try 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.Open(movie);
player.PlayThen(() => player.PlayThen(() =>
@@ -74,13 +74,13 @@ namespace OpenRA.Mods.Common.Scripting
public static void StopFMVInRadar() public static void StopFMVInRadar()
{ {
var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER"); var player = Ui.Root.Get<VideoPlayerWidget>("PLAYER");
player.Stop(); 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);
} }
} }
} }

View File

@@ -17,6 +17,7 @@ using System.Linq;
using OpenRA.FileSystem; using OpenRA.FileSystem;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Video;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic namespace OpenRA.Mods.Common.Widgets.Logic
@@ -44,7 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
IReadOnlyPackage currentPackage; IReadOnlyPackage currentPackage;
Sprite[] currentSprites; Sprite[] currentSprites;
IModel currentVoxel; IModel currentVoxel;
VqaPlayerWidget player = null; VideoPlayerWidget player = null;
bool isVideoLoaded = false; bool isVideoLoaded = false;
bool isLoadError = false; bool isLoadError = false;
int currentFrame; int currentFrame;
@@ -84,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
spriteWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentSprites != null; spriteWidget.IsVisible = () => !isVideoLoaded && !isLoadError && currentSprites != null;
} }
var playerWidget = panel.GetOrNull<VqaPlayerWidget>("PLAYER"); var playerWidget = panel.GetOrNull<VideoPlayerWidget>("PLAYER");
if (playerWidget != null) if (playerWidget != null)
playerWidget.IsVisible = () => isVideoLoaded && !isLoadError; playerWidget.IsVisible = () => isVideoLoaded && !isLoadError;
@@ -379,9 +380,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
prefix += "|"; 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.Load(prefix + filename);
player.DrawOverlay = false; player.DrawOverlay = false;
isVideoLoaded = true; isVideoLoaded = true;

View File

@@ -17,6 +17,7 @@ using System.Threading;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Video;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic namespace OpenRA.Mods.Common.Widgets.Logic
@@ -36,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly ButtonWidget stopBriefingVideoButton; readonly ButtonWidget stopBriefingVideoButton;
readonly ButtonWidget startInfoVideoButton; readonly ButtonWidget startInfoVideoButton;
readonly ButtonWidget stopInfoVideoButton; readonly ButtonWidget stopInfoVideoButton;
readonly VqaPlayerWidget videoPlayer; readonly VideoPlayerWidget videoPlayer;
readonly BackgroundWidget fullscreenVideoPlayer; readonly BackgroundWidget fullscreenVideoPlayer;
readonly ScrollPanelWidget missionList; readonly ScrollPanelWidget missionList;
@@ -71,7 +72,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
previewWidget.Preview = () => selectedMap; previewWidget.Preview = () => selectedMap;
previewWidget.IsVisible = () => playingVideo == PlayingVideo.None; 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; widget.Get("MISSION_BIN").IsVisible = () => playingVideo != PlayingVideo.None;
fullscreenVideoPlayer = Ui.LoadWidget<BackgroundWidget>("FULLSCREEN_PLAYER", Ui.Root, new WidgetArgs { { "world", world } }); 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; 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)) 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) if (playingVideo == PlayingVideo.None)
return; return;
@@ -385,7 +386,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var missionData = selectedMap.Rules.Actors["world"].TraitInfoOrDefault<MissionDataInfo>(); var missionData = selectedMap.Rules.Actors["world"].TraitInfoOrDefault<MissionDataInfo>();
if (missionData != null && missionData.StartVideo != null && modData.DefaultFileSystem.Exists(missionData.StartVideo)) 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; fullscreenVideoPlayer.Visible = true;
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () => PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
{ {

View File

@@ -11,13 +11,13 @@
using System; using System;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.FileFormats;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Video;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class VqaPlayerWidget : Widget public class VideoPlayerWidget : Widget
{ {
public Hotkey CancelKey = new Hotkey(Keycode.ESCAPE, Modifiers.None); public Hotkey CancelKey = new Hotkey(Keycode.ESCAPE, Modifiers.None);
public float AspectRatio = 1.2f; public float AspectRatio = 1.2f;
@@ -25,11 +25,11 @@ namespace OpenRA.Mods.Common.Widgets
public bool Skippable = true; public bool Skippable = true;
public bool Paused { get { return paused; } } public bool Paused { get { return paused; } }
public VqaReader Video { get { return video; } } public IVideo Video { get { return video; } }
Sprite videoSprite, overlaySprite; Sprite videoSprite, overlaySprite;
Sheet overlaySheet; Sheet overlaySheet;
VqaReader video = null; IVideo video = null;
string cachedVideo; string cachedVideo;
float invLength; float invLength;
float2 videoOrigin, videoSize; float2 videoOrigin, videoSize;
@@ -44,13 +44,14 @@ namespace OpenRA.Mods.Common.Widgets
{ {
if (filename == cachedVideo) if (filename == cachedVideo)
return; 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; cachedVideo = filename;
Open(video);
} }
public void Open(VqaReader video) public void Open(IVideo video)
{ {
this.video = video; this.video = video;

View File

@@ -104,7 +104,7 @@ Container@ASSETBROWSER_PANEL:
Sprite@SPRITE: Sprite@SPRITE:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Height: PARENT_BOTTOM Height: PARENT_BOTTOM
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Height: PARENT_BOTTOM Height: PARENT_BOTTOM
AspectRatio: 1 AspectRatio: 1

View File

@@ -160,7 +160,7 @@ Container@OBSERVER_WIDGETS:
Y: 1 Y: 1
Width: PARENT_RIGHT - 2 Width: PARENT_RIGHT - 2
Height: PARENT_BOTTOM - 2 Height: PARENT_BOTTOM - 2
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 1 X: 1
Y: 1 Y: 1
Width: PARENT_RIGHT - 2 Width: PARENT_RIGHT - 2
@@ -1632,7 +1632,7 @@ Container@PLAYER_WIDGETS:
Height: 194 Height: 194
SoundUp: RadarUp SoundUp: RadarUp
SoundDown: RadarDown SoundDown: RadarDown
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
Width: 194 Width: 194
Height: 194 Height: 194
Skippable: false Skippable: false
@@ -1856,7 +1856,7 @@ Background@FMVPLAYER:
Height: WINDOW_BOTTOM Height: WINDOW_BOTTOM
Background: panel-allblack Background: panel-allblack
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 0 X: 0
Y: 0 Y: 0
Width: WINDOW_RIGHT Width: WINDOW_RIGHT

View File

@@ -146,7 +146,7 @@ Container@MISSIONBROWSER_PANEL:
Font: Bold Font: Bold
Container@MISSION_BIN: Container@MISSION_BIN:
Children: Children:
VqaPlayer@MISSION_VIDEO: VideoPlayer@MISSION_VIDEO:
X: 1 X: 1
Y: 1 Y: 1
Width: 712 Width: 712
@@ -159,7 +159,7 @@ Background@FULLSCREEN_PLAYER:
Background: panel-allblack Background: panel-allblack
Visible: False Visible: False
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 0 X: 0
Y: 0 Y: 0
Width: WINDOW_RIGHT Width: WINDOW_RIGHT

View File

@@ -212,6 +212,8 @@ SoundFormats: Aud, Wav
SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA
VideoFormats: Vqa
SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence
TilesetExtensions: TilesetExtensions:
TEMPERAT: .tem TEMPERAT: .tem

View File

@@ -99,7 +99,7 @@ Background@ASSETBROWSER_PANEL:
Sprite@SPRITE: Sprite@SPRITE:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Height: PARENT_BOTTOM Height: PARENT_BOTTOM
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
Width: PARENT_RIGHT Width: PARENT_RIGHT
Height: PARENT_BOTTOM Height: PARENT_BOTTOM
AspectRatio: 1 AspectRatio: 1

View File

@@ -3,7 +3,7 @@ Background@FMVPLAYER:
Height: WINDOW_BOTTOM Height: WINDOW_BOTTOM
Background: dialog5 Background: dialog5
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 0 X: 0
Y: 0 Y: 0
Width: WINDOW_RIGHT Width: WINDOW_RIGHT

View File

@@ -44,7 +44,7 @@ Container@OBSERVER_WIDGETS:
Width: PARENT_RIGHT - 19 Width: PARENT_RIGHT - 19
Height: PARENT_BOTTOM - 19 Height: PARENT_BOTTOM - 19
WorldInteractionController: INTERACTION_CONTROLLER WorldInteractionController: INTERACTION_CONTROLLER
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 10 X: 10
Y: 10 Y: 10
Width: PARENT_RIGHT - 20 Width: PARENT_RIGHT - 20

View File

@@ -147,7 +147,7 @@ Background@MISSIONBROWSER_PANEL:
Height: 377 Height: 377
Background: dialog3 Background: dialog3
Children: Children:
VqaPlayer@MISSION_VIDEO: VideoPlayer@MISSION_VIDEO:
X: 1 X: 1
Y: 1 Y: 1
Width: 640 Width: 640
@@ -160,7 +160,7 @@ Background@FULLSCREEN_PLAYER:
Background: dialog5 Background: dialog5
Visible: False Visible: False
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 0 X: 0
Y: 0 Y: 0
Width: WINDOW_RIGHT Width: WINDOW_RIGHT

View File

@@ -64,7 +64,7 @@ Container@OBSERVER_WIDGETS:
Width: PARENT_RIGHT - 19 Width: PARENT_RIGHT - 19
Height: PARENT_BOTTOM - 19 Height: PARENT_BOTTOM - 19
WorldInteractionController: INTERACTION_CONTROLLER WorldInteractionController: INTERACTION_CONTROLLER
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 10 X: 10
Y: 10 Y: 10
Width: PARENT_RIGHT - 20 Width: PARENT_RIGHT - 20

View File

@@ -383,7 +383,7 @@ Container@PLAYER_WIDGETS:
SoundUp: RadarUp SoundUp: RadarUp
SoundDown: RadarDown SoundDown: RadarDown
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 12 X: 12
Y: 32 Y: 32
Width: 202 Width: 202

View File

@@ -148,7 +148,7 @@ Background@MISSIONBROWSER_PANEL:
Height: 483 Height: 483
Background: dialog3 Background: dialog3
Children: Children:
VqaPlayer@MISSION_VIDEO: VideoPlayer@MISSION_VIDEO:
X: 1 X: 1
Y: 1 Y: 1
Width: 640 Width: 640
@@ -163,7 +163,7 @@ Background@FULLSCREEN_PLAYER:
Background: dialog5 Background: dialog5
Visible: False Visible: False
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 0 X: 0
Y: 0 Y: 0
Width: WINDOW_RIGHT Width: WINDOW_RIGHT

View File

@@ -194,6 +194,8 @@ SoundFormats: Aud, Wav
SpriteFormats: R8, ShpTD, TmpRA SpriteFormats: R8, ShpTD, TmpRA
VideoFormats: Vqa
SpriteSequenceFormat: DefaultSpriteSequence SpriteSequenceFormat: DefaultSpriteSequence
ModelSequenceFormat: PlaceholderModelSequence ModelSequenceFormat: PlaceholderModelSequence

View File

@@ -81,7 +81,7 @@ Container@OBSERVER_WIDGETS:
Y: 41 Y: 41
Width: 220 Width: 220
Height: 220 Height: 220
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 9 X: 9
Y: 41 Y: 41
Width: 220 Width: 220

View File

@@ -406,7 +406,7 @@ Container@PLAYER_WIDGETS:
SoundUp: RadarUp SoundUp: RadarUp
SoundDown: RadarDown SoundDown: RadarDown
Children: Children:
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 1 X: 1
Y: 1 Y: 1
Width: 220 Width: 220

View File

@@ -218,6 +218,8 @@ SoundFormats: Aud, Wav
SpriteFormats: ShpD2, ShpTD, TmpRA, TmpTD, ShpTS SpriteFormats: ShpD2, ShpTD, TmpRA, TmpTD, ShpTS
VideoFormats: Vqa
SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence SpriteSequenceFormat: ClassicTilesetSpecificSpriteSequence
TilesetExtensions: TilesetExtensions:
TEMPERAT: .tem TEMPERAT: .tem

View File

@@ -64,7 +64,7 @@ Container@OBSERVER_WIDGETS:
Width: PARENT_RIGHT - 19 Width: PARENT_RIGHT - 19
Height: PARENT_BOTTOM - 19 Height: PARENT_BOTTOM - 19
WorldInteractionController: INTERACTION_CONTROLLER WorldInteractionController: INTERACTION_CONTROLLER
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 10 X: 10
Y: 10 Y: 10
Width: PARENT_RIGHT - 20 Width: PARENT_RIGHT - 20

View File

@@ -404,7 +404,7 @@ Container@PLAYER_WIDGETS:
Height: 161 Height: 161
SoundUp: RadarUp SoundUp: RadarUp
SoundDown: RadarDown SoundDown: RadarDown
VqaPlayer@PLAYER: VideoPlayer@PLAYER:
X: 16 X: 16
Y: 64 Y: 64
Width: 206 Width: 206

View File

@@ -247,6 +247,8 @@ SoundFormats: Aud, Wav
SpriteFormats: ShpTS, TmpTS, ShpTD SpriteFormats: ShpTS, TmpTS, ShpTD
VideoFormats: Vqa
SpriteSequenceFormat: TilesetSpecificSpriteSequence SpriteSequenceFormat: TilesetSpecificSpriteSequence
TilesetExtensions: TilesetExtensions:
TEMPERATE: .tem TEMPERATE: .tem