rust-ffmpeg-sys icon indicating copy to clipboard operation
rust-ffmpeg-sys copied to clipboard

Cannot get enum variant from name

Open valnoel opened this issue 2 years ago • 0 comments

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!

valnoel avatar Oct 03 '23 09:10 valnoel