@@ -219,9 +219,6 @@ class VideoDelegate final : public IDeckLinkInputCallback
219219 }
220220 return newRefValue;
221221 }
222- static string getNotificationEventsStr (
223- BMDVideoInputFormatChangedEvents notificationEvents,
224- BMDDetectedVideoInputFormatFlags flags) noexcept ;
225222 HRESULT STDMETHODCALLTYPE VideoInputFormatChanged (
226223 BMDVideoInputFormatChangedEvents notificationEvents,
227224 IDeckLinkDisplayMode *mode,
@@ -296,10 +293,11 @@ static void print_input_modes (IDeckLink* deckLink);
296293static string display_mode_get_name (IDeckLinkDisplayMode *displayMode);
297294
298295
299- string
300- VideoDelegate:: getNotificationEventsStr (
296+ static string
297+ getNotificationEventsStr (
301298 BMDVideoInputFormatChangedEvents notificationEvents,
302- BMDDetectedVideoInputFormatFlags flags) noexcept
299+ BMDDetectedVideoInputFormatFlags flags,
300+ BMDFieldDominance field_dominance) noexcept
303301{
304302 string status{};
305303 map<BMDDetectedVideoInputFormatFlags, string> change_map{
@@ -337,17 +335,60 @@ VideoDelegate::getNotificationEventsStr(
337335 first = false ;
338336 }
339337 }
338+
339+ status += " , " ;
340+ switch (field_dominance) {
341+ case bmdLowerFieldFirst:
342+ status += " lower-field-first" ;
343+ break ;
344+ case bmdUpperFieldFirst:
345+ status += " upper-field-first" ;
346+ break ;
347+ case bmdProgressiveFrame:
348+ status += " progressive" ;
349+ break ;
350+ case bmdProgressiveSegmentedFrame:
351+ status += " PsF" ;
352+ break ;
353+ default :
354+ status += " UNKNOWN field dominance" ;
355+ }
356+
340357 return status;
341358}
342359
360+ static int
361+ depth_from_flags (BMDDetectedVideoInputFormatFlags flags)
362+ {
363+ if (flags & bmdDetectedVideoInput8BitDepth) {
364+ return 8 ;
365+ }
366+ if (flags & bmdDetectedVideoInput10BitDepth) {
367+ return 10 ;
368+ }
369+ assert (flags & bmdDetectedVideoInput12BitDepth);
370+ return 12 ;
371+ }
372+
343373HRESULT STDMETHODCALLTYPE
344374VideoDelegate::VideoInputFormatChanged (
345375 BMDVideoInputFormatChangedEvents notificationEvents,
346376 IDeckLinkDisplayMode *mode, BMDDetectedVideoInputFormatFlags flags) noexcept
347377{
378+ char aux_info[STR_LEN ];
379+ if (s->requested_bit_depth != 0 &&
380+ (flags & bitDepthMask) != s->requested_bit_depth ) {
381+ snprintf_ch (aux_info, " Capturing %d bits as requested." ,
382+ depth_from_flags ((BMDDetectedVideoInputFormatFlags)
383+ s->requested_bit_depth ));
384+ } else {
385+ aux_info[0 ] = ' \0 ' ;
386+ }
348387 LOG (LOG_LEVEL_NOTICE )
349388 << MOD_NAME << " Format change detected ("
350- << getNotificationEventsStr (notificationEvents, flags) << " ).\n " ;
389+ << getNotificationEventsStr (notificationEvents, flags,
390+ mode->GetFieldDominance ())
391+ << " )." << aux_info << " \n " ;
351392
352393 bool detected_3d = (flags & bmdDetectedVideoInputDualStream3D) != 0U ;
353394 if (detected_3d != s->stereo ) {
@@ -395,8 +436,7 @@ VideoDelegate::VideoInputFormatChanged(
395436 };
396437 if (s->requested_bit_depth == 0 &&
397438 (csBitDepth & bmdDetectedVideoInput8BitDepth) == 0 ) {
398- const int depth =
399- (flags & bmdDetectedVideoInput10BitDepth) != 0U ? 10 : 12 ;
439+ const int depth = depth_from_flags (flags);
400440 if (depth == 12 && !decklink_supports_codec (
401441 deckLinkInput, bmdFormat12BitRGBLE)) {
402442 MSG (WARNING , " 12-bit input detected but not supported "
0 commit comments