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 40f541f..eae3e89 100644
--- a/glib/demo/utils.c
+++ b/glib/demo/utils.c
@@ -595,9 +595,9 @@
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 f505ce0..989f3a9 100644
--- a/glib/poppler-movie.cc
+++ b/glib/poppler-movie.cc
@@ -211,6 +211,8 @@
* 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 @@
* 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 @@
* 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 @@
*
* 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 @@
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 0cb7bb2..e1960c1 100644
--- a/glib/poppler-movie.h
+++ b/glib/poppler-movie.h
@@ -51,6 +51,15 @@
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 @@
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