From 793353f51a2347f389d338c0e3b8e4e7c8e513c6 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 9 Nov 2021 14:43:01 +0100 Subject: [PATCH] decklink: fix HRESULT printing --- modules/access/vlc_decklink.h | 3 +++ modules/stream_out/sdi/DBMSDIOutput.cpp | 16 ++++++++-------- modules/video_output/decklink.cpp | 14 +++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/access/vlc_decklink.h b/modules/access/vlc_decklink.h index e522053be1..89362a6a36 100644 --- a/modules/access/vlc_decklink.h +++ b/modules/access/vlc_decklink.h @@ -41,11 +41,13 @@ typedef CFStringRef decklink_str_t; #define DECKLINK_STRDUP(s) FromCFString(s, kCFStringEncodingUTF8) #define DECKLINK_FREE(s) CFRelease(s) +#define PRIHR "X" #elif defined(_WIN32) #include // FromWide typedef BSTR decklink_str_t; #define DECKLINK_STRDUP(s) FromWide(s) #define DECKLINK_FREE(s) SysFreeString(s) +#define PRIHR "lX" static inline IDeckLinkIterator *CreateDeckLinkIteratorInstance(void) { @@ -60,6 +62,7 @@ static inline IDeckLinkIterator *CreateDeckLinkIteratorInstance(void) typedef const char* decklink_str_t; #define DECKLINK_STRDUP(s) strdup(s) #define DECKLINK_FREE(s) free((void *) s) +#define PRIHR "X" #endif #endif /* VLC_DECKLINK_H */ diff --git a/modules/stream_out/sdi/DBMSDIOutput.cpp b/modules/stream_out/sdi/DBMSDIOutput.cpp index 7751423fb7..ff9952fa4c 100644 --- a/modules/stream_out/sdi/DBMSDIOutput.cpp +++ b/modules/stream_out/sdi/DBMSDIOutput.cpp @@ -126,7 +126,7 @@ AbstractStream *DBMSDIOutput::Add(const es_format_t *fmt) if(psz_err)\ msg_Err(p_stream, message ": %s", psz_err); \ else \ - msg_Err(p_stream, message ": 0x%X", result); \ + msg_Err(p_stream, message ":0x%" PRIHR, result); \ goto error; \ } \ } while(0) @@ -698,7 +698,7 @@ int DBMSDIOutput::ProcessAudio(block_t *p_block) scheduleTime, CLOCK_FREQ, &written); if (result != S_OK) - msg_Err(p_stream, "Failed to schedule audio sample: 0x%X", result); + msg_Err(p_stream, "Failed to schedule audio sample:0x%" PRIHR, result); else { lasttimestamp = __MAX(p_block->i_pts, lasttimestamp); @@ -754,7 +754,7 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, block_t *p_cc) video.tenbits ? bmdFormat10BitYUV : bmdFormat8BitYUV, bmdFrameFlagDefault, &pDLVideoFrame); if(result != S_OK) { - msg_Err(p_stream, "Failed to create video frame: 0x%X", result); + msg_Err(p_stream, "Failed to create video frame:0x%" PRIHR, result); goto error; } @@ -769,13 +769,13 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, block_t *p_cc) result = p_output->CreateAncillaryData(bmdFormat10BitYUV, &vanc); if (result != S_OK) { - msg_Err(p_stream, "Failed to create vanc: %d", result); + msg_Err(p_stream, "Failed to create vanc:0x%" PRIHR, result); goto error; } result = vanc->GetBufferForVerticalBlankingLine(ancillary.afd_line, &buf); if (result != S_OK) { - msg_Err(p_stream, "Failed to get VBI line %u: %d", ancillary.afd_line, result); + msg_Err(p_stream, "Failed to get VBI line %u:0x%" PRIHR, ancillary.afd_line, result); goto error; } @@ -786,7 +786,7 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, block_t *p_cc) { result = vanc->GetBufferForVerticalBlankingLine(ancillary.captions_line, &buf); if (result != S_OK) { - msg_Err(p_stream, "Failed to get VBI line %u: %d", ancillary.captions_line, result); + msg_Err(p_stream, "Failed to get VBI line %u:0x%" PRIHR, ancillary.captions_line, result); goto error; } sdi::Captions captions(p_cc->p_buffer, p_cc->i_buffer, timescale, frameduration); @@ -798,7 +798,7 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, block_t *p_cc) result = pDLVideoFrame->SetAncillaryData(vanc); vanc->Release(); if (result != S_OK) { - msg_Err(p_stream, "Failed to set vanc: %d", result); + msg_Err(p_stream, "Failed to set vanc:0x%" PRIHR, result); goto error; } } @@ -816,7 +816,7 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, block_t *p_cc) scheduleTime = picture->date + DECKLINK_SCHED_OFFSET; result = p_output->ScheduleVideoFrame(pDLVideoFrame, scheduleTime, length, CLOCK_FREQ); if (result != S_OK) { - msg_Err(p_stream, "Dropped Video frame %" PRId64 ": 0x%x", + msg_Err(p_stream, "Dropped Video frame %" PRId64 ":0x%" PRIHR, picture->date, result); goto error; } diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp index a6281d1d28..3db1f1e4c9 100644 --- a/modules/video_output/decklink.cpp +++ b/modules/video_output/decklink.cpp @@ -406,7 +406,7 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys, video_format_t if(psz_err)\ msg_Err(vd, message ": %s", psz_err); \ else \ - msg_Err(vd, message ": 0x%X", result); \ + msg_Err(vd, message ":0x%" PRIHR, result); \ goto error; \ } \ } while(0) @@ -682,7 +682,7 @@ static void PrepareVideo(vout_display_t *vd, picture_t *picture, subpicture_t *, bmdFrameFlagDefault, &pDLVideoFrame); if (result != S_OK) { - msg_Err(vd, "Failed to create video frame: 0x%X", result); + msg_Err(vd, "Failed to create video frame:0x%" PRIHR, result); pDLVideoFrame = NULL; goto end; } @@ -699,14 +699,14 @@ static void PrepareVideo(vout_display_t *vd, picture_t *picture, subpicture_t *, result = sys->p_output->CreateAncillaryData( sys->video.tenbits ? bmdFormat10BitYUV : bmdFormat8BitYUV, &vanc); if (result != S_OK) { - msg_Err(vd, "Failed to create vanc: %d", result); + msg_Err(vd, "Failed to create vanc:0x%" PRIHR, result); goto end; } line = var_InheritInteger(vd, VIDEO_CFG_PREFIX "afd-line"); result = vanc->GetBufferForVerticalBlankingLine(line, &buf); if (result != S_OK) { - msg_Err(vd, "Failed to get VBI line %d: %d", line, result); + msg_Err(vd, "Failed to get VBI line %d:0x%" PRIHR, line, result); goto end; } @@ -718,7 +718,7 @@ static void PrepareVideo(vout_display_t *vd, picture_t *picture, subpicture_t *, result = pDLVideoFrame->SetAncillaryData(vanc); vanc->Release(); if (result != S_OK) { - msg_Err(vd, "Failed to set vanc: %d", result); + msg_Err(vd, "Failed to set vanc:0x%" PRIHR, result); goto end; } } @@ -738,7 +738,7 @@ static void PrepareVideo(vout_display_t *vd, picture_t *picture, subpicture_t *, date, length, CLOCK_FREQ); if (result != S_OK) { - msg_Err(vd, "Dropped Video frame %" PRId64 ": 0x%x", date, result); + msg_Err(vd, "Dropped Video frame %" PRId64 ":0x%" PRIHR, date, result); goto end; } @@ -902,7 +902,7 @@ static void PlayAudio(audio_output_t *aout, block_t *audio, vlc_tick_t systempts audio->p_buffer, sampleFrameCount, systempts, CLOCK_FREQ, &written); if (result != S_OK) - msg_Err(aout, "Failed to schedule audio sample: 0x%X", result); + msg_Err(aout, "Failed to schedule audio sample:0x%" PRIHR, result); else if (sampleFrameCount != written) msg_Err(aout, "Written only %d samples out of %d", written, sampleFrameCount);