glib/demo/utils.c | 8 +- glib/poppler-movie.cc | 140 ++++++++++++++++++++++++++++++++++++ glib/poppler-movie.h | 12 +++ glib/reference/poppler-sections.txt | 7 + 4 files changed, 166 insertions(+), 1 deletion(-)
New commits: commit 365a92e5ed21c642a45dfb75295b7dfa7fc4499a Author: Evgeny Stambulchik <[email protected]> Date: Wed Aug 21 01:08:31 2019 +0300 Use guint64 for time-related values of movie objects (in ns) diff --git a/glib/demo/utils.c b/glib/demo/utils.c index a8b0c68d..aad6c88c 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -564,7 +564,6 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, GtkWidget *button; GEnumValue *enum_value; gint row = 0; - PopplerMovieTime start, duration; table = gtk_bin_get_child (GTK_BIN (movie_view)); if (table) { @@ -595,10 +594,8 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_is_synchronous (movie) ? "Yes" : "No", &row); pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%g", poppler_movie_get_volume (movie)), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rate:</b>", g_strdup_printf("%g", poppler_movie_get_rate (movie)), &row); - poppler_movie_get_start (movie, &start); - pgd_table_add_property (GTK_GRID (table), "<b>Start:</b>", g_strdup_printf("%lu/%i s", start.units, start.units_per_second), &row); - poppler_movie_get_duration (movie, &duration); - pgd_table_add_property (GTK_GRID (table), "<b>Duration:</b>", g_strdup_printf("%lu/%i s", duration.units, duration.units_per_second), &row); + pgd_table_add_property (GTK_GRID (table), "<b>Start:</b>", g_strdup_printf("%g s", poppler_movie_get_start (movie)/1e9), &row); + pgd_table_add_property (GTK_GRID (table), "<b>Duration:</b>", g_strdup_printf("%g s", poppler_movie_get_duration (movie)/1e9), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rotation Angle:</b>", g_strdup_printf("%u", poppler_movie_get_rotation_angle (movie)), &row); button = gtk_button_new_with_mnemonic ("_Play"); diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index ce5e7ba3..aa40aa15 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -41,8 +41,8 @@ struct _PopplerMovie gboolean synchronous_play; gint volume; gdouble rate; - PopplerMovieTime start; - PopplerMovieTime duration; + guint64 start; + guint64 duration; gushort rotation_angle; }; @@ -117,11 +117,21 @@ _poppler_movie_new (const Movie *poppler_movie) movie->rate = poppler_movie->getActivationParameters()->rate; - movie->start.units = poppler_movie->getActivationParameters()->start.units; - movie->start.units_per_second = poppler_movie->getActivationParameters()->start.units_per_second; + if (poppler_movie->getActivationParameters()->start.units_per_second > 0) { + movie->start = 1000000000L* + poppler_movie->getActivationParameters()->start.units/ + poppler_movie->getActivationParameters()->start.units_per_second; + } else { + movie->start = 0L; + } - movie->duration.units = poppler_movie->getActivationParameters()->duration.units; - movie->duration.units_per_second = poppler_movie->getActivationParameters()->duration.units_per_second; + if (poppler_movie->getActivationParameters()->duration.units_per_second > 0) { + movie->duration = 1000000000L* + poppler_movie->getActivationParameters()->duration.units/ + poppler_movie->getActivationParameters()->duration.units_per_second; + } else { + movie->duration = 0L; + } movie->rotation_angle = poppler_movie->getRotationAngle(); @@ -280,35 +290,35 @@ poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) /** * poppler_movie_get_start: * @poppler_movie: a #PopplerMovie - * @start: (out): a return location for a #PopplerMovieTime * - * Obtains the start position of the movie playback + * Returns the start position of the movie playback + * + * Return value: the start position of the movie playback (in ns) * * Since: 0.80 */ -void -poppler_movie_get_start (PopplerMovie *poppler_movie, - PopplerMovieTime *start) +guint64 +poppler_movie_get_start (PopplerMovie *poppler_movie) { - g_return_if_fail (POPPLER_IS_MOVIE (poppler_movie)); + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0L); - *start = poppler_movie->start; + return poppler_movie->start; } /** * poppler_movie_get_duration: * @poppler_movie: a #PopplerMovie - * @duration: (out): a return location for a #PopplerMovieTime * - * Obtains the duration of the movie playback + * Returns the duration of the movie playback + * + * Return value: the duration of the movie playback (in ns) * * Since: 0.80 */ -void -poppler_movie_get_duration (PopplerMovie *poppler_movie, - PopplerMovieTime *duration) +guint64 +poppler_movie_get_duration (PopplerMovie *poppler_movie) { - g_return_if_fail (POPPLER_IS_MOVIE (poppler_movie)); + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0L); - *duration = poppler_movie->duration; + return poppler_movie->duration; } diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index 52b3d7b7..9350a073 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -51,20 +51,6 @@ typedef enum POPPLER_MOVIE_PLAY_MODE_PALINDROME } PopplerMoviePlayMode; -/** - * PopplerMovieTime: - * - * Time-related entities (start position, duration); to get the equivalent - * value in seconds, calculate (double) units/units_per_second. Note that - * units_per_second may be zero if the respective entity is undefined. - * - * Since: 0.80 - */ -typedef struct { - gulong units; - gint units_per_second; -} PopplerMovieTime; - POPPLER_PUBLIC GType poppler_movie_get_type (void) G_GNUC_CONST; POPPLER_PUBLIC @@ -84,11 +70,9 @@ gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie); POPPLER_PUBLIC gushort poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie); POPPLER_PUBLIC -void poppler_movie_get_start (PopplerMovie *poppler_movie, - PopplerMovieTime *start); +guint64 poppler_movie_get_start (PopplerMovie *poppler_movie); POPPLER_PUBLIC -void poppler_movie_get_duration (PopplerMovie *poppler_movie, - PopplerMovieTime *duration); +guint64 poppler_movie_get_duration (PopplerMovie *poppler_movie); G_END_DECLS commit 764dd94a7f5cac3426a58d3f7efbcf8d1b8c787f Author: Evgeny Stambulchik <[email protected]> Date: Wed Aug 21 00:40:13 2019 +0300 Make poppler_movie_get_volume() return double 0.0-1.0 diff --git a/glib/demo/utils.c b/glib/demo/utils.c index 9c66c7fd..a8b0c68d 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -593,7 +593,7 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, 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); pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_is_synchronous (movie) ? "Yes" : "No", &row); - pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%i", poppler_movie_get_volume (movie)), &row); + pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%g", poppler_movie_get_volume (movie)), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rate:</b>", g_strdup_printf("%g", poppler_movie_get_rate (movie)), &row); poppler_movie_get_start (movie, &start); pgd_table_add_property (GTK_GRID (table), "<b>Start:</b>", g_strdup_printf("%lu/%i s", start.units, start.units_per_second), &row); diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index f9ee8dce..ce5e7ba3 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -228,16 +228,16 @@ poppler_movie_is_synchronous (PopplerMovie *poppler_movie) * * Returns the playback audio volume * - * Return value: volume setting for the movie (0 - 100) + * Return value: volume setting for the movie (0.0 - 1.0) * * Since: 0.80 */ -gint +gdouble poppler_movie_get_volume (PopplerMovie *poppler_movie) { g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0); - return poppler_movie->volume; + return poppler_movie->volume/100.0; } /** diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index 01750888..52b3d7b7 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -78,7 +78,7 @@ PopplerMoviePlayMode poppler_movie_get_play_mode (PopplerMovie *poppler_movie); POPPLER_PUBLIC gboolean poppler_movie_is_synchronous (PopplerMovie *poppler_movie); POPPLER_PUBLIC -gint poppler_movie_get_volume (PopplerMovie *poppler_movie); +gdouble poppler_movie_get_volume (PopplerMovie *poppler_movie); POPPLER_PUBLIC gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie); POPPLER_PUBLIC commit 8c2c5c46aba84d714f6c8f779eda0646b31b956b Author: Evgeny Stambulchik <[email protected]> Date: Wed Aug 21 00:33:16 2019 +0300 Rename poppler_movie_synchronous_play -> poppler_movie_is_synchronous diff --git a/glib/demo/utils.c b/glib/demo/utils.c index eae3e896..9c66c7fd 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -592,7 +592,7 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, 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); - pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_synchronous_play (movie) ? "Yes" : "No", &row); + pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_is_synchronous (movie) ? "Yes" : "No", &row); pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%i", poppler_movie_get_volume (movie)), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rate:</b>", g_strdup_printf("%g", poppler_movie_get_rate (movie)), &row); poppler_movie_get_start (movie, &start); diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index 538c703c..f9ee8dce 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -204,7 +204,7 @@ poppler_movie_get_play_mode (PopplerMovie *poppler_movie) } /** - * poppler_movie_synchronous_play: + * poppler_movie_is_synchronous: * @poppler_movie: a #PopplerMovie * * Returns whether the user must wait for the movie to be finished before @@ -215,7 +215,7 @@ poppler_movie_get_play_mode (PopplerMovie *poppler_movie) * Since: 0.80 */ gboolean -poppler_movie_synchronous_play (PopplerMovie *poppler_movie) +poppler_movie_is_synchronous (PopplerMovie *poppler_movie) { g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), FALSE); diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index 0c7644aa..01750888 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -76,7 +76,7 @@ gboolean poppler_movie_show_controls (PopplerMovie *poppler_movie); POPPLER_PUBLIC PopplerMoviePlayMode poppler_movie_get_play_mode (PopplerMovie *poppler_movie); POPPLER_PUBLIC -gboolean poppler_movie_synchronous_play (PopplerMovie *poppler_movie); +gboolean poppler_movie_is_synchronous (PopplerMovie *poppler_movie); POPPLER_PUBLIC gint poppler_movie_get_volume (PopplerMovie *poppler_movie); POPPLER_PUBLIC diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt index e2f1276a..49fe3b72 100644 --- a/glib/reference/poppler-sections.txt +++ b/glib/reference/poppler-sections.txt @@ -593,7 +593,7 @@ poppler_movie_get_start poppler_movie_get_volume poppler_movie_need_poster poppler_movie_show_controls -poppler_movie_synchronous_play +poppler_movie_is_synchronous <SUBSECTION Standard> POPPLER_MOVIE commit b1df2588a8180d3aa027c25764377f28c8d94ce6 Author: Evgeny Stambulchik <[email protected]> Date: Sat Jul 27 00:34:31 2019 +0300 Update Since: comments for new video APIs diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index 989f3a90..538c703c 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -212,7 +212,7 @@ poppler_movie_get_play_mode (PopplerMovie *poppler_movie) * * Return value: %TRUE if yes, %FALSE otherwise * - * Since: 0.79 + * Since: 0.80 */ gboolean poppler_movie_synchronous_play (PopplerMovie *poppler_movie) @@ -230,7 +230,7 @@ poppler_movie_synchronous_play (PopplerMovie *poppler_movie) * * Return value: volume setting for the movie (0 - 100) * - * Since: 0.79 + * Since: 0.80 */ gint poppler_movie_get_volume (PopplerMovie *poppler_movie) @@ -248,7 +248,7 @@ poppler_movie_get_volume (PopplerMovie *poppler_movie) * * Return value: the relative speed of the movie (1 means no change) * - * Since: 0.79 + * Since: 0.80 */ gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie) @@ -267,7 +267,7 @@ poppler_movie_get_rate (PopplerMovie *poppler_movie) * Return value: the number of degrees the movie should be rotated (positive, * multiples of 90: 0, 90, 180, 270) * - * Since: 0.79 + * Since: 0.80 */ gushort poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) @@ -284,7 +284,7 @@ poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) * * Obtains the start position of the movie playback * - * Since: 0.79 + * Since: 0.80 */ void poppler_movie_get_start (PopplerMovie *poppler_movie, @@ -302,7 +302,7 @@ poppler_movie_get_start (PopplerMovie *poppler_movie, * * Obtains the duration of the movie playback * - * Since: 0.79 + * Since: 0.80 */ void poppler_movie_get_duration (PopplerMovie *poppler_movie, diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index e1960c1c..0c7644aa 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -58,7 +58,7 @@ typedef enum * value in seconds, calculate (double) units/units_per_second. Note that * units_per_second may be zero if the respective entity is undefined. * - * Since: 0.79 + * Since: 0.80 */ typedef struct { gulong units; commit fc79087f2d26b355b4477155141578a59ff06620 Author: Evgeny Stambulchik <[email protected]> Date: Fri Jul 5 02:02:26 2019 +0300 Change time-related Movie glib API's to return time as out Also, added Since: strings and completed missing API doc comments. diff --git a/glib/demo/utils.c b/glib/demo/utils.c index 40f541f7..eae3e896 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -595,9 +595,9 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_synchronous_play (movie) ? "Yes" : "No", &row); pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%i", poppler_movie_get_volume (movie)), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rate:</b>", g_strdup_printf("%g", poppler_movie_get_rate (movie)), &row); - start = poppler_movie_get_start (movie); + poppler_movie_get_start (movie, &start); pgd_table_add_property (GTK_GRID (table), "<b>Start:</b>", g_strdup_printf("%lu/%i s", start.units, start.units_per_second), &row); - duration = poppler_movie_get_duration (movie); + poppler_movie_get_duration (movie, &duration); pgd_table_add_property (GTK_GRID (table), "<b>Duration:</b>", g_strdup_printf("%lu/%i s", duration.units, duration.units_per_second), &row); pgd_table_add_property (GTK_GRID (table), "<b>Rotation Angle:</b>", g_strdup_printf("%u", poppler_movie_get_rotation_angle (movie)), &row); diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index f505ce07..989f3a90 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -211,6 +211,8 @@ poppler_movie_get_play_mode (PopplerMovie *poppler_movie) * the PDF viewer accepts any interactive action * * Return value: %TRUE if yes, %FALSE otherwise + * + * Since: 0.79 */ gboolean poppler_movie_synchronous_play (PopplerMovie *poppler_movie) @@ -227,6 +229,8 @@ poppler_movie_synchronous_play (PopplerMovie *poppler_movie) * Returns the playback audio volume * * Return value: volume setting for the movie (0 - 100) + * + * Since: 0.79 */ gint poppler_movie_get_volume (PopplerMovie *poppler_movie) @@ -243,6 +247,8 @@ poppler_movie_get_volume (PopplerMovie *poppler_movie) * Returns the relative speed of the movie * * Return value: the relative speed of the movie (1 means no change) + * + * Since: 0.79 */ gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie) @@ -260,6 +266,8 @@ poppler_movie_get_rate (PopplerMovie *poppler_movie) * * Return value: the number of degrees the movie should be rotated (positive, * multiples of 90: 0, 90, 180, 270) + * + * Since: 0.79 */ gushort poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) @@ -269,20 +277,38 @@ poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) return poppler_movie->rotation_angle; } -const static PopplerMovieTime time0 = {0, 0}; - -PopplerMovieTime -poppler_movie_get_start (PopplerMovie *poppler_movie) +/** + * poppler_movie_get_start: + * @poppler_movie: a #PopplerMovie + * @start: (out): a return location for a #PopplerMovieTime + * + * Obtains the start position of the movie playback + * + * Since: 0.79 + */ +void +poppler_movie_get_start (PopplerMovie *poppler_movie, + PopplerMovieTime *start) { - g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), time0); + g_return_if_fail (POPPLER_IS_MOVIE (poppler_movie)); - return poppler_movie->start; + *start = poppler_movie->start; } -PopplerMovieTime -poppler_movie_get_duration (PopplerMovie *poppler_movie) +/** + * poppler_movie_get_duration: + * @poppler_movie: a #PopplerMovie + * @duration: (out): a return location for a #PopplerMovieTime + * + * Obtains the duration of the movie playback + * + * Since: 0.79 + */ +void +poppler_movie_get_duration (PopplerMovie *poppler_movie, + PopplerMovieTime *duration) { - g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), time0); + g_return_if_fail (POPPLER_IS_MOVIE (poppler_movie)); - return poppler_movie->duration; + *duration = poppler_movie->duration; } diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index 0cb7bb20..e1960c1c 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -51,6 +51,15 @@ typedef enum POPPLER_MOVIE_PLAY_MODE_PALINDROME } PopplerMoviePlayMode; +/** + * PopplerMovieTime: + * + * Time-related entities (start position, duration); to get the equivalent + * value in seconds, calculate (double) units/units_per_second. Note that + * units_per_second may be zero if the respective entity is undefined. + * + * Since: 0.79 + */ typedef struct { gulong units; gint units_per_second; @@ -75,9 +84,11 @@ gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie); POPPLER_PUBLIC gushort poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie); POPPLER_PUBLIC -PopplerMovieTime poppler_movie_get_start (PopplerMovie *poppler_movie); +void poppler_movie_get_start (PopplerMovie *poppler_movie, + PopplerMovieTime *start); POPPLER_PUBLIC -PopplerMovieTime poppler_movie_get_duration (PopplerMovie *poppler_movie); +void poppler_movie_get_duration (PopplerMovie *poppler_movie, + PopplerMovieTime *duration); G_END_DECLS commit 9a65ab0f43bf3fe1c60da0a0657ccdbaddaba1e5 Author: Evgeny Stambulchik <[email protected]> Date: Fri Jul 5 01:11:25 2019 +0300 Update the Movie section in poppler-sections.txt diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt index d94abf22..e2f1276a 100644 --- a/glib/reference/poppler-sections.txt +++ b/glib/reference/poppler-sections.txt @@ -583,10 +583,17 @@ poppler_media_get_type <TITLE>Poppler Movie</TITLE> PopplerMovie PopplerMoviePlayMode +PopplerMovieTime +poppler_movie_get_duration poppler_movie_get_filename poppler_movie_get_play_mode +poppler_movie_get_rate +poppler_movie_get_rotation_angle +poppler_movie_get_start +poppler_movie_get_volume poppler_movie_need_poster poppler_movie_show_controls +poppler_movie_synchronous_play <SUBSECTION Standard> POPPLER_MOVIE commit 2f55f4cc10cc7544b1c564ef28f84d470b2dbe05 Author: Evgeny Stambulchik <[email protected]> Date: Thu Jun 20 00:07:07 2019 +0300 Implement missing Movie API's in the Glib bindings diff --git a/glib/demo/utils.c b/glib/demo/utils.c index 38bde147..40f541f7 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -564,6 +564,7 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, GtkWidget *button; GEnumValue *enum_value; gint row = 0; + PopplerMovieTime start, duration; table = gtk_bin_get_child (GTK_BIN (movie_view)); if (table) { @@ -590,7 +591,15 @@ pgd_movie_view_set_movie (GtkWidget *movie_view, 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); + pgd_table_add_property (GTK_GRID (table), "<b>Play Mode:</b>", enum_value->value_name, &row); + pgd_table_add_property (GTK_GRID (table), "<b>Synchronous Play:</b>", poppler_movie_synchronous_play (movie) ? "Yes" : "No", &row); + pgd_table_add_property (GTK_GRID (table), "<b>Volume:</b>", g_strdup_printf("%i", poppler_movie_get_volume (movie)), &row); + pgd_table_add_property (GTK_GRID (table), "<b>Rate:</b>", g_strdup_printf("%g", poppler_movie_get_rate (movie)), &row); + start = poppler_movie_get_start (movie); + pgd_table_add_property (GTK_GRID (table), "<b>Start:</b>", g_strdup_printf("%lu/%i s", start.units, start.units_per_second), &row); + duration = poppler_movie_get_duration (movie); + pgd_table_add_property (GTK_GRID (table), "<b>Duration:</b>", g_strdup_printf("%lu/%i s", duration.units, duration.units_per_second), &row); + pgd_table_add_property (GTK_GRID (table), "<b>Rotation Angle:</b>", g_strdup_printf("%u", poppler_movie_get_rotation_angle (movie)), &row); button = gtk_button_new_with_mnemonic ("_Play"); g_signal_connect (button, "clicked", diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index 999d1c40..f505ce07 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -38,6 +38,12 @@ struct _PopplerMovie gboolean need_poster; gboolean show_controls; PopplerMoviePlayMode mode; + gboolean synchronous_play; + gint volume; + gdouble rate; + PopplerMovieTime start; + PopplerMovieTime duration; + gushort rotation_angle; }; struct _PopplerMovieClass @@ -105,6 +111,20 @@ _poppler_movie_new (const Movie *poppler_movie) break; } + movie->synchronous_play = poppler_movie->getActivationParameters()->synchronousPlay; + + movie->volume = poppler_movie->getActivationParameters()->volume; + + movie->rate = poppler_movie->getActivationParameters()->rate; + + movie->start.units = poppler_movie->getActivationParameters()->start.units; + movie->start.units_per_second = poppler_movie->getActivationParameters()->start.units_per_second; + + movie->duration.units = poppler_movie->getActivationParameters()->duration.units; + movie->duration.units_per_second = poppler_movie->getActivationParameters()->duration.units_per_second; + + movie->rotation_angle = poppler_movie->getRotationAngle(); + return movie; } @@ -182,3 +202,87 @@ poppler_movie_get_play_mode (PopplerMovie *poppler_movie) return poppler_movie->mode; } + +/** + * poppler_movie_synchronous_play: + * @poppler_movie: a #PopplerMovie + * + * Returns whether the user must wait for the movie to be finished before + * the PDF viewer accepts any interactive action + * + * Return value: %TRUE if yes, %FALSE otherwise + */ +gboolean +poppler_movie_synchronous_play (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), FALSE); + + return poppler_movie->synchronous_play; +} + +/** + * poppler_movie_get_volume: + * @poppler_movie: a #PopplerMovie + * + * Returns the playback audio volume + * + * Return value: volume setting for the movie (0 - 100) + */ +gint +poppler_movie_get_volume (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0); + + return poppler_movie->volume; +} + +/** + * poppler_movie_get_rate: + * @poppler_movie: a #PopplerMovie + * + * Returns the relative speed of the movie + * + * Return value: the relative speed of the movie (1 means no change) + */ +gdouble +poppler_movie_get_rate (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0); + + return poppler_movie->rate; +} + +/** + * poppler_movie_get_rotation_angle: + * @poppler_movie: a #PopplerMovie + * + * Returns the rotation angle + * + * Return value: the number of degrees the movie should be rotated (positive, + * multiples of 90: 0, 90, 180, 270) + */ +gushort +poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), 0); + + return poppler_movie->rotation_angle; +} + +const static PopplerMovieTime time0 = {0, 0}; + +PopplerMovieTime +poppler_movie_get_start (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), time0); + + return poppler_movie->start; +} + +PopplerMovieTime +poppler_movie_get_duration (PopplerMovie *poppler_movie) +{ + g_return_val_if_fail (POPPLER_IS_MOVIE (poppler_movie), time0); + + return poppler_movie->duration; +} diff --git a/glib/poppler-movie.h b/glib/poppler-movie.h index 02c07650..0cb7bb20 100644 --- a/glib/poppler-movie.h +++ b/glib/poppler-movie.h @@ -51,6 +51,11 @@ typedef enum POPPLER_MOVIE_PLAY_MODE_PALINDROME } PopplerMoviePlayMode; +typedef struct { + gulong units; + gint units_per_second; +} PopplerMovieTime; + POPPLER_PUBLIC GType poppler_movie_get_type (void) G_GNUC_CONST; POPPLER_PUBLIC @@ -61,6 +66,18 @@ POPPLER_PUBLIC gboolean poppler_movie_show_controls (PopplerMovie *poppler_movie); POPPLER_PUBLIC PopplerMoviePlayMode poppler_movie_get_play_mode (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +gboolean poppler_movie_synchronous_play (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +gint poppler_movie_get_volume (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +gdouble poppler_movie_get_rate (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +gushort poppler_movie_get_rotation_angle (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +PopplerMovieTime poppler_movie_get_start (PopplerMovie *poppler_movie); +POPPLER_PUBLIC +PopplerMovieTime poppler_movie_get_duration (PopplerMovie *poppler_movie); G_END_DECLS _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
