summaryrefslogtreecommitdiff
path: root/drivers/theoraplayer
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-11-02 11:31:01 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-11-02 11:31:01 -0300
commitd85b67be53bac252c0a28b799d56d1b359c4ee99 (patch)
tree5227e145e3271bfee542bdd3e4237c3378565306 /drivers/theoraplayer
parent738eb2c1a88d441eacc4149ce8f1c12a90267191 (diff)
Bug Fixes
-=-=-=-=- -Fixed problem with scaling shapes (#827), related to not taking scale in consideration for calculating the moment of inertia -Added support for multiline strings (or comments) using """ -Save subscene bug, properties not being saved in root node (#806) -Fix Crash in CollisionPolygon2DEditor (#814) -Restored Ability to compile without 3D (#795) -Fix InterpolatedCamera (#803) -Fix UV Import for OBJ Meshes (#771) -Fixed issue with modifier gizmos (#794) -Fixed CapsuleShape gizmo handle (#50) -Fixed Import Button (not properly working in 3D) (#733) -Many misc fixes (though no new features)
Diffstat (limited to 'drivers/theoraplayer')
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.cpp36
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.h5
2 files changed, 30 insertions, 11 deletions
diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp
index b2ff8062cc..04210f0209 100644
--- a/drivers/theoraplayer/video_stream_theoraplayer.cpp
+++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp
@@ -306,18 +306,28 @@ int VideoStreamTheoraplayer::get_pending_frame_count() const {
if (!clip)
return 0;
- if (!frame.empty())
- return 1;
+ TheoraVideoFrame* f = clip->getNextFrame();
+ return f ? 1 : 0;
+};
+
+
+void VideoStreamTheoraplayer::pop_frame(Ref<ImageTexture> p_tex) {
TheoraVideoFrame* f = clip->getNextFrame();
- if (!f)
- return 0;
+ if (!f) {
+ return;
+ };
+
+#ifdef GLES2_ENABLED
+// RasterizerGLES2* r = RasterizerGLES2::get_singleton();
+// r->_texture_set_data(p_tex, f->mBpp == 3 ? Image::Format_RGB : Image::Format_RGBA, f->mBpp, w, h, f->getBuffer());
+
+#endif
float w=clip->getWidth(),h=clip->getHeight();
int imgsize = w * h * f->mBpp;
int size = f->getStride() * f->getHeight() * f->mBpp;
- DVector<uint8_t> data;
data.resize(imgsize);
DVector<uint8_t>::Write wr = data.write();
uint8_t* ptr = wr.ptr();
@@ -329,24 +339,32 @@ int VideoStreamTheoraplayer::get_pending_frame_count() const {
copymem(ptr + dstofs, f->getBuffer() + dstofs, w * f->mBpp);
};
*/
- frame = Image();
+ Image frame = Image();
frame.create(w, h, 0, f->mBpp == 3 ? Image::FORMAT_RGB : Image::FORMAT_RGBA, data);
clip->popFrame();
- return 1;
+ if (p_tex->get_width() == 0) {
+ p_tex->create(frame.get_width(),frame.get_height(),frame.get_format(),Texture::FLAG_VIDEO_SURFACE|Texture::FLAG_FILTER);
+ p_tex->set_data(frame);
+ } else {
+
+ p_tex->set_data(frame);
+ };
};
+/*
Image VideoStreamTheoraplayer::pop_frame() {
Image ret = frame;
frame = Image();
return ret;
};
+*/
Image VideoStreamTheoraplayer::peek_frame() const {
- return frame;
+ return Image();
};
void VideoStreamTheoraplayer::update(float p_time) {
@@ -386,7 +404,7 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) {
if (p_file.find(".mp4") != -1) {
std::string file = p_file.replace("res://", "").utf8().get_data();
- clip = mgr->createVideoClip(file);
+ clip = mgr->createVideoClip(file, TH_BGRX, 16);
memdelete(f);
} else {
diff --git a/drivers/theoraplayer/video_stream_theoraplayer.h b/drivers/theoraplayer/video_stream_theoraplayer.h
index 063bf38953..67a2db710b 100644
--- a/drivers/theoraplayer/video_stream_theoraplayer.h
+++ b/drivers/theoraplayer/video_stream_theoraplayer.h
@@ -3,6 +3,7 @@
#include "scene/resources/video_stream.h"
#include "io/resource_loader.h"
+#include "scene/resources/texture.h"
class TheoraVideoManager;
class TheoraVideoClip;
@@ -11,7 +12,7 @@ class VideoStreamTheoraplayer : public VideoStream {
OBJ_TYPE(VideoStreamTheoraplayer,VideoStream);
- mutable Image frame;
+ mutable DVector<uint8_t> data;
TheoraVideoManager* mgr;
TheoraVideoClip* clip;
bool started;
@@ -37,7 +38,7 @@ public:
virtual float get_length() const;
virtual int get_pending_frame_count() const;
- virtual Image pop_frame();
+ virtual void pop_frame(Ref<ImageTexture> p_tex);
virtual Image peek_frame() const;
void update(float p_time);