Page 1 of 1

Display red line on RTSP stream

Posted: 05 May 2021 13:13
by woolfik
Hello,

I need write red line in the middle of TPanel where is displaying RTSP stream. I have add new component to my application (TPaintBox) and draw over canvas but method:
libvlc_media_player_play(vlcMediaPlayer);
overrite this red line.

Can You help me?

Code: Select all

procedure TkbSDVLCLib.Play(const pRTSPAddr: PAnsiChar; const pDisplay: THandle; const pRec: boolean); var vname: string; begin if (Assigned(vlcMediaPlayer) and (libvlc_media_player_is_playing(vlcMediaPlayer) = 1)) then exit; vlcMedia := libvlc_media_new_location(vlcInstance, pRTSPAddr); vlcMediaPlayer := libvlc_media_player_new_from_media(vlcMedia); if pRec then begin FRTSPAddr := pRTSPAddr; FDisplay := pDisplay; vTimer.Interval := FRecordTimeInMiliseconds; vTimer.Enabled := true; vname :=FPath+'\'+ DateTimeToStr(Now,FS) + '_'+FName + '.mp4'; FFileList.Add(vName); libvlc_media_add_option(vlcMedia,PAnsiChar(AnsiString(':sout=#duplicate{dst=display,dst=std{access=file,mux=mp4,dst="'+vname +'"}}'))); end; libvlc_media_release(vlcMedia); libvlc_media_player_set_hwnd(vlcMediaPlayer, Pointer(pDisplay)); libvlc_media_player_play(vlcMediaPlayer); end;
and drawing on canvas code:

Code: Select all

pbLine.Canvas.Pen.Color := clRed; pbLine.Canvas.MoveTo(0,round(pbLine.Height/2)); pbLine.Canvas.LineTo(pbLine.Width,Round(pbLine.Height/2));

Re: Display red line on RTSP stream

Posted: 10 May 2021 04:10
by mfkl
Not sure what GUI toolkit you are using, but I'd try adding a control over the one that holds the HWND libvlc is using to draw on.

Re: Display red line on RTSP stream

Posted: 11 May 2021 08:25
by woolfik
Can't do it because libvlc create a new window and dock this new window in my control. So everything I put on my control (TPanel or TForm or everything that has HWND) is under this new libvlc window. Now I make this red line by adding some logo but it doesn't work when the control has a small size.