Solved

Directshow does not repaint while a movie clip is paused.

Posted on 2003-11-20
7
603 Views
Last Modified: 2012-06-27
I have made a little movie player box in a dialog I have, outputing the video to a static control.  Everything works great except for when I pause the player and open a window over the application, when I make the app visible again, the video is gone and directshow does not repaint the paused frame.  During playback everything works great. Here is the code that responds to events:

void cTrailerList::HandleGraphEvent(void)
{
      // Function to take care of graph notication codes

      long lCode, lParam1, lParam2;

      LONGLONG pos = 0;

      // If the IMediaEventEx pointer is NULL return
      // to avoid an error
      if ( cTrailer.pEvent == NULL )
            return;

      while ( SUCCEEDED(cTrailer.pEvent->GetEvent(&lCode, &lParam1, &lParam2, 0)) )
      {
            cTrailer.pEvent->FreeEventParams(lCode, lParam1, lParam2);

            switch(lCode)
            {
                  case EC_COMPLETE:
                        // Reset to first frame of movie
                        cTrailer.pSeek->SetPositions(&pos, AM_SEEKING_AbsolutePositioning ,
                                                                   NULL, AM_SEEKING_NoPositioning);

                        return;

                  case EC_USERABORT:
                  case EC_ERRORABORT:
                        cTrailer.CleanUp();

                        return;
            }
      }
}

I have tried handling EC_REPAINT but with no success. I am somehow conviced it has to do with the static control but I can't find a workaround.
0
Comment
Question by:georgiek50
  • 4
7 Comments
 
LVL 8

Expert Comment

by:_corey_
ID: 9801444
You will probably need to subclass CStatic and implement the OnDraw method so that it updates the CStatic window with the current buffer when WM_PAINT is called.
0
 
LVL 8

Expert Comment

by:_corey_
ID: 9801449
http://www.codeproject.com/wtl/mix_wtl_mfc.asp

This is a slightly akward example, but if you can get around the odd coding since it is a WTL to MFC conversion example, check out the project files, and then open the scrollwindow.cpp and .h for example in implementing the OnDraw method.  ScrollWindow subclasses CStatic (and does a lot of other stuff).

I was actually looking at that for something else so it's the reason I'm giving it as the example.  Hope it helps more than confuses.
0
 
LVL 1

Author Comment

by:georgiek50
ID: 9801879
I have already subclassed the window to process the WM_PAINT message.  I thought of doing something along the lines like you suggested, keep a track of the current frame and just paint it in when needed.  I just wanted to see if this was the "proper" way to handle this situation because reading through MSDN it states that Directshow will handle the painting.
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 8

Accepted Solution

by:
_corey_ earned 300 total points
ID: 9803126
It will, but the CStatic window might not repaint correctly?  I've seen this error too.

I think just implementing OnDraw will work instead of trying to trap WM_PAINT manually.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10249343
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: _corey_ {http:#9803126}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
 
LVL 8

Expert Comment

by:_corey_
ID: 10252929
All you have to do is check for a DEVICELOST return value, and then re-create the device the video is being displayed on.  Or something like that.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question