Update libAAF (upstream v0.5-2-g4dfb754)

This commit is contained in:
Robin Gareus 2023-12-26 14:35:14 +01:00
parent f5689f37b6
commit c5db23a15c
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
13 changed files with 716 additions and 429 deletions

View file

@ -31,16 +31,15 @@
void void
aaf_dump_Header (AAF_Data* aafd) aaf_dump_Header (AAF_Data* aafd)
{ {
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ByteOrder : %ls (0x%04x)\n", aaft_ByteOrderToText (aafd->Header.ByteOrder), aafd->Header.ByteOrder); DBG_BUFFER_WRITE (dbg, " ByteOrder : %ls (0x%04x)\n", aaft_ByteOrderToText (aafd->Header.ByteOrder), aafd->Header.ByteOrder);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " LastModified : %ls\n", aaft_TimestampToText (aafd->Header.LastModified)); DBG_BUFFER_WRITE (dbg, " LastModified : %ls\n", aaft_TimestampToText (aafd->Header.LastModified));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " AAF ObjSpec Version : %ls\n", aaft_VersionToText (aafd->Header.Version)); DBG_BUFFER_WRITE (dbg, " AAF ObjSpec Version : %ls\n", aaft_VersionToText (aafd->Header.Version));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ObjectModel Version : %u\n", aafd->Header.ObjectModelVersion); DBG_BUFFER_WRITE (dbg, " ObjectModel Version : %u\n", aafd->Header.ObjectModelVersion);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Operational Pattern : %ls\n", aaft_OPDefToText (aafd->Header.OperationalPattern)); DBG_BUFFER_WRITE (dbg, " Operational Pattern : %ls\n", aaft_OPDefToText (aafd->Header.OperationalPattern));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
@ -48,20 +47,19 @@ aaf_dump_Header (AAF_Data* aafd)
void void
aaf_dump_Identification (AAF_Data* aafd) aaf_dump_Identification (AAF_Data* aafd)
{ {
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " CompanyName : %ls\n", (aafd->Identification.CompanyName) ? aafd->Identification.CompanyName : L"n/a"); DBG_BUFFER_WRITE (dbg, " CompanyName : %ls\n", (aafd->Identification.CompanyName) ? aafd->Identification.CompanyName : L"n/a");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ProductName : %ls\n", (aafd->Identification.ProductName) ? aafd->Identification.ProductName : L"n/a"); DBG_BUFFER_WRITE (dbg, " ProductName : %ls\n", (aafd->Identification.ProductName) ? aafd->Identification.ProductName : L"n/a");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ProductVersion : %ls\n", aaft_ProductVersionToText (aafd->Identification.ProductVersion)); DBG_BUFFER_WRITE (dbg, " ProductVersion : %ls\n", aaft_ProductVersionToText (aafd->Identification.ProductVersion));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ProductVersionString : %ls\n", (aafd->Identification.ProductVersionString) ? aafd->Identification.ProductVersionString : L"n/a"); DBG_BUFFER_WRITE (dbg, " ProductVersionString : %ls\n", (aafd->Identification.ProductVersionString) ? aafd->Identification.ProductVersionString : L"n/a");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ProductID : %ls\n", AUIDToText (aafd->Identification.ProductID)); DBG_BUFFER_WRITE (dbg, " ProductID : %ls\n", AUIDToText (aafd->Identification.ProductID));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Date : %ls\n", aaft_TimestampToText (aafd->Identification.Date)); DBG_BUFFER_WRITE (dbg, " Date : %ls\n", aaft_TimestampToText (aafd->Identification.Date));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " ToolkitVersion : %ls\n", aaft_ProductVersionToText (aafd->Identification.ToolkitVersion)); DBG_BUFFER_WRITE (dbg, " ToolkitVersion : %ls\n", aaft_ProductVersionToText (aafd->Identification.ToolkitVersion));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Platform : %ls\n", (aafd->Identification.Platform) ? aafd->Identification.Platform : L"n/a"); DBG_BUFFER_WRITE (dbg, " Platform : %ls\n", (aafd->Identification.Platform) ? aafd->Identification.Platform : L"n/a");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " GenerationAUID : %ls\n", AUIDToText (aafd->Identification.GenerationAUID)); DBG_BUFFER_WRITE (dbg, " GenerationAUID : %ls\n", AUIDToText (aafd->Identification.GenerationAUID));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
@ -69,13 +67,16 @@ aaf_dump_Identification (AAF_Data* aafd)
void void
aaf_dump_ObjectProperty (AAF_Data* aafd, aafProperty* Prop) aaf_dump_ObjectProperty (AAF_Data* aafd, aafProperty* Prop)
{ {
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " :.: (0x%04x) %ls (%ls)\n", Prop->pid, aaft_PIDToText (aafd, Prop->pid), aaft_StoredFormToText (Prop->sf) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/); if (Prop->def->meta) {
DBG_BUFFER_WRITE (dbg, " :.: %s(0x%04x) %ls%s (%ls)\n", ANSI_COLOR_YELLOW (dbg), Prop->pid, aaft_PIDToText (aafd, Prop->pid), ANSI_COLOR_RESET (dbg), aaft_StoredFormToText (Prop->sf) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/);
} else {
DBG_BUFFER_WRITE (dbg, " :.: (0x%04x) %ls (%ls)\n", Prop->pid, aaft_PIDToText (aafd, Prop->pid), aaft_StoredFormToText (Prop->sf) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/);
}
// WARNING : Wont print strong references (set/vector) corectly. // WARNING : Wont print strong references (set/vector) corectly.
offset += laaf_util_dump_hex (Prop->val, Prop->len, &aafd->dbg->_dbg_msg, &aafd->dbg->_dbg_msg_size, offset); aafd->dbg->_dbg_msg_pos += laaf_util_dump_hex (Prop->val, Prop->len, &aafd->dbg->_dbg_msg, &aafd->dbg->_dbg_msg_size, aafd->dbg->_dbg_msg_pos);
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
@ -87,31 +88,23 @@ aaf_dump_ObjectProperties (AAF_Data* aafd, aafObject* Obj)
* List the properties once they have been parsed and interpreted by AAFCore. * List the properties once they have been parsed and interpreted by AAFCore.
*/ */
// int offset = 0;
// struct dbg *dbg = aafd->dbg;
aafProperty* Prop = NULL; aafProperty* Prop = NULL;
for (Prop = Obj->Properties; Prop != NULL; Prop = Prop->next) { for (Prop = Obj->Properties; Prop != NULL; Prop = Prop->next) {
aaf_dump_ObjectProperty (aafd, Prop); aaf_dump_ObjectProperty (aafd, Prop);
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " :.: (0x%04x) %ls (%ls)\n", Prop->pid, aaft_PIDToText( aafd, Prop->pid ), aaft_StoredFormToText( Prop->sf ) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/ );
//
// // WARNING : Wont print strong references (set/vector) corectly.
// laaf_util_dump_hex( Prop->val, Prop->len );
} }
} }
void void
aaf_dump_rawProperties (AAF_Data* aafd, aafByte_t* propStream) aaf_dump_rawProperties (AAF_Data* aafd, aafByte_t* propStream)
{ {
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
if (propStream == NULL) { if (propStream == NULL) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, DBG_BUFFER_WRITE (dbg,
" ## Property_Header____________________________________________________\n\n" " ## Property_Header____________________________________________________\n\n"
" aafPropertyIndexHeader_t is NULL\n" " aafPropertyIndexHeader_t is NULL\n"
" ======================================================================\n\n"); " ======================================================================\n\n");
return; return;
} }
@ -124,17 +117,17 @@ aaf_dump_rawProperties (AAF_Data* aafd, aafByte_t* propStream)
uint32_t i = 0; uint32_t i = 0;
uint32_t valueOffset = 0; uint32_t valueOffset = 0;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, DBG_BUFFER_WRITE (dbg,
" ## Property_Header____________________________________________________\n\n" " ## Property_Header____________________________________________________\n\n"
" _byteOrder : 0x%02x\n" " _byteOrder : 0x%02x\n"
" _formatVersion : 0x%02x\n" " _formatVersion : 0x%02x\n"
" _entryCount : %u\n\n" " _entryCount : %u\n\n"
" ======================================================================\n\n", " ======================================================================\n\n",
Header._byteOrder, Header._byteOrder,
Header._formatVersion, Header._formatVersion,
Header._entryCount); Header._entryCount);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
/* /*
* Since the following for-loop macro is not intended to be user * Since the following for-loop macro is not intended to be user
@ -149,19 +142,19 @@ aaf_dump_rawProperties (AAF_Data* aafd, aafByte_t* propStream)
(value = propStream + valueOffset); (value = propStream + valueOffset);
valueOffset += Prop._length, valueOffset += Prop._length,
i++) { i++) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, DBG_BUFFER_WRITE (dbg,
" #%u Property_Entry_____________________________________________________\n" " #%u Property_Entry_____________________________________________________\n"
" _pid : 0x%04x (%ls)\n" " _pid : 0x%04x (%ls)\n"
" _storedForm : %ls\n" " _storedForm : %ls\n"
" _length : %u bytes\n", " _length : %u bytes\n",
i, i,
Prop._pid, aaft_PIDToText (aafd, Prop._pid), Prop._pid, aaft_PIDToText (aafd, Prop._pid),
aaft_StoredFormToText (Prop._storedForm), aaft_StoredFormToText (Prop._storedForm),
Prop._length); Prop._length);
offset += laaf_util_dump_hex (value, Prop._length, &aafd->dbg->_dbg_msg, &aafd->dbg->_dbg_msg_size, offset); aafd->dbg->_dbg_msg_pos += laaf_util_dump_hex (value, Prop._length, &aafd->dbg->_dbg_msg, &aafd->dbg->_dbg_msg_size, aafd->dbg->_dbg_msg_pos);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n");
} }
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
@ -192,8 +185,7 @@ aaf_dump_MetaDictionary (AAF_Data* aafd)
* wont be printed out. * wont be printed out.
*/ */
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
aafClass* Class = NULL; aafClass* Class = NULL;
@ -206,29 +198,34 @@ aaf_dump_MetaDictionary (AAF_Data* aafd)
foreachPropertyDefinition (PDef, Class->Properties) foreachPropertyDefinition (PDef, Class->Properties)
{ {
if (Class->meta) { if (Class->meta) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, ANSI_COLOR_YELLOW "%ls::%ls (0x%04x)\n" ANSI_COLOR_RESET, DBG_BUFFER_WRITE (dbg, "%s%ls::%ls (0x%04x)%s\n",
Class->name, ANSI_COLOR_YELLOW (dbg),
PDef->name, Class->name,
PDef->pid); PDef->name,
PDef->pid,
ANSI_COLOR_RESET (dbg));
print++; print++;
} else if (PDef->meta) { } else if (PDef->meta) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls::" ANSI_COLOR_YELLOW "%ls (0x%04x)\n" ANSI_COLOR_RESET, DBG_BUFFER_WRITE (dbg, "%ls::%s%ls (0x%04x)%s\n",
aaft_ClassIDToText (aafd, Class->ID), aaft_ClassIDToText (aafd, Class->ID),
PDef->name, ANSI_COLOR_YELLOW (dbg),
PDef->pid); PDef->name,
PDef->pid,
ANSI_COLOR_RESET (dbg));
print++; print++;
} }
} }
if (print) if (print) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
}
print = 1; print = 1;
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
@ -236,8 +233,7 @@ aaf_dump_MetaDictionary (AAF_Data* aafd)
void void
aaf_dump_Classes (AAF_Data* aafd) aaf_dump_Classes (AAF_Data* aafd)
{ {
int offset = 0; struct dbg* dbg = aafd->dbg;
struct dbg* dbg = aafd->dbg;
aafClass* ConcreteClass = NULL; aafClass* ConcreteClass = NULL;
aafClass* Class = NULL; aafClass* Class = NULL;
@ -246,19 +242,19 @@ aaf_dump_Classes (AAF_Data* aafd)
{ {
foreachClassInheritance (Class, ConcreteClass) foreachClassInheritance (Class, ConcreteClass)
{ {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s%ls%s", DBG_BUFFER_WRITE (dbg, "%s%ls%s",
(Class->meta) ? ANSI_COLOR_YELLOW : "", (Class->meta) ? ANSI_COLOR_YELLOW (dbg) : "",
aaft_ClassIDToText (aafd, Class->ID), aaft_ClassIDToText (aafd, Class->ID),
(Class->meta) ? ANSI_COLOR_RESET : ""); (Class->meta) ? ANSI_COLOR_RESET (dbg) : "");
if (Class->Parent != NULL) if (Class->Parent != NULL)
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " > "); DBG_BUFFER_WRITE (dbg, " > ");
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }

View file

@ -112,17 +112,79 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const wchar_t* original_uri_
// debug( "Original URI filepath : %s", uri_filepath ); // debug( "Original URI filepath : %s", uri_filepath );
uri = uriParse (uri_filepath, URI_OPT_DECODE_ALL, aafi->dbg);
if (uri == NULL) {
error ("Could not parse URI");
goto err;
}
if (uri->path == NULL) {
error ("Could not retrieve <path> out of URI");
goto err;
}
// debug( "Decoded URI's filepath : %s", uri->path );
/* extract relative path to essence file : "<firstparent>/<essence.file>" */
char* relativeEssencePath = NULL;
char* p = uri->path + strlen (uri->path);
int sepcount = 0;
while (p > uri->path) {
if (*p == '/') { /* parsing URI, so will always be '/' as separator character */
sepcount++;
if (sepcount == 2) {
relativeEssencePath = (p + 1);
break;
}
}
p--;
}
const char* essenceFileName = laaf_util_fop_get_file (uri->path);
// debug( "Essence filename : %s", essenceFileName );
if (search_location) { if (search_location) {
local_filepath = laaf_util_build_path (DIR_SEP_STR, search_location, laaf_util_fop_get_file (uri_filepath), NULL); /*
* "<search_location>/<essence.file>"
*/
local_filepath = laaf_util_build_path (DIR_SEP_STR, search_location, essenceFileName, NULL);
if (local_filepath == NULL) { if (local_filepath == NULL) {
error ("Could not build search filepath"); error ("Could not build search filepath");
goto err; goto err;
} }
// debug( "Search filepath : %s", fpath ); // debug( "Search filepath : %s", local_filepath );
/* JE - for testing !!!! (added call to uriDecodeString() */ if (access (uriDecodeString(local_filepath, NULL), F_OK) != -1) { if (access (local_filepath, F_OK) != -1) {
// debug( "FOUND: %s", local_filepath );
retpath = local_filepath;
goto found;
}
free (local_filepath);
local_filepath = NULL;
/*
* "<search_location>/<firstparentInOriginalEssencePath>/<essence.file>"
*/
local_filepath = laaf_util_build_path (DIR_SEP_STR, search_location, relativeEssencePath, NULL);
if (local_filepath == NULL) {
error ("Could not build search filepath");
goto err;
}
// debug( "Search filepath : %s", local_filepath );
if (access (local_filepath, F_OK) != -1) {
// debug( "FOUND: %s", local_filepath ); // debug( "FOUND: %s", local_filepath );
retpath = local_filepath; retpath = local_filepath;
goto found; goto found;
@ -142,22 +204,8 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const wchar_t* original_uri_
/* Try <path> part of URI */ /* Try <path> part of URI */
uri = uriParse (uri_filepath, URI_OPT_DECODE_ALL, aafi->dbg);
if (uri == NULL) {
error ("Could not parse URI");
goto err;
}
if (uri->path == NULL) {
error ("Could not retrieve <path> out of URI");
goto err;
}
// debug( "URI's filepath : %s", uri->path );
if (access (uri->path, F_OK) != -1) { if (access (uri->path, F_OK) != -1) {
// debug( "FOUND: %s", path ); // debug( "FOUND: %s", uri->path );
retpath = uri->path; retpath = uri->path;
goto found; goto found;
} }
@ -183,24 +231,6 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const wchar_t* original_uri_
* = /home/user/AudioFiles/essence.file * = /home/user/AudioFiles/essence.file
*/ */
/* extract relative path to essence file : "<firstparent>/<essence.file>" */
char* relativeEssencePath = NULL;
char* p = uri->path + strlen (uri->path);
int sepcount = 0;
while (p > uri->path) {
if (*p == '/') { /* parsing URI, so will always be '/' as separator character */
sepcount++;
if (sepcount == 2) {
relativeEssencePath = (p + 1);
break;
}
}
p--;
}
/* extract path to AAF file */ /* extract path to AAF file */
aaf_path = laaf_util_c99strdup (aafi->aafd->cfbd->file); aaf_path = laaf_util_c99strdup (aafi->aafd->cfbd->file);
@ -220,6 +250,32 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const wchar_t* original_uri_
p--; p--;
} }
/*
* "<localPathToAAFfile>/<essence.file>"
*/
local_filepath = laaf_util_build_path (DIR_SEP_STR, aaf_path, essenceFileName, NULL);
if (local_filepath == NULL) {
error ("Could not build filepath");
goto err;
}
// debug( "AAF relative filepath : %s", local_filepath );
if (access (local_filepath, F_OK) != -1) {
// debug( "FOUND: %s", filepath );
retpath = local_filepath;
goto found;
}
free (local_filepath);
local_filepath = NULL;
/*
* "<localPathToAAFfile>/<firstparentInOriginalEssencePath>/<essence.file>"
*/
local_filepath = laaf_util_build_path (DIR_SEP_STR, aaf_path, relativeEssencePath, NULL); local_filepath = laaf_util_build_path (DIR_SEP_STR, aaf_path, relativeEssencePath, NULL);
if (local_filepath == NULL) { if (local_filepath == NULL) {
@ -235,6 +291,9 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const wchar_t* original_uri_
goto found; goto found;
} }
free (local_filepath);
local_filepath = NULL;
// debug("File not found"); // debug("File not found");
found: found:
@ -426,7 +485,7 @@ aafi_parse_audio_summary (AAF_Iface* aafi, aafiAudioEssence* audioEssence)
if (audioEssence->is_embedded) { if (audioEssence->is_embedded) {
if (audioEssence->summary == NULL) { if (audioEssence->summary == NULL) {
warning ("TODO: Audio essence has no summary. Should try essence data stream ?"); warning ("TODO: Audio essence has no summary. TODO: Should try essence data stream ?");
goto err; goto err;
} }
@ -449,6 +508,11 @@ aafi_parse_audio_summary (AAF_Iface* aafi, aafiAudioEssence* audioEssence)
warning ("TODO: Could not parse embedded essence summary. Should try essence data stream ?"); warning ("TODO: Could not parse embedded essence summary. Should try essence data stream ?");
goto err; goto err;
} }
audioEssence->channels = RIFFAudioFile.channels;
audioEssence->samplerate = RIFFAudioFile.sampleRate;
audioEssence->samplesize = RIFFAudioFile.sampleSize;
audioEssence->length = RIFFAudioFile.duration;
} else { } else {
/* TODO: can external essence have audioEssence->summary too ? If mp3 (Resolve 18.5.aaf) ? */ /* TODO: can external essence have audioEssence->summary too ? If mp3 (Resolve 18.5.aaf) ? */
@ -473,26 +537,32 @@ aafi_parse_audio_summary (AAF_Iface* aafi, aafiAudioEssence* audioEssence)
goto err; goto err;
} }
fp = fopen (externalFilePath, "rb"); if (laaf_util_fop_is_wstr_fileext (audioEssence->original_file_path, L"wav") ||
laaf_util_fop_is_wstr_fileext (audioEssence->original_file_path, L"wave") ||
laaf_util_fop_is_wstr_fileext (audioEssence->original_file_path, L"aif") ||
laaf_util_fop_is_wstr_fileext (audioEssence->original_file_path, L"aiff") ||
laaf_util_fop_is_wstr_fileext (audioEssence->original_file_path, L"aifc")) {
fp = fopen (externalFilePath, "rb");
if (fp == NULL) { if (fp == NULL) {
error ("Could not open external audio essence file for reading : %s", externalFilePath); error ("Could not open external audio essence file for reading : %s", externalFilePath);
goto err; goto err;
} }
rc = riff_parseAudioFile (&RIFFAudioFile, RIFF_PARSE_ONLY_HEADER, &externalAudioDataReaderCallback, fp, externalFilePath, aafi, aafi->dbg); rc = riff_parseAudioFile (&RIFFAudioFile, RIFF_PARSE_ONLY_HEADER, &externalAudioDataReaderCallback, fp, externalFilePath, aafi, aafi->dbg);
if (rc < 0) { if (rc < 0) {
error ("TODO IF MP3 ? Failed parsing external essence file : %s", externalFilePath); error ("Failed parsing external audio essence file : %s", externalFilePath);
goto err; goto err;
}
audioEssence->channels = RIFFAudioFile.channels;
audioEssence->samplerate = RIFFAudioFile.sampleRate;
audioEssence->samplesize = RIFFAudioFile.sampleSize;
audioEssence->length = RIFFAudioFile.duration;
} }
} }
audioEssence->channels = RIFFAudioFile.channels;
audioEssence->samplerate = RIFFAudioFile.sampleRate;
audioEssence->samplesize = RIFFAudioFile.sampleSize;
audioEssence->length = RIFFAudioFile.duration;
rc = 0; rc = 0;
goto end; goto end;

View file

@ -202,7 +202,6 @@ xplore_StrongObjectReferenceVector (AAF_Iface* aafi, aafObject* ObjCollection, t
aaf_foreach_ObjectInSet (&Obj, ObjCollection, NULL) aaf_foreach_ObjectInSet (&Obj, ObjCollection, NULL)
{ {
// aaf_dump_ObjectProperties( aafi->aafd, ObjCollection ); // aaf_dump_ObjectProperties( aafi->aafd, ObjCollection );
int offset = 0;
/* TODO implement retrieve_TaggedValue() */ /* TODO implement retrieve_TaggedValue() */
if (aaf_get_property (Obj, PID_TaggedValue_Name) && if (aaf_get_property (Obj, PID_TaggedValue_Name) &&
@ -212,13 +211,13 @@ xplore_StrongObjectReferenceVector (AAF_Iface* aafi, aafObject* ObjCollection, t
if (aafUIDCmp (&indirect->TypeDef, &AAFTypeID_Int32)) { if (aafUIDCmp (&indirect->TypeDef, &AAFTypeID_Int32)) {
int32_t* indirectValue = aaf_get_indirectValue (aafi->aafd, indirect, &AAFTypeID_Int32); int32_t* indirectValue = aaf_get_indirectValue (aafi->aafd, indirect, &AAFTypeID_Int32);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "Tagged | Name: %ls%*s Value (%ls) : %i\n", name, 56 - (int)wcslen (name), " ", aaft_TypeIDToText (&indirect->TypeDef), *indirectValue); DBG_BUFFER_WRITE (dbg, "Tagged | Name: %ls%*s Value (%ls) : %i\n", name, 56 - (int)wcslen (name), " ", aaft_TypeIDToText (&indirect->TypeDef), *indirectValue);
} else if (aafUIDCmp (&indirect->TypeDef, &AAFTypeID_String)) { } else if (aafUIDCmp (&indirect->TypeDef, &AAFTypeID_String)) {
wchar_t* indirectValue = aaf_get_indirectValue (aafi->aafd, indirect, &AAFTypeID_String); wchar_t* indirectValue = aaf_get_indirectValue (aafi->aafd, indirect, &AAFTypeID_String);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "Tagged | Name: %ls%*s Value (%ls) : %ls\n", name, 56 - (int)wcslen (name), " ", aaft_TypeIDToText (&indirect->TypeDef), indirectValue); DBG_BUFFER_WRITE (dbg, "Tagged | Name: %ls%*s Value (%ls) : %ls\n", name, 56 - (int)wcslen (name), " ", aaft_TypeIDToText (&indirect->TypeDef), indirectValue);
free (indirectValue); free (indirectValue);
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "Tagged | Name: %ls%*s Value (%s%ls%s) : %sUNKNOWN_TYPE%s\n", name, 56 - (int)wcslen (name), " ", ANSI_COLOR_RED, aaft_TypeIDToText (&indirect->TypeDef), ANSI_COLOR_RESET, ANSI_COLOR_RED, ANSI_COLOR_RESET); DBG_BUFFER_WRITE (dbg, "Tagged | Name: %ls%*s Value (%s%ls%s) : %sUNKNOWN_TYPE%s\n", name, 56 - (int)wcslen (name), " ", ANSI_COLOR_RED (dbg), aaft_TypeIDToText (&indirect->TypeDef), ANSI_COLOR_RESET (dbg), ANSI_COLOR_RED (dbg), ANSI_COLOR_RESET (dbg));
} }
dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
@ -226,8 +225,6 @@ xplore_StrongObjectReferenceVector (AAF_Iface* aafi, aafObject* ObjCollection, t
free (name); free (name);
} else { } else {
dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
offset = 0;
aaf_dump_ObjectProperties (aafi->aafd, Obj); aaf_dump_ObjectProperties (aafi->aafd, Obj);
} }
} }
@ -240,30 +237,29 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
return; return;
/* Print caller line number */ /* Print caller line number */
struct dbg* dbg = aafi->dbg; struct dbg* dbg = aafi->dbg;
int offset = 0;
if (Obj) { if (Obj) {
switch (state) { switch (state) {
case TD_ERROR: case TD_ERROR:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_RED); DBG_BUFFER_WRITE (dbg, "%serr %s%ls %s", ANSI_COLOR_RED (dbg), ANSI_COLOR_DARKGREY (dbg), L"\u2502", ANSI_COLOR_RED (dbg));
break; break;
case TD_WARNING: case TD_WARNING:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_YELLOW); DBG_BUFFER_WRITE (dbg, "%swrn %s%ls %s", ANSI_COLOR_YELLOW (dbg), ANSI_COLOR_DARKGREY (dbg), L"\u2502", ANSI_COLOR_YELLOW (dbg));
break; break;
case TD_NOT_SUPPORTED: case TD_NOT_SUPPORTED:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_ORANGE); DBG_BUFFER_WRITE (dbg, "%suns %s%ls %s", ANSI_COLOR_ORANGE (dbg), ANSI_COLOR_DARKGREY (dbg), L"\u2502", ANSI_COLOR_ORANGE (dbg));
break; break;
default: default:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_DARKGREY); DBG_BUFFER_WRITE (dbg, " %s%ls ", ANSI_COLOR_DARKGREY (dbg), L"\u2502");
break; break;
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%05i", line); DBG_BUFFER_WRITE (dbg, "%05i", line);
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " "); DBG_BUFFER_WRITE (dbg, " %s%ls%s ", ANSI_COLOR_DARKGREY (dbg), L"\u2502", ANSI_COLOR_RESET (dbg));
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s%ls%s", ANSI_COLOR_DARKGREY, L"\u2502", ANSI_COLOR_RESET); // │ DBG_BUFFER_WRITE (dbg, "%s%ls%s", ANSI_COLOR_DARKGREY (dbg), L"\u2502", ANSI_COLOR_RESET (dbg)); // │
/* Print padding and vertical lines */ /* Print padding and vertical lines */
@ -276,17 +272,17 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
if (i + 1 == __td->lv) { if (i + 1 == __td->lv) {
if (Obj) { if (Obj) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls", L"\u251c\u2500\u2500\u25fb "); // ├──◻ DBG_BUFFER_WRITE (dbg, "%ls", L"\u251c\u2500\u2500\u25fb "); // ├──◻
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls", L"\u2502 "); // │ DBG_BUFFER_WRITE (dbg, "%ls", L"\u2502 "); // │
} }
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls", L"\u2502 "); // │ DBG_BUFFER_WRITE (dbg, "%ls", L"\u2502 "); // │
} }
} else if (i + 1 == __td->lv && Obj) { } else if (i + 1 == __td->lv && Obj) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls", L"\u2514\u2500\u2500\u25fb "); // └──◻ DBG_BUFFER_WRITE (dbg, "%ls", L"\u2514\u2500\u2500\u25fb "); // └──◻
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " "); DBG_BUFFER_WRITE (dbg, " ");
} }
} }
} }
@ -294,27 +290,28 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
if (Obj) { if (Obj) {
switch (state) { switch (state) {
case TD_ERROR: case TD_ERROR:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_RED); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_RED (dbg));
break; break;
case TD_WARNING: case TD_WARNING:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_YELLOW); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_YELLOW (dbg));
break; break;
case TD_NOT_SUPPORTED: case TD_NOT_SUPPORTED:
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_ORANGE); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_ORANGE (dbg));
break; break;
case TD_INFO: case TD_INFO:
case TD_OK: case TD_OK:
if (__td->sub) if (__td->sub) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_DARKGREY); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_DARKGREY (dbg));
else } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_CYAN); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_CYAN (dbg));
}
break; break;
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%ls ", aaft_ClassIDToText (aafi->aafd, Obj->Class->ID)); DBG_BUFFER_WRITE (dbg, "%ls ", aaft_ClassIDToText (aafi->aafd, Obj->Class->ID));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_RESET); DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_RESET (dbg));
if (aafUIDCmp (Obj->Class->ID, &AAFClassID_TimelineMobSlot) && if (aafUIDCmp (Obj->Class->ID, &AAFClassID_TimelineMobSlot) &&
aafUIDCmp (Obj->Parent->Class->ID, &AAFClassID_CompositionMob)) { aafUIDCmp (Obj->Parent->Class->ID, &AAFClassID_CompositionMob)) {
@ -324,17 +321,17 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
uint32_t* slotID = aaf_get_propertyValue (Obj, PID_MobSlot_SlotID, &AAFTypeID_UInt32); uint32_t* slotID = aaf_get_propertyValue (Obj, PID_MobSlot_SlotID, &AAFTypeID_UInt32);
uint32_t* trackNo = aaf_get_propertyValue (Obj, PID_MobSlot_PhysicalTrackNumber, &AAFTypeID_UInt32); uint32_t* trackNo = aaf_get_propertyValue (Obj, PID_MobSlot_PhysicalTrackNumber, &AAFTypeID_UInt32);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "[slot:%s%i%s track:%s%i%s] (DataDef : %s%ls%s) %s%ls ", DBG_BUFFER_WRITE (dbg, "[slot:%s%i%s track:%s%i%s] (DataDef : %s%ls%s) %s%ls ",
ANSI_COLOR_BOLD, ANSI_COLOR_BOLD (dbg),
(slotID) ? (int)(*slotID) : -1, (slotID) ? (int)(*slotID) : -1,
ANSI_COLOR_RESET, ANSI_COLOR_RESET (dbg),
ANSI_COLOR_BOLD, ANSI_COLOR_BOLD (dbg),
(trackNo) ? (int)(*trackNo) : -1, (trackNo) ? (int)(*trackNo) : -1,
ANSI_COLOR_RESET, ANSI_COLOR_RESET (dbg),
ANSI_COLOR_DARKGREY, ANSI_COLOR_DARKGREY (dbg),
aaft_DataDefToText (aafi->aafd, DataDefinition), aaft_DataDefToText (aafi->aafd, DataDefinition),
ANSI_COLOR_RESET, ANSI_COLOR_RESET (dbg),
(name[0] != 0x00) ? ": " : "", (name) ? name : L""); (name[0] != 0x00) ? ": " : "", (name) ? name : L"");
free (name); free (name);
} else if (aafUIDCmp (Obj->Class->ID, &AAFClassID_CompositionMob) || } else if (aafUIDCmp (Obj->Class->ID, &AAFClassID_CompositionMob) ||
@ -343,20 +340,20 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
aafUID_t* usageCode = aaf_get_propertyValue (Obj, PID_Mob_UsageCode, &AAFTypeID_UsageType); aafUID_t* usageCode = aaf_get_propertyValue (Obj, PID_Mob_UsageCode, &AAFTypeID_UsageType);
wchar_t* name = aaf_get_propertyValue (Obj, PID_Mob_Name, &AAFTypeID_String); wchar_t* name = aaf_get_propertyValue (Obj, PID_Mob_Name, &AAFTypeID_String);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "(UsageCode: %s%ls%s) %s%ls", DBG_BUFFER_WRITE (dbg, "(UsageCode: %s%ls%s) %s%ls",
ANSI_COLOR_DARKGREY, ANSI_COLOR_DARKGREY (dbg),
aaft_UsageCodeToText (usageCode), aaft_UsageCodeToText (usageCode),
ANSI_COLOR_RESET, ANSI_COLOR_RESET (dbg),
(name && name[0] != 0x00) ? ": " : "", (name) ? name : L""); (name && name[0] != 0x00) ? ": " : "", (name) ? name : L"");
free (name); free (name);
} else if (aafUIDCmp (Obj->Class->ID, &AAFClassID_OperationGroup)) { } else if (aafUIDCmp (Obj->Class->ID, &AAFClassID_OperationGroup)) {
aafUID_t* OperationIdentification = get_OperationGroup_OperationIdentification (aafi, Obj); aafUID_t* OperationIdentification = get_OperationGroup_OperationIdentification (aafi, Obj);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "(OpIdent: %s%ls%s) ", DBG_BUFFER_WRITE (dbg, "(OpIdent: %s%ls%s) ",
ANSI_COLOR_DARKGREY, ANSI_COLOR_DARKGREY (dbg),
aaft_OperationDefToText (aafi->aafd, OperationIdentification), aaft_OperationDefToText (aafi->aafd, OperationIdentification),
ANSI_COLOR_RESET); ANSI_COLOR_RESET (dbg));
} }
// else if ( aafUIDCmp( Obj->Class->ID, &AAFClassID_TapeDescriptor ) || // else if ( aafUIDCmp( Obj->Class->ID, &AAFClassID_TapeDescriptor ) ||
// aafUIDCmp( Obj->Class->ID, &AAFClassID_FilmDescriptor ) || // aafUIDCmp( Obj->Class->ID, &AAFClassID_FilmDescriptor ) ||
@ -370,19 +367,19 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
// aafUIDCmp( Obj->Class->ID, &AAFClassID_AIFCDescriptor ) ) // aafUIDCmp( Obj->Class->ID, &AAFClassID_AIFCDescriptor ) )
// { // {
// aafUID_t *ContainerFormat = get_FileDescriptor_ContainerFormat( aafi, Obj ); // aafUID_t *ContainerFormat = get_FileDescriptor_ContainerFormat( aafi, Obj );
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "(ContainerIdent : \x1b[38;5;242m%ls\x1b[0m)", aaft_ContainerToText(ContainerFormat) ); // DBG_BUFFER_WRITE( dbg, "(ContainerIdent : \x1b[38;5;242m%ls\x1b[0m)", aaft_ContainerToText(ContainerFormat) );
// } // }
if (state == TD_ERROR) { if (state == TD_ERROR) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, ": %s", ANSI_COLOR_RED); DBG_BUFFER_WRITE (dbg, ": %s", ANSI_COLOR_RED (dbg));
} else if (state == TD_INFO) { } else if (state == TD_INFO) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, ": %s", ANSI_COLOR_CYAN); DBG_BUFFER_WRITE (dbg, ": %s", ANSI_COLOR_CYAN (dbg));
} }
va_list args; va_list args;
va_start (args, fmt); va_start (args, fmt);
offset += laaf_util_vsnprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, fmt, &args); dbg->_dbg_msg_pos += laaf_util_vsnprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, dbg->_dbg_msg_pos, fmt, &args);
va_end (args); va_end (args);
// va_list args; // va_list args;
@ -413,63 +410,79 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta
// va_end( args ); // va_end( args );
if (state == TD_ERROR || state == TD_INFO) { if (state == TD_ERROR || state == TD_INFO) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "."); DBG_BUFFER_WRITE (dbg, ".");
} }
if (state == TD_NOT_SUPPORTED || (aafi->ctx.options.trace_class && wcscmp (aaft_ClassIDToText (aafi->aafd, Obj->Class->ID), aafi->ctx.options.trace_class) == 0)) { if (!aafi->ctx.options.dump_class_aaf_properties) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n%s", (state == TD_NOT_SUPPORTED) ? ANSI_COLOR_ORANGE : "");
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "CFB Object Dump : %ls\n", aaf_get_ObjectPath( Obj ) );
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "=================\n" );
// cfb_dump_node( aafi->aafd->cfbd, Obj->Node, 1 );
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "Properties Dump (%ls)\n", aaf_get_ObjectPath (Obj));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "===============\n\n");
// aaf_dump_nodeStreamProperties( aafi->aafd, Obj->Node );
// dbg->debug_callback( dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user );
//
// offset = 0;
// aaf_dump_ObjectProperties( aafi->aafd, Obj );
} else {
aafProperty* Prop = NULL; aafProperty* Prop = NULL;
int hasUnknownProps = 0; int hasUnknownProps = 0;
for (Prop = Obj->Properties; Prop != NULL; Prop = Prop->next) { for (Prop = Obj->Properties; Prop != NULL; Prop = Prop->next) {
if (Prop->def->meta) { if (Prop->def->meta) {
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); // DBG_BUFFER_WRITE( dbg, "\n");
if (aafi->ctx.options.trace_meta) { if (aafi->ctx.options.trace_meta) {
// aaf_dump_ObjectProperties( aafi->aafd, Obj ); // aaf_dump_ObjectProperties( aafi->aafd, Obj );
// if ( Prop->pid == 0xffca ) { // if ( Prop->pid == 0xffca ) {
if (Prop->sf == SF_STRONG_OBJECT_REFERENCE_VECTOR) { if (Prop->sf == SF_STRONG_OBJECT_REFERENCE_VECTOR) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " >>> (0x%04x) %ls (%ls)\n", Prop->pid, aaft_PIDToText (aafi->aafd, Prop->pid), aaft_StoredFormToText (Prop->sf) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/); DBG_BUFFER_WRITE (dbg, " >>> (0x%04x) %ls (%ls)\n", Prop->pid, aaft_PIDToText (aafi->aafd, Prop->pid), aaft_StoredFormToText (Prop->sf) /*AUIDToText( &Prop->def->type ),*/ /*aaft_TypeIDToText( &(Prop->def->type) )*/);
void* propValue = aaf_get_propertyValue (Obj, Prop->pid, &AAFUID_NULL); void* propValue = aaf_get_propertyValue (Obj, Prop->pid, &AAFUID_NULL);
xplore_StrongObjectReferenceVector (aafi, propValue, __td); xplore_StrongObjectReferenceVector (aafi, propValue, __td);
// DUMP_OBJ_NO_SUPPORT( aafi, propValue, __td ); // DUMP_OBJ_NO_SUPPORT( aafi, propValue, __td );
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
aaf_dump_ObjectProperty (aafi->aafd, Prop); aaf_dump_ObjectProperty (aafi->aafd, Prop);
} }
} else { } else {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s%s %ls[0x%04x]", ANSI_COLOR_RESET, (!hasUnknownProps) ? " (MetaProps:" : "", aaft_PIDToText (aafi->aafd, Prop->pid), Prop->pid); DBG_BUFFER_WRITE (dbg, "%s%s %ls[0x%04x]", ANSI_COLOR_RESET (dbg), (!hasUnknownProps) ? " (MetaProps:" : "", aaft_PIDToText (aafi->aafd, Prop->pid), Prop->pid);
// laaf_util_dump_hex( Prop->val, Prop->len ); // laaf_util_dump_hex( Prop->val, Prop->len );
hasUnknownProps++; hasUnknownProps++;
} }
} }
} }
if (aafi->ctx.options.trace_meta == 0 && hasUnknownProps) { if (aafi->ctx.options.trace_meta == 0 && hasUnknownProps) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, ")"); DBG_BUFFER_WRITE (dbg, ")");
} }
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%s", ANSI_COLOR_RESET); if (aafi->ctx.options.dump_class_raw_properties && wcscmp (aaft_ClassIDToText (aafi->aafd, Obj->Class->ID), aafi->ctx.options.dump_class_raw_properties) == 0) {
DBG_BUFFER_WRITE (dbg, "\n\n");
DBG_BUFFER_WRITE (dbg, "======================================================================\n");
DBG_BUFFER_WRITE (dbg, " CFB Object Properties Dump\n");
DBG_BUFFER_WRITE (dbg, "======================================================================\n");
DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_DARKGREY (dbg));
DBG_BUFFER_WRITE (dbg, "%ls\n", aaft_ClassIDToText (aafi->aafd, Obj->Class->ID));
DBG_BUFFER_WRITE (dbg, "%ls/properties\n", aaf_get_ObjectPath (Obj));
DBG_BUFFER_WRITE (dbg, "%s\n\n", ANSI_COLOR_RESET (dbg));
// cfb_dump_node( aafi->aafd->cfbd, cfb_getChildNode( aafi->aafd->cfbd, L"properties", Obj->Node ), 1 );
aaf_dump_nodeStreamProperties (aafi->aafd, cfb_getChildNode (aafi->aafd->cfbd, L"properties", Obj->Node));
DBG_BUFFER_WRITE (dbg, "\n");
}
if (aafi->ctx.options.dump_class_aaf_properties && wcscmp (aaft_ClassIDToText (aafi->aafd, Obj->Class->ID), aafi->ctx.options.dump_class_aaf_properties) == 0) {
DBG_BUFFER_WRITE (dbg, "\n\n");
DBG_BUFFER_WRITE (dbg, "======================================================================\n");
DBG_BUFFER_WRITE (dbg, " AAF Properties Dump\n");
DBG_BUFFER_WRITE (dbg, "======================================================================\n");
DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_DARKGREY (dbg));
DBG_BUFFER_WRITE (dbg, "%ls\n", aaft_ClassIDToText (aafi->aafd, Obj->Class->ID));
DBG_BUFFER_WRITE (dbg, "%ls/properties\n", aaf_get_ObjectPath (Obj));
DBG_BUFFER_WRITE (dbg, "%s\n\n", ANSI_COLOR_RESET (dbg));
aaf_dump_ObjectProperties (aafi->aafd, Obj);
DBG_BUFFER_WRITE (dbg, "\n");
}
DBG_BUFFER_WRITE (dbg, "%s", ANSI_COLOR_RESET (dbg));
} }
// offset += laaf_util_snprintf_realloc( &dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n" ); // DBG_BUFFER_WRITE( dbg, "\n" );
dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user); dbg->debug_callback (dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
@ -997,29 +1010,45 @@ parse_DigitalImageDescriptor (AAF_Iface* aafi, aafObject* DIDescriptor, td* __pt
return -1; return -1;
} }
/*
* « Informative note: In the case of picture essence, the Sample Rate is usually the frame rate. The value should be
* numerically exact, for example {25,1} or {30000, 1001}. »
*
* « Informative note: Care should be taken if a sample rate of {2997,100} is encountered, since this may have been intended
* as a (mistaken) approximation to the exact value. »
*/
aafRational_t* framerate = aaf_get_propertyValue (DIDescriptor, PID_FileDescriptor_SampleRate, &AAFTypeID_Rational); aafRational_t* framerate = aaf_get_propertyValue (DIDescriptor, PID_FileDescriptor_SampleRate, &AAFTypeID_Rational);
if (framerate == NULL) { if (framerate == NULL) { /* REQ */
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_FileDescriptor_SampleRate"); DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_FileDescriptor_SampleRate (framerate)");
return -1; return -1;
} }
videoEssence->framerate = framerate; videoEssence->framerate = framerate;
debug ("Video framerate : %i/%i", framerate->numerator, framerate->denominator);
/*
* All mandatory properties below are treated as optional, because we assume that
* video will be an external file so we are not using those, and because some AAF
* implementations does not even set those mandatory properties (eg. Davinci Resolve).
*
* TODO: parse PID_FileDescriptor_Length ?
*/
uint32_t* storedHeight = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_StoredHeight, &AAFTypeID_UInt32); uint32_t* storedHeight = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_StoredHeight, &AAFTypeID_UInt32);
if (storedHeight == NULL) { if (storedHeight == NULL) { /* REQ */
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_StoredHeight"); DUMP_OBJ_WARNING (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_StoredHeight");
return -1;
} }
// debug( "storedHeight : %u", *storedHeight ); // debug( "storedHeight : %u", *storedHeight );
uint32_t* storedWidth = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_StoredWidth, &AAFTypeID_UInt32); uint32_t* storedWidth = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_StoredWidth, &AAFTypeID_UInt32);
if (storedWidth == NULL) { if (storedWidth == NULL) { /* REQ */
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_StoredWidth"); DUMP_OBJ_WARNING (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_StoredWidth");
return -1;
} }
// debug( "storedWidth : %u", *storedWidth ); // debug( "storedWidth : %u", *storedWidth );
@ -1027,8 +1056,7 @@ parse_DigitalImageDescriptor (AAF_Iface* aafi, aafObject* DIDescriptor, td* __pt
uint32_t* displayHeight = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_DisplayHeight, &AAFTypeID_UInt32); uint32_t* displayHeight = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_DisplayHeight, &AAFTypeID_UInt32);
if (displayHeight == NULL) { if (displayHeight == NULL) {
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_DisplayHeight"); DUMP_OBJ_WARNING (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_DisplayHeight");
return -1;
} }
// debug( "displayHeight : %u", *displayHeight ); // debug( "displayHeight : %u", *displayHeight );
@ -1036,17 +1064,15 @@ parse_DigitalImageDescriptor (AAF_Iface* aafi, aafObject* DIDescriptor, td* __pt
uint32_t* displayWidth = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_DisplayWidth, &AAFTypeID_UInt32); uint32_t* displayWidth = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_DisplayWidth, &AAFTypeID_UInt32);
if (displayWidth == NULL) { if (displayWidth == NULL) {
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_DisplayWidth"); DUMP_OBJ_WARNING (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_DisplayWidth");
return -1;
} }
// debug( "displayWidth : %u", *displayWidth ); // debug( "displayWidth : %u", *displayWidth );
aafRational_t* imageAspectRatio = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_ImageAspectRatio, &AAFTypeID_Rational); aafRational_t* imageAspectRatio = aaf_get_propertyValue (DIDescriptor, PID_DigitalImageDescriptor_ImageAspectRatio, &AAFTypeID_Rational);
if (imageAspectRatio == NULL) { if (imageAspectRatio == NULL) { /* REQ */
DUMP_OBJ_ERROR (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_ImageAspectRatio"); DUMP_OBJ_WARNING (aafi, DIDescriptor, &__td, "Missing PID_DigitalImageDescriptor_ImageAspectRatio");
return -1;
} }
// debug( "imageAspectRatio : %i/%i", imageAspectRatio->numerator, imageAspectRatio->denominator ); // debug( "imageAspectRatio : %i/%i", imageAspectRatio->numerator, imageAspectRatio->denominator );
@ -2550,6 +2576,17 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
} else if (aafUIDCmp (DataDefinition, &AAFDataDef_Picture) || } else if (aafUIDCmp (DataDefinition, &AAFDataDef_Picture) ||
aafUIDCmp (DataDefinition, &AAFDataDef_LegacyPicture)) { aafUIDCmp (DataDefinition, &AAFDataDef_LegacyPicture)) {
/*
* 04382 AAFClassID_TimelineMobSlot [slot:2 track:1] (DataDef : AAFDataDef_Picture)
* 01939 AAFClassID_Sequence
* 03007 AAFClassID_SourceClip
*/
/*
* 04390 AAFClassID_TimelineMobSlot [slot:8 track:1] (DataDef : AAFDataDef_LegacyPicture) : Video Mixdown
* 03007 AAFClassID_SourceClip
*/
if (aafi->Video->Tracks->Items) { if (aafi->Video->Tracks->Items) {
DUMP_OBJ_ERROR (aafi, SourceClip, &__td, "Current implementation supports only one video clip"); DUMP_OBJ_ERROR (aafi, SourceClip, &__td, "Current implementation supports only one video clip");
return -1; return -1;
@ -2616,6 +2653,11 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
parse_MobSlot (aafi, refMobSlot, &__td); parse_MobSlot (aafi, refMobSlot, &__td);
// memcpy( &(aafi->ctx), &ctxBackup, sizeof(struct aafiContext) ); // memcpy( &(aafi->ctx), &ctxBackup, sizeof(struct aafiContext) );
} else {
DUMP_OBJ_ERROR (aafi, SourceClip, &__td, "RefMob isn't MasterMob : %ls", aaft_ClassIDToText (aafi->aafd, refMob->Class->ID));
// parse_CompositionMob( )
return -1;
} }
} }
} }
@ -2740,6 +2782,23 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
} else if (aafUIDCmp (DataDefinition, &AAFDataDef_Picture) || } else if (aafUIDCmp (DataDefinition, &AAFDataDef_Picture) ||
aafUIDCmp (DataDefinition, &AAFDataDef_LegacyPicture)) { aafUIDCmp (DataDefinition, &AAFDataDef_LegacyPicture)) {
/*
* 04382 AAFClassID_TimelineMobSlot [slot:2 track:1] (DataDef : AAFDataDef_Picture)
* 01939 AAFClassID_Sequence
* 03007 AAFClassID_SourceClip
* 03012 AAFClassID_MasterMob (UsageCode: n/a) : sample@29
* 04402 AAFClassID_TimelineMobSlot
* 03234 AAFClassID_SourceClip
*/
/*
* 04390 AAFClassID_TimelineMobSlot [slot:8 track:1] (DataDef : AAFDataDef_LegacyPicture) : Video Mixdown
* 03007 AAFClassID_SourceClip
* 03012 AAFClassID_MasterMob (UsageCode: n/a) : 2975854 - PREPARATIFS DISPOSITIF 2 30.Exported.01,Video Mixdown,5 (MetaProps: ConvertFrameRate[0xfff8])
* 04410 AAFClassID_TimelineMobSlot
* 03242 AAFClassID_SourceClip
*/
/* Check if this Essence has already been retrieved */ /* Check if this Essence has already been retrieved */
// int slotID = MobSlot->Entry->_localKey; // int slotID = MobSlot->Entry->_localKey;
@ -2760,6 +2819,8 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
if (aafMobIDCmp (videoEssence->sourceMobID, sourceID) && videoEssence->sourceMobSlotID == (unsigned)*SourceMobSlotID) { if (aafMobIDCmp (videoEssence->sourceMobID, sourceID) && videoEssence->sourceMobSlotID == (unsigned)*SourceMobSlotID) {
/* Essence already retrieved */ /* Essence already retrieved */
aafi->ctx.current_video_clip->Essence = videoEssence; aafi->ctx.current_video_clip->Essence = videoEssence;
__td.eob = 1;
DUMP_OBJ_INFO (aafi, SourceClip, &__td, "Essence already parsed: Linking with %ls", videoEssence->file_name);
return 0; return 0;
} }
} }
@ -2775,6 +2836,10 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
videoEssence->file_name = aaf_get_propertyValue (ParentMob, PID_Mob_Name, &AAFTypeID_String); videoEssence->file_name = aaf_get_propertyValue (ParentMob, PID_Mob_Name, &AAFTypeID_String);
if (videoEssence->file_name == NULL) {
debug ("Missing MasterMob::PID_Mob_Name (essence file name)");
}
/* /*
* p.49 : To create a SourceReference that refers to a MobSlot within * p.49 : To create a SourceReference that refers to a MobSlot within
* the same Mob as the SourceReference, omit the SourceID property. * the same Mob as the SourceReference, omit the SourceID property.
@ -2788,8 +2853,6 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
// warning( "Could not retrieve SourceReference::SourceID, retrieving from parent Mob." ); // warning( "Could not retrieve SourceReference::SourceID, retrieving from parent Mob." );
// } // }
aafi->ctx.current_video_essence = videoEssence;
DUMP_OBJ (aafi, SourceClip, &__td); DUMP_OBJ (aafi, SourceClip, &__td);
aafObject* SourceMob = aaf_get_MobByID (aafi->aafd->Mobs, videoEssence->sourceMobID); aafObject* SourceMob = aaf_get_MobByID (aafi->aafd->Mobs, videoEssence->sourceMobID);
@ -2801,15 +2864,21 @@ POS NOT UPDATED HERE ------------------> └──◻ AAFClassID_SourceClip
videoEssence->SourceMob = SourceMob; videoEssence->SourceMob = SourceMob;
aafObject* EssenceData = get_EssenceData_By_MobID (aafi, videoEssence->sourceMobID);
if (EssenceData)
__td.ll[__td.lv] = 2;
aafi->ctx.current_video_essence = videoEssence;
parse_SourceMob (aafi, SourceMob, &__td); parse_SourceMob (aafi, SourceMob, &__td);
aafObject* EssenceData = get_EssenceData_By_MobID (aafi, videoEssence->sourceMobID); __td.ll[__td.lv] = 0;
if (EssenceData == NULL) { if (EssenceData == NULL) {
/* /*
* It means essence is not embedded. * It means essence is not embedded.
*/ */
// return -1; // return -1;
} else { } else {
parse_EssenceData (aafi, EssenceData, &__td); parse_EssenceData (aafi, EssenceData, &__td);
@ -4089,8 +4158,10 @@ aafi_retrieveData (AAF_Iface* aafi)
foreachEssence (audioEssence, aafi->Audio->Essences) foreachEssence (audioEssence, aafi->Audio->Essences)
{ {
/* TODO: rename (not only summary, can be external file too) */ if (audioEssence->type != AAFI_ESSENCE_TYPE_PCM) {
aafi_parse_audio_summary (aafi, audioEssence); /* TODO: rename (not only summary, can be external file too) */
aafi_parse_audio_summary (aafi, audioEssence);
}
/* TODO : check samplerate / samplesize proportions accross essences, and choose the most used values as composition values */ /* TODO : check samplerate / samplesize proportions accross essences, and choose the most used values as composition values */
if (aafi->Audio->samplerate == 0 || aafi->Audio->samplerate == audioEssence->samplerate) { if (aafi->Audio->samplerate == 0 || aafi->Audio->samplerate == audioEssence->samplerate) {
@ -4106,6 +4177,42 @@ aafi_retrieveData (AAF_Iface* aafi)
} }
} }
aafiVideoEssence* videoEssence = NULL;
foreachEssence (videoEssence, aafi->Video->Essences)
{
if (videoEssence->original_file_path == NULL) {
continue;
}
char* externalFilePath = aafi_locate_external_essence_file (aafi, videoEssence->original_file_path, aafi->ctx.options.media_location);
if (externalFilePath == NULL) {
error ("Could not locate external audio essence file '%ls'", videoEssence->original_file_path);
continue;
}
videoEssence->usable_file_path = malloc ((strlen (externalFilePath) + 1) * sizeof (wchar_t));
if (videoEssence->usable_file_path == NULL) {
error ("Could not allocate memory : %s", strerror (errno));
free (externalFilePath);
continue;
}
int rc = swprintf (videoEssence->usable_file_path, strlen (externalFilePath) + 1, L"%" WPRIs, externalFilePath);
if (rc < 0) {
error ("Failed setting usable_file_path");
free (externalFilePath);
free (videoEssence->usable_file_path);
videoEssence->usable_file_path = NULL;
continue;
}
free (externalFilePath);
}
aafiAudioTrack* audioTrack = NULL; aafiAudioTrack* audioTrack = NULL;
foreach_audioTrack (audioTrack, aafi) foreach_audioTrack (audioTrack, aafi)

View file

@ -119,22 +119,11 @@ aafi_alloc (AAF_Data* aafd)
} }
void void
aafi_enable_windows_VT100_output (void) aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, int ansicolor, FILE* fp, void (*callback) (struct dbg* dbg, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user)
{ {
#ifdef _WIN32 aafi->dbg->verb = v;
/* enables ANSI colors and unicode chars */ aafi->dbg->ansicolor = ansicolor;
HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE); aafi->dbg->fp = fp;
DWORD dwMode = 0;
GetConsoleMode (hOut, &dwMode);
SetConsoleMode (hOut, (dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING));
#endif
}
void
aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, FILE* fp, void (*callback) (struct dbg* dbg, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user)
{
aafi->dbg->verb = v;
aafi->dbg->fp = fp;
if (callback) { if (callback) {
aafi->dbg->debug_callback = callback; aafi->dbg->debug_callback = callback;
@ -146,34 +135,78 @@ aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, FILE* fp, void (*callback)
} }
int int
aafi_set_media_location (AAF_Iface* aafi, const char* path) aafi_set_option_int (AAF_Iface* aafi, const char* optname, int val)
{ {
if (aafi->ctx.options.media_location) { if (strcmp (optname, "trace") == 0) {
free (aafi->ctx.options.media_location); aafi->ctx.options.trace = val;
return 0;
} else if (strcmp (optname, "trace_meta") == 0) {
aafi->ctx.options.trace_meta = val;
return 0;
} else if (strcmp (optname, "forbid_nonlatin_filenames") == 0) {
aafi->ctx.options.forbid_nonlatin_filenames = val;
return 0;
} else if (strcmp (optname, "protools") == 0) {
aafi->ctx.options.protools = val;
return 0;
} else if (strcmp (optname, "resolve") == 0) {
aafi->ctx.options.resolve = val;
return 0;
} }
aafi->ctx.options.media_location = (path) ? laaf_util_c99strdup (path) : NULL; return 1;
return 0;
} }
int int
aafi_set_trace_class (AAF_Iface* aafi, const char* className) aafi_set_option_str (AAF_Iface* aafi, const char* optname, const char* val)
{ {
if (aafi->ctx.options.trace_class) { if (strcmp (optname, "media_location") == 0) {
free (aafi->ctx.options.trace_class); if (aafi->ctx.options.media_location) {
aafi->ctx.options.trace_class = NULL; free (aafi->ctx.options.media_location);
}
aafi->ctx.options.media_location = (val) ? laaf_util_c99strdup (val) : NULL;
return 0;
} else if (strcmp (optname, "dump_class_aaf_properties") == 0) {
if (aafi->ctx.options.dump_class_aaf_properties) {
free (aafi->ctx.options.dump_class_aaf_properties);
aafi->ctx.options.dump_class_aaf_properties = NULL;
}
if (val == NULL)
return 0;
aafi->ctx.options.dump_class_aaf_properties = malloc ((strlen (val) + 1) * sizeof (wchar_t));
if (aafi->ctx.options.dump_class_aaf_properties == NULL) {
return -1;
}
swprintf (aafi->ctx.options.dump_class_aaf_properties, strlen (val) + 1, L"%" WPRIs, val);
return 0;
} else if (strcmp (optname, "dump_class_raw_properties") == 0) {
if (aafi->ctx.options.dump_class_raw_properties) {
free (aafi->ctx.options.dump_class_raw_properties);
aafi->ctx.options.dump_class_raw_properties = NULL;
}
if (val == NULL)
return 0;
aafi->ctx.options.dump_class_raw_properties = malloc ((strlen (val) + 1) * sizeof (wchar_t));
if (aafi->ctx.options.dump_class_raw_properties == NULL) {
return -1;
}
swprintf (aafi->ctx.options.dump_class_raw_properties, strlen (val) + 1, L"%" WPRIs, val);
return 0;
} }
aafi->ctx.options.trace_class = malloc ((strlen (className) + 1) * sizeof (wchar_t)); return 1;
if (aafi->ctx.options.trace_class == NULL) {
return -1;
}
swprintf (aafi->ctx.options.trace_class, strlen (className) + 1, L"%" WPRIs, className);
return 0;
} }
void void
@ -220,8 +253,12 @@ aafi_release (AAF_Iface** aafi)
aafi_freeMarkers (&(*aafi)->Markers); aafi_freeMarkers (&(*aafi)->Markers);
} }
if ((*aafi)->ctx.options.trace_class) { if ((*aafi)->ctx.options.dump_class_aaf_properties) {
free ((*aafi)->ctx.options.trace_class); free ((*aafi)->ctx.options.dump_class_aaf_properties);
}
if ((*aafi)->ctx.options.dump_class_raw_properties) {
free ((*aafi)->ctx.options.dump_class_raw_properties);
} }
if ((*aafi)->ctx.options.media_location) { if ((*aafi)->ctx.options.media_location) {
@ -297,7 +334,7 @@ aafi_get_xfade (aafiTimelineItem* audioItem)
} }
aafiMarker* aafiMarker*
aafi_newMarker (AAF_Iface* aafi, aafRational_t* editRate, aafPosition_t start, aafPosition_t length, wchar_t* name, wchar_t* comment, uint16_t*(RVBColor[3])) aafi_newMarker (AAF_Iface* aafi, aafRational_t* editRate, aafPosition_t start, aafPosition_t length, wchar_t* name, wchar_t* comment, uint16_t*(RGBColor[3]))
{ {
aafiMarker* marker = malloc (sizeof (aafiMarker)); aafiMarker* marker = malloc (sizeof (aafiMarker));
@ -311,10 +348,10 @@ aafi_newMarker (AAF_Iface* aafi, aafRational_t* editRate, aafPosition_t start, a
marker->prev = NULL; marker->prev = NULL;
marker->next = NULL; marker->next = NULL;
if (RVBColor) { if (RGBColor) {
marker->RVBColor[0] = (*RVBColor)[0]; marker->RGBColor[0] = (*RGBColor)[0];
marker->RVBColor[1] = (*RVBColor)[1]; marker->RGBColor[1] = (*RGBColor)[1];
marker->RVBColor[2] = (*RVBColor)[2]; marker->RGBColor[2] = (*RGBColor)[2];
} }
if (aafi->Markers != NULL) { if (aafi->Markers != NULL) {

View file

@ -1939,9 +1939,9 @@ aaft_PIDToText (AAF_Data* aafd, aafPID_t pid)
{ {
if (PDef->pid == pid) { if (PDef->pid == pid) {
swprintf (PIDText, 1024, L"%" WPRIs L"%" WPRIws L"%" WPRIs, swprintf (PIDText, 1024, L"%" WPRIs L"%" WPRIws L"%" WPRIs,
(PDef->meta) ? ANSI_COLOR_YELLOW : "", (PDef->meta) ? ANSI_COLOR_YELLOW (aafd->dbg) : "",
PDef->name, PDef->name,
(PDef->meta) ? ANSI_COLOR_RESET : ""); (PDef->meta) ? ANSI_COLOR_RESET (aafd->dbg) : "");
return PIDText; return PIDText;
} }
} }
@ -2175,9 +2175,9 @@ aaft_ClassIDToText (AAF_Data* aafd, const aafUID_t* auid)
{ {
if (aafUIDCmp (Class->ID, auid)) { if (aafUIDCmp (Class->ID, auid)) {
swprintf (ClassIDText, 1024, L"%" WPRIs L"%" WPRIws L"%" WPRIs, swprintf (ClassIDText, 1024, L"%" WPRIs L"%" WPRIws L"%" WPRIs,
(Class->meta) ? ANSI_COLOR_YELLOW : "", (Class->meta) ? ANSI_COLOR_YELLOW (aafd->dbg) : "",
Class->name, Class->name,
(Class->meta) ? ANSI_COLOR_RESET : ""); (Class->meta) ? ANSI_COLOR_RESET (aafd->dbg) : "");
return ClassIDText; return ClassIDText;
} }
} }

View file

@ -51,49 +51,50 @@ cfb_dump_node (CFB_Data* cfbd, cfbNode* node, int print_stream)
cfb_w16towchar (nodeName, node->_ab, node->_cb); cfb_w16towchar (nodeName, node->_ab, node->_cb);
int offset = 0; struct dbg* dbg = cfbd->dbg;
struct dbg* dbg = cfbd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _ab : %ls\n", nodeName); DBG_BUFFER_WRITE (dbg, " _ab : %ls\n", nodeName);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _cb : %u\n", node->_cb); DBG_BUFFER_WRITE (dbg, " _cb : %u\n", node->_cb);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _mse : %s\n", DBG_BUFFER_WRITE (dbg, " _mse : %s\n",
node->_mse == 0 ? "STGTY_INVALID" : node->_mse == 1 ? "STGTY_STORAGE" node->_mse == 0 ? "STGTY_INVALID" : node->_mse == 1 ? "STGTY_STORAGE"
: node->_mse == 2 ? "STGTY_STREAM" : node->_mse == 2 ? "STGTY_STREAM"
: node->_mse == 3 ? "STGTY_LOCKBYTES" : node->_mse == 3 ? "STGTY_LOCKBYTES"
: node->_mse == 4 ? "STGTY_PROPERTY" : node->_mse == 4 ? "STGTY_PROPERTY"
: node->_mse == 5 ? "STGTY_ROOT" : node->_mse == 5 ? "STGTY_ROOT"
: ""); : "");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _bflags : %s\n", node->_bflags == 1 ? "BLACK" : "RED"); DBG_BUFFER_WRITE (dbg, " _bflags : %s\n", node->_bflags == 1 ? "BLACK" : "RED");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _sidLeftSib : 0x%08x\n", node->_sidLeftSib); DBG_BUFFER_WRITE (dbg, " _sidLeftSib : 0x%08x\n", node->_sidLeftSib);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _sidRightSib : 0x%08x\n", node->_sidRightSib); DBG_BUFFER_WRITE (dbg, " _sidRightSib : 0x%08x\n", node->_sidRightSib);
if (node->_mse == STGTY_STORAGE || if (node->_mse == STGTY_STORAGE ||
node->_mse == STGTY_ROOT) { node->_mse == STGTY_ROOT) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _sidChild : 0x%08x\n", node->_sidChild); DBG_BUFFER_WRITE (dbg, " _sidChild : 0x%08x\n", node->_sidChild);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _clsid : %ls\n", cfb_CLSIDToText (&(node->_clsId))); DBG_BUFFER_WRITE (dbg, " _clsid : %ls\n", cfb_CLSIDToText (&(node->_clsId)));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _dwUserFlags : 0x%08x (%d)\n", node->_dwUserFlags, node->_dwUserFlags); DBG_BUFFER_WRITE (dbg, " _dwUserFlags : 0x%08x (%d)\n", node->_dwUserFlags, node->_dwUserFlags);
} }
if (node->_mse == STGTY_INVALID) { if (node->_mse == STGTY_INVALID) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _time (cre) : 0x%08x%08x\n", DBG_BUFFER_WRITE (dbg, " _time (cre) : 0x%08x%08x\n",
node->_time[0].dwHighDateTime, node->_time[0].dwHighDateTime,
node->_time[0].dwLowDateTime); node->_time[0].dwLowDateTime);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _ (mod) : 0x%08x%08x\n", DBG_BUFFER_WRITE (dbg, " _ (mod) : 0x%08x%08x\n",
node->_time[1].dwHighDateTime, node->_time[1].dwHighDateTime,
node->_time[1].dwLowDateTime); node->_time[1].dwLowDateTime);
} }
if (node->_mse == STGTY_STREAM || if (node->_mse == STGTY_STREAM ||
node->_mse == STGTY_ROOT) { node->_mse == STGTY_ROOT) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _sectStart : 0x%08x (%d)\n", node->_sectStart, node->_sectStart); DBG_BUFFER_WRITE (dbg, " _sectStart : 0x%08x (%d)\n", node->_sectStart, node->_sectStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _ulSizeLow : 0x%08x (%d)\n", node->_ulSizeLow, node->_ulSizeLow); DBG_BUFFER_WRITE (dbg, " _ulSizeLow : 0x%08x (%d)\n", node->_ulSizeLow, node->_ulSizeLow);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " _ulSizeHigh : 0x%08x (%d)\n", node->_ulSizeHigh, node->_ulSizeHigh); DBG_BUFFER_WRITE (dbg, " _ulSizeHigh : 0x%08x (%d)\n", node->_ulSizeHigh, node->_ulSizeHigh);
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
if (print_stream == 1) { if (print_stream == 1) {
cfb_dump_nodeStream (cfbd, node); cfb_dump_nodeStream (cfbd, node);
@ -110,17 +111,14 @@ cfb_dump_nodePath (CFB_Data* cfbd, const wchar_t* path, int print_stream)
return; return;
} }
int offset = 0;
struct dbg* dbg = cfbd->dbg;
cfb_dump_node (cfbd, node, print_stream); cfb_dump_node (cfbd, node, print_stream);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n");
} }
void void
cfb_dump_nodeStream (CFB_Data* cfbd, cfbNode* node) cfb_dump_nodeStream (CFB_Data* cfbd, cfbNode* node)
{ {
struct dbg* dbg = cfbd->dbg;
unsigned char* stream = NULL; unsigned char* stream = NULL;
uint64_t stream_sz = 0; uint64_t stream_sz = 0;
@ -130,7 +128,9 @@ cfb_dump_nodeStream (CFB_Data* cfbd, cfbNode* node)
return; return;
} }
laaf_util_dump_hex (stream, stream_sz, &cfbd->dbg->_dbg_msg, &cfbd->dbg->_dbg_msg_size, 0); laaf_util_dump_hex (stream, stream_sz, &dbg->_dbg_msg, &dbg->_dbg_msg_size, dbg->_dbg_msg_pos);
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
free (stream); free (stream);
} }
@ -138,6 +138,8 @@ cfb_dump_nodeStream (CFB_Data* cfbd, cfbNode* node)
void void
cfb_dump_nodePathStream (CFB_Data* cfbd, const wchar_t* path) cfb_dump_nodePathStream (CFB_Data* cfbd, const wchar_t* path)
{ {
struct dbg* dbg = cfbd->dbg;
cfbNode* node = cfb_getNodeByPath (cfbd, path, 0); cfbNode* node = cfb_getNodeByPath (cfbd, path, 0);
if (node == NULL) { if (node == NULL) {
@ -150,7 +152,9 @@ cfb_dump_nodePathStream (CFB_Data* cfbd, const wchar_t* path)
cfb_getStream (cfbd, node, &stream, &stream_sz); cfb_getStream (cfbd, node, &stream, &stream_sz);
laaf_util_dump_hex (stream, stream_sz, &cfbd->dbg->_dbg_msg, &cfbd->dbg->_dbg_msg_size, 0); laaf_util_dump_hex (stream, stream_sz, &dbg->_dbg_msg, &dbg->_dbg_msg_size, dbg->_dbg_msg_pos);
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
free (stream); free (stream);
} }
@ -158,6 +162,8 @@ cfb_dump_nodePathStream (CFB_Data* cfbd, const wchar_t* path)
void void
cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_t* str_i, cfbNode* node) cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_t* str_i, cfbNode* node)
{ {
struct dbg* dbg = cfbd->dbg;
if (node == NULL) { if (node == NULL) {
/* the begining of the first function call. */ /* the begining of the first function call. */
node = &cfbd->nodes[0]; node = &cfbd->nodes[0];
@ -195,152 +201,155 @@ cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_
/* the end of the first function call, recursion is over. */ /* the end of the first function call, recursion is over. */
if (node == &cfbd->nodes[0]) { if (node == &cfbd->nodes[0]) {
int offset = 0;
struct dbg* dbg = cfbd->dbg;
/* commented out because output is proper this way... why did we call qsort() in the first place ?! */ /* commented out because output is proper this way... why did we call qsort() in the first place ?! */
// qsort( strArray, *str_i, sizeof(char*), compareStrings ); // qsort( strArray, *str_i, sizeof(char*), compareStrings );
for (uint32_t i = 0; i < cfbd->nodes_cnt && strArray[i] != NULL; i++) { for (uint32_t i = 0; i < cfbd->nodes_cnt && strArray[i] != NULL; i++) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "%05i : %s\n", i, strArray[i]); DBG_BUFFER_WRITE (dbg, "%05i : %s\n", i, strArray[i]);
free (strArray[i]); free (strArray[i]);
} }
free (strArray); free (strArray);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
} }
void void
cfb_dump_header (CFB_Data* cfbd) cfb_dump_header (CFB_Data* cfbd)
{ {
struct dbg* dbg = cfbd->dbg;
cfbHeader* cfbh = cfbd->hdr; cfbHeader* cfbh = cfbd->hdr;
int offset = 0; DBG_BUFFER_WRITE (dbg, "_abSig : 0x%08" PRIx64 "\n", cfbh->_abSig);
struct dbg* dbg = cfbd->dbg; DBG_BUFFER_WRITE (dbg, "_clsId : %ls\n", cfb_CLSIDToText (&(cfbh->_clsid)));
DBG_BUFFER_WRITE (dbg, " version : %u.%u ( 0x%04x 0x%04x )\n",
cfbh->_uMinorVersion, cfbh->_uDllVersion,
cfbh->_uMinorVersion, cfbh->_uDllVersion);
DBG_BUFFER_WRITE (dbg, "_uByteOrder : %s ( 0x%04x )\n",
cfbh->_uByteOrder == 0xFFFE ? "little-endian" : cfbh->_uByteOrder == 0xFEFF ? "big-endian"
: "?",
cfbh->_uByteOrder);
DBG_BUFFER_WRITE (dbg, "_uSectorShift : %u (%u bytes sectors)\n",
cfbh->_uSectorShift,
1 << cfbh->_uSectorShift);
DBG_BUFFER_WRITE (dbg, "_uMiniSectorShift : %u (%u bytes mini-sectors)\n",
cfbh->_uMiniSectorShift,
1 << cfbh->_uMiniSectorShift);
DBG_BUFFER_WRITE (dbg, "_usReserved0 : 0x%02x\n", cfbh->_usReserved);
DBG_BUFFER_WRITE (dbg, "_ulReserved1 : 0x%04x\n", cfbh->_ulReserved1);
DBG_BUFFER_WRITE (dbg, "_csectDir : %u\n", cfbh->_csectDir);
DBG_BUFFER_WRITE (dbg, "_csectFat : %u\n", cfbh->_csectFat);
DBG_BUFFER_WRITE (dbg, "_sectDirStart : %u\n", cfbh->_sectDirStart);
DBG_BUFFER_WRITE (dbg, "_signature : %u\n", cfbh->_signature);
DBG_BUFFER_WRITE (dbg, "_ulMiniSectorCutoff : %u\n", cfbh->_ulMiniSectorCutoff);
DBG_BUFFER_WRITE (dbg, "_sectMiniFatStart : %u\n", cfbh->_sectMiniFatStart);
DBG_BUFFER_WRITE (dbg, "_csectMiniFat : %u\n", cfbh->_csectMiniFat);
DBG_BUFFER_WRITE (dbg, "_sectDifStart : %u\n", cfbh->_sectDifStart);
DBG_BUFFER_WRITE (dbg, "_csectDif : %u\n", cfbh->_csectDif);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_abSig : 0x%08" PRIx64 "\n", cfbh->_abSig); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_clsId : %ls\n", cfb_CLSIDToText (&(cfbh->_clsid)));
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " version : %u.%u ( 0x%04x 0x%04x )\n",
cfbh->_uMinorVersion, cfbh->_uDllVersion,
cfbh->_uMinorVersion, cfbh->_uDllVersion);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_uByteOrder : %s ( 0x%04x )\n",
cfbh->_uByteOrder == 0xFFFE ? "little-endian" : cfbh->_uByteOrder == 0xFEFF ? "big-endian"
: "?",
cfbh->_uByteOrder);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_uSectorShift : %u (%u bytes sectors)\n",
cfbh->_uSectorShift,
1 << cfbh->_uSectorShift);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_uMiniSectorShift : %u (%u bytes mini-sectors)\n",
cfbh->_uMiniSectorShift,
1 << cfbh->_uMiniSectorShift);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_usReserved0 : 0x%02x\n", cfbh->_usReserved);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_ulReserved1 : 0x%04x\n", cfbh->_ulReserved1);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_csectDir : %u\n", cfbh->_csectDir);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_csectFat : %u\n", cfbh->_csectFat);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_sectDirStart : %u\n", cfbh->_sectDirStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_signature : %u\n", cfbh->_signature);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_ulMiniSectorCutoff : %u\n", cfbh->_ulMiniSectorCutoff);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_sectMiniFatStart : %u\n", cfbh->_sectMiniFatStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_csectMiniFat : %u\n", cfbh->_csectMiniFat);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_sectDifStart : %u\n", cfbh->_sectDifStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_csectDif : %u\n", cfbh->_csectDif);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
void void
cfb_dump_FAT (CFB_Data* cfbd) cfb_dump_FAT (CFB_Data* cfbd)
{ {
int offset = 0; struct dbg* dbg = cfbd->dbg;
struct dbg* dbg = cfbd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_CFB_FAT_______________________________________________________________________________________\n\n"); DBG_BUFFER_WRITE (dbg, "_CFB_FAT_______________________________________________________________________________________\n\n");
uint32_t i = 0; uint32_t i = 0;
for (i = 0; i < cfbd->fat_sz; i++) { for (i = 0; i < cfbd->fat_sz; i++) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " SECT[%u] : 0x%08x %s\n", DBG_BUFFER_WRITE (dbg, " SECT[%u] : 0x%08x %s\n",
i, i,
cfbd->fat[i], cfbd->fat[i],
(cfbd->fat[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->fat[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)" (cfbd->fat[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->fat[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)"
: (cfbd->fat[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)" : (cfbd->fat[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)"
: (cfbd->fat[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)" : (cfbd->fat[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)"
: (cfbd->fat[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)" : (cfbd->fat[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)"
: ""); : "");
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " End of FAT.\n\n"); DBG_BUFFER_WRITE (dbg, " End of FAT.\n\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Total FAT entries : %u\n", cfbd->fat_sz); DBG_BUFFER_WRITE (dbg, " Total FAT entries : %u\n", cfbd->fat_sz);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Count of FAT sector : %u\n", cfbd->hdr->_csectFat); DBG_BUFFER_WRITE (dbg, " Count of FAT sector : %u\n", cfbd->hdr->_csectFat);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
void void
cfb_dump_MiniFAT (CFB_Data* cfbd) cfb_dump_MiniFAT (CFB_Data* cfbd)
{ {
int offset = 0; struct dbg* dbg = cfbd->dbg;
struct dbg* dbg = cfbd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_CFB_MiniFAT___________________________________________________________________________________\n\n"); DBG_BUFFER_WRITE (dbg, "_CFB_MiniFAT___________________________________________________________________________________\n\n");
uint32_t i = 0; uint32_t i = 0;
for (i = 0; i < cfbd->miniFat_sz; i++) { for (i = 0; i < cfbd->miniFat_sz; i++) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " SECT[%u] : 0x%08x %s\n", DBG_BUFFER_WRITE (dbg, " SECT[%u] : 0x%08x %s\n",
i, i,
cfbd->miniFat[i], cfbd->miniFat[i],
(cfbd->miniFat[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->miniFat[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)" (cfbd->miniFat[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->miniFat[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)"
: (cfbd->miniFat[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)" : (cfbd->miniFat[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)"
: (cfbd->miniFat[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)" : (cfbd->miniFat[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)"
: (cfbd->miniFat[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)" : (cfbd->miniFat[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)"
: ""); : "");
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " End of MiniFAT.\n\n"); DBG_BUFFER_WRITE (dbg, " End of MiniFAT.\n\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Total MiniFAT entries : %u\n", cfbd->miniFat_sz); DBG_BUFFER_WRITE (dbg, " Total MiniFAT entries : %u\n", cfbd->miniFat_sz);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " First MiniFAT sector ID : %u\n", cfbd->hdr->_sectMiniFatStart); DBG_BUFFER_WRITE (dbg, " First MiniFAT sector ID : %u\n", cfbd->hdr->_sectMiniFatStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Count of MiniFAT sector : %u\n", cfbd->hdr->_csectMiniFat); DBG_BUFFER_WRITE (dbg, " Count of MiniFAT sector : %u\n", cfbd->hdr->_csectMiniFat);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }
void void
cfb_dump_DiFAT (CFB_Data* cfbd) cfb_dump_DiFAT (CFB_Data* cfbd)
{ {
int offset = 0; struct dbg* dbg = cfbd->dbg;
struct dbg* dbg = cfbd->dbg;
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "_CFB_DiFAT_____________________________________________________________________________________\n\n"); DBG_BUFFER_WRITE (dbg, "_CFB_DiFAT_____________________________________________________________________________________\n\n");
uint32_t i = 0; uint32_t i = 0;
for (i = 0; i < cfbd->DiFAT_sz; i++) { for (i = 0; i < cfbd->DiFAT_sz; i++) {
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " SECT[%u] : 0x%08x %s\n", DBG_BUFFER_WRITE (dbg, " SECT[%u] : 0x%08x %s\n",
i, i,
cfbd->DiFAT[i], cfbd->DiFAT[i],
(cfbd->DiFAT[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->DiFAT[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)" (cfbd->DiFAT[i] == CFB_MAX_REG_SECT) ? "(CFB_MAX_REG_SECT)" : (cfbd->DiFAT[i] == CFB_DIFAT_SECT) ? "(CFB_DIFAT_SECT)"
: (cfbd->DiFAT[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)" : (cfbd->DiFAT[i] == CFB_FAT_SECT) ? "(CFB_FAT_SECT)"
: (cfbd->DiFAT[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)" : (cfbd->DiFAT[i] == CFB_END_OF_CHAIN) ? "(CFB_END_OF_CHAIN)"
: (cfbd->DiFAT[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)" : (cfbd->DiFAT[i] == CFB_FREE_SECT) ? "(CFB_FREE_SECT)"
: ""); : "");
} }
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n"); DBG_BUFFER_WRITE (dbg, "\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " End of DiFAT.\n\n"); DBG_BUFFER_WRITE (dbg, " End of DiFAT.\n\n");
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Total DiFAT entries : %u\n", cfbd->DiFAT_sz); DBG_BUFFER_WRITE (dbg, " Total DiFAT entries : %u\n", cfbd->DiFAT_sz);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " First DiFAT sector ID : %u\n", cfbd->hdr->_sectDifStart); DBG_BUFFER_WRITE (dbg, " First DiFAT sector ID : %u\n", cfbd->hdr->_sectDifStart);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, " Count of DiFAT sector : Header + %u\n", cfbd->hdr->_csectDif); DBG_BUFFER_WRITE (dbg, " Count of DiFAT sector : Header + %u\n", cfbd->hdr->_csectDif);
offset += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, offset, "\n\n"); DBG_BUFFER_WRITE (dbg, "\n\n");
dbg->debug_callback (dbg, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user);
} }

View file

@ -288,6 +288,7 @@ _uri_parse_authority (struct uri* uri, const char** pos, const char* end, struct
if (*uri->authority == 0x00) { if (*uri->authority == 0x00) {
uri->flags |= URI_T_LOCALHOST; uri->flags |= URI_T_LOCALHOST;
/* TODO: return 0 ? */
} }
return 1; return 1;
@ -304,7 +305,11 @@ _uri_parse_userinfo (struct uri* uri, const char** pos, const char* end, struct
const char* p = *pos; const char* p = *pos;
while (p < end) { while (p < end &&
/* end of authority */
*p != '/' &&
(!SCHEME_ALLOW_QUERY (uri) || *p != '?') &&
(!SCHEME_ALLOW_FRAGMENT (uri) || *p != '#')) {
if (*p == '@') { if (*p == '@') {
hasUserinfo = 1; hasUserinfo = 1;
break; break;

View file

@ -616,7 +616,7 @@ typedef struct aafiMarker {
wchar_t* name; wchar_t* name;
wchar_t* comment; wchar_t* comment;
uint16_t RVBColor[3]; uint16_t RGBColor[3];
struct aafiMarker* prev; struct aafiMarker* prev;
struct aafiMarker* next; struct aafiMarker* next;
@ -681,12 +681,12 @@ typedef struct aafiContext {
int is_inside_derivation_chain; int is_inside_derivation_chain;
struct options { struct options {
verbosityLevel_e verb; int trace;
int trace; int trace_meta;
int trace_meta; wchar_t* dump_class_aaf_properties;
wchar_t* trace_class; wchar_t* dump_class_raw_properties;
char* media_location; char* media_location;
char forbid_nonlatin_filenames; char forbid_nonlatin_filenames;
/* vendor specific */ /* vendor specific */
uint32_t resolve; uint32_t resolve;
uint32_t protools; uint32_t protools;
@ -765,20 +765,16 @@ typedef struct AAF_Iface {
(int64_t) (val * (samplerate * (1 / aafRationalToFloat ((*edit_rate))))) (int64_t) (val * (samplerate * (1 / aafRationalToFloat ((*edit_rate)))))
void void
aafi_enable_windows_VT100_output (void); aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, int ansicolor, FILE* fp, void (*callback) (struct dbg* dbg, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user);
void int
aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, FILE* fp, void (*callback) (struct dbg* dbg, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user); aafi_set_option_int (AAF_Iface* aafi, const char* optname, int val);
int
aafi_set_option_str (AAF_Iface* aafi, const char* optname, const char* val);
AAF_Iface* AAF_Iface*
aafi_alloc (AAF_Data* aafd); aafi_alloc (AAF_Data* aafd);
int
aafi_set_media_location (AAF_Iface* aafi, const char* path);
int
aafi_set_trace_class (AAF_Iface* aafi, const char* className);
void void
aafi_release (AAF_Iface** aafi); aafi_release (AAF_Iface** aafi);
@ -795,7 +791,7 @@ aafiTransition*
aafi_get_xfade (aafiTimelineItem* audioItem); aafi_get_xfade (aafiTimelineItem* audioItem);
aafiMarker* aafiMarker*
aafi_newMarker (AAF_Iface* aafi, aafRational_t* editRate, aafPosition_t start, aafPosition_t length, wchar_t* name, wchar_t* comment, uint16_t* RVBColor[3]); aafi_newMarker (AAF_Iface* aafi, aafRational_t* editRate, aafPosition_t start, aafPosition_t length, wchar_t* name, wchar_t* comment, uint16_t* RGBColor[3]);
void void
aafi_freeMarkers (aafiMarker** aafi); aafi_freeMarkers (aafiMarker** aafi);

View file

@ -26,6 +26,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "aaf/utils.h"
#define __FILENAME__ (strrchr (__FILE__, '/') ? strrchr (__FILE__, '/') + 1 : __FILE__) #define __FILENAME__ (strrchr (__FILE__, '/') ? strrchr (__FILE__, '/') + 1 : __FILE__)
enum debug_source_id { enum debug_source_id {
@ -49,9 +51,14 @@ struct dbg {
FILE* fp; FILE* fp;
verbosityLevel_e verb; verbosityLevel_e verb;
int ansicolor;
char* _dbg_msg; char* _dbg_msg;
int _dbg_msg_size; int _dbg_msg_size;
int _dbg_msg_pos;
char* _dbg_msg_tmp;
int _dbg_msg_pos_tmp;
void* user; void* user;
}; };
@ -62,6 +69,10 @@ struct dbg {
const char* dbgfunc = __func__; \ const char* dbgfunc = __func__; \
int dbgline = __LINE__; \ int dbgline = __LINE__; \
if (dbg && dbg->verb >= type && dbg->debug_callback) { \ if (dbg && dbg->verb >= type && dbg->debug_callback) { \
if (dbg->_dbg_msg_pos) { \
dbg->_dbg_msg_pos_tmp = dbg->_dbg_msg_pos; \
dbg->_dbg_msg_tmp = laaf_util_c99strdup (dbg->_dbg_msg); \
} \
int msgsize = snprintf (NULL, 0, __VA_ARGS__) + 1; \ int msgsize = snprintf (NULL, 0, __VA_ARGS__) + 1; \
if (msgsize >= dbg->_dbg_msg_size) { \ if (msgsize >= dbg->_dbg_msg_size) { \
char* msgtmp = realloc (dbg->_dbg_msg, msgsize); \ char* msgtmp = realloc (dbg->_dbg_msg, msgsize); \
@ -71,15 +82,28 @@ struct dbg {
snprintf (dbg->_dbg_msg, dbg->_dbg_msg_size, __VA_ARGS__); \ snprintf (dbg->_dbg_msg, dbg->_dbg_msg_size, __VA_ARGS__); \
dbg->debug_callback (dbg, (void*)ctxdata, lib, type, dbgfile, dbgfunc, dbgline, dbg->_dbg_msg, dbg->user); \ dbg->debug_callback (dbg, (void*)ctxdata, lib, type, dbgfile, dbgfunc, dbgline, dbg->_dbg_msg, dbg->user); \
} else { \ } else { \
/* Should we print error to stderr ? */ \ /* realloc() error */ \
} \ } \
} else { \ } else { \
snprintf (dbg->_dbg_msg, dbg->_dbg_msg_size, __VA_ARGS__); \ snprintf (dbg->_dbg_msg, dbg->_dbg_msg_size, __VA_ARGS__); \
dbg->debug_callback (dbg, (void*)ctxdata, lib, type, dbgfile, dbgfunc, dbgline, dbg->_dbg_msg, dbg->user); \ dbg->debug_callback (dbg, (void*)ctxdata, lib, type, dbgfile, dbgfunc, dbgline, dbg->_dbg_msg, dbg->user); \
} \ } \
if (dbg->_dbg_msg_pos_tmp) { \
dbg->_dbg_msg_pos = dbg->_dbg_msg_pos_tmp; \
strcpy (dbg->_dbg_msg, dbg->_dbg_msg_tmp); \
free (dbg->_dbg_msg_tmp); \
dbg->_dbg_msg_tmp = NULL; \
dbg->_dbg_msg_pos_tmp = 0; \
} \
} \ } \
} }
#define DBG_BUFFER_WRITE(dbg, ...) \
dbg->_dbg_msg_pos += laaf_util_snprintf_realloc (&dbg->_dbg_msg, &dbg->_dbg_msg_size, dbg->_dbg_msg_pos, __VA_ARGS__);
#define DBG_BUFFER_RESET(dbg) \
dbg->_dbg_msg_pos = 0;
struct dbg* struct dbg*
laaf_new_debug (void); laaf_new_debug (void);

View file

@ -51,16 +51,16 @@ extern "C" {
#define IS_DIR_SEP(c) \ #define IS_DIR_SEP(c) \
((((c) == DIR_SEP) || ((c) == '/'))) ((((c) == DIR_SEP) || ((c) == '/')))
#define ANSI_COLOR_RED "\033[38;5;124m" //"\x1b[31m" #define ANSI_COLOR_RED(dbg) (((dbg)->ansicolor) ? "\033[38;5;124m" : "") //"\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[92m" #define ANSI_COLOR_GREEN(dbg) (((dbg)->ansicolor) ? "\x1b[92m" : "")
#define ANSI_COLOR_YELLOW "\x1b[33m" //"\x1b[93m" #define ANSI_COLOR_YELLOW(dbg) (((dbg)->ansicolor) ? "\x1b[33m" : "") //"\x1b[93m"
#define ANSI_COLOR_ORANGE "\033[38;5;130m" #define ANSI_COLOR_ORANGE(dbg) (((dbg)->ansicolor) ? "\033[38;5;130m" : "")
#define ANSI_COLOR_BLUE "\x1b[34m" #define ANSI_COLOR_BLUE(dbg) (((dbg)->ansicolor) ? "\x1b[34m" : "")
#define ANSI_COLOR_MAGENTA "\x1b[35m" #define ANSI_COLOR_MAGENTA(dbg) (((dbg)->ansicolor) ? "\x1b[35m" : "")
#define ANSI_COLOR_CYAN "\033[38;5;81m" //"\x1b[36m" #define ANSI_COLOR_CYAN(dbg) (((dbg)->ansicolor) ? "\033[38;5;81m" : "") //"\x1b[36m"
#define ANSI_COLOR_DARKGREY "\x1b[38;5;242m" #define ANSI_COLOR_DARKGREY(dbg) (((dbg)->ansicolor) ? "\x1b[38;5;242m" : "")
#define ANSI_COLOR_BOLD "\x1b[1m" #define ANSI_COLOR_BOLD(dbg) (((dbg)->ansicolor) ? "\x1b[1m" : "")
#define ANSI_COLOR_RESET "\x1b[0m" #define ANSI_COLOR_RESET(dbg) (((dbg)->ansicolor) ? "\x1b[0m" : "")
int int
laaf_util_wstr_contains_nonlatin (const wchar_t* str); laaf_util_wstr_contains_nonlatin (const wchar_t* str);
@ -71,6 +71,9 @@ laaf_util_clean_filename (char* filename);
const char* const char*
laaf_util_fop_get_file (const char* filepath); laaf_util_fop_get_file (const char* filepath);
int
laaf_util_fop_is_wstr_fileext (const wchar_t* filepath, const wchar_t* ext);
char* char*
laaf_util_build_path (const char* sep, const char* first, ...); laaf_util_build_path (const char* sep, const char* first, ...);

View file

@ -1,2 +1,2 @@
#pragma once #pragma once
#define LIBAAF_VERSION "v0.1-85-g3e4c2cd" #define LIBAAF_VERSION "v0.5-2-g4dfb754"

View file

@ -16,6 +16,7 @@ laaf_new_debug (void)
dbg->debug_callback = &laaf_debug_callback; dbg->debug_callback = &laaf_debug_callback;
dbg->fp = stdout; dbg->fp = stdout;
dbg->ansicolor = 0;
return dbg; return dbg;
} }
@ -42,6 +43,7 @@ laaf_debug_callback (struct dbg* dbg, void* ctxdata, int libid, int type, const
const char* color = ""; const char* color = "";
if (dbg->fp == NULL) { if (dbg->fp == NULL) {
DBG_BUFFER_RESET (dbg);
return; return;
} }
@ -70,25 +72,27 @@ laaf_debug_callback (struct dbg* dbg, void* ctxdata, int libid, int type, const
switch (type) { switch (type) {
case VERB_ERROR: case VERB_ERROR:
typestr = " error "; typestr = " error ";
color = ANSI_COLOR_RED; color = ANSI_COLOR_RED (dbg);
break; break;
case VERB_WARNING: case VERB_WARNING:
typestr = "warning"; typestr = "warning";
color = ANSI_COLOR_YELLOW; color = ANSI_COLOR_YELLOW (dbg);
break; break;
case VERB_DEBUG: case VERB_DEBUG:
typestr = " debug "; typestr = " debug ";
color = ANSI_COLOR_DARKGREY; color = ANSI_COLOR_DARKGREY (dbg);
break; break;
} }
if (libid != DEBUG_SRC_ID_TRACE && libid != DEBUG_SRC_ID_DUMP) { if (libid != DEBUG_SRC_ID_TRACE && libid != DEBUG_SRC_ID_DUMP) {
fprintf (dbg->fp, "[%s%s%s] ", color, typestr, ANSI_COLOR_RESET); fprintf (dbg->fp, "[%s%s%s] ", color, typestr, ANSI_COLOR_RESET (dbg));
fprintf (dbg->fp, "%s%s:%i in %s()%s : ", ANSI_COLOR_DARKGREY, srcfile, lineno, srcfunc, ANSI_COLOR_RESET); fprintf (dbg->fp, "%s%s:%i in %s()%s : ", ANSI_COLOR_DARKGREY (dbg), srcfile, lineno, srcfunc, ANSI_COLOR_RESET (dbg));
} }
fprintf (dbg->fp, "%s\n", msg); fprintf (dbg->fp, "%s\n", msg);
DBG_BUFFER_RESET (dbg);
/* avoids -Wunused-parameter -Wunused-but-set-variable */ /* avoids -Wunused-parameter -Wunused-but-set-variable */
(void)aafi; (void)aafi;
(void)aafd; (void)aafd;

View file

@ -96,6 +96,42 @@ laaf_util_fop_get_file (const char* filepath)
return (IS_DIR_SEP (*end)) ? end + 1 : end; return (IS_DIR_SEP (*end)) ? end + 1 : end;
} }
int
laaf_util_fop_is_wstr_fileext (const wchar_t* filepath, const wchar_t* ext)
{
if (filepath == NULL) {
return 0;
}
const wchar_t* end = filepath + wcslen (filepath);
size_t extlen = 0;
while (end > filepath && (*end) != '.') {
--end;
extlen++;
}
if ((*end) == '.') {
end++;
extlen--;
}
if (extlen != wcslen (ext)) {
return 0;
}
// printf(" end: %ls ext: %ls\n", end, ext );
for (size_t i = 0; i < extlen; i++) {
// printf("end: %c != %c\n", *(end+i), *(ext+i));
if (tolower (*(end + i)) != tolower (*(ext + i))) {
return 0;
}
}
return 1;
}
char* char*
laaf_util_build_path (const char* sep, const char* first, ...) laaf_util_build_path (const char* sep, const char* first, ...)
{ {