diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-11-19 11:33:15 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-11-19 11:33:15 -0300 |
commit | e709468bb13e795cff72b3e87198c61c5b1a2ee7 (patch) | |
tree | 11d4a855259498bdaf10719199b506034a802536 /drivers | |
parent | d5cb758d36035fc35e960a466d0b370ff19e4f76 (diff) |
missing navmesh demo and small fixes
Diffstat (limited to 'drivers')
4 files changed, 33 insertions, 8 deletions
diff --git a/drivers/theoraplayer/SCsub b/drivers/theoraplayer/SCsub index 979ff2ed1b..d4218debb6 100644 --- a/drivers/theoraplayer/SCsub +++ b/drivers/theoraplayer/SCsub @@ -67,10 +67,13 @@ if env["platform"] == "iphone": env_theora = env.Clone() -env_theora.Append(CPPFLAGS=["-D_YUV_C", "-D__THEORA", "-D_LIB"]) +env_theora.Append(CPPFLAGS=["-D_YUV_C", "-D_LIB", "-D__THEORA"]) if env["platform"] == "iphone": env_theora.Append(CPPFLAGS=["-D__AVFOUNDATION"]) +else: + pass + #env_theora.Append(CPPFLAGS=["-D__FFMPEG"]) if env["platform"] == "android": env_theora.Append(CPPFLAGS=["-D_ANDROID"]) diff --git a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm b/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm index 72e3dfc9fa..1b5cf0ab13 100644 --- a/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm +++ b/drivers/theoraplayer/src/AVFoundation/TheoraVideoClip_AVFoundation.mm @@ -271,6 +271,8 @@ void TheoraVideoClip_AVFoundation::load(TheoraDataSource* source) AVAssetTrack *videoTrack = [tracks objectAtIndex:0]; NSArray* audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio]; + if (audio_track >= audioTracks.count) + audio_track = 0; AVAssetTrack *audioTrack = audioTracks.count > 0 ? [audioTracks objectAtIndex:audio_track] : NULL; printf("*********** using audio track %i\n", audio_track); diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp index 643899aaed..62dee1336a 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.cpp +++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp @@ -122,6 +122,7 @@ class AudioStreamInput : public AudioStreamResampled { int rb_power; int total_wrote; bool playing; + bool paused; public: @@ -133,6 +134,7 @@ public: AudioServer::get_singleton()->stream_set_active(stream_rid,true); AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,1); playing = true; + paused = false; }; virtual void stop() { @@ -146,8 +148,8 @@ public: virtual bool is_playing() const { return true; }; - virtual void set_paused(bool p_paused) {}; - virtual bool is_paused(bool p_paused) const { return false; }; + virtual void set_paused(bool p_paused) { paused = p_paused; }; + virtual bool is_paused(bool p_paused) const { return paused; }; virtual void set_loop(bool p_enable) {}; virtual bool has_loop() const { return false; }; @@ -209,6 +211,7 @@ public: AudioStreamInput(int p_channels, int p_freq) { playing = false; + paused = true; channels = p_channels; freq = p_freq; total_wrote = 0; @@ -285,12 +288,12 @@ void VideoStreamTheoraplayer::stop() { clip->stop(); clip->seek(0); }; + started = true; }; void VideoStreamTheoraplayer::play() { - - playing = true; - started = true; + if (clip) + playing = true; }; bool VideoStreamTheoraplayer::is_playing() const { @@ -300,7 +303,13 @@ bool VideoStreamTheoraplayer::is_playing() const { void VideoStreamTheoraplayer::set_paused(bool p_paused) { - playing = false; + paused = p_paused; + if (paused) { + clip->pause(); + } else { + if (clip && playing && !started) + clip->play(); + } }; bool VideoStreamTheoraplayer::is_paused(bool p_paused) const { @@ -355,6 +364,9 @@ int VideoStreamTheoraplayer::get_pending_frame_count() const { void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) { + if (!clip) + return; + TheoraVideoFrame* f = clip->getNextFrame(); if (!f) { return; @@ -374,7 +386,7 @@ void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) { { DVector<uint8_t>::Write wr = data.write(); uint8_t* ptr = wr.ptr(); - memcpy(ptr, f->getBuffer(), imgsize); + copymem(ptr, f->getBuffer(), imgsize); } /* for (int i=0; i<h; i++) { @@ -416,6 +428,12 @@ void VideoStreamTheoraplayer::update(float p_time) { if (!mgr) return; + if (!clip) + return; + + if (!playing || paused) + return; + //printf("video update!\n"); if (started) { if (clip->getNumReadyFrames() < 2) { @@ -499,6 +517,7 @@ VideoStreamTheoraplayer::VideoStreamTheoraplayer() { clip = NULL; started = false; playing = false; + paused = false; loop = false; audio_track=0; }; diff --git a/drivers/theoraplayer/video_stream_theoraplayer.h b/drivers/theoraplayer/video_stream_theoraplayer.h index f926dfdaf5..d43c12609f 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.h +++ b/drivers/theoraplayer/video_stream_theoraplayer.h @@ -17,6 +17,7 @@ class VideoStreamTheoraplayer : public VideoStream { bool started; bool playing; bool loop; + bool paused; int audio_track; |