Question

DirectShow video playback on Windows Mobile 5.0 using Visual Studio 2005

Asked by: cprice404

Hello,

I am a developer working on an application that will run on the Windows CE 5.0 Core platform.  The application requires video playback, and I am having trouble finding an acceptable way to implement this.  I have a lot of flexibility over the file format of the video files that will be played.  I don't necessarily need to support multiple formats... if I can get even one format working then that should be sufficient.  MPG, WMV, AVI, or MOV would all work and if I can support more than one of them (which I know that DirectShow is capable of) then that will be a great advantage.  The video files will all be stored on local storage, so I do not need to be able to support network streaming at this point, though leaving open the possibility of adding that functionality in the future would be a huge plus.

The target device will be running a Samsung ARM 400 MHz processor, so it seems to me that the solution will have to include some library that can take advantage of hardware rendering.  Initial tests with software-only rendering have provided little hope that that type of solution could be acceptable with our limited processor speed.

The Windows CE 5.0 OS Image that we will be using does NOT include the Windows Media Player or associated OCX, so that is not a possibility.  Right now I am leaning towards using the DirectShow library, which definitely WILL be available on my target device.  But I am not locked into DirectShow if I can find a better solution.  I am also considering licensing the third-party TCPMP player from CoreCodec, but our requirements seem so simple, theoretically, that I would prefer to avoid incurring additional third-party licensing and support costs if at all possible.  Especially in light of the fact that DirectShow is available for no extra cost as part of our OS platform.

I have a device in my possession, for performance testing, that has the same chip that our final target device has, but I do not have access to our final target hardware at this point in time.  The device that I do have is running Windows Mobile 5.0.  This is NOT our target OS, as I mentioned above... but Windows Mobile does claim to support DirectShow, so I assume that if I can get a DirectShow video player application to compile on run on the WinMobile 5.0 device, the application should run OK on the real target device when I get my hands on it.  I am aware that I need to avoid using any WinMobile5.0 features that may not be available in our target OS of WinCE 5.0 Core.

Developing an application for the Windows Mobile 5.0 platform requires Visual Studio 2005, so that seems like a requirement at this point.  Also, I expect VS2005 to be much more useful in the future for new devices that we may want to support than if we developed the application using embedded VC++ or some combination of that and Visual Studio.NET 2003.

At this point, I am simply trying to get a simple DirectShow video playback application to compile in VS2005 and deploy and run it on the Windows Mobile 5.0 emulator or on my physical WM5.0 device.  I am using a Visual C++ Smart Device Win32 Application project in VS2005, and have virtually copied and pasted my code from the DirectShow for WinCE 5.0 sample code available on MSDN here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50condirectshowsamplecode.asp

I can not get it to compile.  It is not a link error, it is a compile error that has to do with these two lines of code:

#define WM_GRAPHNOTIFY  WM_APP + 1

and

pEvent->SetNotifyWindow((OAHWND)g_hwnd, WM_GRAPHNOTIFY, 0);

The compile error is about syntax.  It says this:

syntax error : missing ')' before ';'

I can give more specific details about the compile error if that would be useful, but I strongly suspect that it has to do with the definition of "WM_APP" being incompatible with its use in this fashion.  I'm assuming this is to do some change to that definition that occurred between VS2003 and VS2005.  Microsoft's sample code page doesn't seem to state it specifically, but I suspect that it was written and tested under VS2003 and not VS2005.

So the ideal answer to this question and a solution that I would gladly award 500 points for would be if someone can give me a working example of how to modify Microsoft's sample code (from the link above) to compile in VS2005 and successfully deploy to the WM5.0 emulator (optional) and my physical WM5.0 device (required).

However if anyone has any other suggestions or comments about my approach or an alternative than seems more desirable or has a higher probability of success, I will divy up so points for any useful information about that as well.

One other factor:  there will be an ActiveX component involved in the application as well, for the User Interface.  I know that without third-party software, this will have to be accomplished via C++ as well.  However, besides the video playback and the ActiveX control, I am hoping to implement as much of the rest of the application logic as possible in C#.  So after I get a working standalone VS2005 C++ app playing video via DirectShow (which is my immediate goal so I can test performance on the hardware),  I am hoping to create a new project that is a wrapper DLL rather than an actual application, and to have the ability to access that and any other C++ code from through the wrapper DLLs from the main C# application.  This is not an absolute requirement but would be a HUGE benefit unless it might cause performance issues.

All feedback is welcome!  Thanks in advance!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-01-11 at 18:37:10ID21693415
Tags

windows

,

mobile

,

directshow

Topic

Windows MobileProgramming

Participating Experts
4
Points
500
Comments
32

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Windows CE Emulator
    Can I know where to download the emulator for the Windows CE??? Thanks
  2. Visual Studio 2005 CE Emulator Not Listing, even after i…
    Hello- From another question someone asked, I saw I could get the CE 5.0 Emulator at: http://www.microsoft.com/downloads/details.aspx?FamilyID=A120E012-CA31-4BE9-A3BF-B9BF4F64CE72&displaylang=en Even after installing this, how do I build and debug a solution onto ...
  3. Flash Player 7 for Windows CE
    We have a Windows Mobile 5 application that runs in Flash Player 7. We would like this application to run on a Windows CE device. However, I am unable find Flash Player 7 for Windows CE. Is the version of Flash Player available for CE? Thanks, Mike
  4. Need windows ce emulator for visual studio 2003
    Hello experts, I used to have an emulator, on my old laptop for window ce device, unfortunately I lost the install. The application was developed with visual studio 2003 so I am not real sure what version of the emulator i need. I get this errror when I try to debug using th...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: mahesh1402Posted on 2006-01-12 at 03:41:59ID: 15680216

Make sure you DirectX Include/Lib path are BEFORE the Microsoft Includes.

 

by: Mikal613Posted on 2006-01-12 at 05:06:40ID: 15680762

why dont you use windows media player?

 

by: cprice404Posted on 2006-01-12 at 06:52:55ID: 15681722

mahesh1402:  thank you for your comment.  However the compile error is coming from this line:

pEvent->SetNotifyWindow((OAHWND)g_hwnd, WM_GRAPHNOTIFY, 0);

the specific compile error is:

syntax error:  missing ')' before ';'

if you look at the line that is causing the compile error, you will notice that syntactically it looks perfectly correct.  The parentheses are matched up.  This implies to me that whatever the compiler is replacing WM_GRAPHNOTIFY with (due to the #define line), is causing the syntax error.  The define line is:

#define WM_GRAPHNOTIFY  WM_APP + 1

I have no idea what the previous definition for "WM_APP" might be, but I'm assuming that it most include some kind of special character like a semicolon.  That's the only thing I can think of that would cause the syntax error at compile time--because the line looks perfectly syntactically correct to me.

 

by: cprice404Posted on 2006-01-12 at 06:55:21ID: 15681736

Mikal613:  Thank you for your comment, however, as I stated in my original post:

"The Windows CE 5.0 OS Image that we will be using does NOT include the Windows Media Player or associated OCX, so that is not a possibility.  Right now I am leaning towards using the DirectShow library, which definitely WILL be available on my target device.  But I am not locked into DirectShow if I can find a better solution.  I am also considering licensing the third-party TCPMP player from CoreCodec, but our requirements seem so simple, theoretically, that I would prefer to avoid incurring additional third-party licensing and support costs if at all possible.  Especially in light of the fact that DirectShow is available for no extra cost as part of our OS platform."

I understand that WMP is included in the WinMobile 5.0 platform that I am using for testing, but that does me no good because it won't be available on my final target platform.

 

by: sakuya_suPosted on 2006-01-12 at 15:21:27ID: 15687216

is the line before the pEvent correct?

if it is then i don't see how it wont work, as puzzled as you, as you said, the syntax is perfectly correct.

BTW, WM_APP is defined as 0x8000, so there is no error there.

It is most likely that something in the code before this is stuffed up and the compiler only picked up the error now.

what you can try, is repleace the code with

pEvent->SetNotifyWindow(Null, 0, 0);

does that stil give you syntax error? if so then maybe the lines before it are really messed up

Also, doesnt the SetNotifyWindow thing belong to <dshow.h>? *I'm not sure about the CE5 header*

 

by: sakuya_suPosted on 2006-01-12 at 15:22:18ID: 15687222

on another Note, TCPMP is a open source project isnt it?

 

by: sakuya_suPosted on 2006-01-12 at 15:23:23ID: 15687229

also, try doing this:


pEvent->SetNotifyWindow((OAHWND)g_hwnd, (0x8000 + 1), 0);

 

by: cprice404Posted on 2006-01-12 at 15:35:35ID: 15687317

TCPMP *used* to be an open source project, and technically I think they are still willing to provide source under certain circumstances, but they no longer make the source available in their download package.  I am under the impression that they are in the process of changing their licensing model.  I have sent them e-mail to try to get an idea of what their plans are for the licensing model, and what requirements they now have for acquiring the source, but I haven't heard back from them yet.  I expect that those folks are pretty darn busy and am not expecting them to be very responsive in getting back to me, which is one of the reasons I'm leaning towards rolling my own player instead of trying to integrate theirs.  It's a shame because I am confident that my company would be willing to pay them for some commercial support but it just doesn't seem likely that they are going to have the time or interest in that.

Thank you for the code suggestions, and especially for the info about the definition of WM_APP.  Your suggestions make a lot of sense, and those are some good clues as to how I can try to figure out what's wrong.  I will try them out and post any further info that I can glean.

 

by: cprice404Posted on 2006-01-12 at 17:49:33ID: 15688033

sakuya_su, you are my hero :)

thanks to your help I solved a big part of my problem.  i am giving you at least 250 points of the 500 for this question.

unfortunately i am still having a problem, so i would like to ask a further question or two and see if you or anyone else can help before i "accept" a final answer.

The problem is, WM_APP was never being defined.  I thought that was supposed to happen from including <windows.h>, but apparently either I am wrong about that or it is different for WinCE/WinMobile than it is for other Win32 OS's.

so, for the time being, I changed:

#define WM_GRAPHNOTIFY  WM_APP + 1

to

#define WM_GRAPHNOTIFY  (0x8000 + 1)

and now my app compiles and deploys to the WinMobile5.0 emulator successfully.  Unfortunately, the program crashes on this line:

pGraph->RenderFile(L"\\mymovie.avi", NULL);

I get an exception window that reads:

Unhandled exception at 0x00011198 in DirectShowWM5_cpp_Win32.exe:
0xC0000005: Access violation reading location 0x00000000.

Forgive me if this is a stupid question but it's been a while since I've written C++ code, and I've *NEVER* written DirectShow code.  To me, the 0x00000000 instantly implies that I'm somehow trying to do something to a pointer that is set to NULL.  But I copied and pasted this code straight from Microsoft's sample code so I don't know how I could have screwed anything up.  I will be happy to paste my full source if it would be useful but it is pretty much EXACTLY the same as the sample code at the Microsoft URL in my first post in this thread.

The only thing that I could think of was that maybe the filepath that I was specifying was invalid, or that the DirectShow libraries installed on the emulator don't support the video format of my file.  So I've tried moving the file to different folders and adjusting my string accordingly, and I've tried several different file formats:  AVI, MPG, WMV.  I can successfully play the WMV file in the Windows Media Player that is installed in the emulator--but none of the other formats will play in WMP.

The fact that the WMV file will play in WMP implies in my mind that the required codecs for WMV are alive and well on the emulator... so I would think that the DirectShow code should be able to AT LEAST play a WMV file.  But I get the same exception with the "Access Violation 0x00000000" even with the WMV file.  I have the WMV file stored in the root directory of the emulator's filesystem so I don't see how I could possibly have the path string wrong in my code.

So here are my two questions for now:
1) Anybody know what file(s) i need to #include to get WM_APP defined?  I will poke through the .h files in the SDK and see if I can answer that question myself but any suggestions would be great.
2) Anyone familiar enough with DirectShow to have any idea why I am getting this "Accesss Violation 0x00000000" exception?  Where am I screwing up and leaving a pointer NULL?

sakuya_su, again, thanks so much for your help, i'm a lot closer now than i was before!!

 

by: sakuya_suPosted on 2006-01-12 at 18:47:18ID: 15688327

apparently, if you use an Pocket PC you'll notice that there are only 3 format WMP can play on a PPC:
 - WMV... duh, its MS
 - Avi with either:
   1. Microsoft MPEG-4 V1 Encoder
   2. or the MS MPEG-4 V2 Encoder

if the code you called upon can actually play WMV< then the code is working? try converting ur Avi to a MPEG-4 Version2 avi file(its actually a WMV file but you can rename it to avi XD).

to do that, you can use the Windows Media Encoder (free)

as for the WM_APP...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesmessages/wm_app.asp

it says its declared in winuser.h and includede in windows.h... but what the heck, if it dont work you can just define your own.

good luck

 

by: sakuya_suPosted on 2006-01-12 at 18:49:49ID: 15688341

both the MS MPEG-4 V1 and V2 encoder actualy encodes to WMV by defualt, but it is possible to call those encoders with graphedit and attach them to a AVI Muxer, so you can get Avi files with those 2 codecs to play on WMP

 

by: cprice404Posted on 2006-01-12 at 19:10:08ID: 15688434

Thanks for the info about WM_APP.  I'm not too concerned about that issue because I will either find the right header file, or just define it myself like you suggested.

My program still doesn't work though.  I tried a WMV file--that was the first format I tried since I assumed it was the most likely to work with Microsoft libraries.  It plays fine in the actual Windows Media Player application that was pre-installed on the PocketPC emulator.  But when I try to play it from my DirectShow program, my program still crashes on this line:

pGraph->RenderFile(L"\\mymovie.wmv", NULL);

It still gives me the same exception:

Unhandled exception at 0x00011198 in DirectShowWM5_cpp_Win32.exe:
0xC0000005: Access violation reading location 0x00000000.

The null pointer thing makes me think that there's something else wrong besides the file format--but I'm not sure...

 

by: sakuya_suPosted on 2006-01-12 at 19:49:32ID: 15688617

yeah

RenderFile is:

pGraph->RenderFile(Path, NULL);

now, the problem with yours is... "\\myhomemovie.wmv" is not a valid path name.. as \\means a network path

try..

hr = pGraph->RenderFile(L"C:\\Media\\Example.avi", 0);


look at this:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/igraphbuilderrenderfile.asp

 

by: cprice404Posted on 2006-01-12 at 20:03:37ID: 15688687

Thanks for spending so much of your time with me on this.

Two points in response to your last comment.

Point #1:  On a WinCE device, there is no "C:".  All file paths just start with "\\".  See the following URL's, which are basically just WinCE specific versions of the same docs you were looking at.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conplayingthefile.asp

Note the comment:  "// Filenames on Windows CE start with a \\ instead of a drive letter."

and you can see it in their full code sample here.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50condirectshowsamplecode.asp

Point #2:  In the link that you just sent me, there are a ton of error codes that imply that if my file path or video file format was invalid, I would get an HRESULT return value with the appropriate error code for me to check against.  But I am never getting a return value at all--it is crashing with an exception before it ever has a chance to return anything.

 

by: cprice404Posted on 2006-01-12 at 20:06:12ID: 15688710

and a network path on a WinCE device would look like this:

L"\\\\OtherComputerName\\FolderName\\FolderName"

 

by: sakuya_suPosted on 2006-01-12 at 20:14:56ID: 15688747

just try a local file 1st, might be because network path dont work

 

by: cprice404Posted on 2006-01-12 at 20:38:44ID: 15688846

I am trying a local file.  I don't even need the ability to support network files in my application.  The WMV file is stored in the root directory of the WinCE device.

L"\\MyMovie.wmv"  IS the windows CE equivalent of

L"C:\\MyMovie.wmv" on XP or other Win32.

Look at the comments in the code snippet at this URL:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conplayingthefile.asp

IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
                    IID_IGraphBuilder, (void **)&pGraph);
// Query for IMediaControl (not shown)
// Filenames on Windows CE start with a \\ instead of a drive letter.
pGraph->RenderFile(L"\\Hello_World.avi", NULL);
pMediaControl->Run();


The part I'm trying to draw your attention to is "Filenames on Windows CE start with a \\ instead of a drive letter."

 

by: sakuya_suPosted on 2006-01-12 at 20:44:49ID: 15688866

put the file on a SD card etc, then try \SD Card\FILENAME?

i cannot see why this code does not work apart from that, soryy cant help you there :(

but i'll keep researching on it

 

by: cprice404Posted on 2006-01-12 at 21:00:22ID: 15688911

please don't apologize, i greatly appreciate you spending so much of your time looking into it.

I have tried putting the file on the SD card, I've tried putting it in the "My Documents" folder, I've tried putting it in the "Temp" folder, and about 5 other places (always changing the PATH string in my RenderFile line accordingly, of course), and none of it has worked.

From the last url that you posted for me:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/igraphbuilderrenderfile.asp

look at the list of return values (HRESULT codes).  Notice that there are error codes listed for "NOT_FOUND", "UNKNOWN_FILE_TYPE", "INVALID_FILE_FORMAT", "INVALIDARG", "ABORT", "FAIL", etc.

so if the problem was that I got the path wrong, then I should just get back one of those error codes as a return value, instead of the program crashing with an unhandled exception.  So I don't think the file path is the problem.

If you want to see the exception yourself I will be happy to give you my source file, or you can copy and paste the code straight off of the Microsoft page.  The Windows Mobile 5.0 emulator is free, it comes with the Windows Mobile 5.0 SDK... but only works with Visual Studio 2005...

thank you..

 

by: cprice404Posted on 2006-01-12 at 21:02:57ID: 15688921

maybe i should open up a new question so i can give you 500 more points :)  because you did answer my first one about WM_GRAPHNOTIFY...

 

by: umaheshPosted on 2006-01-13 at 00:35:27ID: 15689760

Hello cprice404

What Mahesh1402 is saying is correct. Becaus as you say
*****************************
so, for the time being, I changed:
#define WM_GRAPHNOTIFY  WM_APP + 1
to
#define WM_GRAPHNOTIFY  (0x8000 + 1)

and now my app compiles and deploys to the WinMobile5.0 emulator successfully.  Unfortunately, the program crashes on this line:
******************************

Then the chances are that you havent defined the WM_APP is not defined at the time when the preprocessing is happening. so whats happening is WM_APP is not getting replaced with any value.

So go back and check the includes of WM_APP. Those shold be before the Microsoft Includes.
I guess you have used the code from

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedshow/html/_dxce_dshow_learning_when_an_event_occurs.asp

Then you need to check the above.

Good Luck

umahesh

 

by: umaheshPosted on 2006-01-13 at 00:38:48ID: 15689770

 

by: sakuya_suPosted on 2006-01-13 at 02:05:20ID: 15690092

i cant really test that code because i'm on linux XD.

But... if WM_APP wasnt defined.. then maybe you missed something else too..

try the code for Win32, see if u get that error, i'll be back tomorrow to test out some stuff

 

by: cprice404Posted on 2006-01-13 at 06:47:43ID: 15691712

Thanks everyone, I think this is the right track here.  I think there is some stuff that is supposed to get defined when WM_APP is supposed to get defined that isn't, and that's probably why I'm crashing.

As for mahesh1402 and umahesh's comments about making sure the directx paths are before the microsoft include paths--I am not using anything from DirectX except for DirectShow, and with Visual Studio 2005 and WinMobile5.0 SDK, the DirectShow stuff is included in the WinMobile 5.0 SDK, so I never even had to install the DirectX SDK.  So all of my includes/libs for both Windows and DirectShow are coming from the same paths, which on my install happen to be:

includes: C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include\Armv4i
libs: C:\Program Filews\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\lib\ARMV4I

Furthermore, I have checked and double checked my include paths, and I am positive that the first <windows.h> that it is finding is from the directory I mentioned above.  Looking through the windows.h file, I do see a line that says #include <winuser.h>.   Double checking the paths again, I am certain that the first "winuser.h" it would find is also in that same includes directory.

Inside <winuser.h> I see the line that is supposed to define WM_APP, but it is obviously never being reached, because my program won't compile if I try to make any reference to WM_APP.  Obviously there is an "ifdef" or "ifndef" somewhere that is preventing the compiler from reaching the "<winuser.h>" file, or inside of that file it's not reaching the "#define WM_APP" line.  I have looked at all of the "ifdef" and "ifndef" lines that encompass those, and I don't see any obvious reason why any of them would fail.

the includes in my .cpp file are in this order:

#include "stdafx.h"  // autogenerated by VS2005
#include "MyApp.h"  // autogenerated by VS2005
#include <windows.h>  // added by me because it is in the Microsoft WinCE DirectShow sample code
#include <streams.h>  // added my be because this is where the DirectShow definitions are

if anyone can give me any clues on how to figure out why winuser.h or WM_APP is not getting processed at compile time that would be very helpful...

I will try to do a Win32 version and see if anything different happens... unfortunately I have to install the Windows Platform SDK to get the DirectShow stuff for Win32, and I have found some posts on newsgroups and such that suggest that the latest Platform SDK DirectShow stuff doesn't work very well with VS2005.

thanks all for your help

 

by: cprice404Posted on 2006-01-13 at 09:03:29ID: 15693159

ok i have some new info.  I started trying to do a Win32 version of this to see if that would give me any clues.

First of all, WM_APP gets set properly in the Win32 version, even though my include lines are exactly the same.  But the Win32 App still crashes on the same line.  So I'm almost positive that the WM_APP definition is not the problem--though I still don't know why WM_APP isn't getting defined in the WinCE version.

Playing around with the debugger on the Win32 version, I found a major clue.  The line that is crashing is this one:

pGraph->RenderFile(L"C:\\MyMovie.wmv", NULL);

The exception is a NULL pointer exception.  It finally occurred to me to check and see if "pGraph" was set to NULL for some reason... and bingo, it sure is.

So the next question is, why is pGraph set to NULL?  It is supposed to get initialized on the line directly preceding that, which is:

CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
                IID_IGraphBuilder, (void **)&pGraph);

For some reason that line is leaving pGraph set to NULL.  I will read up on the docs of CoCreateInstance and see if I can get a return value with an error code or something, but I thought I'd go ahead and post this info in case it means something meaningful to any of you.

 

by: cprice404Posted on 2006-01-13 at 09:13:49ID: 15693269

Changed the CoCreateInstance line to:

HRESULT result = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
                IID_IGraphBuilder, (void **)&pGraph);

the value of "result" gets set to:

0x800401f0 CoInitialize has not been called.

This sounds like Microsoft just left a few COM-related setup lines out of their sample code, and I have too little experience with COM to have known that they needed to be there.  I will keep poking through the docs, I think I should be able to figure it out now, but if anyone already knows what I'm missing, let me know.

 

by: cprice404Posted on 2006-01-13 at 09:28:23ID: 15693426

Adding one line:

CoInitialize(NULL);

above the CoCreateInstance line fixes everything on the Win32 version.  The video plays successfully.

I went back into the WinCE version and made the same fix.  The program no longer crashes, it runs now... but it doesn't actually play the video.  Still looking through docs... any thoughts appreciated...

 

by: cprice404Posted on 2006-01-13 at 10:36:28ID: 15694055

I have narrowed down the problem a little bit more.  I am now saving the HRESULT return value from the RenderFile command.  The value that it is set to after it fails to play the video is VFW_E_CANNOT_RENDER, which as I understand means that it can't find an appropriate filter/codec for this file format.  But the file in question is a WMV file.  If DirectShow can play ANYTHING it should be able to play WMV, shouldn't it?  I can play this same WMV file just fine in the Windows Media Player application on the emulator.  And Windows Media Player is built on DirectShow so why would I get this "CANNOT_RENDER" error?

I also tried changing the file path argument to RenderFile to an invalid path, intentionally, to see if I got the same error.  When I use an invalid file path, I get VFW_E_NOT_FOUND as my error code.  So I know that I have my file path correct when I am getting the CANNOT_RENDER error code--I just don't know why I am getting that error code.

Any clues?

 

by: sakuya_suPosted on 2006-01-13 at 20:27:09ID: 15698552

hmm, can you check what codecs are used by that WMV?

 

by: umaheshPosted on 2006-01-13 at 21:06:15ID: 15698678

Hello
I am starting from your first problem

1) First about the exception which occurs at
pGraph->RenderFile(L"\\mymovie.avi", NULL);

Unhandled exception at 0x00011198 in DirectShowWM5_cpp_Win32.exe:
0xC0000005: Access violation reading location 0x00000000.

This error message is a bit cryptic, but it's understandable if broken down. 0xC0000005 is the error code designation for an Access Violation. 0x00000000 is the location that we tried to read (this is our NULL value!). And, 0x00011198 is the arbitrary memory location where our application happened to be running at the time of the crash (in platform builder you can trace this location and find which module is running there).

For Win32 processes - OS protect lowest 4Mb (hmm, is it realy 4Mb or 4Kb only ?) of memory space from reading/writing.
See http://support.microsoft.com/kb/q125691/ for a reference.

Thus - while trying to read anything from this area (including from address 0) in user-mode Win32 process you will get page fault that will be translated to exception with code EXCEPTION_ACCESS_VIOLATION.

But in DOS - this will be completely legal code and you will get some information from interrupt vector table (becouse IVT reside at this addresses)

BTW, Even in Win32 - this is legal code. You can plug some exception handler for AV exception and perform some magic based on address accessed. For example you can see how you can allocate memory dynamicaly as result of exceptions at http://msdn.microsoft.com/library/en-us/memory/base/reserving_and_committing_memory.asp

2) I have seen some times that,
calling a virtual function that doesn not exists for an object, or the linker got screwed up and linked to an invalid fonction pointer), or calling an object that has been deleted already, possibly to do with objects being statically created or an invalid reference to an object that's not present anymore
The other option could be
derefrencing error in a destructor. Put breakpoints on your destructors and step through them all on exit to see where you get the fault.
So check your in

void CleanUp(void)

and set all pointers to NULL after deletion and before new | at constructors

3) Now you are at a point where you are able to run your code but its not getting rendered,
Please see the suppoprted codec types by DirectX under WinCE

Again while playing a file the filter graph need to be completed. The avi or wmv file is splitted in to video and audio. The video part is again given to specific codec and then it goes to renderer. If you are playing it in own filter wrapper code then you need to check the filter graph. The pin allocation must match the output pin of previous filter to the input pin of the next filter and so on. If it fails then you will get error related to codec filter.

If you are getting blank screen only then there is WinCE update for that error see here..
just copy and paste following link in IE and download those updates for directX for your Win CE version.

http://www.microsoft.com/downloads/results.aspx?freetext=windows%20ce%20directx%20update&productID=&categoryId=&period=&sortCriteria=title&nr=20&DisplayLang=en&type=a

Good luck

Umahesh

 

by: umaheshPosted on 2006-01-13 at 21:11:33ID: 15698692

Here is details about the video codec and renders supported in Windows CE5.0

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conaudiocodecsrenderers.asp

Good luck

 

by: cprice404Posted on 2006-01-15 at 08:10:19ID: 15705151

Thanks for your help, everyone.  I haven't had a chance to go back and work on this in a few days, but now that the program is compiling and running, and I know that it is just a codec issue, I am confident that I can solve the problem from here.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...