MPEG2 Video Capture to a BMP

G

Guest

We have an application that has a propriotary mpeg2 player. The API of the version I am currently using does not provide an interface to get a bitmap of the current image being displayed. I have spent the day searching for video capture from web cam devices, etc. and I think I am on the right path to solving my problem but I am definitly missing something
I am using the capCreateCaptureWindowA function in "avicap32.dll" to create a capture window and this happens, but the window only displays black. My code is as follows

frm is a variable of a specific form that contains my OCX video playe
f is a new window opened to be the parent of the CaptureWindo

hwndc = capCreateCaptureWindowA("CaptureWindow", WS_CHILD Or WS_VISIBLE, 0, 0, 300, 300, f.Handle.ToInt32, 0
If (hwndc <> 0) The
temp = CStr(SendMessage(hwndc, WM_CAP_DRIVER_CONNECT, frm.AxVideoPlayer.Handle.ToInt32, 0)
temp = CStr(SendMessage(hwndc, WM_CAP_SET_PREVIEW, 1, 1)
temp = CStr(SendMessage(hwndc, WM_CAP_SET_PREVIEWRATE, 66, 0)

temp = CStr(SendMessage(hwndc, WM_CAP_EDIT_COPY, 1, 0)
Dim data As IDataObjec
data = Clipboard.GetDataObjec

End I
My questions/confusion.... The data being placed on the clipboard is text, not my image :
I have found several constants values for the SendMessage API but I have also discovered I am missing a whole bunch more, is there someplace I can find these and also is there a list of the functions available in the avicap32.dll ?? Or do I just add an "A" to the end of these function calls to make them work? I'm not even sure if the wParm and lParm variables I am passing to SendMessage are correct anymore so I was wondering if that is documented somewhere also !

There are business reasons for using this player so any MediaPlayer Interop is not an option
TI
Jon Cred
Please_No_SPam_CreditJ@Panthers_nfl_com_no_spam
 
J

Joe Delekto

Greets,

If you have the latest Platform SDK installed, you can look at the VFW.H
header file which has the #defines to call the approprate cap* API functions
depending upon whether or not you are building for ANSI or unicode. These
functions are documented in MSDN. Furthermore, the Platform SDK also has an
excellent sample that you can examine found in the samples folder under the
Platform SDK installation folder called "WinCap32":

Platform SDK\Samples\Multimedia\Gdi\WinCap32

Regards,

Joe

JonnyRedBike said:
We have an application that has a propriotary mpeg2 player. The API of the
version I am currently using does not provide an interface to get a bitmap
of the current image being displayed. I have spent the day searching for
video capture from web cam devices, etc. and I think I am on the right path
to solving my problem but I am definitly missing something.
I am using the capCreateCaptureWindowA function in "avicap32.dll" to
create a capture window and this happens, but the window only displays
black. My code is as follows:
frm is a variable of a specific form that contains my OCX video player
f is a new window opened to be the parent of the CaptureWindow

hwndc = capCreateCaptureWindowA("CaptureWindow", WS_CHILD Or
WS_VISIBLE, 0, 0, 300, 300, f.Handle.ToInt32, 0)
If (hwndc <> 0) Then
temp = CStr(SendMessage(hwndc, WM_CAP_DRIVER_CONNECT,
frm.AxVideoPlayer.Handle.ToInt32, 0))
temp = CStr(SendMessage(hwndc, WM_CAP_SET_PREVIEW, 1, 1))
temp = CStr(SendMessage(hwndc, WM_CAP_SET_PREVIEWRATE, 66, 0))

temp = CStr(SendMessage(hwndc, WM_CAP_EDIT_COPY, 1, 0))
Dim data As IDataObject
data = Clipboard.GetDataObject

End If
My questions/confusion.... The data being placed on the clipboard is text, not my image :(
I have found several constants values for the SendMessage API but I have
also discovered I am missing a whole bunch more, is there someplace I can
find these and also is there a list of the functions available in the
avicap32.dll ?? Or do I just add an "A" to the end of these function calls
to make them work? I'm not even sure if the wParm and lParm variables I am
passing to SendMessage are correct anymore so I was wondering if that is
documented somewhere also !!
 
J

Jon Credit

Thanks Joe,
I'll have a look at this in the morning and let you know how I make
out.

Thanks again
--Jon
 
J

Joe Delekto

Greets,

If you are looking to just capture an image which is being displayed on
an applications window, then using the capture API isn't going to help. It
is mainly for capture devices such as cameras, TV cards, etc. Without
actually hooking into the API calls which are used to display the bitmap in
the application, another alternative is to capture a bitmap image of the
window and store it that way. However, you are probably better off finding
some way to do this in DirectMedia, unfortunately, this is something with
which I am not familiar.

Regards,

Joe

Jon Credit said:
I have installed the Platform SDK and have found the vfw.h file for all my
constants. I think my first problem is I am not able to find a capture
driver. This is leading me to think avicap32.dll may not be the approach I
need to take here.
I have run through the loop:
For i = 0 To 9
szDeviceName = "".PadRight(80)
szDeviceVersion = "".PadRight(80)
capGetDriverDescriptionA(i, szDeviceName, 80, szDeviceVersion, 80)
Next
and szDeviceName is always an empty string
I also noticed that my call to
intResult = SendMessage(hWnd, WM_CAP_DRIVER_CONNECT, 0, 0)
is always 0, but I am thinking this is because I cannot find a capture
driver and I am not putting the correct value in the wParm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top