Changeset 65


Ignore:
Timestamp:
Sep 22, 2023, 8:23:34 PM (23 months ago)
Author:
gyoung
Message:

Code to allow integration of FFMPEG or S/Mplayer for playing modern video formats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/classes/c/c_video/cwavi.c

    r2 r65  
    3737#define M_CWAVI_Class_Source
    3838
     39#define INCL_DOSFILEMGR
     40#define INCL_DOSMISC
    3941#define INCL_PM
    4042#include <os2.h>
     43#include <stdarg.h>
     44#include <stdio.h>
    4145#include "helpid.h"
    4246#include "cwavi.ih"
     
    7276          char chrPlayer[CCHMAXPATH]={0};
    7377          char chrParams[CCHMAXPATH+2]="\"";
     78          char chrTempParams[CCHMAXPATH+2]={0};
    7479          char chrTitle[50];
    7580          char *chrPtr=chrParams;
    7681          ULONG ulSize;
    77           ULONG ulRc;
    78          
    79           if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "aviplayer", NULLHANDLE, chrPlayer,
    80                                     sizeof(chrPlayer)))
    81             PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "vb", "vb.exe", chrPlayer,
    82                                   sizeof(chrPlayer));
    83 
    84           chrPtr++;
     82          ULONG ulRc;
     83          char szFullFilename[CCHMAXPATH];
     84
     85          chrPtr++;
    8586          ulSize=sizeof(chrParams)-2;
    8687          _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
    8788          strcat(chrPtr,"\"");
     89          strcpy(chrTempParams, chrParams);
     90          ulSize =PrfQueryProfileInt(HINI_USERPROFILE, "CWMM", "nomodvid", 0);
     91          if(strstr(strlwr(chrTempParams), ".avi")) {
     92            if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "aviplayer", NULLHANDLE, chrPlayer,
     93                                      sizeof(chrPlayer)))
     94              PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "vb", "vb.exe", chrPlayer,
     95                                    sizeof(chrPlayer));
     96          }
     97          else if(!ulSize) {
     98            if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "mvidplayer", NULLHANDLE, chrPlayer,
     99                                      sizeof(chrPlayer))) {
     100              if(!DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY,
     101                               "PATH",
     102                               "ffplay.exe",
     103                               (PBYTE) szFullFilename,
     104                                CCHMAXPATH - 1))
     105                strcpy(chrPlayer, szFullFilename);
     106              else if(!DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY,
     107                                     "PATH",
     108                                     "smplayer.exe",
     109                                     (PBYTE) szFullFilename,
     110                                     CCHMAXPATH - 1))
     111                strcpy(chrPlayer, szFullFilename);
     112             else if(!DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY,
     113                                     "PATH",
     114                                     "mplayer.exe",
     115                                     (PBYTE) szFullFilename,
     116                                     CCHMAXPATH - 1))
     117               strcpy(chrPlayer, szFullFilename);
     118             else  {
     119               char text[200];
     120               sprintf(text, "No suitable video player could be found. Please install ffplay (part of ffmpeg) or smplayer/mplayer somewhere in your path or in OS2.INI add the key mvidplayer under CWMM application containing the full path to an appropriate video player");
     121 
     122               WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, "Missing video player",
     123                             1234, MB_OK|MB_MOVEABLE);
     124               return NULLHANDLE;
     125             }
     126            }
     127          }
    88128          /* Get the Title for the window list */
    89129          if(!getMessage(chrTitle, IDSTR_VIDPLAYERTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
     
    135175SOM_Scope PSZ  SOMLINK cwaviM_wpclsQueryInstanceType(M_MMAVI *somSelf)
    136176{
     177    ULONG ulSize;
     178
    137179    /* M_CWAVIData *somThis = M_CWAVIGetData(somSelf); */
    138180    M_MMAVIMethodDebug("M_MMAVI","cwaviM_wpclsQueryInstanceType");
    139181
    140     return "AVI";
     182    ulSize = PrfQueryProfileInt(HINI_USERPROFILE, "CWMM", "nomodvid", 0);
     183    if(ulSize)
     184      return "AVI";
     185    else
     186    return "AVI/FLV/3GP/M4V/MKV/MP4/MTS/VOB/WMV/WEBM";
    141187}
    142188
     
    151197SOM_Scope PSZ  SOMLINK cwaviM_wpclsQueryInstanceFilter(M_MMAVI *somSelf)
    152198{
     199    ULONG ulSize;
     200
    153201    /* M_CWAVIData *somThis = M_CWAVIGetData(somSelf); */
    154202    M_MMAVIMethodDebug("M_MMAVI","cwaviM_wpclsQueryInstanceFilter");
    155203
    156     return "*.AVI";
     204    ulSize =PrfQueryProfileInt(HINI_USERPROFILE, "CWMM", "nomodvid", 0);
     205    if(ulSize)
     206      return "*.AVI";
     207    else
     208      return "*.AVI,*.FLV,*.3GP,*.M4V,*.MKV,*.MP4,*.MTS,*.VOB,*.WMV,*.WEBM";
    157209}
    158210
Note: See TracChangeset for help on using the changeset viewer.