[Lazarus] PasLibVLC based video player does not run on Linux...

Werner Pamler werner.pamler at freenet.de
Wed Nov 22 10:41:11 CET 2023


Am 21.11.2023 um 21:17 schrieb Bo Berglund via lazarus:
> On Tue, 21 Nov 2023 19:29:58 +0100, Bo Berglund via lazarus
> <lazarus at lists.lazarus-ide.org>  wrote:
>
>> ------------- Set video speed -----------------------
>> To set the speed this is what I use in my code:
>>   
>> procedure TfrmMain.btnFFClick(Sender: TObject);
>> begin
>>   vlcPlayer.SetPlayRate(speSpeed.Value);
>> end;
>>
>> It goes here:
>>
>> procedure TPasLibVlcPlayer.SetPlayRate(rate: Integer);
>> begin
>>   if (p_mi = NIL) then exit;
>>   if (rate < 1) then exit;
>>   if (rate > 1000) then exit;
>>   libvlc_media_player_set_rate(p_mi, rate / 100);
>> end;
>>
>> And it winds up here:
>>
>> (**
>> * Set movie play rate
>> *
>> * param p_mi the Media Player
>> * param rate movie play rate to set
>> * return  -1 if an error was detected, 0 otherwise (but even then, it might
>> * not actually work depending on the underlying media protocol)
>> *)
>>
>> var
>>   libvlc_media_player_set_rate : function(
>>     p_mi : libvlc_media_player_t_ptr;
>>     rate : Single // float
>>   ) : Integer; cdecl;
> Now I have searched in the test application tha uses the Lazarus lclvlc package
> and found this hidden inside the vlc.pp unit
>
>
> procedure TCustomVLCMediaPlayer.SetPlayRate(Avalue : Integer);
> begin
>    if Assigned(FInstance) then
>      begin
>      if (Avalue< 1) then
>         AValue:=1
>      else if (AValue>1000) then
>        AValue:=1000;
>      libvlc_media_player_set_rate(FInstance,AValue/100);
>      end;
> end;
>
> So there is such a function inside but how can I use it in my top level code?
> I tried like this:
>
> procedure TfrmMainVlc.btnSpeedClick(Sender: TObject);
> var
>    VideoSpeed: integer;
> begin
>    VideoSpeed := speVideoSpeed.Value;
>    Fplayer.SetPlayRate(VideoSpeed);
> end;
>
> But it generates an error:
> "identifier idents no member "SetPlayRate"
>
> So I tried to trace it further and found it in unit vlc:
>
>    TCustomVLCMediaPlayer = Class(TComponent)
>    private
>     ...
>     procedure SetPlayRate(AValue: Integer);
>     ...
>
> So how can I get to use this function? I.e. how to publish it (it is private
> now)?
>
> If I trace it down to implementation it looks like this:
>
> procedure TCustomVLCMediaPlayer.SetPlayRate(Avalue : Integer);
> begin
>    if Assigned(FInstance) then
>      begin
>      if (Avalue< 1) then
>         AValue:=1
>      else if (AValue>1000) then
>        AValue:=1000;
>      libvlc_media_player_set_rate(FInstance,AValue/100);
>      end;
> end;
>
> So all is there but not accessible for me...
Private methods GetSomething and SetSomething usually are getters and 
setter for a property "Something". Looking at vlc.pp I can see that the 
methods GetPlayRate and SetPlayRate do exist, but a property "PlayRate" 
has not been defined. Just forgotten? Post a feature request to the fpc 
bugtracker to create this property.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20231122/dc6c598e/attachment-0001.htm>


More information about the lazarus mailing list