Commit fc79087f authored by Evgeny Stambulchik's avatar Evgeny Stambulchik Committed by Albert Astals Cid

Change time-related Movie glib API's to return time as out

Also, added Since: strings and completed missing API doc comments.
parent 9a65ab0f
......@@ -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);
......
......@@ -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;
}
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment