video_stream.h
1 /*************************************************************************/
2 /* video_stream.h */
3 /*************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* http://www.godotengine.org */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
9 /* */
10 /* Permission is hereby granted, free of charge, to any person obtaining */
11 /* a copy of this software and associated documentation files (the */
12 /* "Software"), to deal in the Software without restriction, including */
13 /* without limitation the rights to use, copy, modify, merge, publish, */
14 /* distribute, sublicense, and/or sell copies of the Software, and to */
15 /* permit persons to whom the Software is furnished to do so, subject to */
16 /* the following conditions: */
17 /* */
18 /* The above copyright notice and this permission notice shall be */
19 /* included in all copies or substantial portions of the Software. */
20 /* */
21 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
22 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
23 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
25 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
26 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
27 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
28 /*************************************************************************/
29 #ifndef VIDEO_STREAM_H
30 #define VIDEO_STREAM_H
31 
32 #include "audio_stream_resampled.h"
33 #include "scene/resources/texture.h"
34 
35 
36 class VideoStreamPlayback : public Resource {
37 
38  OBJ_TYPE(VideoStreamPlayback,Resource);
39 
40 protected:
41  static void _bind_methods();
42 
43 public:
44 
45  typedef int (*AudioMixCallback)(void* p_udata,const int16_t *p_data,int p_frames);
46 
47  virtual void stop()=0;
48  virtual void play()=0;
49 
50  virtual bool is_playing() const=0;
51 
52  virtual void set_paused(bool p_paused)=0;
53  virtual bool is_paused(bool p_paused) const=0;
54 
55  virtual void set_loop(bool p_enable)=0;
56  virtual bool has_loop() const=0;
57 
58  virtual float get_length() const=0;
59 
60  virtual float get_pos() const=0;
61  virtual void seek_pos(float p_time)=0;
62 
63  virtual void set_audio_track(int p_idx) =0;
64 
65  //virtual int mix(int16_t* p_bufer,int p_frames)=0;
66 
67  virtual Ref<Texture> get_texture()=0;
68  virtual void update(float p_delta)=0;
69 
70  virtual void set_mix_callback(AudioMixCallback p_callback,void *p_userdata)=0;
71  virtual int get_channels() const=0;
72  virtual int get_mix_rate() const=0;
73 
75 };
76 
77 
78 class VideoStream : public Resource {
79 
80  OBJ_TYPE( VideoStream, Resource );
81  OBJ_SAVE_TYPE( VideoStream ); //children are all saved as AudioStream, so they can be exchanged
82 
83 public:
84 
85  virtual void set_audio_track(int p_track)=0;
86  virtual Ref<VideoStreamPlayback> instance_playback()=0;
87 
88  VideoStream() {}
89 };
90 
91 
92 #endif
93 
Definition: video_stream.h:78
Definition: resource.h:89
Definition: video_stream.h:36