Hello all,
I'm trying to implement this interface into either a C++ dll or into the DirectShowNet dll. This interface is used by the PGR type cameras to access any register on the camera. I need to access some of these registers that aren't covered by the standard ProcAMP registers. Any suggestions/guidence would be greatly appreciated.
the C++ API code from PGR for DirectShow: -
#include <ks.h>
-
#include <ksproxy.h>
-
#include "PGRKSMedia.h"
-
-
DECLARE_INTERFACE_(IPGRInterface, IUnknown )
-
{
-
STDMETHOD (GetRegister) ( THIS_ long lRegister, long *plValue ) PURE;
-
STDMETHOD (SetRegister) ( THIS_ long lRegister, long lValue ) PURE;
-
};
-
In the PGRKSMedia.h file contains the GUID and structures for the methods: -
#include <ks.h>
-
#include <ksproxy.h>
-
#include <ksmedia.h>
-
/**
-
* GUID identifying the custom properties that are exported by the driver.
-
*/
-
DEFINE_GUID( PROPSETID_CUSTOM, 0xdae50fa6, 0x1dac, 0x4913, 0x98, 0x41, 0x8e, 0xd3, 0xab, 0x3f, 0xeb, 0x4 );
-
-
//===========================================================================
-
// {DAE50FA6-1DAC-4913-9841-8ED3AB3FEB04}
-
#define STATIC_PROPSETID_CUSTOM\
-
0xdae50fa6, 0x1dac, 0x4913, 0x98, 0x41, 0x8e, 0xd3, 0xab, 0x3f, 0xeb, 0x4
-
// {DAE50FA6-1DAC-4913-9841-8ED3AB3FEB04}
-
DEFINE_GUIDSTRUCT("dae50fa6-1dac-4913-9841-8ed3ab3feb04", PROPSETID_CUSTOM);
-
#define PROPSETID_CUSTOM DEFINE_GUIDNAMED(PROPSETID_CUSTOM)
-
-
/**
-
* enumeration of the custom property identifiers.
-
*/
-
typedef enum
-
{
-
KSPROPERTY_CUSTOM_REGISTER, // RWO
-
KSPROPERTY_CUSTOM_FORMAT7,
-
} KSPROPERTY_CUSTOM;
-
/**
-
* Structure used for getting and setting of registers on the camera.
-
*/
-
typedef struct
-
{
-
KSPROPERTY Property;
-
ULONG StreamIndex;
-
ULONG ulRegister;
-
ULONG ulRegisterValue;
-
} KSPROPERTY_CUSTOM_REGISTER_S, *PKSPROPERTY_CUSTOM_REGISTER_S;
-
I'm assuming to get these to work i would need to be able to define the KSPROPERTY type in C# or create a public interface in C++ i can access in C#.
Thanks for any comments.
2 2294
Refer this, Revert back if u have any issues
http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/
:)
I was able to convert all the code into C#. See below. -
IKsPropertySet pKs = ibf as IKsPropertySet;
-
KSPropertySupport dwSupported = new KSPropertySupport();
-
-
hr = pKs.QuerySupported(PROPSETID_CUSTOM, (int)KSPROPERTY_CUSTOM.KSPROPERTY_CUSTOM_REGISTER, out dwSupported);
-
-
if (dwSupported == (KSPropertySupport.Get | KSPropertySupport.Set))
-
{
-
hr = 0;
-
}
-
-
KSPROPERTY_CUSTOM_REGISTER_S cRegisterStr = new KSPROPERTY_CUSTOM_REGISTER_S();
-
cRegisterStr.ulRegister = regNumber;
-
-
IntPtr regData = Marshal.AllocCoTaskMem(Marshal.SizeOf(cRegisterStr));
-
IntPtr instData = Marshal.AllocCoTaskMem(Marshal.SizeOf(cRegisterStr));
-
int cbBytes = 0;
-
-
Marshal.StructureToPtr(cRegisterStr, regData, true);
-
Marshal.StructureToPtr(cRegisterStr, instData, true);
-
-
hr = pKs.Get(PROPSETID_CUSTOM,
-
(int)KSPROPERTY_CUSTOM.KSPROPERTY_CUSTOM_REGISTER,
-
instData,
-
Marshal.SizeOf(cRegisterStr),
-
regData,
-
Marshal.SizeOf(cRegisterStr),
-
out cbBytes);
-
DsError.ThrowExceptionForHR(hr);
-
-
cRegisterStr.ulRegisterValue = regValue;
-
Marshal.StructureToPtr(cRegisterStr, regData, true);
-
Marshal.StructureToPtr(cRegisterStr, instData, true);
-
-
hr = pKs.Set(PROPSETID_CUSTOM,
-
(int)KSPROPERTY_CUSTOM.KSPROPERTY_CUSTOM_REGISTER,
-
instData,
-
Marshal.SizeOf(cRegisterStr),
-
regData,
-
Marshal.SizeOf(cRegisterStr));
-
DsError.ThrowExceptionForHR(hr);
-
-
if (regData != IntPtr.Zero)
-
{
-
Marshal.FreeCoTaskMem(regData);
-
}
-
if (instData != IntPtr.Zero)
-
{
-
Marshal.FreeCoTaskMem(instData);
-
}
-
Now I just have to figure out why i can't do Marshal.PtrToStructure(regData, cRegisterStr) and pull the information back into a structure to look at.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul Shaw |
last post by:
Can anyone explain why an insert might cause multiple logical
bufferpool data reads?
Here's a situation that has me scratching my head.
Table A's data resides in tablespace B
Table A's...
|
by: Rattanak Song |
last post by:
Hi,
I'm trying to build a database which can capture a still image from a
digital camera or web cam and import to the database via an Object or
something like that.
Any help would be very...
|
by: silentlights |
last post by:
Hi Guys, I am looking for an alternative means of register access in a
microcontroller. Currently my get() function looks like this..
------------------------
implementation in comm.c...
|
by: Stupid48 |
last post by:
I have this Pentax Optio camera and I want to access it via vb.net. I
would like to write something where I can snap the picture from the
application and it automatically acquires the image from...
|
by: =?Utf-8?B?RGljaw==?= |
last post by:
I'd like to read a file's "extended" properties, i.e. for some JPEG images
taken with a digital camera, I'd like to read the "Date Picture Taken"
property. I can see this property from the Summary...
|
by: sanoyhm |
last post by:
Hello guys, how r u doing? I'm doing a final year project, Gesture recognition and am using video camera and vb.net for my project. But am now facing a problem and am in need of ur help.Is there a...
|
by: ak1dnar |
last post by:
Hi,
I need a big favour from you guys.Need to know how to set up a IP camera to access that using Internet.
Before I start need to say, I am not from the same stream as you guys. Just a web...
|
by: Berco Beute |
last post by:
I've been trying to access my webcam using Python, but I failed
miserably. The camera works fine under Ubuntu (using camora and
skype), but I am unable to get WebCamSpy or libfg to access my...
|
by: =?Utf-8?B?anAybXNmdA==?= |
last post by:
You're going to need to start with the driver for the camera - otherwise,
your application might run into problems finding where the video is.
Next, search (i.e. Google) into Twain Aquire...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |