forked from mirrors/gstreamer-rs
Fix Player constructor on GStreamer 1.12 if a video renderer or signal dispatcher are given
This commit is contained in:
parent
b4cb81cd56
commit
150527f779
1 changed files with 4 additions and 5 deletions
|
@ -19,17 +19,16 @@ impl Player {
|
|||
signal_dispatcher: Option<&PlayerSignalDispatcher>,
|
||||
) -> Player {
|
||||
assert_initialized_main_thread!();
|
||||
let video_renderer = video_renderer.to_glib_full();
|
||||
let signal_dispatcher = signal_dispatcher.to_glib_full();
|
||||
|
||||
let (major, minor, _, _) = gst::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
let video_renderer = video_renderer.to_glib_full();
|
||||
let signal_dispatcher = signal_dispatcher.to_glib_full();
|
||||
unsafe { from_glib_full(ffi::gst_player_new(video_renderer, signal_dispatcher)) }
|
||||
} else {
|
||||
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 in
|
||||
// https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/gst-libs/gst/player/gstplayer.c?id=634cd87c76f58b5e1383715bafd5614db825c7d1
|
||||
let video_renderer = video_renderer.to_glib_none();
|
||||
let signal_dispatcher = signal_dispatcher.to_glib_none();
|
||||
unsafe { from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) }
|
||||
unsafe { from_glib_none(ffi::gst_player_new(video_renderer, signal_dispatcher)) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue