WIP: PlaybackController can now push frames to the Viewer
This commit is contained in:
parent
ebe91793c5
commit
9197aa2ddf
7 changed files with 51 additions and 3 deletions
|
|
@ -29,7 +29,13 @@ namespace controller {
|
|||
void
|
||||
PlaybackController::play()
|
||||
{
|
||||
g_message("Play");
|
||||
pull_frame();
|
||||
}
|
||||
|
||||
void
|
||||
PlaybackController::attach_viewer(const sigc::slot<void, void*>& on_frame)
|
||||
{
|
||||
frame_signal.connect(on_frame);
|
||||
}
|
||||
|
||||
void PlaybackController::playback_thread()
|
||||
|
|
@ -39,7 +45,12 @@ void PlaybackController::playback_thread()
|
|||
|
||||
void PlaybackController::pull_frame()
|
||||
{
|
||||
unsigned char buffer[320 * 240 * 4];
|
||||
|
||||
for(int i = 0; i < 320*240*4; i++)
|
||||
buffer[i] = rand();
|
||||
|
||||
frame_signal.emit(buffer);
|
||||
}
|
||||
|
||||
} // namespace controller
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
** This file contains the definition of the playback controller object
|
||||
*/
|
||||
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#ifndef PLAYBACK_CONTROLLER_HPP
|
||||
#define PLAYBACK_CONTROLLER_HPP
|
||||
|
||||
|
|
@ -34,12 +36,17 @@ class PlaybackController
|
|||
public:
|
||||
|
||||
void play();
|
||||
|
||||
void attach_viewer(const sigc::slot<void, void*>& on_frame);
|
||||
|
||||
private:
|
||||
|
||||
void playback_thread();
|
||||
|
||||
void pull_frame();
|
||||
|
||||
private:
|
||||
sigc::signal<void, void*> frame_signal;
|
||||
};
|
||||
|
||||
} // namespace controller
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "lib/util.hpp"
|
||||
#include "backend/thread-wrapper.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <gavl/gavltime.h>
|
||||
|
|
|
|||
|
|
@ -23,8 +23,13 @@
|
|||
#include "../gtk-lumiera.hpp"
|
||||
#include "viewer-panel.hpp"
|
||||
|
||||
using namespace gui::widgets;
|
||||
#include "../workspace/workspace-window.hpp"
|
||||
#include "../controller/controller.hpp"
|
||||
#include "../controller/playback-controller.hpp"
|
||||
|
||||
using namespace Gtk;
|
||||
using namespace gui::widgets;
|
||||
using namespace gui::controller;
|
||||
|
||||
namespace gui {
|
||||
namespace panels {
|
||||
|
|
@ -34,6 +39,20 @@ ViewerPanel::ViewerPanel(workspace::WorkspaceWindow &workspace_window) :
|
|||
{
|
||||
//----- Pack in the Widgets -----//
|
||||
pack_start(display, PACK_EXPAND_WIDGET);
|
||||
|
||||
PlaybackController &playback =
|
||||
workspace_window.get_controller().get_playback_controller();
|
||||
|
||||
playback.attach_viewer(sigc::mem_fun(this, &ViewerPanel::on_frame));
|
||||
}
|
||||
|
||||
void
|
||||
ViewerPanel::on_frame(void *buffer)
|
||||
{
|
||||
Displayer *displayer = display.get_displayer();
|
||||
REQUIRE(displayer);
|
||||
|
||||
displayer->put(buffer);
|
||||
}
|
||||
|
||||
} // namespace panels
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public:
|
|||
* @param workspace_window The window that owns this panel.
|
||||
**/
|
||||
ViewerPanel(workspace::WorkspaceWindow &owner_window);
|
||||
|
||||
protected:
|
||||
|
||||
void on_frame(void *buffer);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ VideoDisplayWidget::~VideoDisplayWidget()
|
|||
delete displayer;
|
||||
}
|
||||
|
||||
Displayer*
|
||||
VideoDisplayWidget::get_displayer() const
|
||||
{
|
||||
return displayer;
|
||||
}
|
||||
|
||||
void
|
||||
VideoDisplayWidget::on_realize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ public:
|
|||
VideoDisplayWidget();
|
||||
|
||||
~VideoDisplayWidget();
|
||||
|
||||
Displayer* get_displayer() const;
|
||||
|
||||
/* ===== Overrides ===== */
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue