Author Topic: How do I change this default behaviour?  (Read 18068 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
How do I change this default behaviour?
« on: November 27, 2021, 08:44:49 pm »
So I've got a bunch of AVI and MPG video files: family get-togethers, various car events, etc. My box currently insist on always opening the AVI and MPG stuff using the ancient default OS/2 AVI player. How the heck do I change that?

Before you say "adjust the associations", well they already have been. All of these media files are pointing to mplayer as the default, and yet each time I double-click on a AVI file the default viewer plays.

So I'm thinking that's because the 'Current class' is defined as MMAVI for the the AVI files and MMMPG for the MPG files. Meanwhile the MP4 stuff is simply showing up as XFldDataFile (which is to be expected given my XWP install).

Do I need to un-register a particular class?

Take a look at what currently shows up under 'Codecs' TAB of the Multimedia object (see attachment).

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4977
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: How do I change this default behaviour?
« Reply #1 on: November 28, 2021, 04:05:34 am »
Hi Dariusz.

I don't think it is good to deregister any class for what you want to do?

When you right click over the AVI or MPG file, and select "Open as", which options do you see?

Do you want to take a look at my notes here, maybe it can give you some hints.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Pete

  • Hero Member
  • *****
  • Posts: 1338
  • Karma: +10/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #2 on: November 28, 2021, 07:29:18 am »
Hi Dariusz

The cwmm MediaFolder help file - usually at [BootDrive]:\MMOS2\MEDIAFLD\DOC\mediafldr.inf provides an answer if using smplayer or vlc. See the section Hidden Features, Replace AVI Player as an example. Not sure if it can be tweaked to use mplayer without a frontend though...


Regards

Pete





mauro

  • Sr. Member
  • ****
  • Posts: 415
  • Karma: +3/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #3 on: November 28, 2021, 02:01:57 pm »
Hi Dariusz, I had simply changed the default application for opening my media files using Assoedit (see images).

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #4 on: November 28, 2021, 06:18:42 pm »
Hi Martin,
I don't think it is good to deregister any class for what you want to do?

When you right click over the AVI or MPG file, and select "Open as", which options do you see?...

I agree, I do not want to de-register any classes, unless there is a single AVI/MPG specific class that will NOT impact anything else. By the looks of it so far, these both appear to be default OS/2 multimedia classes though, and for that reason I think it's best that I do not touch them.

Take a look at the attached screenshot for what "Open as" looks like. Basically all my other video apps show, along with the default OS/2 ones.

I can certainly force each AVI file to open using mplayer, but that requires me to open it's Settings and specifically select mplayer, as opposed to relying on normal OS/2 associations.

Regarding the "Associations Set Up" docs...very nice!!! I am aware of all of these options and have already tried them, but that's a great write-up for anyone that's not had the chance to work through these in the past.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #5 on: November 28, 2021, 06:21:37 pm »
Hi Pete!

...The cwmm MediaFolder help file - usually at [BootDrive]:\MMOS2\MEDIAFLD\DOC\mediafldr.inf provides an answer if using smplayer or vlc. See the section Hidden Features, Replace AVI Player as an example. Not sure if it can be tweaked to use mplayer without a frontend though...

Ahh, so these are the Chris W's MM classes I think, which I do not have installed on my machine, so that option is not currently available. Not to say I won't pursue it, just that it's not the setup I have deployed at the moment.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #6 on: November 28, 2021, 06:23:21 pm »
Hi mauro,
Hi Dariusz, I had simply changed the default application for opening my media files using Assoedit (see images).

Yeah, I thought that doing this should take precedence over anything else, but in my case that is not the outcome. I suspect it is because of the MM file classes, but that's a standard OS/2 MM install and I figured basically everyone else out there would be impacted by this, unless I have of course installed something else in the past that I have simply forgotten about since then!

Lars

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +70/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #7 on: November 29, 2021, 10:44:13 am »
The MM classes do make an attempt to define some "default" behaviour when you double click a file for the file type/file extension they are responsible for. I have not looked at the MM classes but I'd expect that they just do a MCI_PLAY command on the MM device that is associated with that file type/extension as a default. The CW MM classes might have implemented a smarter approach (looks like it).
Anyway, the "default" MM device for some given file type/file extension is defined through MMPM2.INI. And unfortunately, that "device" has to be an MCI device which essentially boils down to being a DLL with a defined entry point and command support. Certainly not any arbitrary EXE file. It would be possible to "wrap" invocation of an EXE file as a MCI device but this has to be implemented...
« Last Edit: November 29, 2021, 10:46:12 am by Lars »

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #8 on: November 29, 2021, 04:34:11 pm »
Hi Lars,

...Anyway, the "default" MM device for some given file type/file extension is defined through MMPM2.INI. And unfortunately, that "device" has to be an MCI device which essentially boils down to being a DLL with a defined entry point and command support. Certainly not any arbitrary EXE file. It would be possible to "wrap" invocation of an EXE file as a MCI device but this has to be implemented...

OK, good pointer. I found the following sections in MMPM2.INI file:

Code: [Select]
...
[IBMDIGVIDPLAYER01]
 VERSIONNUMBER=1.2
 PRODUCTINFO=Software Motion Video
 MCDDRIVER=SVMC
 MCDTABLE=MDM
 RESOURCENAME=VIDEO PLAYER01
 DEVICEFLAG=1
 DEVICETYPE=12
 SHARETYPE=3
 RESOURCEUNITS=10
 RESOURCECLASSES=2,10,1
 CONNECTORS=1,3,,1
 EXTNAMES=5,AVI,FLC,FLI,MOV,QT
 EATYPES=Digital Video
 ALIASNAME=DigitalVideo Player
...
[IBMMPEGPLAYER01]
 VERSIONNUMBER=1.2
 PRODUCTINFO=OpenMPEG Video
 MCDDRIVER=DVMC
 MCDTABLE=MDM
 RESOURCENAME=OpenMPEG01
 DEVICEFLAG=1
 DEVICETYPE=12
 SHARETYPE=3
 RESOURCEUNITS=10
 RESOURCECLASSES=2,10,1
 CONNECTORS=1,3,,1
 EXTNAMES=7,MPG,VBS,DAT,M2P,CDI,M2T,M1T
 ALIASNAME=OpenMPEG Video 2
...

...therefore, the 'Digitalvideo' definition (see below section) clearly points to the above 'Software Motion Video' and 'OpenMPEG Video' as the providers of that playback functionality (at least as best as I can interpret this).

Further on, the following is defined in the 'Drivers' section:

Code: [Select]
[Drivers]
 Digitalvideo=IBMDIGVIDPLAYER01,IBMMPEGPLAYER01
 Speaker=SPEAKER
 Headphone=HEADPHONE
 Microphone=MICROPHONE
 Filter=IBMFILTER01,IBMFILTER02,IBMFILTER03
 CDaudio=IBMCDAUDIO01
 Waveaudio=UNIAUDWAVE01
 Ampmix=UNIAUDAMPMIX01,UNIFMAMPMIX01
 Sequencer=UNIAUDFM01

Therefore, the IBMDIGVIDPLAYER01 & IBMMPEGPLAYER01 are the pertinent sections, where the 'MCDDRIVER=' field in both cases appears to point to a matching DLL file in the \MMOS2\DLL path.

Beyond this, the contents of MMPMMMIO.INI spell out the actual installed & registered details.

I am fairly certain that both of these are part of the default OS/2 MM install though, so I suppose one could try the official un-install process, although I'm worried that would remove far too much of that multimedia functionality.

Based on the feedback you provided I went looking through 'Multimedia Subsystem Programming Guide' (part of the OS/2 Toolkit), and under the 'Installation Requirements' one will find 'Installing an I/O Procedure' section. Of course that will simply update the MMPMMMIO.INI file, but it still needs the DLL itself that would allow a re-mapping of various file extensions to a user-defined program.

Taking the example of the AVI IOProc from above, so the SVMC.DLL file, I find the following procedures being exported:

Code: [Select]
Procedures Exported by Ordinal:
    0 @#IBM:14.075#@
    1 mciDriverEntry

Therefore, I'm curious if one was to:
1) build such a DLL that would re-map the call to a mplayer.exe (or a user defined EXE for that matter), would it be sufficient to define in that DLL the matching mciDriverEntry procedure?

2) once that procedure is created, would it simply call the EXE from there?

I feel like the above is a terrible oversimplification, but heck, that's all I know at the moment! LOL

Lars

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +70/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #9 on: November 29, 2021, 05:05:23 pm »
You are mixing up MCD drivers (see "MMPM2.INI") and MMIO procedures (see "MMPMMMIO.INI").

MCD drivers are for actually playing/recording audio/video content, MMIO procedures are for converting file formats (say from ADPCM to PCM) so that they become playable by MCD drivers (which only know a limited number of file formats to play, for audio this is almost exclusively: PCM) or transform to a standard format on record.

I would need to look at what commands an MCD driver needs to support but there must be something like OPEN , LOAD and also PLAY. And I seem to remember that either on OPEN , LOAD or PLAY, the MCI driver gets passed a filename or an "hmmio" which is a handle to an already opened audio/video "file" (where "file" can also mean data in memory). Search for "MCI_OPEN", "MCI_LOAD" and "MCI_PLAY" ...

Then, simply spoken, you'd just start the app with that filename (if it is a real file, otherwise you would need to create a temporary file ...). Then, in order to deal with concurrent calls, you need to deal with device IDs and possibly serializing access to that "MCD device" (maybe that replay app can only play one file at a time ...).

And then, in order to easily support multiple different replay apps, it would likely be a good idea to make that configurable via either some INI file or via some settings page in the "Multimedia Object" or some such. There are a few other functions that are mandatory to support (but won't need to do much for the envisaged use case).

And yes, the entry point of such an MCD driver (DLL) always is "mciDriverEntry".

Have a look at this, I think that's a good explanation of somebody who knows:
http://mireality.co.uk/writing/technology/os2-multimedia-chapter/media-control-interface/

By the way: MCD drivers are added via a CARDINFO.DLL resource DLL. It's some work to write one but it's not extremely difficult (maybe there also exists some script approach but I don't know). An example has been the "Timidity MCD" which essentially wrapped the Timidity SW so that you could play MIDI files with a double click.
« Last Edit: November 29, 2021, 05:14:50 pm by Lars »

Lars

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +70/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #10 on: November 29, 2021, 07:02:37 pm »
On second thought, it's likely much easier to write a new WPS class that registers for certain file types/extensions and then to override the "open" method (invoked on a double click). And that is what the CWMM classes likely do. Then they just invoke some app with the filename. And the app seems to be configurable via some INI key or config file.

Rich Walsh

  • Sr. Member
  • ****
  • Posts: 355
  • Karma: +24/-0
  • ONU! (OS/2 is NOT Unix!)
    • View Profile
Re: How do I change this default behaviour?
« Reply #11 on: November 30, 2021, 06:58:09 am »
Here's something I vaguely remember from a FixPack readme that supposedly works for the IBM MM classes but *not* for CWMM.

You can create a dummy object of a given class and use a setup string that will set the default 'OpenAs' for the entire class. I unpacked 'mmparts.dll' and confirmed that the string is in there. Here's how to do it using 'oo' - you could use REXX instead:
Code: [Select]
oo /n MMMPG mmtest.mpg "<WP_DESKTOP>" "CLASSDEFAULTVIEW=4096;"
After the file is created on the Desktop, you can delete it.

The default view value of '4096' means "the first associated program". I have no way to test this since I have CWMM installed, so I'd be interested to know if it actually works.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #12 on: November 30, 2021, 05:30:02 pm »
Hi Rich,

...You can create a dummy object of a given class and use a setup string that will set the default 'OpenAs' for the entire class. I unpacked 'mmparts.dll' and confirmed that the string is in there. Here's how to do it using 'oo' - you could use REXX instead:
Code: [Select]
oo /n MMMPG mmtest.mpg "<WP_DESKTOP>" "CLASSDEFAULTVIEW=4096;"
After the file is created on the Desktop, you can delete it.

The default view value of '4096' means "the first associated program". I have no way to test this since I have CWMM installed, so I'd be interested to know if it actually works.

Nah, no luck Rich. I created the object, even re-booted just in case, but no change. What was curious is that the default 'Open as' for that object was 'Video editor', meanwhile the other AVI files are pointing to 'Play' instead.

Anyways, l suspect there is some other stuff that's causing the problem here. In fact I went as far as to deregister the MMAVI class but following re-boot I still had the same AVI file behaviour.

What a real PITA this has turned out to be...LOL!

Lars

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +70/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #13 on: December 01, 2021, 10:28:50 am »
Yes, the complexity is ridiculous. But if Rich's suggestion means that the "first associated program" will open the file, then you'll also need to associate your desired program and it will have to the "the first".

And in order to do that, I suspect that you need to set up a program object for your desired progam and then, on the association page, to assign by file type and/or file extension the files you want to have handled by this program (the *.AVI files in your case). What I don't know is how to convince the system that this is the "first" program for the files of given file type and/or file extension. I hope that you can specify the usual placeholder parameters in the "command line" entry field to have the program started with additional parameters and the filename.

Since with Rich's suggestion, on a double click, the open action now is "the first associated program" and no longer the default action (which was "Play"), your program should then be called with the filename as the argument instead of the "Play" action invoked (which likely is to invoke the default MM device specified through MMPM2.INI ...).

So I hope at least.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1346
  • Karma: +26/-0
    • View Profile
Re: How do I change this default behaviour?
« Reply #14 on: December 01, 2021, 03:35:17 pm »
Lars, everyone...

Yes, the complexity is ridiculous. But if Rich's suggestion means that the "first associated program" will open the file, then you'll also need to associate your desired program and it will have to the "the first".

That's the thing you guys, this has already been done. It's like the default associations have absolutely NO bearing on what MMOS2 will actually do. Take a look at this definition of mplayer object: the object types associated cover the MMAVI and MMMPG classes, then to top it all off I even included the file extensions.

...Since with Rich's suggestion, on a double click, the open action now is "the first associated program" and no longer the default action (which was "Play"), your program should then be called with the filename as the argument instead of the "Play" action invoked (which likely is to invoke the default MM device specified through MMPM2.INI ...)...

Yeah, my hope was that this would work. What was strange is that the newly created object (with Rich's command) was the ONLY AVI object that was changed to 'Video editor', all other AVIs that I have remained exactly as they were, even after a re-boot.

You know, I spent a little time yesterday looking at how to override the default behaviour in 'Play'. I expected to find a program object named 'Play', but did not. I also looked for 'Video editor', did not find that either. So that makes me think this is all internally implemented in the MM class, perhaps in one of the DLLs?