[Swfdec-commits] 2 commits - swfdec/swfdec_player.c swfdec/swfdec_player.h test/swfdec_test_plugin.c
Benjamin Otte
company at kemper.freedesktop.org
Fri Feb 15 10:42:13 PST 2008
swfdec/swfdec_player.c | 38 ++++++++++++++++++++++++++++++++++----
swfdec/swfdec_player.h | 3 +++
test/swfdec_test_plugin.c | 3 ++-
3 files changed, 39 insertions(+), 5 deletions(-)
New commits:
commit e331815f492079bab0340a860e298580dbac8860
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Feb 15 19:42:07 2008 +0100
whoops, don't set the beginning as the default start time.
Only use it in the testsuite.
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index a5d2c72..9497250 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -920,9 +920,10 @@ swfdec_player_set_property (GObject *object, guint param_id, const GValue *value
break;
case PROP_START_TIME:
{
- static const GTimeVal the_beginning = { 1035840244, 0 };
const GTimeVal *set = g_value_get_boxed (value);
- SWFDEC_AS_CONTEXT (player)->start_time = set ? *set : the_beginning;
+ if (set)
+ SWFDEC_AS_CONTEXT (player)->start_time = set;
+ /* else use default time from context */
}
break;
default:
diff --git a/test/swfdec_test_plugin.c b/test/swfdec_test_plugin.c
index 6394856..a021c57 100644
--- a/test/swfdec_test_plugin.c
+++ b/test/swfdec_test_plugin.c
@@ -123,6 +123,7 @@ swfdec_test_plugin_swfdec_notify (SwfdecPlayer *player, GParamSpec *pspec, Swfde
void
swfdec_test_plugin_swfdec_new (SwfdecTestPlugin *plugin)
{
+ static const GTimeVal the_beginning = { 1035840244, 0 };
SwfdecPlayer *player;
SwfdecURL *url;
@@ -134,7 +135,7 @@ swfdec_test_plugin_swfdec_new (SwfdecTestPlugin *plugin)
plugin->finish = swfdec_test_plugin_swfdec_finish;
plugin->data = player = g_object_new (SWFDEC_TYPE_PLAYER, "random-seed", 0,
"loader-type", SWFDEC_TYPE_FILE_LOADER, "socket-type", SWFDEC_TYPE_TEST_SWFDEC_SOCKET,
- "max-runtime", 0,
+ "max-runtime", 0, "start-time", &the_beginning,
NULL);
g_object_set_data (G_OBJECT (player), "plugin", plugin);
commit b5f4d3dfa469df2c0f4315e12c967eff293c4655
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Feb 15 19:39:38 2008 +0100
make the start time configurable
and add a SWFDEC_TYPE_TIME_VAL for its property
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 08f66ed..a5d2c72 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -237,6 +237,27 @@
* keyboard.
*/
+/*** timeval type mapping ***/
+
+static gpointer
+swfdec_time_val_copy (gpointer boxed)
+{
+ return g_memdup (boxed, sizeof (GTimeVal));
+}
+
+GType
+swfdec_time_val_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ type = g_boxed_type_register_static ("SwfdecTimeVal",
+ swfdec_time_val_copy, g_free);
+ }
+
+ return type;
+}
+
/*** Timeouts ***/
static SwfdecTick
@@ -634,7 +655,8 @@ enum {
PROP_SOCKET_TYPE,
PROP_BASE_URL,
PROP_URL,
- PROP_VARIABLES
+ PROP_VARIABLES,
+ PROP_START_TIME
};
G_DEFINE_TYPE (SwfdecPlayer, swfdec_player, SWFDEC_TYPE_AS_CONTEXT)
@@ -896,6 +918,13 @@ swfdec_player_set_property (GObject *object, guint param_id, const GValue *value
case PROP_VARIABLES:
swfdec_player_set_variables (player, g_value_get_boxed (value));
break;
+ case PROP_START_TIME:
+ {
+ static const GTimeVal the_beginning = { 1035840244, 0 };
+ const GTimeVal *set = g_value_get_boxed (value);
+ SWFDEC_AS_CONTEXT (player)->start_time = set ? *set : the_beginning;
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -1697,6 +1726,9 @@ swfdec_player_class_init (SwfdecPlayerClass *klass)
g_object_class_install_property (object_class, PROP_VARIABLES,
g_param_spec_string ("variables", "variables", "variables to use when setting the URL",
NULL, G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_START_TIME,
+ g_param_spec_boxed ("start-time", "start-time", "time to use as the beginning time for this player",
+ SWFDEC_TYPE_TIME_VAL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
/**
* SwfdecPlayer::invalidate:
@@ -2297,7 +2329,6 @@ swfdec_player_use_video_codec (SwfdecPlayer *player, guint codec)
SwfdecPlayer *
swfdec_player_new (SwfdecAsDebugger *debugger)
{
- static const GTimeVal the_beginning = { 1035840244, 0 };
SwfdecPlayer *player;
g_return_val_if_fail (debugger == NULL || SWFDEC_IS_AS_DEBUGGER (debugger), NULL);
@@ -2307,8 +2338,6 @@ swfdec_player_new (SwfdecAsDebugger *debugger)
"loader-type", SWFDEC_TYPE_FILE_LOADER, "socket-type", SWFDEC_TYPE_SOCKET,
"max-runtime", 0,
"debugger", debugger, NULL);
- /* FIXME: make this a property or something and don't set it here */
- SWFDEC_AS_CONTEXT (player)->start_time = the_beginning;
return player;
}
diff --git a/swfdec/swfdec_player.h b/swfdec/swfdec_player.h
index a77addf..aa16c1b 100644
--- a/swfdec/swfdec_player.h
+++ b/swfdec/swfdec_player.h
@@ -54,6 +54,9 @@ typedef enum {
SWFDEC_SCALE_NONE
} SwfdecScaleMode;
+#define SWFDEC_TYPE_TIME_VAL swfdec_time_val_get_type()
+GType swfdec_time_val_get_type (void);
+
/* forward declarations */
typedef struct _SwfdecPlayerScripting SwfdecPlayerScripting;
More information about the Swfdec-commits
mailing list