VC: Video application

Hi,
I am in the design stages of writing a program in Visual C++ 6 (MFC), and would like your comments. The program needs to read a set of nonstandard-format bitmap files and display them as video on screen. Ideally the program should be able to reach rates of about 30 fps.

I am currently seeking comments on the best way to do this. Right now I am thinking of reading the files one by one and BitBlting them. Any better ideas? Any comments on what framerate I will achieve in this method?

I will accept as an answer a link to written code which performs this operation. As the discussion evolves I may refine my question slightly. Or, if I get enough information from the comments, I will give the points to the expert who helped the most.

Thanks!
-- Slarti
LVL 2
SlartiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WynCommented:
I once did this and I loaded all the maps together into a surface and bitblt them.
But I use Directx:)
Regards
Wyn.
0
SlartiAuthor Commented:
How difficult would it be to learn how to do this in Directx? Can anyone give me a sample code? I have never used DirectX before.
0
chensuCommented:
Whether you can achieve the performance also depends on the bitmap size (display size and file size).
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

GlennDeanCommented:
BitBlting in DirectX is very similar to the CBitmap::Blt function, except you "Blt" to a target surface (typically a back buffer).  You can use DirectX in VC++ if you load ddraw.lib.  
   I know how to load a BMP file and Blt it to a surface but non-standard formats I have no clue how hard that is.  Once you figured that out, and you don't mind using COM (which DirectX hides from you for the most part) you can do what you want in a few days.
   MSDN has info on BitBlting in DirectX (check out IDirectDrawSurface3::Blt).
   Glenn
   
0
SlartiAuthor Commented:
Thanks for your info Glenn. I have a couple of questions (which go for all experts, of course):

1. Is it your estimation that using DirectDraw will be faster than ordinary BitBltting? Why do you think so? It seems to me that both APIs end up doing pretty much the same thing, so why bother?

2. Is there direct access to the BITMAP structure before I blt it? I need this in order to fill the bitmap with the pixels I want to blt (I know how to do this if I have a BITMAP structure).
0
udiaCommented:
You can use DrawDib library functions. They are very simple to use and since the bitmaps are drawn directly to the video memory the performance is MUCH better then using standard GDI routines.
Refer the the MSDN documentation for further details.

If you are looking for an easy solution then DrawDib is the way to go. The only downside is that the DrawDib (and VFW) libraries are considered "old", even though they will be supported by Windows 2000 (and probably future versions as well).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GlennDeanCommented:
I made a mistake in my above comment - there is no CBitmap::Blt function.  I always forget in MFC you call BitBlt from the CDC class.
   I'm sure this is not the way to go, but you can always get complete info on a bitmap simply by reading from the BMP directly.  The first section of the BMP file is always a BITMAPFILEHEADER structure and the second is always a BITMAPINFOHEADER structure.  THEN, depending on what's in those two structures tells you what the rest of the BMP file contains.  You mentioned you needed info on the bitmap before Blt - most likely you need width,height, bit count (bpp) and image size which are all contained in the BITMAPINFOHEADER.
   Glenn
0
SlartiAuthor Commented:
Thanks for your comments everyone.

udia: I looked up DrawDib and it sounds interesting. However, it looks like the drawing is into direct screen coordinates, i.e. not into a window. Is this true? If so, could you or anyone else give me some code that will translate window coordinates to screen coordinates? (I need, for example, to be able to put the video in a resizable window, preferably with scroll bars).

Glenn: You are referring to the part of creating the bitmap. I know how to handle this part, I've done so before. I am looking for information on the fastest way to draw the bitmap on screen.
0
SlartiAuthor Commented:
I am actually not too sure about what I said in the last comment, about drawing into screen coordinates. The function DrawDibBegin() has a HDC parameter which is described as "Handle of a DC for drawing. This parameter is optional." Typical Microsoft online help phrazing: it tells me only what I don't need to know.

Does anybody know what this parameter does? In particular, does it cause DrawDib to plot into the coordinates limited by the supplied DC? If so, that's what I need.
0
SlartiAuthor Commented:
Since this thread has died down, and I have not received answers to some of my more specific answer, I will accept udia's last comment as an answer with grade C. Thank you everyone for your participation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.