Commit graph

269 commits

Author SHA1 Message Date
Guillaume Desmottes ae57524502 video: manually order VideoFormat and VideoFormatInfo 2020-06-09 09:26:32 +02:00
Sebastian Dröge 30d51f0ca6 video: Don't panic when passing an invalid video info to VideoMeta::add()
Instead return an error that can be handled by the caller.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/259
2020-06-07 18:58:54 +03:00
Sebastian Dröge 926ed2f53d video: Don't unmap VideoFrameRef created from a VideoFrame
Otherwise we're going to unmap it twice. Also add a test for the
different interactions.
2020-06-07 15:22:33 +00:00
Sebastian Dröge 4f5aceaa5a video: Check that the passed in video info is valid when creating a VideoFrame 2020-06-07 15:22:33 +00:00
Sebastian Dröge 6ed505401f video: Add VideoInfo::is_valid() and guard against finfo being NULL when retrieving the video format 2020-06-07 15:22:33 +00:00
Mathieu Duponchelle 9f422c25d9 audio / video: export new formats iterators in preludes 2020-06-03 21:38:16 +02:00
Guillaume Desmottes 972002ceb2 video: implement Iterator on VideoFormat
Also add VIDEO_FORMATS_ALL as public API.
2020-06-03 21:11:00 +03:00
Guillaume Desmottes 9754147a30 video: add API to build raw video caps 2020-06-03 21:11:00 +03:00
Guillaume Desmottes 1b0a20e52f regenerate 2020-06-03 20:04:18 +03:00
Sebastian Dröge 9236ace284 video: Add VideoAffineTransformationMeta, CropMeta and RegionOfInterestMeta
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/218
2020-06-02 16:05:01 +03:00
Sebastian Dröge 5eb1dbd93e video/videoinfo: Use a proper error type in the TryFrom<VideoMultiviewMode> impl for VideoMultiviewFramePacking 2020-05-26 19:26:35 +03:00
Sebastian Dröge f0e12bbf24 video/videoconverter: Add TryFrom<Structure> and inverse From impl for VideoConverterConfig
Allows converting between both types interchangebly.
2020-05-26 19:26:35 +03:00
Mathieu Duponchelle 02a43819a7 gstreamer-video: expose caps features 2020-05-22 21:31:45 +02:00
Sebastian Dröge 31313fb5c8 video: Add bindings for guess_framerate() 2020-05-20 09:52:03 +03:00
Sebastian Dröge 8029d85232 video: Add bindings for calculate_display_ratio() 2020-05-20 09:52:03 +03:00
Sebastian Dröge 781c5785b1 Regenerate 2020-05-05 17:29:14 +00:00
Vivia Nikolaidou ec4a43be89 Regenerate 2020-05-03 16:48:35 +03:00
Vivia Nikolaidou 4718f72fed gstreamer-video/video_encoder: Manually implement finish_subframe 2020-05-03 16:48:35 +03:00
Sebastian Dröge 1be8ec691e gstreamer-video: Add support for the AFD and Bar metas 2020-05-03 16:48:35 +03:00
Vivia Nikolaidou 118c7d4ad9 Regenerate 2020-04-30 17:16:23 +03:00
Sebastian Dröge 6e431ce060 Run everything through rustfmt again
It got some improvements for applying consistent formatting to code
blocks in macros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/468>
2020-04-24 12:46:16 +03:00
Sebastian Dröge 47cc80b1ef video: Assert if caption data passed when adding caption metas is empty
It will cause a critical warning otherwise.
2020-04-22 21:42:39 +03:00
Sebastian Dröge 78a81e2c73 gstreamer-video: ValidVideoTimeCode::add_interval() is guaranteed to return a valid timecode again
So change the return type from VideoTimeCode to ValidVideoTimeCode.
2020-04-14 17:24:11 +03:00
Sebastian Dröge 5021994237 Regenerate everything 2020-04-13 19:11:33 +03:00
Sebastian Dröge 76a0410d41 Replace unneeded transmute calls with a safer alternative 2020-04-12 19:47:49 +03:00
Sebastian Dröge d1665b8114 Regenerate with latest gir 2020-04-12 18:55:06 +03:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge 62e9af58c6 Fix some clippy warnings 2020-04-11 21:18:18 +03:00
Sebastian Dröge 62c0f5ef42 Use mem::ManuallyDrop instead of mem::forget() everywhere
It makes the intentions clearer and potentially results in simpler
assembly, at least in debug builds.
2020-04-09 16:57:06 +03:00
Sebastian Dröge 019afd54f9 Update for new from_glib_borrow signature
See https://github.com/gtk-rs/glib/pull/605
2020-04-05 18:48:48 +03:00
Sebastian Dröge 0651bfb51b gstreamer-audio/video: Make allocator optional in get_allocator() functions for encoder/decoder base classes
They can be and are often None.
2020-04-02 19:58:42 +03:00
Sebastian Dröge a2a1a87c46 video/video-info: Don't use bool return of gst_video_info_set_format()/align() when running with GStreamer < 1.11.1
The bool return value was added in 1.11.1 and using the return value
with older versions gives a random value that might be true or false,
and then causes spurious errors.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/236#note_399872
2020-02-14 13:12:41 +01:00
Sebastian Dröge 80c93dfddb video: Add Future variant of convert_sample_async()
Requires to be spawned on the GLib main context futures executor as the
function itself requires a GLib main context to call the callback.
2020-02-09 19:08:41 +02:00
Sebastian Dröge 53dd841006 video: Add VideoConverter bindings 2020-01-30 23:17:06 +02:00
Sebastian Dröge 3c10986222 video: Autogenerate bindings for a few more enums 2020-01-30 23:12:07 +02:00
Sebastian Dröge 0b16556d9b video/video-frame: Implement immutable frame functions more generically 2020-01-30 23:11:12 +02:00
Sebastian Dröge 7230aee069 Switch everything from lazy_static to once_cell::Lazy
Fewer macros, faster compile-time and the Lazy type will likely end up
in the standard library in a similar form to this.
2020-01-22 19:57:41 +02:00
Sebastian Dröge 196a9891cb Regenerate with latest gir
This switches the RTP constant strings over to once_cell::Lazy
2020-01-22 19:57:41 +02:00
Sebastian Dröge d3c77f400d Don't derive Debug impls for generic types where the type parameters don't have to impl Debug themselves
This allows to use MappedBuffer and similar types to be properly
debug-printed.

Also change VideoFrame/VideoFrameRef/RTPBuffer from a tuple struct to a
struct with proper field names to make the code easier to understand.
2020-01-22 19:10:04 +02:00
Sebastian Dröge a418dcbe05 video: Use static inner lifetime for VideoCodecState<Readable>
It does not borrow from anything else and can be safely stored away.

Only the VideoCodecState<InNegotiation> is actively borrowing from the
element to ensure that it is only modified during negotiation in a safe
way.
2019-12-23 13:07:05 +02:00
Sebastian Dröge 69be1ce2fc Fix various new clippy warnings from 1.40 2019-12-22 12:10:27 +02:00
Sebastian Dröge 573055cb1e gstreamer-video: Require &mut self for VideoCodecFrame functions that modify it
And add non-mutable getters for input/output buffer
2019-12-18 18:42:40 +02:00
Sebastian Dröge 2ba5105b80 Implement Sync/Send for more types and don't implement Send for TypeFind
They can actually be shared with multiple threads at the same time
safely as all functions requiring an immutable reference are
thread-safe.

OTOH TypeFind can't be shared safely between different threads as not
all implementations of the TypeFind struct are thread-safe.
2019-12-18 18:37:44 +02:00
Sebastian Dröge be3c378f28 Use Results instead of Options where they signal an error instead of just a missing value
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 22:21:28 +02:00
Tony Jinwoo Ahn 700332dd3e gstreamer-video: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 08:41:51 +00:00
Tony Jinwoo Ahn 62c0b689a6 gstreamer-base/{adapter,functions}, gstreamer-video/video_info: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-16 11:29:51 +00:00
Sebastian Dröge eaafbd14f7 Regenerate 2019-12-15 12:19:33 +02:00
Tony Jinwoo Ahn 3e3c5205db gstreamer-video/video_info: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-15 08:36:56 +00:00
Sebastian Dröge f417d68820 Remove usage of glib_floating_reference_guard!()
It's not needed anymore.
2019-12-07 23:05:14 +02:00
Sebastian Dröge 175863668d Regenerate everything with latest gir 2019-11-21 09:52:51 +02:00
Philippe Normand 80e01dbe3c video: Simplify VideoMeta::add_full()
The n_planes value can be infered from the offset and stride slices size, which
both need to match.

Fixes #224
2019-11-18 18:15:03 +00:00
Guillaume Gomez 9e30687d8e Fix glib reexports 2019-11-11 11:34:09 +01:00
Guillaume Gomez 457ac9118b Regenerate with latest gir 2019-11-11 11:34:09 +01:00
Sebastian Dröge 452ea45c1b video: Actually export is_video_overlay_prepare_window_handle_message() function 2019-10-29 19:40:32 +02:00
Sebastian Dröge 8dcf3fec20 gstreamer: Change Sample constructor to the builder pattern
Simplifies construction of Samples considerably.
2019-10-23 09:55:56 +03:00
Sebastian Dröge 2d2459ed52 Export traits from the crate level and ensure that all traits are in the preludes 2019-10-17 13:30:35 +03:00
Sebastian Dröge 991f2e1576 Update and regenerate everything with latest gir 2019-10-05 00:03:57 +03:00
Sebastian Dröge 06cfcd57fc Move to_string() methods into the Display trait or rename to to_str(), move from_string() into the FromStr trait
Fixes clippy warnings, prevents confusing errors and is more consistent.

The Display trait provides a to_string() method by itself and FromStr
provides from_str().
2019-10-04 11:01:55 +03:00
Sebastian Dröge fc0fc99d1c audio/video: Fix some clippy warnings
warning: use of `unwrap_or` followed by a function call
   --> gstreamer-audio/src/subclass/audio_encoder.rs:360:18
    |
360 |                 .unwrap_or(element.proxy_getcaps(None, filter))
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | help: try this: `unwrap_or_else(|| element.proxy_getcaps(None, filter))`
2019-09-24 15:03:45 +03:00
Sebastian Dröge c19c9b1d8a audio/video: Add decoder base class error macros 2019-09-15 11:44:08 +03:00
Sebastian Dröge 1348127ca8 audio/video: proxy_getcaps() can't return None and get_caps() vfuncs must not return None 2019-09-14 11:05:55 +03:00
Sebastian Dröge bddb49443d audio/video: Use proxy_getcaps() function for default handling of getcaps() vfunc 2019-09-14 11:01:50 +03:00
Sebastian Dröge ea95d1e479 video: Add support for VideoDecoder::drain() vfunc 2019-09-13 23:04:10 +03:00
Sebastian Dröge 8160521574 video: Add support for getcaps(), negotiate(), src/sink_query/event() vfuncs in VideoEncoder/Decoder 2019-09-13 22:59:31 +03:00
Sebastian Dröge 4c52996fc8 video: Return NotNegotiated if setting the output state fails 2019-09-13 22:59:31 +03:00
Sebastian Dröge 2d5b6de590 video: Add VideoEncoder/VideoDecoder::get_allocator() 2019-09-13 22:59:31 +03:00
Sebastian Dröge 52509b4b95 Remove subclassing feature and make it the default 2019-09-09 11:51:07 +03:00
Sebastian Dröge ea367bac14 Fix or ignore various clippy warnings
And ignore some common warnings we don't care about in general, while
also making clippy errors fail the build.
2019-09-07 19:39:19 +03:00
Sebastian Dröge eddf4a61ff videoencoder/decoder: Add constants for the NEED_DATA custom flow returns 2019-08-14 20:22:55 +03:00
Sebastian Dröge 5c53f10135 videoencoder: Allow passing None to finish_frame() 2019-08-14 20:22:53 +03:00
François Laignel 5d012945df Regen 2019-08-11 10:43:30 +02:00
Sebastian Dröge e3282c27f1 video: Generate VideoBufferFlags and add a extension trait for setting/getting them on buffers 2019-07-16 11:51:23 +03:00
Sebastian Dröge d8325212f4 Fix various clippy warnings 2019-07-11 22:02:01 +03:00
Sebastian Dröge 424a87efbf Use MaybeUninit::zeroed() everywhere possible instead of mem::zeroed() 2019-07-11 17:56:50 +03:00
Sebastian Dröge 3a8d05075d Switch everything from mem::uninitialized() to MaybeUninit or mem::zeroed()
And also fix a few cases where mem::uninitialized() was simply wrong to
use.
2019-07-11 17:56:50 +03:00
Sebastian Dröge bde6a04780 Regenerate everything with latest gir 2019-07-10 11:21:28 +03:00
Guillaume Desmottes 86f7a1dd9b video: VideoInfo: display format info in Debug 2019-07-03 14:32:43 +02:00
Guillaume Desmottes 71414fe052 video: implement proper Debug on VideoFormatInfo 2019-07-03 14:23:58 +02:00
Sebastian Dröge 38f3d3eff2 video-info: Use gst_video_info_set_interlaced_format() when building for 1.16 and having an interlace-mode set
This ensures that the plane information is filled correctly.
2019-06-26 12:42:33 +03:00
Sebastian Dröge 47f0940b44 Regenerate everything with latest gir 2019-06-24 20:52:03 +03:00
Guillaume Desmottes cd16337874 video: video-info: fix Display implementations
We were calling the blanket implementation of ToString, which is using
Display, rather than our own, resulting in an infinite recursion.

Also a couple of to_string() implementation were using the wrong
glib conversion as they actually return a 'const gchar *'.
2019-06-18 17:11:24 +05:30
Guillaume Desmottes af65497c39 video: fix VideoFormat Display implementation
We were calling the blanket implementation of ToString, which is using
Display, rather than our own, resulting in an infinite recursion.

Fix #208
2019-06-18 17:11:24 +05:30
Sebastian Dröge b87ffa17bb Run rustfmt also over all the generated code 2019-06-18 13:12:00 +03:00
Sebastian Dröge e5aa6f59f9 Regenerate everything 2019-06-18 13:10:46 +03:00
Guillaume Desmottes c3ccec67eb video: turn VIDEO_MAX_PLANES to an usize
More convenient to use.
2019-06-18 13:30:59 +05:30
Guillaume Desmottes 840d1847a1 video: add VIDEO_MAX_PLANES constant 2019-06-18 10:57:58 +05:30
Guillaume Desmottes 491eaf3a73 video: VideoInfo: implement align() 2019-06-18 09:38:43 +05:30
Sebastian Dröge d1e562b9f6 Explicitly add dyn keyword to trait objects
Trait objects without are deprecated with the latest nightly and this
makes it more clear that we're doing dynamic dispatch anyway.
2019-06-06 09:09:34 +03:00
Sebastian Dröge d44c293753 Use TryFrom/TryInto traits where it makes sense instead of our previous ad-hoc solutions 2019-06-03 18:42:34 +03:00
Sebastian Dröge e5d0afee02 video: Add pack/unpack func bindings 2019-05-28 09:26:44 +02:00
Sebastian Dröge 4798b4bcc9 video: Don't require the input buffers of the video codec frames to be writable 2019-05-25 14:13:06 +02:00
Sebastian Dröge bc082ba56c video: Don't unref video codec state in set_format() 2019-05-25 13:02:41 +02:00
Sebastian Dröge be9434e029 video: Add finish() virtual function for video encoder/decoder 2019-05-25 11:25:56 +02:00
Sebastian Dröge 7a0bc76668 video: Add VideoEncoder bindings
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/160
2019-05-25 10:11:06 +02:00
Vivia Nikolaidou 4a8e860a9e gstreamer-video: Expose VideoBufferPool
Closes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/12
2019-05-24 10:32:57 +00:00
Sebastian Dröge 6cef32a4dd Change various mini object references to references to the refcounted object
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/204
2019-05-24 10:04:16 +00:00
Guillaume Desmottes c766f16403 video: add GST_BUFFER_POOL_OPTION_VIDEO_*_META constants 2019-05-23 15:10:42 +02:00
Guillaume Desmottes 47121fe9d6 gstreamer-video: VideoDecoder bindings
The VideoCodecFrame and VideoCodecState is C API is unfortunatelly unsafe
by design. So we workarounded it by ensuring the decoder stream lock was
hold while user has a writable reference on those objects.

Based on previous work from Thibault Saunier and Philippe Normand.

Fixes #161
2019-05-22 20:40:57 +00:00
Víctor Manuel Jáquez Leal 32d7f42d67 Remove unused extern crates
Latest versions of nightly rust compiler can detect unused extern
crates, and this commit removes those marked as unused.
2019-05-17 09:34:46 +00:00
Sebastian Dröge 6071c68ab6 video: Add support for VideoCaptionMeta 2019-05-16 00:35:19 +03:00