1 | //********************************************************************************* |
2 | // Movie.h |
3 | //--------------------------------------------------------------------------------- |
4 | // |
5 | //--------------------------------------------------------------------------------- |
6 | // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008 |
7 | // Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010 |
8 | // Albert Astals Cid <aacid@kde.org> (c) 2017-2019, 2021, 2022 |
9 | // |
10 | // This program is free software; you can redistribute it and/or modify |
11 | // it under the terms of the GNU General Public License as published by |
12 | // the Free Software Foundation; either version 2 of the License, or |
13 | // (at your option) any later version. |
14 | // |
15 | // This program is distributed in the hope that it will be useful, |
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | // GNU General Public License for more details. |
19 | // |
20 | // You should have received a copy of the GNU General Public License |
21 | // along with this program; if not, write to the Free Software |
22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | //********************************************************************************* |
24 | |
25 | #ifndef _MOVIE_H_ |
26 | #define _MOVIE_H_ |
27 | |
28 | #include "Object.h" |
29 | #include "poppler_private_export.h" |
30 | |
31 | #include <memory> |
32 | |
33 | struct MovieActivationParameters |
34 | { |
35 | |
36 | MovieActivationParameters(); |
37 | ~MovieActivationParameters(); |
38 | |
39 | // parse from a "Movie Activation" dictionary |
40 | void parseMovieActivation(const Object *aDict); |
41 | |
42 | enum MovieRepeatMode |
43 | { |
44 | repeatModeOnce, |
45 | repeatModeOpen, |
46 | repeatModeRepeat, |
47 | repeatModePalindrome |
48 | }; |
49 | |
50 | struct MovieTime |
51 | { |
52 | MovieTime() { units_per_second = 0; } |
53 | unsigned long units; |
54 | int units_per_second; // 0 : defined by movie |
55 | }; |
56 | |
57 | MovieTime start; // 0 |
58 | MovieTime duration; // 0 |
59 | |
60 | double rate; // 1.0 |
61 | |
62 | int volume; // 100 |
63 | |
64 | bool showControls; // false |
65 | |
66 | bool synchronousPlay; // false |
67 | MovieRepeatMode repeatMode; // repeatModeOnce |
68 | |
69 | // floating window position |
70 | bool floatingWindow; |
71 | double xPosition; // 0.5 |
72 | double yPosition; // 0.5 |
73 | int znum; // 1 |
74 | int zdenum; // 1 |
75 | }; |
76 | |
77 | class POPPLER_PRIVATE_EXPORT Movie |
78 | { |
79 | public: |
80 | Movie(const Object *movieDict, const Object *aDict); |
81 | explicit Movie(const Object *movieDict); |
82 | Movie(const Movie &other); |
83 | ~Movie(); |
84 | Movie &operator=(const Movie &) = delete; |
85 | |
86 | bool isOk() const { return ok; } |
87 | const MovieActivationParameters *getActivationParameters() const { return &MA; } |
88 | |
89 | const GooString *getFileName() const { return fileName; } |
90 | |
91 | unsigned short getRotationAngle() const { return rotationAngle; } |
92 | void getAspect(int *widthA, int *heightA) const |
93 | { |
94 | *widthA = width; |
95 | *heightA = height; |
96 | } |
97 | |
98 | Object getPoster() const { return poster.copy(); } |
99 | bool getShowPoster() const { return showPoster; } |
100 | |
101 | bool getUseFloatingWindow() const { return MA.floatingWindow; } |
102 | void getFloatingWindowSize(int *width, int *height); |
103 | |
104 | std::unique_ptr<Movie> copy() const; |
105 | |
106 | private: |
107 | void parseMovie(const Object *movieDict); |
108 | |
109 | bool ok; |
110 | |
111 | unsigned short rotationAngle; // 0 |
112 | int width; // Aspect |
113 | int height; // Aspect |
114 | |
115 | Object poster; |
116 | bool showPoster; |
117 | |
118 | GooString *fileName; |
119 | |
120 | MovieActivationParameters MA; |
121 | }; |
122 | |
123 | #endif |
124 | |