<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Am 21.11.2023 um 21:17 schrieb Bo
Berglund via lazarus:<br>
</div>
<blockquote type="cite"
cite="mid:9a3qlide3gmph1ac06cndp0o8shrigvhek@4ax.com">
<pre class="moz-quote-pre" wrap="">On Tue, 21 Nov 2023 19:29:58 +0100, Bo Berglund via lazarus
<a class="moz-txt-link-rfc2396E" href="mailto:lazarus@lists.lazarus-ide.org"><lazarus@lists.lazarus-ide.org></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">------------- 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;
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
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...</pre>
</blockquote>
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.<span
style="white-space: pre-wrap">
</span>
</body>
</html>