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.
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
24 #include "swfdec_sound_provider.h"
25 #include "swfdec_actor.h"
26 #include "swfdec_debug.h"
27 #include "swfdec_player_internal.h"
30 swfdec_sound_provider_base_init (gpointer klass
)
32 static gboolean initialized
= FALSE
;
34 if (G_UNLIKELY (!initialized
)) {
40 swfdec_sound_provider_get_type (void)
42 static GType sound_provider_type
= 0;
44 if (!sound_provider_type
) {
45 static const GTypeInfo sound_provider_info
= {
46 sizeof (SwfdecSoundProviderInterface
),
47 swfdec_sound_provider_base_init
,
57 sound_provider_type
= g_type_register_static (G_TYPE_INTERFACE
,
58 "SwfdecSoundProvider", &sound_provider_info
, 0);
59 g_type_interface_add_prerequisite (sound_provider_type
, G_TYPE_OBJECT
);
62 return sound_provider_type
;
66 swfdec_sound_provider_start (SwfdecSoundProvider
*provider
,
67 SwfdecActor
*actor
, gsize samples_offset
, guint loops
)
69 SwfdecSoundProviderInterface
*iface
;
71 g_return_if_fail (SWFDEC_IS_SOUND_PROVIDER (provider
));
72 g_return_if_fail (SWFDEC_IS_ACTOR (actor
));
73 g_return_if_fail (loops
> 0);
75 iface
= SWFDEC_SOUND_PROVIDER_GET_INTERFACE (provider
);
76 iface
->start (provider
, actor
, samples_offset
, loops
);
80 swfdec_sound_provider_stop (SwfdecSoundProvider
*provider
, SwfdecActor
*actor
)
82 SwfdecSoundProviderInterface
*iface
;
84 g_return_if_fail (SWFDEC_IS_SOUND_PROVIDER (provider
));
85 g_return_if_fail (SWFDEC_IS_ACTOR (actor
));
87 iface
= SWFDEC_SOUND_PROVIDER_GET_INTERFACE (provider
);
88 iface
->stop (provider
, actor
);
92 swfdec_sound_provider_get_matrix (SwfdecSoundProvider
*provider
)
94 SwfdecSoundProviderInterface
*iface
;
96 g_return_val_if_fail (SWFDEC_IS_SOUND_PROVIDER (provider
), NULL
);
98 iface
= SWFDEC_SOUND_PROVIDER_GET_INTERFACE (provider
);
99 return iface
->get_matrix (provider
);