Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

776 lines
21 KiB

  1. /*
  2. * Copyright (c) 1996 1997, 1998 Philips CE I&C
  3. * FILE PRPCOM.CPP
  4. * DATE 7-1-97
  5. * VERSION 1.00
  6. * AUTHOR M.J. Verberne
  7. * DESCRIPTION Property transfer
  8. * HISTORY
  9. */
  10. #include <windows.h>
  11. #include <winioctl.h>
  12. #include <olectl.h>
  13. #include <ks.h>
  14. #include <ksmedia.h>
  15. #include <ksguid.h>
  16. #include "enre.h"
  17. #include "debug.h"
  18. #include "prpcom.h"
  19. #include "phvcmext.h"
  20. /*======================== DEFINES =======================================*/
  21. #define FILE_DEVICE_KS 0x0000002f // needed by ks header,
  22. // bug of Microsoft
  23. /*======================== DATA TYPES ====================================*/
  24. typedef struct {
  25. KSPROPERTY_DESCRIPTION PropertyDescription;
  26. KSPROPERTY_MEMBERSHEADER MembersHeader;
  27. ULONG DefaultValue;
  28. } VIDEOPROCAMP_DEFAULTLIST;
  29. typedef struct {
  30. KSPROPERTY_DESCRIPTION PropertyDescription;
  31. KSPROPERTY_MEMBERSHEADER MembersHeader;
  32. KSPROPERTY_STEPPING_LONG SteppingLong;
  33. } VIDEOPROCAMP_MEMBERSLIST;
  34. /*======================== LOCAL FUNCTION DEFINITIONS ====================*/
  35. static BOOL PRPCOM_GetVideoProcAmpPropertyValue(
  36. LPFNEXTDEVIO pfnDeviceIoControl,
  37. LPARAM lParam,
  38. ULONG ulPropertyId,
  39. PLONG plValue);
  40. static BOOL PRPCOM_SetVideoProcAmpPropertyValue(
  41. LPFNEXTDEVIO pfnDeviceIoControl,
  42. LPARAM lParam,
  43. ULONG ulPropertyId,
  44. LONG lValue);
  45. static BOOL PRPCOM_GetVideoProcAmpPropertyRange(
  46. LPFNEXTDEVIO pfnDeviceIoControl,
  47. LPARAM lParam,
  48. ULONG ulPropertyId,
  49. PLONG plMin,
  50. PLONG plMax);
  51. static BOOL PRPCOM_GetCustomPropertyValue(
  52. LPFNEXTDEVIO pfnDeviceIoControl,
  53. LPARAM lParam,
  54. ULONG ulPropertyId,
  55. PLONG plValue);
  56. static BOOL PRPCOM_SetCustomPropertyValue(
  57. LPFNEXTDEVIO pfnDeviceIoControl,
  58. LPARAM lParam,
  59. ULONG ulPropertyId,
  60. LONG lValue);
  61. static BOOL PRPCOM_GetCustomPropertyRange(
  62. LPFNEXTDEVIO pfnDeviceIoControl,
  63. LPARAM lParam,
  64. ULONG ulPropertyId,
  65. PLONG plMin,
  66. PLONG plMax);
  67. static BOOL PRPCOM_ExtDeviceIoControl(
  68. LPFNEXTDEVIO pfnDeviceIoControl,
  69. LPARAM lParam,
  70. DWORD dwVfWFlags,
  71. DWORD dwIoControlCode,
  72. LPVOID lpInBuffer,
  73. DWORD cbInBufferSize,
  74. LPVOID lpOutBuffer,
  75. DWORD cbOutBufferSize,
  76. LPDWORD pcbReturned);
  77. #ifdef _DEBUG
  78. static void PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyValue(
  79. ULONG ulPropertyId,
  80. PLONG plValue,
  81. BOOL bRet);
  82. static void PRPCOM_Debug_PRPCOM_SetVideoProcAmpPropertyValue(
  83. ULONG ulPropertyId,
  84. LONG lValue,
  85. BOOL bRet);
  86. static void PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyRange(
  87. ULONG ulPropertyId,
  88. PLONG plMin,
  89. PLONG plMax,
  90. BOOL bRet);
  91. static void PRPCOM_Debug_GetVideoProcAmpPropertyIdStr(
  92. ULONG ulPropertyId,
  93. char *PropertyIdStr,
  94. UINT MaxLen);
  95. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyValue(
  96. ULONG ulPropertyId,
  97. PLONG plValue,
  98. BOOL bRet);
  99. static void PRPCOM_Debug_PRPCOM_SetCustomPropertyValue(
  100. ULONG ulPropertyId,
  101. LONG lValue,
  102. BOOL bRet);
  103. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyRange(
  104. ULONG ulPropertyId,
  105. PLONG plMin,
  106. PLONG plMax,
  107. BOOL bRet);
  108. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyIdStr(
  109. ULONG ulPropertyId,
  110. char *PropertyIdStr,
  111. UINT MaxLen);
  112. #endif
  113. /*======================== EXPORTED FUNCTIONS =============================*/
  114. /*-------------------------------------------------------------------------*/
  115. BOOL PRPCOM_HasDeviceChanged(
  116. LPFNEXTDEVIO pfnDeviceIoControl,
  117. LPARAM lParam)
  118. /*-------------------------------------------------------------------------*/
  119. {
  120. BOOL bRet = TRUE;
  121. bRet = pfnDeviceIoControl (
  122. lParam,
  123. VFW_QUERY_DEV_CHANGED,
  124. 0,0,0,0,0,0, 0);
  125. return bRet;
  126. }
  127. /*-------------------------------------------------------------------------*/
  128. BOOL PRPCOM_Get_Value(
  129. GUID PropertySet,
  130. ULONG ulPropertyId,
  131. LPFNEXTDEVIO pfnDeviceIoControl,
  132. LPARAM lParam,
  133. PLONG plValue)
  134. /*-------------------------------------------------------------------------*/
  135. {
  136. BOOL bResult;
  137. if (IsEqualGUID(PropertySet, PROPSETID_VIDCAP_VIDEOPROCAMP))
  138. {
  139. // get VIDEOPROCAMP value
  140. bResult = PRPCOM_GetVideoProcAmpPropertyValue(
  141. pfnDeviceIoControl,
  142. lParam,
  143. ulPropertyId,
  144. plValue);
  145. }
  146. else if (IsEqualGUID(PropertySet, PROPSETID_PHILIPS_CUSTOM_PROP))
  147. {
  148. // get custom value
  149. bResult = PRPCOM_GetCustomPropertyValue(
  150. pfnDeviceIoControl,
  151. lParam,
  152. ulPropertyId,
  153. plValue);
  154. }
  155. else
  156. return FALSE;
  157. return bResult;
  158. }
  159. /*-------------------------------------------------------------------------*/
  160. BOOL PRPCOM_Set_Value(
  161. GUID PropertySet,
  162. ULONG ulPropertyId,
  163. LPFNEXTDEVIO pfnDeviceIoControl,
  164. LPARAM lParam,
  165. LONG lValue)
  166. /*-------------------------------------------------------------------------*/
  167. {
  168. BOOL bResult;
  169. if (IsEqualGUID(PropertySet, PROPSETID_VIDCAP_VIDEOPROCAMP))
  170. {
  171. // set VIDEOPROCAMP value
  172. bResult = PRPCOM_SetVideoProcAmpPropertyValue(
  173. pfnDeviceIoControl,
  174. lParam,
  175. ulPropertyId,
  176. lValue);
  177. }
  178. else if (IsEqualGUID(PropertySet, PROPSETID_PHILIPS_CUSTOM_PROP))
  179. {
  180. // set custom value
  181. bResult = PRPCOM_SetCustomPropertyValue(
  182. pfnDeviceIoControl,
  183. lParam,
  184. ulPropertyId,
  185. lValue);
  186. }
  187. else
  188. return FALSE;
  189. return bResult;
  190. }
  191. /*-------------------------------------------------------------------------*/
  192. BOOL PRPCOM_Get_Range(
  193. GUID PropertySet,
  194. ULONG ulPropertyId,
  195. LPFNEXTDEVIO pfnDeviceIoControl,
  196. LPARAM lParam,
  197. PLONG plMin, PLONG plMax)
  198. /*-------------------------------------------------------------------------*/
  199. {
  200. BOOL bResult;
  201. if (IsEqualGUID(PropertySet, PROPSETID_VIDCAP_VIDEOPROCAMP))
  202. {
  203. // get VIDEOPROCAMP range
  204. bResult = PRPCOM_GetVideoProcAmpPropertyRange(
  205. pfnDeviceIoControl,
  206. lParam,
  207. ulPropertyId,
  208. plMin,
  209. plMax);
  210. }
  211. else if (IsEqualGUID(PropertySet, PROPSETID_PHILIPS_CUSTOM_PROP))
  212. {
  213. // get custom range
  214. bResult = PRPCOM_GetCustomPropertyRange(
  215. pfnDeviceIoControl,
  216. lParam,
  217. ulPropertyId,
  218. plMin,
  219. plMax);
  220. }
  221. else
  222. return FALSE;
  223. return bResult;
  224. }
  225. /*======================== LOCAL FUNCTIONS ================================*/
  226. /*-------------------------------------------------------------------------*/
  227. static BOOL PRPCOM_GetVideoProcAmpPropertyValue(
  228. LPFNEXTDEVIO pfnDeviceIoControl,
  229. LPARAM lParam,
  230. ULONG ulPropertyId,
  231. PLONG plValue)
  232. /*-------------------------------------------------------------------------*/
  233. {
  234. BOOL bRet;
  235. DWORD cbRet;
  236. KSPROPERTY_VIDEOPROCAMP_S VideoProperty;
  237. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_VIDEOPROCAMP_S) );
  238. VideoProperty.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
  239. VideoProperty.Property.Id = ulPropertyId;
  240. VideoProperty.Property.Flags = KSPROPERTY_TYPE_GET;
  241. VideoProperty.Flags = 0;
  242. VideoProperty.Capabilities = 0;
  243. if ((bRet = PRPCOM_ExtDeviceIoControl(
  244. pfnDeviceIoControl,
  245. lParam,
  246. VFW_USE_DEVICE_HANDLE,
  247. IOCTL_KS_PROPERTY,
  248. &VideoProperty,
  249. sizeof(VideoProperty),
  250. &VideoProperty,
  251. sizeof(VideoProperty),
  252. &cbRet)))
  253. {
  254. if (plValue != NULL)
  255. *plValue = VideoProperty.Value;
  256. /* if (pulFlags != NULL)
  257. *pulFlags = VideoProperty.Flags;
  258. if (pulCapabilities != NULL)
  259. *pulCapabilities = VideoProperty.Capabilities;*/
  260. }
  261. #ifdef _DEBUG
  262. PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyValue(ulPropertyId, plValue, bRet);
  263. #endif
  264. return bRet;
  265. }
  266. /*-------------------------------------------------------------------------*/
  267. static BOOL PRPCOM_SetVideoProcAmpPropertyValue(
  268. LPFNEXTDEVIO pfnDeviceIoControl,
  269. LPARAM lParam,
  270. ULONG ulPropertyId,
  271. LONG lValue)
  272. /*-------------------------------------------------------------------------*/
  273. {
  274. BOOL bRet;
  275. DWORD cbRet;
  276. KSPROPERTY_VIDEOPROCAMP_S VideoProperty;
  277. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_VIDEOPROCAMP_S) );
  278. VideoProperty.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
  279. VideoProperty.Property.Id = ulPropertyId;
  280. VideoProperty.Property.Flags = KSPROPERTY_TYPE_SET;
  281. VideoProperty.Value = lValue;
  282. VideoProperty.Flags = 0;
  283. VideoProperty.Capabilities = 0;
  284. bRet = PRPCOM_ExtDeviceIoControl(
  285. pfnDeviceIoControl,
  286. lParam,
  287. VFW_USE_DEVICE_HANDLE,
  288. IOCTL_KS_PROPERTY,
  289. &VideoProperty,
  290. sizeof(VideoProperty),
  291. &VideoProperty,
  292. sizeof(VideoProperty),
  293. &cbRet);
  294. #ifdef _DEBUG
  295. PRPCOM_Debug_PRPCOM_SetVideoProcAmpPropertyValue(ulPropertyId, lValue, bRet);
  296. #endif
  297. return bRet;
  298. }
  299. /*-------------------------------------------------------------------------*/
  300. static BOOL PRPCOM_GetVideoProcAmpPropertyRange(
  301. LPFNEXTDEVIO pfnDeviceIoControl,
  302. LPARAM lParam,
  303. ULONG ulPropertyId,
  304. PLONG plMin,
  305. PLONG plMax)
  306. /*-------------------------------------------------------------------------*/
  307. {
  308. BOOL bRet;
  309. DWORD cbRet;
  310. KSPROPERTY_VIDEOPROCAMP_S VideoProperty;
  311. VIDEOPROCAMP_MEMBERSLIST PropertyList;
  312. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_VIDEOPROCAMP_S) );
  313. VideoProperty.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
  314. VideoProperty.Property.Id = ulPropertyId;
  315. VideoProperty.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT;
  316. VideoProperty.Flags = 0;
  317. VideoProperty.Capabilities = 0;
  318. bRet = PRPCOM_ExtDeviceIoControl(
  319. pfnDeviceIoControl,
  320. lParam,
  321. VFW_USE_DEVICE_HANDLE,
  322. IOCTL_KS_PROPERTY,
  323. &VideoProperty,
  324. sizeof(VideoProperty),
  325. &PropertyList,
  326. sizeof(PropertyList),
  327. &cbRet);
  328. if (plMin != NULL)
  329. *plMin = PropertyList.SteppingLong.Bounds.SignedMinimum;
  330. if (plMax != NULL)
  331. *plMax = PropertyList.SteppingLong.Bounds.SignedMaximum;
  332. #ifdef _DEBUG
  333. PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyRange(ulPropertyId, plMin, plMax, bRet);
  334. #endif
  335. return bRet;
  336. }
  337. /*-------------------------------------------------------------------------*/
  338. static BOOL PRPCOM_GetCustomPropertyValue(
  339. LPFNEXTDEVIO pfnDeviceIoControl,
  340. LPARAM lParam,
  341. ULONG ulPropertyId,
  342. PLONG plValue)
  343. /*-------------------------------------------------------------------------*/
  344. {
  345. BOOL bRet;
  346. DWORD cbRet;
  347. KSPROPERTY_PHILIPS_CUSTOM_PROP_S VideoProperty;
  348. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_PHILIPS_CUSTOM_PROP_S) );
  349. VideoProperty.Property.Set = PROPSETID_PHILIPS_CUSTOM_PROP;
  350. VideoProperty.Property.Id = ulPropertyId;
  351. VideoProperty.Property.Flags = KSPROPERTY_TYPE_GET;
  352. VideoProperty.Flags = 0;
  353. VideoProperty.Capabilities = 0;
  354. if ((bRet = PRPCOM_ExtDeviceIoControl(
  355. pfnDeviceIoControl,
  356. lParam,
  357. VFW_USE_DEVICE_HANDLE,
  358. IOCTL_KS_PROPERTY,
  359. &VideoProperty,
  360. sizeof(VideoProperty),
  361. &VideoProperty,
  362. sizeof(VideoProperty),
  363. &cbRet)))
  364. {
  365. if (plValue != NULL)
  366. *plValue = VideoProperty.Value;
  367. /* if (pulFlags != NULL)
  368. *pulFlags = VideoProperty.Flags;
  369. if (pulCapabilities != NULL)
  370. *pulCapabilities = VideoProperty.Capabilities;*/
  371. }
  372. #ifdef _DEBUG
  373. PRPCOM_Debug_PRPCOM_GetCustomPropertyValue(ulPropertyId, plValue, bRet);
  374. #endif
  375. return bRet;
  376. }
  377. /*-------------------------------------------------------------------------*/
  378. static BOOL PRPCOM_SetCustomPropertyValue(
  379. LPFNEXTDEVIO pfnDeviceIoControl,
  380. LPARAM lParam,
  381. ULONG ulPropertyId,
  382. LONG lValue)
  383. /*-------------------------------------------------------------------------*/
  384. {
  385. BOOL bRet;
  386. DWORD cbRet;
  387. KSPROPERTY_PHILIPS_CUSTOM_PROP_S VideoProperty;
  388. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_PHILIPS_CUSTOM_PROP_S) );
  389. VideoProperty.Property.Set = PROPSETID_PHILIPS_CUSTOM_PROP;
  390. VideoProperty.Property.Id = ulPropertyId;
  391. VideoProperty.Property.Flags = KSPROPERTY_TYPE_SET;
  392. VideoProperty.Value = lValue;
  393. VideoProperty.Flags = 0;
  394. VideoProperty.Capabilities = 0;
  395. bRet = PRPCOM_ExtDeviceIoControl(
  396. pfnDeviceIoControl,
  397. lParam,
  398. VFW_USE_DEVICE_HANDLE,
  399. IOCTL_KS_PROPERTY,
  400. &VideoProperty,
  401. sizeof(VideoProperty),
  402. &VideoProperty,
  403. sizeof(VideoProperty),
  404. &cbRet);
  405. #ifdef _DEBUG
  406. PRPCOM_Debug_PRPCOM_SetCustomPropertyValue(ulPropertyId, lValue, bRet);
  407. #endif
  408. return bRet;
  409. }
  410. /*-------------------------------------------------------------------------*/
  411. static BOOL PRPCOM_GetCustomPropertyRange(
  412. LPFNEXTDEVIO pfnDeviceIoControl,
  413. LPARAM lParam,
  414. ULONG ulPropertyId,
  415. PLONG plMin,
  416. PLONG plMax)
  417. /*-------------------------------------------------------------------------*/
  418. {
  419. BOOL bRet;
  420. DWORD cbRet;
  421. KSPROPERTY_PHILIPS_CUSTOM_PROP_S VideoProperty;
  422. VIDEOPROCAMP_MEMBERSLIST PropertyList;
  423. ZeroMemory(&VideoProperty, sizeof(KSPROPERTY_PHILIPS_CUSTOM_PROP_S) );
  424. VideoProperty.Property.Set = PROPSETID_PHILIPS_CUSTOM_PROP;
  425. VideoProperty.Property.Id = ulPropertyId;
  426. VideoProperty.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT;
  427. VideoProperty.Flags = 0;
  428. VideoProperty.Capabilities = 0;
  429. bRet = PRPCOM_ExtDeviceIoControl(
  430. pfnDeviceIoControl,
  431. lParam,
  432. VFW_USE_DEVICE_HANDLE,
  433. IOCTL_KS_PROPERTY,
  434. &VideoProperty,
  435. sizeof(VideoProperty),
  436. &PropertyList,
  437. sizeof(PropertyList),
  438. &cbRet);
  439. if (plMin != NULL)
  440. *plMin = PropertyList.SteppingLong.Bounds.SignedMinimum;
  441. if (plMax != NULL)
  442. *plMax = PropertyList.SteppingLong.Bounds.SignedMaximum;
  443. #ifdef _DEBUG
  444. PRPCOM_Debug_PRPCOM_GetCustomPropertyRange(ulPropertyId, plMin, plMax, bRet);
  445. #endif
  446. return bRet;
  447. }
  448. /*-------------------------------------------------------------------------*/
  449. static BOOL PRPCOM_ExtDeviceIoControl(
  450. LPFNEXTDEVIO pfnDeviceIoControl,
  451. LPARAM lParam,
  452. DWORD dwVfWFlags,
  453. DWORD dwIoControlCode,
  454. LPVOID lpInBuffer,
  455. DWORD cbInBufferSize,
  456. LPVOID lpOutBuffer,
  457. DWORD cbOutBufferSize,
  458. LPDWORD pcbReturned)
  459. /*-------------------------------------------------------------------------*/
  460. {
  461. OVERLAPPED ov;
  462. BOOL bRet;
  463. ov.Offset = 0;
  464. ov.OffsetHigh = 0;
  465. ov.hEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
  466. if (ov.hEvent == (HANDLE) 0)
  467. bRet= FALSE;
  468. else
  469. {
  470. bRet = pfnDeviceIoControl (
  471. lParam,
  472. dwVfWFlags,
  473. dwIoControlCode,
  474. lpInBuffer,
  475. cbInBufferSize,
  476. lpOutBuffer,
  477. cbOutBufferSize,
  478. pcbReturned,
  479. &ov);
  480. if (!bRet && GetLastError() == ERROR_IO_PENDING)
  481. bRet = WaitForSingleObject( ov.hEvent, 2000 ) == WAIT_OBJECT_0;
  482. CloseHandle(ov.hEvent);
  483. }
  484. return bRet;
  485. }
  486. /*======================== DEBUGGING CODE =================================*/
  487. #ifdef _DEBUG
  488. /*-------------------------------------------------------------------------*/
  489. static void PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyValue(
  490. ULONG ulPropertyId,
  491. PLONG plValue,
  492. BOOL bRet)
  493. /*-------------------------------------------------------------------------*/
  494. {
  495. char PropertyIdStr[132], RetStr[132];
  496. PRPCOM_Debug_GetVideoProcAmpPropertyIdStr(
  497. ulPropertyId, PropertyIdStr, 132);
  498. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  499. printf("\nPRPCOM_GetVideoProcAmpPropertyValue(%s) --> %s, Value: %li",
  500. PropertyIdStr, RetStr, *plValue);
  501. }
  502. /*-------------------------------------------------------------------------*/
  503. static void PRPCOM_Debug_PRPCOM_SetVideoProcAmpPropertyValue(
  504. ULONG ulPropertyId,
  505. LONG lValue,
  506. BOOL bRet)
  507. /*-------------------------------------------------------------------------*/
  508. {
  509. char PropertyIdStr[132], RetStr[132];
  510. PRPCOM_Debug_GetVideoProcAmpPropertyIdStr(
  511. ulPropertyId, PropertyIdStr, 132);
  512. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  513. printf("\nPRPCOM_SetVideoProcAmpPropertyValue(%s, %li) --> %s",
  514. PropertyIdStr, lValue, RetStr);
  515. }
  516. /*-------------------------------------------------------------------------*/
  517. static void PRPCOM_Debug_PRPCOM_GetVideoProcAmpPropertyRange(
  518. ULONG ulPropertyId,
  519. PLONG plMin,
  520. PLONG plMax,
  521. BOOL bRet)
  522. /*-------------------------------------------------------------------------*/
  523. {
  524. char PropertyIdStr[132], RetStr[132];
  525. PRPCOM_Debug_GetVideoProcAmpPropertyIdStr(
  526. ulPropertyId, PropertyIdStr, 132);
  527. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  528. printf("\nPRPCOM_GetVideoProcAmpPropertyRange(%s) --> %s, Min: %li, Max : %li",
  529. PropertyIdStr, RetStr, *plMin, *plMax, *plMax);
  530. }
  531. /*-------------------------------------------------------------------------*/
  532. static void PRPCOM_Debug_GetVideoProcAmpPropertyIdStr(
  533. ULONG ulPropertyId,
  534. char *PropertyIdStr,
  535. UINT MaxLen)
  536. /*-------------------------------------------------------------------------*/
  537. {
  538. if (MaxLen == 0)
  539. return;
  540. switch(ulPropertyId)
  541. {
  542. case KSPROPERTY_VIDEOPROCAMP_COLORENABLE:
  543. strncpy(PropertyIdStr, "COLORENABLE", MaxLen - 1);
  544. break;
  545. case KSPROPERTY_VIDEOPROCAMP_BACKLIGHT_COMPENSATION:
  546. strncpy(PropertyIdStr, "BACKLIGHT_COMPENSATION", MaxLen - 1);
  547. break;
  548. case KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS:
  549. strncpy(PropertyIdStr, "BRIGHTNESS", MaxLen - 1);
  550. break;
  551. case KSPROPERTY_VIDEOPROCAMP_CONTRAST:
  552. strncpy(PropertyIdStr, "CONTRAST", MaxLen - 1);
  553. break;
  554. case KSPROPERTY_VIDEOPROCAMP_GAMMA:
  555. strncpy(PropertyIdStr, "GAMMA", MaxLen - 1);
  556. break;
  557. default:
  558. strncpy(PropertyIdStr, "??", MaxLen - 1);
  559. }
  560. }
  561. /*-------------------------------------------------------------------------*/
  562. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyValue(
  563. ULONG ulPropertyId,
  564. PLONG plValue,
  565. BOOL bRet)
  566. /*-------------------------------------------------------------------------*/
  567. {
  568. char PropertyIdStr[132], RetStr[132];
  569. PRPCOM_Debug_PRPCOM_GetCustomPropertyIdStr(
  570. ulPropertyId, PropertyIdStr, 132);
  571. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  572. printf("\nPRPCOM_GetCustomPropertyValue(%s) --> %s, Value: %li",
  573. PropertyIdStr, RetStr, *plValue);
  574. }
  575. /*-------------------------------------------------------------------------*/
  576. static void PRPCOM_Debug_PRPCOM_SetCustomPropertyValue(
  577. ULONG ulPropertyId,
  578. LONG lValue,
  579. BOOL bRet)
  580. /*-------------------------------------------------------------------------*/
  581. {
  582. char PropertyIdStr[132], RetStr[132];
  583. PRPCOM_Debug_PRPCOM_GetCustomPropertyIdStr(
  584. ulPropertyId, PropertyIdStr, 132);
  585. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  586. printf("\nPRPCOM_SetCustomPropertyValue(%s, %li) --> %s",
  587. PropertyIdStr, lValue, RetStr);
  588. }
  589. /*-------------------------------------------------------------------------*/
  590. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyRange(
  591. ULONG ulPropertyId,
  592. PLONG plMin,
  593. PLONG plMax,
  594. BOOL bRet)
  595. /*-------------------------------------------------------------------------*/
  596. {
  597. char PropertyIdStr[132], RetStr[132];
  598. PRPCOM_Debug_PRPCOM_GetCustomPropertyIdStr(
  599. ulPropertyId, PropertyIdStr, 132);
  600. strcpy(RetStr, bRet ? "TRUE" : "FALSE");
  601. printf("\nPRPCOM_GetCustomPropertyRange(%s) --> %s, Min: %li, Max : %li",
  602. PropertyIdStr, RetStr, *plMin, *plMax, *plMax);
  603. }
  604. /*-------------------------------------------------------------------------*/
  605. static void PRPCOM_Debug_PRPCOM_GetCustomPropertyIdStr(
  606. ULONG ulPropertyId,
  607. char *PropertyIdStr,
  608. UINT MaxLen)
  609. /*-------------------------------------------------------------------------*/
  610. {
  611. if (MaxLen == 0)
  612. return;
  613. switch(ulPropertyId)
  614. {
  615. case KSPROPERTY_PHILIPS_CUSTOM_PROP_WB_MODE:
  616. strncpy(PropertyIdStr, "WB_MODE", MaxLen - 1);
  617. break;
  618. case KSPROPERTY_PHILIPS_CUSTOM_PROP_WB_SPEED:
  619. strncpy(PropertyIdStr, "WB_SPEED", MaxLen - 1);
  620. break;
  621. case KSPROPERTY_PHILIPS_CUSTOM_PROP_WB_DELAY:
  622. strncpy(PropertyIdStr, "WB_DELAY", MaxLen - 1);
  623. break;
  624. case KSPROPERTY_PHILIPS_CUSTOM_PROP_WB_RED_GAIN:
  625. strncpy(PropertyIdStr, "RED_GAIN", MaxLen - 1);
  626. break;
  627. case KSPROPERTY_PHILIPS_CUSTOM_PROP_WB_BLUE_GAIN:
  628. strncpy(PropertyIdStr, "BLUE_GAIN", MaxLen - 1);
  629. break;
  630. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_CONTROL_SPEED:
  631. strncpy(PropertyIdStr, "EXPOSURE_SPEED", MaxLen - 1);
  632. break;
  633. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_FLICKERLESS:
  634. strncpy(PropertyIdStr, "FLICKERLESS", MaxLen - 1);
  635. break;
  636. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_SHUTTER_MODE:
  637. strncpy(PropertyIdStr, "EXPOSURE_SHUTTER_MODE", MaxLen - 1);
  638. break;
  639. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_SHUTTER_SPEED:
  640. strncpy(PropertyIdStr, "SHUTTERSPEED", MaxLen - 1);
  641. break;
  642. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_SHUTTER_STATUS:
  643. strncpy(PropertyIdStr, "SHUTTERSTATUS", MaxLen - 1);
  644. break;
  645. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_AGC_MODE:
  646. strncpy(PropertyIdStr, "EXPOSURE_AGC_MODE", MaxLen - 1);
  647. break;
  648. case KSPROPERTY_PHILIPS_CUSTOM_PROP_AE_AGC:
  649. strncpy(PropertyIdStr, "EXPOSURE_AGC_SPEED", MaxLen - 1);
  650. break;
  651. case KSPROPERTY_PHILIPS_CUSTOM_PROP_DRIVERVERSION:
  652. strncpy(PropertyIdStr, "DRIVERVERSION", MaxLen - 1);
  653. break;
  654. case KSPROPERTY_PHILIPS_CUSTOM_PROP_FRAMERATE:
  655. strncpy(PropertyIdStr, "FRAMERATE", MaxLen - 1);
  656. break;
  657. case KSPROPERTY_PHILIPS_CUSTOM_PROP_VIDEOFORMAT:
  658. strncpy(PropertyIdStr, "VIDEOFORMAT", MaxLen - 1);
  659. break;
  660. case KSPROPERTY_PHILIPS_CUSTOM_PROP_SENSORTYPE:
  661. strncpy(PropertyIdStr, "SENSORTYPE", MaxLen - 1);
  662. break;
  663. case KSPROPERTY_PHILIPS_CUSTOM_PROP_VIDEOCOMPRESSION:
  664. strncpy(PropertyIdStr, "VIDEOCOMPRESSION", MaxLen - 1);
  665. break;
  666. case KSPROPERTY_PHILIPS_CUSTOM_PROP_DEFAULTS:
  667. strncpy(PropertyIdStr, "DEFAULTS", MaxLen - 1);
  668. break;
  669. default:
  670. strncpy(PropertyIdStr, "??", MaxLen - 1);
  671. }
  672. }
  673. #endif