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

Implement missing Movie API's in the Glib bindings

parent c6dbde14
......@@ -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",
......
......@@ -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;
}
......@@ -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
......
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