diff --git a/examples/sndfile-info.c b/examples/sndfile-info.c index 72de9ae5..d1270d94 100644 --- a/examples/sndfile-info.c +++ b/examples/sndfile-info.c @@ -327,6 +327,7 @@ broadcast_dump (const char *filename) { SNDFILE *file ; SF_INFO sfinfo ; SF_BROADCAST_INFO bext ; + double time_usec ; int got_bext ; memset (&sfinfo, 0, sizeof (sfinfo)) ; @@ -349,11 +350,27 @@ broadcast_dump (const char *filename) return ; } ; + /* + ** From : http://www.ebu.ch/en/technical/publications/userguides/bwf_user_guide.php + ** + ** Time Reference: + ** This field is a count from midnight in samples to the first sample + ** of the audio sequence. + */ + + time_usec = ((pow (2.0, 32) * bext.time_reference_high) + (1.0 * bext.time_reference_low)) / sfinfo.samplerate / 1e6 ; + printf ("Description : %.*s\n", (int) sizeof (bext.description), bext.description) ; printf ("Originator : %.*s\n", (int) sizeof (bext.originator), bext.originator) ; printf ("Origination ref : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ; printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ; printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ; + + if (bext.time_reference_high == 0 && bext.time_reference_low == 0) + printf ("Time ref : 0\n") ; + else + printf ("Time ref : 0x%x%08x (%.4f microseconds)\n", bext.time_reference_high, bext.time_reference_low, time_usec) ; + printf ("BWF version : %d\n", bext.version) ; printf ("UMID : %.*s\n", (int) sizeof (bext.umid), bext.umid) ; printf ("Coding history : %.*s\n", bext.coding_history_size, bext.coding_history) ;