Skip to content

Commit 4d9d078

Browse files
committed
Make movie support optional
Not supporting movies removes the need for a number of dependencies. Refs #74.
1 parent 24af5d4 commit 4d9d078

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ set(MANDIR "share/man/man1" CACHE FILEPATH "mandir")
1111

1212
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1313

14+
option(MOVIES "Compile support for movie playback (requires gdk-x11)" ON)
15+
1416
add_subdirectory(src)
1517
add_subdirectory(icons)
1618
add_subdirectory(man)

src/CMakeLists.txt

+21-10
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ pkg_check_modules(GEE REQUIRED gee-0.8)
55
pkg_check_modules(POPPLER REQUIRED poppler-glib)
66
pkg_check_modules(GTK REQUIRED gtk+-3.0)
77
pkg_check_modules(GTHREAD REQUIRED gthread-2.0)
8-
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
9-
pkg_check_modules(GSTBASE REQUIRED gstreamer-base-1.0)
10-
pkg_check_modules(GSTAUDIO REQUIRED gstreamer-audio-1.0)
11-
pkg_check_modules(GSTVIDEO REQUIRED gstreamer-video-1.0)
12-
pkg_check_modules(GDKX11 REQUIRED gdk-x11-3.0)
8+
if (MOVIES)
9+
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
10+
pkg_check_modules(GSTBASE REQUIRED gstreamer-base-1.0)
11+
pkg_check_modules(GSTAUDIO REQUIRED gstreamer-audio-1.0)
12+
pkg_check_modules(GSTVIDEO REQUIRED gstreamer-video-1.0)
13+
pkg_check_modules(GDKX11 REQUIRED gdk-x11-3.0)
14+
set(MOVIE_PACKAGES
15+
gstreamer-1.0
16+
gstreamer-base-1.0
17+
gstreamer-audio-1.0
18+
gstreamer-video-1.0
19+
gdk-x11-3.0
20+
)
21+
endif ()
1322

1423
set(CFLAGS
1524
${GOBJECT_CFLAGS} ${GOBJECT_CFLAGS_OTHER}
@@ -56,6 +65,11 @@ link_directories(${LIB_PATHS})
5665
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/paths.in ${CMAKE_CURRENT_SOURCE_DIR}/paths.vala)
5766

5867
file (GLOB_RECURSE VALA_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala)
68+
if (MOVIES)
69+
set(EXTRA_VALA_OPTIONS ${EXTRA_VALA_OPTIONS} -D MOVIES)
70+
else ()
71+
LIST(REMOVE_ITEM VALA_SRC classes/action/movie.vala)
72+
endif ()
5973

6074
vala_precompile(VALA_C
6175
${VALA_SRC}
@@ -65,15 +79,12 @@ PACKAGES
6579
poppler-glib
6680
gtk+-3.0
6781
posix
68-
gstreamer-1.0
69-
gstreamer-base-1.0
70-
gstreamer-audio-1.0
71-
gstreamer-video-1.0
72-
gdk-x11-3.0
82+
${MOVIE_PACKAGES}
7383
OPTIONS
7484
--thread
7585
--debug
7686
--enable-experimental
87+
${EXTRA_VALA_OPTIONS}
7788
GENERATE_HEADER
7889
presenter
7990
GENERATE_VAPI

src/classes/metadata/pdf.vala

+6-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,12 @@ namespace pdfpc.Metadata {
584584
*/
585585
private int mapping_page_num = -1;
586586
private GLib.List<ActionMapping> action_mapping;
587-
private ActionMapping[] blanks = {new ControlledMovie(), new LinkAction()};
587+
private ActionMapping[] blanks = {
588+
#if MOVIES
589+
new ControlledMovie(),
590+
#endif
591+
new LinkAction()
592+
};
588593
public weak PresentationController controller = null;
589594

590595
/**

src/classes/presentation_controller.vala

+2
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ namespace pdfpc {
906906
return tm.mktime();
907907
}
908908

909+
#if MOVIES
909910
/**
910911
* Give the Gdk.Rectangle corresponding to the Poppler.Rectangle for the nth
911912
* controllable's main view. Also, return the XID for the view's window,
@@ -925,5 +926,6 @@ namespace pdfpc {
925926
rect = view.convert_poppler_rectangle_to_gdk_rectangle(area);
926927
return (uint*) ((Gdk.X11.Window) view.get_window()).get_xid();
927928
}
929+
#endif
928930
}
929931
}

src/pdfpc.vala

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ namespace pdfpc {
195195
print_version();
196196
Posix.exit(0);
197197
}
198-
198+
#if MOVIES
199199
Gst.init( ref args );
200-
200+
#endif
201201
if (Options.list_actions) {
202202
stdout.printf("Config file commands accepted by pdfpc:\n");
203203
string[] actions = PresentationController.getActionDescriptions();

0 commit comments

Comments
 (0)