diff options
author | scuri <scuri> | 2010-04-25 21:51:28 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-04-25 21:51:28 +0000 |
commit | dfde7e17c5018ec5ff73ad8c4165441b315c16aa (patch) | |
tree | fea2cd90998201c6312c6487bbc8844de719af14 | |
parent | dc3e637a5f44f579060985bc615b814c74eb4de4 (diff) |
New: function imVideoCaptureReleaseDevices.
-rw-r--r-- | html/en/history.html | 8 | ||||
-rw-r--r-- | include/im_capture.h | 6 | ||||
-rw-r--r-- | src/im_capture.def | 2 | ||||
-rw-r--r-- | src/im_capture_dx.cpp | 15 | ||||
-rw-r--r-- | src/lua5/imlua_capture.c | 15 |
5 files changed, 39 insertions, 7 deletions
diff --git a/html/en/history.html b/html/en/history.html index 744eb41..80446f5 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -12,6 +12,14 @@ <h2>History of Changes</h2> <h3 dir="ltr"> + CVS (25/Apr/2010)</h3> +<ul dir="ltr"> + <li dir="ltr"><span style="color: #008000"> + <span + style="color: #000000"> <span style="color: #0000FF">New:</span> + function <strong>imVideoCaptureReleaseDevices</strong>.</span></span></li> +</ul> +<h3 dir="ltr"> <a href="http://sourceforge.net/projects/imtoolkit/files/3.6.1/">Version 3.6.1</a> (23/Apr/2010)</h3> <ul dir="ltr"> <li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span diff --git a/include/im_capture.h b/include/im_capture.h index bc5f732..ae8e2c2 100644 --- a/include/im_capture.h +++ b/include/im_capture.h @@ -68,6 +68,12 @@ const char* IM_DECL imVideoCaptureDeviceVendorInfo(int device); * \ingroup capture */ int IM_DECL imVideoCaptureReloadDevices(void); +/** Release the device list. Usefull is you need to track leak erros in your application. + * + * \verbatim im.imVideoCaptureReleaseDevices() [in Lua 5] \endverbatim + * \ingroup capture */ +void IM_DECL imVideoCaptureReleaseDevices(void); + /** Creates a new imVideoCapture object. \n * Returns NULL if there is no capture device available. \n * In Windows returns NULL if DirectX version is older than 8. \n diff --git a/src/im_capture.def b/src/im_capture.def index 6b44ac3..19560fc 100644 --- a/src/im_capture.def +++ b/src/im_capture.def @@ -25,3 +25,5 @@ EXPORTS imVideoCaptureDeviceExDesc imVideoCaptureDevicePath imVideoCaptureDeviceVendorInfo + imVideoCaptureReleaseDevices +
\ No newline at end of file diff --git a/src/im_capture_dx.cpp b/src/im_capture_dx.cpp index cb4749b..fcd6d98 100644 --- a/src/im_capture_dx.cpp +++ b/src/im_capture_dx.cpp @@ -2,7 +2,7 @@ * \brief Video Capture Using Direct Show 9 * * See Copyright Notice in im.h - * $Id: im_capture_dx.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_capture_dx.cpp,v 1.2 2010/04/25 21:51:29 scuri Exp $ */ /* @@ -240,7 +240,7 @@ struct vcDevice static vcDevice vc_DeviceList[VC_MAXVIDDEVICES]; static int vc_DeviceCount = 0; -static void vc_AddDevice(IBaseFilter *filter, char* desc, char* ex_desc, char* path, char* vendorinfo) +static void vc_AddDevice(IBaseFilter *filter, const char* desc, const char* ex_desc, const char* path, const char* vendorinfo) { int i = vc_DeviceCount; vcDevice* device = &vc_DeviceList[i]; @@ -596,14 +596,19 @@ int imVideoCaptureDeviceCount(void) return vc_DeviceCount; } -int imVideoCaptureReloadDevices(void) +void imVideoCaptureReleaseDevices(void) { for (int i = 0; i < vc_DeviceCount; i++) { vc_DeviceList[i].filter->Release(); } - vc_DeviceCount = 0; +} + +int imVideoCaptureReloadDevices(void) +{ + imVideoCaptureReleaseDevices(); + vc_EnumerateDevices(); return vc_DeviceCount; } @@ -1291,7 +1296,7 @@ static void vc_GetFormatName(GUID subtype, char* desc) desc[0] = (char)(subtype.Data1); desc[1] = (char)(subtype.Data1 >> 8); desc[2] = (char)(subtype.Data1 >> 16); - desc[3] = (char)(subtype.Data1 >> 32); + desc[3] = (char)(subtype.Data1 >> 24); desc[4] = 0; } diff --git a/src/lua5/imlua_capture.c b/src/lua5/imlua_capture.c index 59ec0fb..3029cd5 100644 --- a/src/lua5/imlua_capture.c +++ b/src/lua5/imlua_capture.c @@ -2,7 +2,7 @@ * \brief IM Lua 5 Binding * * See Copyright Notice in im_lib.h - * $Id: imlua_capture.c,v 1.2 2009/08/12 04:09:17 scuri Exp $ + * $Id: imlua_capture.c,v 1.3 2010/04/25 21:51:29 scuri Exp $ */ #include <string.h> @@ -68,7 +68,7 @@ static int imluaVideoCaptureDeviceDesc (lua_State *L) } /*****************************************************************************\ - im.VideoCaptureDeviceDesc(device) + im.VideoCaptureReloadDevices() \*****************************************************************************/ static int imluaVideoCaptureReloadDevices (lua_State *L) { @@ -77,6 +77,16 @@ static int imluaVideoCaptureReloadDevices (lua_State *L) } /*****************************************************************************\ + im.VideoCaptureReleaseDevices() +\*****************************************************************************/ +static int imluaVideoCaptureReleaseDevices (lua_State *L) +{ + (void)L; + imVideoCaptureReleaseDevices(); + return 0; +} + +/*****************************************************************************\ im.VideoCaptureCreate() \*****************************************************************************/ static int imluaVideoCaptureCreate (lua_State *L) @@ -381,6 +391,7 @@ static const luaL_reg imcapture_lib[] = { {"VideoCaptureDeviceCount", imluaVideoCaptureDeviceCount}, {"VideoCaptureDeviceDesc", imluaVideoCaptureDeviceDesc}, {"VideoCaptureReloadDevices", imluaVideoCaptureReloadDevices}, + {"VideoCaptureReleaseDevices", imluaVideoCaptureReleaseDevices}, {"VideoCaptureCreate", imluaVideoCaptureCreate}, {"VideoCaptureDestroy", imluaVideoCaptureDestroy}, {NULL, NULL} |