Lumiera  0.pre.03
»edit your freedom«
video-display-widget.cpp
Go to the documentation of this file.
1 /*
2  VideoDisplayWidget - Implementation of the video viewer widget
3 
4  Copyright (C)
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
21 #include "stage/gtk-base.hpp"
24 
25 #include "video-display-widget.hpp"
26 
27 namespace stage {
28 namespace widget {
29 
30  VideoDisplayWidget::VideoDisplayWidget()
31  : displayer_(NULL)
32  { }
33 
34 
35  VideoDisplayWidget::~VideoDisplayWidget()
36  {
37  if (displayer_) delete displayer_;
38  }
39 
40 
41  Displayer*
42  VideoDisplayWidget::getDisplayer() const
43  {
44  return displayer_;
45  }
46 
47 
48  void
49  VideoDisplayWidget::on_realize()
50  {
51  // invoke base implementation
52  Gtk::Widget::on_realize ();
53 
54  // Set colours
55  //modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("black"));
56 
57  if (displayer_) delete displayer_;
58  displayer_ = createDisplayer (this, 320, 240);
59 
60  add_events (Gdk::ALL_EVENTS_MASK);
61  }
62 
63 
64  Displayer*
65  VideoDisplayWidget::createDisplayer (Gtk::Widget *drawingArea, int width, int height)
66  {
67  REQUIRE (drawingArea != NULL);
68  REQUIRE (width > 0 && height > 0);
69 
70  Displayer *displayer = NULL;
71 
72  displayer = new XvDisplayer (drawingArea, width, height);
73  if (!displayer->usable())
74  {
75  delete displayer;
76  displayer = NULL;
77  }
78 
79  if (!displayer)
80  {
81  displayer = new GdkDisplayer (drawingArea, width, height);
83  }
84 
85  return displayer;
86  }
87 
88 
89 }}// stage::widget
Display video via GDK.
Widget to create a video display embedded into the UI.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
XvDisplayer is a class which is responsible for rendering a video image via XVideo.
Definition: xvdisplayer.hpp:53
virtual bool usable()
Indicates if this object can be used to render images on the running system.
Definition: displayer.cpp:38
A set of basic GTK includes for the UI.
Implementation of video output via XVideo.
A Displayer is a class which is responsible for rendering an image in some way (ie: Xvideo...
Definition: displayer.hpp:65
GdkDisplayer is a class which is responsible for rendering a video image via GDK. ...