Forum > Audio and Video

MPlayer Component, suitable for Linux and Windows

(1/4) > >>

six1:
The MPlayer Component from Mattias Gaertner now also works for Lazarus/Windows Combination.

I needed a Cross Component for playing videos on a x86 X-System and also on x86 Microsoft Windows, so i decieded to push up the great working Component from Mattias.

New is the Property "MPlayerPath". For X-System leave it blank ( Player1.MPlayerPath :=''; ) but on a Microsoft Windows System, you have to fill it with a valid Path to mplayer.exe installation.
Also new is the Property "StartParam". This is for starting mplayer with special arguments like "-zoom".

Sample for Setup the Player:
  {$IFDEF Linux}
   MPlayerControl1.MPlayerPath:='';
   MPlayerControl1.StartParam:='-vo x11 -zoom -fs';
  {$else $IFDEF Windows}
   // Download MPlayer generic for Windows and save under Programm Folder Directory
   // http://sourceforge.net/projects/mplayer-win32/
   //Download MPlayer WIN32-Generic
   MPlayerControl1.MPlayerPath:=extractfilepath(application.exename)+'MPlayer/mplayer.exe' ;
   MPlayerControl1.StartParam:='-zoom -fs';
  {$endif}

Download MPlayer generic for Windows: http://sourceforge.net/projects/mplayer-win32/





Edit 2024/02:
Do to Problems with LAZ Versions >=2.2 on Linux , MplayerComponent was patched on Lazarus CCR
https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/mplayer/
Thanks to wp_xyz!



Hope, it will be usefull.
Best regards, Michael

mattias:
I did  a few improvements: I fixed the default file name under Linux, less hints, better error handling and better quoting the file name.

Mike.Cornflake:
The mplayer package now supports reading of video file properties and has all the usual events and methods you'd expect from a video player control.

A page on the wiki has been created: http://wiki.lazarus.freepascal.org/TMPlayerControl  (I've been meaning to add a usage notes section, but haven't got around to it and I'm out of time for now).

Recent changes have been tested on Windows 7/8 quite extensively, and, well, lightly under Linux.

Frame Capture under Windows seems to work best with the Direct3D renderer (TMPlayer1.StartParam := '-vo direct3d'), but under Linux (where you have to use '-vo x11') seems hit and miss...

The package also has a new demo that implements a fairly comprehensive video player (it's even got wheel mouse scroll for controlled stepping through the video (back or forth in 1/3 second increments), I work with underwater inspection video, wheel mouse scroll is very useful in this area).  See examples\FullFeatured\mplayerTestHarness.lpr

Kamau:

--- Quote from: six1 on March 24, 2014, 08:37:32 pm ---Hope, it will be usefull.
Best regards, Michael

--- End quote ---

Very good! Thank you for this information.

/Kamau

jipété:
Hi,

--- Quote from: six1 on March 24, 2014, 08:37:32 pm ---The MPlayer Component from Mattias Gaertner now also works for Lazarus/Windows Combination.

--- End quote ---
Not now, Mattias...

I've searched the internet for MPlayer coz' I have many old Delphi working sources using TMPlayer and PlaySound, and I wanted to convert these programs to Linux (Debian 11.5 64 bits with the last Lazarus) and I've found that topic.

But...
I downloaded the files from the 4th link of the first post (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/mplayer/)
I installed MPlayerCtrl, with a problem in MPlayerCtrl.pas... : "Wrong number of parameters" here (line 835) :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    WidgetInfo := GetWidgetInfo(NewWidget,true); // destroyed in MPLayerWidgetDestroyCBSo I commented out that line and added another one :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    WidgetInfo := GetWidgetInfo(NewWidget); // jpt
Restarted install = OK but now, the new line causes SIGSEGV with the example found in http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/mplayer/
img_sigsegv

mouse on LCLObject displays the following :
img_mouseon

So I tried the following : reboot computer, start Lazarus, create a new application, open Multimedia tab and double-click on the TMPlayer icon, a component is drawn on form, ok, so F9 and ACCESS VIOLATION at line 837 of MPlayerCtrl.pas...

And if I try to move up the Multimedia tab from ide menu / Tools / Options / Components' Palette, when I close the Options dialog, ide crashes.
img_crash_lazarus

In 3rd post I read

--- Quote from: Mike.Cornflake on July 16, 2014, 09:03:11 pm ---See examples\FullFeatured\mplayerTestHarness.lpr

--- End quote ---
Nothing like that in my computer (Debian 11.5, FPC 3.2.2, Laz 2.2.4)...

Dunno what to do now...

Thanks for help

PS : i run under X/gtk2, as required by the ReadMe.

PPS out of topic : how to insert images in text ?

Navigation

[0] Message Index

[#] Next page

Go to full version