diff --git a/libs/aaf/AAFClass.c b/libs/aaf/AAFClass.c index 211ab5431c..247ae75f22 100644 --- a/libs/aaf/AAFClass.c +++ b/libs/aaf/AAFClass.c @@ -43,13 +43,13 @@ #include "aaf/AAFClass.h" #define debug(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) #define attachNewProperty(aafd, Class, Prop, Pid, IsReq) \ Prop = calloc (1, sizeof (aafPropertyDef)); \ @@ -162,8 +162,6 @@ aafclass_setDefaultClasses (AAF_Data* aafd) { aafPropertyDef* prop = NULL; - /* TODO test ENOMEM after each class alloc */ - aafClass* IOC = aafclass_defineNewClass (aafd, &AAFClassID_InterchangeObject, ABSTRACT, NULL); if (IOC == NULL) { diff --git a/libs/aaf/AAFCore.c b/libs/aaf/AAFCore.c index e8532bb9db..1b031b61f4 100644 --- a/libs/aaf/AAFCore.c +++ b/libs/aaf/AAFCore.c @@ -39,13 +39,13 @@ #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) /** * Loops through each aafStrongRefSetEntry_t of a StrongRefSet Index node stream. diff --git a/libs/aaf/AAFDump.c b/libs/aaf/AAFDump.c index 7b77441df4..34a92ce88d 100644 --- a/libs/aaf/AAFDump.c +++ b/libs/aaf/AAFDump.c @@ -45,7 +45,7 @@ aaf_dump_Header (AAF_Data* aafd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -65,7 +65,7 @@ aaf_dump_Identification (AAF_Data* aafd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -99,7 +99,7 @@ aaf_dump_ObjectProperty (AAF_Data* aafd, aafProperty* Prop, const char* padding) aafd->log->_msg_pos += (size_t)rc; } - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -141,7 +141,7 @@ aaf_dump_TaggedValueSet (AAF_Data* aafd, aafObject* ObjCollection, const char* p (aafUIDCmp (&indirect->TypeDef, &AAFTypeID_String)) ? "\"" : "", ANSI_COLOR_RESET (log)); - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); free (name); } @@ -225,7 +225,7 @@ aaf_dump_rawProperties (AAF_Data* aafd, aafByte_t* propStream, const char* paddi LOG_BUFFER_WRITE (log, "\n"); } - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -295,7 +295,7 @@ aaf_dump_MetaDictionary (AAF_Data* aafd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -326,5 +326,5 @@ aaf_dump_Classes (AAF_Data* aafd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } diff --git a/libs/aaf/AAFIEssenceFile.c b/libs/aaf/AAFIEssenceFile.c index 0bfea5c866..b52bd3ebc6 100644 --- a/libs/aaf/AAFIEssenceFile.c +++ b/libs/aaf/AAFIEssenceFile.c @@ -37,16 +37,16 @@ #include "aaf/URIParser.h" #define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define success(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_SUCCESS, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_SUCCESS, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) static int set_audioEssenceWithRIFF (AAF_Iface* aafi, const char* filename, aafiAudioEssenceFile* audioEssenceFile, struct RIFFAudioFile* RIFFAudioFile, int isExternalFile); @@ -234,7 +234,7 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const char* original_uri_fil local_filepath = NULL; } - /* Try AAF essence's URI */ + /* Try raw essence's URI, just in case... */ if (laaf_util_file_exists (original_uri_filepath) == 1) { foundpath = original_uri_filepath; @@ -248,24 +248,12 @@ aafi_locate_external_essence_file (AAF_Iface* aafi, const char* original_uri_fil goto found; } - if (uri->flags & URI_T_LOCALHOST) { - // debug( "URI targets localhost : %s", uri_filepath ); - } else { - if (uri->flags & URI_T_HOST_IPV4) { - // debug( "URI targets IPV4 : %s", uri_filepath ); - } else if (uri->flags & URI_T_HOST_IPV6) { - // debug( "URI targets IPV6 : %s", uri_filepath ); - } else if (uri->flags & URI_T_HOST_REGNAME) { - // debug( "URI targets hostname : %s", uri_filepath ); - } - } - /* * Try to locate essence file from the AAF file location. * * e.g. - * - AAF filepath : /home/user/AAFFile.aaf - * - Essence URI : file://localhost/C:/Users/user/Desktop/AudioFiles/essence.wav + * AAF filepath : /home/user/AAFFile.aaf + * + Essence URI : file://localhost/C:/Users/user/Desktop/AudioFiles/essence.wav * = /home/user/AudioFiles/essence.file */ @@ -341,7 +329,6 @@ found: * So even if foundpath is already absolute, we need that drive letter at it * start. */ - // retpath = laaf_util_c99strdup(foundpath); retpath = laaf_util_absolute_path (foundpath); if (!retpath) { @@ -364,26 +351,6 @@ end: free (aaf_path); return retpath; - - /* - * AAFInfo --aaf-clips ../libaaf_testfiles/fonk_2.AAF - file://localhost/Users/horlaprod/Music/Logic/fonk_2/Audio Files_1/fonk_2_3#04.wav - - * AAFInfo --aaf-clips ../libaaf_testfiles/ADP/ADP3_51-ST-MONO-NOBREAKOUT.aaf - file:///C:/Users/Loviniou/Downloads/ChID-BLITS-EBU-Narration441-16b.wav - - * AAFInfo --aaf-clips ../libaaf_testfiles/ADP/ADP2_SEQ-FULL.aaf - file://?/E:/Adrien/ADPAAF/Sequence A Rendu.mxf - - * AAFInfo --aaf-clips ../libaaf_testfiles/TEST-AVID_COMP2977052\ \ -\ \ OFF\ PODIUM\ ETAPE\ 2.aaf - file:////C:/Users/mix_limo/Desktop/TEST2977052 - OFF PODIUM ETAPE 2.aaf - - * AAFInfo --aaf-clips ../ardio/watchfolder/3572607_RUGBY_F_1_1.aaf - file://10.87.230.71/mixage/DR2/Avid MediaFiles/MXF/1/3572607_RUGBY_F2_S65CFA3D0V.mxf - - * AAFInfo --aaf-clips ../libaaf_testfiles/ProTools/pt2MCC.aaf - file:///_system/Users/horlaprod/pt2MCCzmhsFRHQgdgsTMQX.mxf - */ } int @@ -552,29 +519,14 @@ aafi_extractAudioEssenceFile (AAF_Iface* aafi, aafiAudioEssenceFile* audioEssenc assert (tmp > 0 && (size_t)tmp < sizeof (((struct wavBextChunk*)0)->originator)); - // if ( tmp < 0 || (size_t)tmp >= sizeof(((struct wavBextChunk *)0)->originator) ) { - // fprintf( stderr, "snprintf() error" ); - // goto err; - // } - tmp = snprintf (wavBext.originator_reference, sizeof (((struct wavBextChunk*)0)->originator_reference), "libAAF %s", LIBAAF_VERSION); assert (tmp > 0 && (size_t)tmp < sizeof (((struct wavBextChunk*)0)->originator_reference)); - // if ( tmp < 0 || (size_t)tmp >= sizeof(((struct wavBextChunk *)0)->originator_reference) ) { - // fprintf( stderr, "snprintf() error" ); - // goto err; - // } - tmp = snprintf (wavBext.description, sizeof (((struct wavBextChunk*)0)->description), "%s\n%s.aaf", audioEssenceFile->name, aafi->compositionName); assert (tmp > 0 && (size_t)tmp < sizeof (((struct wavBextChunk*)0)->description)); - // if ( tmp < 0 || (size_t)tmp >= sizeof(((struct wavBextChunk *)0)->description) ) { - // fprintf( stderr, "snprintf() error" ); - // goto err; - // } - memcpy (wavBext.origination_date, audioEssenceFile->originationDate, sizeof (((struct wavBextChunk*)0)->origination_date)); memcpy (wavBext.origination_time, audioEssenceFile->originationTime, sizeof (((struct wavBextChunk*)0)->origination_time)); @@ -712,10 +664,6 @@ set_audioEssenceWithRIFF (AAF_Iface* aafi, const char* filename, aafiAudioEssenc if (audioEssenceFile->channels > 0 && audioEssenceFile->channels != RIFFAudioFile->channels) { warning ("%s : summary channel count (%i) mismatch %s (%i)", filename, audioEssenceFile->channels, ((isExternalFile) ? "located file" : "previously retrieved data"), RIFFAudioFile->channels); } - // else { - // /* In Davinci Resolve embedded multichannel WAV, summary channel is always 1 */ - // audioEssenceFile->channels = RIFFAudioFile->channels; - // } if (audioEssenceFile->samplerate > 0 && audioEssenceFile->samplerate != RIFFAudioFile->sampleRate) { warning ("%s : summary samplerate (%i) mismatch %s (%i)", filename, audioEssenceFile->samplerate, ((isExternalFile) ? "located file" : "previously retrieved data"), RIFFAudioFile->sampleRate); diff --git a/libs/aaf/AAFIParser.c b/libs/aaf/AAFIParser.c index ec88a71302..07c92df314 100644 --- a/libs/aaf/AAFIParser.c +++ b/libs/aaf/AAFIParser.c @@ -67,13 +67,13 @@ #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) static aafRational_t AAFI_DEFAULT_TC_EDIT_RATE = { 25, 1 }; @@ -296,22 +296,12 @@ parse_SourceMob (AAF_Iface* aafi, aafObject* SourceMob, td* __ptd) assert (rc > 0 && (size_t)rc < sizeof (((aafiAudioEssenceFile*)0)->originationDate)); - // if ( rc < 0 || (size_t)rc >= sizeof(((aafiAudioEssenceFile *)0)->originationDate) ) { - // fprintf( stderr, "snprintf() error" ); - // return -1; - // } - rc = snprintf (audioEssenceFile->originationTime, sizeof (((aafiAudioEssenceFile*)0)->originationTime), "%02u:%02u:%02u", (CreationTime->time.hour <= 99) ? CreationTime->time.hour : 0, (CreationTime->time.minute <= 99) ? CreationTime->time.minute : 0, (CreationTime->time.second <= 99) ? CreationTime->time.second : 0); assert (rc > 0 && (size_t)rc < sizeof (((aafiAudioEssenceFile*)0)->originationTime)); - - // if ( rc < 0 || (size_t)rc >= sizeof(((aafiAudioEssenceFile *)0)->originationTime) ) { - // fprintf( stderr, "snprintf() error" ); - // return -1; - // } } __td.ll[__td.lv] = 2; @@ -1072,7 +1062,7 @@ parse_SourceClip (AAF_Iface* aafi, aafObject* SourceClip, td* __ptd) } } else if (aafUIDCmp (parentMobUsageCode, &AAFUsage_AdjustedClip)) { // if ( aafi->ctx.current_adjusted_clip_gain ) { - // applyGainOffset( aafi, &aafi->ctx.current_clip->gain, aafi->ctx.current_adjusted_clip_gain ); + // aafi_applyGainOffset( aafi, &aafi->ctx.current_clip->gain, aafi->ctx.current_adjusted_clip_gain ); // aafi_freeAudioGain( aafi->ctx.current_adjusted_clip_gain ); // aafi->ctx.current_adjusted_clip_gain = NULL; // } @@ -3252,7 +3242,7 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta return; } - laaf_write_log (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __FILENAME__, func, line, buf); + laaf_write_log (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __FILENAME__, func, line, buf); free (buf); @@ -3635,7 +3625,7 @@ aafi_dump_obj (AAF_Iface* aafi, aafObject* Obj, struct trace_dump* __td, int sta LOG_BUFFER_WRITE (log, "%s", ANSI_COLOR_RESET (log)); } - log->debug_callback (log, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)aafi, LOG_SRC_ID_TRACE, 0, "", "", 0, log->_msg, log->user); /* if end of branch, print one line padding */ if (Obj && (__td->eob || state == TD_ERROR)) diff --git a/libs/aaf/AAFIface.c b/libs/aaf/AAFIface.c index 139c2cc7cd..24919fe339 100644 --- a/libs/aaf/AAFIface.c +++ b/libs/aaf/AAFIface.c @@ -50,20 +50,14 @@ #include "aaf/log.h" #include "aaf/utils.h" -#ifdef _WIN32 -#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING -#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 -#endif -#endif - #define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) AAF_Iface* aafi_alloc (AAF_Data* aafd) @@ -111,18 +105,18 @@ err: } void -aafi_set_debug (AAF_Iface* aafi, verbosityLevel_e v, int ansicolor, FILE* fp, void (*callback) (struct aafLog* log, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user) +aafi_set_debug (AAF_Iface* aafi, enum verbosityLevel_e verb, int ansicolor, FILE* fp, void (*callback) (struct aafLog* log, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user), void* user) { if (!aafi) { return; } - aafi->log->verb = v; + aafi->log->verb = verb; aafi->log->ansicolor = ansicolor; aafi->log->fp = fp; if (callback) { - aafi->log->debug_callback = callback; + aafi->log->log_callback = callback; } if (user) { diff --git a/libs/aaf/AAFToText.c b/libs/aaf/AAFToText.c index d3dda48283..454644aa46 100644 --- a/libs/aaf/AAFToText.c +++ b/libs/aaf/AAFToText.c @@ -42,13 +42,13 @@ #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafd->log, aafd, DEBUG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafd->log, aafd, LOG_SRC_ID_AAF_CORE, VERB_ERROR, __VA_ARGS__) const char* aaft_MobIDToText (aafMobID_t* mobid) @@ -69,10 +69,6 @@ aaft_MobIDToText (aafMobID_t* mobid) rc = snprintf (str + offset, strsz - offset, " - "); assert (rc > 0 && (size_t)rc < strsz - offset); - // if ( rc < 0 || (size_t)rc >= strsz-offset ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } offset += (uint32_t)rc; @@ -86,11 +82,6 @@ aaft_MobIDToText (aafMobID_t* mobid) assert (rc > 0 && (size_t)rc < strsz - offset); - // if ( rc < 0 || (size_t)rc >= strsz-offset ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } - offset += (uint32_t)rc; if (i == 15) { @@ -98,11 +89,6 @@ aaft_MobIDToText (aafMobID_t* mobid) assert (rc > 0 && (size_t)rc < strsz - offset); - // if ( rc < 0 || (size_t)rc >= strsz-offset ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } - offset += (uint32_t)rc; break; @@ -117,11 +103,6 @@ aaft_MobIDToText (aafMobID_t* mobid) assert (rc >= 0 && (size_t)rc < strsz - offset); - // if ( rc < 0 || (size_t)rc >= strsz-offset ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } - return str; } @@ -146,11 +127,6 @@ aaft_TimestampToText (aafTimeStamp_t* ts) ts->time.fraction); assert (rc > 0 && (size_t)rc < sizeof (str)); - - // if ( rc < 0 || (size_t)rc >= sizeof(str) ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } } return str; @@ -172,11 +148,6 @@ aaft_VersionToText (aafVersionType_t* vers) vers->minor); assert (rc > 0 && (size_t)rc < sizeof (str)); - - // if ( rc < 0 || (size_t)rc >= sizeof(str) ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } } return str; @@ -202,11 +173,6 @@ aaft_ProductVersionToText (aafProductVersion_t* vers) vers->type); assert (rc > 0 && (size_t)rc < sizeof (str)); - - // if ( rc < 0 || (size_t)rc >= sizeof(str) ) { - // fprintf( stderr, "snprintf() error" ); - // return "NULL"; - // } } return str; @@ -991,11 +957,6 @@ aaft_DataDefToText (AAF_Data* aafd, const aafUID_t* auid) assert (rc >= 0 && (size_t)rc < sizeof (TEXTDataDef)); - // if ( rc < 0 || (size_t)rc >= 1024 ) { - // error( "snprintf() error" ); - // return NULL; - // } - free (name); return TEXTDataDef; @@ -1096,11 +1057,6 @@ aaft_OperationDefToText (AAF_Data* aafd, const aafUID_t* auid) assert (rc >= 0 && (size_t)rc < sizeof (TEXTOperationDef)); - // if ( rc < 0 || (size_t)rc >= 1024 ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } - free (name); return TEXTOperationDef; @@ -1293,11 +1249,6 @@ aaft_ParameterToText (AAF_Data* aafd, const aafUID_t* auid) assert (rc >= 0 && (size_t)rc < sizeof (TEXTParameterDef)); - // if ( rc < 0 || (size_t)rc >= 1024 ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } - free (name); return TEXTParameterDef; @@ -2055,11 +2006,6 @@ aaft_PIDToText (AAF_Data* aafd, aafPID_t pid) assert (rc >= 0 && (size_t)rc < sizeof (PIDText)); - // if ( rc < 0 || (size_t)rc >= 1024 ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } - return PIDText; } } @@ -2299,11 +2245,6 @@ aaft_ClassIDToText (AAF_Data* aafd, const aafUID_t* auid) assert (rc >= 0 && (size_t)rc < sizeof (ClassIDText)); - // if ( rc < 0 || (size_t)rc >= 1024 ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } - return ClassIDText; } } @@ -2368,11 +2309,6 @@ aaft_IndirectValueToText (AAF_Data* aafd, aafIndirect_t* Indirect) assert (rc >= 0 && (size_t)rc < sizeof (buf)); - // if ( rc < 0 || (size_t)rc >= sizeof(buf) ) { - // fprintf( stderr, "snprintf() error" ); - // return NULL; - // } - return buf; } diff --git a/libs/aaf/CFBDump.c b/libs/aaf/CFBDump.c index a342a06254..8dd71540a8 100644 --- a/libs/aaf/CFBDump.c +++ b/libs/aaf/CFBDump.c @@ -28,13 +28,13 @@ #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_WARNING, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_ERROR, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_ERROR, __VA_ARGS__) void cfb_dump_node (CFB_Data* cfbd, cfbNode* node, int print_stream, const char* padding) @@ -99,7 +99,7 @@ cfb_dump_node (CFB_Data* cfbd, cfbNode* node, int print_stream, const char* padd LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); if (print_stream == 1) { cfb_dump_nodeStream (cfbd, node, ""); @@ -137,7 +137,7 @@ cfb_dump_nodeStream (CFB_Data* cfbd, cfbNode* node, const char* padding) laaf_util_dump_hex (stream, stream_sz, &log->_msg, &log->_msg_size, log->_msg_pos, padding); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); free (stream); } @@ -161,7 +161,7 @@ cfb_dump_nodePathStream (CFB_Data* cfbd, const char* path, const char* padding) laaf_util_dump_hex (stream, stream_sz, &log->_msg, &log->_msg_size, log->_msg_pos, padding); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); free (stream); } @@ -171,9 +171,8 @@ cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_ { struct aafLog* log = cfbd->log; - // if ( !node ) { + /* initial function call */ if (firstIteration) { - /* initial function call */ node = &cfbd->nodes[0]; if (!node) { @@ -190,7 +189,6 @@ cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_ uint32_t thisPath = (*str_i); - /* TODO snprintf_realloc() ? */ char* nodeName = cfb_w16toUTF8 (node->_ab, node->_cb); laaf_util_snprintf_realloc (&strArray[thisPath], 0, 0, "%s/%s", strArray[prevPath], nodeName); @@ -209,7 +207,6 @@ cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_ cfb_dump_nodePaths (cfbd, prevPath, strArray, str_i, &cfbd->nodes[node->_sidRightSib], padding, 0); /* the end of the first function call, recursion is over. */ - // if ( node == &cfbd->nodes[0] ) { if (firstIteration) { /* commented out because output seems proper this way... why did we call qsort() in the first place ?! */ // qsort( strArray, *str_i, sizeof(char*), compareStrings ); @@ -234,7 +231,7 @@ cfb_dump_nodePaths (CFB_Data* cfbd, uint32_t prevPath, char* strArray[], uint32_ LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } } @@ -286,7 +283,7 @@ cfb_dump_header (CFB_Data* cfbd, const char* padding) LOG_BUFFER_WRITE (log, "\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -330,7 +327,7 @@ cfb_dump_FAT (CFB_Data* cfbd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -375,7 +372,7 @@ cfb_dump_MiniFAT (CFB_Data* cfbd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } void @@ -420,5 +417,5 @@ cfb_dump_DiFAT (CFB_Data* cfbd, const char* padding) LOG_BUFFER_WRITE (log, "\n\n"); - log->debug_callback (log, (void*)cfbd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); + log->log_callback (log, (void*)cfbd, LOG_SRC_ID_DUMP, 0, "", "", 0, log->_msg, log->user); } diff --git a/libs/aaf/LibCFB.c b/libs/aaf/LibCFB.c index f1da71d1b4..6d2130cc78 100644 --- a/libs/aaf/LibCFB.c +++ b/libs/aaf/LibCFB.c @@ -107,13 +107,13 @@ #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_WARNING, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (cfbd->log, cfbd, DEBUG_SRC_ID_LIB_CFB, VERB_ERROR, __VA_ARGS__) + AAF_LOG (cfbd->log, cfbd, LOG_SRC_ID_LIB_CFB, VERB_ERROR, __VA_ARGS__) static int cfb_getFileSize (CFB_Data* cfbd); diff --git a/libs/aaf/MediaComposer.c b/libs/aaf/MediaComposer.c index 50695b7dbf..9389bbc5ce 100644 --- a/libs/aaf/MediaComposer.c +++ b/libs/aaf/MediaComposer.c @@ -30,13 +30,13 @@ #include "aaf/log.h" #define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) int mediaComposer_AAF (struct AAF_Iface* aafi) diff --git a/libs/aaf/ProTools.c b/libs/aaf/ProTools.c index 88ef808bf9..0b49a125f3 100644 --- a/libs/aaf/ProTools.c +++ b/libs/aaf/ProTools.c @@ -23,6 +23,15 @@ #include "aaf/AAFIface.h" #include "aaf/ProTools.h" +#define debug(...) \ + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + +#define warning(...) \ + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + +#define error(...) \ + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + /* English : "Fade " (Same as JA and DE) */ static const char PROTOOLS_CLIP_NAME_FADE_EN[] = "\x46\x61\x64\x65\x20"; /* French : "Fondu " */ @@ -53,15 +62,6 @@ static const char PROTOOLS_CLIP_NAME_SAMPLE_ACCURATE_EDIT_ZH_CN[] = "\xe7\xb2\xb /* Chinese (T) : "精確取樣編輯" */ static const char PROTOOLS_CLIP_NAME_SAMPLE_ACCURATE_EDIT_ZH_TW[] = "\xe7\xb2\xbe\xe7\xa2\xba\xe5\x8f\x96\xe6\xa8\xa3\xe7\xb7\xa8\xe8\xbc\xaf"; -#define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) - -#define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) - -#define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) - static int is_rendered_fade (const char* clipName); static int @@ -76,7 +76,7 @@ protools_AAF (struct AAF_Iface* aafi) { int probe = 0; - /* NOTE: CompanyName is "Digidesign, Inc." at least since ProTools 10.3.10.613, and still today */ + /* NOTE: CompanyName is "Digidesign, Inc." at least since ProTools 10.3.10.613, and still today (2024) */ if (aafi->aafd->Identification.CompanyName && strcmp (aafi->aafd->Identification.CompanyName, "Digidesign, Inc.") == 0) { probe++; @@ -149,7 +149,7 @@ remove_sampleAccurateEditClip (AAF_Iface* aafi, aafiAudioTrack* audioTrack, aafi return 1; } // else { - // warning( L"Can't remove SAE \"%s\" : left clip \"%s\" has not enough right handle : %lu but %lu is required", + // debug( L"SAE \"%s\" : left clip \"%s\" has not enough right handle : %lu but %lu is required", // saeClip->essencePointerList->essenceFile->unique_name, // leftClip->essencePointerList->essenceFile->unique_name, // (essenceLength - leftClip->essence_offset - leftClip->len), @@ -185,7 +185,7 @@ remove_sampleAccurateEditClip (AAF_Iface* aafi, aafiAudioTrack* audioTrack, aafi return 1; } // else { - // warning( L"Can't remove SAE \"%s\" : right clip \"%s\" has not enough left handle : %lu but %lu is required", + // debug( L"SAE \"%s\" : right clip \"%s\" has not enough left handle : %lu but %lu is required", // saeClip->essencePointerList->essenceFile->unique_name, // rightClip->essencePointerList->essenceFile->unique_name, // rightClip->essence_offset, @@ -404,7 +404,7 @@ protools_post_processing (AAF_Iface* aafi) aafiTimelineItem* audioItemNext = audioItem->next; if (audioItem->type != AAFI_AUDIO_CLIP) { - audioItem = audioItem->next; + audioItem = audioItemNext; continue; } @@ -412,15 +412,21 @@ protools_post_processing (AAF_Iface* aafi) char* clipName = audioClip->essencePointerList->essenceFile->name; + int previousClipCount = audioTrack->clipCount; + if ((aafi->ctx.options.protools & AAFI_PROTOOLS_OPT_REPLACE_CLIP_FADES) && is_rendered_fade (clipName)) { - if (replace_clipFade (aafi, audioTrack, audioItem) > 0) { + replace_clipFade (aafi, audioTrack, audioItem); + + if (previousClipCount != audioTrack->clipCount) { audioItem = audioTrack->timelineItems; continue; } } else if ((aafi->ctx.options.protools & AAFI_PROTOOLS_OPT_REMOVE_SAMPLE_ACCURATE_EDIT) && is_sample_accurate_edit (clipName)) { - if (remove_sampleAccurateEditClip (aafi, audioTrack, audioItem)) { + remove_sampleAccurateEditClip (aafi, audioTrack, audioItem); + + if (previousClipCount != audioTrack->clipCount) { audioItem = audioTrack->timelineItems; continue; } diff --git a/libs/aaf/RIFFParser.c b/libs/aaf/RIFFParser.c index 09e74c49cd..29a7685eb5 100644 --- a/libs/aaf/RIFFParser.c +++ b/libs/aaf/RIFFParser.c @@ -26,13 +26,13 @@ #include "aaf/RIFFParser.h" #define debug(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) #define BE2LE32(val) \ (((val >> 24) & 0xff) | ((val << 8) & 0xff0000) | ((val >> 8) & 0xff00) | ((val << 24) & 0xff000000)) diff --git a/libs/aaf/Resolve.c b/libs/aaf/Resolve.c index 43162c71bc..241fc8804f 100644 --- a/libs/aaf/Resolve.c +++ b/libs/aaf/Resolve.c @@ -30,13 +30,13 @@ #include "aaf/log.h" #define debug(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (aafi->log, aafi, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (aafi->log, aafi, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) int resolve_AAF (struct AAF_Iface* aafi) diff --git a/libs/aaf/URIParser.c b/libs/aaf/URIParser.c index 914f78b4c1..e09ecf2ce0 100644 --- a/libs/aaf/URIParser.c +++ b/libs/aaf/URIParser.c @@ -36,13 +36,13 @@ typedef SSIZE_T ssize_t; #include "aaf/utils.h" #define debug(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_DEBUG, __VA_ARGS__) #define warning(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_WARNING, __VA_ARGS__) #define error(...) \ - AAF_LOG (log, NULL, DEBUG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) + AAF_LOG (log, NULL, LOG_SRC_ID_AAF_IFACE, VERB_ERROR, __VA_ARGS__) #define IS_LOWALPHA(c) \ ((c >= 'a') && (c <= 'z')) diff --git a/libs/aaf/aaf/AAFCore.h b/libs/aaf/aaf/AAFCore.h index 91a06f3836..2a50f7c90f 100644 --- a/libs/aaf/aaf/AAFCore.h +++ b/libs/aaf/aaf/AAFCore.h @@ -122,7 +122,7 @@ typedef struct aafPropertyDefinition { char* name; /* - * Looks like nobody cares about AAF standard TypeDefinition. All observed files + * Looks like nobody cares about AAF standard TypeDefinition. All observed files * had incorrect values for Type's Name and Identification, even Avid's files. * Thus, PDef->type should NOT be trusted. * diff --git a/libs/aaf/aaf/AAFIface.h b/libs/aaf/aaf/AAFIface.h index 9ad3785986..39979c2683 100644 --- a/libs/aaf/aaf/AAFIface.h +++ b/libs/aaf/aaf/AAFIface.h @@ -110,7 +110,6 @@ typedef enum aafiInterpolation_e { * Having two curves (AAFI_TRANS_TWO_CURVE) allows a cross fade to have one curve per fade. * * A transition should have at least two points, one at time zero and one at time 1. - * TODO To finish */ typedef struct aafiTransition { @@ -270,7 +269,7 @@ typedef struct aafiAudioEssenceFile { * instead of name when exporting embedded essences. */ - char* unique_name; // TODO: see creative_post.aaf + char* unique_name; /** * Holds the URI path to the essence file, as specified in NetworkLocator::URLString. @@ -377,7 +376,7 @@ typedef struct aafiAudioEssencePointer { typedef struct aafiVideoEssence { char* original_file_path; // NetworkLocator::URLString should point to original essence file if external (and in some cases, points to the AAF itself if internal..) - char* usable_file_path; // TODO, not that used.. to be tweaked. ---- Holds the file path, once the essence has been exported, copied or linked. + char* usable_file_path; // Holds the file path, once the essence has been exported, copied or linked. char* name; // MasterMob::Name -> file name char* unique_name; // unique name generated from aafiVideoEssence->name. Sometimes, multiple files share the same names so this unique name should be used on export. @@ -755,21 +754,11 @@ typedef struct aafiMarker { } aafiMarker; typedef struct aafiContext { - /* - * Current MobSlot Segment's DataDefinition - * Mob::Slots > MobSlot::Segment > Component::DataDefinition - */ - - // aafUID_t *DataDef; - /* Clip */ aafObject* TopLevelCompositionMob; aafiAudioTrack* current_track; - // int current_track_number; // used only when missing MobSlot::PhysicalTrackNumber - - // aafPosition_t current_pos; aafiAudioClip* current_clip; aafiVideoClip* current_video_clip; int current_clip_is_muted; @@ -810,8 +799,7 @@ typedef struct aafiContext { char* dump_class_aaf_properties; char* dump_class_raw_properties; char* media_location; - // int forbid_nonlatin_filenames; - int mobid_essence_filename; + int mobid_essence_filename; /* vendor specific */ int protools; diff --git a/libs/aaf/aaf/log.h b/libs/aaf/aaf/log.h index b631de4dda..11423719fd 100644 --- a/libs/aaf/aaf/log.h +++ b/libs/aaf/aaf/log.h @@ -30,12 +30,12 @@ #define __FILENAME__ (strrchr (__FILE__, '/') ? strrchr (__FILE__, '/') + 1 : __FILE__) -enum debug_source_id { - DEBUG_SRC_ID_LIB_CFB, - DEBUG_SRC_ID_AAF_CORE, - DEBUG_SRC_ID_AAF_IFACE, - DEBUG_SRC_ID_TRACE, - DEBUG_SRC_ID_DUMP +enum log_source_id { + LOG_SRC_ID_LIB_CFB, + LOG_SRC_ID_AAF_CORE, + LOG_SRC_ID_AAF_IFACE, + LOG_SRC_ID_TRACE, + LOG_SRC_ID_DUMP }; typedef enum verbosityLevel_e { @@ -49,7 +49,7 @@ typedef enum verbosityLevel_e { #define VERB_SUCCESS 99 struct aafLog { - void (*debug_callback) (struct aafLog* log, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user); + void (*log_callback) (struct aafLog* log, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user); FILE* fp; verbosityLevel_e verb; @@ -64,7 +64,7 @@ struct aafLog { char* _previous_msg; size_t _previous_pos; - int _tmp_dbg_msg_pos; + int _tmp_msg_pos; void* user; }; @@ -72,11 +72,11 @@ struct aafLog { #define AAF_LOG(log, ctxdata, lib, type, ...) \ laaf_write_log (log, ctxdata, lib, type, __FILENAME__, __func__, __LINE__, __VA_ARGS__) -#define LOG_BUFFER_WRITE(log, ...) \ - log->_tmp_dbg_msg_pos = laaf_util_snprintf_realloc (&log->_msg, &log->_msg_size, log->_msg_pos, __VA_ARGS__); \ - log->_msg_pos += (log->_tmp_dbg_msg_pos < 0) ? 0 : (size_t)log->_tmp_dbg_msg_pos; +#define LOG_BUFFER_WRITE(log, ...) \ + log->_tmp_msg_pos = laaf_util_snprintf_realloc (&log->_msg, &log->_msg_size, log->_msg_pos, __VA_ARGS__); \ + log->_msg_pos += (log->_tmp_msg_pos < 0) ? 0 : (size_t)log->_tmp_msg_pos; -#define DBG_BUFFER_RESET(log) \ +#define LOG_BUFFER_RESET(log) \ log->_msg_pos = 0; struct aafLog* @@ -89,6 +89,6 @@ void laaf_log_callback (struct aafLog* log, void* ctxdata, int lib, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user); void -laaf_write_log (struct aafLog* log, void* ctxdata, enum debug_source_id lib, enum verbosityLevel_e type, const char* dbgfile, const char* dbgfunc, int dbgline, const char* format, ...); +laaf_write_log (struct aafLog* log, void* ctxdata, enum log_source_id lib, enum verbosityLevel_e type, const char* srcfile, const char* srcfunc, int srcline, const char* format, ...); #endif // !laaf_log_h__ diff --git a/libs/aaf/aaf/version.h b/libs/aaf/aaf/version.h index 2f346f6f87..042917adfd 100644 --- a/libs/aaf/aaf/version.h +++ b/libs/aaf/aaf/version.h @@ -1,2 +1,2 @@ #pragma once -#define LIBAAF_VERSION "v1.0-1-gdef35bf" +#define LIBAAF_VERSION "v1.0-10-g13f0b0a" diff --git a/libs/aaf/log.c b/libs/aaf/log.c index a57e399ee4..1889b2358e 100644 --- a/libs/aaf/log.c +++ b/libs/aaf/log.c @@ -55,9 +55,9 @@ laaf_new_log (void) return NULL; } - log->debug_callback = &laaf_log_callback; - log->fp = stdout; - log->ansicolor = 0; + log->log_callback = &laaf_log_callback; + log->fp = stdout; + log->ansicolor = 0; return log; } @@ -85,28 +85,28 @@ laaf_log_callback (struct aafLog* log, void* ctxdata, int libid, int type, const const char* color = ""; if (log->fp == NULL) { - DBG_BUFFER_RESET (log); + LOG_BUFFER_RESET (log); return; } switch (libid) { - case DEBUG_SRC_ID_LIB_CFB: + case LOG_SRC_ID_LIB_CFB: lib = "libCFB"; aafi = (AAF_Iface*)ctxdata; break; - case DEBUG_SRC_ID_AAF_CORE: + case LOG_SRC_ID_AAF_CORE: lib = "AAFCore"; aafd = (AAF_Data*)ctxdata; break; - case DEBUG_SRC_ID_AAF_IFACE: + case LOG_SRC_ID_AAF_IFACE: lib = "AAFIface"; cfbd = (CFB_Data*)ctxdata; break; - case DEBUG_SRC_ID_TRACE: + case LOG_SRC_ID_TRACE: lib = "trace"; aafi = (AAF_Iface*)ctxdata; break; - case DEBUG_SRC_ID_DUMP: + case LOG_SRC_ID_DUMP: lib = "dump"; break; } @@ -132,7 +132,7 @@ laaf_log_callback (struct aafLog* log, void* ctxdata, int libid, int type, const const char* eol = ""; - if (libid != DEBUG_SRC_ID_TRACE && libid != DEBUG_SRC_ID_DUMP) { + if (libid != LOG_SRC_ID_TRACE && libid != LOG_SRC_ID_DUMP) { #ifdef __MINGW32__ fwprintf (log->fp, L"[%" WPRIs "%" WPRIs "%" WPRIs "] %" WPRIs "%" WPRIs ":%i in %" WPRIs "()%" WPRIs " : ", color, @@ -156,7 +156,7 @@ laaf_log_callback (struct aafLog* log, void* ctxdata, int libid, int type, const #endif } - if (libid != DEBUG_SRC_ID_DUMP) { + if (libid != LOG_SRC_ID_DUMP) { eol = "\n"; } @@ -173,7 +173,7 @@ laaf_log_callback (struct aafLog* log, void* ctxdata, int libid, int type, const fflush (log->fp); - DBG_BUFFER_RESET (log); + LOG_BUFFER_RESET (log); /* avoids -Wunused-parameter -Wunused-but-set-variable */ (void)aafi; @@ -184,13 +184,13 @@ laaf_log_callback (struct aafLog* log, void* ctxdata, int libid, int type, const } void -laaf_write_log (struct aafLog* log, void* ctxdata, enum debug_source_id lib, enum verbosityLevel_e type, const char* dbgfile, const char* dbgfunc, int dbgline, const char* format, ...) +laaf_write_log (struct aafLog* log, void* ctxdata, enum log_source_id lib, enum verbosityLevel_e type, const char* srcfile, const char* srcfunc, int srcline, const char* format, ...) { if (!log) { return; } - if (!log->debug_callback) { + if (!log->log_callback) { return; } @@ -275,7 +275,7 @@ laaf_write_log (struct aafLog* log, void* ctxdata, enum debug_source_id lib, enu return; } - log->debug_callback (log, (void*)ctxdata, lib, type, dbgfile, dbgfunc, dbgline, log->_msg, log->user); + log->log_callback (log, (void*)ctxdata, lib, type, srcfile, srcfunc, srcline, log->_msg, log->user); va_end (ap); diff --git a/libs/aaf/utils.c b/libs/aaf/utils.c index f2a7c32d8d..fd232186d0 100644 --- a/libs/aaf/utils.c +++ b/libs/aaf/utils.c @@ -307,9 +307,6 @@ laaf_util_relative_path (const char* filepath, const char* refpath) return NULL; } - // fprintf( stderr, "%s\n", filepath ); - // fprintf( stderr, "%s\n", refpath ); - int isWindowsPath = 0; int aWindowsPath = 0; int bWindowsPath = 0;