2008-04-14 23:51:59 +02:00
|
|
|
/*
|
2011-02-05 20:56:51 +01:00
|
|
|
VideoDisplayWidget - Implementation of the video viewer widget
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-04-14 23:51:59 +02:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-04-14 23:51:59 +02:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2008-04-14 23:51:59 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-04-14 23:51:59 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-04-14 23:51:59 +02:00
|
|
|
* *****************************************************/
|
|
|
|
|
|
2011-02-05 20:56:51 +01:00
|
|
|
|
2016-11-03 18:22:31 +01:00
|
|
|
/** @file video-display-widget.cpp
|
|
|
|
|
** TODO video-display-widget.cpp
|
2016-11-03 18:20:10 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2010-12-27 05:50:40 +01:00
|
|
|
#include "gui/gtk-lumiera.hpp"
|
|
|
|
|
#include "gui/output/xvdisplayer.hpp"
|
|
|
|
|
#include "gui/output/gdkdisplayer.hpp"
|
2008-05-12 14:02:14 +02:00
|
|
|
|
2008-04-19 21:47:53 +02:00
|
|
|
#include "video-display-widget.hpp"
|
2008-04-14 23:51:59 +02:00
|
|
|
|
|
|
|
|
namespace gui {
|
2015-05-29 04:44:58 +02:00
|
|
|
namespace widget {
|
2008-08-04 17:39:36 +02:00
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
VideoDisplayWidget::VideoDisplayWidget()
|
|
|
|
|
: displayer_(NULL)
|
2011-02-05 20:56:51 +01:00
|
|
|
{ }
|
2008-08-04 17:39:36 +02:00
|
|
|
|
2011-02-05 20:56:51 +01:00
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
VideoDisplayWidget::~VideoDisplayWidget()
|
2011-02-05 20:56:51 +01:00
|
|
|
{
|
2015-05-29 04:44:58 +02:00
|
|
|
if (displayer_) delete displayer_;
|
2011-02-05 20:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
|
2011-02-05 20:56:51 +01:00
|
|
|
Displayer*
|
2015-05-29 04:44:58 +02:00
|
|
|
VideoDisplayWidget::getDisplayer() const
|
2011-02-05 20:56:51 +01:00
|
|
|
{
|
2015-05-29 04:44:58 +02:00
|
|
|
return displayer_;
|
2011-02-05 20:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
VideoDisplayWidget::on_realize()
|
2011-02-05 20:56:51 +01:00
|
|
|
{
|
2015-05-29 04:44:58 +02:00
|
|
|
// invoke base implementation
|
2011-02-05 20:56:51 +01:00
|
|
|
Gtk::Widget::on_realize ();
|
|
|
|
|
|
|
|
|
|
// Set colours
|
2012-08-12 11:16:48 +02:00
|
|
|
//modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("black"));
|
2011-02-05 20:56:51 +01:00
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
if (displayer_) delete displayer_;
|
|
|
|
|
displayer_ = createDisplayer (this, 320, 240);
|
2011-02-05 20:56:51 +01:00
|
|
|
|
|
|
|
|
add_events (Gdk::ALL_EVENTS_MASK);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
|
2011-02-05 20:56:51 +01:00
|
|
|
Displayer*
|
|
|
|
|
VideoDisplayWidget::createDisplayer (Gtk::Widget *drawingArea, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
REQUIRE (drawingArea != NULL);
|
|
|
|
|
REQUIRE (width > 0 && height > 0);
|
|
|
|
|
|
|
|
|
|
Displayer *displayer = NULL;
|
|
|
|
|
|
|
|
|
|
displayer = new XvDisplayer (drawingArea, width, height);
|
2015-05-29 04:44:58 +02:00
|
|
|
if (!displayer->usable())
|
2011-02-05 20:56:51 +01:00
|
|
|
{
|
|
|
|
|
delete displayer;
|
|
|
|
|
displayer = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
if (!displayer)
|
2011-02-05 20:56:51 +01:00
|
|
|
{
|
|
|
|
|
displayer = new GdkDisplayer (drawingArea, width, height);
|
2014-10-05 09:32:06 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
|
2011-02-05 20:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return displayer;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-29 04:44:58 +02:00
|
|
|
|
|
|
|
|
}}// gui::widget
|