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

Cannot get enum variant from name #61

Open
valnoel opened this issue Oct 3, 2023 · 0 comments
Open

Cannot get enum variant from name #61

valnoel opened this issue Oct 3, 2023 · 0 comments

Comments

@valnoel
Copy link

valnoel commented Oct 3, 2023

Hi!

I'm trying to use following helper functions to retrieve enum values from strings, but they return the enum discriminants instead:

pub fn av_color_range_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVColorRange
pub fn av_color_primaries_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVColorPrimaries
pub fn av_color_transfer_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVColorTransferCharacteristic
pub fn av_color_space_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVColorSpace
pub fn av_chroma_location_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVChromaLocation
pub fn av_stereo3d_from_name(name: *const libc::c_char) -> libc::c_int; // should return the AVStereo3DType
// maybe more...

Moreover, there is no simple way to retrieve the enum variant from the discriminant in Rust.

Would it be possible to fix these functions?

Thanks!

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

1 participant