Log in

View Full Version : neuron, is there a way to get the infos DGIndex gets form the source?


Amnon82
15th March 2006, 22:26
Rockas posted me his AutoIt-Script for reading the infos out of DGIndex

Opt('WinTitleMatchMode', 2)
sleep(2000)
$DGIndex="DGIndex"
WinGetTitle('DGIndex' & $DGIndex)
WinWaitActive ("DGIndex")
sleep(100)
Send("{F5}")

$SynEditor="SynthEditor"
WinGetTitle('SynthEditor' & $SynEditor)

sleep(5000)
$FrameT=ControlGetText ( "Information", "", 1022 )
$FOrder=ControlGetText ( "Information", "", 1034 )
ControlSetText ( "DialogName", "", "ControlID", $FrameT )
ControlSetText ( "DialogName", "", "ControlID", $FOrder )

Send("{Esc}")

sleep(200)
Send("!f")
sleep(200)
send("{UP}")
sleep(200)
send("{ENTER}")
Exit

Is there a way to read out the d2v directly or can you save the infos of the source in a extra text-file? It will be realy helpfull for us two and others ...

Rockas
15th March 2006, 23:05
Well... I guess I can make the scipt to output the data to a text file... the current script send the data diectly to two different fields of Synth Editor.

Guest
15th March 2006, 23:22
@Rockas and Amnon82

My plan is to address this for 1.4.7.

Do you just want the final Info dialog information to be (optionally) stored in a text file?

The more clearly you state your requirements in this regard, the more likely it will be that your requirements are met. :)

Rockas
15th March 2006, 23:36
A text file will be fine to me - or on the project file :)
Can you add the option to cli?
Can you have the avrg bitrate on that info too?

Thank you.

Amnon82
17th March 2006, 11:48
It will help us a lot. In cli it will also be fine. Text of the info dialog in a txt-file is exactly what I'm searching for.

Thx neuron.

Rockas
17th March 2006, 14:37
I just thought that another good/important Information would be the Audio delay... can it be added to the text file as well?
Thank you

alfixdvd
18th March 2006, 12:40
The final Info dialog information stored in a text file plus information about TFF or BFF.

Best regards.

alfixdvd
18th March 2006, 16:16
Coded # : 195363
Frame Rate : 25.000 fps
Video Type : PAL
Frame Type : Interlaced
Aspect Ratio : 16:9
Frame Size : 720x576
Profile : main@main
Frame Struct : Frame
Field Order : Top
Audio : DD 2/0 192
Colorimetry : ITU-R BT.709


The code that at the moment I use to obtain the data that I want, consists of capturing the information that appears in the windows of Information:

1. After creating file d2v
2. After play movie about 5"(to obtain data on TFF or BFF).

I execute Dgindex via WinExecAndWait32.
DGIndex.exe - AIF=[G:\VIDEO_TS\vts_01_1.vob ] - IA=3 - FO=0 - YR=1 - OM=0 - OF=[.\LaRoca]

In WinExecAndWait32 I have putting the condition
Until ((exitCode < > WAIT_TIMEOUT) or (CreatedD2v() = true));
for being able to finalize when the file d2v has been created.

CreatedD2v function controls the size of the file d2v. When it has finished collects information in the Tlist Milista.
informationHwnd: = FindWindow(nil, 'Information ');
EnumChildWindows(informationHwnd, @EnumChildWindowsProc, LParam(MiLista));

Later I send the keycode F5 so that movie reproduces for 5"
PostMessage(GetParent(InformationHwnd), WM_KEYDOWN, VK_F5, 0);
Sleep(5000);

When the 5" have passed I send the keycode ESC to stop it.
PostMessage(GetParent(InformationHwnd), WM_KEYDOWN, VK_ESCAPE, 0);

Then I collect information in the Tlist Milista2. (I only want TFF).
EnumChildWindows(informationHwnd, @EnumChildWindowsProc, Lparam(MiLista2));


type
PVentana = ^Ventana;
Ventana = record
CtrlHwnd: HWND;
CtrlId : integer;
Text: array[0..99] of Char;
end;

procedure TForm1.btnCrearD2vClick(Sender: TObject);
var
i : Integer;
Elemento, Elemento1034 : PVentana;
begin
D2vFileSize := 0;
MiLista := TList.Create;
MiLista2:= TList.Create;
reMemo.Lines.Append('Ejecutando DgIndex');
reMemo.Lines.Append('');
reMemo.Lines.Append(lblEditDgIndex.Text + ' ' + Format(DgIndex_commands,[ExtractFilePath(Application.ExeName),lblEditAvs.Text]));
WinExecAndWait32(lblEditDgIndex.Text + ' ' + Format(DgIndex_commands,[ExtractFilePath(Application.ExeName),lblEditAvs.Text]),SW_SHOW, ExtractFilePath(Application.ExeName));
reMemo.Lines.Append('');

for i := 0 to (MiLista2.Count - 1) do
begin
Elemento := MiLista2.Items[i];
if Elemento^.CtrlId = 1034 then Elemento1034 := MiLista2.Items[i];
end;

for i := 0 to (MiLista.Count - 1) do
begin
Elemento := MiLista.Items[i];
case Elemento^.CtrlId of
1016: begin
rememo.lines.Append(Format('Coded # : %s',[Elemento^.Text]));
form1.lblEditFrames.Text := Elemento^.Text;
end;
1018: rememo.lines.Append(Format('Frame Rate : %s',[Elemento^.Text]));
1021: rememo.lines.Append(Format('Video Type : %s',[Elemento^.Text]));
1022: begin
rememo.lines.Append(Format('Frame Type : %s',[Elemento^.Text]));
if (StrComp(Elemento^.Text,'Interlaced') = 0 ) then
rbInterlaced.checked := true
else if (StrComp(Elemento^.Text,'Progressive') = 0 ) then
rbProgressive.Checked := true
else ShowMessage(Format('Frame Type : %s desconocido',[Elemento^.Text]));
end;
1023: begin
rememo.lines.Append(Format('Aspect Ratio : %s',[Elemento^.Text]));
if (StrComp(Elemento^.Text,'16:9') = 0 ) then
rb169.checked := true
else if (StrComp(Elemento^.Text,'4:3') = 0 ) then
rb43.Checked := true
else ShowMessage(Format('Aspect Ratio : %s desconocido',[Elemento^.Text]));
end;
1026: rememo.lines.Append(Format('Frame Size : %s',[Elemento^.Text]));
1027: rememo.lines.Append(Format('Profile : %s',[Elemento^.Text]));
1029: rememo.lines.Append(Format('Colorimetry : %s',[Elemento^.Text]));
1031: rememo.lines.Append(Format('Frame Struct : %s',[Elemento^.Text]));
1034: begin
rememo.lines.Append(Format('Field Order : %s',[Elemento1034^.Text]));
if (StrComp(Elemento1034^.Text,'Top') = 0 ) then
rbTop.checked := true
else if (StrComp(Elemento1034^.Text,'Bottom') = 0 ) then
rbBottom.Checked := true
else ShowMessage(Format('Field Order : %s desconocido',[Elemento1034^.Text]));
end;

1067..1074: begin
if not (StrComp(Elemento^.Text,'Empty') = 0 ) then begin
rememo.lines.Append(Format('Audio : %s',[Elemento^.Text]));
cbAudioBitRate.ItemIndex := cbAudioBitRate.Items.IndexOf(RightStr(Elemento^.Text,3));
cbAudioBitRate.Refresh;
cbAudioBitRate.OnChange(nil);
end;
end;
end;
end;

for i := 0 to (MiLista.Count - 1) do
begin
Elemento := MiLista.Items[i];
Dispose(Elemento);
Elemento := MiLista2.Items[i];
Dispose(Elemento);
end;
MiLIsta.Free;
MiLIsta2.Free;
end;


function TForm1.WinExecAndWait32(FileName:String; Visibility:integer; dir: String):integer;
var
zAppName:array[0..512] of char;
zCurDir:array[0..255] of char;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
exitCode: DWord;
begin
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);
FillChar(ProcessInfo, sizeof(TProcessInformation), 0);
FillChar(StartupInfo,Sizeof(TStartupInfo),0);
StartupInfo.cb := Sizeof(TStartupInfo);

StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := Visibility;
if CreateProcess(nil,
zAppName, { pointer to command line string }
nil, { pointer to process security attributes}
nil, { pointer to thread security attributes}
false, { handle inheritance flag }
CREATE_NEW_CONSOLE or { creation flags }
NORMAL_PRIORITY_CLASS,
nil, { pointer to new environment block }
Pchar(dir), { pointer to current directory name }
StartupInfo, { pointer to STARTUPINFO }
ProcessInfo) = False then
begin
with Application do
begin
NormalizeTopMosts;
MessageBox(PChar('No se ha podido iniciar: ' + #13#10 + Filename), 'Error', MB_OK);
RestoreTopMosts;
btnAbortar.Enabled := false;
Result := 0;
exit;
end;
end;
Application.BringToFront;
{Wait until execution finish}
Repeat
exitCode := WaitForSingleObject( ProcessInfo.hProcess, 2000);
Application.ProcessMessages;
Until ((exitCode <> WAIT_TIMEOUT ) or (CreatedD2v() = true));
Result:=exitcode;
MessageBeep(0);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess );
end;

function TForm1.CreatedD2v(): boolean;
var
f: file of Byte;
OldFileMode: Byte;
Size : LongInt;
begin
olDFileMode := FileMode;
AssignFile(f, Format('%s.d2v',[lblEditAvs.Text]));
FileMode := 0; {Set file access to read only }
Reset(f);
size := FileSize(f);
CloseFile(f);
FileMode := OldFileMode;
if D2vFileSize < Size then Result := False
else begin
Result := True;
reMemo.Lines.Append('');
rememo.Lines.Append(Format('Creado fichero %s%s.d2v con %d bytes',[ExtractFilePath(Application.ExeName),lblEditAvs.Text,D2vFileSize]));
reMemo.Lines.Append('');
informationHwnd := FindWindow(nil,'Information');
EnumChildWindows(informationHwnd, @EnumChildWindowsProc, LParam(MiLista));
PostMessage(GetParent(InformationHwnd),WM_KEYDOWN,VK_F5,0);
Sleep(5000);
PostMessage(GetParent(InformationHwnd),WM_KEYDOWN,VK_ESCAPE,0);
informationHwnd := FindWindow(nil,'Information');
EnumChildWindows(informationHwnd, @EnumChildWindowsProc, Lparam(MiLista2));
Abortar := True;
end;
D2vFileSize := Size;
end;

function EnumChildWindowsProc(Wnd: HWnd; Lista: TList): Bool; export;
{$ifdef Win32} stdcall; {$endif}
var
BufferText: array[0..99] of Char;
CtrlId : integer;
Elemento : PVentana;
begin

GetWindowText(Wnd, BufferText, 100);
if StrPas(BufferText) = '' then BufferText := 'Empty';
CtrlId := GetDlgCtrlId(Wnd);
New(Elemento);
Elemento^.CtrlHwnd := wnd;
Elemento^.CtrlId := CtrlId;
StrCopy(Elemento^.Text,BufferText);
Lista.Add(Elemento);
if GetWindow(Wnd, GW_CHILD) = 0 then
Enumchildwindows(Wnd, @EnumChildWindowsProc, 0);
Result := True;
end;

Amnon82
18th March 2006, 22:17
I'm working on a delphi-tool to parse d2v-files.

D2VParse (http://forum.doom9.org/showthread.php?t=108858)

I've only problem to find out if it is PFF or not.

bit 6

Progressive_Frame Flag (See notes below)
0 (Interlaced)
1 (Progressive)

Notes on Progressive_Frame Flag: This specifies that the picture is part of a frame (either a frame picture making up the entire frame, or a field picture making up one of the fields of the frame) whose fields are sampled at one moment. A RFF flag may be present however, such that the displayed frame after pulldown is interlaced.

d00 6 0 384035 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0

seems to me that it is interlaced + bff

d00 1 0 2048 1 1 92 b2 a2 b2 b2 a2 b2 b2 a2 b2 b2 a2

is progressive + tff

... but how I get the bit 6?

Rockas
18th March 2006, 22:34
... but how I get the bit 6?
now... there's a question I've been asking to my self many times before :) ... the only answer I found (in the top of my ignorance) was another question: "inside the mpeg file?" :D

Guest
19th March 2006, 02:13
There are bit operations in Delphi that you can use. Do you need help with that?

Amnon82
20th March 2006, 23:14
I think we will go on there (http://forum.doom9.org/showthread.php?t=108858) ;)

berrinam
13th April 2006, 22:09
Can DGIndex output the filenames of the files it has demuxed somewhere please? Say, stdout/stderr, if nothing else is appropriate.

Also, would it be possible to print the indexing status (amount complete) to stdout/stderr as well? It's not important, but it means other apps like MeGUI can find out where DGIndex is up to.

Thanks,

berrinam

dimzon
13th April 2006, 22:16
Can DGIndex output the filenames of the files it has demuxed somewhere please? Say, stdout/stderr, if nothing else is appropriate.
Or, maybe, even override output filenames


Also, would it be possible to print the indexing status (amount complete) to stdout/stderr as well? It's not important, but it means other apps like MeGUI can find out where DGIndex is up to.
MeGUI can read status using WM_GETTEXT Message (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_gettext.asp)

Amnon82
14th April 2006, 10:28
THX dimzon. I got (http://forum.doom9.org/showthread.php?t=109756) it already ;)

berrinam
5th May 2006, 07:04
Can DGIndex output the filenames of the files it has demuxed somewhere please? Say, stdout/stderr, if nothing else is appropriate.

Also, would it be possible to print the indexing status (amount complete) to stdout/stderr as well? It's not important, but it means other apps like MeGUI can find out where DGIndex is up to.

Thanks,

berrinam
@neuron2: Could you have a look at this please? I know I make a lot of feature request posts which are often ridiculous, but I do think that this is plausible, and such a feature would be really valuable to me.