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

RE: DirectShow issue with Windows Mobile 5 by Joe

Joe
Tue Jan 17 00:26:02 CST 2006

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();
}



Re: DirectShow issue with Windows Mobile 5 by Gary

Gary
Wed Jan 18 18:42:23 CST 2006

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@discussions.microsoft.com> wrote in message
news:82845774-B169-4147-9561-3D1F71C55142@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();
> }
>
>



Re: DirectShow issue with Windows Mobile 5 by DominiqueKuster

DominiqueKuster
Thu Jan 19 09:52:05 CST 2006

"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 ?



Re: DirectShow issue with Windows Mobile 5 by Chester

Chester
Fri Jan 20 00:04:26 CST 2006


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 =E5=AF=AB=E9=81=93=EF=BC=9A

> "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 ?


Re: DirectShow issue with Windows Mobile 5 by DominiqueKuster

DominiqueKuster
Fri Jan 20 03:02:02 CST 2006

"Chester Cheng[MVP]" wrote:
> Do you have AKU? (Adaption Kit Update.)
It could be... I'm running my tests on a Dell Axim X50 originally packed
with Windows Mobile 2003 and I upgraded to Windows Mobile 2005.
I should get a native WM2005 device soon.

Do you know if it is possible to install 3rd party codecs ?


Re: DirectShow issue with Windows Mobile 5 by Chester

Chester
Fri Jan 20 03:28:50 CST 2006

Hi,

http://www.tcpmp.com/
Open source

Directshow library need be installed by device vendor.

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


Dominique Kuster =E5=AF=AB=E9=81=93=EF=BC=9A


Dominique Kuster =E5=AF=AB=E9=81=93=EF=BC=9A

> "Chester Cheng[MVP]" wrote:
> > Do you have AKU? (Adaption Kit Update.)
> It could be... I'm running my tests on a Dell Axim X50 originally packed
> with Windows Mobile 2003 and I upgraded to Windows Mobile 2005.
> I should get a native WM2005 device soon.
>=20
> Do you know if it is possible to install 3rd party codecs ?


Re: DirectShow issue with Windows Mobile 5 by Joe

Joe
Tue Jan 24 07:06:40 CST 2006

I have an HTC made PPC phone Dopod 900 based on WM5. How can I tell if
it supports DS or not? Or supports DS but not the codec?

How can we application developers verify our applications work for DS
with only a emulator? I really don't understand the development process
if I am not employeed by an PPC manufacturer.


Re: DirectShow issue with Windows Mobile 5 by YuYuan

YuYuan
Thu Jan 26 02:29:39 CST 2006

Yeah. It's a good question.
Maybe you can export the registry using Windows Ce Remote Registry
Editor
and then search using the keyword " decode "or "encoder" or
"capture".and also have a
look the file uuids.h. maybe you can verify the codec machine
supported.
that's my way.:)

btw. I think the wmv encoder will be supported because OEM have to
support camera capture using directshow ,then including wmv encoder.
and also ms-rle decoder will support in most devices because the
decoder is really small
footprint (2k..)
Joe wrote:

> I have an HTC made PPC phone Dopod 900 based on WM5. How can I tell if
> it supports DS or not? Or supports DS but not the codec?
>
> How can we application developers verify our applications work for DS
> with only a emulator? I really don't understand the development process
> if I am not employeed by an PPC manufacturer.


Re: DirectShow issue with Windows Mobile 5 by YuYuan

YuYuan
Thu Jan 26 02:32:22 CST 2006

I think you can have a test to playing the "clock.avi" file which
located in the windows directory in the desktop computer

Dominique Kuster wrote:

> 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


Re: DirectShow issue with Windows Mobile 5 by Joe

Joe
Thu Jan 26 03:19:44 CST 2006

You really help and I see the avi is playing on my PPC emulator now and
this is the answer I am looking for from Jan. 17th. It's really a
painful process in this 21st century.


Re: DirectShow issue with Windows Mobile 5 by soni

soni
Tue Feb 07 23:23:49 CST 2006

Hi Dominique,

is your snippet code is for windows mobile 5 using C#? i have been
looking for how to access directshow from C# in windows mobile 5 and
cant get it done, lots of the samples i got is in C++. can you send me
your sample codes how to access directshow in C# to my email? sonigroup
@ gmail.com, really appreciate your help or anyone who know how to do
this can send me email about this.. i want to create video conference
application from PDA to desktop, i want to embed this functionality to
my application which i already created using C#. in my search i got
into directshow to access the camera and still learning how to make it
work and how to get the data and stream it to my server and vice versa.
i'm using VS2005 and DOPOD 900.
thanks for any help that you can give to me.

best regards
soni


RE: DirectShow issue with Windows Mobile 5 by shanejh

shanejh
Thu Sep 21 17:26:01 CDT 2006

Hi,

I'm alos trying to link managed code to Native C++ code. Can you please post
some code examples of how you have done this? I think a lot of people out
there would be interested. Currently there is very little example code out
there.
--
Regards

Shane Harris


"Dominique Kuster" wrote:

> 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