Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Qt and DirectShow (Not Quicktime)

48 views
Skip to first unread message

Todd Dobmeyer

unread,
Jun 15, 2006, 8:52:02 AM6/15/06
to
I am working on developing a video player that can skip any amount of frames
requested by the user. Thus being why I am showing the video using
DirectShow. I am using Qt by Trolltech to handle my GUI such as all the
buttons and the frame to display the video in. I have all the buttons
implemented and the video playing. One thing I need to be able to do is click
on a point on the video and draw a red dot to show where I clicked. Then if I
click on another spot in the video on the same frame the original red dot
disappears and a new red dot appears based on the newly clicked location. I
am using a windowless control to show my video. This is what I had planned to
do for drawing the point:

/*
* Event handler for the any widget using the installEventFilter function
*/
bool VideoViewerWindow::eventFilter( QObject *obj, QEvent *event )
{
if( event->type() == QEvent::Paint || event->type( ) == QEvent::Move )
{
if( pMediaSeeking != NULL )
{
QPainter* painter;
//painter = new QPainter( mpVideoPlayer );
painter = new QPainter( mpFrame );
painter->setPen( QPen( Qt::red, 3 ) );
// mpOverlay is now transparent
painter->drawPixmap( 0, 0, 561, 351, *mpOverlay );
// Creating a 2nd painter to paint on the overlay...doesn't appear
to help though
QPainter* painter2;
painter2 = new QPainter( mpOverlay );
painter2->setPen( QPen( Qt::red, 3 ) );
// Creating a painter to act as an eraser by using the transparent
color for the pen
QPainter* eraser;
eraser = new QPainter( mpOverlay );
eraser->setPen( QPen( Qt::transparent, 3 ) );
for( int i = 0 ; i < azElPoints.size( ) ; i++ )
{
if( azElPoints[i].frameNumber == getCurrentFrame( ) )
{
if( erasePoint == true )
{
eraser->drawPoint( tempX, tempY );
erasePoint = false;
}
painter->drawPoint( azElPoints[i].xPos, azElPoints[i].yPos );
}
}
delete painter;
delete painter2;
repaintWindow( );
return true;
}
}
return QObject::eventFilter( obj, event );
}

repaintWindow( ) looks like this:

/*
*
* repaintWindow( )
*
* This function repaints the video in its video frame so that the video
will be
* upon loading and flipping back and forth between open windows.
*
*/
void VideoViewerWindow::repaintWindow( )
{
long lWidth, lHeight;
HRESULT hr = pWindowlessControl->GetNativeVideoSize( &lWidth, &lHeight,
NULL, NULL );
RECT rcSrc, rcDest;
// Set the source rectangle.
SetRect( &rcSrc, 0, 0, lWidth, lHeight );

// Get the window client area.
GetClientRect( (HWND) mpVideoPlayer->winId( ), &rcDest );
// Set the destination rectangle.
SetRect(&rcDest, 1, 1, 558, 349);

// Set the video position.
hr = pWindowlessControl->SetVideoPosition( &rcSrc, &rcDest );

PAINTSTRUCT ps;
HDC hdc;
RECT rcClient;
GetClientRect( (HWND) mpVideoPlayer->winId( ), &rcClient );
hdc = BeginPaint( (HWND) mpVideoPlayer->winId( ), &ps );
if( pWindowlessControl != NULL )
{
// Find the region where the application can paint by subtracting
// the video destination rectangle from the client area.
// (Assume that g_rcDest was calculated previously.)
HRGN rgnClient = CreateRectRgnIndirect( &rcClient );
HRGN rgnVideo = CreateRectRgnIndirect( &rcDest );
CombineRgn( rgnClient, rgnClient, rgnVideo, RGN_DIFF );

// Paint on window.
HBRUSH hbr = GetSysColorBrush( COLOR_BTNFACE );
FillRgn( hdc, rgnClient, hbr );

// Clean up.
DeleteObject( hbr );
DeleteObject( rgnClient );
DeleteObject( rgnVideo );

// Request the VMR to paint the video.
HRESULT hr = pWindowlessControl->RepaintVideo( (HWND)
mpVideoPlayer->winId( ), hdc );
}
}

What I am getting is a red dot to display on the frame and everytime a
repaint occurs the video displays for a brief second and then the video
disappears and the blank frame reappears with the red dot being drawn where
it should be drawn. What I am having problems getting to work is I need to
display the red dot on top of the video, not the way it is currently working.
Thanks for any help you may have for getting this to work. If you need more
information, please let me know!

The March Hare [MVP]

unread,
Jun 15, 2006, 10:20:59 AM6/15/06
to
On Thu, 15 Jun 2006 05:52:02 -0700, Todd Dobmeyer wrote:

> What I am getting is a red dot to display on the frame and everytime a
> repaint occurs the video displays for a brief second and then the video
> disappears and the blank frame reappears with the red dot being drawn where
> it should be drawn. What I am having problems getting to work is I need to
> display the red dot on top of the video, not the way it is currently working.
> Thanks for any help you may have for getting this to work. If you need more
> information, please let me know!

Why don't you use the mixer bitmap that is built-in to the VMR to display
the dot? See IVMRMixerBitmap in the SDK docs.

--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution

Todd Dobmeyer

unread,
Jun 15, 2006, 11:36:02 AM6/15/06
to
I've looked through the MSDN site and their information on the
IVMRMixerBitmap seems very limited. There are no examples of how it is used
and the function definitions seem vague to me. I feel I am still raw when it
comes to using DirectShow stuff and this IVMRMixerBitmap is confusing me.
From the little bit I think I understand, I think this would work, but I do
not know for certain. Any examples would be great because I don't think it
should be too difficult to display a red dot on top of my image. Thanks!

The March Hare [MVP]

unread,
Jun 15, 2006, 1:56:47 PM6/15/06
to
On Thu, 15 Jun 2006 08:36:02 -0700, Todd Dobmeyer wrote:

> I've looked through the MSDN site and their information on the
> IVMRMixerBitmap seems very limited. There are no examples of how it is used
> and the function definitions seem vague to me. I feel I am still raw when it
> comes to using DirectShow stuff and this IVMRMixerBitmap is confusing me.
> From the little bit I think I understand, I think this would work, but I do
> not know for certain. Any examples would be great because I don't think it
> should be too difficult to display a red dot on top of my image.

Look at the samples that come with the SDK (BmpMix9 and Text9).

BTW, the Summer 2004 DirectX SDK is useful because it has a sample browser
and some samples that were deleted when dshow was moved to the Platform
SDK.

See my Links page for a link to the MS DX downloads.

Todd Dobmeyer

unread,
Jun 19, 2006, 3:58:02 PM6/19/06
to
What are the differences between the VMR and the VMR9 samples? I have been
using the PlayWnd sample from the Players examples for my basis. Will the
VMR9 samples be compatible with similar code to the PlayWND sample or will I
have to convert some of the code I wrote based off PlayWND to handle the VMR9
samples? BmpText9 is exactly what I am looking for! Thanks again!

"The March Hare [MVP]" wrote:

The March Hare [MVP]

unread,
Jun 19, 2006, 4:51:51 PM6/19/06
to
On Mon, 19 Jun 2006 12:58:02 -0700, Todd Dobmeyer wrote:

> What are the differences between the VMR and the VMR9 samples?

VMR means VMR7 which is available on XP only.

VMR9 is only available with DirectX 9 and D3D9 compatible cards.

> I have been
> using the PlayWnd sample from the Players examples for my basis. Will the
> VMR9 samples be compatible with similar code to the PlayWND sample or will I
> have to convert some of the code I wrote based off PlayWND to handle the VMR9
> samples?

You will need to convert some code.

> BmpText9 is exactly what I am looking for! Thanks again!

You're welcome. Please learn to quote and trim inline as requested.

The March Hare [MVP]

unread,
Jun 19, 2006, 4:56:10 PM6/19/06
to
On Mon, 19 Jun 2006 14:51:51 -0600, The March Hare [MVP] wrote:


> VMR means VMR7 which is available on XP only.

Clarification: XP forward (AFAIK, it is available on W2K3 Server and
Vista).

Todd Dobmeyer

unread,
Jun 20, 2006, 9:04:01 AM6/20/06
to
Thank you for your clarification. I was able to build the Text9 sample on
VC++ 6 but I am now on the machine where the actual development is occuring
and all I have is VC++ 2003 .Net. Unfortunately I cannot get the Text or
Text9 samples to build. When I try to build the Text sample I get these
errors:

Text fatal error LNK1120: 2 unresolved externals
Text error LNK2001: unresolved external symbol "class ATL::CAtlBaseModule
ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A)
Text error LNK2001: unresolved external symbol "class ATL::CAtlBaseModule
ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A)
Text error LNK2001: unresolved external symbol "long __stdcall
ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)"
(?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z)
Text error LNK2019: unresolved external symbol "long __stdcall
ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)"
(?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z) referenced in function
"public: __thiscall ATL::CAtlWinModule::CAtlWinModule(void)"
(??0CAtlWinModule@ATL@@QAE@XZ)

I cannot figure out how to fix this error and it confuses me since it built
fine on VC6 for me last night on a different machine. Is this okay to post
here or is there a better forum to post this question?

And when I try to build Text9 sample, it says it cannot find vmr9.h I
installed the Feb. 2006 SDK but apparently this was not installed. Is there
anywhere this file is posted so I can just download it and save it instead of
downloading and re-installing the whole SDK? Thanks again!


The March Hare [MVP]

unread,
Jun 20, 2006, 10:11:46 AM6/20/06
to
On Tue, 20 Jun 2006 06:04:01 -0700, Todd Dobmeyer wrote:

> Thank you for your clarification.

Clarification of what? Why did you not trim and quote inline as requested?

> Text fatal error LNK1120: 2 unresolved externals
> Text error LNK2001: unresolved external symbol "class ATL::CAtlBaseModule
> ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A)
> Text error LNK2001: unresolved external symbol "class ATL::CAtlBaseModule
> ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A)
> Text error LNK2001: unresolved external symbol "long __stdcall
> ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)"
> (?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z)
> Text error LNK2019: unresolved external symbol "long __stdcall
> ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)"
> (?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z) referenced in function
> "public: __thiscall ATL::CAtlWinModule::CAtlWinModule(void)"
> (??0CAtlWinModule@ATL@@QAE@XZ)

Did you recompile the baseclasses with VC7.1?



> And when I try to build Text9 sample, it says it cannot find vmr9.h I
> installed the Feb. 2006 SDK but apparently this was not installed.

See my FAQ for information on where dshow is now.

> Is there
> anywhere this file is posted so I can just download it and save it instead of
> downloading and re-installing the whole SDK?

AFAIK, no because it would violate the EULA for the SDK.

Todd Dobmeyer

unread,
Jun 20, 2006, 10:58:02 AM6/20/06
to
> Did you recompile the baseclasses with VC7.1?
I assumed the baseclasses were all compiled with VC7.1 when it was installed
on this machine as this machine only has VC7.1 and no other compilers like
VC6. The machine has been used for some time by other people with no
problems. I have just started using this machine in the past month and
unfortunately do not have Admin access. But I am guessing that since other
people have had success using VC7.1 before and I have not had any problems up
until now, that the baseclasses must have been compiled.

> See my FAQ for information on where dshow is now.

All I see from your FAQ is it talks about DShow being taken out of DirectX
in 2004 but the only link you provide for DShow is for some Windows 2003
Server Platform SDK...not much help since I am using WinXP. I will just
download the April SDK as I am pretty sure this is all I downloaded on my own
personal PC and had all the DShow examples. Thanks.

The March Hare [MVP]

unread,
Jun 20, 2006, 11:24:08 AM6/20/06
to
On Tue, 20 Jun 2006 07:58:02 -0700, Todd Dobmeyer wrote:

>> Did you recompile the baseclasses with VC7.1?
> I assumed the baseclasses were all compiled with VC7.1 when it was installed
> on this machine as this machine only has VC7.1 and no other compilers like
> VC6. The machine has been used for some time by other people with no
> problems. I have just started using this machine in the past month and
> unfortunately do not have Admin access. But I am guessing that since other
> people have had success using VC7.1 before and I have not had any problems up
> until now, that the baseclasses must have been compiled.

You know what they say about assuming ;)

It could be a calling convention problem too. There was a recent post on
this here or in the ../SDK newsgroup.

>> See my FAQ for information on where dshow is now.
> All I see from your FAQ is it talks about DShow being taken out of DirectX
> in 2004 but the only link you provide for DShow is for some Windows 2003
> Server Platform SDK...not much help since I am using WinXP. I will just
> download the April SDK as I am pretty sure this is all I downloaded on my own
> personal PC and had all the DShow examples. Thanks.

The names of the Platform SDKs are confusing but if you look at the W2K3
PSDK's download page you will see that it is compatible with XP.

Also, you can use the DirectX Summer 2004 SDK with VC7.1 (available on MS
Downloads, see my Links page).

Todd Dobmeyer

unread,
Jun 20, 2006, 11:37:02 AM6/20/06
to
> The names of the Platform SDKs are confusing but if you look at the W2K3
> PSDK's download page you will see that it is compatible with XP.
>
> Also, you can use the DirectX Summer 2004 SDK with VC7.1 (available on MS
> Downloads, see my Links page).
So should I download the W2K3 Platform SDK that you link to, developed in
April 2005 or does the newer March 2006 one contain directshow as well? I
don't really feel like downloading both as I am guessing the March 2006 is
every bit as big as this one. Thanks!

The March Hare [MVP]

unread,
Jun 20, 2006, 12:40:05 PM6/20/06
to
On Tue, 20 Jun 2006 08:41:02 -0700, Todd Dobmeyer wrote:

> Has DShow changed much since the Summer 2004 SDK came out? Since it is much
> smaller? Also, do I need to Extras package or just the main DirectX 9.0 SDK
> Update - (Summer 2004)? Thanks again!

I still use the Summer 2004 for my product and use VC7.1. I don't think
you need the extras (at least for the main dshow stuff).

Todd Dobmeyer

unread,
Jun 21, 2006, 9:27:02 AM6/21/06
to
> Look at the samples that come with the SDK (BmpMix9 and Text9).
I have looked over this BmpMix9 Sample as it has done exactly what I want to
do. Since the rest of my code was written based in the VMR7 style code, I
want to keep the VMR in VMR7 style so I am working on converting parts of
BmpMix9 to work with my program. I create a QPixmap that is the same size as
my QAxWidget and fill the QPixmap with a transparent color. I then add a red
dot to the QPixmap based on the coordinates received by the mouse when it is
clicked. I know this is working as this is the point when I could see my
point draw behind the video before the video would be redrawn onto the
screen. I am then converting my QPixmap to a QBitmap so I have a bitmap. The
code for this looks like:

if( event->type( ) == QEvent::Paint )


{
if( pMediaSeeking != NULL )
{

QPainter* painter2;
painter2 = new QPainter( mpOverlay );
painter2->setPen( QPen( Qt::red, 3 ) );

for( int i = 0 ; i < azElPoints.size( ) ; i++ )
{
if( azElPoints[i].frameNumber == getCurrentFrame( ) )
{
if( erasePoint == true )
{

// Fill the overlay with transparent again since using a
// transparent pen does not remove the red dot.
mpOverlay->fill( Qt::transparent );
}
painter2->drawPoint( azElPoints[i].xPos, azElPoints[i].yPos );
}
}
// Set the QBitmap equal to the QPixmap
*mpRedDot = *mpOverlay;
updateAlphaBitmap( );
repaintWindow( );
delete painter2;
return true;
}
}

HRESULT VideoViewerWindow::updateAlphaBitmap( )
{
HRESULT hr = E_FAIL;
VMRALPHABITMAP alphaBitmap;

// Update the bitmap by index
setUpAlphaBitmap( alphaBitmap );

// Apply the bitmap to the VMR
pMixerBitmap->SetAlphaBitmap( &alphaBitmap );

return hr;
}

HRESULT VideoViewerWindow::setUpAlphaBitmap( VMRALPHABITMAP& alphaBitmap )
{
if( pMixerBitmap == NULL )
{
return E_FAIL;
}

ZeroMemory( &alphaBitmap, sizeof VMRALPHABITMAP);

// Initialize VMR9AlphaBitmap structure
alphaBitmap.dwFlags = VMRBITMAP_ENTIREDDS | VMRBITMAP_SRCCOLORKEY;
alphaBitmap.hdc = NULL;
alphaBitmap.pDDS = (LPDIRECTDRAWSURFACE7) mpRedDot;
alphaBitmap.clrSrcKey = RGB(255,255,255); // white background

// Position the bitmap within the VMR's composition space (0.0 - 1.0).
// Because the bitmap will always be as big as the QAxWidget it should
// go from 0.0-1.0
alphaBitmap.rDest.top = 0.0;
alphaBitmap.rDest.left = 0.0;
alphaBitmap.rDest.bottom = 1.0;
alphaBitmap.rDest.right = 1.0;
alphaBitmap.fAlpha = 0.0f;

return S_OK;
}

This code all compiles but it is not working. One thing that worries me is
the line:

alphaBitmap.pDDS = (LPDIRECTDRAWSURFACE7) mpRedDot;

Is this a legal cast or how can I get from my QBitmap to a
LPDIRECTDRAWSURFACE7 so the alphaBitmap.pDDS will know what the bitmap I want
it to draw looks like? Let me know if you need more information but I think
this should be sufficient for now. Thanks!

The March Hare [MVP]

unread,
Jun 21, 2006, 9:38:56 AM6/21/06
to
On Wed, 21 Jun 2006 06:27:02 -0700, Todd Dobmeyer wrote:

> Is this a legal cast or how can I get from my QBitmap to a
> LPDIRECTDRAWSURFACE7 so the alphaBitmap.pDDS will know what the bitmap I want
> it to draw looks like? Let me know if you need more information but I think
> this should be sufficient for now. Thanks!

It will likely be easier to use the HDC instead of the pDDS. If you can
easily get an HBITMAP from QBitmap.

This should be illustrated in the Text or Ticker samples (which use VMR7).

Todd Dobmeyer

unread,
Jun 21, 2006, 11:35:13 AM6/21/06
to
> It will likely be easier to use the HDC instead of the pDDS. If you can
> easily get an HBITMAP from QBitmap.
What is this HDC? I saw it mentioned on the VMRALPHABITMAP page on MSDN but
didn't think it was used since I was planning on using the pDDS like the VMR9
examples?

> This should be illustrated in the Text or Ticker samples (which use VMR7).
Thanks I will check out these samples!

The March Hare [MVP]

unread,
Jun 21, 2006, 1:06:49 PM6/21/06
to
On Wed, 21 Jun 2006 08:35:13 -0700, Todd Dobmeyer wrote:

>> It will likely be easier to use the HDC instead of the pDDS. If you can
>> easily get an HBITMAP from QBitmap.
> What is this HDC?

It is a handle to a Device Context.

Device Contexts
A device context is a structure that defines a set of graphic objects and
their associated attributes, as well as the graphic modes that affect
output. The graphic objects include a pen for line drawing, a brush for
painting and filling, a bitmap for copying or scrolling parts of the
screen, a palette for defining the set of available colors, a region for
clipping and other operations, and a path for painting and drawing
operations. The remainder of this section is divided into the following
three areas.

>> This should be illustrated in the Text or Ticker samples (which use VMR7).
> Thanks I will check out these samples!

IIRC, you will find an HDC example among the samples.

Todd Dobmeyer

unread,
Jun 21, 2006, 3:09:02 PM6/21/06
to
> > What is this HDC?
>
> It is a handle to a Device Context.
>
> Device Contexts
> A device context is a structure that defines a set of graphic objects and
> their associated attributes, as well as the graphic modes that affect
> output. The graphic objects include a pen for line drawing, a brush for
> painting and filling, a bitmap for copying or scrolling parts of the
> screen, a palette for defining the set of available colors, a region for
> clipping and other operations, and a path for painting and drawing
> operations. The remainder of this section is divided into the following
> three areas.

I looked over the Ticker example and I think I have a feel for how to handle
this HDC stuff. Now I am just confused on how to actually get this VMR stuff
to appear on top of my video. I know the QPixmap I am using is correct
because I have displayed it in place of the video and I see the red dot like
I want to. And by using the QPixmap::toWinHBITMAP( ) function, I am pretty
sure I am getting the HBITMAP stuff correctly. toWinHBITMAP takes an argument
which I pass in as being: mpOverlay->toWinHBITMAP(
QPixmap::PremultipliedAlpha ) because my Pixmap is filled with the color
Qt::transparent and it said if you don't use PremultipledAlpha, it assumed
all the pixels were opaque and that there was no transparency in the QPixmap.
So here is what my code looks like now:

HRESULT VideoViewerWindow::setInitialAlphaBitmap( )


{
HRESULT hr = E_FAIL;
VMRALPHABITMAP alphaBitmap;

// Initialize the alpha bitmap


setUpAlphaBitmap( alphaBitmap );

// Apply the bitmap to the VMR
pMixerBitmap->SetAlphaBitmap( &alphaBitmap );

return hr;
}

HRESULT VideoViewerWindow::setUpAlphaBitmap( VMRALPHABITMAP& alphaBitmap )
{
if( pMixerBitmap == NULL )
{
return E_FAIL;
}

// Create a device context compatible with the current window
HDC hdc = GetDC( (HWND) mpVideoPlayer->winId( ) );
HDC hdcBmp = CreateCompatibleDC( hdc );
ReleaseDC( (HWND) mpVideoPlayer->winId( ), hdc );

// Select our bitmap into the device context and save the old one
BITMAP bm;
HBITMAP hbmOld;
GetObject( mpOverlay->toWinHBITMAP( QPixmap::PremultipliedAlpha ),
sizeof( bm ), &bm);
hbmOld = (HBITMAP) SelectObject( hdcBmp,
mpOverlay->toWinHBITMAP( QPixmap::PremultipliedAlpha )
);

ZeroMemory( &alphaBitmap, sizeof( VMRALPHABITMAP ) );

// Initialize VMR9AlphaBitmap structure
alphaBitmap.dwFlags = VMRBITMAP_HDC | VMRBITMAP_SRCCOLORKEY;
alphaBitmap.hdc = hdcBmp;
alphaBitmap.pDDS = NULL;
// alphaBitmap.pDDS = (LPDIRECTDRAWSURFACE7) mpRedDot;


alphaBitmap.clrSrcKey = RGB(255,255,255); // white background

// Position the bitmap within the VMR's composition space (0.0 - 1.0).

// Because the bitmap can move on mouse clicks, keep track of the
// current X and Y positions. The width/height of the alpha-bitmap are
// predetermined by constant sizes.


alphaBitmap.rDest.top = 0.0;
alphaBitmap.rDest.left = 0.0;
alphaBitmap.rDest.bottom = 1.0;
alphaBitmap.rDest.right = 1.0;

alphaBitmap.fAlpha = 1.0f;

return S_OK;
}

HRESULT VideoViewerWindow::updateAlphaBitmap( )
{
HRESULT hr = E_FAIL;
VMRALPHABITMAP alphaBitmap;

// Update the bitmap by index
setUpAlphaBitmap( alphaBitmap );

// Apply the bitmap to the VMR
pMixerBitmap->SetAlphaBitmap( &alphaBitmap );

return hr;
}

Then inside my Qt Paint Event handler I do this:

if( event->type( ) == QEvent::Paint )
{
if( pMediaSeeking != NULL )
{
QPainter* painter2;
painter2 = new QPainter( mpOverlay );
painter2->setPen( QPen( Qt::red, 3 ) );
for( int i = 0 ; i < azElPoints.size( ) ; i++ )
{
if( azElPoints[i].frameNumber == getCurrentFrame( ) )
{
if( erasePoint == true )
{
// Fill the overlay with transparent again since using a

// transparent pen do es not remove the red dot.


mpOverlay->fill( Qt::transparent );
}
painter2->drawPoint( azElPoints[i].xPos, azElPoints[i].yPos );
}
}
// Set the QBitmap equal to the QPixmap

updateAlphaBitmap( );
repaintWindow( );
delete painter2;
return true;
}
}

But I do not see my QPixmap display on top of the video. I pause the video
at it's frame before clicking so the video will stay on the current frame.
When I choose to paint the QPixmap on top of the video, it shows the red dot
in the correct place. So is there something I am doing incorrectly with my
VMR? Do you need more information? Thanks once again for all your help. This
DirectShow stuff is confusing me.

The March Hare [MVP]

unread,
Jun 22, 2006, 9:36:03 AM6/22/06
to
On Wed, 21 Jun 2006 12:09:02 -0700, Todd Dobmeyer wrote:

> But I do not see my QPixmap display on top of the video. I pause the video
> at it's frame before clicking so the video will stay on the current frame.
> When I choose to paint the QPixmap on top of the video, it shows the red dot
> in the correct place. So is there something I am doing incorrectly with my
> VMR?

Does the bitmap show up after the graph is run again?

The docs say:

"Applications can change the image displayed as frequently as they wish. It
should be noted that changes are only reflected on the screen when the
DirectShow filter graph is in the running state."

So you will need to have the graph in the Run state when you update the
bitmap.

Todd Dobmeyer

unread,
Jun 22, 2006, 11:18:02 AM6/22/06
to
> Does the bitmap show up after the graph is run again?
>
> The docs say:
>
> "Applications can change the image displayed as frequently as they wish. It
> should be noted that changes are only reflected on the screen when the
> DirectShow filter graph is in the running state."
>
> So you will need to have the graph in the Run state when you update the
> bitmap.

So there is no way to update the graph and see the changes when the graph is
in a paused state? If this is so, then using the VMR will not work for me as
I need to pause the video, click on the screen and then see the dot on the
screen on the same frame that I clicked it on. Then I want to be able to skip
a couple frames ahead but stay in the paused state and click a new point
here. But the bitmap can only be loaded in the Run state? So when I pause it,
say after updating the map and rerunning it to a frame I clicked on before,
should I see the dot? Am I seeing this correctly or am I just getting
confused? Thanks again!

The March Hare [MVP]

unread,
Jun 22, 2006, 11:30:23 AM6/22/06
to
On Thu, 22 Jun 2006 08:18:02 -0700, Todd Dobmeyer wrote:

> So there is no way to update the graph and see the changes when the graph is
> in a paused state?

AFAIK, that is correct.

> If this is so, then using the VMR will not work for me as
> I need to pause the video, click on the screen and then see the dot on the
> screen on the same frame that I clicked it on. Then I want to be able to skip
> a couple frames ahead but stay in the paused state and click a new point
> here. But the bitmap can only be loaded in the Run state?

It can be loaded but it will not be displayed in the Paused state.

You may be able to trick it into displaying by using IMediaSeeking to seek
to the current position.

Another way around this would be to have a filter that has a custom
interface with a function that allows you to only emit the current sample
when the graph is running. Then when you turn this mode off remember to
seek to the correct position.

A second approach would be to use the multiple graph architecture (see
Geraint's GMFBridge (linked on my site)).

Todd Dobmeyer

unread,
Jun 26, 2006, 1:34:02 PM6/26/06
to
> It can be loaded but it will not be displayed in the Paused state.
>
> You may be able to trick it into displaying by using IMediaSeeking to seek
> to the current position.
>
> Another way around this would be to have a filter that has a custom
> interface with a function that allows you to only emit the current sample
> when the graph is running. Then when you turn this mode off remember to
> seek to the correct position.
>
> A second approach would be to use the multiple graph architecture (see
> Geraint's GMFBridge (linked on my site)).
I just decided to go back to the Qt route and I created a 5x5 red QPixmap
and applied it to a 5x5 QLabel. I then drew the QLabel on top of the video in
the spot the mouse was clicked at and this enabled the dot to be drawn and
the rest of the video to be seen so I could handle the video being paused.
Thanks for all your help though!!!

The March Hare [MVP]

unread,
Jun 26, 2006, 5:46:06 PM6/26/06
to
On Mon, 26 Jun 2006 10:34:02 -0700, Todd Dobmeyer wrote:

> I just decided to go back to the Qt route and I created a 5x5 red QPixmap
> and applied it to a 5x5 QLabel. I then drew the QLabel on top of the video in
> the spot the mouse was clicked at and this enabled the dot to be drawn and
> the rest of the video to be seen so I could handle the video being paused.
> Thanks for all your help though!!!

Thanks for following up. Sorry that it wasn't easier (it should be). I
made the point about the Pause mode to the developer of the VMR a few years
ago. Maybe it will be available in Vista.

Todd Dobmeyer

unread,
Jun 27, 2006, 8:17:01 AM6/27/06
to

"The March Hare [MVP]" wrote:

> On Mon, 26 Jun 2006 10:34:02 -0700, Todd Dobmeyer wrote:
>
> > I just decided to go back to the Qt route and I created a 5x5 red QPixmap
> > and applied it to a 5x5 QLabel. I then drew the QLabel on top of the video in
> > the spot the mouse was clicked at and this enabled the dot to be drawn and
> > the rest of the video to be seen so I could handle the video being paused.
> > Thanks for all your help though!!!
>
> Thanks for following up. Sorry that it wasn't easier (it should be). I
> made the point about the Pause mode to the developer of the VMR a few years
> ago. Maybe it will be available in Vista.

Let's hope because it seems like a very useful and beneficial capability to
have directly in DShow!

0 new messages