Commit graph

190 commits

Author SHA1 Message Date
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