diff options
Diffstat (limited to 'drivers/theoraplayer')
-rw-r--r-- | drivers/theoraplayer/SCsub | 14 | ||||
-rw-r--r-- | drivers/theoraplayer/video_stream_theoraplayer.cpp | 15 |
2 files changed, 25 insertions, 4 deletions
diff --git a/drivers/theoraplayer/SCsub b/drivers/theoraplayer/SCsub index 023b2c928b..979ff2ed1b 100644 --- a/drivers/theoraplayer/SCsub +++ b/drivers/theoraplayer/SCsub @@ -59,7 +59,6 @@ src/YUV/C/yuv420_grey_c.c src/YUV/C/yuv420_yuv_c.c src/YUV/C/yuv420_rgb_c.c src/TheoraVideoFrame.cpp -video_stream_theoraplayer.cpp """) if env["platform"] == "iphone": @@ -79,7 +78,18 @@ if env["platform"] == "android": env_theora.Append(CPPPATH=["#drivers/theoraplayer/include/theoraplayer", "#drivers/theoraplayer/src/YUV", "#drivers/theoraplayer/src/YUV/libyuv/include", "#drivers/theoraplayer/src/Theora", "#drivers/theoraplayer/src/AVFoundation"]) objs = [] -env_theora.add_source_files(objs, sources) + +env_theora.add_source_files(objs, ["video_stream_theoraplayer.cpp"]) + +if env['use_theoraplayer_binary'] == "yes": + if env["platform"] == "iphone": + env.Append(LIBPATH=['#drivers/theoraplayer/lib/ios']) + env.Append(LIBS=['theoraplayer', 'ogg', 'theora', 'tremor']) + if env["platform"] == "windows": + env.Append(LIBPATH=['#drivers/theoraplayer/lib/windows']) + env.Append(LINKFLAGS=['libtheoraplayer_static.lib', 'libogg.lib', 'libtheora.lib', 'libvorbis.lib']) +else: + env_theora.add_source_files(objs, sources) env.drivers_sources += objs diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp index 12ef5de88f..b2ff8062cc 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.cpp +++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp @@ -86,12 +86,18 @@ public: return fa->get_pos(); }; - TPDataFA(String p_path) { + TPDataFA(const String& p_path) { fa = FileAccess::open(p_path, FileAccess::READ); data_name = "File: " + p_path; }; + TPDataFA(FileAccess* p_fa, const String& p_path) { + + fa = p_fa; + data_name = "File: " + p_path; + }; + ~TPDataFA() { if (fa) @@ -366,6 +372,10 @@ void VideoStreamTheoraplayer::update(float p_time) { void VideoStreamTheoraplayer::set_file(const String& p_file) { + FileAccess* f = FileAccess::open(p_file, FileAccess::READ); + if (!f || !f->is_open()) + return; + if (!audio_factory) { audio_factory = memnew(TPAudioGodotFactory); }; @@ -377,10 +387,11 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) { std::string file = p_file.replace("res://", "").utf8().get_data(); clip = mgr->createVideoClip(file); + memdelete(f); } else { - TheoraDataSource* ds = memnew(TPDataFA(p_file)); + TheoraDataSource* ds = memnew(TPDataFA(f, p_file)); try { clip = mgr->createVideoClip(ds); |