@@ -1384,7 +1384,8 @@ static const struct status_property {
13841384 true , LOG_LEVEL_INFO },
13851385};
13861386static void
1387- print_status_item (IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop)
1387+ print_status_item (IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop,
1388+ const char *log_prefix)
13881389{
13891390 const struct status_property *s_prop = nullptr ;
13901391
@@ -1408,8 +1409,10 @@ print_status_item(IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop)
14081409 : deckLinkStatus->GetInt (s_prop->prop , &int_val);
14091410 if (!SUCCEEDED (rc)) {
14101411 if (FAILED (rc) && rc != E_NOTIMPL) {
1411- MSG (WARNING, " Obtain property 0x%08x value: %s\n " ,
1412- (unsigned ) prop, bmd_hresult_to_string (rc).c_str ());
1412+ log_msg (LOG_LEVEL_WARNING,
1413+ " %sObtain property 0x%08x value: %s\n " ,
1414+ log_prefix, (unsigned ) prop,
1415+ bmd_hresult_to_string (rc).c_str ());
14131416 }
14141417 return ;
14151418 }
@@ -1418,13 +1421,15 @@ print_status_item(IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop)
14181421 case ST_STRING: {
14191422 string str = get_str_from_bmd_api_str (string_val);
14201423 release_bmd_api_str (string_val);
1421- MSG (INFO, " %s: %s\n " , s_prop->prop_name , str.c_str ());
1424+ log_msg (LOG_LEVEL_INFO, " %s%s: %s\n " , log_prefix,
1425+ s_prop->prop_name , str.c_str ());
14221426 break ;
14231427 }
14241428 case ST_INT: {
14251429 char buf[STR_LEN];
14261430 snprintf_ch (buf, s_prop->type_data .int_fmt_str , int_val);
1427- MSG (INFO, " %s: %s\n " , s_prop->prop_name , buf);
1431+ log_msg (LOG_LEVEL_INFO, " %s%s: %s\n " ,
1432+ log_prefix, s_prop->prop_name , buf);
14281433 break ;
14291434 }
14301435 case ST_BIT_FIELD: {
@@ -1443,7 +1448,8 @@ print_status_item(IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop)
14431448 snprintf_ch (val, " %s" , s_prop->type_data .map [0 ].name );
14441449 }
14451450
1446- MSG (INFO, " %s: %s\n " , s_prop->prop_name , val);
1451+ log_msg (LOG_LEVEL_INFO, " %s%s: %s\n " , log_prefix,
1452+ s_prop->prop_name , val);
14471453 break ;
14481454 }
14491455 case ST_ENUM: {
@@ -1456,7 +1462,8 @@ print_status_item(IDeckLinkStatus *deckLinkStatus, BMDDeckLinkStatusID prop)
14561462 }
14571463 }
14581464
1459- MSG (INFO, " %s: %s\n " , s_prop->prop_name , val);
1465+ log_msg (LOG_LEVEL_INFO, " %s%s: %s\n " , log_prefix,
1466+ s_prop->prop_name , val);
14601467 break ;
14611468 }
14621469 }
@@ -1468,9 +1475,10 @@ class BMDNotificationCallback : public IDeckLinkNotificationCallback
14681475 public:
14691476 explicit BMDNotificationCallback (
14701477 IDeckLinkStatus *deckLinkStatus,
1471- IDeckLinkNotification *deckLinkNotification)
1478+ IDeckLinkNotification *deckLinkNotification, const char *log_prefix )
14721479 : m_deckLinkStatus(deckLinkStatus),
1473- m_deckLinkNotification(deckLinkNotification), m_refCount(1 )
1480+ m_deckLinkNotification(deckLinkNotification),
1481+ m_logPrefix(log_prefix), m_refCount(1 )
14741482
14751483 {
14761484 m_deckLinkStatus->AddRef ();
@@ -1489,7 +1497,8 @@ class BMDNotificationCallback : public IDeckLinkNotificationCallback
14891497
14901498 // Print the updated status value
14911499 auto statusId = (BMDDeckLinkStatusID) param1;
1492- print_status_item (m_deckLinkStatus, statusId);
1500+ print_status_item (m_deckLinkStatus, statusId,
1501+ m_logPrefix.c_str ());
14931502
14941503 return S_OK;
14951504 }
@@ -1517,6 +1526,7 @@ class BMDNotificationCallback : public IDeckLinkNotificationCallback
15171526 private:
15181527 IDeckLinkStatus *m_deckLinkStatus;
15191528 IDeckLinkNotification *m_deckLinkNotification;
1529+ string m_logPrefix;
15201530 std::atomic<ULONG> m_refCount;
15211531
15221532 virtual ~BMDNotificationCallback ()
@@ -1547,7 +1557,8 @@ class BMDNotificationCallback : public IDeckLinkNotificationCallback
15471557 * destroy with bmd_unsubscribe_notify()
15481558 */
15491559BMDNotificationCallback *
1550- bmd_print_status_subscribe_notify (IDeckLink *deckLink, bool capture)
1560+ bmd_print_status_subscribe_notify (IDeckLink *deckLink, const char *log_prefix,
1561+ bool capture)
15511562{
15521563 IDeckLinkProfileAttributes *deckLinkAttributes = nullptr ;
15531564 HRESULT result = deckLink->QueryInterface (
@@ -1558,13 +1569,15 @@ bmd_print_status_subscribe_notify(IDeckLink *deckLink, bool capture)
15581569 BMDDeckLinkEthernetMACAddress, &string_val))) {
15591570 string mac_addr = get_str_from_bmd_api_str (string_val);
15601571 release_bmd_api_str (string_val);
1561- MSG (INFO , " Ethernet MAC address: %s\n " ,
1562- mac_addr.c_str ());
1572+ log_msg (LOG_LEVEL_INFO , " %sEthernet MAC address: %s\n " ,
1573+ log_prefix, mac_addr.c_str ());
15631574 }
15641575 deckLinkAttributes->Release ();
15651576 } else {
1566- MSG (ERROR, " Cannot obtain IID_IDeckLinkProfileAttributes from "
1567- " DeckLink!\n " );
1577+ log_msg (LOG_LEVEL_ERROR,
1578+ " %sCannot obtain IID_IDeckLinkProfileAttributes from "
1579+ " DeckLink: %s\n " ,
1580+ log_prefix, bmd_hresult_to_string (result).c_str ());
15681581 }
15691582
15701583 IDeckLinkStatus *deckLinkStatus = nullptr ;
@@ -1577,7 +1590,8 @@ bmd_print_status_subscribe_notify(IDeckLink *deckLink, bool capture)
15771590 if (capture && status_map[u].playback_only ) {
15781591 continue ;
15791592 }
1580- print_status_item (deckLinkStatus, status_map[u].prop );
1593+ print_status_item (deckLinkStatus, status_map[u].prop ,
1594+ log_prefix);
15811595 }
15821596
15831597 // Obtain the notification interface
@@ -1588,8 +1602,8 @@ bmd_print_status_subscribe_notify(IDeckLink *deckLink, bool capture)
15881602 deckLinkStatus->Release ();
15891603 return nullptr );
15901604
1591- auto *notificationCallback =
1592- new BMDNotificationCallback ( deckLinkStatus, deckLinkNotification);
1605+ auto *notificationCallback = new BMDNotificationCallback (
1606+ deckLinkStatus, deckLinkNotification, log_prefix );
15931607 assert (notificationCallback != nullptr );
15941608
15951609 BMD_CHECK (deckLinkNotification->Subscribe (bmdStatusChanged,
0 commit comments