View Full Version : AC3 bitrate in Delphi
MattO
28th April 2003, 19:06
Hiya all,
Can anyone supply working Delphi code to get the audio bitrate from a .AC3 file? or is it more difficult than I expect ...
I have read this:
http://mpucoder.kewlhair.com/DVD/ac3hdr.html
but I do not fully understand how to utilize this my needs.
thanks for any help
MattO
Emp3r0r
28th April 2003, 19:55
You don't have to read the header if you know the duration and filesize. (of course this is a lazy solution)
GZZ
28th April 2003, 21:53
look at this post:
http://forum.doom9.org/showthread.php?s=&threadid=41024
It might help you or then take a look at the ac3 file with vobedit. Its very useful.
GZZ
MattO
29th April 2003, 20:11
Thanks,
I'll check it out.
MattO
Amnon82
28th October 2005, 00:27
I found a code for wav-files, but how can I use it for AC3 and DTS?
{....}
private
procedure OpenMedia(WaveFile : string);
function GetStatus(StatusRequested : DWord) : longint;
procedure CloseMedia;
{....}
var
MyError, dwFlags: Longint;
FDeviceID : Word;
{....}
uses
MMSystem;
{....}
procedure TForm1.OpenMedia(WaveFile: string);
var
MyOpenParms: TMCI_Open_Parms;
begin
with MyOpenParms do
begin
dwCallback := Handle; // TForm1.Handle
lpstrDeviceType := PChar('WaveAudio');
lpstrElementName := PChar(WaveFile);
end; {with MyOpenParms}
dwFlags := MCI_WAIT or MCI_OPEN_ELEMENT or MCI_OPEN_TYPE;
MyError := mciSendCommand(0, MCI_OPEN, dwFlags, Longint(@MyOpenParms));
// one could use mciSendCommand(DevId, here to specify a particular device
if MyError = 0 then
FDeviceID := MyOpenParms.wDeviceID
else
raise Exception.Create('Open Failed');
end;
function TForm1.GetStatus(StatusRequested: DWORD): Longint;
var
MyStatusParms: TMCI_Status_Parms;
begin
dwFlags := MCI_WAIT or MCI_STATUS_ITEM;
with MyStatusParms do
begin
dwCallback := Handle;
dwItem := StatusRequested;
end;
MyError := mciSendCommand(FDeviceID,
MCI_STATUS,
MCI_WAIT or MCI_STATUS_ITEM,
Longint(@MyStatusParms));
if MyError = 0 then
Result := MyStatusParms.dwReturn
else
raise Exception.Create('Status call to get status of ' +
IntToStr(StatusRequested) + ' Failed');
end;
procedure TForm1.CloseMedia;
var
MyGenParms: TMCI_Generic_Parms;
begin
if FDeviceID > 0 then
begin
dwFlags := 0;
MyGenParms.dwCallback := Handle; // TForm1.Handle
MyError := mciSendCommand(FDeviceID, MCI_CLOSE, dwFlags, Longint(@MyGenParms));
if MyError = 0 then
FDeviceID := 0
else
begin
raise Exception.Create('Close Failed');
end;
end;
end;
//Example:
//Beispiel:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
OpenMedia(OpenDialog1.FileName);
with ListBox1.Items do
begin
Add('Average Bytes / Sec : ' + IntToStr(GetStatus(MCI_WAVE_STATUS_AVGBYTESPERSEC)));
Add('Bits / Sample : ' + IntToStr(GetStatus(MCI_WAVE_STATUS_BITSPERSAMPLE)));
Add('Samples / Sec : ' + IntToStr(GetStatus(MCI_WAVE_STATUS_SAMPLESPERSEC)));
Add('Channels : ' + IntToStr(GetStatus(MCI_WAVE_STATUS_CHANNELS)));
end;
CloseMedia;
end;
end;
Kurtnoise
28th October 2005, 07:32
Amnon : use ATL (http://mac.sourceforge.net/atl/)...it's very easy. :)
Amnon82
30th October 2005, 03:06
Thx dude. This will help me alot !!!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.