First show effect diagram:
1, MPlayer Introduction
MPlayer is an open source multimedia player, released under the GNU General Public License. This software can be used in all major operating systems, such as Linux and other Unix-like systems, Windows and Mac OS x systems.
The MPlayer is based on the command line interface and can be installed in various operating systems with different graphical interfaces. Another big feature of MPlayer is the wide range of output device support. It works in X11, Xv, DGA, OpenGL, Svgalib, Fbdev, Aalib, DIRECTFB, and can use GGI and SDL and some low-level hardware-related drive modes such as Matrox, 3Dfx and Radeon, MACH64, PERMEDIA3). MPlayer also supports display via hardware MPEG decoder cards, such as DVB and DXR3 and hollywood+.
The development of MPlayer began in 2000. The original author was Arpad Gereoffy. MPlayer's initial name was "mplayer-the movie player for Linux", but later developers called it "mplayer-the movie player", The reason is that MPlayer is not only available for Linux but can be run on all platforms.
mplayer Download Address:Http://Jempson.7958.com/down_10948103.html
2. Principle of realization
There are two ways of writing GUI programs for MPlayer:
A, MPlayer source
This method needs to read MPlayer source, directly modify the code inside him, so that we do the interface can be integrated with the MPlayer (of course, you can also use the link mplayer any library and. O documentation, seamlessly integrate him into the program)
B. Using slave mode
The so-called slave mode, that is, mplayer in the process to receive the user Input command line, specifically support which command line, can be through the Mplayer-input cmdlist This command came, These commands are also explained in detail in the slave.txt of the MPlayer source code. The mplayer of working in slave mode can interact with the standard input and output of the system. We can use the Linux C programming to complete the mplayer of the slave mode work to control and information acquisition.
Using Aauto development, use scenario B.
3. Slave mode command
Slave mode commands are numerous, the main ones are the following (from the Documentation: Http://dd.ma/ffQiTkCK):
MPlayer pause:
Pause Pause/unpause the playback.
MPlayer Standard Time Output:
Get_time_pos Print out of the current position in the file in seconds, as float.
Get_time_length Print out the length of the current file in seconds.
Wait: Learn the full command, download the document: Http://dd.ma/ffQiTkCK
4. Aauto Code
Understanding the above principles, development or relatively simple. The main use of Process.popen, the exchange of data between pipelines. The first version of the code is as follows:
Import Win.ui;
Import Fsys.dlg;
Import Win.ui.menu;
Import Process.popen; /*dsg{{*/var WinForm =: Win.form (text= "player"; right=654;bottom=422;border= "None") Winform.add (video={cls= "Static"; Top=20;right=656;bottom
=424;ah=1;aw=1;bgcolor=0;db=1;dl=1;dr=1;dt=1;left=0;z=1};
)/*}}*/import web.layout; Import web.layout.behavior.windowsizer;//Support Drag border import web.layout.behavior.windowcommand;//support title bar button Wblayout =
Web.layout (WinForm) wblayout.go ("/layout/frmround.html")//Fillet window import win.util.round;
Win.util.round (WinForm); Create the Player:
Player = null; var openvideo = function (filepath) {if (.. Player! = null) {:
Player.process.kill (); ..
Player.close (); }
.. Player = Process.popen (Io.fullpath ("/mplayer/mplayer.exe"), "-vo Gl-identify-slave-noquiet-wid" + Winform.video.hwnd
+ "" + filepath); } winform.onclose = function (Hwnd,message,wparam,lparam) {if (.. Player! = null) {:
Player.process.kill (); ..
Player.close (); }} Winform.popmenu = Win.ui.popmenU (WinForm);//Create pop-up menu Winform.popmenu.add (' Open ', function (ID) {var filepath = Fsys.dlg.open ("All Files |*.*| |", "select File");
if (filepath!=null) {openvideo (filepath);
}
}
);
Winform.popmenu.add (' Exit ', function (ID) {winform.close ()}) Winform.wndproc = function (Hwnd,message,wparam,lparam) {
Select (message) {case 0x204/*_wm_rbuttondown*/{Winform.popmenu.popup (Win.getmessagepos (LParam));//Pop-up Menu}}
} winform.show () Win.loopmessage ();
return WinForm;
Source code Download Address: Http://dd.ma/Bf1PEARM