Directdraw: Rotate video stream

前端 未结 2 1776
庸人自扰
庸人自扰 2021-01-23 16:51

Problem

Windows Mobile / Directdraw: Rotate video stream

The video preview is working, all I need now is a way to rotate the image. I think the

相关标签:
2条回答
  • 2021-01-23 17:04

    Well if you look at the EZRGB24 sample you get the basics of a simple video transform filter.

    There are 2 things you need to do to the sample to get it to do what you want.

    1) You need to copy x,y to y,x.
    2) You need to tell the media sample that the sample is now Height x Width instead of Width x Height.

    Bear in mind that the final image will have exactly the same number of pixels.

    To solve 1 is relatively simple. You can calculate the position of a pixel by doing "x + (y * Width)". So you step through each x and y calculate the position that way and then write it to "y + (x * Height)". This will transpose the image. Of course without step2 this will look completely wrong.

    To solve 2 you need to get the AM_MEDIA_TYPE of the input sample. You then need to find out what the formatType is (Probably FormatType_VideoInfo or FormatType_VideoInfo2). You can thus cast the pbFormat member of AM_MEDIA_TYPE to either a VIDEOINFOHEADER or a VIDEOINFOHEADER2 (Depending on the FormatType). You need to now set VIDEOINFOHEADER[2]::bmiHeader.biWidth and biHeight to the biHeight and biWidth (respectively) of the input media sample. Everything else should be the same as the input AM_MEDIA_TYPE.

    I hope that helps a bit.

    0 讨论(0)
  • 2021-01-23 17:14

    This question will help you get some details about DirectDraw. I did some research about this some time ago and the best I could find was this blog post (also mentioned in the above question). The post presents an extension of the CameraCapture sample in the SDK.

    However, don't have high expectations. It seems that the preview and the picture taken will only work in small resolution. Although DirectDraw does describe a way of configuring the resolution, there is no guarantee that this will be properly implemented by the driver.

    So from my experience what you have read is true. The only way to do it will be to use HTC drivers. So, if you don't want to spend endless days in reverse engineering for a doubtful result, let someone else do the job for you. If you want to give it a shot, try xda-developers forum.

    0 讨论(0)
提交回复
热议问题