diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-30 00:19:34 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-30 00:19:34 +0100 |
commit | d856075f5f21a76266d47675a76aa4b762fd51aa (patch) | |
tree | 384902f83707bec0ea28817b65d4bd256004d939 /src/3rdparty/libvlc/fpg_vlc.pas | |
parent | 1ef066af3f4fbfb339264c6095a318564dfee0b9 (diff) | |
download | fpGUI-d856075f5f21a76266d47675a76aa4b762fd51aa.tar.xz |
Adds VLC video library header translation and Media Player component.
These are optional 3rd party components, because they will add extra
dependencies to your project. For that reason, they are not part of
the fpgui_toolkit package as standard.
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. + |