Problem using Video Creator tool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
emwamin
Newbie
Newbie
Posts: 4
Joined: Mon Sep 08, 2014 12:00 am

Problem using Video Creator tool

Post by emwamin » Mon Feb 23, 2015 5:58 pm

Hi

I am using the video creator tool but it crashes every time. I am trying to do it the same way as the demo in Tee9New (which works on my system) using a timer. I wonder what do I do wrong.

I am not rotating the plot like the example in Tee9New but programmatically moving a trackbar. Data Points having the same index as the trackbar position or less get a color (default color is background = Hidden points). The followings are the code:

Code: Select all

/////////////////////////////////////////////////////////////
procedure TMyForm.Timer1Timer(Sender: TObject);
begin
     if trackbar3.Position < trackbar3.Max then
        Begin
             trackbar3.Position := trackbar3.Position + 5;         // Timer trigger 5 times per second so each second 10 more point will become visible
             Application.ProcessMessages;
        end;


procedure TMyForm.btnStartAnimation(Sender: TObject);
var
     i,cnt  : Integer;
     delay : Double;  //MS
begin
     trackbar3.Position := 0;
     Application.ProcessMessages;

     timer1.Enabled := true;                                              //enabling the timer

     Video.StartRecording('c:\temp\test.avi');                    // Start recording
     while (trackbar3.Position < trackbar3.Max) do             // Wait until all point are plotted
        Begin
             Application.ProcessMessages;
             Sleep(500);
        end;
     timer1.Enabled := false;
     Video.StopRecording;                                               // Stop recording
end;


procedure TMyForm.TrackBar3Change(Sender)
begin
        // we change the background color here
end;
//////////////////////////////////////////////////////////////////////////////////
I have to add that my plot is OpenGL. As soon as I start the program I get an exception. The following is the trace for the function calls (last call at the top):


**********************************************************************************************
0048738c +000 VideoTest.exe Graphics TBitmap.GetHandleType
00487414 +008 VideoTest.exe Graphics TBitmap.GetPixelFormat
00488421 +011 VideoTest.exe Graphics TBitmap.SetPixelFormat
007b6e49 +02d VideoTest.exe TeeVideo TVideoTool.InitStreamFormat
007b6d04 +02c VideoTest.exe TeeVideo TVideoTool.AddFrame
007b6a9a +046 VideoTest.exe TeeVideo TVideoTool.ChartEvent
0067b166 +032 VideoTest.exe TeEngine TCustomAxisPanel.BroadcastToolEvent
0067bb27 +1f3 VideoTest.exe TeEngine TCustomAxisPanel.InternalDraw
0065a0e4 +11c VideoTest.exe TeeProcs InnerDraw
0065a199 +021 VideoTest.exe TeeProcs TCustomTeePanel.Draw
00659df9 +041 VideoTest.exe TeeProcs TCustomTeePanel.Draw
0065a265 +059 VideoTest.exe TeeProcs TCustomTeePanel.Paint
004defb7 +057 VideoTest.exe Controls TCustomControl.PaintWindow
004dadce +04e VideoTest.exe Controls TWinControl.PaintHandler
004db2fb +03f VideoTest.exe Controls TWinControl.WMPaint
004def50 +010 VideoTest.exe Controls TCustomControl.WMPaint
004d7bd8 +188 VideoTest.exe Controls TControl.WndProc
004dac37 +157 VideoTest.exe Controls TWinControl.WndProc
0065a84c +00c VideoTest.exe TeeProcs TCustomTeePanel.WndProc
004da8b4 +02c VideoTest.exe Controls TWinControl.MainWndProc
0047e9c8 +014 VideoTest.exe Classes StdWndProc
77440974 +016 user32.dll CallWindowProcW
77975c4b +02b ntdll.dll KiUserCallbackDispatcher
77438b77 +00a user32.dll DispatchMessageA
004f821f +083 VideoTest.exe Forms TApplication.ProcessMessage
004f823e +00a VideoTest.exe Forms TApplication.ProcessMessages
00a189e6 +032 VideoTest.exe MyForm 162 +5 TMyForm.Timer1Timer
**********************************************************************************************
Does the size of the plot make any difference?

Please advise how I can solve this problem.

I am using TeeChart version 2015.14.150120. My OS is Vista (32 bits) with service pack 2.

BR
emwamin

emwamin
Newbie
Newbie
Posts: 4
Joined: Mon Sep 08, 2014 12:00 am

Re: Problem using Video Creator tool

Post by emwamin » Mon Feb 23, 2015 6:00 pm

Hi

I have to add that I am using Delphi 7.

BR
emwamin

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem using Video Creator tool

Post by Yeray » Tue Feb 24, 2015 11:48 am

Hello,

I've made a simple test trying to do what you describe and it seems to work fine for me here.
Could you please take a look at the project attached and modify it so we can reproduce the problem here?
testVideo.zip
(2.25 KiB) Downloaded 441 times
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

emwamin
Newbie
Newbie
Posts: 4
Joined: Mon Sep 08, 2014 12:00 am

Re: Problem using Video Creator tool

Post by emwamin » Thu Feb 26, 2015 10:21 am

Hi

Thanks for the example program. It works on my computer. But as I mentioned I use OpenGL. If you activate openGL you get the same error as me.
Please see the modified example.

BR
emwamin
Attachments
testVideo.zip
modified example
(31.95 KiB) Downloaded 401 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem using Video Creator tool

Post by Yeray » Fri Feb 27, 2015 12:15 pm

Hello,

Excuse me, I missed the OpenGL part.
This is a know problem already in the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=175

I've just fixed it so the next maintenance release will include the modification.

If you want to modify the sources yourself, at TeeVideo.pas, include the TeeGLCanvas to the uses clause change TVideoTool.ChartEvent for this:

Code: Select all

procedure TVideoTool.ChartEvent(AEvent: TChartToolEvent);
var tmpBitmap: TBitmap;
begin
  inherited;

  if IsRecording and (AEvent=cteAfterDraw) then
  try
    if ParentChart.Canvas is TGLCanvas then
    begin
      tmpBitmap:=TBitmap.Create;
      (ParentChart.Canvas as TGLCanvas).BufferToBitmap(tmpBitmap, ParentChart.ChartBounds);
    end
    else
      tmpBitmap:=TTeeCanvas3D(ParentChart.Canvas).Bitmap;

    AddFrame(tmpBitmap);
  except
    on E:Exception do
    begin
      StopRecording;
      raise;
    end;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

emwamin
Newbie
Newbie
Posts: 4
Joined: Mon Sep 08, 2014 12:00 am

Re: Problem using Video Creator tool

Post by emwamin » Sat Feb 28, 2015 2:15 pm

Hi
I changed the source and compiled it but the problem remains.

Does the recompilation also install the changed modules? As far as I can see I am using the new DCU file.

BR
emwamin

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem using Video Creator tool

Post by Yeray » Mon Mar 02, 2015 2:42 pm

Hi emwamin,
emwamin wrote: I changed the source and compiled it but the problem remains.

Does the recompilation also install the changed modules? As far as I can see I am using the new DCU file.
Yes, TeeRecompile should compile the sources and install the, into the chosen IDE(s).

You can try temporally adding the "Sources" path on top of the IDE library path. This way, you'll be directly using the sources and you'll be able to debug on them.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem using Video Creator tool

Post by Yeray » Fri Mar 06, 2015 8:46 am

Hello,
Yeray wrote: If you want to modify the sources yourself, at TeeVideo.pas, include the TeeGLCanvas to the uses clause change TVideoTool.ChartEvent for this:
We've modified the fix to not use TeeGLCanvas unit. Now TVideoTool.ChartEvent looks like this:

Code: Select all

procedure TVideoTool.ChartEvent(AEvent: TChartToolEvent);
var tmpBitmap: TBitmap;
begin
  inherited;

  if IsRecording and (AEvent=cteAfterDraw) then
  try
    if ParentChart.Canvas.SupportsFullRotation then //OpenGL
    begin
      tmpBitmap:=TBitmap.Create;
      ParentChart.Canvas.RenderToBitmap(tmpBitmap, ParentChart.ChartBounds);
    end
    else
      tmpBitmap:=TTeeCanvas3D(ParentChart.Canvas).Bitmap;

    AddFrame(tmpBitmap);

    if ParentChart.Canvas.SupportsFullRotation then //OpenGL
      tmpBitmap.Free;
  except
    on E:Exception do
    begin
      StopRecording;
      raise;
    end;
  end;
end;
If you modified TeeVideo.pas adding TeeGLCanvas unit in the uses clause as indicated in the post above, don't forget to remove it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply