fix build for --disable-gtk-doc
[swfdec.git] / swfdec / swfdec_video_provider.c
blobe5c7e0eab4446894b19839cd9a17d75876081416
1 /* Swfdec
2 * Copyright (C) 2008 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 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include "swfdec_video_provider.h"
25 #include "swfdec_debug.h"
26 #include "swfdec_loader_internal.h"
27 #include "swfdec_player_internal.h"
29 enum {
30 NEW_IMAGE,
31 LAST_SIGNAL
34 static guint signals[LAST_SIGNAL] = { 0, };
36 static void
37 swfdec_video_provider_base_init (gpointer klass)
39 static gboolean initialized = FALSE;
41 if (G_UNLIKELY (!initialized)) {
42 initialized = TRUE;
44 signals[NEW_IMAGE] = g_signal_new ("new-image", G_TYPE_FROM_CLASS (klass),
45 G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
46 G_TYPE_NONE, 0);
50 GType
51 swfdec_video_provider_get_type (void)
53 static GType video_provider_type = 0;
55 if (!video_provider_type) {
56 static const GTypeInfo video_provider_info = {
57 sizeof (SwfdecVideoProviderInterface),
58 swfdec_video_provider_base_init,
59 NULL,
60 NULL,
61 NULL,
62 NULL,
65 NULL,
68 video_provider_type = g_type_register_static (G_TYPE_INTERFACE,
69 "SwfdecVideoProvider", &video_provider_info, 0);
70 g_type_interface_add_prerequisite (video_provider_type, G_TYPE_OBJECT);
73 return video_provider_type;
76 cairo_surface_t *
77 swfdec_video_provider_get_image (SwfdecVideoProvider *provider,
78 SwfdecRenderer *renderer, guint *width, guint *height)
80 SwfdecVideoProviderInterface *iface;
82 g_return_val_if_fail (SWFDEC_IS_VIDEO_PROVIDER (provider), NULL);
83 g_return_val_if_fail (SWFDEC_IS_RENDERER (renderer), NULL);
84 g_return_val_if_fail (width != NULL, NULL);
85 g_return_val_if_fail (height != NULL, NULL);
87 iface = SWFDEC_VIDEO_PROVIDER_GET_INTERFACE (provider);
88 g_assert (iface->get_image != NULL);
89 return iface->get_image (provider, renderer, width, height);
92 guint
93 swfdec_video_provider_get_width (SwfdecVideoProvider *provider)
95 SwfdecVideoProviderInterface *iface;
96 guint w, h;
98 g_return_val_if_fail (SWFDEC_IS_VIDEO_PROVIDER (provider), 0);
100 iface = SWFDEC_VIDEO_PROVIDER_GET_INTERFACE (provider);
101 g_assert (iface->get_size != NULL);
102 iface->get_size (provider, &w, &h);
103 return w;
106 guint
107 swfdec_video_provider_get_height (SwfdecVideoProvider *provider)
109 SwfdecVideoProviderInterface *iface;
110 guint w, h;
112 g_return_val_if_fail (SWFDEC_IS_VIDEO_PROVIDER (provider), 0);
114 iface = SWFDEC_VIDEO_PROVIDER_GET_INTERFACE (provider);
115 g_assert (iface->get_size != NULL);
116 iface->get_size (provider, &w, &h);
117 return h;
120 void
121 swfdec_video_provider_set_ratio (SwfdecVideoProvider *provider, guint ratio)
123 SwfdecVideoProviderInterface *iface;
125 g_return_if_fail (SWFDEC_IS_VIDEO_PROVIDER (provider));
127 iface = SWFDEC_VIDEO_PROVIDER_GET_INTERFACE (provider);
128 if (iface->set_ratio != NULL)
129 iface->set_ratio (provider, ratio);
132 void
133 swfdec_video_provider_new_image (SwfdecVideoProvider *provider)
135 g_return_if_fail (SWFDEC_IS_VIDEO_PROVIDER (provider));
136 g_signal_emit (provider, signals[NEW_IMAGE], 0);