2 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
24 #include "vivi_wrap.h"
25 #include "vivi_application.h"
26 #include "vivi_function.h"
27 #include <swfdec-gtk/swfdec-gtk.h>
29 VIVI_FUNCTION ("player_frame_get", vivi_player_as_frame_get
)
31 vivi_player_as_frame_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
32 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
34 ViviApplication
*app
= VIVI_APPLICATION (cx
);
37 obj
= SWFDEC_AS_OBJECT (swfdec_as_context_get_frame (SWFDEC_AS_CONTEXT (app
->player
)));
39 SWFDEC_AS_VALUE_SET_OBJECT (retval
, vivi_wrap_object (app
, obj
));
42 VIVI_FUNCTION ("player_filename_get", vivi_player_as_filename_get
)
44 vivi_player_as_filename_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
45 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
47 ViviApplication
*app
= VIVI_APPLICATION (cx
);
48 const char *s
= vivi_application_get_filename (app
);
51 SWFDEC_AS_VALUE_SET_STRING (retval
, swfdec_as_context_get_string (cx
, s
));
54 VIVI_FUNCTION ("player_filename_set", vivi_player_as_filename_set
)
56 vivi_player_as_filename_set (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
57 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
59 ViviApplication
*app
= VIVI_APPLICATION (cx
);
64 s
= swfdec_as_value_to_string (cx
, &argv
[0]);
66 vivi_application_set_filename (app
, s
);
69 VIVI_FUNCTION ("player_variables_get", vivi_player_as_variables_get
)
71 vivi_player_as_variables_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
72 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
74 ViviApplication
*app
= VIVI_APPLICATION (cx
);
75 const char *s
= vivi_application_get_variables (app
);
78 SWFDEC_AS_VALUE_SET_STRING (retval
, swfdec_as_context_get_string (cx
, s
));
81 VIVI_FUNCTION ("player_variables_set", vivi_player_as_variables_set
)
83 vivi_player_as_variables_set (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
84 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
86 ViviApplication
*app
= VIVI_APPLICATION (cx
);
91 s
= swfdec_as_value_to_string (cx
, &argv
[0]);
93 vivi_application_set_variables (app
, s
);
96 VIVI_FUNCTION ("player_global_get", vivi_player_as_global_get
)
98 vivi_player_as_global_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
99 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
101 ViviApplication
*app
= VIVI_APPLICATION (cx
);
103 if (SWFDEC_AS_CONTEXT (app
->player
)->global
) {
104 SWFDEC_AS_VALUE_SET_OBJECT (retval
, vivi_wrap_object (app
,
105 SWFDEC_AS_CONTEXT (app
->player
)->global
));
109 VIVI_FUNCTION ("player_sound_get", vivi_player_as_sound_get
)
111 vivi_player_as_sound_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
112 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
114 ViviApplication
*app
= VIVI_APPLICATION (cx
);
116 SWFDEC_AS_VALUE_SET_BOOLEAN (retval
,
117 swfdec_gtk_player_get_audio_enabled (SWFDEC_GTK_PLAYER (app
->player
)));
120 VIVI_FUNCTION ("player_sound_set", vivi_player_as_sound_set
)
122 vivi_player_as_sound_set (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
123 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
125 ViviApplication
*app
= VIVI_APPLICATION (cx
);
129 swfdec_gtk_player_set_audio_enabled (SWFDEC_GTK_PLAYER (app
->player
),
130 swfdec_as_value_to_boolean (cx
, &argv
[0]));