diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/video_stream.cpp | 8 | ||||
-rw-r--r-- | scene/resources/video_stream.h | 36 |
2 files changed, 30 insertions, 14 deletions
diff --git a/scene/resources/video_stream.cpp b/scene/resources/video_stream.cpp index b27413bb68..c957fd4c67 100644 --- a/scene/resources/video_stream.cpp +++ b/scene/resources/video_stream.cpp @@ -28,16 +28,12 @@ /*************************************************************************/ #include "video_stream.h" -void VideoStream::_bind_methods() { +void VideoStreamPlayback::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_pending_frame_count"),&VideoStream::get_pending_frame_count); - ObjectTypeDB::bind_method(_MD("pop_frame"),&VideoStream::pop_frame); - ObjectTypeDB::bind_method(_MD("peek_frame"),&VideoStream::peek_frame); - ObjectTypeDB::bind_method(_MD("set_audio_track","idx"),&VideoStream::set_audio_track); }; -VideoStream::VideoStream() { +VideoStreamPlayback::VideoStreamPlayback() { }; diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h index 2ad7457ec4..a23ef0c64f 100644 --- a/scene/resources/video_stream.h +++ b/scene/resources/video_stream.h @@ -33,15 +33,17 @@ #include "scene/resources/texture.h" -class VideoStream : public Resource { +class VideoStreamPlayback : public Resource { - OBJ_TYPE(VideoStream,Resource); + OBJ_TYPE(VideoStreamPlayback,Resource); protected: static void _bind_methods(); public: + typedef int (*AudioMixCallback)(void* p_udata,const int16_t *p_data,int p_frames); + virtual void stop()=0; virtual void play()=0; @@ -58,16 +60,34 @@ public: virtual float get_pos() const=0; virtual void seek_pos(float p_time)=0; - virtual int get_pending_frame_count() const=0; - virtual void pop_frame(Ref<ImageTexture> p_tex)=0; - virtual Image peek_frame() const=0; - virtual void set_audio_track(int p_idx) =0; - virtual void update(float p_time)=0; + //virtual int mix(int16_t* p_bufer,int p_frames)=0; + + virtual Ref<Texture> get_texture()=0; + virtual void update(float p_delta)=0; - VideoStream(); + virtual void set_mix_callback(AudioMixCallback p_callback,void *p_userdata)=0; + virtual int get_channels() const=0; + virtual int get_mix_rate() const=0; + + VideoStreamPlayback(); }; + +class VideoStream : public Resource { + + OBJ_TYPE( VideoStream, Resource ); + OBJ_SAVE_TYPE( VideoStream ); //children are all saved as AudioStream, so they can be exchanged + +public: + + virtual void set_audio_track(int p_track)=0; + virtual Ref<VideoStreamPlayback> instance_playback()=0; + + VideoStream() {} +}; + + #endif |