1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::MoviePlayMode;
use glib::translate::*;
use std::fmt;

glib::wrapper! {
    ///
    #[doc(alias = "PopplerMovie")]
    pub struct Movie(Object<ffi::PopplerMovie>);

    match fn {
        type_ => || ffi::poppler_movie_get_type(),
    }
}

impl Movie {
    /// Returns the duration of the movie playback
    ///
    /// # Returns
    ///
    /// the duration of the movie playback (in ns)
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_get_duration")]
    #[doc(alias = "get_duration")]
    pub fn duration(&self) -> u64 {
        unsafe { ffi::poppler_movie_get_duration(self.to_glib_none().0) }
    }

    /// Returns the local filename identifying a self-describing movie file
    ///
    /// # Returns
    ///
    /// a local filename, return value is owned by [`Movie`][crate::Movie] and
    ///  should not be freed
    #[doc(alias = "poppler_movie_get_filename")]
    #[doc(alias = "get_filename")]
    pub fn filename(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::poppler_movie_get_filename(self.to_glib_none().0)) }
    }

    /// Returns the play mode of `self`.
    ///
    /// # Returns
    ///
    /// a [`MoviePlayMode`][crate::MoviePlayMode].
    #[doc(alias = "poppler_movie_get_play_mode")]
    #[doc(alias = "get_play_mode")]
    pub fn play_mode(&self) -> MoviePlayMode {
        unsafe { from_glib(ffi::poppler_movie_get_play_mode(self.to_glib_none().0)) }
    }

    /// Returns the relative speed of the movie
    ///
    /// # Returns
    ///
    /// the relative speed of the movie (1 means no change)
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_get_rate")]
    #[doc(alias = "get_rate")]
    pub fn rate(&self) -> f64 {
        unsafe { ffi::poppler_movie_get_rate(self.to_glib_none().0) }
    }

    /// Returns the rotation angle
    ///
    /// # Returns
    ///
    /// the number of degrees the movie should be rotated (positive,
    /// multiples of 90: 0, 90, 180, 270)
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_get_rotation_angle")]
    #[doc(alias = "get_rotation_angle")]
    pub fn rotation_angle(&self) -> libc::c_ushort {
        unsafe { ffi::poppler_movie_get_rotation_angle(self.to_glib_none().0) }
    }

    /// Returns the start position of the movie playback
    ///
    /// # Returns
    ///
    /// the start position of the movie playback (in ns)
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_get_start")]
    #[doc(alias = "get_start")]
    pub fn start(&self) -> u64 {
        unsafe { ffi::poppler_movie_get_start(self.to_glib_none().0) }
    }

    /// Returns the playback audio volume
    ///
    /// # Returns
    ///
    /// volume setting for the movie (0.0 - 1.0)
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_get_volume")]
    #[doc(alias = "get_volume")]
    pub fn volume(&self) -> f64 {
        unsafe { ffi::poppler_movie_get_volume(self.to_glib_none().0) }
    }

    /// Returns whether the user must wait for the movie to be finished before
    /// the PDF viewer accepts any interactive action
    ///
    /// # Returns
    ///
    /// [`true`] if yes, [`false`] otherwise
    #[cfg(feature = "v0_80")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v0_80")))]
    #[doc(alias = "poppler_movie_is_synchronous")]
    pub fn is_synchronous(&self) -> bool {
        unsafe { from_glib(ffi::poppler_movie_is_synchronous(self.to_glib_none().0)) }
    }

    /// Returns whether a poster image representing the Movie
    /// shall be displayed. The poster image must be retrieved
    /// from the movie file.
    ///
    /// # Returns
    ///
    /// [`true`] if move needs a poster image, [`false`] otherwise
    #[doc(alias = "poppler_movie_need_poster")]
    pub fn need_poster(&self) -> bool {
        unsafe { from_glib(ffi::poppler_movie_need_poster(self.to_glib_none().0)) }
    }

    /// Returns whether to display a movie controller bar while playing the movie
    ///
    /// # Returns
    ///
    /// [`true`] if controller bar should be displayed, [`false`] otherwise
    #[doc(alias = "poppler_movie_show_controls")]
    pub fn show_controls(&self) -> bool {
        unsafe { from_glib(ffi::poppler_movie_show_controls(self.to_glib_none().0)) }
    }
}

impl fmt::Display for Movie {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("Movie")
    }
}