[Swfdec] libswfdec-gtk/swfdec_gtk_player.c libswfdec/swfdec_as_date.c libswfdec/swfdec_audio.c libswfdec/swfdec_audio_event.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_interval.c libswfdec/swfdec_key_as.c libswfdec/swfdec_mouse_as.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_policy_loader.c libswfdec/swfdec_resource.c libswfdec/swfdec_resource_request.c libswfdec/swfdec_sound_object.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite_movie_as.c libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_stage_as.c libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_system_as.c libswfdec/swfdec_system_security.c libswfdec/swfdec_video_movie_as.c libswfdec/swfdec_video_movie.c test/dump.c test/swfdec-extract.c
Benjamin Otte
company at kemper.freedesktop.org
Thu Dec 13 02:09:20 PST 2007
libswfdec-gtk/swfdec_gtk_player.c | 1
libswfdec/swfdec_as_date.c | 7
libswfdec/swfdec_audio.c | 10
libswfdec/swfdec_audio_event.c | 2
libswfdec/swfdec_button_movie.c | 2
libswfdec/swfdec_interval.c | 14
libswfdec/swfdec_key_as.c | 6
libswfdec/swfdec_mouse_as.c | 8
libswfdec/swfdec_movie.c | 34 -
libswfdec/swfdec_net_stream.c | 2
libswfdec/swfdec_player.c | 777 +++++++++++++++++++-----------------
libswfdec/swfdec_player.h | 25 +
libswfdec/swfdec_player_internal.h | 24 -
libswfdec/swfdec_policy_loader.c | 2
libswfdec/swfdec_resource.c | 8
libswfdec/swfdec_resource_request.c | 24 -
libswfdec/swfdec_sound_object.c | 2
libswfdec/swfdec_sprite.c | 15
libswfdec/swfdec_sprite_movie.c | 4
libswfdec/swfdec_sprite_movie_as.c | 7
libswfdec/swfdec_stage_as.c | 19
libswfdec/swfdec_swf_decoder.c | 2
libswfdec/swfdec_system_as.c | 24 -
libswfdec/swfdec_system_security.c | 2
libswfdec/swfdec_video_movie.c | 2
libswfdec/swfdec_video_movie_as.c | 2
test/dump.c | 6
test/swfdec-extract.c | 6
28 files changed, 568 insertions(+), 469 deletions(-)
New commits:
commit 9eb2e0de2296d01f79fa3ac25c536aeb404b7d1c
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Dec 13 10:05:57 2007 +0100
export SwfdecPlayer structure
This patch adds a SwfdecPlayerPrivate structure that contains all the player
elements, as is usual in exported GObjects. Exporting SwfdecPlayer is necessary
for creating subclasses in swfdec-gtk or (the new) swfdec-directfb, that can't
depend on private headers.
diff --git a/libswfdec-gtk/swfdec_gtk_player.c b/libswfdec-gtk/swfdec_gtk_player.c
index 485f708..c494a71 100644
--- a/libswfdec-gtk/swfdec_gtk_player.c
+++ b/libswfdec-gtk/swfdec_gtk_player.c
@@ -21,7 +21,6 @@
#include "config.h"
#endif
-#include <libswfdec/swfdec_player_internal.h>
#include "libswfdec-gtk/swfdec_gtk_loader.h"
#include "libswfdec-gtk/swfdec_gtk_player.h"
#include "libswfdec-gtk/swfdec_playback.h"
diff --git a/libswfdec/swfdec_as_date.c b/libswfdec/swfdec_as_date.c
index 148e61d..648b50f 100644
--- a/libswfdec/swfdec_as_date.c
+++ b/libswfdec/swfdec_as_date.c
@@ -1036,8 +1036,11 @@ swfdec_as_date_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
date = SWFDEC_AS_DATE (object);
- date->utc_offset =
- SWFDEC_PLAYER (SWFDEC_AS_OBJECT (date)->context)->system->utc_offset;
+ /* FIXME: find a general solution here */
+ if (SWFDEC_IS_PLAYER (SWFDEC_AS_OBJECT (date)->context)) {
+ date->utc_offset =
+ SWFDEC_PLAYER (SWFDEC_AS_OBJECT (date)->context)->priv->system->utc_offset;
+ }
// don't accept arguments when not constructing
if (!cx->frame->construct)
diff --git a/libswfdec/swfdec_audio.c b/libswfdec/swfdec_audio.c
index f94ea53..e9a5e5f 100644
--- a/libswfdec/swfdec_audio.c
+++ b/libswfdec/swfdec_audio.c
@@ -92,6 +92,8 @@ swfdec_audio_init (SwfdecAudio *audio)
void
swfdec_audio_add (SwfdecAudio *audio, SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_AUDIO (audio));
g_return_if_fail (audio->player == NULL);
if (player == NULL)
@@ -100,7 +102,8 @@ swfdec_audio_add (SwfdecAudio *audio, SwfdecPlayer *player)
g_object_ref (audio);
audio->player = player;
- player->audio = g_list_append (player->audio, audio);
+ priv = player->priv;
+ priv->audio = g_list_append (priv->audio, audio);
SWFDEC_INFO ("adding %s %p", G_OBJECT_TYPE_NAME (audio), audio);
}
@@ -110,8 +113,9 @@ swfdec_audio_remove (SwfdecAudio *audio)
g_return_if_fail (SWFDEC_IS_AUDIO (audio));
if (audio->player != NULL) {
+ SwfdecPlayerPrivate *priv = audio->player->priv;
SWFDEC_INFO ("removing %s %p", G_OBJECT_TYPE_NAME (audio), audio);
- audio->player->audio = g_list_remove (audio->player->audio, audio);
+ priv->audio = g_list_remove (priv->audio, audio);
if (audio->added) {
g_signal_emit_by_name (audio->player, "audio-removed", audio);
audio->added = FALSE;
@@ -197,7 +201,7 @@ swfdec_player_render_audio (SwfdecPlayer *player, gint16* dest,
g_return_if_fail (n_samples > 0);
SWFDEC_LOG ("rendering offset %u, samples %u", start_offset, n_samples);
- for (walk = player->audio; walk; walk = walk->next) {
+ for (walk = player->priv->audio; walk; walk = walk->next) {
audio = walk->data;
swfdec_audio_render (audio, dest, start_offset, n_samples);
}
diff --git a/libswfdec/swfdec_audio_event.c b/libswfdec/swfdec_audio_event.c
index 4f7ee5c..fc05dcd 100644
--- a/libswfdec/swfdec_audio_event.c
+++ b/libswfdec/swfdec_audio_event.c
@@ -271,7 +271,7 @@ swfdec_audio_event_get (SwfdecPlayer *player, SwfdecSound *sound)
if (player == NULL)
return NULL;
- for (walk = player->audio; walk; walk = walk->next) {
+ for (walk = player->priv->audio; walk; walk = walk->next) {
SwfdecAudio *audio = walk->data;
if (!SWFDEC_IS_AUDIO_EVENT (audio))
continue;
diff --git a/libswfdec/swfdec_button_movie.c b/libswfdec/swfdec_button_movie.c
index 1c9e1e3..e7ccdba 100644
--- a/libswfdec/swfdec_button_movie.c
+++ b/libswfdec/swfdec_button_movie.c
@@ -208,7 +208,7 @@ swfdec_button_movie_mouse_release (SwfdecMovie *movie, guint button)
if (button != 0)
return;
player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- if (player->mouse_below == movie) {
+ if (player->priv->mouse_below == movie) {
swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_OVER);
SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_release (movie, button);
diff --git a/libswfdec/swfdec_interval.c b/libswfdec/swfdec_interval.c
index 59f3ea7..1d98b2b 100644
--- a/libswfdec/swfdec_interval.c
+++ b/libswfdec/swfdec_interval.c
@@ -93,7 +93,7 @@ swfdec_interval_trigger (SwfdecTimeout *timeout)
timeout->timestamp += SWFDEC_MSECS_TO_TICKS (interval->msecs);
swfdec_player_add_timeout (SWFDEC_PLAYER (context), timeout);
} else {
- player->intervals = g_list_remove (player->intervals, interval);
+ player->priv->intervals = g_list_remove (player->priv->intervals, interval);
interval->timeout.callback = NULL;
}
if (interval->fun_name) {
@@ -122,19 +122,19 @@ swfdec_interval_new (SwfdecPlayer *player, guint msecs, gboolean repeat,
interval = g_object_new (SWFDEC_TYPE_INTERVAL, NULL);
swfdec_as_object_add (SWFDEC_AS_OBJECT (interval), context, size);
- interval->id = ++player->interval_id;
+ interval->id = ++player->priv->interval_id;
interval->msecs = msecs;
interval->repeat = repeat;
interval->object = object;
interval->fun_name = fun_name;
interval->n_args = n_args;
interval->args = g_memdup (args, n_args * sizeof (SwfdecAsValue));
- interval->timeout.timestamp = player->time + SWFDEC_MSECS_TO_TICKS (interval->msecs);
+ interval->timeout.timestamp = player->priv->time + SWFDEC_MSECS_TO_TICKS (interval->msecs);
interval->timeout.callback = swfdec_interval_trigger;
swfdec_player_add_timeout (player, &interval->timeout);
- player->intervals =
- g_list_prepend (player->intervals, interval);
+ player->priv->intervals =
+ g_list_prepend (player->priv->intervals, interval);
return interval->id;
}
@@ -172,12 +172,12 @@ swfdec_interval_remove (SwfdecPlayer *player, guint id)
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- for (walk = player->intervals; walk; walk = walk->next) {
+ for (walk = player->priv->intervals; walk; walk = walk->next) {
SwfdecInterval *interval = walk->data;
if (interval->id != id)
continue;
- player->intervals = g_list_delete_link (player->intervals, walk);
+ player->priv->intervals = g_list_delete_link (player->priv->intervals, walk);
swfdec_player_remove_timeout (player, &interval->timeout);
interval->timeout.callback = NULL;
return;
diff --git a/libswfdec/swfdec_key_as.c b/libswfdec/swfdec_key_as.c
index 3303249..ca7a949 100644
--- a/libswfdec/swfdec_key_as.c
+++ b/libswfdec/swfdec_key_as.c
@@ -34,7 +34,7 @@ swfdec_key_getAscii (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (retval, player->last_character);
+ SWFDEC_AS_VALUE_SET_INT (retval, player->priv->last_character);
}
SWFDEC_AS_NATIVE (800, 1, swfdec_key_getCode)
@@ -44,7 +44,7 @@ swfdec_key_getCode (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (retval, player->last_keycode);
+ SWFDEC_AS_VALUE_SET_INT (retval, player->priv->last_keycode);
}
SWFDEC_AS_NATIVE (800, 2, swfdec_key_isDown)
@@ -63,7 +63,7 @@ swfdec_key_isDown (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_FIXME ("id %u too big for a keycode", id);
id %= 256;
}
- SWFDEC_AS_VALUE_SET_BOOLEAN (retval, (player->key_pressed[id / 8] & (1 << (id % 8))) ? TRUE : FALSE);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (retval, (player->priv->key_pressed[id / 8] & (1 << (id % 8))) ? TRUE : FALSE);
}
SWFDEC_AS_NATIVE (800, 3, swfdec_key_isToggled)
diff --git a/libswfdec/swfdec_mouse_as.c b/libswfdec/swfdec_mouse_as.c
index 914e009..88ee046 100644
--- a/libswfdec/swfdec_mouse_as.c
+++ b/libswfdec/swfdec_mouse_as.c
@@ -34,8 +34,8 @@ swfdec_mouse_show (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (retval, player->mouse_visible ? 1 : 0);
- player->mouse_visible = TRUE;
+ SWFDEC_AS_VALUE_SET_INT (retval, player->priv->mouse_visible ? 1 : 0);
+ player->priv->mouse_visible = TRUE;
}
SWFDEC_AS_NATIVE (5, 1, swfdec_mouse_hide)
@@ -45,7 +45,7 @@ swfdec_mouse_hide (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (retval, player->mouse_visible ? 1 : 0);
- player->mouse_visible = FALSE;
+ SWFDEC_AS_VALUE_SET_INT (retval, player->priv->mouse_visible ? 1 : 0);
+ player->priv->mouse_visible = FALSE;
}
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 92a0edb..8cdfd80 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -305,6 +305,7 @@ swfdec_movie_find (SwfdecMovie *movie, int depth)
static gboolean
swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
{
+ SwfdecPlayerPrivate *priv;
SwfdecPlayer *player;
SWFDEC_LOG ("removing %s %s", G_OBJECT_TYPE_NAME (movie), movie->name);
@@ -319,10 +320,11 @@ swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
destroy &= swfdec_movie_do_remove (walk->data, destroy);
}
/* FIXME: all of this here or in destroy callback? */
- if (player->mouse_grab == movie)
- player->mouse_grab = NULL;
- if (player->mouse_drag == movie)
- player->mouse_drag = NULL;
+ priv = player->priv;
+ if (priv->mouse_grab == movie)
+ priv->mouse_grab = NULL;
+ if (priv->mouse_drag == movie)
+ priv->mouse_drag = NULL;
swfdec_movie_invalidate_last (movie);
movie->state = SWFDEC_MOVIE_STATE_REMOVED;
@@ -380,7 +382,7 @@ swfdec_movie_destroy (SwfdecMovie *movie)
if (movie->parent) {
movie->parent->list = g_list_remove (movie->parent->list, movie);
} else {
- player->roots = g_list_remove (player->roots, movie);
+ player->priv->roots = g_list_remove (player->priv->roots, movie);
}
/* unset masks */
if (movie->masked_by)
@@ -394,7 +396,7 @@ swfdec_movie_destroy (SwfdecMovie *movie)
swfdec_player_remove_all_actions (player, movie);
if (klass->finish_movie)
klass->finish_movie (movie);
- player->movies = g_list_remove (player->movies, movie);
+ player->priv->movies = g_list_remove (player->priv->movies, movie);
movie->state = SWFDEC_MOVIE_STATE_DESTROYED;
/* unset prototype here, so we don't work in AS anymore */
SWFDEC_AS_OBJECT (movie)->prototype = NULL;
@@ -422,7 +424,7 @@ swfdec_movie_set_constructor (SwfdecSpriteMovie *movie)
}
}
if (constructor == NULL)
- constructor = SWFDEC_PLAYER (context)->MovieClip;
+ constructor = SWFDEC_PLAYER (context)->priv->MovieClip;
swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), constructor);
}
@@ -675,8 +677,8 @@ swfdec_movie_get_mouse (SwfdecMovie *movie, double *x, double *y)
g_return_if_fail (y != NULL);
player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- *x = player->mouse_x;
- *y = player->mouse_y;
+ *x = player->priv->mouse_x;
+ *y = player->priv->mouse_y;
swfdec_player_stage_to_global (player, x, y);
swfdec_movie_global_to_local (movie, x, y);
}
@@ -1076,7 +1078,7 @@ swfdec_movie_get_by_name (SwfdecMovie *movie, const char *name, gboolean unnamed
if (errno != 0 || *end != 0 || l > G_MAXINT)
return NULL;
i = l - 16384;
- for (walk = player->roots; walk; walk = walk->next) {
+ for (walk = player->priv->roots; walk; walk = walk->next) {
SwfdecMovie *cur = walk->data;
if (cur->depth < i)
continue;
@@ -1133,7 +1135,7 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
}
if (movie->parent == NULL && variable == SWFDEC_AS_STR__version) {
SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_get_string (object->context,
- SWFDEC_PLAYER (object->context)->system->version));
+ SWFDEC_PLAYER (object->context)->priv->system->version));
*flags = 0;
return TRUE;
}
@@ -1391,7 +1393,7 @@ swfdec_movie_mouse_release (SwfdecMovie *movie, guint button)
return;
player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- if (player->mouse_below == movie)
+ if (player->priv->mouse_below == movie)
swfdec_movie_queue_script (movie, SWFDEC_EVENT_RELEASE);
else
swfdec_movie_queue_script (movie, SWFDEC_EVENT_RELEASE_OUTSIDE);
@@ -1481,7 +1483,7 @@ swfdec_movie_set_depth (SwfdecMovie *movie, int depth)
if (movie->parent) {
movie->parent->list = g_list_sort (movie->parent->list, swfdec_movie_compare_depths);
} else {
- SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
+ SwfdecPlayerPrivate *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context)->priv;
player->roots = g_list_sort (player->roots, swfdec_movie_compare_depths);
}
g_object_notify (G_OBJECT (movie), "depth");
@@ -1546,7 +1548,7 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
/* invalidate the parent, so it gets visible */
swfdec_movie_queue_update (parent, SWFDEC_MOVIE_INVALID_CHILDREN);
} else {
- player->roots = g_list_insert_sorted (player->roots, movie, swfdec_movie_compare_depths);
+ player->priv->roots = g_list_insert_sorted (player->priv->roots, movie, swfdec_movie_compare_depths);
}
/* set its name */
if (name) {
@@ -1556,7 +1558,7 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
movie->original_name = SWFDEC_AS_STR_EMPTY;
if (SWFDEC_IS_SPRITE_MOVIE (movie) || SWFDEC_IS_BUTTON_MOVIE (movie)) {
movie->name = swfdec_as_context_give_string (SWFDEC_AS_CONTEXT (player),
- g_strdup_printf ("instance%u", ++player->unnamed_count));
+ g_strdup_printf ("instance%u", ++player->priv->unnamed_count));
} else {
movie->name = SWFDEC_AS_STR_EMPTY;
}
@@ -1566,7 +1568,7 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
* Setting the parent does a gotoAndPlay(0) for Sprites which can cause
* new movies to be created (and added to this list)
*/
- player->movies = g_list_prepend (player->movies, movie);
+ player->priv->movies = g_list_prepend (player->priv->movies, movie);
/* only add the movie here, because it needs to be setup for the debugger */
swfdec_as_object_add (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_CONTEXT (player), size);
/* only setup here, the resource assumes it can access the player via the movie */
diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c
index 35c8c8e..cc821de 100644
--- a/libswfdec/swfdec_net_stream.c
+++ b/libswfdec/swfdec_net_stream.c
@@ -193,7 +193,7 @@ swfdec_net_stream_update_playing (SwfdecNetStream *stream)
if (should_play && stream->timeout.callback == NULL) {
SWFDEC_DEBUG ("starting playback");
stream->timeout.callback = swfdec_net_stream_timeout;
- stream->timeout.timestamp = player->time + SWFDEC_MSECS_TO_TICKS (stream->next_time - stream->current_time);
+ stream->timeout.timestamp = player->priv->time + SWFDEC_MSECS_TO_TICKS (stream->next_time - stream->current_time);
swfdec_player_add_timeout (player, &stream->timeout);
if (stream->flvdecoder->audio) {
g_assert (stream->audio == NULL);
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 2c5f47c..efe2798 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -242,8 +242,10 @@
static SwfdecTick
swfdec_player_get_next_event_time (SwfdecPlayer *player)
{
- if (player->timeouts) {
- return ((SwfdecTimeout *) player->timeouts->data)->timestamp - player->time;
+ SwfdecPlayerPrivate *priv = player->priv;
+
+ if (priv->timeouts) {
+ return ((SwfdecTimeout *) priv->timeouts->data)->timestamp - priv->time;
} else {
return G_MAXUINT64;
}
@@ -277,24 +279,26 @@ swfdec_player_get_next_event_time (SwfdecPlayer *player)
void
swfdec_player_add_timeout (SwfdecPlayer *player, SwfdecTimeout *timeout)
{
+ SwfdecPlayerPrivate *priv;
GList *walk;
SwfdecTick next_tick;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (timeout != NULL);
- g_return_if_fail (timeout->timestamp >= player->time);
+ g_return_if_fail (timeout->timestamp >= player->priv->time);
g_return_if_fail (timeout->callback != NULL);
+ priv = player->priv;
SWFDEC_LOG ("adding timeout %p in %"G_GUINT64_FORMAT" msecs", timeout,
- SWFDEC_TICKS_TO_MSECS (timeout->timestamp - player->time));
+ SWFDEC_TICKS_TO_MSECS (timeout->timestamp - priv->time));
next_tick = swfdec_player_get_next_event_time (player);
/* the order is important, on events with the same time, we make sure the new one is last */
- for (walk = player->timeouts; walk; walk = walk->next) {
+ for (walk = priv->timeouts; walk; walk = walk->next) {
SwfdecTimeout *cur = walk->data;
if (cur->timestamp > timeout->timestamp)
break;
}
- player->timeouts = g_list_insert_before (player->timeouts, walk, timeout);
+ priv->timeouts = g_list_insert_before (priv->timeouts, walk, timeout);
if (next_tick != swfdec_player_get_next_event_time (player))
g_object_notify (G_OBJECT (player), "next-event");
}
@@ -310,16 +314,18 @@ swfdec_player_add_timeout (SwfdecPlayer *player, SwfdecTimeout *timeout)
void
swfdec_player_remove_timeout (SwfdecPlayer *player, SwfdecTimeout *timeout)
{
+ SwfdecPlayerPrivate *priv;
SwfdecTick next_tick;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (timeout != NULL);
- g_return_if_fail (timeout->timestamp >= player->time);
+ g_return_if_fail (timeout->timestamp >= player->priv->time);
g_return_if_fail (timeout->callback != NULL);
SWFDEC_LOG ("removing timeout %p", timeout);
+ priv = player->priv;
next_tick = swfdec_player_get_next_event_time (player);
- player->timeouts = g_list_remove (player->timeouts, timeout);
+ priv->timeouts = g_list_remove (priv->timeouts, timeout);
if (next_tick != swfdec_player_get_next_event_time (player))
g_object_notify (G_OBJECT (player), "next-event");
}
@@ -364,18 +370,19 @@ swfdec_player_compress_actions (SwfdecRingBuffer *buffer)
static void
swfdec_player_do_add_action (SwfdecPlayer *player, guint importance, SwfdecPlayerAction *act)
{
- SwfdecPlayerAction *action = swfdec_ring_buffer_push (player->actions[importance]);
+ SwfdecPlayerPrivate *priv = player->priv;
+ SwfdecPlayerAction *action = swfdec_ring_buffer_push (priv->actions[importance]);
if (action == NULL) {
/* try to get rid of freed actions */
- swfdec_player_compress_actions (player->actions[importance]);
- action = swfdec_ring_buffer_push (player->actions[importance]);
+ swfdec_player_compress_actions (priv->actions[importance]);
+ action = swfdec_ring_buffer_push (priv->actions[importance]);
if (action == NULL) {
- if (swfdec_ring_buffer_get_size (player->actions[importance]) == 256) {
+ if (swfdec_ring_buffer_get_size (priv->actions[importance]) == 256) {
SWFDEC_WARNING ("256 levels of recursion were exceeded in one action list.");
}
- swfdec_ring_buffer_set_size (player->actions[importance],
- swfdec_ring_buffer_get_size (player->actions[importance]) + 16);
- action = swfdec_ring_buffer_push (player->actions[importance]);
+ swfdec_ring_buffer_set_size (priv->actions[importance],
+ swfdec_ring_buffer_get_size (priv->actions[importance]) + 16);
+ action = swfdec_ring_buffer_push (priv->actions[importance]);
g_assert (action);
}
}
@@ -435,14 +442,16 @@ void
swfdec_player_remove_all_actions (SwfdecPlayer *player, SwfdecMovie *movie)
{
SwfdecPlayerAction *action;
+ SwfdecPlayerPrivate *priv;
guint i, j;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (SWFDEC_IS_MOVIE (movie));
+ priv = player->priv;
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
- for (j = 0; j < swfdec_ring_buffer_get_n_elements (player->actions[i]); j++) {
- action = swfdec_ring_buffer_peek_nth (player->actions[i], j);
+ for (j = 0; j < swfdec_ring_buffer_get_n_elements (priv->actions[i]); j++) {
+ action = swfdec_ring_buffer_peek_nth (priv->actions[i], j);
if (action->movie == movie) {
SWFDEC_LOG ("removing action %p %u",
@@ -457,11 +466,13 @@ static gboolean
swfdec_player_do_action (SwfdecPlayer *player)
{
SwfdecPlayerAction *action;
+ SwfdecPlayerPrivate *priv;
guint i;
+ priv = player->priv;
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
do {
- action = swfdec_ring_buffer_pop (player->actions[i]);
+ action = swfdec_ring_buffer_pop (priv->actions[i]);
if (action == NULL)
break;
} while (action->movie == NULL); /* skip removed actions */
@@ -483,18 +494,19 @@ static void
swfdec_player_perform_external_actions (SwfdecPlayer *player)
{
SwfdecPlayerExternalAction *action;
+ SwfdecPlayerPrivate *priv = player->priv;
guint i;
/* remove timeout if it exists - do this before executing stuff below */
- if (player->external_timeout.callback) {
- swfdec_player_remove_timeout (player, &player->external_timeout);
- player->external_timeout.callback = NULL;
+ if (priv->external_timeout.callback) {
+ swfdec_player_remove_timeout (player, &priv->external_timeout);
+ priv->external_timeout.callback = NULL;
}
/* we need to query the number of current actions so newly added ones aren't
* executed in here */
- for (i = swfdec_ring_buffer_get_n_elements (player->external_actions); i > 0; i--) {
- action = swfdec_ring_buffer_pop (player->external_actions);
+ for (i = swfdec_ring_buffer_get_n_elements (priv->external_actions); i > 0; i--) {
+ action = swfdec_ring_buffer_pop (priv->external_actions);
g_assert (action != NULL);
/* skip removed actions */
if (action->object == NULL)
@@ -507,10 +519,10 @@ swfdec_player_perform_external_actions (SwfdecPlayer *player)
static void
swfdec_player_trigger_external_actions (SwfdecTimeout *advance)
{
- SwfdecPlayer *player = SWFDEC_PLAYER ((void *) ((guint8 *) advance - G_STRUCT_OFFSET (SwfdecPlayer, external_timeout)));
+ SwfdecPlayerPrivate *priv = (SwfdecPlayerPrivate *) ((void *) ((guint8 *) advance - G_STRUCT_OFFSET (SwfdecPlayerPrivate, external_timeout)));
- player->external_timeout.callback = NULL;
- swfdec_player_perform_external_actions (player);
+ priv->external_timeout.callback = NULL;
+ swfdec_player_perform_external_actions (priv->player);
}
void
@@ -518,38 +530,40 @@ swfdec_player_add_external_action (SwfdecPlayer *player, gpointer object,
SwfdecActionFunc action_func, gpointer action_data)
{
SwfdecPlayerExternalAction *action;
+ SwfdecPlayerPrivate *priv;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (object != NULL);
g_return_if_fail (action_func != NULL);
SWFDEC_LOG ("adding external action %p %p %p", object, action_func, action_data);
- action = swfdec_ring_buffer_push (player->external_actions);
+ priv = player->priv;
+ action = swfdec_ring_buffer_push (priv->external_actions);
if (action == NULL) {
/* FIXME: limit number of actions to not get inf loops due to scripts? */
- swfdec_ring_buffer_set_size (player->external_actions,
- swfdec_ring_buffer_get_size (player->external_actions) + 16);
- action = swfdec_ring_buffer_push (player->external_actions);
+ swfdec_ring_buffer_set_size (priv->external_actions,
+ swfdec_ring_buffer_get_size (priv->external_actions) + 16);
+ action = swfdec_ring_buffer_push (priv->external_actions);
g_assert (action);
}
action->object = object;
action->func = action_func;
action->data = action_data;
- if (!player->external_timeout.callback) {
+ if (!priv->external_timeout.callback) {
/* trigger execution immediately.
* But if initialized, keep at least 100ms from when the last external
* timeout triggered. This is a crude method to get around infinite loops
* when script actions executed by external actions trigger another external
* action that would execute instantly.
*/
- if (player->initialized) {
- player->external_timeout.timestamp = MAX (player->time,
- player->external_timeout.timestamp + SWFDEC_MSECS_TO_TICKS (100));
+ if (priv->initialized) {
+ priv->external_timeout.timestamp = MAX (priv->time,
+ priv->external_timeout.timestamp + SWFDEC_MSECS_TO_TICKS (100));
} else {
- player->external_timeout.timestamp = player->time;
+ priv->external_timeout.timestamp = priv->time;
}
- player->external_timeout.callback = swfdec_player_trigger_external_actions;
- swfdec_player_add_timeout (player, &player->external_timeout);
+ priv->external_timeout.callback = swfdec_player_trigger_external_actions;
+ swfdec_player_add_timeout (player, &priv->external_timeout);
}
}
@@ -557,13 +571,15 @@ void
swfdec_player_remove_all_external_actions (SwfdecPlayer *player, gpointer object)
{
SwfdecPlayerExternalAction *action;
+ SwfdecPlayerPrivate *priv;
guint i;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (object != NULL);
- for (i = 0; i < swfdec_ring_buffer_get_n_elements (player->external_actions); i++) {
- action = swfdec_ring_buffer_peek_nth (player->external_actions, i);
+ priv = player->priv;
+ for (i = 0; i < swfdec_ring_buffer_get_n_elements (priv->external_actions); i++) {
+ action = swfdec_ring_buffer_peek_nth (priv->external_actions, i);
if (action->object == object) {
SWFDEC_LOG ("removing external action %p %p %p",
@@ -612,8 +628,10 @@ G_DEFINE_TYPE (SwfdecPlayer, swfdec_player, SWFDEC_TYPE_AS_CONTEXT)
void
swfdec_player_remove_movie (SwfdecPlayer *player, SwfdecMovie *movie)
{
+ SwfdecPlayerPrivate *priv = player->priv;
+
swfdec_movie_remove (movie);
- player->movies = g_list_remove (player->movies, movie);
+ priv->movies = g_list_remove (priv->movies, movie);
}
static guint
@@ -668,49 +686,50 @@ swfdec_player_get_property (GObject *object, guint param_id, GValue *value,
GParamSpec * pspec)
{
SwfdecPlayer *player = SWFDEC_PLAYER (object);
+ SwfdecPlayerPrivate *priv = player->priv;
switch (param_id) {
case PROP_BACKGROUND_COLOR:
g_value_set_uint (value, swfdec_player_get_background_color (player));
break;
case PROP_CACHE_SIZE:
- g_value_set_uint (value, player->cache->max_size);
+ g_value_set_uint (value, priv->cache->max_size);
break;
case PROP_INITIALIZED:
g_value_set_boolean (value, swfdec_player_is_initialized (player));
break;
case PROP_DEFAULT_WIDTH:
- g_value_set_uint (value, player->width);
+ g_value_set_uint (value, priv->width);
break;
case PROP_DEFAULT_HEIGHT:
- g_value_set_uint (value, player->height);
+ g_value_set_uint (value, priv->height);
break;
case PROP_RATE:
- g_value_set_double (value, player->rate / 256.0);
+ g_value_set_double (value, priv->rate / 256.0);
break;
case PROP_MOUSE_CURSOR:
- g_value_set_enum (value, player->mouse_cursor);
+ g_value_set_enum (value, priv->mouse_cursor);
break;
case PROP_NEXT_EVENT:
g_value_set_uint (value, swfdec_player_get_next_event (player));
break;
case PROP_WIDTH:
- g_value_set_int (value, player->stage_width);
+ g_value_set_int (value, priv->stage_width);
break;
case PROP_HEIGHT:
- g_value_set_int (value, player->stage_height);
+ g_value_set_int (value, priv->stage_height);
break;
case PROP_ALIGNMENT:
- g_value_set_enum (value, swfdec_player_alignment_from_flags (player->align_flags));
+ g_value_set_enum (value, swfdec_player_alignment_from_flags (priv->align_flags));
break;
case PROP_SCALE:
- g_value_set_enum (value, player->scale_mode);
+ g_value_set_enum (value, priv->scale_mode);
break;
case PROP_SYSTEM:
- g_value_set_object (value, player->system);
+ g_value_set_object (value, priv->system);
break;
case PROP_MAX_RUNTIME:
- g_value_set_ulong (value, player->max_runtime);
+ g_value_set_ulong (value, priv->max_runtime);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -721,69 +740,70 @@ swfdec_player_get_property (GObject *object, guint param_id, GValue *value,
void
swfdec_player_update_scale (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
int width, height;
double scale_x, scale_y;
- player->stage.width = player->stage_width >= 0 ? player->stage_width : (int) player->width;
- player->stage.height = player->stage_height >= 0 ? player->stage_height : (int) player->height;
- if (player->stage.height == 0 || player->stage.width == 0) {
- player->scale_x = 1.0;
- player->scale_y = 1.0;
- player->offset_x = 0;
- player->offset_y = 0;
+ priv->stage.width = priv->stage_width >= 0 ? priv->stage_width : (int) priv->width;
+ priv->stage.height = priv->stage_height >= 0 ? priv->stage_height : (int) priv->height;
+ if (priv->stage.height == 0 || priv->stage.width == 0) {
+ priv->scale_x = 1.0;
+ priv->scale_y = 1.0;
+ priv->offset_x = 0;
+ priv->offset_y = 0;
return;
}
- if (player->width == 0 || player->height == 0) {
+ if (priv->width == 0 || priv->height == 0) {
scale_x = 1.0;
scale_y = 1.0;
} else {
- scale_x = (double) player->stage.width / player->width;
- scale_y = (double) player->stage.height / player->height;
+ scale_x = (double) priv->stage.width / priv->width;
+ scale_y = (double) priv->stage.height / priv->height;
}
- switch (player->scale_mode) {
+ switch (priv->scale_mode) {
case SWFDEC_SCALE_SHOW_ALL:
- player->scale_x = MIN (scale_x, scale_y);
- player->scale_y = player->scale_x;
+ priv->scale_x = MIN (scale_x, scale_y);
+ priv->scale_y = priv->scale_x;
break;
case SWFDEC_SCALE_NO_BORDER:
- player->scale_x = MAX (scale_x, scale_y);
- player->scale_y = player->scale_x;
+ priv->scale_x = MAX (scale_x, scale_y);
+ priv->scale_y = priv->scale_x;
break;
case SWFDEC_SCALE_EXACT_FIT:
- player->scale_x = scale_x;
- player->scale_y = scale_y;
+ priv->scale_x = scale_x;
+ priv->scale_y = scale_y;
break;
case SWFDEC_SCALE_NONE:
- player->scale_x = 1.0;
- player->scale_y = 1.0;
+ priv->scale_x = 1.0;
+ priv->scale_y = 1.0;
break;
default:
g_assert_not_reached ();
}
- width = player->stage.width - ceil (player->width * player->scale_x);
- height = player->stage.height - ceil (player->height * player->scale_y);
- if (player->align_flags & SWFDEC_ALIGN_FLAG_LEFT) {
- player->offset_x = 0;
- } else if (player->align_flags & SWFDEC_ALIGN_FLAG_RIGHT) {
- player->offset_x = width;
+ width = priv->stage.width - ceil (priv->width * priv->scale_x);
+ height = priv->stage.height - ceil (priv->height * priv->scale_y);
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_LEFT) {
+ priv->offset_x = 0;
+ } else if (priv->align_flags & SWFDEC_ALIGN_FLAG_RIGHT) {
+ priv->offset_x = width;
} else {
- player->offset_x = width / 2;
+ priv->offset_x = width / 2;
}
- if (player->align_flags & SWFDEC_ALIGN_FLAG_TOP) {
- player->offset_y = 0;
- } else if (player->align_flags & SWFDEC_ALIGN_FLAG_BOTTOM) {
- player->offset_y = height;
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_TOP) {
+ priv->offset_y = 0;
+ } else if (priv->align_flags & SWFDEC_ALIGN_FLAG_BOTTOM) {
+ priv->offset_y = height;
} else {
- player->offset_y = height / 2;
+ priv->offset_y = height / 2;
}
SWFDEC_LOG ("coordinate translation is %g * x + %d - %g * y + %d",
- player->scale_x, player->offset_x, player->scale_y, player->offset_y);
+ priv->scale_x, priv->offset_x, priv->scale_y, priv->offset_y);
#if 0
/* FIXME: make this emit the signal at the right time */
- player->invalid.x0 = 0;
- player->invalid.y0 = 0;
- player->invalid.x1 = player->stage_width;
- player->invalid.y1 = player->stage_height;
+ priv->invalid.x0 = 0;
+ priv->invalid.y0 = 0;
+ priv->invalid.x1 = priv->stage_width;
+ priv->invalid.y1 = priv->stage_height;
#endif
}
@@ -792,33 +812,34 @@ swfdec_player_set_property (GObject *object, guint param_id, const GValue *value
GParamSpec *pspec)
{
SwfdecPlayer *player = SWFDEC_PLAYER (object);
+ SwfdecPlayerPrivate *priv = player->priv;
switch (param_id) {
case PROP_BACKGROUND_COLOR:
swfdec_player_set_background_color (player, g_value_get_uint (value));
break;
case PROP_CACHE_SIZE:
- player->cache->max_size = g_value_get_uint (value);
+ priv->cache->max_size = g_value_get_uint (value);
break;
case PROP_WIDTH:
- swfdec_player_set_size (player, g_value_get_int (value), player->stage_height);
+ swfdec_player_set_size (player, g_value_get_int (value), priv->stage_height);
break;
case PROP_HEIGHT:
- swfdec_player_set_size (player, player->stage_width, g_value_get_int (value));
+ swfdec_player_set_size (player, priv->stage_width, g_value_get_int (value));
break;
case PROP_ALIGNMENT:
- player->align_flags = swfdec_player_alignment_to_flags (g_value_get_enum (value));
+ priv->align_flags = swfdec_player_alignment_to_flags (g_value_get_enum (value));
swfdec_player_update_scale (player);
break;
case PROP_SCALE:
swfdec_player_set_scale_mode (player, g_value_get_enum (value));
break;
case PROP_SYSTEM:
- g_object_unref (player->system);
+ g_object_unref (priv->system);
if (g_value_get_object (value)) {
- player->system = SWFDEC_SYSTEM (g_value_dup_object (value));
+ priv->system = SWFDEC_SYSTEM (g_value_dup_object (value));
} else {
- player->system = swfdec_system_new ();
+ priv->system = swfdec_system_new ();
}
break;
case PROP_MAX_RUNTIME:
@@ -834,20 +855,21 @@ static void
swfdec_player_dispose (GObject *object)
{
SwfdecPlayer *player = SWFDEC_PLAYER (object);
+ SwfdecPlayerPrivate *priv = player->priv;
guint i;
swfdec_player_stop_all_sounds (player);
swfdec_player_resource_request_finish (player);
- g_hash_table_destroy (player->registered_classes);
+ g_hash_table_destroy (priv->registered_classes);
- while (player->roots)
- swfdec_movie_destroy (player->roots->data);
- if (player->resource) {
- g_object_unref (player->resource);
- player->resource = NULL;
+ while (priv->roots)
+ swfdec_movie_destroy (priv->roots->data);
+ if (priv->resource) {
+ g_object_unref (priv->resource);
+ priv->resource = NULL;
}
- while (player->rooted_objects)
- swfdec_player_unroot_object (player, player->rooted_objects->data);
+ while (priv->rooted_objects)
+ swfdec_player_unroot_object (player, priv->rooted_objects->data);
/* we do this here so references to GC'd objects get freed */
G_OBJECT_CLASS (swfdec_player_parent_class)->dispose (object);
@@ -856,43 +878,43 @@ swfdec_player_dispose (GObject *object)
#ifndef G_DISABLE_ASSERT
{
SwfdecPlayerExternalAction *action;
- while ((action = swfdec_ring_buffer_pop (player->external_actions)) != NULL) {
+ while ((action = swfdec_ring_buffer_pop (priv->external_actions)) != NULL) {
g_assert (action->object == NULL); /* skip removed actions */
}
}
{
SwfdecPlayerAction *action;
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
- while ((action = swfdec_ring_buffer_pop (player->actions[i])) != NULL) {
+ while ((action = swfdec_ring_buffer_pop (priv->actions[i])) != NULL) {
g_assert (action->movie == NULL); /* skip removed actions */
}
}
}
#endif
- swfdec_ring_buffer_free (player->external_actions);
+ swfdec_ring_buffer_free (priv->external_actions);
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
- swfdec_ring_buffer_free (player->actions[i]);
+ swfdec_ring_buffer_free (priv->actions[i]);
}
- g_assert (player->movies == NULL);
- g_assert (player->audio == NULL);
- if (player->external_timeout.callback)
- swfdec_player_remove_timeout (player, &player->external_timeout);
- if (player->rate) {
- swfdec_player_remove_timeout (player, &player->iterate_timeout);
+ g_assert (priv->movies == NULL);
+ g_assert (priv->audio == NULL);
+ if (priv->external_timeout.callback)
+ swfdec_player_remove_timeout (player, &priv->external_timeout);
+ if (priv->rate) {
+ swfdec_player_remove_timeout (player, &priv->iterate_timeout);
}
- g_assert (player->timeouts == NULL);
- g_list_free (player->intervals);
- player->intervals = NULL;
- swfdec_cache_unref (player->cache);
- if (player->system) {
- g_object_unref (player->system);
- player->system = NULL;
+ g_assert (priv->timeouts == NULL);
+ g_list_free (priv->intervals);
+ priv->intervals = NULL;
+ swfdec_cache_unref (priv->cache);
+ if (priv->system) {
+ g_object_unref (priv->system);
+ priv->system = NULL;
}
- g_array_free (player->invalidations, TRUE);
- player->invalidations = NULL;
- if (player->runtime) {
- g_timer_destroy (player->runtime);
- player->runtime = NULL;
+ g_array_free (priv->invalidations, TRUE);
+ priv->invalidations = NULL;
+ if (priv->runtime) {
+ g_timer_destroy (priv->runtime);
+ priv->runtime = NULL;
}
}
@@ -915,21 +937,22 @@ swfdec_player_broadcast (SwfdecPlayer *player, const char *object_name, const ch
static void
swfdec_player_update_mouse_cursor (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecMouseCursor new = SWFDEC_MOUSE_CURSOR_NORMAL;
- if (!player->mouse_visible) {
+ if (!priv->mouse_visible) {
new = SWFDEC_MOUSE_CURSOR_NONE;
- } else if (player->mouse_grab != NULL) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ } else if (priv->mouse_grab != NULL) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_cursor)
- new = klass->mouse_cursor (player->mouse_grab);
+ new = klass->mouse_cursor (priv->mouse_grab);
else
new = SWFDEC_MOUSE_CURSOR_CLICK;
}
- if (new != player->mouse_cursor) {
- player->mouse_cursor = new;
+ if (new != priv->mouse_cursor) {
+ priv->mouse_cursor = new;
g_object_notify (G_OBJECT (player), "mouse-cursor");
}
}
@@ -937,29 +960,30 @@ swfdec_player_update_mouse_cursor (SwfdecPlayer *player)
static void
swfdec_player_update_drag_movie (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
double x, y;
SwfdecMovie *movie;
- if (player->mouse_drag == NULL)
+ if (priv->mouse_drag == NULL)
return;
- movie = player->mouse_drag;
+ movie = priv->mouse_drag;
g_assert (movie->cache_state == SWFDEC_MOVIE_UP_TO_DATE);
- x = player->mouse_x;
- y = player->mouse_y;
+ x = priv->mouse_x;
+ y = priv->mouse_y;
swfdec_player_stage_to_global (player, &x, &y);
if (movie->parent)
swfdec_movie_global_to_local (movie->parent, &x, &y);
- if (player->mouse_drag_center) {
+ if (priv->mouse_drag_center) {
x -= (movie->extents.x1 - movie->extents.x0) / 2;
y -= (movie->extents.y1 - movie->extents.y0) / 2;
} else {
- x -= player->mouse_drag_x;
- y -= player->mouse_drag_y;
+ x -= priv->mouse_drag_x;
+ y -= priv->mouse_drag_y;
}
- x = CLAMP (x, player->mouse_drag_rect.x0, player->mouse_drag_rect.x1);
- y = CLAMP (y, player->mouse_drag_rect.y0, player->mouse_drag_rect.y1);
- SWFDEC_LOG ("mouse is at %g %g, originally (%g %g)", x, y, player->mouse_x, player->mouse_y);
+ x = CLAMP (x, priv->mouse_drag_rect.x0, priv->mouse_drag_rect.x1);
+ y = CLAMP (y, priv->mouse_drag_rect.y0, priv->mouse_drag_rect.y1);
+ SWFDEC_LOG ("mouse is at %g %g, originally (%g %g)", x, y, priv->mouse_x, priv->mouse_y);
if (x != movie->matrix.x0 || y != movie->matrix.y0) {
swfdec_movie_queue_update (movie, SWFDEC_MOVIE_INVALID_MATRIX);
movie->matrix.x0 = x;
@@ -982,32 +1006,35 @@ void
swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecMovie *drag, gboolean center,
SwfdecRect *rect)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (drag == NULL || SWFDEC_IS_MOVIE (drag));
/* FIXME: need to do anything with old drag? */
- player->mouse_drag = drag;
- player->mouse_drag_center = center;
+ priv = player->priv;
+ priv->mouse_drag = drag;
+ priv->mouse_drag_center = center;
if (drag && !center) {
- player->mouse_drag_x = player->mouse_x;
- player->mouse_drag_y = player->mouse_y;
- swfdec_player_stage_to_global (player, &player->mouse_drag_x, &player->mouse_drag_y);
+ priv->mouse_drag_x = priv->mouse_x;
+ priv->mouse_drag_y = priv->mouse_y;
+ swfdec_player_stage_to_global (player, &priv->mouse_drag_x, &priv->mouse_drag_y);
if (drag->parent)
- swfdec_movie_global_to_local (drag->parent, &player->mouse_drag_x, &player->mouse_drag_y);
- player->mouse_drag_x -= drag->matrix.x0;
- player->mouse_drag_y -= drag->matrix.y0;
+ swfdec_movie_global_to_local (drag->parent, &priv->mouse_drag_x, &priv->mouse_drag_y);
+ priv->mouse_drag_x -= drag->matrix.x0;
+ priv->mouse_drag_y -= drag->matrix.y0;
}
if (rect) {
- player->mouse_drag_rect = *rect;
+ priv->mouse_drag_rect = *rect;
} else {
- player->mouse_drag_rect.x0 = -G_MAXDOUBLE;
- player->mouse_drag_rect.y0 = -G_MAXDOUBLE;
- player->mouse_drag_rect.x1 = G_MAXDOUBLE;
- player->mouse_drag_rect.y1 = G_MAXDOUBLE;
+ priv->mouse_drag_rect.x0 = -G_MAXDOUBLE;
+ priv->mouse_drag_rect.y0 = -G_MAXDOUBLE;
+ priv->mouse_drag_rect.x1 = G_MAXDOUBLE;
+ priv->mouse_drag_rect.y1 = G_MAXDOUBLE;
}
SWFDEC_DEBUG ("starting drag in %g %g %g %g",
- player->mouse_drag_rect.x0, player->mouse_drag_rect.y0,
- player->mouse_drag_rect.x1, player->mouse_drag_rect.y1);
+ priv->mouse_drag_rect.x0, priv->mouse_drag_rect.y0,
+ priv->mouse_drag_rect.x1, priv->mouse_drag_rect.y1);
/* FIXME: need a way to make sure we get updated */
if (drag) {
swfdec_movie_update (drag);
@@ -1019,14 +1046,15 @@ swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecMovie *drag, gboolean
static void
swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
double x, y;
SwfdecMovie *below_mouse = NULL;
- x = player->mouse_x;
- y = player->mouse_y;
+ x = priv->mouse_x;
+ y = priv->mouse_y;
swfdec_player_stage_to_global (player, &x, &y);
- for (walk = g_list_last (player->roots); walk; walk = walk->prev) {
+ for (walk = g_list_last (priv->roots); walk; walk = walk->prev) {
below_mouse = swfdec_movie_get_movie_at (walk->data, x, y, TRUE);
if (below_mouse) {
if (swfdec_movie_get_mouse_events (below_mouse))
@@ -1036,26 +1064,26 @@ swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
}
if (swfdec_player_is_mouse_pressed (player)) {
/* a mouse grab is active */
- if (player->mouse_grab) {
- if (below_mouse == player->mouse_grab &&
- player->mouse_below != player->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ if (priv->mouse_grab) {
+ if (below_mouse == priv->mouse_grab &&
+ priv->mouse_below != priv->mouse_grab) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_in)
- klass->mouse_in (player->mouse_grab);
- } else if (below_mouse != player->mouse_grab &&
- player->mouse_below == player->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ klass->mouse_in (priv->mouse_grab);
+ } else if (below_mouse != priv->mouse_grab &&
+ priv->mouse_below == priv->mouse_grab) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_out)
- klass->mouse_out (player->mouse_grab);
+ klass->mouse_out (priv->mouse_grab);
}
}
} else {
/* no mouse grab is active */
- if (below_mouse != player->mouse_grab) {
- if (player->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ if (below_mouse != priv->mouse_grab) {
+ if (priv->mouse_grab) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_out)
- klass->mouse_out (player->mouse_grab);
+ klass->mouse_out (priv->mouse_grab);
}
if (below_mouse) {
SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (below_mouse);
@@ -1063,23 +1091,24 @@ swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
klass->mouse_in (below_mouse);
}
}
- player->mouse_grab = below_mouse;
+ priv->mouse_grab = below_mouse;
}
- player->mouse_below = below_mouse;
+ priv->mouse_below = below_mouse;
SWFDEC_DEBUG ("%s %p has mouse at %g %g",
- player->mouse_grab ? G_OBJECT_TYPE_NAME (player->mouse_grab) : "---",
- player->mouse_grab, player->mouse_x, player->mouse_y);
+ priv->mouse_grab ? G_OBJECT_TYPE_NAME (priv->mouse_grab) : "---",
+ priv->mouse_grab, priv->mouse_x, priv->mouse_y);
}
static gboolean
swfdec_player_do_mouse_move (SwfdecPlayer *player, double x, double y)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
- if (player->mouse_x != x || player->mouse_y != y) {
- player->mouse_x = x;
- player->mouse_y = y;
- for (walk = player->movies; walk; walk = walk->next) {
+ if (priv->mouse_x != x || priv->mouse_y != y) {
+ priv->mouse_x = x;
+ priv->mouse_y = y;
+ for (walk = priv->movies; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_MOVE);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseMove);
@@ -1094,19 +1123,20 @@ swfdec_player_do_mouse_move (SwfdecPlayer *player, double x, double y)
static gboolean
swfdec_player_do_mouse_press (SwfdecPlayer *player, guint button)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
- player->mouse_button |= 1 << button;
+ priv->mouse_button |= 1 << button;
if (button == 0) {
- for (walk = player->movies; walk; walk = walk->next) {
+ for (walk = priv->movies; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_DOWN);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseDown);
}
- if (player->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ if (priv->mouse_grab) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_press)
- klass->mouse_press (player->mouse_grab, button);
+ klass->mouse_press (priv->mouse_grab, button);
}
/* FIXME: allow events to pass through */
@@ -1116,25 +1146,26 @@ swfdec_player_do_mouse_press (SwfdecPlayer *player, guint button)
static gboolean
swfdec_player_do_mouse_release (SwfdecPlayer *player, guint button)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
- player->mouse_button &= ~(1 << button);
+ priv->mouse_button &= ~(1 << button);
if (button == 0) {
- for (walk = player->movies; walk; walk = walk->next) {
+ for (walk = priv->movies; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_UP);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseUp);
}
- if (player->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ if (priv->mouse_grab) {
+ SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_release)
- klass->mouse_release (player->mouse_grab, button);
- if (button == 0 && player->mouse_grab != player->mouse_below) {
- player->mouse_grab = player->mouse_below;
- if (player->mouse_grab) {
- klass = SWFDEC_MOVIE_GET_CLASS (player->mouse_grab);
+ klass->mouse_release (priv->mouse_grab, button);
+ if (button == 0 && priv->mouse_grab != priv->mouse_below) {
+ priv->mouse_grab = priv->mouse_below;
+ if (priv->mouse_grab) {
+ klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
if (klass->mouse_in)
- klass->mouse_in (player->mouse_grab);
+ klass->mouse_in (priv->mouse_grab);
}
}
}
@@ -1146,18 +1177,19 @@ swfdec_player_do_mouse_release (SwfdecPlayer *player, guint button)
static void
swfdec_player_emit_signals (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
/* emit invalidate signal */
- if (!swfdec_rectangle_is_empty (&player->invalid_extents)) {
- g_signal_emit (player, signals[INVALIDATE], 0, &player->invalid_extents,
- player->invalidations->data, player->invalidations->len);
- swfdec_rectangle_init_empty (&player->invalid_extents);
- g_array_set_size (player->invalidations, 0);
+ if (!swfdec_rectangle_is_empty (&priv->invalid_extents)) {
+ g_signal_emit (player, signals[INVALIDATE], 0, &priv->invalid_extents,
+ priv->invalidations->data, priv->invalidations->len);
+ swfdec_rectangle_init_empty (&priv->invalid_extents);
+ g_array_set_size (priv->invalidations, 0);
}
/* emit audio-added for all added audio streams */
- for (walk = player->audio; walk; walk = walk->next) {
+ for (walk = priv->audio; walk; walk = walk->next) {
SwfdecAudio *audio = walk->data;
if (audio->added)
@@ -1170,17 +1202,18 @@ swfdec_player_emit_signals (SwfdecPlayer *player)
static gboolean
swfdec_player_do_handle_key (SwfdecPlayer *player, guint keycode, guint character, gboolean down)
{
+ SwfdecPlayerPrivate *priv = player->priv;
g_assert (keycode < 256);
if (!swfdec_player_lock (player))
return FALSE;
/* set the correct variables */
- player->last_keycode = keycode;
- player->last_character = character;
+ priv->last_keycode = keycode;
+ priv->last_character = character;
if (down) {
- player->key_pressed[keycode / 8] |= 1 << keycode % 8;
+ priv->key_pressed[keycode / 8] |= 1 << keycode % 8;
} else {
- player->key_pressed[keycode / 8] &= ~(1 << keycode % 8);
+ priv->key_pressed[keycode / 8] &= ~(1 << keycode % 8);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Key, down ? SWFDEC_AS_STR_onKeyDown : SWFDEC_AS_STR_onKeyUp);
swfdec_player_perform_actions (player);
@@ -1214,23 +1247,27 @@ swfdec_player_do_handle_mouse (SwfdecPlayer *player,
void
swfdec_player_global_to_stage (SwfdecPlayer *player, double *x, double *y)
{
+ SwfdecPlayerPrivate *priv = player->priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
- *x = *x / SWFDEC_TWIPS_SCALE_FACTOR * player->scale_x + player->offset_x;
- *y = *y / SWFDEC_TWIPS_SCALE_FACTOR * player->scale_y + player->offset_y;
+ *x = *x / SWFDEC_TWIPS_SCALE_FACTOR * priv->scale_x + priv->offset_x;
+ *y = *y / SWFDEC_TWIPS_SCALE_FACTOR * priv->scale_y + priv->offset_y;
}
void
swfdec_player_stage_to_global (SwfdecPlayer *player, double *x, double *y)
{
+ SwfdecPlayerPrivate *priv = player->priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
- *x = (*x - player->offset_x) / player->scale_x * SWFDEC_TWIPS_SCALE_FACTOR;
- *y = (*y - player->offset_y) / player->scale_y * SWFDEC_TWIPS_SCALE_FACTOR;
+ *x = (*x - priv->offset_x) / priv->scale_x * SWFDEC_TWIPS_SCALE_FACTOR;
+ *y = (*y - priv->offset_y) / priv->scale_y * SWFDEC_TWIPS_SCALE_FACTOR;
}
static void
@@ -1240,7 +1277,7 @@ swfdec_player_execute_on_load_init (SwfdecPlayer *player)
/* FIXME: This can be made a LOT faster with correct caching, but I'm lazy */
do {
- for (walk = player->movies; walk; walk = walk->next) {
+ for (walk = player->priv->movies; walk; walk = walk->next) {
SwfdecMovie *movie = walk->data;
SwfdecResource *resource = swfdec_movie_get_own_resource (movie);
if (resource == NULL)
@@ -1254,19 +1291,20 @@ swfdec_player_execute_on_load_init (SwfdecPlayer *player)
static void
swfdec_player_iterate (SwfdecTimeout *timeout)
{
- SwfdecPlayer *player = SWFDEC_PLAYER ((void *) ((guint8 *) timeout - G_STRUCT_OFFSET (SwfdecPlayer, iterate_timeout)));
+ SwfdecPlayerPrivate *priv = (SwfdecPlayerPrivate *) ((void *) ((guint8 *) timeout - G_STRUCT_OFFSET (SwfdecPlayerPrivate, iterate_timeout)));
+ SwfdecPlayer *player = priv->player;
GList *walk;
/* add timeout again - do this first because later code can change it */
/* FIXME: rounding issues? */
- player->iterate_timeout.timestamp += SWFDEC_TICKS_PER_SECOND * 256 / player->rate;
- swfdec_player_add_timeout (player, &player->iterate_timeout);
+ priv->iterate_timeout.timestamp += SWFDEC_TICKS_PER_SECOND * 256 / priv->rate;
+ swfdec_player_add_timeout (player, &priv->iterate_timeout);
swfdec_player_perform_external_actions (player);
SWFDEC_INFO ("=== START ITERATION ===");
/* start the iteration. This performs a goto next frame on all
* movies that are not stopped. It also queues onEnterFrame.
*/
- for (walk = player->movies; walk; walk = walk->next) {
+ for (walk = priv->movies; walk; walk = walk->next) {
SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (walk->data);
if (klass->iterate_start)
klass->iterate_start (walk->data);
@@ -1274,7 +1312,7 @@ swfdec_player_iterate (SwfdecTimeout *timeout)
swfdec_player_perform_actions (player);
SWFDEC_INFO ("=== STOP ITERATION ===");
/* this loop allows removal of walk->data */
- walk = player->movies;
+ walk = priv->movies;
while (walk) {
SwfdecMovie *cur = walk->data;
SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (cur);
@@ -1299,7 +1337,7 @@ swfdec_player_advance_audio (SwfdecPlayer *player, guint samples)
/* don't use for loop here, because we need to advance walk before
* removing the audio */
- walk = player->audio;
+ walk = player->priv->audio;
while (walk) {
audio = walk->data;
walk = walk->next;
@@ -1311,6 +1349,7 @@ swfdec_player_advance_audio (SwfdecPlayer *player, guint samples)
static void
swfdec_player_do_advance (SwfdecPlayer *player, gulong msecs, guint audio_samples)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecTimeout *timeout;
SwfdecTick target_time;
guint frames_now;
@@ -1318,16 +1357,16 @@ swfdec_player_do_advance (SwfdecPlayer *player, gulong msecs, guint audio_sample
if (!swfdec_player_lock (player))
return;
- target_time = player->time + SWFDEC_MSECS_TO_TICKS (msecs);
+ target_time = priv->time + SWFDEC_MSECS_TO_TICKS (msecs);
SWFDEC_DEBUG ("advancing %lu msecs (%u audio frames)", msecs, audio_samples);
- for (timeout = player->timeouts ? player->timeouts->data : NULL;
+ for (timeout = priv->timeouts ? priv->timeouts->data : NULL;
timeout && timeout->timestamp <= target_time;
- timeout = player->timeouts ? player->timeouts->data : NULL) {
- player->timeouts = g_list_remove (player->timeouts, timeout);
+ timeout = priv->timeouts ? priv->timeouts->data : NULL) {
+ priv->timeouts = g_list_remove (priv->timeouts, timeout);
frames_now = SWFDEC_TICKS_TO_SAMPLES (timeout->timestamp) -
- SWFDEC_TICKS_TO_SAMPLES (player->time);
- player->time = timeout->timestamp;
+ SWFDEC_TICKS_TO_SAMPLES (priv->time);
+ priv->time = timeout->timestamp;
swfdec_player_advance_audio (player, frames_now);
audio_samples -= frames_now;
SWFDEC_LOG ("activating timeout %p now (timeout is %"G_GUINT64_FORMAT", target time is %"G_GUINT64_FORMAT,
@@ -1335,10 +1374,10 @@ swfdec_player_do_advance (SwfdecPlayer *player, gulong msecs, guint audio_sample
timeout->callback (timeout);
swfdec_player_perform_actions (player);
}
- if (target_time > player->time) {
+ if (target_time > priv->time) {
frames_now = SWFDEC_TICKS_TO_SAMPLES (target_time) -
- SWFDEC_TICKS_TO_SAMPLES (player->time);
- player->time = target_time;
+ SWFDEC_TICKS_TO_SAMPLES (priv->time);
+ priv->time = target_time;
swfdec_player_advance_audio (player, frames_now);
audio_samples -= frames_now;
}
@@ -1360,10 +1399,10 @@ void
swfdec_player_lock_soft (SwfdecPlayer *player)
{
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_assert (swfdec_rectangle_is_empty (&player->invalid_extents));
+ g_assert (swfdec_rectangle_is_empty (&player->priv->invalid_extents));
g_object_freeze_notify (G_OBJECT (player));
- g_timer_start (player->runtime);
+ g_timer_start (player->priv->runtime);
SWFDEC_DEBUG ("LOCKED");
}
@@ -1371,10 +1410,10 @@ gboolean
swfdec_player_lock (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), FALSE);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[0]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[1]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[2]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[3]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[0]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[1]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[2]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[3]) == 0);
if (swfdec_as_context_is_aborted (SWFDEC_AS_CONTEXT (player)))
return FALSE;
@@ -1392,7 +1431,7 @@ swfdec_player_update_movies (SwfdecPlayer *player)
GList *walk;
/* FIXME: This g_list_last could be slow */
- for (walk = g_list_last (player->movies); walk; walk = walk->prev) {
+ for (walk = g_list_last (player->priv->movies); walk; walk = walk->prev) {
movie = walk->data;
swfdec_movie_update (movie);
@@ -1416,7 +1455,7 @@ swfdec_player_unlock_soft (SwfdecPlayer *player)
g_return_if_fail (SWFDEC_IS_PLAYER (player));
SWFDEC_DEBUG ("UNLOCK");
- g_timer_stop (player->runtime);
+ g_timer_stop (player->priv->runtime);
swfdec_player_update_movies (player);
swfdec_player_update_mouse_cursor (player);
g_object_thaw_notify (G_OBJECT (player));
@@ -1429,10 +1468,10 @@ swfdec_player_unlock (SwfdecPlayer *player)
SwfdecAsContext *context;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[0]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[1]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[2]) == 0);
- g_assert (swfdec_ring_buffer_get_n_elements (player->actions[3]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[0]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[1]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[2]) == 0);
+ g_assert (swfdec_ring_buffer_get_n_elements (player->priv->actions[3]) == 0);
context = SWFDEC_AS_CONTEXT (player);
g_return_if_fail (context->state != SWFDEC_AS_CONTEXT_INTERRUPTED);
@@ -1472,13 +1511,14 @@ static void
swfdec_player_mark (SwfdecAsContext *context)
{
SwfdecPlayer *player = SWFDEC_PLAYER (context);
+ SwfdecPlayerPrivate *priv = player->priv;
- g_hash_table_foreach (player->registered_classes, swfdec_player_mark_string_object, NULL);
- swfdec_as_object_mark (player->MovieClip);
- swfdec_as_object_mark (player->Video);
- g_list_foreach (player->roots, (GFunc) swfdec_as_object_mark, NULL);
- g_list_foreach (player->intervals, (GFunc) swfdec_as_object_mark, NULL);
- g_list_foreach (player->rooted_objects, swfdec_player_mark_rooted_object, NULL);
+ g_hash_table_foreach (priv->registered_classes, swfdec_player_mark_string_object, NULL);
+ swfdec_as_object_mark (priv->MovieClip);
+ swfdec_as_object_mark (priv->Video);
+ g_list_foreach (priv->roots, (GFunc) swfdec_as_object_mark, NULL);
+ g_list_foreach (priv->intervals, (GFunc) swfdec_as_object_mark, NULL);
+ g_list_foreach (priv->rooted_objects, swfdec_player_mark_rooted_object, NULL);
SWFDEC_AS_CONTEXT_CLASS (swfdec_player_parent_class)->mark (context);
}
@@ -1489,17 +1529,18 @@ swfdec_player_get_time (SwfdecAsContext *context, GTimeVal *tv)
*tv = context->start_time;
/* FIXME: what granularity do we want? Currently it's milliseconds */
- g_time_val_add (tv, SWFDEC_TICKS_TO_MSECS (SWFDEC_PLAYER (context)->time) * 1000);
+ g_time_val_add (tv, SWFDEC_TICKS_TO_MSECS (SWFDEC_PLAYER (context)->priv->time) * 1000);
}
static gboolean
swfdec_player_check_continue (SwfdecAsContext *context)
{
SwfdecPlayer *player = SWFDEC_PLAYER (context);
+ SwfdecPlayerPrivate *priv = player->priv;
- if (player->max_runtime == 0)
+ if (priv->max_runtime == 0)
return TRUE;
- return g_timer_elapsed (player->runtime, NULL) * 1000 <= player->max_runtime;
+ return g_timer_elapsed (priv->runtime, NULL) * 1000 <= priv->max_runtime;
}
static void
@@ -1508,6 +1549,8 @@ swfdec_player_class_init (SwfdecPlayerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
SwfdecAsContextClass *context_class = SWFDEC_AS_CONTEXT_CLASS (klass);
+ g_type_class_add_private (klass, sizeof (SwfdecPlayerPrivate));
+
object_class->get_property = swfdec_player_get_property;
object_class->set_property = swfdec_player_set_property;
object_class->dispose = swfdec_player_dispose;
@@ -1707,27 +1750,31 @@ swfdec_player_class_init (SwfdecPlayerClass *klass)
static void
swfdec_player_init (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv;
guint i;
- player->system = swfdec_system_new ();
- player->registered_classes = g_hash_table_new (g_direct_hash, g_direct_equal);
+ player->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (player, SWFDEC_TYPE_PLAYER, SwfdecPlayerPrivate);
+ priv->player = player;
+
+ priv->system = swfdec_system_new ();
+ priv->registered_classes = g_hash_table_new (g_direct_hash, g_direct_equal);
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
- player->actions[i] = swfdec_ring_buffer_new_for_type (SwfdecPlayerAction, 16);
- }
- player->external_actions = swfdec_ring_buffer_new_for_type (SwfdecPlayerExternalAction, 8);
- player->cache = swfdec_cache_new (50 * 1024 * 1024); /* 100 MB */
- player->bgcolor = SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF);
-
- player->runtime = g_timer_new ();
- g_timer_stop (player->runtime);
- player->max_runtime = 10 * 1000;
- player->invalidations = g_array_new (FALSE, FALSE, sizeof (SwfdecRectangle));
- player->mouse_visible = TRUE;
- player->mouse_cursor = SWFDEC_MOUSE_CURSOR_NORMAL;
- player->iterate_timeout.callback = swfdec_player_iterate;
- player->stage_width = -1;
- player->stage_height = -1;
+ priv->actions[i] = swfdec_ring_buffer_new_for_type (SwfdecPlayerAction, 16);
+ }
+ priv->external_actions = swfdec_ring_buffer_new_for_type (SwfdecPlayerExternalAction, 8);
+ priv->cache = swfdec_cache_new (50 * 1024 * 1024); /* 100 MB */
+ priv->bgcolor = SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF);
+
+ priv->runtime = g_timer_new ();
+ g_timer_stop (priv->runtime);
+ priv->max_runtime = 10 * 1000;
+ priv->invalidations = g_array_new (FALSE, FALSE, sizeof (SwfdecRectangle));
+ priv->mouse_visible = TRUE;
+ priv->mouse_cursor = SWFDEC_MOUSE_CURSOR_NORMAL;
+ priv->iterate_timeout.callback = swfdec_player_iterate;
+ priv->stage_width = -1;
+ priv->stage_height = -1;
swfdec_player_resource_request_init (player);
}
@@ -1735,10 +1782,13 @@ swfdec_player_init (SwfdecPlayer *player)
void
swfdec_player_stop_all_sounds (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- while (player->audio) {
- swfdec_audio_remove (player->audio->data);
+ priv = player->priv;
+ while (priv->audio) {
+ swfdec_audio_remove (priv->audio->data);
}
}
@@ -1750,7 +1800,7 @@ swfdec_player_stop_sounds (SwfdecPlayer *player, SwfdecAudioRemoveFunc func, gpo
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (func);
- walk = player->audio;
+ walk = player->priv->audio;
while (walk) {
SwfdecAudio *audio = walk->data;
walk = walk->next;
@@ -1763,6 +1813,7 @@ swfdec_player_stop_sounds (SwfdecPlayer *player, SwfdecAudioRemoveFunc func, gpo
void
swfdec_player_invalidate (SwfdecPlayer *player, const SwfdecRect *rect)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecRectangle r;
SwfdecRect tmp;
guint i;
@@ -1777,31 +1828,31 @@ swfdec_player_invalidate (SwfdecPlayer *player, const SwfdecRect *rect)
/* FIXME: currently we clamp the rectangle to the visible area, it might
* be useful to allow out-of-bounds drawing. In that case this needs to be
* changed */
- swfdec_rectangle_intersect (&r, &r, &player->stage);
+ swfdec_rectangle_intersect (&r, &r, &priv->stage);
if (swfdec_rectangle_is_empty (&r))
return;
SWFDEC_LOG (" invalidating %d %d %d %d", r.x, r.y, r.width, r.height);
/* FIXME: get region code into swfdec? */
- for (i = 0; i < player->invalidations->len; i++) {
- SwfdecRectangle *cur = &g_array_index (player->invalidations, SwfdecRectangle, i);
+ for (i = 0; i < priv->invalidations->len; i++) {
+ SwfdecRectangle *cur = &g_array_index (priv->invalidations, SwfdecRectangle, i);
if (swfdec_rectangle_contains (cur, &r))
break;
if (swfdec_rectangle_contains (&r, cur)) {
*cur = r;
- swfdec_rectangle_union (&player->invalid_extents, &player->invalid_extents, &r);
+ swfdec_rectangle_union (&priv->invalid_extents, &priv->invalid_extents, &r);
}
}
- if (i == player->invalidations->len) {
- g_array_append_val (player->invalidations, r);
- swfdec_rectangle_union (&player->invalid_extents, &player->invalid_extents, &r);
+ if (i == priv->invalidations->len) {
+ g_array_append_val (priv->invalidations, r);
+ swfdec_rectangle_union (&priv->invalid_extents, &priv->invalid_extents, &r);
}
SWFDEC_DEBUG ("toplevel invalidation of %g %g %g %g - invalid region now %d %d %d %d (%u subregions)",
rect->x0, rect->y0, rect->x1, rect->y1,
- player->invalid_extents.x, player->invalid_extents.y,
- player->invalid_extents.x + player->invalid_extents.width,
- player->invalid_extents.y + player->invalid_extents.height,
- player->invalidations->len);
+ priv->invalid_extents.x, priv->invalid_extents.y,
+ priv->invalid_extents.x + priv->invalid_extents.width,
+ priv->invalid_extents.y + priv->invalid_extents.height,
+ priv->invalidations->len);
}
/**
@@ -1877,7 +1928,7 @@ swfdec_player_get_movie_at_level (SwfdecPlayer *player, int level)
depth = level - 16384;
/* find movie */
- for (walk = player->roots; walk; walk = walk->next) {
+ for (walk = player->priv->roots; walk; walk = walk->next) {
SwfdecMovie *cur = walk->data;
if (cur->depth < depth)
continue;
@@ -1919,10 +1970,13 @@ void
swfdec_player_initialize (SwfdecPlayer *player, guint version,
guint rate, guint width, guint height)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (rate > 0);
- if (!player->initialized) {
+ priv = player->priv;
+ if (!priv->initialized) {
SwfdecAsContext *context = SWFDEC_AS_CONTEXT (player);
swfdec_as_context_startup (context, version);
/* reset state for initialization */
@@ -1938,37 +1992,37 @@ swfdec_player_initialize (SwfdecPlayer *player, guint version,
if (context->state == SWFDEC_AS_CONTEXT_NEW) {
context->state = SWFDEC_AS_CONTEXT_RUNNING;
- swfdec_as_object_set_constructor (player->roots->data, player->MovieClip);
+ swfdec_as_object_set_constructor (priv->roots->data, priv->MovieClip);
}
}
- player->initialized = TRUE;
+ priv->initialized = TRUE;
g_object_notify (G_OBJECT (player), "initialized");
} else {
/* FIXME: need to kick all other movies out here */
- swfdec_player_remove_timeout (player, &player->iterate_timeout);
+ swfdec_player_remove_timeout (player, &priv->iterate_timeout);
}
SWFDEC_INFO ("initializing player to size %ux%u and rate %u/256", width, height, rate);
- if (rate != player->rate) {
- player->rate = rate;
+ if (rate != priv->rate) {
+ priv->rate = rate;
g_object_notify (G_OBJECT (player), "rate");
}
- if (player->width != width) {
- player->width = width;
+ if (priv->width != width) {
+ priv->width = width;
g_object_notify (G_OBJECT (player), "default-width");
}
- if (player->height != height) {
- player->height = height;
+ if (priv->height != height) {
+ priv->height = height;
g_object_notify (G_OBJECT (player), "default-height");
}
- player->broadcasted_width = player->internal_width = player->stage_width >= 0 ? (guint) player->stage_width : player->width;
- player->broadcasted_height = player->internal_height = player->stage_height >= 0 ? (guint) player->stage_height : player->height;
+ priv->broadcasted_width = priv->internal_width = priv->stage_width >= 0 ? (guint) priv->stage_width : priv->width;
+ priv->broadcasted_height = priv->internal_height = priv->stage_height >= 0 ? (guint) priv->stage_height : priv->height;
swfdec_player_update_scale (player);
- player->iterate_timeout.timestamp = player->time + SWFDEC_TICKS_PER_SECOND * 256 / player->rate / 10;
- swfdec_player_add_timeout (player, &player->iterate_timeout);
+ priv->iterate_timeout.timestamp = priv->time + SWFDEC_TICKS_PER_SECOND * 256 / priv->rate / 10;
+ swfdec_player_add_timeout (player, &priv->iterate_timeout);
SWFDEC_LOG ("initialized iterate timeout %p to %"G_GUINT64_FORMAT" (now %"G_GUINT64_FORMAT")",
- &player->iterate_timeout, player->iterate_timeout.timestamp, player->time);
+ &priv->iterate_timeout, priv->iterate_timeout.timestamp, priv->time);
}
/**
@@ -1983,14 +2037,15 @@ swfdec_player_initialize (SwfdecPlayer *player, guint version,
SwfdecAsObject *
swfdec_player_get_export_class (SwfdecPlayer *player, const char *name)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecAsObject *ret;
- ret = g_hash_table_lookup (player->registered_classes, name);
+ ret = g_hash_table_lookup (priv->registered_classes, name);
if (ret) {
SWFDEC_LOG ("found registered class %p for %s", ret, name);
return ret;
}
- return player->MovieClip;
+ return priv->MovieClip;
}
/**
@@ -2005,15 +2060,18 @@ swfdec_player_get_export_class (SwfdecPlayer *player, const char *name)
void
swfdec_player_set_export_class (SwfdecPlayer *player, const char *name, SwfdecAsObject *object)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (name != NULL);
g_return_if_fail (object == NULL || SWFDEC_IS_AS_OBJECT (object));
+ priv = player->priv;
if (object) {
SWFDEC_LOG ("setting class %p for %s", object, name);
- g_hash_table_insert (player->registered_classes, (gpointer) name, object);
+ g_hash_table_insert (priv->registered_classes, (gpointer) name, object);
} else {
- g_hash_table_remove (player->registered_classes, name);
+ g_hash_table_remove (priv->registered_classes, name);
}
}
@@ -2025,24 +2083,28 @@ swfdec_player_set_export_class (SwfdecPlayer *player, const char *name, SwfdecAs
void
swfdec_player_root_object (SwfdecPlayer *player, GObject *object)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (G_IS_OBJECT (object));
+ priv = player->priv;
g_object_ref (object);
- player->rooted_objects = g_list_prepend (player->rooted_objects, object);
+ priv->rooted_objects = g_list_prepend (priv->rooted_objects, object);
}
void
swfdec_player_unroot_object (SwfdecPlayer *player, GObject *object)
{
+ SwfdecPlayerPrivate *priv = player->priv;
GList *entry;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (G_IS_OBJECT (object));
- entry = g_list_find (player->rooted_objects, object);
+ entry = g_list_find (priv->rooted_objects, object);
g_return_if_fail (entry != NULL);
g_object_unref (object);
- player->rooted_objects = g_list_delete_link (player->rooted_objects, entry);
+ priv->rooted_objects = g_list_delete_link (priv->rooted_objects, entry);
}
/** PUBLIC API ***/
@@ -2089,7 +2151,7 @@ void
swfdec_player_set_loader (SwfdecPlayer *player, SwfdecLoader *loader)
{
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (player->roots == NULL);
+ g_return_if_fail (player->priv->roots == NULL);
g_return_if_fail (SWFDEC_IS_LOADER (loader));
swfdec_player_set_loader_with_variables (player, loader, NULL);
@@ -2112,14 +2174,16 @@ void
swfdec_player_set_loader_with_variables (SwfdecPlayer *player, SwfdecLoader *loader,
const char *variables)
{
+ SwfdecPlayerPrivate *priv;
SwfdecMovie *movie;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (player->resource == NULL);
+ g_return_if_fail (player->priv->resource == NULL);
g_return_if_fail (SWFDEC_IS_LOADER (loader));
- player->resource = swfdec_resource_new (player, loader, variables);
- movie = swfdec_movie_new (player, -16384, NULL, player->resource, NULL, SWFDEC_AS_STR__level0);
+ priv = player->priv;
+ priv->resource = swfdec_resource_new (player, loader, variables);
+ movie = swfdec_movie_new (player, -16384, NULL, priv->resource, NULL, SWFDEC_AS_STR__level0);
movie->name = SWFDEC_AS_STR_EMPTY;
g_object_unref (loader);
}
@@ -2335,6 +2399,7 @@ swfdec_player_render (SwfdecPlayer *player, cairo_t *cr,
double x, double y, double width, double height)
{
static const SwfdecColorTransform trans = { FALSE, 256, 0, 256, 0, 256, 0, 256, 0 };
+ SwfdecPlayerPrivate *priv;
GList *walk;
SwfdecRect real;
@@ -2347,30 +2412,31 @@ swfdec_player_render (SwfdecPlayer *player, cairo_t *cr,
if (!swfdec_player_is_initialized (player))
return;
+ priv = player->priv;
if (width == 0.0)
- width = player->stage_width;
+ width = priv->stage_width;
if (height == 0.0)
- height = player->stage_height;
+ height = priv->stage_height;
/* clip the area */
cairo_save (cr);
cairo_rectangle (cr, x, y, width, height);
cairo_clip (cr);
/* compute the rectangle */
- x -= player->offset_x;
- y -= player->offset_y;
- real.x0 = floor (x * SWFDEC_TWIPS_SCALE_FACTOR) / player->scale_x;
- real.y0 = floor (y * SWFDEC_TWIPS_SCALE_FACTOR) / player->scale_y;
- real.x1 = ceil ((x + width) * SWFDEC_TWIPS_SCALE_FACTOR) / player->scale_x;
- real.y1 = ceil ((y + height) * SWFDEC_TWIPS_SCALE_FACTOR) / player->scale_y;
+ x -= priv->offset_x;
+ y -= priv->offset_y;
+ real.x0 = floor (x * SWFDEC_TWIPS_SCALE_FACTOR) / priv->scale_x;
+ real.y0 = floor (y * SWFDEC_TWIPS_SCALE_FACTOR) / priv->scale_y;
+ real.x1 = ceil ((x + width) * SWFDEC_TWIPS_SCALE_FACTOR) / priv->scale_x;
+ real.y1 = ceil ((y + height) * SWFDEC_TWIPS_SCALE_FACTOR) / priv->scale_y;
SWFDEC_INFO ("=== %p: START RENDER, area %g %g %g %g ===", player,
real.x0, real.y0, real.x1, real.y1);
/* convert the cairo matrix */
- cairo_translate (cr, player->offset_x, player->offset_y);
- cairo_scale (cr, player->scale_x / SWFDEC_TWIPS_SCALE_FACTOR, player->scale_y / SWFDEC_TWIPS_SCALE_FACTOR);
- swfdec_color_set_source (cr, player->bgcolor);
+ cairo_translate (cr, priv->offset_x, priv->offset_y);
+ cairo_scale (cr, priv->scale_x / SWFDEC_TWIPS_SCALE_FACTOR, priv->scale_y / SWFDEC_TWIPS_SCALE_FACTOR);
+ swfdec_color_set_source (cr, priv->bgcolor);
cairo_paint (cr);
- for (walk = player->roots; walk; walk = walk->next) {
+ for (walk = priv->roots; walk; walk = walk->next) {
swfdec_movie_render (walk->data, cr, &trans, &real);
}
SWFDEC_INFO ("=== %p: END RENDER ===", player);
@@ -2388,11 +2454,14 @@ swfdec_player_render (SwfdecPlayer *player, cairo_t *cr,
void
swfdec_player_advance (SwfdecPlayer *player, gulong msecs)
{
+ SwfdecPlayerPrivate *priv;
guint frames;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- frames = SWFDEC_TICKS_TO_SAMPLES (player->time + SWFDEC_MSECS_TO_TICKS (msecs))
- - SWFDEC_TICKS_TO_SAMPLES (player->time);
+ priv = player->priv;
+ frames = SWFDEC_TICKS_TO_SAMPLES (priv->time + SWFDEC_MSECS_TO_TICKS (msecs))
+ - SWFDEC_TICKS_TO_SAMPLES (priv->time);
g_signal_emit (player, signals[ADVANCE], 0, msecs, frames);
}
@@ -2413,7 +2482,7 @@ swfdec_player_is_initialized (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), FALSE);
- return player->initialized;
+ return player->priv->initialized;
}
/**
@@ -2463,7 +2532,7 @@ swfdec_player_get_rate (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), 0.0);
- return player->rate / 256.0;
+ return player->priv->rate / 256.0;
}
/**
@@ -2481,9 +2550,9 @@ swfdec_player_get_default_size (SwfdecPlayer *player, guint *width, guint *heigh
g_return_if_fail (SWFDEC_IS_PLAYER (player));
if (width)
- *width = player->width;
+ *width = player->priv->width;
if (height)
- *height = player->height;
+ *height = player->priv->height;
}
/**
@@ -2501,30 +2570,31 @@ swfdec_player_get_size (SwfdecPlayer *player, int *width, int *height)
g_return_if_fail (SWFDEC_IS_PLAYER (player));
if (width)
- *width = player->stage_width;
+ *width = player->priv->stage_width;
if (height)
- *height = player->stage_height;
+ *height = player->priv->stage_height;
}
static void
swfdec_player_update_size (gpointer playerp, gpointer unused)
{
SwfdecPlayer *player = playerp;
+ SwfdecPlayerPrivate *priv = player->priv;
/* FIXME: only update if not fullscreen */
- player->internal_width = player->stage_width >=0 ? (guint) player->stage_width : player->width;
- player->internal_height = player->stage_height >=0 ? (guint) player->stage_height : player->height;
+ priv->internal_width = priv->stage_width >=0 ? (guint) priv->stage_width : priv->width;
+ priv->internal_height = priv->stage_height >=0 ? (guint) priv->stage_height : priv->height;
- if (player->scale_mode != SWFDEC_SCALE_NONE)
+ if (priv->scale_mode != SWFDEC_SCALE_NONE)
return;
/* only broadcast once */
- if (player->internal_width == player->broadcasted_width &&
- player->internal_height == player->broadcasted_height)
+ if (priv->internal_width == priv->broadcasted_width &&
+ priv->internal_height == priv->broadcasted_height)
return;
- player->broadcasted_width = player->internal_width;
- player->broadcasted_height = player->internal_height;
+ priv->broadcasted_width = priv->internal_width;
+ priv->broadcasted_height = priv->internal_height;
swfdec_player_broadcast (player, SWFDEC_AS_STR_Stage, SWFDEC_AS_STR_onResize);
}
@@ -2540,19 +2610,21 @@ swfdec_player_update_size (gpointer playerp, gpointer unused)
void
swfdec_player_set_size (SwfdecPlayer *player, int width, int height)
{
+ SwfdecPlayerPrivate *priv;
gboolean changed = FALSE;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
g_return_if_fail (width >= -1);
g_return_if_fail (height >= -1);
- if (player->stage_width != width) {
- player->stage_width = width;
+ priv = player->priv;
+ if (priv->stage_width != width) {
+ priv->stage_width = width;
g_object_notify (G_OBJECT (player), "width");
changed = TRUE;
}
- if (player->stage_height != height) {
- player->stage_height = height;
+ if (priv->stage_height != height) {
+ priv->stage_height = height;
g_object_notify (G_OBJECT (player), "height");
changed = TRUE;
}
@@ -2575,7 +2647,7 @@ swfdec_player_get_audio (SwfdecPlayer * player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- return player->audio;
+ return player->priv->audio;
}
/**
@@ -2592,7 +2664,7 @@ swfdec_player_get_background_color (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF));
- return player->bgcolor;
+ return player->priv->bgcolor;
}
/**
@@ -2606,16 +2678,19 @@ swfdec_player_get_background_color (SwfdecPlayer *player)
void
swfdec_player_set_background_color (SwfdecPlayer *player, guint color)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- player->bgcolor_set = TRUE;
- if (player->bgcolor == color)
+ priv = player->priv;
+ priv->bgcolor_set = TRUE;
+ if (priv->bgcolor == color)
return;
- player->bgcolor = color;
+ priv->bgcolor = color;
g_object_notify (G_OBJECT (player), "background-color");
if (swfdec_player_is_initialized (player)) {
g_signal_emit (player, signals[INVALIDATE], 0, 0.0, 0.0,
- (double) player->width, (double) player->height);
+ (double) priv->width, (double) priv->height);
}
}
@@ -2633,7 +2708,7 @@ swfdec_player_get_scale_mode (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), SWFDEC_SCALE_SHOW_ALL);
- return player->scale_mode;
+ return player->priv->scale_mode;
}
/**
@@ -2647,10 +2722,13 @@ swfdec_player_get_scale_mode (SwfdecPlayer *player)
void
swfdec_player_set_scale_mode (SwfdecPlayer *player, SwfdecScaleMode mode)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- if (player->scale_mode != mode) {
- player->scale_mode = mode;
+ priv = player->priv;
+ if (priv->scale_mode != mode) {
+ priv->scale_mode = mode;
swfdec_player_update_scale (player);
g_object_notify (G_OBJECT (player), "scale-mode");
swfdec_player_add_external_action (player, player, swfdec_player_update_size, NULL);
@@ -2672,7 +2750,7 @@ swfdec_player_get_alignment (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), SWFDEC_ALIGNMENT_CENTER);
- return swfdec_player_alignment_from_flags (player->align_flags);
+ return swfdec_player_alignment_from_flags (player->priv->align_flags);
}
/**
@@ -2697,10 +2775,13 @@ swfdec_player_set_alignment (SwfdecPlayer *player, SwfdecAlignment align)
void
swfdec_player_set_align_flags (SwfdecPlayer *player, guint flags)
{
+ SwfdecPlayerPrivate *priv;
+
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- if (flags != player->align_flags) {
- player->align_flags = flags;
+ priv = player->priv;
+ if (flags != priv->align_flags) {
+ priv->align_flags = flags;
swfdec_player_update_scale (player);
g_object_notify (G_OBJECT (player), "alignment");
}
@@ -2721,7 +2802,7 @@ swfdec_player_get_maximum_runtime (SwfdecPlayer *player)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), 0);
- return player->max_runtime;
+ return player->priv->max_runtime;
}
/**
@@ -2745,7 +2826,7 @@ swfdec_player_set_maximum_runtime (SwfdecPlayer *player, gulong msecs)
{
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- player->max_runtime = msecs;
+ player->priv->max_runtime = msecs;
g_object_notify (G_OBJECT (player), "max-runtime");
}
diff --git a/libswfdec/swfdec_player.h b/libswfdec/swfdec_player.h
index 903eabb..16ec52d 100644
--- a/libswfdec/swfdec_player.h
+++ b/libswfdec/swfdec_player.h
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include <cairo.h>
+#include <libswfdec/swfdec_as_context.h>
#include <libswfdec/swfdec_as_types.h>
#include <libswfdec/swfdec_loader.h>
@@ -54,6 +55,7 @@ typedef enum {
} SwfdecScaleMode;
typedef struct _SwfdecPlayer SwfdecPlayer;
+typedef struct _SwfdecPlayerPrivate SwfdecPlayerPrivate;
typedef struct _SwfdecPlayerClass SwfdecPlayerClass;
#define SWFDEC_TYPE_PLAYER (swfdec_player_get_type())
@@ -63,6 +65,29 @@ typedef struct _SwfdecPlayerClass SwfdecPlayerClass;
#define SWFDEC_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_PLAYER, SwfdecPlayerClass))
#define SWFDEC_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_PLAYER, SwfdecPlayerClass))
+struct _SwfdecPlayer
+{
+ SwfdecAsContext context;
+ SwfdecPlayerPrivate * priv;
+};
+
+struct _SwfdecPlayerClass
+{
+ SwfdecAsContextClass context_class;
+
+ void (* advance) (SwfdecPlayer * player,
+ gulong msecs,
+ guint audio_samples);
+ gboolean (* handle_key) (SwfdecPlayer * player,
+ guint key,
+ guint character,
+ gboolean down);
+ gboolean (* handle_mouse) (SwfdecPlayer * player,
+ double x,
+ double y,
+ int button);
+};
+
void swfdec_init (void);
GType swfdec_player_get_type (void);
diff --git a/libswfdec/swfdec_player_internal.h b/libswfdec/swfdec_player_internal.h
index 8fff190..07d3fa8 100644
--- a/libswfdec/swfdec_player_internal.h
+++ b/libswfdec/swfdec_player_internal.h
@@ -21,7 +21,6 @@
#define _SWFDEC_PLAYER_INTERNAL_H_
#include <libswfdec/swfdec_player.h>
-#include <libswfdec/swfdec_as_context.h>
#include <libswfdec/swfdec_audio.h>
#include <libswfdec/swfdec_event.h>
#include <libswfdec/swfdec_rect.h>
@@ -50,9 +49,9 @@ struct _SwfdecTimeout {
#define SWFDEC_PLAYER_N_ACTION_QUEUES 4
-struct _SwfdecPlayer
+struct _SwfdecPlayerPrivate
{
- SwfdecAsContext context;
+ SwfdecPlayer * player; /* backlink */
/* global properties */
SwfdecSystem * system; /* our system properties */
@@ -130,23 +129,6 @@ struct _SwfdecPlayer
SwfdecRingBuffer * actions[SWFDEC_PLAYER_N_ACTION_QUEUES]; /* all actions we've queued up so far */
};
-struct _SwfdecPlayerClass
-{
- SwfdecAsContextClass context_class;
-
- void (* advance) (SwfdecPlayer * player,
- gulong msecs,
- guint audio_samples);
- gboolean (* handle_key) (SwfdecPlayer * player,
- guint key,
- guint character,
- gboolean down);
- gboolean (* handle_mouse) (SwfdecPlayer * player,
- double x,
- double y,
- int button);
-};
-
void swfdec_player_initialize (SwfdecPlayer * player,
guint version,
guint rate,
@@ -174,7 +156,7 @@ void swfdec_player_set_export_class (SwfdecPlayer * player,
const char * name,
SwfdecAsObject * object);
-#define swfdec_player_is_mouse_pressed(player) ((player)->mouse_button & 1)
+#define swfdec_player_is_mouse_pressed(player) ((player)->priv->mouse_button & 1)
void swfdec_player_invalidate (SwfdecPlayer * player,
const SwfdecRect * rect);
void swfdec_player_add_timeout (SwfdecPlayer * player,
diff --git a/libswfdec/swfdec_policy_loader.c b/libswfdec/swfdec_policy_loader.c
index 983a034..6d04c75 100644
--- a/libswfdec/swfdec_policy_loader.c
+++ b/libswfdec/swfdec_policy_loader.c
@@ -226,7 +226,7 @@ swfdec_policy_loader_new (SwfdecFlashSecurity *sec, const char *host,
url_str = g_strdup_printf ("http://%s/crossdomain.xml", host);
url = swfdec_url_new (url_str);
g_free (url_str);
- policy_loader->loader = swfdec_loader_load (sec->player->resource->loader,
+ policy_loader->loader = swfdec_loader_load (sec->player->priv->resource->loader,
url, SWFDEC_LOADER_REQUEST_DEFAULT, NULL, 0);
swfdec_url_free (url);
diff --git a/libswfdec/swfdec_resource.c b/libswfdec/swfdec_resource.c
index 027027a..cac371a 100644
--- a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -57,7 +57,7 @@ swfdec_resource_is_root (SwfdecResource *resource)
g_return_val_if_fail (SWFDEC_IS_RESOURCE (resource), FALSE);
return
- resource->movie == SWFDEC_FLASH_SECURITY (resource)->player->roots->data;
+ resource->movie == SWFDEC_FLASH_SECURITY (resource)->player->priv->roots->data;
}
static SwfdecPlayer *
@@ -119,7 +119,7 @@ swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolea
return;
cx = SWFDEC_AS_OBJECT (resource->clip_loader)->context;
g_assert (resource->target);
- movie = swfdec_action_lookup_object (cx, SWFDEC_PLAYER (cx)->roots->data,
+ movie = swfdec_action_lookup_object (cx, SWFDEC_PLAYER (cx)->priv->roots->data,
resource->target, resource->target + strlen (resource->target));
if (!SWFDEC_IS_SPRITE_MOVIE (movie)) {
SWFDEC_DEBUG ("no movie, not emitting signal");
@@ -203,7 +203,7 @@ swfdec_resource_create_movie (SwfdecResource *resource)
return TRUE;
player = SWFDEC_FLASH_SECURITY (resource)->player;
movie = (SwfdecSpriteMovie *) swfdec_action_lookup_object (SWFDEC_AS_CONTEXT (player),
- player->roots->data, resource->target, resource->target + strlen (resource->target));
+ player->priv->roots->data, resource->target, resource->target + strlen (resource->target));
if (!SWFDEC_IS_SPRITE_MOVIE (movie)) {
level = swfdec_player_get_level (player, resource->target);
if (level < 0) {
@@ -498,7 +498,7 @@ swfdec_resource_do_unload (SwfdecPlayer *player, const char *target, gpointer re
SwfdecSpriteMovie *movie;
movie = (SwfdecSpriteMovie *) swfdec_action_lookup_object (
- SWFDEC_AS_CONTEXT (player), player->roots->data,
+ SWFDEC_AS_CONTEXT (player), player->priv->roots->data,
target, target + strlen (target));
if (!SWFDEC_IS_SPRITE_MOVIE (movie)) {
SWFDEC_DEBUG ("no movie, not unloading");
diff --git a/libswfdec/swfdec_resource_request.c b/libswfdec/swfdec_resource_request.c
index 7b17d12..020625d 100644
--- a/libswfdec/swfdec_resource_request.c
+++ b/libswfdec/swfdec_resource_request.c
@@ -68,11 +68,11 @@ swfdec_player_request_resource_allow_callback (const SwfdecURL *url,
loader = NULL;
} else {
if (data->buffer) {
- loader = swfdec_loader_load (data->player->resource->loader, url,
+ loader = swfdec_loader_load (data->player->priv->resource->loader, url,
data->request, (const char *) data->buffer->data,
data->buffer->length);
} else {
- loader = swfdec_loader_load (data->player->resource->loader, url,
+ loader = swfdec_loader_load (data->player->priv->resource->loader, url,
data->request, NULL, 0);
}
}
@@ -102,7 +102,7 @@ swfdec_player_request_resource_now (SwfdecPlayer *player,
data->user_data = user_data;
/* create absolute url first */
- absolute = swfdec_url_new_relative (swfdec_loader_get_url (player->resource->loader), url);
+ absolute = swfdec_url_new_relative (swfdec_loader_get_url (player->priv->resource->loader), url);
swfdec_security_allow_url (security, absolute,
swfdec_player_request_resource_allow_callback, data);
@@ -130,7 +130,7 @@ swfdec_request_resource_perform_load_callback (SwfdecPlayer *player,
static void
swfdec_request_resource_perform_load (SwfdecPlayer *player, SwfdecResourceRequest *request)
{
- g_assert (player->resource);
+ g_assert (player->priv->resource);
swfdec_player_request_resource_now (player, request->security,
request->url, request->request, request->buffer,
swfdec_request_resource_perform_load_callback, request);
@@ -172,8 +172,8 @@ swfdec_player_resource_request_perform (SwfdecPlayer *player)
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- list = player->resource_requests;
- player->resource_requests = NULL;
+ list = player->priv->resource_requests;
+ player->priv->resource_requests = NULL;
g_slist_foreach (list, swfdec_request_resource_perform_one, player);
g_slist_free (list);
}
@@ -201,7 +201,7 @@ swfdec_player_request_resource (SwfdecPlayer *player, SwfdecSecurity *security,
request->destroy = destroy;
request->data = data;
- player->resource_requests = g_slist_append (player->resource_requests, request);
+ player->priv->resource_requests = g_slist_append (player->priv->resource_requests, request);
}
static gboolean
@@ -250,7 +250,7 @@ swfdec_player_request_fscommand (SwfdecPlayer *player, const char *command,
request->command = g_ascii_strdown (command, -1);
request->value = g_strdup (value);
- player->resource_requests = g_slist_append (player->resource_requests, request);
+ player->priv->resource_requests = g_slist_append (player->priv->resource_requests, request);
return TRUE;
}
@@ -270,7 +270,7 @@ swfdec_player_request_unload (SwfdecPlayer *player, const char *target,
request->data = data;
request->destroy = destroy;
- player->resource_requests = g_slist_append (player->resource_requests, request);
+ player->priv->resource_requests = g_slist_append (player->priv->resource_requests, request);
}
void
@@ -284,8 +284,8 @@ swfdec_player_resource_request_finish (SwfdecPlayer *player)
{
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_slist_foreach (player->resource_requests, (GFunc) swfdec_resource_request_free, NULL);
- g_slist_free (player->resource_requests);
- player->resource_requests = NULL;
+ g_slist_foreach (player->priv->resource_requests, (GFunc) swfdec_resource_request_free, NULL);
+ g_slist_free (player->priv->resource_requests);
+ player->priv->resource_requests = NULL;
}
diff --git a/libswfdec/swfdec_sound_object.c b/libswfdec/swfdec_sound_object.c
index 8beda57..1d95fdb 100644
--- a/libswfdec/swfdec_sound_object.c
+++ b/libswfdec/swfdec_sound_object.c
@@ -332,7 +332,7 @@ swfdec_sound_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object, guin
* We use the target in attachSound to look up the sound object to attach.
* But I'm not sure what is used for global sounds.
* So we just use a random one that looks good for now. */
- sound->target = player->roots->data;
+ sound->target = player->priv->roots->data;
} else {
sound->target = swfdec_player_get_movie_from_value (player, &argv[0]);
}
diff --git a/libswfdec/swfdec_sprite.c b/libswfdec/swfdec_sprite.c
index d17cbd5..ae61642 100644
--- a/libswfdec/swfdec_sprite.c
+++ b/libswfdec/swfdec_sprite.c
@@ -126,20 +126,21 @@ int
tag_func_set_background_color (SwfdecSwfDecoder * s, guint tag)
{
SwfdecPlayer *player = SWFDEC_DECODER (s)->player;
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecColor color = swfdec_bits_get_color (&s->b);
- if (player->bgcolor_set) {
+ if (priv->bgcolor_set) {
/* only an INFO because it can be set by user, should be error if we check duplication of tag */
SWFDEC_INFO ("background color has been set to %X already, setting to %X ignored",
- player->bgcolor, color);
+ priv->bgcolor, color);
} else {
SWFDEC_LOG ("setting background color to %X", color);
/* can't use swfdec_player_set_background_color() here, because the player is locked and doesn't emit signals */
- player->bgcolor = color;
- player->bgcolor_set = TRUE;
- player->invalid_extents = player->stage;
- g_array_set_size (player->invalidations, 1);
- g_array_index (player->invalidations, SwfdecRectangle, 0) = player->stage;
+ priv->bgcolor = color;
+ priv->bgcolor_set = TRUE;
+ priv->invalid_extents = priv->stage;
+ g_array_set_size (priv->invalidations, 1);
+ g_array_index (priv->invalidations, SwfdecRectangle, 0) = priv->stage;
g_object_notify (G_OBJECT (player), "background-color");
}
diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index 1626ede..791f985 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -641,8 +641,8 @@ swfdec_sprite_movie_add (SwfdecAsObject *object)
{
SwfdecPlayer *player = SWFDEC_PLAYER (object->context);
- if (player->MovieClip)
- swfdec_as_object_set_constructor (object, player->MovieClip);
+ if (player->priv->MovieClip)
+ swfdec_as_object_set_constructor (object, player->priv->MovieClip);
SWFDEC_AS_OBJECT_CLASS (swfdec_sprite_movie_parent_class)->add (object);
}
diff --git a/libswfdec/swfdec_sprite_movie_as.c b/libswfdec/swfdec_sprite_movie_as.c
index b4b5774..e1c4f5d 100644
--- a/libswfdec/swfdec_sprite_movie_as.c
+++ b/libswfdec/swfdec_sprite_movie_as.c
@@ -825,19 +825,20 @@ swfdec_sprite_movie_setMask (SwfdecAsContext *cx, SwfdecAsObject *object,
void
swfdec_sprite_movie_init_context (SwfdecPlayer *player, guint version)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecAsContext *context = SWFDEC_AS_CONTEXT (player);
SwfdecAsValue val;
SwfdecAsObject *proto;
- player->MovieClip = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global,
+ priv->MovieClip = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global,
SWFDEC_AS_STR_MovieClip, 0, NULL, 0));
- if (player->MovieClip == NULL)
+ if (priv->MovieClip == NULL)
return;
proto = swfdec_as_object_new (context);
if (!proto)
return;
SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
- swfdec_as_object_set_variable_and_flags (player->MovieClip,
+ swfdec_as_object_set_variable_and_flags (priv->MovieClip,
SWFDEC_AS_STR_prototype, &val, SWFDEC_AS_VARIABLE_HIDDEN |
SWFDEC_AS_VARIABLE_PERMANENT);
};
diff --git a/libswfdec/swfdec_stage_as.c b/libswfdec/swfdec_stage_as.c
index b9cbda4..cd69731 100644
--- a/libswfdec/swfdec_stage_as.c
+++ b/libswfdec/swfdec_stage_as.c
@@ -36,7 +36,7 @@ get_scaleMode (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- switch (player->scale_mode) {
+ switch (player->priv->scale_mode) {
case SWFDEC_SCALE_SHOW_ALL:
SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_showAll);
break;
@@ -85,16 +85,17 @@ get_align (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
+ SwfdecPlayerPrivate *priv = player->priv;
char s[5];
guint i = 0;
- if (player->align_flags & SWFDEC_ALIGN_FLAG_LEFT)
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_LEFT)
s[i++] = 'L';
- if (player->align_flags & SWFDEC_ALIGN_FLAG_TOP)
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_TOP)
s[i++] = 'T';
- if (player->align_flags & SWFDEC_ALIGN_FLAG_RIGHT)
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_RIGHT)
s[i++] = 'R';
- if (player->align_flags & SWFDEC_ALIGN_FLAG_BOTTOM)
+ if (priv->align_flags & SWFDEC_ALIGN_FLAG_BOTTOM)
s[i++] = 'B';
s[i] = 0;
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (cx, s));
@@ -122,8 +123,8 @@ set_align (SwfdecAsContext *cx, SwfdecAsObject *object,
if (strchr (s, 'b') || strchr (s, 'B'))
flags |= SWFDEC_ALIGN_FLAG_BOTTOM;
- if (flags != player->align_flags) {
- player->align_flags = flags;
+ if (flags != player->priv->align_flags) {
+ player->priv->align_flags = flags;
g_object_notify (G_OBJECT (player), "alignment");
swfdec_player_update_scale (player);
}
@@ -136,7 +137,7 @@ get_width (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (ret, player->internal_width);
+ SWFDEC_AS_VALUE_SET_INT (ret, player->priv->internal_width);
}
SWFDEC_AS_NATIVE (666, 7, get_height)
@@ -146,7 +147,7 @@ get_height (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- SWFDEC_AS_VALUE_SET_INT (ret, player->internal_height);
+ SWFDEC_AS_VALUE_SET_INT (ret, player->priv->internal_height);
}
/* FIXME: do this smarter */
diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c
index f079c54..28223f0 100644
--- a/libswfdec/swfdec_swf_decoder.c
+++ b/libswfdec/swfdec_swf_decoder.c
@@ -460,7 +460,7 @@ swfdec_swf_decoder_create_character (SwfdecSwfDecoder * s, guint id, GType type)
result->id = id;
g_hash_table_insert (s->characters, GUINT_TO_POINTER (id), result);
if (SWFDEC_IS_CACHED (result)) {
- swfdec_cached_set_cache (SWFDEC_CACHED (result), SWFDEC_DECODER (s)->player->cache);
+ swfdec_cached_set_cache (SWFDEC_CACHED (result), SWFDEC_DECODER (s)->player->priv->cache);
}
return result;
diff --git a/libswfdec/swfdec_system_as.c b/libswfdec/swfdec_system_as.c
index 36946d5..0ba3f9e 100644
--- a/libswfdec/swfdec_system_as.c
+++ b/libswfdec/swfdec_system_as.c
@@ -157,66 +157,66 @@ swfdec_system_has_screen_playback (SwfdecPlayer *player, SwfdecAsValue *ret)
static void
swfdec_system_is_debugger (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, player->system->debugger);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, player->priv->system->debugger);
}
static void
swfdec_system_version (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->version));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->version));
}
static void
swfdec_system_manufacturer (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->manufacturer));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->manufacturer));
}
static void
swfdec_system_screen_width (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- SWFDEC_AS_VALUE_SET_INT (ret, player->system->screen_width);
+ SWFDEC_AS_VALUE_SET_INT (ret, player->priv->system->screen_width);
}
static void
swfdec_system_screen_height (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- SWFDEC_AS_VALUE_SET_INT (ret, player->system->screen_height);
+ SWFDEC_AS_VALUE_SET_INT (ret, player->priv->system->screen_height);
}
static void
swfdec_system_screen_dpi (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- SWFDEC_AS_VALUE_SET_INT (ret, player->system->dpi);
+ SWFDEC_AS_VALUE_SET_INT (ret, player->priv->system->dpi);
}
static void
swfdec_system_screen_color (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->color_mode));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->color_mode));
}
static void
swfdec_system_screen_par (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- SWFDEC_AS_VALUE_SET_NUMBER (ret, player->system->par);
+ SWFDEC_AS_VALUE_SET_NUMBER (ret, player->priv->system->par);
}
static void
swfdec_system_os (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->os));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->os));
}
static void
swfdec_system_language (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->language));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->language));
}
static void
@@ -229,7 +229,7 @@ static void
swfdec_system_player_type (SwfdecPlayer *player, SwfdecAsValue *ret)
{
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (
- SWFDEC_AS_CONTEXT (player), player->system->player_type));
+ SWFDEC_AS_CONTEXT (player), player->priv->system->player_type));
}
static void
@@ -319,7 +319,7 @@ swfdec_system_query (SwfdecAsContext *cx, SwfdecAsObject *object,
g_string_append (server, "&AR=");
g_string_append (server, buffer);
} else if (queries[i].name == SWFDEC_AS_STR_manufacturer) {
- char *s = swfdec_as_string_escape (cx, player->system->server_manufacturer);
+ char *s = swfdec_as_string_escape (cx, player->priv->system->server_manufacturer);
g_string_append_printf (server, "&M=%s", s);
g_free (s);
} else {
diff --git a/libswfdec/swfdec_system_security.c b/libswfdec/swfdec_system_security.c
index 46e2caf..dd01317 100644
--- a/libswfdec/swfdec_system_security.c
+++ b/libswfdec/swfdec_system_security.c
@@ -80,7 +80,7 @@ swfdec_system_security_get_sandboxType (SwfdecAsContext *cx,
SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
SwfdecAsValue *ret)
{
- switch (SWFDEC_FLASH_SECURITY (SWFDEC_PLAYER (cx)->resource)->sandbox) {
+ switch (SWFDEC_FLASH_SECURITY (SWFDEC_PLAYER (cx)->priv->resource)->sandbox) {
case SWFDEC_SANDBOX_REMOTE:
SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_remote);
break;
diff --git a/libswfdec/swfdec_video_movie.c b/libswfdec/swfdec_video_movie.c
index f13b961..046befb 100644
--- a/libswfdec/swfdec_video_movie.c
+++ b/libswfdec/swfdec_video_movie.c
@@ -131,7 +131,7 @@ swfdec_video_movie_init_movie (SwfdecMovie *movie)
{
SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), player->Video);
+ swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), player->priv->Video);
}
static void
diff --git a/libswfdec/swfdec_video_movie_as.c b/libswfdec/swfdec_video_movie_as.c
index 0ff1506..833c634 100644
--- a/libswfdec/swfdec_video_movie_as.c
+++ b/libswfdec/swfdec_video_movie_as.c
@@ -74,7 +74,7 @@ swfdec_video_movie_init_context (SwfdecPlayer *player, guint version)
SWFDEC_AS_STR_Video, 0, NULL, 0));
if (video == NULL)
return;
- player->Video = video;
+ player->priv->Video = video;
proto = swfdec_as_object_new_empty (context);
if (proto == NULL)
return;
diff --git a/test/dump.c b/test/dump.c
index 01a1776..48f037d 100644
--- a/test/dump.c
+++ b/test/dump.c
@@ -402,8 +402,8 @@ main (int argc, char *argv[])
}
player = swfdec_player_new_from_file (argv[1]);
- if (player->resource->loader->error) {
- g_printerr ("Couldn't open file \"%s\": %s\n", argv[1], player->resource->loader->error);
+ if (player->priv->resource->loader->error) {
+ g_printerr ("Couldn't open file \"%s\": %s\n", argv[1], player->priv->resource->loader->error);
g_object_unref (player);
return 1;
}
@@ -415,7 +415,7 @@ main (int argc, char *argv[])
player = NULL;
return 1;
}
- s = (SwfdecSwfDecoder *) SWFDEC_MOVIE (player->roots->data)->resource->decoder;
+ s = (SwfdecSwfDecoder *) SWFDEC_MOVIE (player->priv->roots->data)->resource->decoder;
/* FIXME: can happen after a _root.loadMovie() call */
if (!SWFDEC_IS_SWF_DECODER (s)) {
g_printerr ("Movie already unloaded from \"%s\"\n", argv[1]);
diff --git a/test/swfdec-extract.c b/test/swfdec-extract.c
index 8a36820..3edfd25 100644
--- a/test/swfdec-extract.c
+++ b/test/swfdec-extract.c
@@ -261,7 +261,7 @@ main (int argc, char *argv[])
player = swfdec_player_new_from_file (argv[1]);
/* FIXME: HACK! */
swfdec_player_advance (player, 0);
- if (!SWFDEC_IS_SPRITE_MOVIE (player->roots->data)) {
+ if (!SWFDEC_IS_SPRITE_MOVIE (player->priv->roots->data)) {
g_printerr ("Error parsing file \"%s\"\n", argv[1]);
g_object_unref (player);
player = NULL;
@@ -270,11 +270,11 @@ main (int argc, char *argv[])
id = strtol (argv[2], NULL, 0);
if (id >= 0) {
character = swfdec_swf_decoder_get_character (
- SWFDEC_SWF_DECODER (SWFDEC_MOVIE (player->roots->data)->resource->decoder),
+ SWFDEC_SWF_DECODER (SWFDEC_MOVIE (player->priv->roots->data)->resource->decoder),
id);
} else {
character = SWFDEC_CHARACTER (SWFDEC_SWF_DECODER (
- SWFDEC_MOVIE (player->roots->data)->resource->decoder)->main_sprite);
+ SWFDEC_MOVIE (player->priv->roots->data)->resource->decoder)->main_sprite);
}
if (SWFDEC_IS_SPRITE (character)) {
if (!export_sprite_sound (SWFDEC_SPRITE (character), argv[3]))
More information about the Swfdec
mailing list