Commit graph

375 commits

Author SHA1 Message Date
François Laignel e80a29372a fix-getters-def 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel b8b944b72b subclass: remove get prefix where applicable 2021-04-20 18:18:02 +02:00
François Laignel f7472c82e3 regen: relaxed get fn identification 2021-04-20 18:18:02 +02:00
François Laignel 172a4d47ab regen: use type_ for glib macros
This also includes a new substitution for bool getters:
get_need_... -> needs_...
2021-04-20 18:18:02 +02:00
Marijn Suijten b8756a3bd8 video/video_buffer_pool: Implement ToGlibPtr for VideoAlignment
This will be used by the GL bindings.
2021-04-17 07:54:40 +00:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
François Laignel 08545cbefc regen - remove get prefix for getters 2021-04-13 17:54:38 +02:00
Marijn Suijten 6ec0e3ac4b Update gir and regenerate with extended gir-dirs comments
Gir now prints all directories and their hashes in the version file and
comments; useful now that gstreamer-rs is being generated from both
gir-files/ and gst-gir-files/ submodules.
2021-04-01 15:58:41 +02:00
Marijn Suijten a38561fbcd Update gir and regenerate with redundant #[cfg]/#[cfg_attr] removed
Also ignores `clippy::upper_case_acronyms` introduced with 1.51 which
can't be adhered to in bindings.
2021-04-01 15:53:18 +02:00
Marijn Suijten 89ba883ea8 audio/video: Do not link v1_20 ffi functions when building docs
The sys crates have not been generated with 1.20 introspected gir files
yet, and break the documentation that is already compiling with the
v1_20 feature. Function body contents don't truly matter for the
documentation build anyway.
2021-03-24 13:43:45 +01:00
Sebastian Dröge ea239c587e Store panic information not in a custom instance struct but in the instance data provided by the subclassing infrastructure
This scales better as there will only be only such data instead of two
or more when having deeper class hierarchies with multiple Rust
elements, and also makes it unnecessary to use a special instance struct
so the default works well.
2021-03-09 16:36:35 +02:00
Sebastian Dröge 6fa48890bc Update for the subclassing glib bindings API changes 2021-03-09 16:04:32 +02:00
Sebastian Dröge a311591310 Regenerate with latest gir 2021-03-08 12:25:37 +02:00
Sebastian Dröge 0803dd411e Update for glib subclass API cleanup 2021-03-08 12:18:24 +02:00
Sebastian Dröge 5822785191 Regenerate with latest gir 2021-02-28 18:30:54 +02:00
Sebastian Dröge 2b0b3910ee Regenerate everything with latest gir 2021-02-22 17:13:45 +02:00
Sebastian Dröge 0ea48e9894 gstreamer-video: Add support for VideoOrientation interface and VideoOrientationMethod enum 2021-02-19 18:42:38 +02:00
Marijn Suijten ce67076f26 gstreamer,video: Do not zero-initialize designated struct members
This should be analogous to C struct initalizers where all unspecified
fields are initialized to zero. Without mut this reads a bit nicer as
well.

Note that two out of three structs have all members specified, hence
need no zero-initialization of the remainder at all.
2021-02-15 20:19:38 +01:00
Sebastian Dröge 631be6b534 video/timecode: Fix compilation of tests with target API < 1.16 2021-02-10 13:09:51 +02:00
Vivia Nikolaidou 0a119cada6 gstreamer-audio: Add AudioConverterConfig 2021-02-09 19:13:30 +02:00
Sebastian Dröge 9d86cef2da Regenerate everything with latest gir 2021-02-07 17:07:17 +02:00
Sebastian Dröge 280433ebc1 video/timecode: Comment out spurious #[cfg] attribute and remove its duplicate 2021-02-04 11:19:54 +02:00
Sebastian Dröge e1a964fb00 video/timecode: Use mem::ManuallyDrop to prevent a double unref of the daily jam
As ffi::GstVideoTimeCode implements Copy, assignments don't move it out
of the passed in value but just copy it. This doesn't increase the
reference count of the daily jam, still runs the Drop impl of the passed
in value to decrease the daily jam and then causes a second unref of it
later when the returned value is dropped.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/310
2021-02-04 10:55:43 +02:00
Marijn Suijten fb55cdfeff Remove allow(unused_imports) from mod auto
gir has been fixed to omit all unnecessary imports from objects, enums
and flags which currently are the only offenders of this linter warning.
Hence disallow this warning from now on which is anyway not applied to
every crate - like gstreamer-gl - where such issues have been uncovered.
2021-01-30 15:49:49 +01:00
Marijn Suijten 1ffa02fc1f Update gir to c85699a with import cleanups; regenerate
Apply import cleanups from https://github.com/gtk-rs/gir/pull/1043,
omitting `use` statements where unnecessary or guarding them with
versioning constraints to prevent `unused_imports` warnings.

Removes unnecessary `mut_override` with
https://github.com/gtk-rs/gir/pull/1044 as well.
2021-01-30 15:49:38 +01:00
Sebastian Dröge 927cca106d Use async/await in a few places and reduce dependencies as a result 2021-01-14 15:25:03 +02:00
Sebastian Dröge 68839c0e79 Re-export all dependency crates and their preludes
This makes code in examples potentially simpler.
2020-12-20 19:40:34 +02:00
Sebastian Dröge 53aae7ddba Remove gst_ prefix from all macros except for the logging macros
The latter stay e.g. gst_debug! to be more clear and not conflict with
e.g. the debug! macro from the log crate.
2020-12-20 19:40:34 +02:00
Marijn Suijten 62436aa8d3 video/time_code_interval: Correct set_frames parameter name
Aesthetics.
2020-12-19 12:54:37 +01:00
Marijn Suijten 6e119b7256 video/time_code_interval: Ord cmp minutes to other.minutes, not hours
Same mistake as the previous commit. Clipppy didn't find this one though
:)
2020-12-19 12:54:21 +01:00
Marijn Suijten 5740a70dd2 video/time_code_interval: Do not compare minutes to hours in PartialEq
Clippy nightly is becoming surprisingly smart these days:

    warning: This sequence of operators looks suspiciously like a bug.
      --> gstreamer-video/src/video_time_code_interval.rs:66:16
       |
    66 |             && self.0.minutes == other.0.hours
       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: I think you meant: `self.0.minutes == other.0.minutes`
       |
       = note: `#[warn(clippy::suspicious_operation_groupings)]` on by default
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_operation_groupings
2020-12-19 12:51:58 +01:00
Guillaume Gomez 2f0e386037 Regen with more doc alias for enums and consts 2020-12-18 15:23:05 +01:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Sebastian Dröge d0b0006d27 Regenerate 2020-12-18 00:34:53 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Marijn Suijten 85e46f39f3 video: Provide manual to_string and display for VideoChromaSite
This function was named wrong before 1.20, and its return transfer type
changed from none to full. To provide

Note that, when 1.20 Gir files are imported, this `version` override in
gstreamer-video/Gir.toml wil come into effect and create a Display trait
for us (without version constraint). At that point the manual Display
impl should be removed, but the manual to_string implementation remains.
2020-12-12 20:28:37 +01:00
Marijn Suijten a215610167 audio/video: Update to v1.20 functions 2020-12-12 19:43:02 +01:00
Guillaume Gomez fb56af8d84 Update from_glib calls and put them in unsafe blocks 2020-12-08 15:50:15 +01:00
Guillaume Gomez 959568f124 regen 2020-12-08 14:00:17 +01:00
Marijn Suijten bb8e7c3e8f audio/video: Fix more unused imports
TODO: How about use glib::translate::*;?
2020-12-07 12:12:16 +01:00
Marijn Suijten 82b4726bb7 impl FromStr: Forward implementation to autogenerated from_string() 2020-12-07 12:12:16 +01:00
Marijn Suijten a7348023a0 video: Add test cases for enum to_string 2020-12-07 12:12:16 +01:00
Marijn Suijten 040772ab61 audio,video: Manual enum to_string returns 'static; add NULL check 2020-12-07 12:12:16 +01:00
Marijn Suijten 9ff39bae6f audio,video: Use autogenerated Display impl 2020-12-07 12:12:16 +01:00
Marijn Suijten c215acb7f9 audio,video: Delete manual implementations for now-autogenerated enum funcs 2020-12-07 12:12:16 +01:00
Marijn Suijten 15d8774e6b Update gir to 1c1a8d7 and regenerate with associated enum/flag functions 2020-12-07 12:11:27 +01:00
Marijn Suijten c95bd4f47a 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`
2020-12-07 12:09:39 +01:00
Marijn Suijten d9769aeb6a audio/video: Add missing FromGlibPtrNone<*const> for FormatInfo 2020-12-07 12:09:39 +01:00
Marijn Suijten 0763d2645d video: Reuse Self::Err in from_str 2020-12-07 12:09:39 +01:00
Marijn Suijten 2447664df6 Replace Result<(), fmt::Error> with fmt::Result 2020-12-07 12:09:39 +01:00
Marijn Suijten 584a87163f video/video_meta: get_plane_size now takes a size-annotated array ptr 2020-12-04 19:37:10 +01:00
Guillaume Desmottes 8b9ef8b109 video: add alignment API to VideoMeta 2020-12-03 16:39:40 +01:00
Guillaume Desmottes c529d4d4ae video: add VideoInfo::align_full() 2020-12-03 16:39:40 +01:00
Guillaume Desmottes e404d4f213 video: VideoInfo::align(): return a Result 2020-12-03 16:39:40 +01:00
Guillaume Desmottes 7cc57f4164 video: implement Eq and PartialEq on VideoAlignment 2020-12-03 16:39:35 +01:00
Guillaume Desmottes 6fbe7a1739 video: add VideoMeta::get_plane_{height,size}
Fix #299
2020-12-03 12:15:51 +01:00
Guillaume Gomez 8f9d76bb8c Revert "Remove unnecessary dox feature"
This reverts commit 9dd8bd9095.
2020-11-27 14:37:49 +01:00
Guillaume Gomez 7daac635c4 regen 2020-11-27 14:37:24 +01:00
Guillaume Gomez 9dd8bd9095 Remove unnecessary dox feature 2020-11-25 15:54:02 +01:00
Guillaume Gomez 28438d245a regen 2020-11-25 15:53:45 +01:00
Sebastian Dröge d31badf9ac gstreamer-video: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Sebastian Dröge 4bd7f7af1a gstreamer-video: Regenerate 2020-11-22 19:15:20 +02:00
Sebastian Dröge 389fa306aa Regenerate with latest gir 2020-11-19 19:53:22 +02:00
Marijn Suijten e88994a0b7 use cfg_if to refactor some #[cfg()] / #[cfg(not())] pairs 2020-11-19 16:39:31 +01:00
Marijn Suijten aeb1b70581 Remove doc(cfg()) from expressions
warning: unused doc comment
       --> gstreamer-video/src/video_info.rs:655:37
        |
    655 |           #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
        |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    656 | /         {
    657 | |             VideoInfoBuilder {
    658 | |                 format,
    659 | |                 width,
    ...   |
    674 | |             }
    675 | |         }
        | |_________- rustdoc does not generate documentation for expressions

Also simplify some blocks into expressions which are allowed to have
attributes as well since Rust 1.43.
2020-11-19 16:39:31 +01:00
Marijn Suijten bd75778fcb Add doc(cfg()) on all manual files 2020-11-19 16:39:31 +01:00
Marijn Suijten 9daa8d20a9 Regenerate with doc(cfg()) attribute on all symbols
This is enabled by a new version of gir, as updated in the previous
commit.
2020-11-19 16:39:31 +01:00
Marijn Suijten 3f373f623a Enable feature(doc_cfg) in all lib.rs
The next version of gir is going to generate doc(cfg()) attributes on
many symbols to show feature-dependence hints. While autogenerated sys
crates get this attribute in their own (generated) lib.rs file the safe
wrapper crates do not have such an autogenerated lib.rs file.
2020-11-19 16:39:31 +01:00
Sebastian Dröge 09f1a87dc9 video/timecode: Use stringify!($name) instead of "$name" in Debug impl
Otherwise it would output a literal "$name" string.
2020-11-16 13:21:57 +02:00
Sebastian Dröge b861f724c4 gstreamer-video: Make virtual methods take wrapper of type, not parent 2020-11-14 19:39:27 +02:00
Sebastian Dröge f6ace04caf Regenerate everything with latest gir 2020-11-07 12:17:25 +02:00
François Laignel 5903496e5b regenerate all 2020-11-05 18:29:47 +01:00
Sebastian Dröge b91123d298 Simplify IsSubclassable::override_vfunc() implementations 2020-11-05 17:12:06 +00:00
Sebastian Dröge 99fbbc32cb Use glib::Class instead of glib::object::Class 2020-11-05 17:12:06 +00:00
Sebastian Dröge 027de84349 Update for class struct handling changes in the glib bindings
See https://github.com/gtk-rs/gtk-rs/pull/10
2020-11-05 16:41:48 +02:00
François Laignel ec220201e7 gstreamer-video: regenerate 2020-11-05 12:40:44 +01:00
Sebastian Dröge 67f5c0767a Regenerate everything with latest gir 2020-11-01 09:48:40 +02:00
Sebastian Dröge a6c8fe0c8a Use repr(transparent) where it is more correct and get rid of some unneeded repr(C) 2020-10-24 17:09:10 +00:00
Sebastian Dröge 4c216bca3a Remove unneeded PhantomData markers
And as a side-effect also get rid of the lifetime parameter of
gst::TypeFind that was completely unused anyway.
2020-10-24 17:09:10 +00:00
Sebastian Dröge 501934a29b Allow unused imports in autogenerated code
These should not be there to begin with but they're hard to prevent.
2020-10-17 13:09:45 +03:00
Sebastian Dröge 0b70e52032 gstreamer/audio/video: Correctly implement ExactSizeIterator
len() is optional but size_hint() must return the correct values. Also
this shouldn't return the overall length but the remaining length.
2020-10-09 11:35:19 +03:00
Sebastian Dröge 6ce9a9ce12 video: Rename VideoTransferFunction functions 2020-09-08 15:43:05 +03:00
Sebastian Dröge 55efe30258 Regenerate everything 2020-09-08 15:42:28 +03:00
Sebastian Dröge febb0dfd16 video/video_frame: Allow getting an owned buffer from readable video frames
In all other variations this is not possible as it would allow to
circumvent the mini object writability rules.
2020-08-11 13:35:39 +03:00
Sebastian Dröge dfe87cf5c9 Add various new 1.18 APIs 2020-08-11 12:54:32 +03:00
Sebastian Dröge 70fd572a46 Regenerate everything 2020-08-11 12:53:27 +03:00
Sebastian Dröge 4f5b2f5060 Update for removal of ObjectImpl::get_type_data() 2020-07-26 18:02:05 +03:00
Sebastian Dröge 448c1e10a0 Regenerate 2020-07-06 13:01:57 +03:00
Sebastian Dröge e3667fd8d2 video/video_info: Add field_height() function 2020-07-03 13:10:28 +03:00
Sebastian Dröge 5845038a63 video: Use correct version for interlaced caps feature 2020-07-03 13:00:07 +03:00
Sebastian Dröge 2db7b8ebcc video: Use correct versions of primaries/transfer function enums 2020-07-03 12:23:32 +03:00
Sebastian Dröge 9cc99b27e0 gstreamer/element: Let post_message() and post_error_message() take ownership of the message
This is more in line with the C API and simplifies callers in Rust.
2020-06-30 23:55:02 +03:00
Sebastian Dröge 911bb34dc2 Don't generate LAST/NONE variants of flags types
Those are automatically provided already.
2020-06-30 11:35:49 +03:00
Sebastian Dröge 45402b5e95 Add specific version configurations for various enum/flags values
gobject-introspection does not support this yet so we have to do that
manually.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/271
2020-06-30 11:23:37 +03:00
Sebastian Dröge af01f1bc67 gstreamer: Simplify MiniObject bindings by removing one layer of abstraction
And instead directly implementing this via the macro on the target
types.
2020-06-30 11:06:02 +03:00
Sebastian Dröge 947ac8db5c Name functions returning a builder builder(), not new()
And also make the video event API more consistent with the normal event
API.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/269
2020-06-25 19:42:33 +03:00
Guillaume Desmottes 2f1b3306de video: properly version VideoFormat members
The C API is not safe when called on unknown formats.

Need to do this manually until gir gives us the version info:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/348

Fix #267
2020-06-24 14:55:27 +02:00
Guillaume Desmottes 2afcdfe79f video: remove 1.18 formats from VIDEO_FORMATS_ALL
This array is a fallback when using gst < 1.18 so it makes no sense
to include formats which have been introduced in 1.18
2020-06-24 14:14:45 +02:00
Guillaume Desmottes 03a240cf3f video: format: check for Nv12 instead of P016Be
The latter has been introduced in 1.18 making the test fail with older
gst.
2020-06-24 10:01:31 +02:00
Guillaume Desmottes ac47c7bc1d video format:: disable sorting test with gst < 1.18
This test relies on a 1.18 specific fix
( 8e3c4a5d5a )
and is meant to check that future updates won't break the ordering.
2020-06-24 10:01:20 +02:00