summaryrefslogtreecommitdiff
path: root/drivers/theora/video_stream_theora.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-05 23:16:41 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-05 23:16:41 -0300
commitfe2a9bc746df86510391435f89eb10f6e0eddec4 (patch)
tree75818ca9c2e54b88c0641515bfa57626a023fa2c /drivers/theora/video_stream_theora.h
parent3ecc9e07b7650725c8786d6af7c5f77ab6d94cc2 (diff)
optional streaming from thread for Theora
Diffstat (limited to 'drivers/theora/video_stream_theora.h')
-rw-r--r--drivers/theora/video_stream_theora.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h
index 5540f050f9..3d88ba4e4b 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/drivers/theora/video_stream_theora.h
@@ -6,9 +6,13 @@
#include "theora/theoradec.h"
#include "vorbis/codec.h"
#include "os/file_access.h"
-
+#include "ring_buffer.h"
#include "io/resource_loader.h"
#include "scene/resources/video_stream.h"
+#include "os/thread.h"
+#include "os/semaphore.h"
+
+//#define THEORA_USE_THREAD_STREAMING
class VideoStreamPlaybackTheora : public VideoStreamPlayback {
@@ -66,7 +70,25 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
AudioMixCallback mix_callback;
void* mix_udata;
- int audio_track;
+#ifdef THEORA_USE_THREAD_STREAMING
+
+ enum {
+ RB_SIZE_KB=1024
+ };
+
+ RingBuffer<uint8_t> ring_buffer;
+ Vector<uint8_t> read_buffer;
+ bool thread_eof;
+ Semaphore *thread_sem;
+ Thread *thread;
+ volatile bool thread_exit;
+
+ static void _streaming_thread(void *ud);
+
+#endif
+
+
+ int audio_track;
protected: