1 | /* poppler-media.h: glib interface to MediaRendition |
2 | * |
3 | * Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org> |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2, or (at your option) |
8 | * any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef __POPPLER_MEDIA_H__ |
21 | #define __POPPLER_MEDIA_H__ |
22 | |
23 | #include <glib-object.h> |
24 | #include "poppler.h" |
25 | |
26 | G_BEGIN_DECLS |
27 | |
28 | #define POPPLER_TYPE_MEDIA (poppler_media_get_type()) |
29 | #define POPPLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_MEDIA, PopplerMedia)) |
30 | #define POPPLER_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_MEDIA)) |
31 | |
32 | /* FIXME: this should be generic (PopplerSaveToCallbackFunc) */ |
33 | |
34 | /** |
35 | * PopplerMediaSaveFunc: |
36 | * @buf: (array length=count) (element-type guint8): buffer containing |
37 | * bytes to be written. |
38 | * @count: number of bytes in @buf. |
39 | * @data: (closure): user data passed to poppler_media_save_to_callback() |
40 | * @error: GError to set on error, or %NULL |
41 | * |
42 | * Specifies the type of the function passed to |
43 | * poppler_media_save_to_callback(). It is called once for each block of |
44 | * bytes that is "written" by poppler_media_save_to_callback(). If |
45 | * successful it should return %TRUE. If an error occurs it should set |
46 | * @error and return %FALSE, in which case poppler_media_save_to_callback() |
47 | * will fail with the same error. |
48 | * |
49 | * Returns: %TRUE if successful, %FALSE (with @error set) if failed. |
50 | * |
51 | * Since: 0.14 |
52 | */ |
53 | typedef gboolean (*PopplerMediaSaveFunc)(const gchar *buf, gsize count, gpointer data, GError **error); |
54 | |
55 | POPPLER_PUBLIC |
56 | GType poppler_media_get_type(void) G_GNUC_CONST; |
57 | POPPLER_PUBLIC |
58 | gboolean poppler_media_is_embedded(PopplerMedia *poppler_media); |
59 | POPPLER_PUBLIC |
60 | const gchar *poppler_media_get_filename(PopplerMedia *poppler_media); |
61 | POPPLER_PUBLIC |
62 | const gchar *poppler_media_get_mime_type(PopplerMedia *poppler_media); |
63 | POPPLER_PUBLIC |
64 | gboolean poppler_media_get_auto_play(PopplerMedia *poppler_media); |
65 | POPPLER_PUBLIC |
66 | gboolean poppler_media_get_show_controls(PopplerMedia *poppler_media); |
67 | POPPLER_PUBLIC |
68 | gfloat poppler_media_get_repeat_count(PopplerMedia *poppler_media); |
69 | POPPLER_PUBLIC |
70 | gboolean poppler_media_save(PopplerMedia *poppler_media, const char *filename, GError **error); |
71 | #ifndef G_OS_WIN32 |
72 | POPPLER_PUBLIC |
73 | gboolean poppler_media_save_to_fd(PopplerMedia *poppler_media, int fd, GError **error); |
74 | #endif |
75 | POPPLER_PUBLIC |
76 | gboolean poppler_media_save_to_callback(PopplerMedia *poppler_media, PopplerMediaSaveFunc save_func, gpointer user_data, GError **error); |
77 | |
78 | G_END_DECLS |
79 | |
80 | #endif /* __POPPLER_MEDIA_H__ */ |
81 | |