Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to identify Opus files with the .ogg extension #1011

Closed
Ambrevar opened this issue May 8, 2021 · 4 comments
Closed

Fail to identify Opus files with the .ogg extension #1011

Ambrevar opened this issue May 8, 2021 · 4 comments

Comments

@Ambrevar
Copy link

Ambrevar commented May 8, 2021

I have Opus files with the .ogg extension and Strawberry (which leverages taglib) fails to detect them.
If I change the file extension to .opus, it works.

I've reported this on the Strawberry bugtracker (strawberrymusicplayer/strawberry#712 (comment)) and they forwarded me here.

@ufleisch
Copy link
Contributor

ufleisch commented May 9, 2021

When using the standard FileRef(FileName fileName, ...) constructor, it will call FileRef::parse(FileName fileName, ...) which will first try detectByResolvers(), then detectByExtension(), and finally detectByContent(). The problem here is that detectByExtension() will return a non null TagLib::File* pointer, actually an invalid Ogg/Vorbis file, and the detectByContent() will not be tried. This behavior could be changed by deleting the returned TagLib::File* if !d->file->isValid(), such a check for validity is also done in detectByContent() and should be added to detectByExtension() and detectByResolvers().

A backwards-compatible solution would be if Strawberry implement a subclass of TagLib::IOStream with an improved file type detection. This could also be implemented in a way to work with TagLib versions < 1.12 because the "Enabled FileRef to detect file types based on the stream content" feature is only available in TagLib 1.12.

@Ambrevar
Copy link
Author

Ambrevar commented May 9, 2021

@jonaski What do you think?

ufleisch added a commit to ufleisch/taglib that referenced this issue May 9, 2021
)

This is the case for Opus files with an ogg extension.
ufleisch added a commit that referenced this issue May 28, 2021
This is the case for Opus files with an ogg extension.
@ufleisch
Copy link
Contributor

Should be fixed by #1013.

@Ambrevar
Copy link
Author

Ambrevar commented May 29, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants