views:

312

answers:

1

Follow up from: http://stackoverflow.com/questions/2289637/windows-mobile-directdraw-display-video-stream-take-picture

I managed to preview the camera's video stream, but the image is rotated by 90° to landscape mode. I'm now searching for a way to rotate the camera image back to normal, but the problem is I don't even know where to start: Is this done in the VideoCaptureFilter, the VideoInfoHeader, in a DDSURFACEDESC structure? Can the rotation only be done by using an additional filter? Is it a filter setting?

+1  A: 

I found out that this is usually done with the BI_SRCPREROTATE flag:

A special flag was developed (BI_SRCPREROTATE) which tells GDI and the video renderer that the orientation of the image from the camera is in the correct orientation (don't rotate when rendering it). This is necessary because as you rotate the shell on the device you also physically rotate the device. When the display driver rotates bitmaps to render the shell and UI it needs to know that this particular bitmap shouldn't be rotated. The flag is or'd into the biCompression field in the BITMAPINFO structure.

From http://www.tech-archive.net/Archive/PocketPC/microsoft.public.pocketpc.developer/2005-12/msg00850.html

Sample code might look like this:

  pVih->bmiHeader.biCompression &= ~BI_SRCPREROTATE;

From http://innovator.samsungmobile.com/bbs/discussion/view.do?parentCategoryId=4&messageId=45549&boardId=224&platformId=2

This method however is not working with the HTC HD2 I am using, but it might work with other devices, so I decided to add this to my question.

xsl