ability to get video player texture

This commit is contained in:
Juan Linietsky 2015-12-12 20:05:26 -03:00
parent bbb2a863f9
commit 11eaf019b3
2 changed files with 13 additions and 2 deletions

View File

@ -338,6 +338,13 @@ float VideoPlayer::get_stream_pos() const {
return playback->get_pos();
};
Ref<Texture> VideoPlayer::get_video_texture() {
if (playback.is_valid())
return playback->get_texture();
return Ref<Texture> ();
}
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") );

View File

@ -88,6 +88,8 @@ public:
bool has_expand() const;
Ref<Texture> get_video_texture();
void set_stream(const Ref<VideoStream> &p_stream);
Ref<VideoStream> 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;