Re: Re: Playing mp4 with mci

"Dimitris Keletsekis [email protected] [gui4cli]" <[email protected]> Sun, 25 May 2014 10:22:44 +0300
Newsgroups gmane.comp.windows.gui4cli
Message-ID <CAHiKg1VrsK7xNCD++O49_Kw5xN3AEZMqzLyE=MO5fRUuKPY4ug@mail.gmail.com>
Hi Chris,

Its incredible that such a useful tidbit of information as "type mpegVideo"
is nowhere to be found in the MCI manuals.. -
http://msdn.microsoft.com/en-us/library/dd743638(v=vs.85).aspx

The part where I said the video is dark when it starts is not due to fade
in. Its messing up - you can see shadows of what its supposed to be
showing. It clears after 10-20 seconds or so. Anyway, its probably
something to do with the window type.

Re the MCI code, its been a long time since I looked at it, but its pretty
simple. I've pasted it hereunder. One of the main problems, as I remember,
is that the return notification doesn't specify which process is returning,
so if you're running multiple videos at the same time, you don't know which
one is finished. Its probably still the same...


// mciNotify (wParam, lParam);

void mciNotify (long state, long id)   // called by window proc
{
struct Event *bt;
 gd->mciState = state; // returned state for $$mci.status
gd->mciID = id; // device ID

if (gd->debug)
Printf ("\n=> Received MCI Notification: ID=%d, State=%d", id,
gd->mciState);

// if a handler event is defined, do it..
if (gd->mciEvent && *gd->mciEvent)
{
if (bt = findSlashEvent (gd->mciEvent, NOREPORT, TRUE))
{
// post exec because message that calls this bypasses GetMessage()
PostMessage (NULL, MSG_DOEVENT, (long)bt->gf, (long)bt);
}
else if (gd->debug)
Printf ("=> Routine %s was not found", gd->mciEvent);
}
}

// =====================================================================
// MCI - mci command
// =====================================================================

intRETCODE mciCommand (char *str)
{
gd->mciRetbuff[0] = '\0';
MCIERROR err = mciSendString(str, gd->mciRetbuff, 128, gd->outwn);
if (err != NOERROR)
{
if (mciGetErrorString(err, MEM0, MEMSIZE))
{ myError (ERR_MCI, MEM0);
}
else myError (ERR_MCI, "Error %d", err);
return (10);
}

if (gd->debug && gd->mciRetbuff[0])
{ Printf ("=> MCI Command returned: %s", gd->mciRetbuff);
}
return (NOERROR);
}


// THIS PART IS IN THE WINDOW ROUTINE AND IS CALLED BY MCI ===========


case MM_MCINOTIFY : // MCI notify callback..
mciNotify (wParam, lParam);
return (0);

case MM_MCISIGNAL : // MCI signal callback..
gd->mciID = wParam; // device ID
gd->mciParam = lParam; // user value or position
if (gd->debug)
Printf ("=> Received MCI Signal for ID %d", gd->mciID);
// if a handler event is defined, do it..
if (gd->mciSignal && *gd->mciSignal)
{
struct Event *mmbt;
if (mmbt = findSlashEvent (gd->mciSignal, NOREPORT, TRUE))
{
// post exec because this bypasses GetMessage()
PostMessage (NULL, MSG_DOEVENT, (long)mmbt->gf, (long)mmbt);
}
else if (gd->debug)
Printf ("=> Routine %s was not found", gd->mciSignal);
}
return (0);





























On Sat, May 24, 2014 at 10:26 PM, [email protected] [gui4cli] <
[email protected]> wrote:

>
>
> Hi Dimitris,
>
> I'm a bit confused myself now about the notify addition in the script mci
> commands.
> It's been a while since I used it. But I now think they still need to be
> there.
>
>
> // universal MCI replacement for GUI MCI
>
>          RETCODE _export WINAPI MCI (struct gcArguments *args)
>          {
>
>             MCIERROR result;
>             char tmp[512];
>             UCHAR mci_retStr[128];
>             //HRESULT coflag;
>
>             strcpy(tmp,args[0].str);
>             strser(tmp,"/","\\");
>
>             result = mciSendString(tmp, mci_retStr, sizeof(mci_retStr), 0);
>             if (result > 0) { return 9; } // error
>
>             gcSetVar("vidplay.mci_return",mci_retStr); // MCI return to GUI
>             gcSetVar("vidplay.mci_state",mci_retStr); // MCI return to GUI
>
>             return 0;
>
>          }
>
> Probably the "mci_retStr" contents that I send to the gui are the mci
> notifications.
> I guess this is what you store in a mci system variable in g4c?
>
> Chris
>  
>