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

Use guint64 for time-related values of movie objects (in ns)

parent 764dd94a
......@@ -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");
......
......@@ -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;
}
......@@ -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
......
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