Comments (8)
Thanks. Would you be willing to open a PR with a fix?
from taglib-sharp.
But this will mean the foreach( ICodec...
code will never be invoked because the two TimeSpan.Zero
conditions are collectively exhaustive and there is no mutation of this.duration
between the two statements.
I understand that duration == TimeSpan.Zero
actually means "unspecified" instead of actually being zero.
I think a better fix (to explicitly allow for a meaningful zero duration) would be to use System.Threading.Timeout.InfiniteTimeSpan
(-1
) to denote undefined duration.
from taglib-sharp.
A Zero
duration indeed here means: no duration. This is consistent with the rest of the TagLib# properties like Year
and feels quite intuitive.
Also I do not think that a video or sample which contains nothing at all is a valid usecase. So the Zero
to represent that no duration is available is, IMHO, a pretty fine choice.
@RogerioDuarte : In which case do you encounter a problem with this Zero
duration convention ?
from taglib-sharp.
Also I do not think that a video or sample which contains nothing at all is a valid usecase.
What is the duration
value of a video file that contains a single frame of video, e.g. a single-frame GIF image?
from taglib-sharp.
What is the duration value of a video file that contains a single frame of video, e.g. a single-frame GIF image?
The duration of such a single frame video should certainly not be 0, but follows this universal formula:
duration = frame_number / frame_rate
As a result, assuming a typical frame-rate of 25 fps, you'll have a duration of 40 milliseconds.
from taglib-sharp.
As a result, assuming a typical frame-rate of 25 fps, you'll have a duration of 40 milliseconds.
GIF files do not have a fixed frame-rate though, instead they have a delay value associated with each frame (making it a variable frame-rate file format) ( https://www.w3.org/Graphics/GIF/spec-gif89a.txt - section 23 c
). Consider a GIF with a single frame with a Delay Time
value of 0
(which is valid, as per the specification). How does TagLib handle this case?
from taglib-sharp.
Consider a GIF with a single frame with a Delay Time value of 0 (which is valid, as per the specification). How does TagLib handle this case?
Then this should be indeed a duration of Zero
. The difference between interpreting it as zero duration, infinite duration, undefined/unknown duration or no duration is quite a philosophical debate... In all those cases, we know that the duration is just irrelevant, just like in a BMP picture.
from taglib-sharp.
RogerioDuarte, thank you for posting the fix, I have forced with the same issue, but... After applying your fix, the duration for all files is always Zero.
I, however, found another (I think) issue causing the infinite recursion loop. In file Mpeg\AudioHeader.cs the Duration in some circumstances is calculated via AudioBitrate whereas AudioBitrate uses Duration. The fix is to change all references to Duration (property) in AudioBitrate property to duration (member variable).
The infinite recursion loop occurs on a file with a broken duration (=0).
However, my fix is not correct because in that case you have to call Duration before AudioBitrate when you're reading properties.
from taglib-sharp.
Related Issues (20)
- Wrong AudioBitrate at some ogg Files
- NestPlayer
- Access To The Path is Denied
- Creating tag RIFF tags in WAV file
- Id3v2 Tag Does Not Support Podcast Frames
- Error reading tag from Photomechanic
- How do I get the dimensions (height and width) of pictures HOT 2
- Impossible read/write tag software HOT 1
- Files not writeable by Taglibsharp but writeable by other tools HOT 1
- ID3v2 WXXX frame is empty HOT 9
- CombinedTag.IsEmpty returns true if any child is empty rather than if every child is empty
- Save Taging destroys highres wav
- PNG tags not being added HOT 1
- TagLibSharp Corrupting MP4\M4V files when updating Tag.Title HOT 1
- Support for classical music tags introduced in iTunes 12.5
- Cannot set tags for .jpg files HOT 1
- File Not Writeable message when setting data for JPG file
- Release type and Release status showing as null
- Finding the video Codec ID in an MKV file
- [BUG] Corrupted UnknownBox data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taglib-sharp.