From: Dominique Kuster on
Hello,
I'm trying to play a video file from a C# application (although the same
occurs with a win32 application) with the following code:

Type ComFilterGraph = Type.GetTypeFromCLSID(Clsid.FilterGraph);

Object CoClass = Activator.CreateInstance(ComFilterGraph);

if (CoClass != null)
{
int hr;
_GraphBuilder = CoClass as IGraphBuilder;
_MediaControl = CoClass as IMediaControl;
_VideoWindow = CoClass as IVideoWindow;

// build the graph
hr = _GraphBuilder.RenderFile(_ClipFile, null);

//Set the video window
hr = _VideoWindow.put_Owner(panel1.Handle);
hr = _VideoWindow.put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

hr = _VideoWindow.SetWindowPosition(0, 0, panel1.Width, panel1.Height);

hr = _MediaControl.Run();
}

I cannot get perfect results, most of the time the call to RenderFile
returns VFW_E_CANNOT_RENDER.
I got some AVI files where either the sound or the video is played (same
behaviour in media player).
In summary I was not able to play any *.wmv or *.mpg files. On the desktop,
the same code is able to play DIVX files !

Any information is welcome, thanks in advance.

DK
From: Joe Pojun <Joe on
I have the same trouble as you do except I'm using the sample code from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conbuildingdirectshowapplications.asp.

The hr is S_OK until it reaches pGraph->RenderFile. The hr is always
0x80040218 VFW_E_CANNOT_RENDER.

My develpment tools are MS VS.2005 + Windows Mobile 5.0 SDK for Pocket PC
v5.0.14343.

My stub is as below:

void PlayFile(void)
{
HRESULT hr;
CoInitialize(NULL);

// Create the filter graph manager.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);

hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
if (FAILED(hr))
{
printf("ERROR - Could not create the Media Control object.");
pGraph->Release(); // Clean up after ourselves.
CoUninitialize(); // And uninitalize COM
return;
}

hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
hr = pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);

// Build the graph.
hr = pGraph->RenderFile(L"\\Temp\\Carton.wmv", NULL);


//Set the video window.
hr = pVidWin->put_Owner((OAHWND)g_hwnd);
hr = pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

RECT grc;
GetClientRect(g_hwnd, &grc);
hr = pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom);

// Run the graph.
hr = pMediaControl->Run();
if( SUCCEEDED(hr) )
{
long evCode;
pEvent->WaitForCompletion(INFINITE,&evCode);
}
hr = pMediaControl->Stop();
CleanUp();
}


From: Gary Daniels [MS] on
Windows Mobile 5.0 does not include the DirectShow decoder filters for WMV.
Windows Media Player uses a custom system for decoding and rendering WMV
video clips for performance reasons.

Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.

"Joe Pojun" <Joe Pojun(a)discussions.microsoft.com> wrote in message
news:82845774-B169-4147-9561-3D1F71C55142(a)microsoft.com...
>I have the same trouble as you do except I'm using the sample code from
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conbuildingdirectshowapplications.asp.
>
> The hr is S_OK until it reaches pGraph->RenderFile. The hr is always
> 0x80040218 VFW_E_CANNOT_RENDER.
>
> My develpment tools are MS VS.2005 + Windows Mobile 5.0 SDK for Pocket PC
> v5.0.14343.
>
> My stub is as below:
>
> void PlayFile(void)
> {
> HRESULT hr;
> CoInitialize(NULL);
>
> // Create the filter graph manager.
> hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
> IID_IGraphBuilder, (void **)&pGraph);
>
> hr = pGraph->QueryInterface(IID_IMediaControl, (void
> **)&pMediaControl);
> if (FAILED(hr))
> {
> printf("ERROR - Could not create the Media Control object.");
> pGraph->Release(); // Clean up after ourselves.
> CoUninitialize(); // And uninitalize COM
> return;
> }
>
> hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
> hr = pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
>
> // Build the graph.
> hr = pGraph->RenderFile(L"\\Temp\\Carton.wmv", NULL);
>
>
> //Set the video window.
> hr = pVidWin->put_Owner((OAHWND)g_hwnd);
> hr = pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
>
> RECT grc;
> GetClientRect(g_hwnd, &grc);
> hr = pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom);
>
> // Run the graph.
> hr = pMediaControl->Run();
> if( SUCCEEDED(hr) )
> {
> long evCode;
> pEvent->WaitForCompletion(INFINITE,&evCode);
> }
> hr = pMediaControl->Stop();
> CleanUp();
> }
>
>


From: Dominique Kuster on
"Gary Daniels [MS]" wrote:
> Windows Mobile 5.0 does not include the DirectShow decoder filters for WMV.
> Windows Media Player uses a custom system for decoding and rendering WMV
> video clips for performance reasons.

Thanks a lot for the answer. Is there a video format that is supported by
DirectShow on Windows Mobile 5.0 apart uncompressed AVI ?


From: Chester Cheng[MVP] on

Do you have AKU? (Adaption Kit Update.)
I think you don't have those codecs.


--
Microsoft MVP(2003-present), MCSD
Chester Cheng For
Windows .NET/SDK
Windows Server Application
BLOG http://www.msmvps.com/chester

Dominique Kuster 寫道:

> "Gary Daniels [MS]" wrote:
> > Windows Mobile 5.0 does not include the DirectShow decoder filters for WMV.
> > Windows Media Player uses a custom system for decoding and rendering WMV
> > video clips for performance reasons.
>
> Thanks a lot for the answer. Is there a video format that is supported by
> DirectShow on Windows Mobile 5.0 apart uncompressed AVI ?