Bulldog13
Golden Member
Details on the question can be found here:
http://stackoverflow.com/questions/...roperties-number-of-channels-bits-per-channel
I am not really sure where to begin. I tried using the binaryreader on the .ogg file and comparing it to the file specification on the stackoverflow thread, but it doesn't really seem to make any sense.
I am a .NET webdeveloper, so alot of this stuff is very foreign to me. All I am trying to do is get some very basic attributes of a .ogg file.
http://stackoverflow.com/questions/...roperties-number-of-channels-bits-per-channel
I am not really sure where to begin. I tried using the binaryreader on the .ogg file and comparing it to the file specification on the stackoverflow thread, but it doesn't really seem to make any sense.
Code:
var binReader =
new BinaryReader(File.Open("a.ogg", FileMode.Open));
try
{
// If the file is not empty,
// read the application settings.
// First read 4 bytes into a buffer to
// determine if the file is empty.
var testArray = new byte[5];
int fileType = binReader.Read(testArray, 0, 5);
if (fileType != 0)
{
// // Reset the position in the stream to zero.
binReader.BaseStream.Seek(0, SeekOrigin.Begin);
// aspectRatio = binReader.ReadSingle();
// lookupDir = binReader.ReadString();
// autoSaveTime = binReader.ReadInt32();
// showStatusBar = binReader.ReadBoolean();
}
var x = BitConverter.ToUInt32(testArray, 0);
//var z = BitConverter.ToUInt32(testArray, 4);
}
// If the end of the stream is reached before reading
// the four data values, ignore the error and use the
// default settings for the remaining values.
catch (EndOfStreamException)
{
Console.WriteLine("{0} caught and ignored. " +
"Using default values.", e.GetType().Name);
}
finally
{
binReader.Close();
}
I am a .NET webdeveloper, so alot of this stuff is very foreign to me. All I am trying to do is get some very basic attributes of a .ogg file.