foreach (array
('title','author','reference'
) as $bext_key) { // Some software (notably Logic Pro) may not blank existing data before writing a null-terminated string to the offsets
// assigned for text fields, resulting in a null-terminated string (or possibly just a single null) followed by garbage
// Keep only string as far as first null byte, discard rest of fixed-width data
// https://github.com/JamesHeinrich/getID3/issues/263
$null_terminator_offset =
strpos($thisfile_riff_WAVE_bext_0[$bext_key], "\x00"
);
$thisfile_riff_WAVE_bext_0[$bext_key] =
substr($thisfile_riff_WAVE_bext_0[$bext_key], 0,
$null_terminator_offset);
} $thisfile_riff_WAVE_bext_0['origin_date'
] =
substr($thisfile_riff_WAVE_bext_0['data'
], 320, 10
);
$thisfile_riff_WAVE_bext_0['origin_time'
] =
substr($thisfile_riff_WAVE_bext_0['data'
], 330, 8
);
$thisfile_riff_WAVE_bext_0['time_reference'
] = getid3_lib::
LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'
], 338, 8
));
$thisfile_riff_WAVE_bext_0['bwf_version'
] = getid3_lib::
LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'
], 346, 1
));
$thisfile_riff_WAVE_bext_0['reserved'
] =
substr($thisfile_riff_WAVE_bext_0['data'
], 347, 254
);
$thisfile_riff_WAVE_bext_0['coding_history'
] =
explode("\r\n",
trim(substr($thisfile_riff_WAVE_bext_0['data'
], 601
)));
if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#',
$thisfile_riff_WAVE_bext_0['origin_date'
],
$matches_bext_date)) { if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#',
$thisfile_riff_WAVE_bext_0['origin_time'
],
$matches_bext_time)) { $bext_timestamp = array
();
list
($dummy,
$bext_timestamp['year'
],
$bext_timestamp['month'
],
$bext_timestamp['day'
]) =
$matches_bext_date;
list
($dummy,
$bext_timestamp['hour'
],
$bext_timestamp['minute'
],
$bext_timestamp['second'
]) =
$matches_bext_time;
$thisfile_riff_WAVE_bext_0['origin_date_unix'
] =
gmmktime($bext_timestamp['hour'
],
$bext_timestamp['minute'
],
$bext_timestamp['second'
],
$bext_timestamp['month'
],
$bext_timestamp['day'
],
$bext_timestamp['year'
]);
} else { $this->
warning('RIFF.WAVE.BEXT.origin_time is invalid'
);
}