ASF Duration Calculation Fix, Creation Date Fix #256
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description: Another couple bugs I found while porting ASF support in TagLib# to node 😅
The TagLib# implementation of ASF duration wasn't calculating the same duration for the sample.wma file as FFMpeg, foobar2000, VLC, which all said the file was 0:04 (or 4.153s). TagLib# was reporting the file was around 5s. Digging through the ASF specification and reading the sample with a hex editor, I found two issues with the TagLib# implementation:
FilePropertiesObject
class.TimeSpan
constructed from the preroll as milliseconds.The issue described in #255 states that ASF spec says creation date in File Properties Object is 100ns ticks since 1/1/1601 instead of the C#
DateTime
format's 100ns ticks since 1/1/0000. I don't really know why this is the case, but it is what it is. The fix for this is to add the number of ticks for 1/1/1601 to the creation date as read from the file. ... However, after revisiting the code, I realized creation date is never used and it's impossible to get access to an instance of the class without manually re-reading it from theAsfFile
, so this fix is more/less inconsequential. Nevertheless, it's bug, so I fix 😄. Unrelated, I'm planning to expose theHeaderObject
in theAsfFile
class in my port, and I'm thinking this would be a valuable addition to the TagLib# API.Testing:
StandardFileTests
properties test to checking all the properties we know about the sample file. All cases pass!