Skip to content

Commit 3546a3e

Browse files
committed
improve debugging of class properties
- change aafi->options members: trace_meta becomes show_meta, trace_class becomes dump_class_aaf_properties and new dump_class_raw_properties is added - change AAFInfo options accordingly
1 parent 16236f2 commit 3546a3e

File tree

5 files changed

+83
-49
lines changed

5 files changed

+83
-49
lines changed

include/libaaf/AAFIface.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ typedef struct aafiContext
807807

808808
int trace;
809809
int trace_meta;
810-
wchar_t *trace_class;
810+
wchar_t *dump_class_aaf_properties;
811+
wchar_t *dump_class_raw_properties;
811812
char *media_location;
812813
char forbid_nonlatin_filenames;
813814
/* vendor specific */

src/AAFCore/AAFDump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void aaf_dump_rawProperties( AAF_Data *aafd, aafByte_t *propStream )
165165

166166
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 );
167167

168-
DBG_BUFFER_WRITE( dbg, "\n\n" );
168+
DBG_BUFFER_WRITE( dbg, "\n" );
169169
}
170170

171171
dbg->debug_callback( dbg, (void*)aafd, DEBUG_SRC_ID_DUMP, 0, "", "", 0, dbg->_dbg_msg, dbg->user );

src/AAFIface/AAFIParser.c

+33-29
Original file line numberDiff line numberDiff line change
@@ -414,35 +414,7 @@ void aafi_dump_obj( AAF_Iface *aafi, aafObject *Obj, struct trace_dump *__td, in
414414
DBG_BUFFER_WRITE( dbg, "." );
415415
}
416416

417-
if ( /*state == TD_NOT_SUPPORTED ||*/ ( aafi->ctx.options.trace_class && wcscmp( aaft_ClassIDToText(aafi->aafd, Obj->Class->ID), aafi->ctx.options.trace_class ) == 0) ) {
418-
419-
// DBG_BUFFER_WRITE( dbg, "\n\n%s", ( state == TD_NOT_SUPPORTED ) ? ANSI_COLOR_ORANGE(dbg) : "" );
420-
DBG_BUFFER_WRITE( dbg, "\n\n" );
421-
422-
DBG_BUFFER_WRITE( dbg, "CFB Object Dump : %ls\n", aaf_get_ObjectPath( Obj ) );
423-
DBG_BUFFER_WRITE( dbg, "=================\n" );
424-
425-
dbg->debug_callback( dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user );
426-
427-
cfb_dump_node( aafi->aafd->cfbd, Obj->Node, 1 );
428-
429-
//
430-
// DBG_BUFFER_WRITE( dbg, "Properties Dump (%ls)\n", aaf_get_ObjectPath( Obj ) );
431-
// DBG_BUFFER_WRITE( dbg, "===============\n\n" );
432-
// // aaf_dump_nodeStreamProperties( aafi->aafd, Obj->Node );
433-
//
434-
// // dbg->debug_callback( dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user );
435-
// //
436-
// // offset = 0;
437-
//
438-
// dbg->debug_callback( dbg, (void*)aafi, DEBUG_SRC_ID_TRACE, 0, "", "", 0, dbg->_dbg_msg, dbg->user );
439-
//
440-
// aaf_dump_ObjectProperties( aafi->aafd, Obj );
441-
//
442-
// DBG_BUFFER_WRITE( dbg, "\n" );
443-
}
444-
else {
445-
417+
if ( !aafi->ctx.options.dump_class_aaf_properties ) {
446418
aafProperty * Prop = NULL;
447419
int hasUnknownProps = 0;
448420

@@ -481,6 +453,38 @@ void aafi_dump_obj( AAF_Iface *aafi, aafObject *Obj, struct trace_dump *__td, in
481453
}
482454
}
483455

456+
457+
if ( aafi->ctx.options.dump_class_raw_properties && wcscmp( aaft_ClassIDToText(aafi->aafd, Obj->Class->ID), aafi->ctx.options.dump_class_raw_properties ) == 0 ) {
458+
DBG_BUFFER_WRITE( dbg, "\n\n" );
459+
DBG_BUFFER_WRITE( dbg, "======================================================================\n" );
460+
DBG_BUFFER_WRITE( dbg, " CFB Object Properties Dump\n" );
461+
DBG_BUFFER_WRITE( dbg, "======================================================================\n" );
462+
DBG_BUFFER_WRITE( dbg, "%s", ANSI_COLOR_DARKGREY(dbg) );
463+
DBG_BUFFER_WRITE( dbg, "%ls\n", aaft_ClassIDToText(aafi->aafd, Obj->Class->ID) );
464+
DBG_BUFFER_WRITE( dbg, "%ls/properties\n", aaf_get_ObjectPath( Obj ) );
465+
DBG_BUFFER_WRITE( dbg, "%s\n\n", ANSI_COLOR_RESET(dbg) );
466+
467+
// cfb_dump_node( aafi->aafd->cfbd, cfb_getChildNode( aafi->aafd->cfbd, L"properties", Obj->Node ), 1 );
468+
aaf_dump_nodeStreamProperties( aafi->aafd, cfb_getChildNode( aafi->aafd->cfbd, L"properties", Obj->Node ) );
469+
470+
DBG_BUFFER_WRITE( dbg, "\n" );
471+
}
472+
473+
if ( aafi->ctx.options.dump_class_aaf_properties && wcscmp( aaft_ClassIDToText(aafi->aafd, Obj->Class->ID), aafi->ctx.options.dump_class_aaf_properties ) == 0 ) {
474+
DBG_BUFFER_WRITE( dbg, "\n\n" );
475+
DBG_BUFFER_WRITE( dbg, "======================================================================\n" );
476+
DBG_BUFFER_WRITE( dbg, " AAF Properties Dump\n" );
477+
DBG_BUFFER_WRITE( dbg, "======================================================================\n" );
478+
DBG_BUFFER_WRITE( dbg, "%s", ANSI_COLOR_DARKGREY(dbg) );
479+
DBG_BUFFER_WRITE( dbg, "%ls\n", aaft_ClassIDToText(aafi->aafd, Obj->Class->ID) );
480+
DBG_BUFFER_WRITE( dbg, "%ls/properties\n", aaf_get_ObjectPath( Obj ) );
481+
DBG_BUFFER_WRITE( dbg, "%s\n\n", ANSI_COLOR_RESET(dbg) );
482+
483+
aaf_dump_ObjectProperties( aafi->aafd, Obj );
484+
485+
DBG_BUFFER_WRITE( dbg, "\n" );
486+
}
487+
484488
DBG_BUFFER_WRITE( dbg, "%s", ANSI_COLOR_RESET(dbg) );
485489
}
486490

src/AAFIface/AAFIface.c

+33-9
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,43 @@ int aafi_set_option_str( AAF_Iface *aafi, const char *optname, char *val ) {
186186

187187
return 0;
188188
}
189-
else if ( strcmp( optname, "trace_class" ) == 0 ) {
189+
else if ( strcmp( optname, "dump_class_aaf_properties" ) == 0 ) {
190190

191-
if ( aafi->ctx.options.trace_class ) {
192-
free( aafi->ctx.options.trace_class );
193-
aafi->ctx.options.trace_class = NULL;
191+
if ( aafi->ctx.options.dump_class_aaf_properties ) {
192+
free( aafi->ctx.options.dump_class_aaf_properties );
193+
aafi->ctx.options.dump_class_aaf_properties = NULL;
194194
}
195195

196196
if ( val == NULL )
197197
return 0;
198198

199-
aafi->ctx.options.trace_class = malloc( (strlen(val)+1)*sizeof(wchar_t) );
199+
aafi->ctx.options.dump_class_aaf_properties = malloc( (strlen(val)+1)*sizeof(wchar_t) );
200200

201-
if ( aafi->ctx.options.trace_class == NULL ) {
201+
if ( aafi->ctx.options.dump_class_aaf_properties == NULL ) {
202202
return -1;
203203
}
204204

205-
swprintf( aafi->ctx.options.trace_class, strlen(val)+1, L"%" WPRIs, val );
205+
swprintf( aafi->ctx.options.dump_class_aaf_properties, strlen(val)+1, L"%" WPRIs, val );
206+
207+
return 0;
208+
}
209+
else if ( strcmp( optname, "dump_class_raw_properties" ) == 0 ) {
210+
211+
if ( aafi->ctx.options.dump_class_raw_properties ) {
212+
free( aafi->ctx.options.dump_class_raw_properties );
213+
aafi->ctx.options.dump_class_raw_properties = NULL;
214+
}
215+
216+
if ( val == NULL )
217+
return 0;
218+
219+
aafi->ctx.options.dump_class_raw_properties = malloc( (strlen(val)+1)*sizeof(wchar_t) );
220+
221+
if ( aafi->ctx.options.dump_class_raw_properties == NULL ) {
222+
return -1;
223+
}
224+
225+
swprintf( aafi->ctx.options.dump_class_raw_properties, strlen(val)+1, L"%" WPRIs, val );
206226

207227
return 0;
208228
}
@@ -263,8 +283,12 @@ void aafi_release( AAF_Iface **aafi )
263283
aafi_freeMarkers( &(*aafi)->Markers );
264284
}
265285

266-
if ( (*aafi)->ctx.options.trace_class ) {
267-
free( (*aafi)->ctx.options.trace_class );
286+
if ( (*aafi)->ctx.options.dump_class_aaf_properties ) {
287+
free( (*aafi)->ctx.options.dump_class_aaf_properties );
288+
}
289+
290+
if ( (*aafi)->ctx.options.dump_class_raw_properties ) {
291+
free( (*aafi)->ctx.options.dump_class_raw_properties );
268292
}
269293

270294
if ( (*aafi)->ctx.options.media_location ) {

tools/AAFInfo.c

+14-9
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ static void showHelp( void ) {
195195
" --aaf-meta Lists Classes and Properties from the MetaDictionary.\n"
196196
" --aaf-properties Displays all Properties.\n"
197197
"\n"
198-
" --trace Prints AAF class/object tree.\n"
199-
" --trace-meta Prints MetaProperties in the trace.\n"
200-
" --trace-class <AAFClassID> Prints properties of a specific AAFClass in the trace.\n"
198+
" --trace Prints file class/object tree.\n"
199+
" --show-meta Prints MetaProperties for each class/object.\n"
200+
" --dump-class <AAFClassID> Dumps aaf properties of a specific AAFClass.\n"
201+
" --dump-class-raw <AAFClassID> Dumps raw properties of a specific AAFClass.\n"
201202
"\n"
202203
"\n"
203204
" Options :\n"
@@ -248,7 +249,8 @@ int main( int argc, char *argv[] ) {
248249
int trace_meta = 0;
249250
int ansicolor = 1;
250251

251-
char *trace_class = NULL;
252+
char *dump_class_aaf_properties = NULL;
253+
char *dump_class_raw_properties = NULL;
252254

253255
int cmd = 0;
254256

@@ -276,8 +278,9 @@ int main( int argc, char *argv[] ) {
276278
{ "aaf-properties", no_argument, 0, 0x8c },
277279

278280
{ "trace", no_argument, 0, 0x91 },
279-
{ "trace-meta", no_argument, 0, 0x92 },
280-
{ "trace-class", required_argument, 0, 0x93 },
281+
{ "show-meta", no_argument, 0, 0x92 },
282+
{ "dump-class", required_argument, 0, 0x93 },
283+
{ "dump-class-raw", required_argument, 0, 0x94 },
281284

282285
{ "media-location", required_argument, 0, 0x8d },
283286
{ "pos-format", required_argument, 0, 0x8e },
@@ -343,7 +346,8 @@ int main( int argc, char *argv[] ) {
343346
case 0x90: verb = atoi(optarg); break;
344347
case 0x91: trace = 1; cmd++; break;
345348
case 0x92: trace_meta = 1; break;
346-
case 0x93: trace_class = optarg; break;
349+
case 0x93: dump_class_aaf_properties = optarg; break;
350+
case 0x94: dump_class_raw_properties = optarg; break;
347351

348352
case 0xa0: ansicolor = 0; break;
349353

@@ -400,8 +404,9 @@ int main( int argc, char *argv[] ) {
400404
aafi_set_option_int( aafi, "protools", PROTOOLS_ALL );
401405
aafi_set_option_int( aafi, "resolve", RESOLVE_ALL );
402406

403-
aafi_set_option_str( aafi, "media_location", media_location );
404-
aafi_set_option_str( aafi, "trace_class", trace_class );
407+
aafi_set_option_str( aafi, "media_location", media_location );
408+
aafi_set_option_str( aafi, "dump_class_aaf_properties", dump_class_aaf_properties );
409+
aafi_set_option_str( aafi, "dump_class_raw_properties", dump_class_raw_properties );
405410

406411
aafi_enable_windows_VT100_output();
407412

0 commit comments

Comments
 (0)