don't crash when loading images > 65kB (fixes #13529)
[swfdec.git] / libswfdec / swfdec_player.h
blob903eabbc9ae55e22ec38094ad28d005b67275d5a
1 /* Swfdec
2 * Copyright (C) 2006-2007 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_PLAYER_H_
21 #define _SWFDEC_PLAYER_H_
23 #include <glib-object.h>
24 #include <cairo.h>
25 #include <libswfdec/swfdec_as_types.h>
26 #include <libswfdec/swfdec_loader.h>
28 G_BEGIN_DECLS
30 typedef enum {
31 SWFDEC_MOUSE_CURSOR_NORMAL,
32 SWFDEC_MOUSE_CURSOR_NONE,
33 SWFDEC_MOUSE_CURSOR_TEXT,
34 SWFDEC_MOUSE_CURSOR_CLICK
35 } SwfdecMouseCursor;
37 typedef enum {
38 SWFDEC_ALIGNMENT_TOP_LEFT,
39 SWFDEC_ALIGNMENT_TOP,
40 SWFDEC_ALIGNMENT_TOP_RIGHT,
41 SWFDEC_ALIGNMENT_LEFT,
42 SWFDEC_ALIGNMENT_CENTER,
43 SWFDEC_ALIGNMENT_RIGHT,
44 SWFDEC_ALIGNMENT_BOTTOM_LEFT,
45 SWFDEC_ALIGNMENT_BOTTOM,
46 SWFDEC_ALIGNMENT_BOTTOM_RIGHT
47 } SwfdecAlignment;
49 typedef enum {
50 SWFDEC_SCALE_SHOW_ALL,
51 SWFDEC_SCALE_NO_BORDER,
52 SWFDEC_SCALE_EXACT_FIT,
53 SWFDEC_SCALE_NONE
54 } SwfdecScaleMode;
56 typedef struct _SwfdecPlayer SwfdecPlayer;
57 typedef struct _SwfdecPlayerClass SwfdecPlayerClass;
59 #define SWFDEC_TYPE_PLAYER (swfdec_player_get_type())
60 #define SWFDEC_IS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_PLAYER))
61 #define SWFDEC_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_PLAYER))
62 #define SWFDEC_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_PLAYER, SwfdecPlayer))
63 #define SWFDEC_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_PLAYER, SwfdecPlayerClass))
64 #define SWFDEC_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_PLAYER, SwfdecPlayerClass))
66 void swfdec_init (void);
68 GType swfdec_player_get_type (void);
70 SwfdecPlayer * swfdec_player_new (SwfdecAsDebugger * debugger);
71 SwfdecPlayer * swfdec_player_new_from_file (const char * filename);
72 void swfdec_player_set_loader (SwfdecPlayer * player,
73 SwfdecLoader * loader);
74 void swfdec_player_set_loader_with_variables
75 (SwfdecPlayer * player,
76 SwfdecLoader * loader,
77 const char * variables);
79 gboolean swfdec_player_is_initialized (SwfdecPlayer * player);
80 glong swfdec_player_get_next_event (SwfdecPlayer * player);
81 double swfdec_player_get_rate (SwfdecPlayer * player);
82 void swfdec_player_get_default_size (SwfdecPlayer * player,
83 guint * width,
84 guint * height);
85 void swfdec_player_get_size (SwfdecPlayer * player,
86 int * width,
87 int * height);
88 void swfdec_player_set_size (SwfdecPlayer * player,
89 int width,
90 int height);
91 guint swfdec_player_get_background_color
92 (SwfdecPlayer * player);
93 void swfdec_player_set_background_color
94 (SwfdecPlayer * player,
95 guint color);
96 SwfdecScaleMode swfdec_player_get_scale_mode (SwfdecPlayer * player);
97 void swfdec_player_set_scale_mode (SwfdecPlayer * player,
98 SwfdecScaleMode mode);
99 SwfdecAlignment swfdec_player_get_alignment (SwfdecPlayer * player);
100 void swfdec_player_set_alignment (SwfdecPlayer * player,
101 SwfdecAlignment align);
102 gulong swfdec_player_get_maximum_runtime
103 (SwfdecPlayer * player);
104 void swfdec_player_set_maximum_runtime
105 (SwfdecPlayer * player,
106 gulong msecs);
108 void swfdec_player_render (SwfdecPlayer * player,
109 cairo_t * cr,
110 double x,
111 double y,
112 double width,
113 double height);
114 void swfdec_player_advance (SwfdecPlayer * player,
115 gulong msecs);
116 gboolean swfdec_player_mouse_move (SwfdecPlayer * player,
117 double x,
118 double y);
119 gboolean swfdec_player_mouse_press (SwfdecPlayer * player,
120 double x,
121 double y,
122 guint button);
123 gboolean swfdec_player_mouse_release (SwfdecPlayer * player,
124 double x,
125 double y,
126 guint button);
127 gboolean swfdec_player_key_press (SwfdecPlayer * player,
128 guint keycode,
129 guint character);
130 gboolean swfdec_player_key_release (SwfdecPlayer * player,
131 guint keycode,
132 guint character);
133 /* audio - see swfdec_audio.c */
134 void swfdec_player_render_audio (SwfdecPlayer * player,
135 gint16 * dest,
136 guint start_offset,
137 guint n_samples);
138 const GList * swfdec_player_get_audio (SwfdecPlayer * player);
140 G_END_DECLS
141 #endif