decklink: fix HRESULT printing

This commit is contained in:
Steve Lhomme 2021-11-09 14:43:01 +01:00 committed by Hugo Beauzée-Luyssen
parent a63a5257d1
commit 793353f51a
3 changed files with 18 additions and 15 deletions

View File

@ -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 <vlc_charset.h> // 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 */

View File

@ -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;
}

View File

@ -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);