Skip to content

Commit 0fa5186

Browse files
committed
deltacast_dvi: utilize DELTA_PRINT_ERROR
(+ MSG where we don't use VHD Result)
1 parent 35bed52 commit 0fa5186

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

src/video_capture/deltacast_dvi.cpp

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,17 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
313313

314314
/* Disable EDID auto load */
315315
Result = VHD_SetStreamProperty(s->StreamHandle,VHD_DV_SP_DISABLE_EDID_AUTO_LOAD,TRUE);
316-
if(Result != VHDERR_NOERROR)
316+
if(Result != VHDERR_NOERROR) {
317+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot disable EDID auto load.");
317318
return false;
319+
}
318320

319321
/* Set the DVI mode of this channel to the detected one */
320322
Result = VHD_SetStreamProperty(s->StreamHandle,VHD_DV_SP_MODE, DviMode);
321-
if(Result != VHDERR_NOERROR)
323+
if(Result != VHDERR_NOERROR) {
324+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot configure RX0 stream mode.")
322325
return false;
326+
}
323327

324328
if(DviMode == VHD_DV_MODE_DVI_A)
325329
{
@@ -348,11 +352,11 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
348352
Result = VHD_PresetDviAStreamProperties(s->StreamHandle, DviAStd,Width,Height,
349353
RefreshRate,Interlaced_B);
350354
if(Result != VHDERR_NOERROR) {
351-
printf("ERROR : Cannot set incoming DVI-A format. Result = 0x%08" PRIX_ULONG "\n", Result);
355+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot set incoming DVI-A format.");
352356
}
353357
}
354358
else {
355-
printf("ERROR : Cannot detect incoming DVI-A format. Result = 0x%08" PRIX_ULONG ". Use 'preset=' option.\n", Result);
359+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming DVI-A format.");
356360
return false;
357361
}
358362
}
@@ -365,40 +369,36 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
365369

366370
/* Get auto-detected resolution */
367371
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_WIDTH,&Width)) != VHDERR_NOERROR) {
368-
printf("ERROR : Cannot detect incoming active width from RX0. "
369-
"Result = 0x%08" PRIX_ULONG "\n", Result);
372+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming active width from RX0.")
370373
return false;
371374
}
372375
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_ACTIVE_HEIGHT,&Height)) != VHDERR_NOERROR) {
373-
printf("ERROR : Cannot detect incoming active height from RX0. "
374-
"Result = 0x%08" PRIX_ULONG "\n", Result);
376+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming active height from RX0.");
375377
return false;
376378
}
377379
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INTERLACED,(ULONG*)&Interlaced_B)) != VHDERR_NOERROR) {
378-
printf("ERROR : Cannot detect if incoming stream from RX0 is "
379-
"interlaced or progressive. Result = 0x%08" PRIX_ULONG "\n", Result);
380+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect if incoming stream from RX0 is "
381+
"interlaced or progressive.");
380382
return false;
381383
}
382384
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_REFRESH_RATE,&RefreshRate)) != VHDERR_NOERROR) {
383-
printf("ERROR : Cannot detect incoming refresh rate from RX0. Result = 0x%08" PRIX_ULONG "\n",Result);
385+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming refresh rate from RX0.");
384386
return false;
385387
}
386388

387389
if (DviMode == VHD_DV_MODE_HDMI || DviMode == VHD_DV_MODE_DISPLAYPORT) {
388390
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_INPUT_CS,(ULONG*)&InputCS)) != VHDERR_NOERROR) {
389-
printf("ERROR : Cannot detect incoming color space from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n", Result,
390-
delta_get_error_description(Result));
391+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming color space from RX0.");
391392
return false;
392393
}
393394
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_PIXEL_CLOCK,&PxlClk)) != VHDERR_NOERROR) {
394-
printf("ERROR : Cannot detect incoming pixel clock from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n", Result,
395-
delta_get_error_description(Result));
395+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect incoming pixel clock from RX0.");
396396
return false;
397397
}
398398
}
399399
if (DviMode == VHD_DV_MODE_DVI_D) {
400400
if ((Result = VHD_GetStreamProperty(s->StreamHandle,VHD_DV_SP_DUAL_LINK,(ULONG*)&Dual_B)) != VHDERR_NOERROR) {
401-
printf("ERROR : Cannot detect if incoming stream from RX0 is dual or simple link. Result = 0x%08" PRIX_ULONG "\n", Result);
401+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot detect if incoming stream from RX0 is dual or simple link.");
402402
return false;
403403
}
404404
}
@@ -589,26 +589,24 @@ vidcap_deltacast_dvi_init(struct vidcap_params *params, void **state)
589589
/* Query VideoMasterHD information */
590590
Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
591591
if (Result != VHDERR_NOERROR) {
592-
log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot query VideoMasterHD"
593-
" information. Result = 0x%08" PRIX_ULONG "\n",
594-
Result);
592+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot query VideoMasterHD information.");
595593
goto error;
596594
}
597595
if (NbBoards == 0) {
598-
log_msg(LOG_LEVEL_ERROR, "[DELTACAST] No DELTA board detected, exiting...\n");
596+
MSG(ERROR, "No DELTA board detected, exiting...\n");
599597
goto error;
600598
}
601599

602600
if(BrdId >= NbBoards) {
603-
log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Wrong index %" PRIu_ULONG ". Found %" PRIu_ULONG " cards.\n", BrdId, NbBoards);
601+
MSG(ERROR, "Wrong index %" PRIu_ULONG ". Found %" PRIu_ULONG " cards.\n", BrdId, NbBoards);
604602
goto error;
605603
}
606604

607605
/* Open a handle on first DELTA-hd/sdi/codec board */
608606
Result = VHD_OpenBoardHandle(BrdId,&s->BoardHandle,NULL,0);
609607
if (Result != VHDERR_NOERROR)
610608
{
611-
log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot open DELTA board %" PRIu_ULONG " handle. Result = 0x%08" PRIX_ULONG "\n", BrdId, Result);
609+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot open DELTA board %" PRIu_ULONG " handle.", BrdId);
612610
goto error;
613611
}
614612
VHD_GetBoardProperty(s->BoardHandle, VHD_CORE_BP_BOARD_TYPE, &s->BoardType);
@@ -631,8 +629,7 @@ vidcap_deltacast_dvi_init(struct vidcap_params *params, void **state)
631629
nullptr, &s->StreamHandle, nullptr);
632630
if (Result != VHDERR_NOERROR)
633631
{
634-
log_msg(LOG_LEVEL_ERROR, "ERROR : Cannot open RX0 stream on DELTA-DVI board handle. "
635-
"Result = 0x%08" PRIX_ULONG "\n", Result);
632+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot open RX0 stream on DELTA-DVI board handle.");
636633
goto no_stream;
637634
}
638635

@@ -788,7 +785,7 @@ vidcap_deltacast_dvi_grab(void *state, struct audio_frame **audio)
788785
Result = VHD_LockSlotHandle(s->StreamHandle, &SlotHandle);
789786
if (Result != VHDERR_NOERROR) {
790787
if (Result != VHDERR_TIMEOUT) {
791-
log_msg(LOG_LEVEL_ERROR, "ERROR : Cannot lock slot on RX0 stream. Result = 0x%08" PRIX_ULONG "\n", Result);
788+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot lock slot on RX0 stream.");
792789
}
793790
else {
794791
log_msg(LOG_LEVEL_WARNING, "Timeout \n");
@@ -799,7 +796,7 @@ vidcap_deltacast_dvi_grab(void *state, struct audio_frame **audio)
799796
Result = VHD_GetSlotBuffer(SlotHandle, VHD_DV_BT_VIDEO, &pBuffer, &BufferSize);
800797

801798
if (Result != VHDERR_NOERROR) {
802-
log_msg(LOG_LEVEL_ERROR, "\nERROR : Cannot get slot buffer. Result = 0x%08" PRIX_ULONG "\n",Result);
799+
DELTA_PRINT_ERROR(Result, "ERROR : Cannot get slot buffer.");
803800
return NULL;
804801
}
805802

0 commit comments

Comments
 (0)