Skip to content

Commit b0362bb

Browse files
author
snakemeat
committed
[MPEG DEMUX] Add some work arounds for stream ids, and comments in PAM on how to get it right when I have more time.
git-svn-id: https://svn.code.sf.net/p/vgmtoolbox/code@748 a691631e-124d-0410-8249-85b9adaa1b1e
1 parent 6754b1c commit b0362bb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

format/VGMToolbox/format/SonyPamStream.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ public class SonyPamStream : SonyPmfStream
1010
{
1111
new public const string DefaultAudioExtension = ".at3";
1212

13-
new public static readonly byte[] Atrac3Bytes = new byte[] { 0x1E, 0x60, 0x14, 0x00 };
13+
new public static readonly byte[] Atrac3Bytes = new byte[] { 0x1E, 0x60, 0x14 };
1414

1515
public const string Ac3AudioExtension = ".ac3";
1616
public static readonly byte[] Ac3Bytes = new byte[] { 0x1E, 0x60, 0x14, 0x30 };
1717

1818
public const string M2vVideoExtension = ".m2v";
1919
public static readonly byte[] M2vBytes = new byte[] { 0x00, 0x00, 0x01, 0xB3 };
2020

21+
/*
22+
For the following values, stream ID is at the offset, from location of ID (000001BD):
23+
* 0x8181: 0x11
24+
* 0x8180: 0x0E
25+
* 0x8100: 0x09
26+
*/
2127
public SonyPamStream(string path)
2228
: base(path)
2329
{
@@ -27,15 +33,14 @@ public SonyPamStream(string path)
2733

2834
base.BlockIdDictionary[BitConverter.ToUInt32(Mpeg2Stream.PacketStartByes, 0)] = new BlockSizeStruct(PacketSizeType.Static, 0xE); // Pack Header
2935
base.BlockIdDictionary[BitConverter.ToUInt32(new byte[] { 0x00, 0x00, 0x01, 0xBD }, 0)] = new BlockSizeStruct(PacketSizeType.SizeBytes, 2); // Audio Stream, two bytes following equal length (Big Endian)
30-
// base.BlockIdDictionary[BitConverter.ToUInt32(new byte[] { 0x00, 0x00, 0x01, 0xBF }, 0)] = new BlockSizeStruct(PacketSizeType.SizeBytes, 2); // Audio Stream, two bytes following equal length (Big Endian)
3136
}
3237

3338
protected override string GetAudioFileExtension(Stream readStream, long currentOffset)
3439
{
3540
string fileExtension;
3641
byte[] checkBytes;
3742

38-
checkBytes = ParseFile.ParseSimpleOffset(readStream, (currentOffset + 0xE), 4);
43+
checkBytes = ParseFile.ParseSimpleOffset(readStream, (currentOffset + 0xE), 3);
3944

4045
if (ParseFile.CompareSegment(checkBytes, 0, Atrac3Bytes))
4146
{

format/VGMToolbox/format/SonyPmfStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class SonyPmfStream : Mpeg2Stream
1313
public const string Atrac3AudioExtension = ".at3";
1414
public const string LpcmAudioExtension = ".lpcm";
1515

16-
public static readonly byte[] Atrac3Bytes = new byte[] { 0x1E, 0x60, 0x04, 0x00 };
16+
public static readonly byte[] Atrac3Bytes = new byte[] { 0x1E, 0x60, 0x04 };
1717
public static readonly byte[] LpcmBytes = new byte[] { 0x1E, 0x61, 0x80, 0x40 };
1818

1919
public const string AvcVideoExtension = ".264";
@@ -113,7 +113,7 @@ protected override string GetAudioFileExtension(Stream readStream, long currentO
113113
string fileExtension;
114114
byte[] checkBytes;
115115

116-
checkBytes = ParseFile.ParseSimpleOffset(readStream, (currentOffset + 0xE), 4);
116+
checkBytes = ParseFile.ParseSimpleOffset(readStream, (currentOffset + 0xE), 3);
117117

118118
if (ParseFile.CompareSegment(checkBytes, 0, Atrac3Bytes))
119119
{

0 commit comments

Comments
 (0)