glib/demo/utils.c                   |    3 +++
 glib/poppler-movie.cc               |   35 +++++++++++++++++++++++++++++++++++
 glib/poppler-movie.h                |   31 ++++++++++++++++++++++++++-----
 glib/reference/poppler-sections.txt |    4 ++++
 4 files changed, 68 insertions(+), 5 deletions(-)

New commits:
commit 2bbd110113f789c56609b3288258f667e0f3851a
Author: Carlos Garcia Campos <[email protected]>
Date:   Sun Apr 2 15:49:48 2017 +0200

    glib-demo: Show play mode in movie properties view

diff --git a/glib/demo/utils.c b/glib/demo/utils.c
index 10d6d4bd..8194ff2b 100644
--- a/glib/demo/utils.c
+++ b/glib/demo/utils.c
@@ -549,6 +549,7 @@ pgd_movie_view_set_movie (GtkWidget    *movie_view,
 {
        GtkWidget  *table;
        GtkWidget  *button;
+        GEnumValue *enum_value;
        gint        row = 0;
 
        table = gtk_bin_get_child (GTK_BIN (movie_view));
@@ -575,6 +576,8 @@ pgd_movie_view_set_movie (GtkWidget    *movie_view,
        pgd_table_add_property (GTK_GRID (table), "<b>Filename:</b>", 
poppler_movie_get_filename (movie), &row);
        pgd_table_add_property (GTK_GRID (table), "<b>Need Poster:</b>", 
poppler_movie_need_poster (movie) ? "Yes" : "No", &row);
        pgd_table_add_property (GTK_GRID (table), "<b>Show Controls:</b>", 
poppler_movie_show_controls (movie) ? "Yes" : "No", &row);
+        enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref 
(POPPLER_TYPE_MOVIE_PLAY_MODE), poppler_movie_get_play_mode (movie));
+        pgd_table_add_property (GTK_GRID (table), "<b>Play mode:</b>", 
enum_value->value_name, &row);
 
        button = gtk_button_new_with_mnemonic ("_Play");
        g_signal_connect (button, "clicked",
commit dad9b36e0e91524e8e342cf924026c37fcb1730e
Author: Francesco Poli (wintermute) <[email protected]>
Date:   Sun Apr 2 15:28:20 2017 +0200

    glib: Expose movie play mode
    
    With this patch the movie play mode can be queried via the glib
    interface. An enum value is obtained that reports whether the movie
    should be played once, in loop, and so forth...
    
    https://bugs.freedesktop.org/show_bug.cgi?id=99625

diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc
index cb5a2ad0..be1d5184 100644
--- a/glib/poppler-movie.cc
+++ b/glib/poppler-movie.cc
@@ -2,6 +2,7 @@
  *
  * Copyright (C) 2010 Carlos Garcia Campos <[email protected]>
  * Copyright (C) 2008 Hugo Mercier <hmercier31[@]gmail.com>
+ * Copyright (C) 2017 Francesco Poli <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,6 +37,7 @@ struct _PopplerMovie
   gchar   *filename;
   gboolean need_poster;
   gboolean show_controls;
+  PopplerMoviePlayMode mode;
 };
 
 struct _PopplerMovieClass
@@ -91,6 +93,21 @@ _poppler_movie_new (Movie *poppler_movie)
 
   movie->show_controls = 
poppler_movie->getActivationParameters()->showControls;
 
+  switch (poppler_movie->getActivationParameters()->repeatMode) {
+  case MovieActivationParameters::repeatModeOnce:
+    movie->mode = POPPLER_MOVIE_PLAY_MODE_ONCE;
+    break;
+  case MovieActivationParameters::repeatModeOpen:
+    movie->mode = POPPLER_MOVIE_PLAY_MODE_OPEN;
+    break;
+  case MovieActivationParameters::repeatModeRepeat:
+    movie->mode = POPPLER_MOVIE_PLAY_MODE_REPEAT;
+    break;
+  case MovieActivationParameters::repeatModePalindrome:
+    movie->mode = POPPLER_MOVIE_PLAY_MODE_PALINDROME;
+    break;
+  }
+
   return movie;
 }
 
@@ -150,3 +167,21 @@ poppler_movie_show_controls (PopplerMovie *poppler_movie)
 
   return poppler_movie->show_controls;
 }
+
+/**
+ * poppler_movie_get_play_mode:
+ * @poppler_movie: a #PopplerMovie
+ *
+ * Returns the play mode of @poppler_movie.
+ *
+ * Return value: a #PopplerMovieRepeatMode.
+ *
+ * Since: 0.54
+ */
+PopplerMoviePlayMode
+poppler_movie_get_play_mode (PopplerMovie *poppler_movie)
+{
+  g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 
POPPLER_MOVIE_PLAY_MODE_ONCE);
+
+  return poppler_movie->mode;
+}
diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h
index 9e1bc32b..d76522a3 100644
--- a/glib/poppler-movie.h
+++ b/glib/poppler-movie.h
@@ -2,6 +2,7 @@
  *
  * Copyright (C) 2010 Carlos Garcia Campos <[email protected]>
  * Copyright (C) 2008 Hugo Mercier <hmercier31[@]gmail.com>
+ * Copyright (C) 2017 Francesco Poli <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,11 +31,31 @@ G_BEGIN_DECLS
 #define POPPLER_MOVIE(obj)                   (G_TYPE_CHECK_INSTANCE_CAST 
((obj), POPPLER_TYPE_MOVIE, PopplerMovie))
 #define POPPLER_IS_MOVIE(obj)                (G_TYPE_CHECK_INSTANCE_TYPE 
((obj), POPPLER_TYPE_MOVIE))
 
-
-GType        poppler_movie_get_type      (void) G_GNUC_CONST;
-const gchar *poppler_movie_get_filename  (PopplerMovie *poppler_movie);
-gboolean     poppler_movie_need_poster   (PopplerMovie *poppler_movie);
-gboolean     poppler_movie_show_controls (PopplerMovie *poppler_movie);
+/**
+ * PopplerMoviePlayMode:
+ * @POPPLER_MOVIE_PLAY_MODE_ONCE: the movie should be played once and controls 
should be closed at the end.
+ * @POPPLER_MOVIE_PLAY_MODE_OPEN: the movie should be played once, but 
controls should be left open.
+ * @POPPLER_MOVIE_PLAY_MODE_REPEAT: the movie should be played in loop, until 
manually stopped.
+ * @POPPLER_MOVIE_PLAY_MODE_PALINDROME: the movie should be played forward and 
backward, forward and backward,
+ *   and so forth, until manually stopped.
+ *
+ * Play mode enum values.
+ *
+ * Since: 0.54
+ */
+typedef enum
+{
+  POPPLER_MOVIE_PLAY_MODE_ONCE,
+  POPPLER_MOVIE_PLAY_MODE_OPEN,
+  POPPLER_MOVIE_PLAY_MODE_REPEAT,
+  POPPLER_MOVIE_PLAY_MODE_PALINDROME
+} PopplerMoviePlayMode;
+
+GType                poppler_movie_get_type      (void) G_GNUC_CONST;
+const gchar         *poppler_movie_get_filename  (PopplerMovie *poppler_movie);
+gboolean             poppler_movie_need_poster   (PopplerMovie *poppler_movie);
+gboolean             poppler_movie_show_controls (PopplerMovie *poppler_movie);
+PopplerMoviePlayMode poppler_movie_get_play_mode (PopplerMovie *poppler_movie);
 
 G_END_DECLS
 
diff --git a/glib/reference/poppler-sections.txt 
b/glib/reference/poppler-sections.txt
index d597c2d4..af1bbba9 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -555,16 +555,20 @@ poppler_media_get_type
 <FILE>poppler-movie</FILE>
 <TITLE>PopplerMovie</TITLE>
 PopplerMovie
+PopplerMoviePlayMode
 poppler_movie_get_filename
 poppler_movie_need_poster
 poppler_movie_show_controls
+poppler_movie_get_play_mode
 
 <SUBSECTION Standard>
 POPPLER_MOVIE
 POPPLER_IS_MOVIE
 POPPLER_TYPE_MOVIE
+POPPLER_TYPE_MOVIE_PLAY_MODE
 <SUBSECTION Private>
 poppler_movie_get_type
+poppler_movie_play_mode_get_type
 
 </SECTION>
 
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to