You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

4 years ago
using System;
using System.IO;
namespace VGMToolbox.format
{
public class Mpeg1Stream : MpegStream
{
public const string DefaultAudioExtension = ".mp2";
public const string DefaultVideoExtension = ".m1v";
public Mpeg1Stream(string path)
: base(path)
{
this.FileExtensionAudio = DefaultAudioExtension;
this.FileExtensionVideo = DefaultVideoExtension;
base.BlockIdDictionary[BitConverter.ToUInt32(MpegStream.PacketStartBytes, 0)] = new BlockSizeStruct(PacketSizeType.Static, 0xC); // Pack Header
}
protected override int GetAudioPacketHeaderSize(Stream readStream, long currentOffset)
{
int paddingByteCount = 0;
readStream.Position = currentOffset + 6;
// skip stuffing bytes
while (readStream.ReadByte() == 0xFF)
{
paddingByteCount++;
}
return paddingByteCount + 7;
}
protected override int GetVideoPacketHeaderSize(Stream readStream, long currentOffset)
{
return 0xC;
}
}
}