Skip to content

Commit 64a237e

Browse files
phillipberndtAndreasBilke
authored andcommitted
Make gstreamer pipeline configurable
1 parent 0901789 commit 64a237e

File tree

5 files changed

+47
-15
lines changed

5 files changed

+47
-15
lines changed

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ Embedded video playback is not working.
165165

166166
You likely have a ``gstreamer`` codec issue. First, try to install
167167
``gstreamer``'s 'bad' codecs (package ``libgstreamer-plugins-bad1.0-0`` on
168-
Debian/Ubuntu). By doing so, ``pdfpc`` will use ``gstreamer``'s OpenGL backend
169-
for rendering, which might solve your issue.
168+
Debian/Ubuntu) and add ``option gstreamer-pipeline glimagesink`` to your
169+
``pdfpcrc`` file. By doing so, ``pdfpc`` will use ``gstreamer``'s OpenGL
170+
backend for rendering, which might solve your issue.
170171

171172
If the problem persists, try loading the video file you want to play with the
172173
following command: ``gst-launch-1.0 filesrc location=<your video> ! decodebin !

man/pdfpcrc.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Add an additional black slide at the end of the presentation (bool, Default fals
6060
.B current-height
6161
Percentage of the height of the presenter screen to be used for the current slide. (int, Default 80)
6262
.TP
63+
.B current-size
64+
Percentage of the presenter screen to be used for the current slide. (int, Default 60)
65+
.TP
6366
.BI disable-caching
6467
see
6568
.B pdfpcrc(5)
@@ -68,8 +71,9 @@ see
6871
see
6972
.B pdfpcrc(5)
7073
.TP
71-
.B current-size
72-
Percentage of the presenter screen to be used for the current slide. (int, Default 60)
74+
.B gstreamer-pipeline
75+
Video rendering methods. Valid values are \fIxvimagesink\fR and \fIglimagesink\fR. (Default
76+
xvimagesink)
7377
.TP
7478
.B next-height
7579
Percentage of the height of the presenter screen to be used for the next slide. (int, Default 70)

src/classes/action/movie.vala

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,20 @@ namespace pdfpc {
298298
break;
299299
}
300300
Gst.Element sink;
301-
// if the gstreamer OpenGL sink is installed (in gstreamer-plugins-bad), use it
302-
// as it fixes video issues (cf pdfpc/pdfpc#197). Otherwise, fallback on
303-
// default xvimagesink.
304-
Gst.ElementFactory glimagesinkFactory = Gst.ElementFactory.find("glimagesink");
305-
if(glimagesinkFactory != null) {
306-
sink = glimagesinkFactory.create(@"sink$n");
307-
} else {
308-
GLib.printerr("gstreamer's OpenGL plugin glimagesink not available. Using xvimagesink instead.\n");
309-
sink = Gst.ElementFactory.make("xvimagesink", @"sink$n");
301+
302+
switch(Options.gstreamer_pipeline) {
303+
case Options.GstreamerPipeline.XVIMAGESINK:
304+
sink = Gst.ElementFactory.make("xvimagesink", @"sink$n");
305+
break;
306+
case Options.GstreamerPipeline.GLIMAGESINK:
307+
sink = Gst.ElementFactory.make("glimagesink", @"sink$n");
308+
break;
309+
default:
310+
GLib.printerr("Invalid gstreamer-pipeline selected. Falling back to autovideosink.\n");
311+
sink = Gst.ElementFactory.make("autovideosink", @"sink$n");
312+
break;
310313
}
314+
311315
Gst.Element queue = Gst.ElementFactory.make("queue", @"queue$n");
312316
bin.add_many(queue,sink);
313317
tee.link(queue);
@@ -316,7 +320,7 @@ namespace pdfpc {
316320
sink.set("force_aspect_ratio", false);
317321
Gst.Video.Overlay xoverlay = (Gst.Video.Overlay) sink;
318322

319-
if(glimagesinkFactory != null) {
323+
if(Options.gstreamer_pipeline == Options.GstreamerPipeline.GLIMAGESINK) {
320324
var overlay_widget = this.controller.overlay_widget(n, this.area);
321325
if (overlay_widget.get_realized()) {
322326
xoverlay.set_window_handle((uint*)((Gdk.X11.Window) overlay_widget.get_window()).get_xid());
@@ -327,7 +331,7 @@ namespace pdfpc {
327331
});
328332
}
329333
}
330-
else {
334+
else if(Options.gstreamer_pipeline == Options.GstreamerPipeline.XVIMAGESINK) {
331335
xoverlay.set_window_handle(xid);
332336
xoverlay.set_render_rectangle(rect.x*gdk_scale, rect.y*gdk_scale,
333337
rect.width*gdk_scale, rect.height*gdk_scale);

src/classes/config_file_reader.vala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,19 @@ namespace pdfpc {
253253
Options.use_time_of_day = true;
254254
}
255255
break;
256+
case "gstreamer-pipeline":
257+
switch(fields[2]) {
258+
case "xvimagesink":
259+
Options.gstreamer_pipeline = Options.GstreamerPipeline.XVIMAGESINK;
260+
break;
261+
case "glimagesink":
262+
Options.gstreamer_pipeline = Options.GstreamerPipeline.GLIMAGESINK;
263+
break;
264+
default:
265+
GLib.printerr("Invalid value for option gstreamer-pipeline, only xvimagesink and glimagesink are supported\n");
266+
break;
267+
}
268+
break;
256269
default:
257270
GLib.printerr("Unknown option %s in pdfpcrc\n", fields[1]);
258271
break;

src/classes/options.vala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ namespace pdfpc {
157157
*/
158158
public static bool version = false;
159159

160+
public enum GstreamerPipeline {
161+
XVIMAGESINK,
162+
GLIMAGESINK,
163+
}
164+
165+
/**
166+
* Select the gstreamer pipeline to use for video output
167+
*/
168+
public static GstreamerPipeline gstreamer_pipeline = GstreamerPipeline.XVIMAGESINK;
169+
160170
public class BindTuple {
161171
public string type;
162172
public uint keyCode;

0 commit comments

Comments
 (0)