Recent

Author Topic: [SOLVED] Window SDL2 Drop Files  (Read 6994 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: [SOLVED] Window SDL2 Drop Files
« Reply #30 on: April 25, 2023, 04:35:41 pm »
This is how the player works, Via dialogox opens the movie. As for FormDropFiles() it works but only on the form outside the movie display window.


metis

  • Sr. Member
  • ****
  • Posts: 300
Re: [SOLVED] Window SDL2 Drop Files
« Reply #31 on: April 26, 2023, 01:40:59 pm »
If I got you right, the Player works, but the SDL-Window is not captured by the Player's MainForm.

Well, the Parent for the SDL-Window is set in 'uexplayer.pas' at Line #5257:
"FWindow:= SDL_CreateWindowFrom({%H-}Pointer(self.Handle));"

And, this is the ProgramFlow for it:
procedure Tmp_main.FormCreate(Sender: TObject);
-> FPlayer:=TEXPlayer.Create(self);
     -> procedure TCustomEXPlayer.DoCreateSDLWindow;
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: [SOLVED] Window SDL2 Drop Files
« Reply #32 on: April 26, 2023, 04:16:39 pm »
Yes, when I drop a file on the lcl form it works, as in the sdl window it doesn't.
I changed FPlayer:=TEXPlayer.Create(self);

It still doesn't work


Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   FPlayer := TEXPlayer.Create(Self);
  4.   with FPlayer do
  5.     begin
  6.         Align := alClient;
  7.         OnProgress := @Self.UpdateProgress;
  8.         Parent := Self;
  9.     end;
  10. end;          
  11.  
Code: Pascal  [Select][+][-]
  1. procedure TCustomEXPlayer.DoCreateSDLWindow;
  2. var aURL: String;
  3. begin
  4.   if FWindow <> nil then Exit;
  5.   FWindow := SDL_CreateWindowFrom(Pointer(Self.Handle));
  6. end;
  7.  

If I comment out the contents of the procedure TCustomEXPlayer.DoCreateSDLWindow then dropping files works but does not display the image



« Last Edit: April 26, 2023, 09:31:30 pm by Pe3s »

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: [SOLVED] Window SDL2 Drop Files
« Reply #33 on: April 27, 2023, 03:20:36 pm »
Quote
when I drop a file on the lcl form it works, as in the sdl window it doesn't.
Of course not.
When the PlayerComponent is created (= FPlayer:=TEXPlayer.Create(self)), it fills the entire MainForm (= Align:=alClient).

Unlike FFPlay4Laz, Somby's PlayerComponent has no SDL-Code for UserInputs (Keys, Mouse, Touch), nor for DropFiles.
Therefore DropFiles cannot be done via the SDL-Window; it will only work with the MainForm, via ...

Code: [Select]
procedure Tmp_main.DoOpenUrl(url: string);
begin
  if FOpenUrl then exit;
  try
   FOpenUrl:=true;
   url:=trim(url);
   if FPlayer.Playing and (url=FPlayer.Url) then exit; // es hat sich nichts geändert
   FPlayer.Stop;
   FPlayer.url:=url;
   if FPlayer.Url='' then exit;
   Application.ProcessMessages;
   Play;
  finally
   FOpenUrl:=false;

  end;
end;

If You still want DropFiles, when the Player is running, You may ...
• leave some Space in the MainForm, where You can drop Files on
• drop them on an other Form, e.g. the NavigatorForm
• add the DropFiles-Code for the SDL-Window into Somby's PlayerComponent by Yourself or
• ask Somby to do so.
« Last Edit: April 27, 2023, 05:23:01 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: [SOLVED] Window SDL2 Drop Files
« Reply #34 on: April 27, 2023, 05:04:45 pm »
Thanks for your patience and informative discussions :)


metis

  • Sr. Member
  • ****
  • Posts: 300
Re: [SOLVED] Window SDL2 Drop Files
« Reply #35 on: April 27, 2023, 05:25:16 pm »
You're welcome. :)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018