From 11eaf019b35b185ff0631551629e63edd661ae50 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 12 Dec 2015 20:05:26 -0300 Subject: [PATCH] ability to get video player texture --- scene/gui/video_player.cpp | 9 +++++++++ scene/gui/video_player.h | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index d99da5e906d..22b19f50b23 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -338,6 +338,13 @@ float VideoPlayer::get_stream_pos() const { return playback->get_pos(); }; +Ref VideoPlayer::get_video_texture() { + + if (playback.is_valid()) + return playback->get_texture(); + + return Ref (); +} void VideoPlayer::set_autoplay(bool p_enable) { @@ -384,6 +391,8 @@ void VideoPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_buffering_msec","msec"),&VideoPlayer::set_buffering_msec); ObjectTypeDB::bind_method(_MD("get_buffering_msec"),&VideoPlayer::get_buffering_msec); + ObjectTypeDB::bind_method(_MD("get_video_texutre:Texture"), &VideoPlayer::get_video_texture ); + ADD_PROPERTY( PropertyInfo(Variant::INT, "stream/audio_track",PROPERTY_HINT_RANGE,"0,128,1"), _SCS("set_audio_track"), _SCS("get_audio_track") ); ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream/stream", PROPERTY_HINT_RESOURCE_TYPE,"VideoStream"), _SCS("set_stream"), _SCS("get_stream") ); // ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") ); diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h index c485e3d6b63..b14d3936b9e 100644 --- a/scene/gui/video_player.h +++ b/scene/gui/video_player.h @@ -88,6 +88,8 @@ public: bool has_expand() const; + Ref get_video_texture(); + void set_stream(const Ref &p_stream); Ref get_stream() const; @@ -110,8 +112,8 @@ public: void set_autoplay(bool p_vol); bool has_autoplay() const; - void set_audio_track(int p_track); - int get_audio_track() const; + void set_audio_track(int p_track); + int get_audio_track() const; void set_buffering_msec(int p_msec); int get_buffering_msec() const;