I am using directshow api to capture video. I have created a graph to
capture the video which works fine.
I faced an image interlacing problem to fix that I made the change to
use VIDEOINFOHEADER2 instead of VIDEOINFOHEADER
But a new problem has sprung up. The images capture with
VIDEOINFOHEADER2 are of size 320 by 240 where as earlier using the
VIDEOINFOHEADER the images were being captured of size 640 by 480.
Given below is the code for setting the video info parameter. This is
same both incase of VIDEOINFOHEADER and VIDEOINFOHEADER2.
stream_config_interface->GetFormat(&media_type);
VIDEOINFOHEADER2 *video_info_header =
reinterpret_cast<VIDEOINFOHEADER2 *>( media_type->pbFormat);
video_info_header->bmiHeader.biWidth = 640;
video_info_header->bmiHeader.biHeight = 480;
video_info_header->bmiHeader.biSizeImage =
640*480*HEADER_BYTES; // HEADER_BYTES = 3
But using the VIDEOINFOHEADER2 causes the image size as 320 by 240.
I also tried setting the rcTarget parameters as follows:-
video_info_header->rcTarget.left = 0;
video_info_header->rcTarget.top = 0;
video_info_header->rcTarget.right = 640;
video_info_header->rcTarget.bottom = 480;
Also before get current image calll basic_video->GetCurrentImage
(&bufSize, NULL); i tried setting the Destination Position as 640 by
480
basic_video->SetDestinationPosition(0,0,640,480);
but the image is still coming out to be 320 by 240
Why is this change in image size happening? How can this be fixed?
Thanks in advance.
Regards
Albert
Hi,
I checked it further... media_type->formattype is FORMAT_VideoInfo so
casting it to VIDEOINFOHEADER2 doesn;t seem to be the right approach
here...
I also tried to set the media_type->formattype to FORMAT_VideoInfo2
but also fails.
Is there a way to set the formattype to FORMAT_VideoInfo2 and use
VIDEOINFOHEADER2?
Regards
Albert
What you should do is call GetNumberOfCapabilities() and GetStreamCaps
() to find media types the device supports, pick one that works for
you, and call SetFormat() with that media type.
Alex,