OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Greggory Shaw on August 06, 2013, 12:30:22 am

Title: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on August 06, 2013, 12:30:22 am
Could somebody please post the install script from the article on Os2World
detailing installation of mPlayer ! The old forum posts are gone.

Also, is there any way to add code to it that will deregister the OLD avi codecs
that come with Os2/eCS ???

Thank you to the person that wrote it !!!


Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Pete on August 06, 2013, 08:00:48 pm
Hi Greggory

I'm not sure who wrote the mplayer "how to" - I think it was collated from various posts on the subject. Was there an install script as well?

Here is what I remember from installing mplayer some time ago:-

1] Download mplayer - current version is http://hobbes.nmsu.edu/download/pub/os2/apps/mmedia/video/players/mplayer-1.1.1-4.4.6.zip

2] Download codecs - current version is http://www.mplayerhq.hu/MPlayer/releases/codecs/windows-essential-20071007.zip

3] unzip mplayer into a directory of your choice eg \programs\mplayer

4] unzip the codec package into a temporary directory then copy the unzipped files into a sub directory of mplayer eg \programs\mplayer\codecs

5] copy \mplayer\npmp.dll to the directory containing your Firefox/Seamonkey plugins - remove the old netscape plugin files to avoid possible problems

6] add required entries to config.sys file; I have the following:-

REM ***** mplayer variables
SET MPLAYER_PATH=J:\PROGRAMS\MULTIMEDIA\mplayer
SET MPLAYER_CODECS_DIR=J:\PROGRAMS\MULTIMEDIA\mplayer\codecs
SET MPLAYER_HOME=I:\users\peter\home\.mplayer

Obviously you will need to change Drive:\DirectoryPath to suit your system

Other options:
smplayer makes a good gui frontend for mplayer - see http://svn.netlabs.org/qtapps/wiki/QT4%20Multimedia
but requires the qt runtime support - see http://svn.netlabs.org/qt4/

I'm not sure about deregistering the old os2 codecs.

If you have eCS1.2 (? or was it 1.1) or later then the CWMM is installed on your system. Have a read of the [BootDrive]:\MMOS2\MEDIAFLD\DOC\mediafldr.inf to discover how to replace the default os2 avi and mpg players with smplayer.


I do not think that I have missed anything. If I have I hope someone else will add it to the above.

Regards

Pete
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Martin Iturbide on August 07, 2013, 01:27:48 am
Hi Greggory.

I recovered an old backup of the forum and it is available here:

http://www.os2world.com/oldforum/index.php?topic=994.msg24136#msg24136 (http://www.os2world.com/oldforum/index.php?topic=994.msg24136#msg24136)

Please notice that the old recovered forum is only for backup, is read only and does not have the attachments stored.

Regards
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on August 07, 2013, 03:10:51 am
Thank you Pete for all the info and Martin for the link !!!
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Martin Iturbide on August 07, 2013, 09:14:10 pm
Hi Greggory

I will also like to invite you to write some lines about MPlayer and OS/2 on the OS2World.com/wiki
It uses the same userid/password of this forum.

Regards
Martin
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on August 08, 2013, 07:38:55 am
Hi Greggory

I will also like to invite you to write some lines about MPlayer and OS/2 on the OS2World.com/wiki
It uses the same userid/password of this forum.

Regards
Martin

Sure after I add the code for MP3s codec and figure how to get rid of the old codecs !

Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 09, 2013, 12:30:10 pm
You may want to use this code and modify it to your needs, please do post you improvements to it here.
//Jan-Erik

Code: [Select]
/*  Install MPlayer */
'@echo off'

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

cfg.snap = 0
cfg.dive = 0
cfg.vman = 0
cfg.t23 = 0
cfg.uniaud = 0
cfg.noshare = 0
cfg.bufsize = 0

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.vman = ( pos( '/VMAN', translate( ARG(1) ) ) > 0 )
   if cfg.snap = 0 & cfg.vman = 0 then
      cfg.t23 = ( pos( '/T23', translate( ARG(1) ) ) > 0 )
   if cfg.snap = 0 & cfg.vman = 0  & cfg.t23 = 0 then
      cfg.dive = ( pos( '/DIVE', translate( ARG(1) ) ) > 0 )
   else cfg.dive = 0
end
cfg.vo = ( pos( '/VO', translate( ARG(1) ) ) > 0 )
cfg.dart = ( pos( '/DART', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 then
   cfg.uniaud = ( pos( '/UNIAUD', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 & cfg.uniaud = 0 then
   cfg.noshare = ( pos( '/NOSHARE', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 & cfg.uniaud = 0 & cfg.noshare = 0 then
   parse value translate( ARG(1) ) with .'/BUFSIZE'buf_size'/'.
if datatype( strip( buf_size ), 'W' ) then
   cfg.bufsize = strip( buf_size )

home_path = VALUE( 'HOME',, env )
if length( home_path ) = 0 then
    home_path = OSBootDrive()'\Apps'
   
if pos( '/I', translate( ARG(1) ) ) >  0 then
do
   parse value translate( ARG(1) ) with .'/I'programs_path'/'.
   programs_path = strip( programs_path )
end
if directory( programs_path ) = '' then
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
if stream( programs_path'\MPlayer\mplayer.exe', 'C', 'query exists' ) <> '' then
   programs_path = programs_path'\MPlayer' /* Change MPlayer by hand if you use another folder name */
else
do
   call SysFileTree programs_path'\*mplayer.exe', 'file', 'SFO'
   if file.0 > 0 then
       programs_path = strip( filespec( 'd', file.i )||filespec( 'p', file.i ), 't', '\' )
   else
   do
       say "Can't find MPlayer in the programs directory"
       drives = SysDriveMap( 'C:', 'USED' )
       do i = 1 to words( drives )
          call SysFileTree subword( drives, i )||'\*mplayer.exe', 'file', 'SFO'
          if file.0 > 0 then
          do
             programs_path = strip( filespec( 'd', file.i )||filespec( 'p', file.i ), 't', '\' )
             leave i
          end
       end
   end
end
if stream( programs_path'\mplayer.exe', 'C', 'query exists' ) = '' then
do
    say "Can't find MPlayer on your computer"
    return 1
end

'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,*.mp4,*.asf,*.matroska,*.fli,*.m4v,*.rm,*.ram'
rc = CreatePrgmObj()
exit rc

CreatePrgmObj: procedure expose prgm.
    setupstring = 'OBJECTID=<'prgm.objid'>;EXENAME='prgm.destpath'\'prgm.name';PROGTYPE=PM;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.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.vman then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use VMAN'
            call lineout ARG(1), 'vo=kva:vman'
        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.dart then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use DART'
            call lineout ARG(1), 'ao=kai:dart'
        end
        else if cfg.uniaud then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use UniAUD'
            call lineout ARG(1), 'ao=kai:uniaud'
        end
        else if cfg.noshare then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use DART No Share'
            call lineout ARG(1), 'ao=kai:noshare'
        end
        if cfg.bufsize then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use buffer size'
            call lineout ARG(1), 'ao=kai:bufsize'||cfg.bufsize
        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
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on August 10, 2013, 02:46:59 am
Exactly what I was looking for !  Thank you Jan-Erik !

I'm adding the options to install MP3 codec and dereg the old MMAVI classes.

Could you please post some examples of the install parameters for your script.


Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 15, 2013, 07:54:54 am
Hello,

You should specify the installation options as parameters to take advantage of the drivers that give the best experience/performance with your hardware. It would however be nice if you can come up with code how to automatically detect installed drivers and which one should take precedence.

//Jan-Erik

InstMPlayer <parameters>
VideoName
/WOWarp Overlay
/SNAPSNAP
/VMANVMan
/T23T23 Laptop
/DIVEDIrect Video Extension
/VOVideo Overlay Options
AudioName
/DARTDigital Audio Real Time
/UNIAUDUNIversal AUDio
/NOSHAREDon't share audio
/BUFSIZE 1234Use buffer size of 1234
/I D:\MyPrograms Tell the script where MPlayer has been unpacked

Note: The code expect MPLayer to be placed in a folder named "MPlayer" and if you specify the path it will install faster if you specify /I D:\MyPrograms instead of /I D:\MyPrograms\MPlayer.
Programs path search order query the environment variables for, PROGRAMS and MMBASE, but the code will fall back to search for MPLayer on the boot drive if MPlayer cant be found there.
It will search though every drive if that also fail, until it find mplayer.exe
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Silvan Scherrer on August 15, 2013, 09:20:33 am
btw you don't have to specify any options to vo=kva or ao=kai, as those libs automaticaly search your system and uses the best combination.

vo search order is: WO, SNAP, DIVE
ao search order is: UNIAUD, DART

regards
Silvan
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 15, 2013, 12:39:24 pm
UNIAUD doesn't work for me though I only have UNIAUD on 3 of 4 machines.

So I have to manually specify /DART to get sound that doesn't stutter or cause 100% CPU usage (eCS v2.2 installations).
/VMAN seem to be the best option for me regaring video for most machines, though one have a Matrox G400 graphics card.

Would WarpOverlay (WO) improve things?
Include it with eCS v2.2 by default!
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Andy Willis on August 15, 2013, 04:04:45 pm
Would WarpOverlay (WO) improve things?
Include it with eCS v2.2 by default!
At this point WO only works with some very old hardware (even compared to what SNAP supports) and the difference between WO and SNAP's overlay support is probably minimal.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Silvan Scherrer on August 15, 2013, 04:31:57 pm
UNIAUD doesn't work for me though I only have UNIAUD on 3 of 4 machines.

So I have to manually specify /DART to get sound that doesn't stutter or cause 100% CPU usage (eCS v2.2 installations).
/VMAN seem to be the best option for me regaring video for most machines, though one have a Matrox G400 graphics card.
as it's just a search order, it falls back to the next, if the former is not found.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 16, 2013, 08:02:51 am
UNIAUD doesn't work for me though I only have UNIAUD on 3 of 4 machines.

So I have to manually specify /DART to get sound that doesn't stutter or cause 100% CPU usage (eCS v2.2 installations).
/VMAN seem to be the best option for me regaring video for most machines, though one have a Matrox G400 graphics card.
as it's just a search order, it falls back to the next, if the former is not found.
Yes, but it use up all cpu and/or stutter if I install without any options ( have to force the mode /DART ). :-/
This is not specific to eCS v2.2, I've seen it for a long time.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Silvan Scherrer on August 16, 2013, 11:35:35 am
did you ever send a note about that to the mplayer porter? He did also the libkva and libkai
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 16, 2013, 11:59:37 am
ok, I'll do that...
Allow one to turn up the volume that UNIAUD produce (louder than a whisper)
The beta work with my Sony Vaio Laptop, but can only be controlled by the OS/2 Volume control and not the other UNIAud aware mixers nor MPLayer.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 26, 2013, 07:53:05 am
The problem seem to be within UNIAUD that has to be fixed there.

PCM Volume control not available with HD Audio.
Only a whisper forum the loud speakers even when volume has been set to max.

I have to test the problem with stall/CPU 100% as I can't reproduce it reliably.

//Jan-Erik
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Silvan Scherrer on August 26, 2013, 11:41:48 am
please post your unimix -list. usually some switches are wrong and needs to be adjusted
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 26, 2013, 12:46:29 pm
ok... I use the defaults.

UniAud #189 (http://svn.netlabs.org/uniaud/ticket/189)
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Silvan Scherrer on August 26, 2013, 02:48:55 pm
you need to enable the front speakers probably. please play with unimix, as noted in ticket 195
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on August 28, 2013, 03:37:39 pm
I moved the speakers to the front... and indeed the sound is louder than the whisper, though I still have to use max volume. Tweaking unimix settings as suggested didn't help though, just as I tried a few years ago.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on September 05, 2013, 12:44:58 pm
I added the option to install the MP3 codec and the ability to remove the MMAVI class to the script.

 Is there any more use of this class MMAVI ?

And is there a way to restore MMAVI if needed ?


Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on September 06, 2013, 02:02:10 pm
Nice!
Please do post your code here Greggory.

I wouldn't mind if there where an Icon for program object. perhaps embedded within the script code?!
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on December 06, 2013, 01:25:42 pm
Nice!
Please do post your code here Greggory.

I wouldn't mind if there where an Icon for program object. perhaps embedded within the script code?!

Thanks Jan-Erik for all the code !

One thing though - what's the easiest way to add specify a specific directory from the user and pass it to your code ( Nevermind I got it). From inside the the program and NOT using the /I option from the command line.  Keep in mind that I just started on Rexx.

But drag & drop install, backup old install, add MP3, and de-register MMAVI are all done, just hung up on that one thing.

I could I send you my changes by email to look over ? The forum said it was to long to post here, I guess I could break it into two parts.

Thanks Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on December 06, 2013, 01:36:29 pm
Hi Greggory

I will also like to invite you to write some lines about MPlayer and OS/2 on the OS2World.com/wiki
It uses the same userid/password of this forum.

Regards
Martin

Sure, I'm about finished !

Drag & Drop install with backup, add MP3 codec and de-register old MMAVI class so mPlayer is the default player now !

Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Jan-Erik Lärka on December 07, 2013, 11:38:24 am
Hello,

I'm sure I'm not the only one that would like to see it!
Post or send it any way you like. A link here would be nice as well.
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on December 07, 2013, 12:59:23 pm
Hello,

I'm sure I'm not the only one that would like to see it!
Post or send it any way you like. A link here would be nice as well.

NOTE: I just realized i posted the wrong version that doesn't have the advance install but that does not affect anything.


You must create a program object for this CMD file /w parameters %*%**N for drag & drop to work as intended  (This is not the whole package).

- now any mPlayer zip file dropped on the program obj is automatically installed in the x:\programs\mplayer directory.

- advanced install allow you to choose where

- a backup is made of the original install if present.

- allows you to de-register the old worthless MMAVI class so mplayer becomes the default player.

- allows you to add the MP3 codec to your system.


Here is the first half, the forum wouldn't let post the entire listing. Keep in mind that that I have little experience in Rexx and the main work is from Jan-Erik.

Thanks

Greggory


Code: [Select]
/*.  */

call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs

SIGNAL ON SYNTAX
SIGNAL ON HALT

Parse arg String var1 var2

Date = '12.06.2013'
Version='004'
FileName = var1
Location = String

cfg.snap = 0
cfg.dive = 0
cfg.vman = 0
cfg.t23 = 0
cfg.uniaud = 0
cfg.noshare = 0
cfg.bufsize = 0

Currentdir = Directory()
ProgramsDir = VALUE('PROGRAMS',,'OS2ENVIRONMENT')


/***********************************************************************
 * ATTENTION - For the DEFAULT option:                                 *
 *                                                                     *
 * In some cases this script may not find the right default path!      *
 *                                                                     *
 *     mPlayerDir = x:\Programs\mPlayer                                *
 *                                                                     *
 ***********************************************************************/

mPlayerDir =  ProgramsDir || '\MPLAYER'

BootDrive = GetOS2BootDrive()


CALL ColorPage
CALL Banner

theSelect=getSelection()

SELECT
  WHEN theSelect=1 THEN DO
SAY ""
call InstallmPlayer
        Exit 0;
  END
  WHEN theSelect=2 THEN DO
SAY ""
call Dereg
        Exit 0;
  END
  WHEN theSelect=3 THEN DO
SAY ""
call AddCodecMP3
        Exit 0;
  END
  WHEN theSelect=4 THEN DO
SAY ""
        call mPlayerAdv
  END
OTHERWISE
NOP
END

Exit 0;



getSelection: PROCEDURE

QUIT=0
SAY "Select option:"
SAY ""
SAY "    1: Install mPlayer to Boot Partition"
SAY ""
SAY "    2: De-register MMAVI multmedia class"
SAY "    3: Add the MP3 codec to the system."
SAY ""
SAY "    ('h' for help)"
SAY "    ('q' for exit)"
SAY ""
Do UNTIL QUIT=1
  say '>'
  parse value SysCurPos() with aktzeile aktspalte
  newposition=SysCurPos(aktzeile-1,2)
  pull theChar
  IF theChar='H' then call mPlayerHelp
  IF theChar='Q' then EXIT 1
  if LENGTH(theChar)==1 & VERIFY(theChar, "1234")==0 THEN QUIT=1
  ELSE
   call beep 100, 100
  call SysCurPos aktzeile-1, 0
  SAY "1B"x || "[K"
  call SysCurPos aktzeile-1, 0
END
  SAY ""
RETURN theChar


/***********************************************************************

 Install or Update Os2/eCS default mPlayer installations

 ***********************************************************************/


InstallmPlayer:

NewVer = FileName
parse var NewVer FileName "-" .

CALL mBanner

IF stream( programs_path'\MPlayer\mplayer.exe', 'C', 'query exists' ) <> ''
  THEN
      DO   
        CALL BackupMplayer
        CALL DeleteMplayer
      END

address cmd 'unzip -o ' || Location || ' -d ' || mPlayerDir;

RunDir = CurrentDir
Dir = mPlayerDir || '\' || Filename ;

CALL mPlayerConfig

say ''
say color.green || 'Updated the default ' || FileName || ' installation on your desktop...' || color.gray;
pause

RETURN


mPlayerAdv:

NewVer = FileName
parse var NewVer FileName "-" .


CALL AdvInstBanner
CALL DeleteMplayer

address cmd 'unzip -o ' || String || ' -d ' || mPlayerDir ;


RETURN


/***********************************************************************/


/***********************************************************************/


BackupMplayer:

CALL DeleteBackup

Copy_Cmd = mPlayerDir || ' ' || mPlayerDir || '-BAK\ /S /E'
XCOPY Copy_Cmd

CALL SysPutEA mPlayerDir || '-BAK', '.LONGNAME', ''

RETURN


DeleteBackup:

fDir = ProgramsDir || '\' || FileName || '-BAK'

/* We only care about the fully qualified path names and in subfolders as well,
 *  so use "O" option to drop dates, times, attribs, etc.
 */
    rtc = SysFileTree( STRIP( fDir, 'T', '\' )||"\*", "filelist", "SFO" )

/* Create worker loops */
    Do A = 1 to filelist.0    /* Loop through file list using count in stem base */
        rtc = SysFileDelete( filelist.A )                         /* delete file */
    End

RETURN


DeleteMplayer:

fDir = mPlayerDir


/* Create Match list of do-not-deletes, upper case! */
    NoDel.1='MPLAYER.EXE'
    NoDel.2='MENCODER.EXE'
    NoDel.3='CODECS'

    NoDel.0=3              /* Set stem array length */

              /* List files and delete each of them */


/* Read directory and all sub-directories and create file list in stem array filelist,
 *  take care of possible trailing back slash.
 */

/* We only care about the fully qualified path names and in subfolders as well,
 *  so use "O" option to drop dates, times, attribs, etc.
 */
    rtc = SysFileTree( STRIP( fDir, 'T', '\' )||"\*", "filelist", "SFO" )

/* Create worker loops */
    Do A = 1 to filelist.0          /* Loop through file list using count in stem base */
        Do B = 1 to NoDel.0                    /* Compare to each value in NoDel array */
            If Pos( NoDel.B, Translate( filelist.A ) ) > 0 Then   /* found a match - using upper case to ensure proper matching */
            Iterate A /* Jump to the next file in the list and don't process this one! */
        End
        rtc = SysFileDelete( filelist.A )                               /* delete file */


        /* Add programming code here to check error codes if wanted - for instance cant delete because locked file */
        /* If rtc = 0 Then Say FileSpec( filelist.A, 'N' ) 'deleted' */
    End
PAUSE

RETURN


/***********************************************************************/


/***********************************************************************/




ColorPage:

/***********************************************************************
   Set some colors, thanx to Dmitry A.Steklenev for the inspiration    *
   enable ANSI extended screen and keyboard control                    *
                                                                       */

'@ansi on > nul'
color.brown   = "1B"x"[0;33m"
color.red     = "1B"x"[1;31m"
color.green   = "1B"x"[1;32m"
color.yellow  = "1B"x"[1;33m"
color.blue    = "1B"x"[1;34m"
color.magenta = "1B"x"[1;35m"
color.cyan    = "1B"x"[1;36m"
color.white   = "1B"x"[1;37m"
color.gray    = "1B"x"[0m"

RETURN


Banner:

/***********************************************************************
   Startup Message                                                     *
                                                                       */

say color.gray  || 'Thank you for using '|| color.magenta || 'mPlayerDD' ||,
color.gray || ', an automated tool for Os2/eCs.'
say color.cyan || 'Version ' || Version || color.gray || ' -- ' || Date
say ''
say color.gray || 'This Program is released under the Gnu Public Licence',
|| '(GPL).'
say 'See the file COPYING for further information.'
say color.gray  || 'Copyright (c) 2011 by '|| color.white ||,
'Greggory Shaw'
say ''
say color.gray  || 'Default option will install or upgrade the default ' || color.green  || 'mPlayer' || color.gray || ' installation'
say '(as defined by SET PROGRAMS=' || color.green || mPlayerDir || color.gray || ') on your eCS system.'
say ''
say 'Use the advance option to specify the install locations.'
say ''

RETURN


mBanner:

/***********************************************************************
   Default Option Message                                              *
                                                                       */
cls
say ''
say color.green || 'Default Option:' || color.gray
say ''
say color.gray  || 'This option automatically installs' color.green || FileName || color.gray || ' to the'
say "default location " || color.green || mPlayerDir || color.gray ||' set by eCS.'
say ''
say 'A backup of the original will be create in ' || color.green || mPlayerDir || '-BAK' || color.gray
say ''
say 'Is this the correct default path ?'
say ''
say color.green || ProgramsDir || '\' || FileName || color.gray

   key = SysGetKey()
   parse upper var key key
   if key <> 'Y' then call DontInstall

RETURN


AdvInstBanner:

/***********************************************************************
   Advanced Option Message                                             *
                                                                       */
cls
say ''
say color.green || 'Advanced Option:' || color.gray
say ''
say 'Please enter the installation directory for ' || FileName || '.'
say ''
say 'If installing to root do not use the backslash (\),'
say 'use this format (E:)'
say ''
say '----------------------------------------------------'

PARSE PULL mPlayerDir

cls
say ''
say 'Is this the correct path ?'
say ''
say color.green ||mPlayerDir || color.gray
say ''
say 'y/n?'
say ''

key = SysGetKey()
parse upper var key key
if key <> 'Y' then call DontInstall

say ''
say ''
say 'If you are installing to a existing ' || FileName || ' directory'
say 'would you like to create a backup of your current installation?'
say ''
say color.green ||mPlayerDir || color.gray

fDir = mPlayerDir || '\' || FileName || '-BAK'

key = SysGetKey('NOECHO')
parse upper var key key
if key == 'Y' then call BackupMplayer

RETURN


mHelp:

/***********************************************************************
   Help Message                                                        *
                                                                       */

CLS
say ''
SAY color.green || 'Default install option:' || color.gray
say ''
say ''
pause

CLS
say ''
say color.green || 'Advanced install option:' || color.gray
say ''
say ''
pause

CLS
say ''
say ''
pause
CLS

RETURN


/***********************************************************************/


/***********************************************************************/




mPlayerConfig:

/***********************************************************************
   Install mPlayer to the x:\PROGRAMS directory                        *
                                                                       */

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.vman = ( pos( '/VMAN', translate( ARG(1) ) ) > 0 )
   if cfg.snap = 0 & cfg.vman = 0 then
      cfg.t23 = ( pos( '/T23', translate( ARG(1) ) ) > 0 )
   if cfg.snap = 0 & cfg.vman = 0  & cfg.t23 = 0 then
      cfg.dive = ( pos( '/DIVE', translate( ARG(1) ) ) > 0 )
   else cfg.dive = 0
end
cfg.vo = ( pos( '/VO', translate( ARG(1) ) ) > 0 )
cfg.dart = ( pos( '/DART', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 then
   cfg.uniaud = ( pos( '/UNIAUD', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 & cfg.uniaud = 0 then
   cfg.noshare = ( pos( '/NOSHARE', translate( ARG(1) ) ) > 0 )
if cfg.dart = 0 & cfg.uniaud = 0 & cfg.noshare = 0 then
   parse value translate( ARG(1) ) with .'/BUFSIZE'buf_size'/'.
if datatype( strip( buf_size ), 'W' ) then
   cfg.bufsize = strip( buf_size )

home_path = VALUE( 'HOME',, env )
if length( home_path ) = 0 then
    home_path = OSBootDrive()'\Apps'
   
if pos( '/I', translate( ARG(1) ) ) >  0 then
do
   parse value translate( ARG(1) ) with .'/I'programs_path'/'.
   programs_path = strip( programs_path )
end
if directory( programs_path ) = '' then
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
if stream( programs_path'\MPlayer\mplayer.exe', 'C', 'query exists' ) <> '' then
   programs_path = programs_path'\MPlayer' /* Change MPlayer by hand if you use another folder name */
else
do
   call SysFileTree programs_path'\*mplayer.exe', 'file', 'SFO'
   if file.0 > 0 then
       programs_path = strip( filespec( 'd', file.i )||filespec( 'p', file.i ), 't', '\' )
   else
   do
       say "Can't find MPlayer in the programs directory"
       drives = SysDriveMap( 'C:', 'USED' )
       do i = 1 to words( drives )
          call SysFileTree subword( drives, i )||'\*mplayer.exe', 'file', 'SFO'
          if file.0 > 0 then
          do
             programs_path = strip( filespec( 'd', file.i )||filespec( 'p', file.i ), 't', '\' )
             leave i
          end
       end
   end
end
if stream( programs_path'\mplayer.exe', 'C', 'query exists' ) = '' then
do
    say "Can't find MPlayer on your computer"
    return 1
end

'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 = 'Video.ico'
prgm.wpname = 'MPlayer'
prgm.wpdest = ''
prgm.params = '"%**P\%**F"'
prgm.assocfilter = '*.mpg,*.avi,*.wmv,*.mov,*.divx,*.flv,*.mpeg,*.vob,*.mp4,*.asf,*.mkv,*.matroska,*.fli,*.m4v,*.rm,*.ram'
rc = CreatePrgmObj()
exit rc

CreatePrgmObj: procedure expose prgm.
    setupstring = 'OBJECTID=<'prgm.objid'>;EXENAME='prgm.destpath'\'prgm.name';PROGTYPE=PM;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), '# Write your default config options here!'
        call lineout ARG(1), 'ao=kai:dart'
        call lineout ARG(1), ''
        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.vman then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use VMAN'
            call lineout ARG(1), 'vo=kva:vman'
        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.dart then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use DART'
            call lineout ARG(1), 'ao=kai:dart'
        end
        else if cfg.uniaud then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use UniAUD'
            call lineout ARG(1), 'ao=kai:uniaud'
        end
        else if cfg.noshare then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use DART No Share'
            call lineout ARG(1), 'ao=kai:noshare'
        end
        if cfg.bufsize then
        do
            call lineout ARG(1), ''
            call lineout ARG(1), '# Force mPlayer to use buffer size'
            call lineout ARG(1), 'ao=kai:bufsize'||cfg.bufsize
        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

/* End of part one */


Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on December 07, 2013, 01:10:27 pm
Here's the second half.

Code: [Select]



Dereg:

/***********************************************************************
   De-register MMAVI classes                                           *
                                                                       */
cls
say 'Option - De-register the MMAVI class'
say ''
say ''
say color.red ||'*** Warning *** -- You are about to de-register a WPS class.' || color.gray
say ''
say 'The MMAVI class is very old and out of date. I have never had problems'
say 'deleting MMAVI, however be sure to have a backup before proceeding.'
say ''
say 'This will allow mPlayer to become the first play option for AVI files.'
say ''
say 'Y/n?'
say ''

key = SysGetKey()
parse upper var key key
if key <> 'Y' then call DontInstall

    Call SysDeregisterObjectClass("MMAVI")
Return


AddCodecMP3:

/***********************************************************************
   Register MP3 codecs                                                 *
                                                                       */

cls
say 'Option - Add the MP3 codec to Os2/eCs'
say ''
say 'Y/n?'
say ''

key = SysGetKey()
parse upper var key key
if key <> 'Y' then call DontInstall

progPath = CurrentDir
progName = "install_MP3.cmd"

/* code sequence to call another CMD file from within an CMD file     */

  cmdLine = progPath || '\' || progName
  "cmd /c " cmdLine
                        /* "RC" contains the return code              */
  if rc <> 0 & rc <> "RC" then
    say "Error: The program ends with RC = " || rc

pause;

RETURN



/***********************************************************************
   Query the bootdrive                                                 *
                                                                       */
GetOS2BootDrive: PROCEDURE expose (exposeList)

                    /* install a local error handler                   */
  signal on Syntax name GetOS2BootDrive1

  boot_drive = ''
  boot_drive = SysBootDrive()

GetOS2BootDrive1:
                    /* if SysBootDrive() failed, boot_drive is still   */
                    /* empty                                           */
                    /* SysBootDrive() is only in the newer versions    */
                    /* of REXXUTIL!                                    */

  if boot_drive = '' then
  do
                    /* You should do further tests to ensure that      */
                    /* the result of this method is correct!           */

    parse upper value VALUE( "PATH",, prog.__env ) with "\OS2\SYSTEM" -2,
                        boot_drive +2
  end                                       /* if boot_drive = '' then */

return boot_drive


DontInstall:

say ''
say ''
say color.red || 'Installation was canceled.'  || color.gray;
pause;

EXIT 0;


SYNTAX:
 SAY 'SYNTAX ERROR:' errortext( rc ) 'in:'
 SAY sourceline( sigl )
 'pause'
 EXIT
 RETURN

HALT:
 SAY 'HALT occurred in:'
 SAY sourceline( sigl )
 'pause'
 EXIT
 RETURN
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on April 01, 2014, 07:33:04 pm
Hi Greggory

I will also like to invite you to write some lines about MPlayer and OS/2 on the OS2World.com/wiki
It uses the same userid/password of this forum.

Regards
Martin


I'm going to be offline for about a week, but I'll write something up during that time. I just finished an install script for mplayer, mp3 codec and remove the old MMAVI codecs !

Greggory
Title: Re: mPlayer install script & add dereg of old avi codecs ???
Post by: Greggory Shaw on July 11, 2014, 01:57:02 am
Upadated Media Pack & Drag & Drop Install script for Mplayer/2 !

Updated to v.008 - http://www.os2notes.com/os2mplayer.html

Need help improving this please !

Media Pack started as a Rexx install script for mPlayer, now it has the ablity to install mPlayer/2 by Drag & Drop. The ability to install the MP3 codec and remove the old MMAVI class has also been added to the script.

With the MMAVI class gone Mplayer becomes the default player for AVI files, no more right clicks just to play.  :D


Cheers

Greggory