aboutsummaryrefslogtreecommitdiff
path: root/drivers/theoraplayer/video_stream_theoraplayer.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2014-11-02 11:31:01 -0300
committerJuan Linietsky2014-11-02 11:31:01 -0300
commitd85b67be53bac252c0a28b799d56d1b359c4ee99 (patch)
tree5227e145e3271bfee542bdd3e4237c3378565306 /drivers/theoraplayer/video_stream_theoraplayer.cpp
parent738eb2c1a88d441eacc4149ce8f1c12a90267191 (diff)
downloadgodot-d85b67be53bac252c0a28b799d56d1b359c4ee99.tar.gz
godot-d85b67be53bac252c0a28b799d56d1b359c4ee99.tar.zst
godot-d85b67be53bac252c0a28b799d56d1b359c4ee99.zip
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/video_stream_theoraplayer.cpp')
-rw-r--r--drivers/theoraplayer/video_stream_theoraplayer.cpp36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp
index b2ff8062c..04210f020 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 {