本文整理汇总了C++中CHK_ORET函数的典型用法代码示例。如果您正苦于以下问题:C++ CHK_ORET函数的具体用法?C++ CHK_ORET怎么用?C++ CHK_ORET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHK_ORET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_or_create_set_item
static int get_or_create_set_item(MXFHeaderMetadata* headerMetadata, MXFMetadataSet* set,
const mxfKey* itemKey, MXFMetadataItem** item)
{
MXFMetadataItem* resultItem = NULL;
mxfLocalTag tag;
MXFItemDef* itemDef = NULL;
/* check if item already exists */
if (!mxf_get_item(set, itemKey, &resultItem))
{
/* check if item registered in primer */
if (!mxf_get_item_tag(headerMetadata->primerPack, itemKey, &tag))
{
/* register item in primer */
CHK_ORET(mxf_find_item_def(headerMetadata->dataModel, itemKey, &itemDef));
CHK_ORET(mxf_register_primer_entry(headerMetadata->primerPack, (const mxfUID*)itemKey,
itemDef->localTag, &tag));
}
/* create new item */
CHK_ORET(mxf_create_item(set, itemKey, tag, &resultItem));
}
*item = resultItem;
return 1;
}
示例2: x11c_initialise
int x11c_initialise(X11Common* x11Common, int reviewDuration, OnScreenDisplay* osd, X11WindowInfo* windowInfo)
{
memset(x11Common, 0, sizeof(x11Common));
x11Common->reviewDuration = reviewDuration;
x11Common->osd = osd;
x11Common->progressBarInput.data = x11Common;
x11Common->progressBarInput.set_listener = x11c_set_pbar_listener;
x11Common->progressBarInput.unset_listener = x11c_unset_pbar_listener;
x11Common->progressBarInput.close = x11c_close_pbar;
x11Common->keyboardInput.data = x11Common;
x11Common->keyboardInput.set_listener = x11c_set_keyboard_listener;
x11Common->keyboardInput.unset_listener = x11c_unset_keyboard_listener;
x11Common->keyboardInput.close = x11c_close_keyboard;
x11Common->mouseInput.data = x11Common;
x11Common->mouseInput.set_listener = x11c_set_mouse_listener;
x11Common->mouseInput.unset_listener = x11c_unset_mouse_listener;
x11Common->mouseInput.close = x11c_close_mouse;
if (windowInfo)
{
x11Common->windowInfo = *windowInfo;
}
CHK_ORET(XInitThreads() != 0);
CHK_ORET(init_mutex(&x11Common->eventMutex));
CHK_ORET(create_joinable_thread(&x11Common->processEventThreadId, process_event_thread, x11Common));
return 1;
}
示例3: mxf_write_rip
int mxf_write_rip(MXFFile *mxfFile, MXFFilePartitions *partitions)
{
uint32_t numPartitions;
uint64_t len;
uint8_t llen;
MXFListIterator iter;
numPartitions = (uint32_t)mxf_get_list_length(partitions);
len = (4 + 8) * numPartitions + 4;
CHK_ORET(mxf_write_k(mxfFile, &g_RandomIndexPack_key));
CHK_ORET((llen = mxf_write_l(mxfFile, len)) != 0);
mxf_initialise_list_iter(&iter, partitions);
while (mxf_next_list_iter_element(&iter))
{
MXFPartition *partition = (MXFPartition*)mxf_get_iter_element(&iter);
CHK_ORET(mxf_write_uint32(mxfFile, partition->bodySID));
CHK_ORET(mxf_write_uint64(mxfFile, partition->thisPartition));
}
CHK_ORET(mxf_write_uint32(mxfFile, (uint32_t)(16 + llen + len)));
return 1;
}
示例4: mxf_read_l
static int mxf_read_l(FILE* mxfFile, uint8_t* llen, uint64_t* len)
{
int i;
int c;
uint64_t length;
uint8_t llength;
CHK_ORET((c = fgetc(mxfFile)) != EOF);
length = 0;
llength = 1;
if (c < 0x80)
{
length = c;
}
else
{
int bytesToRead = c & 0x7f;
CHK_ORET(bytesToRead <= 8);
for (i = 0; i < bytesToRead; i++)
{
CHK_ORET((c = fgetc(mxfFile)) != EOF);
length = length << 8;
length = length | c;
}
llength += bytesToRead;
}
*llen = llength;
*len = length;
return 1;
}
示例5: mxf_read_item_tl
int mxf_read_item_tl(MXFFile* mxfFile, mxfLocalTag* itemTag, uint16_t* itemLen)
{
CHK_ORET(mxf_read_local_tag(mxfFile, itemTag));
CHK_ORET(mxf_read_uint16(mxfFile, itemLen));
return 1;
}
示例6: mxf_write_header_metadata
int mxf_write_header_metadata(MXFFile* mxfFile, MXFHeaderMetadata* headerMetadata)
{
CHK_ORET(mxf_write_header_primer_pack(mxfFile, headerMetadata));
CHK_ORET(mxf_write_header_sets(mxfFile, headerMetadata));
return 1;
}
示例7: mxf_fill_to_position
int mxf_fill_to_position(MXFFile *mxfFile, uint64_t position)
{
int64_t filePos;
uint64_t fillSize;
uint8_t llen;
CHK_ORET((filePos = mxf_file_tell(mxfFile)) >= 0);
if ((uint64_t)filePos == position)
{
return 1;
}
CHK_ORET(((uint64_t)filePos <= position - mxf_get_min_llen(mxfFile) + mxfKey_extlen));
CHK_ORET(mxf_write_k(mxfFile, &g_KLVFill_key));
fillSize = position - filePos - mxfKey_extlen;
llen = mxf_get_llen(mxfFile, fillSize);
assert(fillSize >= llen);
fillSize -= llen;
CHK_ORET(mxf_write_l(mxfFile, fillSize));
CHK_ORET(mxf_write_zeros(mxfFile, fillSize));
return 1;
}
示例8: mxf_read_header_pp_kl_with_runin
int mxf_read_header_pp_kl_with_runin(MXFFile *mxfFile, mxfKey *key, uint8_t *llen, uint64_t *len)
{
mxfKey tkey = MXF_PP_KEY(0x01, 0x00, 0x00);
uint8_t tllen;
uint64_t tlen;
uint8_t keyCompareByte = 0;
uint32_t runinCheckCount = 0;
int byte;
/* the run-in shall not contain the first 11 bytes of the partition pack label and so
read until the first 11 bytes are found or max run-in exceeded */
while (runinCheckCount <= MAX_RUNIN_LEN && keyCompareByte < 11) {
CHK_ORET((byte = mxf_file_getc(mxfFile)) != EOF);
if (byte == ((uint8_t*)(&tkey))[keyCompareByte]) {
keyCompareByte++;
} else {
runinCheckCount += keyCompareByte + 1;
keyCompareByte = 0;
}
}
CHK_ORET(runinCheckCount <= MAX_RUNIN_LEN);
CHK_ORET(mxf_file_read(mxfFile, &tkey.octet11, 5) == 5);
CHK_ORET(mxf_is_header_partition_pack(&tkey));
CHK_ORET(mxf_read_l(mxfFile, &tllen, &tlen));
mxf_set_runin_len(mxfFile, (uint16_t)runinCheckCount);
*key = tkey;
*llen = tllen;
*len = tlen;
return 1;
}
示例9: mxf_read_kl
static int mxf_read_kl(FILE* mxfFile, mxfKey* key, uint8_t* llen, uint64_t *len)
{
CHK_ORET(mxf_read_k(mxfFile, key));
CHK_ORET(mxf_read_l(mxfFile, llen, len));
return 1;
}
示例10: mxf_register_set_items
int mxf_register_set_items(MXFHeaderMetadata* headerMetadata, const mxfKey* key)
{
MXFSetDef* setDef;
MXFItemDef* itemDef;
MXFListIterator iter;
mxfLocalTag tag;
CHK_ORET(mxf_find_set_def(headerMetadata->dataModel, key, &setDef));
/* go though the set def and parents and register the items */
while (setDef != NULL)
{
mxf_initialise_list_iter(&iter, &setDef->itemDefs);
while (mxf_next_list_iter_element(&iter))
{
itemDef = (MXFItemDef*)mxf_get_iter_element(&iter);
CHK_ORET(mxf_register_primer_entry(headerMetadata->primerPack, (const mxfUID*)&itemDef->key,
itemDef->localTag, &tag));
}
setDef = setDef->parentSetDef;
}
return 1;
}
示例11: mxf_write_item
int mxf_write_item(MXFFile* mxfFile, MXFMetadataItem* item)
{
CHK_ORET(mxf_write_local_tag(mxfFile, item->tag));
CHK_ORET(mxf_write_uint16(mxfFile, item->length));
CHK_ORET(mxf_file_write(mxfFile, item->value, item->length) == item->length);
item->isPersistent = 1;
return 1;
}
示例12: mxf_allocate_space_to_kag
int mxf_allocate_space_to_kag(MXFFile *mxfFile, MXFPartition *partition, uint32_t size)
{
int64_t filePos;
uint64_t relativeFilePos;
int64_t fillSize;
uint8_t llen;
assert(partition->kagSize > 0);
if (size == 0 && partition->kagSize == 1)
{
return 1;
}
CHK_ORET((filePos = mxf_file_tell(mxfFile)) >= 0);
CHK_ORET((uint64_t)filePos > partition->thisPartition);
relativeFilePos = filePos + size - partition->thisPartition;
if (size != 0 || (relativeFilePos % partition->kagSize) != 0)
{
CHK_ORET(mxf_write_k(mxfFile, &g_KLVFill_key));
fillSize = (int64_t)size - mxfKey_extlen;
if (partition->kagSize > 1)
{
fillSize += partition->kagSize - relativeFilePos % partition->kagSize;
}
if (fillSize >= 0)
{
llen = mxf_get_llen(mxfFile, fillSize);
}
else
{
llen = 0;
}
while (fillSize - llen < 0)
{
fillSize += partition->kagSize;
if (fillSize >= 0)
{
llen = mxf_get_llen(mxfFile, fillSize);
}
else
{
llen = 0;
}
}
fillSize -= llen;
CHK_ORET(mxf_write_l(mxfFile, fillSize));
CHK_ORET(mxf_write_zeros(mxfFile, fillSize));
}
return 1;
}
示例13: mxf_avid_add_typedef_record_member
int mxf_avid_add_typedef_record_member(MXFMetadataSet* typeDefSet, const mxfUTF16Char* name, const mxfUL* typeId)
{
uint8_t* elementValue;
CHK_ORET(append_name_to_string_array(typeDefSet, &MXF_ITEM_K(TypeDefinitionRecord, MemberNames), name));
CHK_ORET(mxf_grow_array_item(typeDefSet, &MXF_ITEM_K(TypeDefinitionRecord, MemberTypes), mxfUL_extlen, 1, &elementValue));
mxf_set_ul(typeId, elementValue);
return 1;
}
示例14: mxf_avid_create_typedef_enum
int mxf_avid_create_typedef_enum(MXFMetadataSet* metaDictSet, const mxfUL* id, const mxfUTF16Char* name, const mxfUTF16Char* description, const mxfUL* typeId, MXFMetadataSet** typeDefSet)
{
MXFMetadataSet* newSet = NULL;
CHK_ORET(mxf_avid_create_typedef(metaDictSet, &MXF_SET_K(TypeDefinitionEnumeration), id, name, description, &newSet));
CHK_ORET(mxf_set_ul_item(newSet, &MXF_ITEM_K(TypeDefinitionEnumeration, Type), typeId));
*typeDefSet = newSet;
return 1;
}
示例15: xml_writer_character_data
int xml_writer_character_data(XMLWriter* writer, const char* data)
{
if (writer->previousWrite == ELEMENT_START || writer->previousWrite == ATTRIBUTE)
{
CHK_ORET(fprintf(writer->file, ">") > 0);
}
CHK_ORET(fprintf(writer->file, "%s", data) > 0);
writer->previousWrite = CHARACTER_DATA;
return 1;
}