convert OGV format into Ogg propery.

This commit is contained in:
morkt
2015-06-14 04:10:00 +04:00
parent d7030ecbdc
commit 227eae0dbe
2 changed files with 24 additions and 15 deletions

View File

@@ -25,6 +25,7 @@
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.IO; using System.IO;
using GameRes.Utility;
namespace GameRes.Formats.ShiinaRio namespace GameRes.Formats.ShiinaRio
{ {
@@ -37,21 +38,29 @@ namespace GameRes.Formats.ShiinaRio
public override SoundInput TryOpen (Stream file) public override SoundInput TryOpen (Stream file)
{ {
var input = file as MemoryStream; file.Position = 0xc;
if (null == input || !input.CanWrite) var header = new byte[8];
if (8 != file.Read (header, 0, 8))
return null;
if (!Binary.AsciiEqual (header, 0, "fmt "))
return null;
uint offset = LittleEndian.ToUInt32 (header, 4);
file.Seek (offset, SeekOrigin.Current);
if (8 != file.Read (header, 0, 8))
return null;
if (!Binary.AsciiEqual (header, 0, "data"))
return null;
var input = new StreamRegion (file, file.Position);
try
{ {
input = new MemoryStream(); return new OggInput (input);
file.CopyTo (input); }
catch
{
input.Dispose();
throw;
} }
input.Position = 1;
input.WriteByte ((byte)'g');
input.WriteByte ((byte)'g');
input.WriteByte ((byte)'S');
input.Position = 0;
var ogg = new OggInput (input);
if (file != input)
file.Dispose();
return ogg;
} }
} }
} }

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.0.6.62")] [assembly: AssemblyVersion ("1.0.6.63")]
[assembly: AssemblyFileVersion ("1.0.6.62")] [assembly: AssemblyFileVersion ("1.0.6.63")]