static int get_infax_data(MXFMetadataSet* dmFrameworkSet, InfaxData* infaxData) { mxfUTF16Char* tempWString = NULL; GET_STRING_ITEM(APP_Format, format); GET_STRING_ITEM(APP_ProgrammeTitle, progTitle); GET_STRING_ITEM(APP_EpisodeTitle, epTitle); GET_DATE_ITEM(APP_TransmissionDate, txDate); GET_STRING_ITEM(APP_MagazinePrefix, magPrefix); GET_STRING_ITEM(APP_ProgrammeNumber, progNo); GET_STRING_ITEM(APP_ProductionCode, prodCode); GET_STRING_ITEM(APP_SpoolStatus, spoolStatus); GET_DATE_ITEM(APP_StockDate, stockDate); GET_STRING_ITEM(APP_SpoolDescriptor, spoolDesc); GET_STRING_ITEM(APP_Memo, memo); GET_INT64_ITEM(APP_Duration, duration); GET_STRING_ITEM(APP_SpoolNumber, spoolNo); GET_STRING_ITEM(APP_AccessionNumber, accNo); GET_STRING_ITEM(APP_CatalogueDetail, catDetail); GET_UINT32_ITEM(APP_ItemNumber, itemNo); SAFE_FREE(&tempWString); return 1; fail: SAFE_FREE(&tempWString); return 0; }
static int get_infax_data(MXFMetadataSet *dmFrameworkSet, InfaxData *infaxData) { mxfUTF16Char *tempWString = NULL; #define GET_STRING_ITEM(name, cName) \ if (mxf_have_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name))) \ { \ CHK_OFAIL(mxf_uu_get_utf16string_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name), &tempWString)); \ CHK_OFAIL(mxf_utf16_to_utf8(infaxData->cName, tempWString, sizeof(infaxData->cName)) != (size_t)(-1)); \ infaxData->cName[sizeof(infaxData->cName) - 1] = '\0'; \ SAFE_FREE(tempWString); \ } #define GET_DATE_ITEM(name, cName) \ if (mxf_have_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name))) \ { \ CHK_OFAIL(mxf_get_timestamp_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name), &infaxData->cName)); \ infaxData->cName.hour = 0; \ infaxData->cName.min = 0; \ infaxData->cName.sec = 0; \ infaxData->cName.qmsec = 0; \ } #define GET_INT64_ITEM(name, cName) \ if (mxf_have_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name))) \ { \ CHK_OFAIL(mxf_get_int64_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name), &infaxData->cName)); \ } #define GET_UINT32_ITEM(name, cName) \ if (mxf_have_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name))) \ { \ CHK_OFAIL(mxf_get_uint32_item(dmFrameworkSet, &MXF_ITEM_K(APP_InfaxFramework, name), &infaxData->cName)); \ } GET_STRING_ITEM(APP_Format, format); GET_STRING_ITEM(APP_ProgrammeTitle, progTitle); GET_STRING_ITEM(APP_EpisodeTitle, epTitle); GET_DATE_ITEM(APP_TransmissionDate, txDate); GET_STRING_ITEM(APP_MagazinePrefix, magPrefix); GET_STRING_ITEM(APP_ProgrammeNumber, progNo); GET_STRING_ITEM(APP_ProductionCode, prodCode); GET_STRING_ITEM(APP_SpoolStatus, spoolStatus); GET_DATE_ITEM(APP_StockDate, stockDate); GET_STRING_ITEM(APP_SpoolDescriptor, spoolDesc); GET_STRING_ITEM(APP_Memo, memo); GET_INT64_ITEM(APP_Duration, duration); GET_STRING_ITEM(APP_SpoolNumber, spoolNo); GET_STRING_ITEM(APP_AccessionNumber, accNo); GET_STRING_ITEM(APP_CatalogueDetail, catDetail); GET_UINT32_ITEM(APP_ItemNumber, itemNo); SAFE_FREE(tempWString); return 1; fail: SAFE_FREE(tempWString); return 0; }