diff options
Diffstat (limited to 'src/3rdparty/libvlc/fpg_vlc.pas')
-rw-r--r-- | src/3rdparty/libvlc/fpg_vlc.pas | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/3rdparty/libvlc/fpg_vlc.pas b/src/3rdparty/libvlc/fpg_vlc.pas new file mode 100644 index 00000000..0eb8daba --- /dev/null +++ b/src/3rdparty/libvlc/fpg_vlc.pas @@ -0,0 +1,81 @@ +unit fpg_vlc; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, libvlc, vlc, fpg_main; + +Type + + { TFpgVLCPlayer } + + TFpgVLCPlayer = Class(TVLCMediaPlayer) + private + FParentWindow: TfpgWindow; + procedure SetParentWindowControl(AValue: TfpgWindow); + Protected + Procedure SetParentWindow; override; + Procedure SetParentWindowSize(AWidth,AHeight : Cardinal); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + Published + Property ParentWindow : TfpgWindow Read FParentWindow Write SetParentWindowControl; + end; + +implementation + +{ TFpgVLCPlayer } + +procedure TFpgVLCPlayer.SetParentWindowControl(AValue: TfpgWindow); +begin + if FParentWindow=AValue then Exit; + If Assigned(FParentWindow) then + FParentWindow.RemoveFreeNotification(Self); + FParentWindow:=AValue; + If Assigned(FParentWindow) then + FParentWindow.FreeNotification(Self); +end; + +procedure TFpgVLCPlayer.SetParentWindow; + +begin + if Assigned(ParentWindow) then + begin + {$IFDEF UNIX} + libvlc_media_player_set_xwindow(Instance, ParentWindow.WinHandle); + {$ENDIF} + {$IFDEF MSWINDOWS} + libvlc_media_player_set_hwnd(Instance, Pointer(ParentWindow.WinHandle)); + {$ENDIF} + end + else if HaveInstance then + begin + {$IFDEF UNIX} + libvlc_media_player_set_xwindow(Instance, 0); + {$ENDIF} + {$IFDEF MSWINDOWS} + libvlc_media_player_set_hwnd(Instance, Nil); + {$ENDIF} + end +end; + +procedure TFpgVLCPlayer.SetParentWindowSize(AWidth, AHeight: Cardinal); +begin + If Assigned(ParentWindow) then + begin + ParentWindow.Width:=AWidth; + ParentWindow.Height:=AHeight; + end; +end; + +procedure TFpgVLCPlayer.Notification(AComponent: TComponent; + Operation: TOperation); +begin + Inherited; + if (Operation=opRemove) and (AComponent=FParentWindow) then + FParentWindow:=Nil; +end; + +end. + |