• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Install MPlayer

Started by jep, 2008.04.30, 16:05:41

Previous topic - Next topic

jep

Marked as: Advanced
Hello,

This is a rexx script to configure mplayer, note that you have to unpack mplayer (to %PROGRAMS%\Mplayer ) and the codecs (to %PROGRAMS%\Mplayer\Codecs ) to make this script work all the way as there's no check that the files exist.

I have left out the part to make changes to config.sys, you have to do that by hand if you want or modify the script. If you modify the script, please post it here so other people can see it as well.

Note that the code hasn't been tested much in it present state. Use with caution!!!
Please do post corrections if you see something that you think is wrong or can be changed.

Params:
/WO force Warp Overlay (Possible?)
/DIVE force DiVE
/VO Video Overlay

See "HOW TO: Installing Streaming Audio and Video Support in Firefox/Seamonkey" ( http://www.os2world.com/content/view/17999/1/ ) for more information.

//Jan-Erik

***Corrected some problems I found***

/*  Install MPlayer ( and enable plugin for Firefox in the future) */
'@echo off'

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

env = 'ENVIRONMENT'
cfg.wo = ( pos( '/WO', translate( ARG(1) ) ) > 0 )
cfg.dive = ( pos( '/DIVE', translate( ARG(1) ) ) > 0 )
cfg.vo = ( pos( '/VO', translate( ARG(1) ) ) > 0 )

home_path = VALUE( 'HOME',, env )
if length( home_path ) = 0 then
    home_path = OSBootDrive()'\Apps'
   
programs_path = VALUE( 'PROGRAMS',, env )
if length( programs_path ) = 0 then
    programs_path = VALUE( 'MMBASE',, env )
if length( programs_path ) = 0 then
    programs_path = OSBootDrive()

programs_path = programs_path'\MPlayer'

'SET MPLAYER_HOME='home_path'\.mplayer'
'SET MPLAYER_CODECS_DIR='programs_path'\Codecs'
'SET MPLAYER_PATH='programs_path'\mplayer.exe'

if ChkCreatePath( programs_path ) = 0 then
    say 'Installation Directory for MPlayer is ready'
else do
    say "Couldn't create Installation directory"
    Exit -1
end

if ChkCreatePath( VALUE( 'MPLAYER_CODECS_DIR',, env ) ) = 0 then
    say 'Directory to store MPlayer Codecs is ready'
else say 'Codec directory not available'

mplayer_home = VALUE( 'MPLAYER_HOME',, env )
if ChkCreatePath( mplayer_home ) = 0 then
do
    say 'Directory to store MPlayer configuration prepared'
    call WriteCfg mplayer_home'\config'
    call WriteInput mplayer_home'\input.conf'
    say 'Configuration written'
end
else do
    say "Couldn't create directory for MPlayer configuration,"
    say "will use standard settings instead..."
end

prgm.destpath = programs_path
prgm.name = 'mplayer.exe'
prgm.objid = 'MPPLAYER'
prgm.icon = 'Mplayer.ico'
prgm.wpname = 'MPlayer'
prgm.wpdest = '<MMPM2_FOLDER>'
prgm.params = '"%**P\%**F"'
prgm.assocfilter = '*.mpg,*.avi,*.wmv,*.mov,*.divx,*.flv,*.mpeg,*.vob'
rc = CreatePrgmObj()
exit rc

CreatePrgmObj: procedure expose prgm.
    setupstring = 'OBJECTID=<'prgm.objid'>;EXENAME='prgm.destpath'\'prgm.name';PARAMETERS='prgm.params';ASSOCFILTER='prgm.assocfilter';ICONFILE='prgm.icon';'

/*Create program in folder and attach icon*/
    rc = SysCreateObject( 'WPProgram', prgm.wpname, prgm.wpdest, setupstring, 'U' )
    if rc then
        say prgm.wpname' has been successfully installed'
    else
        say  prgm.wpname' failed installation'
Return rc
   
WriteCfg: procedure expose cfg.
    retval = stream( ARG(1), 'C', 'QUERY EXIST' )
    if retval <> '' then '@DEL 'ARG(1)' /F'
    if stream( ARG(1), 'C', 'OPEN WRITE' ) = 'READY:' then
    do
        call lineout ARG(1), '# Settings for stream/file caching'
        call lineout ARG(1), 'cache=12288'
        call lineout ARG(1), 'cache-min=30'
        call lineout ARG(1), ''
        call lineout ARG(1), '# Setting for Browser User Agent response'
        call lineout ARG(1), 'user-agent=NSPlayer/4.1.0.3856'
        if cfg.wo then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use WarpOverlay'
            call lineout ARG(1), 'vo=kva:wo'
        end
        else if cfg.dive then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use DIVE'
            call lineout ARG(1), 'vo=kva:dive'
        end
        if cfg.vo then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Video Overlay Options and VIO Message Window Options'
            call lineout ARG(1), 'really-quiet=yes'
            call lineout ARG(1), 'fixed-vo=yes'
            call lineout ARG(1), 'colorkey=0x000001'
        end
        call stream ARG(1), 'C', 'CLOSE'
    end
Return 0
   
WriteInput: procedure expose cfg.
    retval = stream( ARG(1), 'C', 'QUERY EXIST' )
    if retval <> '' then '@DEL 'ARG(1)' /F'
    if stream( ARG(1), 'C', 'OPEN WRITE' ) = 'READY:' then
    do
        call lineout ARG(1), '# Settings for User Control of mPlayer playback'
        call lineout ARG(1), 'MOUSE_BTN2 vo_fullscreen'
        call lineout ARG(1), 'PGUP pt_step -1'
        call lineout ARG(1), 'PGDWN pt_step 1'
        call lineout ARG(1), '+ volume 5'
        call lineout ARG(1), '- volume -5'
        call stream ARG(1), 'C', 'CLOSE'
    end
Return 0
   
OSBootDrive: procedure
    BootDrive = substr( value( 'RUNWORKPLACE' ,, 'ENVIRONMENT' ), 1, 2 )

    if BootDrive = '' then
        BootDrive = substr( value( 'COMSPEC' ,, 'ENVIRONMENT' ), 1, 2 )

    if length( BootDrive ) = 0 then
        BootDrive = 'C:'
Return BootDrive
   
ChkCreatePath: procedure
    rc = ( directory( ARG(1) ) = '' )
    if rc = 1 then
        call ChkCreatePath strip( filespec( 'D', ARG(1) )||filespec( 'P', ARG(1) ), 'T', '\' )
    if rc = 1 then
        '@mkdir 'ARG(1)
Return rc

Pete

Hi Jan-Erik

I have not tried your script but it looks like it could be useful - especially for those of us reluctant to try configuring "ported from *nix" software ourselves.

Could I suggest that you offer it to KO Myung-Hun, mplayer porter, for possible inclusion with the next mplayer package? His email is in the mplayer docs.

He may also have ideas for extending and/or fine tuning the script.

Regards

Pete


jep

Just sent the message...

//Jan-Erik

OriAl

I am a know-little, so I appreciate all the help everyone provides.  I am trying to install mplayer.  I have unzipped it to g:\mplayer, and unzipped the win codecs.  I have saved the rex file to disk, and named it mplayer.rex in g:\mplayer.  Is that okay?  I haven't edited config.sys yet - is the rex file run before or afetr, and how is it run?

What files does mplayer display, and how do I set up MPC to view them?  If I missed any of this in the how to file, please let me know and I'll look harder.  I havee a concentration problem, so doing and learning things is difficult for me.

Thanks for providing the app, the instructions, and the help.

RobertM

Hi OriAI,

The REXX file can be run by typing it's name from the commandline of the directory you copied it to. I believe though, that OS/2 requires it to be named with a .cmd extension instead of a .rex extension - so if it does not run, change the extension.

Follow the instructions below to run the script properly to set the correct parameters, or check out the "How To" topic - or both...

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|


jep

#5
Marked as: Advanced
Hello,

I've modified the code some more so you can't specify both WarpOverlay, SNAP and DIVE at the same time.
I've also added the param "/i" so that you can use if you want to specify where you've unzipped MPlayer, note that you must place it in a folder called MPlayer though, or modify the script below.

If you don't use that param it'll assume you've placed in the programs folder, if that's not present, in the multimedia folder (usually mmos2) and if that's not present either, directly under the boot drive.
1) C:\Programs\MPlayer
2) C:\MMOS2\Mplayer
3) C:\Mplayer

The line:
    if retval <> '' then '@DEL "'ARG(1)'" /N'
enable you to run the script as many times as you want because it'll delete config and input.conf if they're present and rewrite them.

the function ChkCreatePath
call itself recursively to check and create the folder structure needed.

//Jan-Erik

/* Install MPlayer */
'@echo off'

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

env = 'ENVIRONMENT'
cfg.wo = ( pos( '/WO', translate( ARG(1) ) ) > 0 )
if cfg.wo = 0 then
do
   cfg.snap = ( pos( '/SNAP', translate( ARG(1) ) ) > 0 )
   if cfg.snap = 0 then
      cfg.dive = ( pos( '/DIVE', translate( ARG(1) ) ) > 0 )
   else cfg.dive = 0
end
else do
  cfg.snap = 0
  cfg.dive = 0
end
cfg.vo = ( pos( '/VO', translate( ARG(1) ) ) > 0 )

home_path = VALUE( 'HOME',, env )
if length( home_path ) = 0 then
    home_path = OSBootDrive()'\OS2'

if pos( '/I', translate( ARG(1) ) ) >  0 then
do
   parse value translate( ARG(1) ) with .'/I'programs_path'/'.
   programs_path = strip( programs_path )
end
else
do
   programs_path = VALUE( 'PROGRAMS',, env )
   if length( programs_path ) = 0 then
      programs_path = VALUE( 'MMBASE',, env )
   if length( programs_path ) = 0 then
      programs_path = OSBootDrive()
end
programs_path = programs_path'\MPlayer' /* Change MPlayer by hand if you use another folder name */

'SET MPLAYER_HOME='home_path'\.mplayer'
'SET MPLAYER_CODECS_DIR='programs_path'\Codecs'
'SET MPLAYER_PATH='programs_path'\mplayer.exe'

if ChkCreatePath( programs_path ) = 0 then
    say 'Installation Directory for MPlayer is ready'
else do
    say "Couldn't create Installation directory"
    Exit -1
end

if ChkCreatePath( VALUE( 'MPLAYER_CODECS_DIR',, env ) ) = 0 then
    say 'Directory to store MPlayer Codecs is ready'
else say 'Codec directory not available'

mplayer_home = VALUE( 'MPLAYER_HOME',, env )
if ChkCreatePath( mplayer_home ) = 0 then
do
    say 'Directory to store MPlayer configuration prepared'
    call WriteCfg mplayer_home'\config'
    call WriteInput mplayer_home'\input.conf'
    say 'Configuration written'
end
else do
    say "Couldn't create directory for MPlayer configuration,"
    say "will use standard settings instead..."
end

prgm.destpath = programs_path
prgm.name = 'mplayer.exe'
prgm.objid = 'MPPLAYER'
prgm.icon = 'Mplayer.ico'
prgm.wpname = 'MPlayer'
prgm.wpdest = '<MMPM2_FOLDER>'
prgm.params = '"%**P\%**F"'
prgm.assocfilter = '*.mpg,*.avi,*.wmv,*.mov,*.divx,*.flv,*.mpeg,*.vob'
rc = CreatePrgmObj()
exit rc

CreatePrgmObj: procedure expose prgm.
    setupstring = 'OBJECTID=<'prgm.objid'>;EXENAME='prgm.destpath'\'prgm.name';PARAMETERS='prgm.params';ASSOCFILTER='prgm.assocfilter';ICONFILE='prgm.icon';'

/*Create program in folder and attach icon*/
    rc = SysCreateObject( 'WPProgram', prgm.wpname, prgm.wpdest, setupstring, 'U' )
    if rc then
        say prgm.wpname' has been successfully installed'
    else
        say  prgm.wpname' failed installation'
Return rc
   
WriteCfg: procedure expose cfg.
    retval = stream( ARG(1), 'C', 'QUERY EXIST' )
    if retval <> '' then '@DEL "'ARG(1)'" /N'
    if stream( ARG(1), 'C', 'OPEN WRITE' ) = 'READY:' then
    do
        call lineout ARG(1), '# Settings for stream/file caching'
        call lineout ARG(1), 'cache=12288'
        call lineout ARG(1), 'cache-min=30'
        call lineout ARG(1), ''
        call lineout ARG(1), '# Setting for Browser User Agent response'
        call lineout ARG(1), 'user-agent=NSPlayer/4.1.0.3856'
        if cfg.wo then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force MPlayer to use WarpOverlay'
            call lineout ARG(1), 'vo=kva:wo'
        end
        else if cfg.snap then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force MPlayer to use SNAP'
            call lineout ARG(1), 'vo=kva:snap'
        end
        else if cfg.dive then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force MPlayer to use DIVE'
            call lineout ARG(1), 'vo=kva:dive'
        end
        if cfg.vo then
        do
            call lineout ARG(1), ''
/* Line wrap adjusted on next row */
            call lineout ARG(1), '# Video Overlay Options and VIO Message Window Options'
            call lineout ARG(1), 'really-quiet=yes'
            call lineout ARG(1), 'fixed-vo=yes'
            call lineout ARG(1), 'colorkey=0x000001'
        end
        call stream ARG(1), 'C', 'CLOSE'
    end
Return 0
   
WriteInput: procedure expose cfg.
    retval = stream( ARG(1), 'C', 'QUERY EXIST' )
    if retval <> '' then '@DEL "'ARG(1)'" /N'
    if stream( ARG(1), 'C', 'OPEN WRITE' ) = 'READY:' then
    do
        call lineout ARG(1), '# Settings for User Control of MPlayer playback'
        call lineout ARG(1), 'MOUSE_BTN2 vo_fullscreen'
        call lineout ARG(1), 'PGUP pt_step -1'
        call lineout ARG(1), 'PGDWN pt_step 1'
        call lineout ARG(1), '+ volume 5'
        call lineout ARG(1), '- volume -5'
        call stream ARG(1), 'C', 'CLOSE'
    end
Return 0
   
OSBootDrive: procedure
    BootDrive = substr( value( 'RUNWORKPLACE' ,, 'ENVIRONMENT' ), 1, 2 )

    if BootDrive = '' then
        BootDrive = substr( value( 'COMSPEC' ,, 'ENVIRONMENT' ), 1, 2 )

    if length( BootDrive ) = 0 then
        BootDrive = 'C:'
Return BootDrive
   
ChkCreatePath: procedure
    rc = ( directory( ARG(1) ) = '' )
    if rc = 1 then
        call ChkCreatePath strip( filespec( 'D', ARG(1) )||filespec( 'P', ARG(1) ), 'T', '\' )
    if rc = 1 then
        '@mkdir 'ARG(1)
Return rc

Updated due to line break...
Another update due to line break...

jep

Hello OriAl,

1) If you try my "new and improved" code save it to a file called InstMplayer.cmd directly on C: if possible.
2) Start a command prompt/window
3) Type
                 instmplayer /I G: /SNAP /VO
4) Done!

if you accidentally type something wrong, missed a parameter or want to try WarpOverlay instead of SNAP, just rerun the command with the parameters you want to use. It'll erase the previous configuration and replace them with the new ones.
WarpOverlay:                 instmplayer /I G: /WO /VO
DIVE:                              instmplayer /I G: /DIVE /VO

The script associate files that you can watch in MPlayer such as AVI, MPG, WMV, DIV, MOV etc. but some formats may have other players set as default that take precedence.

You may want to add 3 lines to config.sys by hand afterward, see the discussion about the proper way to set:
SET MPLAYER_HOME=%HOME%\.mplayer
SET MPLAYER_CODECS_DIR=%PROGRAMS%\Codecs
SET MPLAYER_PATH=%PROGRAMS%\mplayer.exe

//Jan-Erik

Quote from: OriAl on 2008.05.01, 23:13:53
I am a know-little, so I appreciate all the help everyone provides.  I am trying to install mplayer.  I have unzipped it to g:\mplayer, and unzipped the win codecs.  I have saved the rex file to disk, and named it mplayer.rex in g:\mplayer.  Is that okay?  I haven't edited config.sys yet - is the rex file run before or afetr, and how is it run?

What files does mplayer display, and how do I set up MPC to view them?  If I missed any of this in the how to file, please let me know and I'll look harder.  I havee a concentration problem, so doing and learning things is difficult for me.

Thanks for providing the app, the instructions, and the help.

OriAl

I set my config.sys entries for G:\mplayer, g:\mplayer\codecs, and g:\mplayer\mplayer.exe.

I haven't run your .cmd yet.

OriAl

I tried runnng your .cmd, but I get nothing but errors.  How can I save the output to a file for you?

jep

Hello OriAl,

Yes, please do send me the output to me.

//Jan-Eik

OriAl

Here's the output.  Mplayer is in g:\mplayer, codecs in g:\mplayr\codecs.

*******

[C:\]

[C:\]/*  Install MPlayer ( and enable plugin for Firefox in the future) */

[C:\]'@echo off'
[C:\]

[C:\]call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'

[C:\]call SysLoadFuncs
[C:\]

[C:\]env = 'ENVIRONMENT'

[C:\]cfg.wo = ( pos( '/WO', translate( ARG(1) ) )  ) 1>0

[C:\]cfg.dive = ( pos( '/DIVE', translate( ARG(1) ) )  ) 1>0

[C:\]cfg.vo = ( pos( '/VO', translate( ARG(1) ) )  ) 1>0
[C:\]

[C:\]home_path = VALUE( 'HOME',, env )

[C:\]if length( home_path ) = 0 then


jep

Hello OriAl,

open the command-file and add the line:
/**/
on the first row, save and run again.

You probably didn't mark the first row in the code as you copied it to a file.
Rexx scripts need the comment to enter "rexx interpreter mode", otherwise it'll just run it similar to a bat file, without rexx.

//Jan-Erik

OriAl

I'm sorry I haven't gotten back with  you - health issues.

The error message I now get when I run instmplayer  is:

REX0006: Error 6 running C:\instmplayer.cmd, line 104: Unmatched "/*" or quote

ddan

To jep and OriAl:
Line 41 surely isn't right?:
'SET MPLAYER_HOME='home_path'\.mplayer'
                       delete the period ^
Or is my knowledge of command line dot-iness less than perfect?

I got the same 'Unmatched "/*" or quote' error as OriAl. Believe it is caused
by line-wrapping when pasting into file (with "copy con"), because went
through and matched all 218 single quotes, and comments too; came out fine,
then the program ran when I tried it again, reporting:

Installation Directory for MPlayer is ready
Directory to store MPlayer Codecs is ready
Directory to store MPlayer configuration prepared
Configuration written
MPlayer has been successfully installed

OR it's "previous run initialized the variable that you didn't" behavior that
I _BELIEVE_ REXX is prone to. In any case, the script seemed to work for me on
second run, with the one edit mentioned above...

BUT then mplayer complained (besides not running after brief blank screen):
MPlayer dev-SVN-rUNKNOWN-3.3.5 (C) 2000-2007 MPlayer Team
CPU: AMD Duron(tm)  (Family: 6, Model: 8, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
The cache option can't be used in a config file.
Error parsing option cache=12288 at line 2
Warning unknown option cache-min at line 3

Commenting out the above lines in your code resulted in MPlayer running,
but without sound. (And after running these from a command line to be sure
were set:
SET MPLAYER_HOME=C:\OS2\MPLAYER
SET MPLAYER_CODECS_DIR=C:\MPLAYER\CODECS
SET MPLAYER_PATH=C\MPLAYER\MPLAYER.EXE)

THEN, I deleted the two config files that your script makes, and I got video
too, plus a LOT of text in the calling window, mostly like:
A:  65.2 V:  65.2 A-V:  0.0022 ct: -0.022 904/904  4%  3%  0.2% 150 0
Is that normal? My experience with MPlayer is nearly 30 seconds at this
instant. Minimizing the calling window seemed to free up the CPU.

By the way, in copying text to an OS/2 window or to a DOS word processor, I
frequently get duplicated characters, not obviously the same one or same
place, except that it seems to particularly like doubling slashes. This is new
to me in plain Warp 4 and now in WSEB. Old problem? Unique to me? Anyone know
of a cure for it?

ddan

Need to clarify the above that I UNWRAPPED in the script a few lines that had wrapped. Couldn't tell whether was my cranky DOS WP, or in the original paste using "copy con".