video: Implement get_kr_kb manually to fix capitalization

Capitalization is wrong in function and parameter/variable names:

    warning: method `get_Kr_Kb` should have a snake case name
       --> gstreamer-video/src/auto/enums.rs:515:12
        |
    515 |     pub fn get_Kr_Kb(&self) -> Option<(f64, f64)> {
        |            ^^^^^^^^^ help: convert the identifier to snake case (notice the capitalization): `get_kr_kb`
        |
        = note: `#[warn(non_snake_case)]` on by default

    warning: variable `Kr` should have a snake case name
       --> gstreamer-video/src/auto/enums.rs:518:21
        |
    518 |             let mut Kr = mem::MaybeUninit::uninit();
        |                     ^^ help: convert the identifier to snake case (notice the capitalization): `kr`

    warning: variable `Kb` should have a snake case name
       --> gstreamer-video/src/auto/enums.rs:519:21
        |
    519 |             let mut Kb = mem::MaybeUninit::uninit();
        |                     ^^ help: convert the identifier to snake case (notice the capitalization): `kb`

    warning: variable `Kr` should have a snake case name
       --> gstreamer-video/src/auto/enums.rs:525:17
        |
    525 |             let Kr = Kr.assume_init();
        |                 ^^ help: convert the identifier to snake case (notice the capitalization): `kr`

    warning: variable `Kb` should have a snake case name
       --> gstreamer-video/src/auto/enums.rs:526:17
        |
    526 |             let Kb = Kb.assume_init();
        |                 ^^ help: convert the identifier to snake case (notice the capitalization): `kb`
This commit is contained in:
Marijn Suijten 2020-11-18 21:23:23 +01:00
parent 12c74d681b
commit c95bd4f47a
3 changed files with 35 additions and 1 deletions

View file

@ -19,7 +19,6 @@ external_libraries = [
generate = [
"GstVideo.VideoCodecFrameFlags",
"GstVideo.VideoFormatFlags",
"GstVideo.VideoColorMatrix",
"GstVideo.VideoMultiviewMode",
"GstVideo.VideoMultiviewFramePacking",
"GstVideo.VideoFilter",
@ -551,3 +550,11 @@ status = "generate"
manual = true
[object.function.return]
nullable = false
[[object]]
name = "GstVideo.VideoColorMatrix"
status = "generate"
[[object.function]]
name = "get_Kr_Kb"
# Function and parameter name capitalization is wrong
ignore = true

View file

@ -41,6 +41,8 @@ pub use crate::caps_features::{
CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, CAPS_FEATURE_META_GST_VIDEO_META,
CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
};
mod video_color_matrix;
pub use video_color_matrix::*;
mod video_format;
pub use crate::video_format::*;
mod video_format_info;

View file

@ -0,0 +1,25 @@
use std::mem;
use glib::translate::ToGlib;
impl crate::VideoColorMatrix {
pub fn get_kr_kb(&self) -> Result<(f64, f64), glib::BoolError> {
assert_initialized_main_thread!();
unsafe {
let mut kr = mem::MaybeUninit::uninit();
let mut kb = mem::MaybeUninit::uninit();
glib::glib_result_from_gboolean!(
ffi::gst_video_color_matrix_get_Kr_Kb(
self.to_glib(),
kr.as_mut_ptr(),
kb.as_mut_ptr(),
),
"{:?} is not a YUV matrix",
self
)?;
let kr = kr.assume_init();
let kb = kb.assume_init();
Ok((kr, kb))
}
}
}