XV-Display: re-implement fallback video display technique

In cases where none of the preferred, library based approaches works,
we can attempt to provide a ''poor man's video display'' by placing the
image data into a bitmap, which can be rendered by the UI toolkit.

The existing solution for such bitmap content is the GDK Pixmap.
But note, this approach is ''deprecated with GTK-4'', since,
generally speaking, GTK moves away from the notion of an
''underlying windowing system'' and relies on the concept
of ''graphic surfaces, textures and paintables'' rather...
This commit is contained in:
Fischlurch 2025-05-06 19:41:51 +02:00
parent 02ac4a169b
commit 93a62af39e
4 changed files with 78 additions and 44 deletions

View file

@ -1,10 +1,11 @@
/* /*
GdkDisplayer - displaying video via GDK PixbufDisplayer - displaying video via bitmap image
Copyright (C) Copyright (C)
2000, Arne Schirmacher <arne@schirmacher.de> 2000, Arne Schirmacher <arne@schirmacher.de>
2001-2007, Dan Dennedy <dan@dennedy.org> 2001-2007, Dan Dennedy <dan@dennedy.org>
2008, Joel Holdsworth <joel@airwebreathe.org.uk> 2008, Joel Holdsworth <joel@airwebreathe.org.uk>
2025, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** is free software; you can redistribute it and/or modify it   **Lumiera** is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the   under the terms of the GNU General Public License as published by the
@ -15,29 +16,26 @@
/** @file pixbuf-displayer.cpp /** @file pixbuf-displayer.cpp
** Dysfunctional implementation code, formerly used to ** Implementation of fallback functionality for video display.
** create a video display based on GDK
** @deprecated obsolete since GTK-3
** @todo WIP as of 5/2025 attempt to accommodate to GTK-3 ////////////////////////////////////////////////TICKET #1403 ** @todo WIP as of 5/2025 attempt to accommodate to GTK-3 ////////////////////////////////////////////////TICKET #1403
*/ */
#include "stage/gtk-base.hpp" #include "stage/gtk-base.hpp"
#include "stage/output/pixbuf-displayer.hpp" #include "stage/output/pixbuf-displayer.hpp"
#include "lib/format-cout.hpp"
#if false ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display #if false ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display #endif ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
#include <iostream> #include <iostream>
using std::cerr;
using std::endl;
namespace stage { namespace stage {
namespace output { namespace output {
GdkDisplayer::GdkDisplayer (Gtk::Widget* drawing_area, PixbufDisplayer::PixbufDisplayer (Gtk::Image* drawing_area,
int width, int height) int width, int height)
: Displayer{width,height} : Displayer{width,height}
, drawingArea_{drawing_area} , drawingArea_{drawing_area}
@ -45,16 +43,17 @@ namespace output {
REQUIRE (drawing_area); REQUIRE (drawing_area);
REQUIRE (width > 0); REQUIRE (width > 0);
REQUIRE (height > 0); REQUIRE (height > 0);
cout << "USING PixbufDisplayer" <<endl;
} }
bool bool
GdkDisplayer::usable() PixbufDisplayer::usable()
{ {
return false; /////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display return true; /////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
} }
void void
GdkDisplayer::put (void* const image) PixbufDisplayer::put (void* const image)
{ {
int video_x = 0, int video_x = 0,
video_y = 0, video_y = 0,
@ -69,7 +68,17 @@ namespace output {
GdkWindow *window = drawingArea_->get_window()->gobj(); GdkWindow *window = drawingArea_->get_window()->gobj();
REQUIRE (window != NULL); REQUIRE (window != NULL);
if (not init_)
{
auto iconSet = Gtk::IconSet::lookup_default (Gtk::StockID("panel_play"));
drawingArea_->set(iconSet, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
init_ = true;
cout << "INIT Pixbuf"<< iconSet.get() <<endl;
}
drawingArea_->queue_draw();
int pixSiz = drawingArea_->property_pixel_size();
cout << "bong.."<<pixSiz<<endl;
#if false ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display #if false ///////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
GdkGC *gc = gdk_gc_new( window ); GdkGC *gc = gdk_gc_new( window );
REQUIRE(gc != NULL); REQUIRE(gc != NULL);

View file

@ -1,10 +1,11 @@
/* /*
GDKDISPLAYER.hpp - displaying video via GDK PIXBUF-DISPLAYER.hpp - displaying video via bitmap image
Copyright (C) Copyright (C)
2000, Arne Schirmacher <arne@schirmacher.de> 2000, Arne Schirmacher <arne@schirmacher.de>
2001-2007, Dan Dennedy <dan@dennedy.org> 2001-2007, Dan Dennedy <dan@dennedy.org>
2008, Joel Holdsworth <joel@airwebreathe.org.uk> 2008, Joel Holdsworth <joel@airwebreathe.org.uk>
2025, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** is free software; you can redistribute it and/or modify it   **Lumiera** is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the   under the terms of the GNU General Public License as published by the
@ -15,9 +16,8 @@
/** @file pixbuf-displayer.hpp /** @file pixbuf-displayer.hpp
** Display video via GDK ** Display video as bitmap image with the UI toolkit.
** **
** @deprecated obsolete since GTK-3
** @todo WIP as of 5/2025 attempt to accommodate to GTK-3 ////////////////////////////////////////////////TICKET #1403 ** @todo WIP as of 5/2025 attempt to accommodate to GTK-3 ////////////////////////////////////////////////TICKET #1403
** @see displayer.hpp ** @see displayer.hpp
*/ */
@ -36,17 +36,16 @@ namespace stage {
namespace output { namespace output {
/** /**
* GdkDisplayer is a class which is responsible for rendering a video * PixbufDisplayer is a class which is responsible for rendering a video
* image via GDK. * image via GDK.
* *
* @todo the GdkDisplayer class is not supported anymore in Gtk3.
* This is due to Gtk3 only supporting drawing with Cairo
* ////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #950 : new solution for video display
* @todo WIP as of 5/2025 attempt to accommodate to GTK-3 /////////////////////////////////////////////////TICKET #1403 * @todo WIP as of 5/2025 attempt to accommodate to GTK-3 /////////////////////////////////////////////////TICKET #1403
*/ */
class GdkDisplayer class PixbufDisplayer
: public Displayer : public Displayer
{ {
Gtk::Image* drawingArea_;
public: public:
/** /**
@ -58,7 +57,7 @@ class GdkDisplayer
* @param[in] height The height of the video image in pixels. This * @param[in] height The height of the video image in pixels. This
* value must be greater than zero. * value must be greater than zero.
*/ */
GdkDisplayer (Gtk::Widget* drawing_area, int width, int height ); PixbufDisplayer (Gtk::Image* drawing_area, int width, int height );
/** /**
* Put an image of a given width and height with the expected input * Put an image of a given width and height with the expected input
@ -68,20 +67,10 @@ class GdkDisplayer
void put (void* const image); void put (void* const image);
protected: protected:
bool usable() override;
/**
* Indicates if this object can be used to render images on the
* running system.
*/
bool usable();
private: private:
bool init_{false};
/**
* The widget that video will be drawn into.
* @remarks This value must be a valid pointer.
*/
Gtk::Widget* drawingArea_;
}; };

View file

@ -37,13 +37,14 @@ namespace widget {
using std::make_unique; using std::make_unique;
using stage::output::XvDisplayer; using stage::output::XvDisplayer;
using stage::output::GdkDisplayer; using stage::output::PixbufDisplayer;
using stage::output::NullDisplayer; using stage::output::NullDisplayer;
VideoDisplayWidget::VideoDisplayWidget() VideoDisplayWidget::VideoDisplayWidget()
{ {
get_style_context()->add_class (CLASS_background); // Style to ensure an opaque backdrop get_style_context()->add_class (CLASS_background); // Style to ensure an opaque backdrop
get_style_context()->add_class (CLASS_videodisplay); get_style_context()->add_class (CLASS_videodisplay);
this->show_all();
} }
@ -73,11 +74,11 @@ namespace widget {
displayer_ = make_unique<XvDisplayer> (this, videoWidth, videoHeight); displayer_ = make_unique<XvDisplayer> (this, videoWidth, videoHeight);
if (displayer_->usable()) if (displayer_->usable())
return; return;
*/
displayer_ = make_unique<GdkDisplayer> (this, videoWidth, videoHeight); displayer_ = make_unique<PixbufDisplayer> (this, videoWidth, videoHeight);
if (displayer_->usable()) if (displayer_->usable())
return; return;
*/
displayer_ = make_unique<NullDisplayer> (this, videoWidth, videoHeight); displayer_ = make_unique<NullDisplayer> (this, videoWidth, videoHeight);
ENSURE (displayer_->usable()); ENSURE (displayer_->usable());
} }

View file

@ -129984,10 +129984,23 @@ StM_bind(Builder&lt;R1&gt; b1, Extension&lt;R1,R2&gt; extension)
<icon BUILTIN="button_ok"/> <icon BUILTIN="button_ok"/>
</node> </node>
</node> </node>
<node CREATED="1746313536301" ID="ID_407425498" MODIFIED="1746313654699" TEXT="Infos zu den Low-Level-Zugriffen"> <node CREATED="1746313536301" ID="ID_407425498" MODIFIED="1746542753237" TEXT="Infos zu den Low-Level-(GDK)-Zugriffen">
<arrowlink COLOR="#6c7789" DESTINATION="ID_292602658" ENDARROW="Default" ENDINCLINATION="-1126;108;" ID="Arrow_ID_1434687356" STARTARROW="None" STARTINCLINATION="-901;77;"/> <arrowlink COLOR="#6c7789" DESTINATION="ID_292602658" ENDARROW="Default" ENDINCLINATION="-1126;108;" ID="Arrow_ID_1434687356" STARTARROW="None" STARTINCLINATION="-984;70;"/>
<icon BUILTIN="info"/> <icon BUILTIN="info"/>
</node> </node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1746542764270" ID="ID_1879098999" MODIFIED="1746542827394" TEXT="Experiment: die Fallback-Anzeige (pixbuff) portieren">
<icon BUILTIN="full-1"/>
<node CREATED="1746630398020" ID="ID_1520924993" MODIFIED="1746632466497" TEXT="mit GTK-3 m&#xfc;ssen wir einen Pixbuf verwenden">
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1746630418070" ID="ID_396250251" MODIFIED="1746630427582" TEXT="die neueren Alternativen wurden erst mit GTK-4 eingef&#xfc;hrt"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1746632432347" ID="ID_110870446" MODIFIED="1746632460790" TEXT="k&#xf6;nne aber versuchen, den in ein Gtk::Image einzubinden">
<icon BUILTIN="idea"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1746542785647" ID="ID_1968916517" MODIFIED="1746542843774" TEXT="Experiment: den XV-Code aktivieren">
<icon BUILTIN="full-2"/>
</node>
</node> </node>
</node> </node>
</node> </node>
@ -151138,17 +151151,22 @@ std::cout &lt;&lt; tmpl.render({&quot;what&quot;, &quot;World&quot;}) &lt;&lt; s
</node> </node>
</node> </node>
<node CREATED="1746287605697" HGAP="29" ID="ID_1605299883" MODIFIED="1746287612557" TEXT="Dokumentation"> <node CREATED="1746287605697" HGAP="29" ID="ID_1605299883" MODIFIED="1746287612557" TEXT="Dokumentation">
<node CREATED="1746544251281" ID="ID_1804838777" LINK="https://docs.gtk.org/" MODIFIED="1746544594564" TEXT="GTK-Doku (Einstieg|aktuell)">
<node CREATED="1746544641070" ID="ID_468111780" LINK="https://docs.gtk.org/gtk4/" MODIFIED="1746544652939" TEXT="GTK-4(aktuell)"/>
<node CREATED="1746544690363" ID="ID_1351157489" LINK="https://docs.gtk.org/gtk3/" MODIFIED="1746544705768" TEXT="GTK-3(3.24|supported)"/>
</node>
<node CREATED="1746287995242" ID="ID_445627802" MODIFIED="1746288001360" TEXT="Programming with Gtkmm"> <node CREATED="1746287995242" ID="ID_445627802" MODIFIED="1746288001360" TEXT="Programming with Gtkmm">
<node CREATED="1746288002185" ID="ID_632354219" LINK="https://web.archive.org/web/20200428080214/https://developer.gnome.org/gtkmm-tutorial/stable/index.html.en" MODIFIED="1746289645030" TEXT="Gtkmm-3 (Archive 2020)"> <node CREATED="1746288002185" ID="ID_632354219" LINK="https://web.archive.org/web/20200428080214/https://developer.gnome.org/gtkmm-tutorial/stable/index.html.en" MODIFIED="1746289645030" TEXT="Gtkmm-3 (Archive 2020)">
<node CREATED="1746288192067" ID="ID_1226751634" LINK="https://download.gnome.org/sources/gtkmm-documentation/3.24/" MODIFIED="1746288198981" TEXT="download"/> <node CREATED="1746288192067" ID="ID_1226751634" LINK="https://download.gnome.org/sources/gtkmm-documentation/3.24/" MODIFIED="1746288198981" TEXT="download"/>
</node> </node>
<node CREATED="1746288009436" ID="ID_1259724761" LINK="https://gnome.pages.gitlab.gnome.org/gtkmm-documentation/index.html" MODIFIED="1746288033465" TEXT="Gtkmm-4 (current)"/> <node CREATED="1746288009436" ID="ID_1259724761" LINK="https://gnome.pages.gitlab.gnome.org/gtkmm-documentation/index.html" MODIFIED="1746288033465" TEXT="Gtkmm-4 (current)"/>
</node> </node>
<node CREATED="1746309394880" ID="ID_1482721663" LINK="https://gtkmm.gnome.org/en/documentation.html" MODIFIED="1746311409207" TEXT="GTKmm-Documentation (current)"/> <node CREATED="1746309394880" ID="ID_1482721663" LINK="https://gtkmm.gnome.org/en/documentation.html" MODIFIED="1746311409207" TEXT="GTKmm-Documentation (current)">
<node CREATED="1746288640997" ID="ID_865943990" LINK="https://web.archive.org/web/20200508150948/https://developer.gnome.org/references" MODIFIED="1746289246861" TEXT="Developers.gnome.org (Archive 2020)"> <node CREATED="1746288640997" ID="ID_865943990" LINK="https://web.archive.org/web/20200508150948/https://developer.gnome.org/references" MODIFIED="1746289246861" TEXT="Developers.gnome.org (Archive 2020)">
<node CREATED="1746289110036" ID="ID_910026032" LINK="https://web.archive.org/web/20201112022432/https://developer.gnome.org/gtkmm/stable/" MODIFIED="1746289198485" TEXT="Gtkmm-3"/> <node CREATED="1746289110036" ID="ID_910026032" LINK="https://web.archive.org/web/20201112022432/https://developer.gnome.org/gtkmm/stable/" MODIFIED="1746289198485" TEXT="Gtkmm-3"/>
</node> </node>
</node> </node>
</node>
<node COLOR="#435e98" CREATED="1534634232557" HGAP="31" ID="ID_1467351006" MODIFIED="1557498707237" TEXT="Konzepte" VSHIFT="-22"> <node COLOR="#435e98" CREATED="1534634232557" HGAP="31" ID="ID_1467351006" MODIFIED="1557498707237" TEXT="Konzepte" VSHIFT="-22">
<font BOLD="true" NAME="SansSerif" SIZE="12"/> <font BOLD="true" NAME="SansSerif" SIZE="12"/>
<icon BUILTIN="info"/> <icon BUILTIN="info"/>
@ -154715,7 +154733,7 @@ std::cout &lt;&lt; tmpl.render({&quot;what&quot;, &quot;World&quot;}) &lt;&lt; s
<node CREATED="1504215729848" ID="ID_518260540" MODIFIED="1557498707239" TEXT="howto"> <node CREATED="1504215729848" ID="ID_518260540" MODIFIED="1557498707239" TEXT="howto">
<node CREATED="1746313074008" ID="ID_326777030" MODIFIED="1746313077703" TEXT="X-Window"> <node CREATED="1746313074008" ID="ID_326777030" MODIFIED="1746313077703" TEXT="X-Window">
<node CREATED="1746313079527" FOLDED="true" ID="ID_292602658" MODIFIED="1746313654699" TEXT="an das X-Window rankommen"> <node CREATED="1746313079527" FOLDED="true" ID="ID_292602658" MODIFIED="1746313654699" TEXT="an das X-Window rankommen">
<linktarget COLOR="#6c7789" DESTINATION="ID_292602658" ENDARROW="Default" ENDINCLINATION="-1126;108;" ID="Arrow_ID_1434687356" SOURCE="ID_407425498" STARTARROW="None" STARTINCLINATION="-901;77;"/> <linktarget COLOR="#6c7789" DESTINATION="ID_292602658" ENDARROW="Default" ENDINCLINATION="-1126;108;" ID="Arrow_ID_1434687356" SOURCE="ID_407425498" STARTARROW="None" STARTINCLINATION="-984;70;"/>
<node CREATED="1746313102451" ID="ID_757727277" LINK="https://discourse.gnome.org/t/set-absolut-window-position-in-gtk4/8552/4" MODIFIED="1746313148021" TEXT="Frage im GNOME-Forum"> <node CREATED="1746313102451" ID="ID_757727277" LINK="https://discourse.gnome.org/t/set-absolut-window-position-in-gtk4/8552/4" MODIFIED="1746313148021" TEXT="Frage im GNOME-Forum">
<richcontent TYPE="NOTE"><html> <richcontent TYPE="NOTE"><html>
<head/> <head/>
@ -158572,13 +158590,21 @@ unsigned int ThreadIdAsInt = *static_cast&lt;unsigned int*&gt;(static_cast&lt;vo
</node> </node>
</node> </node>
</node> </node>
<node BACKGROUND_COLOR="#d7cec4" CREATED="1437693678626" HGAP="136" ID="ID_1536988357" MODIFIED="1731199643025" POSITION="left" STYLE="bubble" VSHIFT="-39"> <node BACKGROUND_COLOR="#d7cec4" CREATED="1437693678626" HGAP="136" ID="ID_1536988357" MODIFIED="1746546760400" POSITION="left" STYLE="bubble" VSHIFT="-39">
<richcontent TYPE="NODE"><html> <richcontent TYPE="NODE"><html>
<head/> <head/>
<body> <body>
<p> <p style="text-align: center">
Dokumentation zu<br/> Quellen
Themenbereichen </p>
<p style="text-align: center">
<font size="2">und</font>
</p>
<p style="text-align: center">
Dokumentation
</p>
<p style="text-align: center">
<font size="2">zu</font><br /><font size="5">Themenbereichen</font>
</p> </p>
</body> </body>
</html></richcontent> </html></richcontent>
@ -158706,6 +158732,15 @@ unsigned int ThreadIdAsInt = *static_cast&lt;unsigned int*&gt;(static_cast&lt;vo
<node CREATED="1745795986779" ID="ID_770800240" LINK="https://wiki.xiph.org/Videos/A_Digital_Media_Primer_For_Geeks" MODIFIED="1745796008637" TEXT="Video: A Digital Media Primer for Geeks (ciph.org)"/> <node CREATED="1745795986779" ID="ID_770800240" LINK="https://wiki.xiph.org/Videos/A_Digital_Media_Primer_For_Geeks" MODIFIED="1745796008637" TEXT="Video: A Digital Media Primer for Geeks (ciph.org)"/>
</node> </node>
</node> </node>
<node CREATED="1746546779168" ID="ID_462246089" MODIFIED="1746546805043" STYLE="fork" TEXT="Free Software">
<edge COLOR="#61617d" STYLE="sharp_bezier" WIDTH="thin"/>
<node CREATED="1746546784656" ID="ID_771853414" MODIFIED="1746546805040" TEXT="Film/Schnitt">
<node CREATED="1746546826106" ID="ID_790336128" LINK="https://en.wikipedia.org/wiki/Olive_(software)" MODIFIED="1746546829067" TEXT="Olive">
<node CREATED="1746546830884" ID="ID_1609191791" LINK="https://www.patreon.com/posts/olives-future-79926246" MODIFIED="1746546862915" TEXT="Zukunft ungewiss (2022)"/>
</node>
<node CREATED="1746546915150" ID="ID_138512802" LINK="https://en.wikipedia.org/wiki/List_of_free_and_open-source_software_packages#Video_editing" MODIFIED="1746546953470" TEXT="List of Free Video Editing Software (Wikipedia)"/>
</node>
</node>
</node> </node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1522933281517" HGAP="79" ID="ID_1743316782" MODIFIED="1557498707241" POSITION="left" TEXT="Entwicklung" VSHIFT="-6"> <node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1522933281517" HGAP="79" ID="ID_1743316782" MODIFIED="1557498707241" POSITION="left" TEXT="Entwicklung" VSHIFT="-6">
<edge COLOR="#9e7171" STYLE="linear"/> <edge COLOR="#9e7171" STYLE="linear"/>