PDA

View Full Version : Set file at run time



brow0833
July 7, 2006, 16:32:25
Hello,

Does anyone know how to set the video file name at run time with MontiVision? I have a simple capture graph:

mv ip source -> mv mjpeg decompressor -> WM ASF Writer

I see there is a Set File option on the WM ASF Writer when right clicked in the workbench application but I don't know how to access that in C++.

I can get the WM ASF Writer in C++ with these statements but how do I set the file?
CString szFilter = "WM ASF Writer";
IUnknownPtr pUnk;
pUnk = pFilterGraph->GetFilter(szFilter.AllocSysString());

Thanks in advance,

Andy

Marc Cymontkowski
July 7, 2006, 20:54:04
Andy,

Please use the Smart Controls IMVSCSetFile (http://www.montivision.com/support/documentation/noframes/source/smart%20control/imvscsetfile.htm) interface.


Best Regards,

Marc Cymontkowski

brow0833
September 11, 2006, 20:38:09
In the workbench application I've set the output video file to one that does not exist since I want to set the file name at run time.

When I load the .mvp file I SOMETIMES get a set file dialog when I start workbench or when I load the config in my program.

Is there a recommended way to handle this? I don't want my users to see the Set File dialog.

Thank you,

Andy

Marc Cymontkowski
September 11, 2006, 20:56:31
Andy,

You could set a valid path on the Smart Controls OnInputPinConnected Event.


Best Regards,

Marc

brow0833
September 11, 2006, 21:44:34
Thanks for the tip. I didn't see an example, is this correct for the event sink map section?

ON_EVENT(CDVRView, ID_MVSMART, 0, OnInputPinConnectedMvsmartcontrol, VTS_BSTR VTS_BSTR VTS_UNKNOWN)

I'm not sure about the '0'. Does that part relate to MV_ALGORITHM_START_EVENT? Is that the correct event to watch for?

Thanks again,

Andy

Marc Cymontkowski
September 11, 2006, 21:56:19
Andy,

not sure. Please have a look at http://www.montivision.com/support/documentation/noframes/source/smart%20control/_imvsmartcontrolevents.htm and there at the OnInputPinConnected Event.

That Event is fired by the Smart Control before an input pin is connected. Check the filter name provided by the Event and if it is the file writer, get the IMVSCSetFile interface and set the path you'd like.


Best Regards,

Marc

brow0833
September 11, 2006, 22:27:31
Marc,

I've tried to catch this event like all the others that I'm handling.

ON_EVENT(CDVRView, ID_MVSMART, 17, OnOutputPinConnected, VTS_BSTR VTS_BSTR VTS_UNKNOWN)
ON_EVENT(CDVRView, ID_MVSMART, 2, OnInputPinConnected, VTS_BSTR VTS_BSTR VTS_UNKNOWN)
ON_EVENT(CDVRView, ID_MVSMART, 14, FilterEventMvsmartcontrol, VTS_I4 VTS_I4)

This event never gets to my event handler. I followed your link and I think i'm doing this correctly since all the other events seem to work as expected. Am I missing a step here?

Andy

brow0833
September 11, 2006, 23:01:53
Got it!

The magic number is 16. Why 16 by the way?

ON_EVENT(CDVRView, ID_MVSMART, 2, OnInputPinConnected, VTS_BSTR VTS_BSTR VTS_UNKNOWN)

In the above line 2 is not correct, it's 16.

Andy