From 6dd5a7917757d647f29841004ffccaaed4bb9211 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Wed, 22 Jan 2014 01:08:14 -0600 Subject: [PATCH] Added an experimental DrawFrameOnScene method, which takes a raw pointer (as a long) from PyQt5 (i.e. unwrapped by sip), and draws a QBitmap on it. --- include/ReaderBase.h | 8 ++++++++ src/CMakeLists.txt | 3 ++- src/ReaderBase.cpp | 13 +++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/ReaderBase.h b/include/ReaderBase.h index 4251de48..5a2ac7d0 100644 --- a/include/ReaderBase.h +++ b/include/ReaderBase.h @@ -35,6 +35,11 @@ #include "Fraction.h" #include "Frame.h" #include "Json.h" +#include +#include +#include +#include +#include using namespace std; @@ -101,6 +106,9 @@ namespace openshot /// @param[in] number The frame number that is requested. virtual tr1::shared_ptr GetFrame(int number) = 0; + /// Test method to draw a bitmap on a Qt QGraphicsScene + void DrawFrameOnScene(string path, long _graphics_scene_address); + /// Initialize the values of the ReaderInfo struct. It is important for derived classes to call /// this method, or the ReaderInfo struct values will not be initialized. void InitFileInfo(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8ff59222..65132254 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -243,7 +243,7 @@ ENDIF (BLACKMAGIC_FOUND) FIND_PACKAGE(SWIG 2.0 REQUIRED) INCLUDE(${SWIG_USE_FILE}) -FIND_PACKAGE(PythonLibs) +FIND_PACKAGE(PythonLibs REQUIRED) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) @@ -261,6 +261,7 @@ INSTALL(TARGETS openshot DESTINATION lib) # Install Swig python library INSTALL(TARGETS _openshot DESTINATION share/pyshared/libopenshot) +INSTALL(TARGETS openshot DESTINATION share/pyshared/libopenshot) # Install Python bindings INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/openshot.py DESTINATION share/pyshared/libopenshot) diff --git a/src/ReaderBase.cpp b/src/ReaderBase.cpp index fbb38be4..ba84a21a 100644 --- a/src/ReaderBase.cpp +++ b/src/ReaderBase.cpp @@ -204,3 +204,16 @@ void ReaderBase::SetJsonValue(Json::Value root) { info.audio_timebase.den = root["audio_timebase"]["den"].asInt(); } } + +// Test method to draw a bitmap on a Qt QGraphicsScene +void ReaderBase::DrawFrameOnScene(string path, long _graphics_scene_address) { + + // Get pixmap + QGraphicsScene *scene = reinterpret_cast(_graphics_scene_address); + QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap(QString(path.c_str()))); + scene->addItem(item); + +} + + +