Skip to content

Conversation

@dmednis
Copy link

@dmednis dmednis commented Dec 1, 2017

Refactored PR #31 to be mergable.

@dmednis dmednis changed the title Added bindings for mp3 info method Added bindings for mp3 info method #31 Dec 1, 2017
@dmednis dmednis changed the title Added bindings for mp3 info method #31 Added bindings for mp3 info method (#31 refactor) Dec 1, 2017
@LinusU
Copy link
Collaborator

LinusU commented Dec 4, 2017

This looks good, the only thing I would like to change is the enums (version, mode, flags and vbr). Could we either just remove them from the info object (and add them in a later version) or turn them into strings instead, so that they are usable from node land.

switch (frameinfo.version) {
  case MPG123_1_0: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("MPG123_1_0")); break;
  case MPG123_2_0: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("MPG123_2_0")); break;
  case MPG123_2_5: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("MPG123_2_5")); break;
}

edit:

maybe even

switch (frameinfo.version) {
  case MPG123_1_0: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("1.0")); break;
  case MPG123_2_0: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("2.0")); break;
  case MPG123_2_5: Nan::Set(o, Nan::New<String>("version").ToLocalChecked(), Nan::New<String>("2.5")); break;
}

@dmednis dmednis closed this May 26, 2021
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

Successfully merging this pull request may close these issues.

2 participants