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

shouldn't rely on file extension #53

Open
bart9h opened this issue Nov 1, 2021 · 4 comments
Open

shouldn't rely on file extension #53

bart9h opened this issue Nov 1, 2021 · 4 comments

Comments

@bart9h
Copy link

bart9h commented Nov 1, 2021

libnyquist decodes "myfile.mp3" just fine.

But if I rename it to "myfile.data", it gives some kind of format error.

Shouldn't the library read the header from the beginning of the file, instead of relying on the file extension?

@4321ba
Copy link
Contributor

4321ba commented Nov 3, 2021

if you need to work around it, you can read in the file yourself
and pass only the raw encoded audio to libnyquist like this:

        vector<uint8_t> encoded_audio;
...//read in idk how
        shared_ptr<nqr::AudioData> file_data = make_shared<nqr::AudioData>();
        nqr::NyquistIO loader;
        loader.Load(file_data.get(), encoded_audio);

then it should properly recognize the file format, at least I think so

@ddiakopoulos
Copy link
Owner

@4321ba Unfortunately it does not!

@bart9h You're definitely right here, that's what the library should do :) I started incubating this feature a long time ago on this branch, but never had time to test and merge it. Happy to accept and PRs to get it working properly.

@4321ba
Copy link
Contributor

4321ba commented Nov 13, 2021

hmm does it not? it worked for me though
and like I don't know the codebase but at https://github.com/ddiakopoulos/libnyquist/blob/master/src/Common.cpp#L64 it really seems like it guesses the file type based on magic numbers, properly
this commit: dafe596

@ddiakopoulos
Copy link
Owner

@4321ba lol, alright my memory was clearly very wrong and I didn't bother to look at the code. Thanks for checking :)

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

3 participants