Commit graph

197 commits

Author SHA1 Message Date
Sebastian Dröge ed0f1140b8 video: Don't unmap VideoFrameRefs that are just borrowed 2020-06-08 12:23:20 +03:00
Sebastian Dröge 997dad0f11 video: Check that the passed in video info is valid when creating a VideoFrame 2020-06-08 12:23:20 +03:00
Sebastian Dröge de0f228075 video: Add VideoInfo::is_valid() and guard against finfo being NULL when retrieving the video format 2020-06-08 12:23:20 +03:00
Sebastian Dröge 0feadec9fe video: Add VideoAffineTransformationMeta, CropMeta and RegionOfInterestMeta
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/218
2020-06-08 12:23:20 +03:00
Sebastian Dröge 8e96888c63 video/videoconverter: Add TryFrom<Structure> and inverse From impl for VideoConverterConfig
Allows converting between both types interchangebly.
2020-05-27 15:24:08 +03:00
Mathieu Duponchelle 487970f620 gstreamer-video: expose caps features 2020-05-27 15:24:08 +03:00
Sebastian Dröge 12063ec83a video: Add bindings for guess_framerate() 2020-05-27 14:51:21 +03:00
Sebastian Dröge c35a7caf42 video: Add bindings for calculate_display_ratio() 2020-05-27 14:51:21 +03:00
Sebastian Dröge 215dbe53c6 video: Assert if caption data passed when adding caption metas is empty
It will cause a critical warning otherwise.
2020-05-27 14:51:21 +03:00
Sebastian Dröge 451c198cec Run everything through cargo fmt again 2020-04-30 11:01:25 +03:00
Sebastian Dröge 5479b23eb9 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-30 10:56:38 +03:00
Sebastian Dröge 462f4ac3b8 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-15 10:15:03 +01:00
Sebastian Dröge 605d4fbf24 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-15 10:14:22 +01:00
Sebastian Dröge ea38e022be video: Add VideoConverter bindings 2020-02-15 10:11:41 +01:00
Sebastian Dröge 23fdd2c5ad video: Autogenerate bindings for a few more enums 2020-02-15 10:11:35 +01:00
Sebastian Dröge 3ae8b48400 video/video-frame: Implement immutable frame functions more generically 2020-02-15 10:11:25 +01:00
Sebastian Dröge 5577e8a457 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 22:31:10 +02:00
Sebastian Dröge fedf4b664a Fix various new clippy warnings from 1.40 2019-12-23 13:40:58 +02:00
Sebastian Dröge d2e508eca1 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:15:34 +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