|
3 | 3 | * @author Martin Piatka <[email protected]> |
4 | 4 | * @author Martin Pulec <[email protected]> |
5 | 5 | * |
| 6 | + * code is written by DELTACAST's VideoMaster SDK example Sample_RX_DVI |
| 7 | + * |
6 | 8 | * @sa deltacast_common.hpp for common DELTACAST information |
7 | 9 | */ |
8 | 10 | /* |
@@ -386,49 +388,40 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h |
386 | 388 | VHD_DV_CS InputCS; |
387 | 389 | ULONG PxlClk = 0; |
388 | 390 | /* Get auto-detected resolution */ |
389 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_WIDTH,&Width); |
390 | | - if(Result == VHDERR_NOERROR) |
391 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_HEIGHT,&Height); |
392 | | - else |
| 391 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_WIDTH,&Width)) != VHDERR_NOERROR) { |
393 | 392 | printf("ERROR : Cannot detect incoming active width from RX0. " |
394 | 393 | "Result = 0x%08" PRIX_ULONG "\n", Result); |
395 | | - if(Result == VHDERR_NOERROR) |
396 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INTERLACED,(ULONG*)&Interlaced_B); |
397 | | - else |
| 394 | + return false; |
| 395 | + } |
| 396 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_HEIGHT,&Height)) != VHDERR_NOERROR) { |
398 | 397 | printf("ERROR : Cannot detect incoming active height from RX0. " |
399 | 398 | "Result = 0x%08" PRIX_ULONG "\n", Result); |
400 | | - if(Result == VHDERR_NOERROR) |
401 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_REFRESH_RATE,&RefreshRate); |
402 | | - else |
| 399 | + return false; |
| 400 | + } |
| 401 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INTERLACED,(ULONG*)&Interlaced_B)) != VHDERR_NOERROR) { |
403 | 402 | printf("ERROR : Cannot detect if incoming stream from RX0 is " |
404 | 403 | "interlaced or progressive. Result = 0x%08" PRIX_ULONG "\n", Result); |
405 | | - |
406 | | - if (Result == VHDERR_NOERROR) { |
407 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_REFRESH_RATE,&RefreshRate); |
408 | | - if(s->BoardType == VHD_BOARDTYPE_HDMI) |
409 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INPUT_CS,(ULONG*)&InputCS); |
410 | | - else |
411 | | - printf("ERROR : Cannot detect incoming color space from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n", Result, |
412 | | - delta_get_error_description(Result)); |
| 404 | + return false; |
| 405 | + } |
| 406 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_REFRESH_RATE,&RefreshRate)) != VHDERR_NOERROR) { |
| 407 | + printf("ERROR : Cannot detect incoming refresh rate from RX0. Result = 0x%08" PRIX_ULONG "\n",Result); |
| 408 | + return false; |
413 | 409 | } |
414 | 410 |
|
415 | | - if (Result == VHDERR_NOERROR) { |
416 | | - if (s->BoardType == VHD_BOARDTYPE_HDMI) |
417 | | - Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_PIXEL_CLOCK,&PxlClk); |
418 | | - else |
| 411 | + if (s->BoardType == VHD_BOARDTYPE_HDMI) { |
| 412 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INPUT_CS,(ULONG*)&InputCS)) != VHDERR_NOERROR) { |
| 413 | + printf("ERROR : Cannot detect incoming color space from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n", Result, |
| 414 | + delta_get_error_description(Result)); |
| 415 | + return false; |
| 416 | + } |
| 417 | + if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_PIXEL_CLOCK,&PxlClk)) != VHDERR_NOERROR) { |
419 | 418 | printf("ERROR : Cannot detect incoming pixel clock from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n", Result, |
420 | 419 | delta_get_error_description(Result)); |
| 420 | + return false |
| 421 | + } |
421 | 422 | } |
422 | 423 |
|
423 | | - if(Result == VHDERR_NOERROR) |
424 | | - printf("\nIncoming graphic resolution : %" PRIu_ULONG "x%" PRIu_ULONG " @%" PRIu_ULONG "Hz (%s)\n", Width, Height, RefreshRate, Interlaced_B ? "Interlaced" : "Progressive"); |
425 | | - else |
426 | | - printf("ERROR : Cannot detect incoming refresh rate from RX0. " |
427 | | - "Result = 0x%08" PRIX_ULONG "\n", Result); |
428 | | - |
429 | | - if(Result != VHDERR_NOERROR) { |
430 | | - return false; |
431 | | - } |
| 424 | + printf("\nIncoming graphic resolution : %" PRIu_ULONG "x%" PRIu_ULONG " @%" PRIu_ULONG "Hz (%s)\n", Width, Height, RefreshRate, Interlaced_B ? "Interlaced" : "Progressive"); |
432 | 425 |
|
433 | 426 | /* Configure stream. Only VHD_DVI_SP_ACTIVE_WIDTH, VHD_DVI_SP_ACTIVE_HEIGHT and |
434 | 427 | VHD_DVI_SP_INTERLACED properties are required for HDMI and Component |
|
0 commit comments