Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 360971
Collapse All | Expand All

(-)file_not_specified_in_diff (-376 / +608 lines)
Line  Link Here
0
-- gxine-0.5.905.orig/m4/_js.m4
0
++ gxine-0.5.905/m4/_js.m4
Lines 51-61 AC_DEFUN([GXINE_PATH_SPIDERMONKEY], Link Here
51
    if test x"$JS_CFLAGS" = x; then
51
    if test x"$JS_CFLAGS" = x; then
52
      AC_MSG_NOTICE([looking for the Spidermonkey Javascript library in various places.])
52
      AC_MSG_NOTICE([looking for the Spidermonkey Javascript library in various places.])
53
53
54
      # Try libmozjs (xulrunner)
54
      JSLIB=mozjs185
55
      AC_MSG_NOTICE([trying mozjs via pkgconfig mozjs185])
56
      PKG_CHECK_MODULES([JS],[mozjs185],[],[:])
55
57
56
      HAVE_JS=xulrunner
58
      if test x"$JS_CFLAGS" = x; then
57
      AC_MSG_NOTICE([trying mozjs via pkgconfig xulrunner-js])
59
        JSLIB=mozjs
58
      PKG_CHECK_MODULES([JS],[xulrunner-js],[],[:])
60
      fi
61
62
      # Try libmozjs (xulrunner)
63
      if test x"$JS_CFLAGS" = x; then
64
        HAVE_JS=xulrunner
65
        AC_MSG_NOTICE([trying mozjs via pkgconfig xulrunner-js])
66
        PKG_CHECK_MODULES([JS],[xulrunner-js],[],[:])
67
      fi
59
68
60
      # Try Mozilla
69
      # Try Mozilla
61
70
Lines 125-130 AC_DEFUN([GXINE_PATH_SPIDERMONKEY], Link Here
125
	[#define XP_UNIX])
135
	[#define XP_UNIX])
126
      CFLAGS="$saved_CFLAGS"
136
      CFLAGS="$saved_CFLAGS"
127
    fi
137
    fi
138
139
    SAVED_LIBS="$LIBS"
140
    LIBS="$JS_LIBS $LIBS"
141
    SAVED_CFLAGS="$CFLAGS"
142
    CFLAGS="$JS_CFLAGS $CFLAGS"
143
    AC_CHECK_LIB([$JSLIB], [JS_NewCompartmentAndGlobalObject],
144
      AC_DEFINE([HAVE_COMPARTMENTS], [1], [Define whether we have compartments]))
145
146
    AC_CHECK_LIB([$JSLIB], [JS_GetStringBytes],
147
      AC_DEFINE([HAVE_JS_GET_STRING_BYTES], [1], [Define whether we have JS_GetStringBytes]))
148
149
    AC_CHECK_LIB([$JSLIB], [JS_NewDouble],
150
      AC_DEFINE([HAVE_JS_NEW_DOUBLE], [1], [Define whether we have JS_NewDouble]))
151
152
    AC_CHECK_LIB([$JSLIB], [JS_StrictPropertyStub],
153
      AC_DEFINE([HAVE_JS_STRICT_PROPERTY_OP], [1], [Define whether we have the JSStrictPropertyOp prototype]))
154
155
    AC_COMPILE_IFELSE(
156
      [AC_LANG_PROGRAM(
157
        [[#include <jsapi.h>]],
158
        [[jsval v; jsdouble *d = JSVAL_TO_DOUBLE(v);]]
159
      )],
160
      AC_DEFINE([JSVAL_TO_DOUBLE_RETURNS_POINTER], [1], [Define whether the JSVAL_TO_DOUBLE function or macro returns a pointer to jsdouble])
161
    )
162
163
    CFLAGS="$JS_CFLAGS -Werror -Wno-attributes"
164
    AC_COMPILE_IFELSE(
165
      [AC_LANG_PROGRAM(
166
        [[#include <jsapi.h>
167
          static JSBool op(JSContext* cx, JSObject* obj, jsid id, jsval* vp) {}]],
168
        [[JSPropertyOp func = op;]]
169
      )],
170
      AC_DEFINE([JS_PROPERTY_OP_HAS_ID_AS_JSID], [1], [Define whether the type of id in the prototype for JSPropertyOp is a jsid])
171
    )
172
    LIBS="$SAVED_LIBS"
173
    CFLAGS="$SAVED_CFLAGS"
174
128
    AC_SUBST(JS_CFLAGS)
175
    AC_SUBST(JS_CFLAGS)
129
    AC_SUBST(JS_LIBS)
176
    AC_SUBST(JS_LIBS)
130
   ])
177
   ])
131
-- gxine-0.5.905.orig/src/script_engine.c
178
++ gxine-0.5.905/src/script_engine.c
Lines 34-40 Link Here
34
#include <stdarg.h>
34
#include <stdarg.h>
35
35
36
#include <gdk/gdkkeysyms.h>
36
#include <gdk/gdkkeysyms.h>
37
#include <jsstr.h>
38
37
39
#include "script_engine.h"
38
#include "script_engine.h"
40
#include "ui.h"
39
#include "ui.h"
Lines 53-58 Link Here
53
#include "snapshot.h"
52
#include "snapshot.h"
54
#include "engine.h"
53
#include "engine.h"
55
#include "history.h"
54
#include "history.h"
55
56
/*
56
/*
57
#define LOG
57
#define LOG
58
*/
58
*/
Lines 194-200 gchar *se_result_str (se_t *se) Link Here
194
    return NULL;
194
    return NULL;
195
195
196
  se->str = JS_ValueToString (se->cx, se->rval);
196
  se->str = JS_ValueToString (se->cx, se->rval);
197
  return JS_GetStringBytes (se->str);
197
  char *encoded = SE_JS_ENCODE_STRING(se->cx, se->str);
198
  char *res = strdup(encoded);
199
  SE_JS_FREE_ENCODED_STRING(se->cx, encoded);
200
  return res;
198
}
201
}
199
202
200
int se_result_int (se_t *se, JSInt32 *num)
203
int se_result_int (se_t *se, JSInt32 *num)
Lines 253-260 se_js_string_val (JSContext *cx, const c Link Here
253
 * methods
256
 * methods
254
 */
257
 */
255
258
256
static JSBool controls_exit (JSContext *cx, JSObject *obj, uintN argc,
259
static JSBool controls_exit (JSContext *cx, uintN argc, jsval *vp)
257
			     jsval *argv, jsval *rval)
258
{
260
{
259
  gchar *fname;
261
  gchar *fname;
260
262
Lines 299-306 static JSBool controls_exit (JSContext * Link Here
299
  exit (0);
301
  exit (0);
300
}
302
}
301
303
302
static JSBool show_js_console (JSContext *cx, JSObject *obj, uintN argc,
304
static JSBool show_js_console (JSContext *cx, uintN argc, jsval *vp)
303
			       jsval *argv, jsval *rval)
304
{
305
{
305
  se_log_fncall_checkinit ("show_js_console");
306
  se_log_fncall_checkinit ("show_js_console");
306
  if (GTK_WIDGET_VISIBLE (se_window))
307
  if (GTK_WIDGET_VISIBLE (se_window))
Lines 311-395 static JSBool show_js_console (JSContext Link Here
311
    se_prop_set_int (gse, js_icon_obj, "v", 0);
312
    se_prop_set_int (gse, js_icon_obj, "v", 0);
312
  }
313
  }
313
314
314
  *rval = JSVAL_VOID;
315
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
315
  return JS_TRUE;
316
  return JS_TRUE;
316
}
317
}
317
318
318
static JSBool
319
static JSBool
319
js_callback (JSContext *cx, JSObject *obj,
320
js_callback (JSContext *cx, uintN argc, jsval *vp)
320
	     uintN argc, jsval *argv, jsval *rval)
321
{
321
{
322
  jsval *argv = JS_ARGV (cx, vp);
322
  se_t *se = (se_t *) JS_GetContextPrivate (cx);
323
  se_t *se = (se_t *) JS_GetContextPrivate (cx);
323
  se_log_fncall ("callback");
324
  se_log_fncall ("callback");
324
  se_argc_check_range (1, 2, "callback");
325
  se_argc_check_range (1, 2, "callback");
325
  se_arg_is_string (0, "callback");
326
  se_arg_is_string (0, "callback");
326
  if (argc > 1)
327
  if (argc > 1)
327
    se_arg_is_object (1, "callback");
328
    se_arg_is_object (1, "callback");
328
  engine_queue_push (JS_GetStringBytes (JS_ValueToString (cx, argv[0])),
329
  char *str = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
329
		     JS_GetPrivate (cx, argc > 1 ? JSVAL_TO_OBJECT (argv[1])
330
  engine_queue_push (str,
330
						 : se->global),
331
 		     JS_GetPrivate (cx, argc > 1 ? JSVAL_TO_OBJECT (argv[1])
331
		     NULL, NULL, NULL, _("JS callback"));
332
 						 : se->global),
332
  *rval = JSVAL_VOID;
333
 		     NULL, NULL, NULL, _("JS callback"));
334
  SE_JS_FREE_ENCODED_STRING (cx, str);
335
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
333
  return JS_TRUE;
336
  return JS_TRUE;
334
}
337
}
335
338
336
static JSBool
339
static JSBool
337
js_xine_cfg_get (JSContext *cx, JSObject *obj,
340
js_xine_cfg_get (JSContext *cx, uintN argc, jsval *vp)
338
		 uintN argc, jsval *argv, jsval *rval)
339
{
341
{
342
  jsval *argv = JS_ARGV (cx, vp);
340
  se_log_fncall ("xine_cfg_get");
343
  se_log_fncall ("xine_cfg_get");
341
  se_argc_check (1, "xine_cfg_get");
344
  se_argc_check (1, "xine_cfg_get");
342
  se_arg_is_string (0, "xine_cfg_get");
345
  se_arg_is_string (0, "xine_cfg_get");
343
346
344
  xine_cfg_entry_t entry;
347
  xine_cfg_entry_t entry;
345
  char *cfg = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
348
  char *cfg = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
346
  if (!xine_config_lookup_entry (xine, cfg, &entry))
349
  if (!xine_config_lookup_entry (xine, cfg, &entry))
347
  {
350
  {
348
    *rval = JSVAL_NULL;
351
    JS_SET_RVAL (cx, vp, JSVAL_NULL);
352
    SE_JS_FREE_ENCODED_STRING (cx, cfg);
349
    return JS_TRUE;
353
    return JS_TRUE;
350
  }
354
  }
351
355
356
  SE_JS_FREE_ENCODED_STRING(cx, cfg);
357
352
  switch (entry.type)
358
  switch (entry.type)
353
  {
359
  {
354
  case XINE_CONFIG_TYPE_RANGE:
360
  case XINE_CONFIG_TYPE_RANGE:
355
  case XINE_CONFIG_TYPE_NUM:
361
  case XINE_CONFIG_TYPE_NUM:
356
    *rval = INT_TO_JSVAL (entry.num_value);
362
    JS_SET_RVAL (cx, vp, INT_TO_JSVAL (entry.num_value));
357
    return JS_TRUE;
363
    return JS_TRUE;
358
364
359
  case XINE_CONFIG_TYPE_BOOL:
365
  case XINE_CONFIG_TYPE_BOOL:
360
    *rval = BOOLEAN_TO_JSVAL (entry.num_value);
366
    JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (entry.num_value));
361
    return JS_TRUE;
367
    return JS_TRUE;
362
368
363
  case XINE_CONFIG_TYPE_STRING:
369
  case XINE_CONFIG_TYPE_STRING:
364
    *rval = se_js_string_val (cx, entry.str_value ? : entry.str_default);
370
    JS_SET_RVAL (cx, vp, se_js_string_val (cx, entry.str_value ? : entry.str_default));
365
    return JS_TRUE;
371
    return JS_TRUE;
366
372
367
  case XINE_CONFIG_TYPE_ENUM:
373
  case XINE_CONFIG_TYPE_ENUM:
368
    *rval = se_js_string_val (cx, entry.enum_values[entry.num_value]);
374
    JS_SET_RVAL (cx, vp, se_js_string_val (cx, entry.enum_values[entry.num_value]));
369
    return JS_TRUE;
375
    return JS_TRUE;
370
376
371
  default:
377
  default:
372
    *rval = JSVAL_NULL;
378
    JS_SET_RVAL (cx, vp, JSVAL_NULL);
373
    return JS_TRUE;
379
    return JS_TRUE;
374
  }
380
  }
375
}
381
}
376
382
377
static JSBool
383
static JSBool
378
js_xine_cfg_set (JSContext *cx, JSObject *obj,
384
js_xine_cfg_set (JSContext *cx, uintN argc, jsval *vp)
379
		 uintN argc, jsval *argv, jsval *rval)
380
{
385
{
386
  jsval *argv = JS_ARGV (cx, vp);
381
  se_log_fncall ("xine_cfg_set");
387
  se_log_fncall ("xine_cfg_set");
382
  se_argc_check (2, "xine_cfg_set");
388
  se_argc_check (2, "xine_cfg_set");
383
  se_arg_is_string (0, "xine_cfg_set");
389
  se_arg_is_string (0, "xine_cfg_set");
384
390
385
  xine_cfg_entry_t entry;
391
  xine_cfg_entry_t entry;
386
  char *cfg = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
392
  char *cfg = SE_JS_ENCODE_STRING (cx, JS_ValueToString(cx, argv[0]));
387
  if (!xine_config_lookup_entry (xine, cfg, &entry))
393
  if (!xine_config_lookup_entry (xine, cfg, &entry))
388
  {
394
  {
389
    *rval = JSVAL_VOID;
395
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
396
    SE_JS_FREE_ENCODED_STRING (cx, cfg);
390
    return JS_TRUE;
397
    return JS_TRUE;
391
  }
398
  }
392
399
400
  SE_JS_FREE_ENCODED_STRING (cx, cfg);
401
393
  int32 num;
402
  int32 num;
394
  switch (entry.type)
403
  switch (entry.type)
395
  {
404
  {
Lines 413-440 js_xine_cfg_set (JSContext *cx, JSObject Link Here
413
422
414
  case XINE_CONFIG_TYPE_STRING:
423
  case XINE_CONFIG_TYPE_STRING:
415
    se_arg_is_string (1, "xine_cfg_set");
424
    se_arg_is_string (1, "xine_cfg_set");
416
    entry.str_value = JS_GetStringBytes (JS_ValueToString (cx, argv[1]));
425
    entry.str_value = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]));
417
    break;
426
    break;
418
427
419
  case XINE_CONFIG_TYPE_ENUM:
428
  case XINE_CONFIG_TYPE_ENUM:
420
    se_arg_is_string (1, "xine_cfg_set");
429
    se_arg_is_string (1, "xine_cfg_set");
421
    char *v = JS_GetStringBytes (JS_ValueToString (cx, argv[1]));
430
    char *v = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]));
422
    int i;
431
    int i;
423
    for (i = 0; entry.enum_values[i]; ++i)
432
    for (i = 0; entry.enum_values[i]; ++i)
424
      if (!strcmp (v, entry.enum_values[i]))
433
      if (!strcmp (v, entry.enum_values[i])) {
434
        SE_JS_FREE_ENCODED_STRING (cx, v);
425
	break;
435
	break;
436
      }
426
    if (entry.enum_values[i])
437
    if (entry.enum_values[i])
427
      entry.num_value = i;
438
      entry.num_value = i;
439
    SE_JS_FREE_ENCODED_STRING (cx, v);
428
    break;
440
    break;
429
441
430
  default:
442
  default:
431
    *rval = JSVAL_VOID;
443
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
432
    return JS_TRUE;
444
    return JS_TRUE;
433
  }
445
  }
434
446
435
  preferences_update_entry (&entry);
447
  preferences_update_entry (&entry);
436
448
437
  *rval = JSVAL_VOID;
449
  if (entry.type == XINE_CONFIG_TYPE_STRING)
450
    SE_JS_FREE_ENCODED_STRING (cx, entry.str_value);
451
452
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
438
  return JS_TRUE;
453
  return JS_TRUE;
439
}
454
}
440
455
Lines 476-483 static char *show_help_int (se_t *se, se Link Here
476
  return help;
491
  return help;
477
}
492
}
478
493
479
static JSBool show_help (JSContext *cx, JSObject *obj, uintN argc,
494
static JSBool show_help (JSContext *cx, uintN argc, jsval *vp)
480
			  jsval *argv, jsval *rval)
481
{
495
{
482
  static char *const group_id[] = {
496
  static char *const group_id[] = {
483
    NULL,
497
    NULL,
Lines 530-536 static JSBool show_help (JSContext *cx, Link Here
530
   * int get_time ();
544
   * int get_time ();
531
   * int get_length ();
545
   * int get_length ();
532
   */
546
   */
533
  *rval = JSVAL_VOID;
547
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
534
  return JS_TRUE;
548
  return JS_TRUE;
535
}
549
}
536
550
Lines 652-659 static jsval get_prop_jsval (se_t *se, s Link Here
652
666
653
  case SE_TYPE_DOUBLE:
667
  case SE_TYPE_DOUBLE:
654
    {
668
    {
655
      jsdouble *d = JS_NewDouble (se->cx, get_prop_double (se, o, p));
669
      jsval rval;
656
      return DOUBLE_TO_JSVAL (d);
670
      SE_JS_NEW_NUMBER_VAL (se->cx, get_prop_double (se, o, p), rval);
671
      return rval;
657
    }
672
    }
658
673
659
  case SE_TYPE_BOOL:
674
  case SE_TYPE_BOOL:
Lines 692-698 static void set_prop_jsval (se_t *se, se Link Here
692
707
693
  case SE_TYPE_DOUBLE:
708
  case SE_TYPE_DOUBLE:
694
    if (JSVAL_IS_NUMBER(*v))
709
    if (JSVAL_IS_NUMBER(*v))
695
      se_prop_set_double (se, o, p->id, *JSVAL_TO_DOUBLE(*v));
710
      se_prop_set_double (se, o, p->id, SE_JSVAL_TO_DOUBLE(*v));
696
    else
711
    else
697
      se->print_cb (se->print_cb_data, _("\n%s.%s: value must be numeric\n"),
712
      se->print_cb (se->print_cb_data, _("\n%s.%s: value must be numeric\n"),
698
		    o->id, p->id);
713
		    o->id, p->id);
Lines 709-716 static void set_prop_jsval (se_t *se, se Link Here
709
  case SE_TYPE_STRING:
724
  case SE_TYPE_STRING:
710
    {
725
    {
711
      JSString *str = JSVAL_TO_STRING(*v);
726
      JSString *str = JSVAL_TO_STRING(*v);
712
      char     *string = JS_GetStringBytes (str);
727
      char     *string = SE_JS_ENCODE_STRING (se->cx, str);
713
      se_prop_set (se, o, p->id, string);
728
      se_prop_set (se, o, p->id, string);
729
      SE_JS_FREE_ENCODED_STRING (se->cx, str);
714
    }
730
    }
715
    return;
731
    return;
716
732
Lines 725-741 static void set_prop_jsval (se_t *se, se Link Here
725
 * function to create and maintain js objects
741
 * function to create and maintain js objects
726
 */
742
 */
727
743
728
static JSBool
744
SE_JS_PROPERTY_GETTER_DECLARE (generic_JSGetProperty)
729
generic_JSGetProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
730
{
745
{
746
  SE_JS_PROPERTY_GETTER_INIT_VARIABLES (id_val);
731
  se_t   *se = (se_t *) JS_GetContextPrivate(cx);
747
  se_t   *se = (se_t *) JS_GetContextPrivate(cx);
732
  se_log_fncall ("generic get property");
748
  se_log_fncall ("generic get property");
733
  se_o_t *o = JS_GetPrivate (cx, obj);
749
  se_o_t *o = JS_GetPrivate (cx, obj);
734
750
735
  if (JSVAL_IS_STRING (id))
751
  if (JSVAL_IS_STRING (id_val))
736
  {
752
  {
737
    JSString *str = JS_ValueToString (cx, id);
753
    JSString *str = JS_ValueToString (cx, id_val);
738
    char     *prop = str ? JS_GetStringBytes (str) : "";
754
    char     *prop = str ? SE_JS_ENCODE_STRING (cx, str) : "";
739
    GList    *n;
755
    GList    *n;
740
756
741
    logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
757
    logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
Lines 749-754 generic_JSGetProperty (JSContext *cx, JS Link Here
749
      if (!strcasecmp (p->id, prop))
765
      if (!strcasecmp (p->id, prop))
750
      {
766
      {
751
	*vp = get_prop_jsval (se, o, p);
767
	*vp = get_prop_jsval (se, o, p);
768
        if (str)
769
          SE_JS_FREE_ENCODED_STRING (cx, prop);
770
752
	return JS_TRUE;
771
	return JS_TRUE;
753
      }
772
      }
754
    }
773
    }
Lines 760-777 generic_JSGetProperty (JSContext *cx, JS Link Here
760
      se_o_t *p = (se_o_t *) n->data;
779
      se_o_t *p = (se_o_t *) n->data;
761
      if (!strcasecmp (p->id, prop))
780
      if (!strcasecmp (p->id, prop))
762
      {
781
      {
763
	static jsval prop = 0;
782
	jsval prop_val = se_js_string_val (cx, ".");
764
	if (!prop)
783
        if (!SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL (generic_JSGetProperty, cx, p->obj, prop_val, vp))
765
	  prop = se_js_string_val (cx, ".");
766
	if (!generic_JSGetProperty (cx, p->obj, prop, vp))
767
	  *vp = OBJECT_TO_JSVAL (p->obj);
784
	  *vp = OBJECT_TO_JSVAL (p->obj);
785
        if (str)
786
          SE_JS_FREE_ENCODED_STRING (cx, prop);
787
768
	return JS_TRUE;
788
	return JS_TRUE;
769
      }
789
      }
770
    }
790
    }
771
791
772
    if (*prop && o->parent)
792
    if (*prop && o->parent) {
773
      return generic_JSGetProperty (cx, o->parent->obj, id, vp);
793
      JSBool ret = generic_JSGetProperty (cx, o->parent->obj, id, vp);
794
      if (str)
795
        SE_JS_FREE_ENCODED_STRING (cx, prop);
796
      return ret;
797
    }
774
798
799
    if (str)
800
      SE_JS_FREE_ENCODED_STRING (cx, prop);
775
    return JS_TRUE;
801
    return JS_TRUE;
776
  }
802
  }
777
803
Lines 780-788 generic_JSGetProperty (JSContext *cx, JS Link Here
780
  return JS_FALSE;
806
  return JS_FALSE;
781
}
807
}
782
808
783
static JSBool
809
SE_JS_PROPERTY_SETTER_DECLARE(generic_JSSetProperty)
784
generic_JSSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
785
{
810
{
811
  SE_JS_PROPERTY_SETTER_INIT_VARIABLES (id_val);
786
  se_t   *se = (se_t *) JS_GetContextPrivate(cx);
812
  se_t   *se = (se_t *) JS_GetContextPrivate(cx);
787
  se_o_t *o;
813
  se_o_t *o;
788
814
Lines 790-799 generic_JSSetProperty(JSContext *cx, JSO Link Here
790
816
791
  o = JS_GetPrivate (cx, obj);
817
  o = JS_GetPrivate (cx, obj);
792
818
793
  if (JSVAL_IS_STRING (id))
819
  if (JSVAL_IS_STRING (id_val))
794
  {
820
  {
795
    JSString *str = JS_ValueToString (cx, id);
821
    JSString *str = JS_ValueToString (cx, id_val);
796
    char     *prop = JS_GetStringBytes (str);
822
    char     *prop = SE_JS_ENCODE_STRING (cx, str);
797
    GList    *n;
823
    GList    *n;
798
824
799
    logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
825
    logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
Lines 808-813 generic_JSSetProperty(JSContext *cx, JSO Link Here
808
      {
834
      {
809
	if (!p->constant)
835
	if (!p->constant)
810
	  set_prop_jsval (se, o, p, vp);
836
	  set_prop_jsval (se, o, p, vp);
837
        SE_JS_FREE_ENCODED_STRING (cx, prop);
811
	return JS_TRUE;
838
	return JS_TRUE;
812
      }
839
      }
813
    }
840
    }
Lines 819-833 generic_JSSetProperty(JSContext *cx, JSO Link Here
819
      se_o_t *p = (se_o_t *) n->data;
846
      se_o_t *p = (se_o_t *) n->data;
820
      if (!strcasecmp (p->id, prop))
847
      if (!strcasecmp (p->id, prop))
821
      {
848
      {
822
	if (!generic_JSSetProperty (cx, p->obj, STRING_TO_JSVAL("."), vp))
849
        jsval prop_val = STRING_TO_JSVAL(".");
850
        if (!SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL (generic_JSSetProperty, cx, p->obj, prop_val, vp))
823
	  *vp = OBJECT_TO_JSVAL (p->obj);
851
	  *vp = OBJECT_TO_JSVAL (p->obj);
852
        SE_JS_FREE_ENCODED_STRING (cx, prop);
824
	return JS_TRUE;
853
	return JS_TRUE;
825
      }
854
      }
826
    }
855
    }
827
856
828
    if (*prop && o->parent)
857
    if (*prop && o->parent) {
829
      return generic_JSSetProperty (cx, o->parent->obj, id, vp);
858
      JSBool ret = SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL (generic_JSSetProperty, cx, o->parent->obj, id_val, vp);
859
      SE_JS_FREE_ENCODED_STRING (cx, prop);
860
      return ret;
861
    }
830
862
863
    SE_JS_FREE_ENCODED_STRING (cx, prop);
831
    return JS_TRUE;
864
    return JS_TRUE;
832
  }
865
  }
833
866
Lines 841-854 static void generic_JSDestructor (JSCont Link Here
841
  se_log_fncall ("generic destructor");
874
  se_log_fncall ("generic destructor");
842
}
875
}
843
876
877
#ifdef JSFUN_CONSTRUCTOR
878
static JSBool generic_Constructor (JSContext* cx, uintN argc, jsval* vp)
879
{
880
  JSObject* obj = JS_NewObjectForConstructor (cx, vp);
881
  if (!obj) {
882
    JS_ReportError (cx, "Failed to create 'this' object");
883
    return JS_FALSE;
884
  }
885
886
  JS_SET_RVAL (cx, vp, OBJECT_TO_JSVAL (obj));
887
  return JS_TRUE;
888
}
889
#endif
890
844
static JSClass generic_JSClass =
891
static JSClass generic_JSClass =
845
  {
892
  {
846
    "view", JSCLASS_HAS_PRIVATE,
893
    "view", JSCLASS_HAS_PRIVATE,
847
    JS_PropertyStub, JS_PropertyStub,
894
    JS_PropertyStub, JS_PropertyStub,
848
    generic_JSGetProperty, generic_JSSetProperty,
895
    generic_JSGetProperty, generic_JSSetProperty,
849
    JS_EnumerateStub, JS_ResolveStub,
896
    JS_EnumerateStub, JS_ResolveStub,
897
#ifndef JSFUN_CONSTRUCTOR
850
    JS_ConvertStub, generic_JSDestructor
898
    JS_ConvertStub, generic_JSDestructor
851
  };
899
  };
900
#else
901
    JS_ConvertStub, generic_JSDestructor,
902
    NULL, NULL, NULL, generic_Constructor,
903
    NULL, NULL, NULL, NULL
904
  };
905
#endif
852
906
853
se_o_t *se_create_object (se_t *se, se_o_t *parent /* may be NULL */,
907
se_o_t *se_create_object (se_t *se, se_o_t *parent /* may be NULL */,
854
			  const gchar *name, void *user_data,
908
			  const gchar *name, void *user_data,
Lines 1542-1548 se_t *se_new (void) Link Here
1542
{
1596
{
1543
  se_t    *se;
1597
  se_t    *se;
1544
  static JSClass global_class = {
1598
  static JSClass global_class = {
1545
    "global", JSCLASS_HAS_PRIVATE,
1599
    "global", JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS,
1546
    JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,
1600
    JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,
1547
    JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
1601
    JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
1548
  };
1602
  };
Lines 1564-1570 se_t *se_new (void) Link Here
1564
  se = malloc (sizeof (se_t));
1618
  se = malloc (sizeof (se_t));
1565
1619
1566
  se->cx       = JS_NewContext (rt, 0x1000);
1620
  se->cx       = JS_NewContext (rt, 0x1000);
1621
#ifdef HAVE_COMPARTMENTS
1622
  se->global   = JS_NewCompartmentAndGlobalObject (se->cx, &global_class, NULL);
1623
  /* Select the compartment our global object is in */
1624
  JS_EnterCrossCompartmentCall (se->cx, se->global);
1625
#else
1567
  se->global   = JS_NewObject (se->cx, &global_class, NULL, NULL);
1626
  se->global   = JS_NewObject (se->cx, &global_class, NULL, NULL);
1627
#endif
1568
1628
1569
  pthread_mutexattr_t attr;
1629
  pthread_mutexattr_t attr;
1570
  pthread_mutexattr_init (&attr);
1630
  pthread_mutexattr_init (&attr);
Lines 1596-1607 se_t *se_new (void) Link Here
1596
1656
1597
  {
1657
  {
1598
    static const se_f_def_t defs[] = {
1658
    static const se_f_def_t defs[] = {
1599
      { "exit", controls_exit, 0, 0, SE_GROUP_ENGINE, NULL, NULL },
1659
      { "exit", controls_exit, 0, JSFUN_FAST_NATIVE, SE_GROUP_ENGINE, NULL, NULL },
1600
      { "js_console_show", show_js_console, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
1660
      { "js_console_show", show_js_console, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
1601
      { "help", show_help, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1661
      { "help", show_help, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1602
      { "callback", js_callback, 0, 0, SE_GROUP_ENGINE, N_("Javascript"), NULL },
1662
      { "callback", js_callback, 0, JSFUN_FAST_NATIVE, SE_GROUP_ENGINE, N_("Javascript"), NULL },
1603
      { "xine_cfg_get", js_xine_cfg_get, 0, 0, SE_GROUP_PROPERTIES, NULL, NULL },
1663
      { "xine_cfg_get", js_xine_cfg_get, 0, JSFUN_FAST_NATIVE, SE_GROUP_PROPERTIES, NULL, NULL },
1604
      { "xine_cfg_set", js_xine_cfg_set, 0, 0, SE_GROUP_PROPERTIES, NULL, NULL },
1664
      { "xine_cfg_set", js_xine_cfg_set, 0, JSFUN_FAST_NATIVE, SE_GROUP_PROPERTIES, NULL, NULL },
1605
      { NULL }
1665
      { NULL }
1606
    };
1666
    };
1607
    se_defuns (se, se->g, defs);
1667
    se_defuns (se, se->g, defs);
1608
-- gxine-0.5.905.orig/src/ui.c
1668
++ gxine-0.5.905/src/ui.c
Lines 490-503 static void set_fs_toolbar_top (int v) Link Here
490
490
491
#ifdef WITH_DEPRECATED
491
#ifdef WITH_DEPRECATED
492
492
493
static JSBool js_fs_toolbar_show (JSContext *cx, JSObject *obj, uintN argc,
493
static JSBool js_fs_toolbar_show (JSContext *cx, uintN argc, jsval *vp)
494
				  jsval *argv, jsval *rval)
495
{
494
{
496
  JSBool show;
495
  JSBool show;
497
496
498
  se_log_fncall_deprecated ("toolbar_show");
497
  se_log_fncall_deprecated ("toolbar_show");
499
  se_argc_check_max (1, "toolbar_show");
498
  se_argc_check_max (1, "toolbar_show");
500
499
500
  jsval *argv = JS_ARGV (cx, vp);
501
  if (argc == 1)
501
  if (argc == 1)
502
  {
502
  {
503
    se_arg_is_int_or_bool (0, "toolbar_show");
503
    se_arg_is_int_or_bool (0, "toolbar_show");
Lines 508-526 static JSBool js_fs_toolbar_show (JSCont Link Here
508
508
509
  window_fs_toolbar_show (show);
509
  window_fs_toolbar_show (show);
510
510
511
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
511
  return JS_TRUE;
512
  return JS_TRUE;
512
}
513
}
513
514
514
#ifdef WITH_OBSOLETE
515
#ifdef WITH_OBSOLETE
515
516
516
static JSBool js_fs_toolbar_position (JSContext *cx, JSObject *obj, uintN argc,
517
static JSBool js_fs_toolbar_position (JSContext *cx, uintN argc, jsval *vp)
517
				      jsval *argv, jsval *rval)
518
{
518
{
519
  JSBool top;
519
  JSBool top;
520
520
521
  se_log_fncall_obsolete ("set_toolbar_position");
521
  se_log_fncall_obsolete ("set_toolbar_position");
522
  se_argc_check_max (1, "set_toolbar_position");
522
  se_argc_check_max (1, "set_toolbar_position");
523
523
524
  jsval *argv = JS_ARGV (cx, vp);
524
  if (argc == 1)
525
  if (argc == 1)
525
  {
526
  {
526
    se_arg_is_int_or_bool (0, "set_toolbar_position");
527
    se_arg_is_int_or_bool (0, "set_toolbar_position");
Lines 532-537 static JSBool js_fs_toolbar_position (JS Link Here
532
  set_fs_toolbar_top
533
  set_fs_toolbar_top
533
    (gtk_radio_action_get_current_value (action_items.fs_toolbar_pos->data));
534
    (gtk_radio_action_get_current_value (action_items.fs_toolbar_pos->data));
534
535
536
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
535
  return JS_TRUE;
537
  return JS_TRUE;
536
}
538
}
537
539
Lines 549-571 static int ui_lookup_js_obj (const JSObj Link Here
549
  abort (); /* can't happen */
551
  abort (); /* can't happen */
550
}
552
}
551
553
552
static JSBool js_control_revert (JSContext *cx, JSObject *obj, uintN argc,
554
static JSBool js_control_revert (JSContext *cx, uintN argc, jsval *vp)
553
				 jsval *argv, jsval *rval)
554
{
555
{
555
  se_log_fncall ("<control>.revert");
556
  se_log_fncall ("<control>.revert");
556
  se_argc_check (0, "<control>.revert");
557
  se_argc_check (0, "<control>.revert");
557
  ui_revert_control_adjustment (ui_lookup_js_obj (obj));
558
  ui_revert_control_adjustment (ui_lookup_js_obj (JS_THIS_OBJECT (cx, vp)));
558
  *rval = JSVAL_VOID;
559
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
559
  return JS_TRUE;
560
  return JS_TRUE;
560
}
561
}
561
562
562
static JSBool js_control_reset (JSContext *cx, JSObject *obj, uintN argc,
563
static JSBool js_control_reset (JSContext *cx, uintN argc, jsval *vp)
563
				jsval *argv, jsval *rval)
564
{
564
{
565
  se_log_fncall ("<control>.reset");
565
  se_log_fncall ("<control>.reset");
566
  se_argc_check (0, "<control>.reset");
566
  se_argc_check (0, "<control>.reset");
567
  ui_clear_control_adjustment (ui_lookup_js_obj (obj));
567
  ui_clear_control_adjustment (ui_lookup_js_obj (JS_THIS_OBJECT (cx, vp)));
568
  *rval = JSVAL_VOID;
568
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
569
  return JS_TRUE;
569
  return JS_TRUE;
570
}
570
}
571
571
Lines 654-666 static int ui_prop_set_bool (void *data, Link Here
654
  return ui_prop_set_internal (data, !!value.i);
654
  return ui_prop_set_internal (data, !!value.i);
655
}
655
}
656
656
657
static JSBool ui_prop_toggle_bool (JSContext *cx, JSObject *obj,
657
static JSBool ui_prop_toggle_bool (JSContext *cx, uintN argc, jsval *vp)
658
				   uintN argc, jsval *argv, jsval *rval)
659
{
658
{
660
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
659
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
661
  se_o_t *o = JS_GetPrivate (cx, obj);
660
  se_o_t *o = JS_GetPrivate (cx, JS_THIS_OBJECT (cx, vp));
662
  JSBool v = !se_prop_get_bool (se, o, "v");
661
  JSBool v = !se_prop_get_bool (se, o, "v");
663
  *rval = BOOLEAN_TO_JSVAL (v);
662
  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (v));
664
  se_prop_set_bool (se, o, "v", v);
663
  se_prop_set_bool (se, o, "v", v);
665
  return JS_TRUE;
664
  return JS_TRUE;
666
}
665
}
Lines 699-705 void ui_create_properties (const ui_prop Link Here
699
      se_prop_create_int (gse, obj, "max", prop[i].max, TRUE);
698
      se_prop_create_int (gse, obj, "max", prop[i].max, TRUE);
700
      break;
699
      break;
701
    case SE_TYPE_BOOL:
700
    case SE_TYPE_BOOL:
702
      se_defun (gse, obj, "toggle", ui_prop_toggle_bool, 0, 0,
701
      se_defun (gse, obj, "toggle", ui_prop_toggle_bool, 0, JSFUN_FAST_NATIVE,
703
		SE_GROUP_HIDDEN, NULL, NULL);
702
		SE_GROUP_HIDDEN, NULL, NULL);
704
      break;
703
      break;
705
    default:; /* we don't handle string and float */
704
    default:; /* we don't handle string and float */
Lines 1044-1053 void ui_init (void) Link Here
1044
1043
1045
#ifdef WITH_DEPRECATED
1044
#ifdef WITH_DEPRECATED
1046
  static const se_f_def_t defs[] = {
1045
  static const se_f_def_t defs[] = {
1047
    { "toolbar_show", js_fs_toolbar_show, 0, 0,
1046
    { "toolbar_show", js_fs_toolbar_show, 0, JSFUN_FAST_NATIVE,
1048
      SE_GROUP_HIDDEN, N_("[bool]"), NULL },
1047
      SE_GROUP_HIDDEN, N_("[bool]"), NULL },
1049
#ifdef WITH_OBSOLETE
1048
#ifdef WITH_OBSOLETE
1050
    { "set_toolbar_position", js_fs_toolbar_position, 0, 0,
1049
    { "set_toolbar_position", js_fs_toolbar_position, 0, JSFUN_FAST_NATIVE,
1051
      SE_GROUP_HIDDEN, N_("bool"), N_("at top if true") },
1050
      SE_GROUP_HIDDEN, N_("bool"), N_("at top if true") },
1052
#endif
1051
#endif
1053
    { NULL }
1052
    { NULL }
Lines 1091-1098 void ui_init (void) Link Here
1091
    if (ranges[i].setting)
1090
    if (ranges[i].setting)
1092
    {
1091
    {
1093
      static const se_f_def_t defs[] = {
1092
      static const se_f_def_t defs[] = {
1094
	{ "revert", js_control_revert, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1093
	{ "revert", js_control_revert, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1095
	{ "reset", js_control_reset, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1094
	{ "reset", js_control_reset, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1096
	{ NULL }
1095
	{ NULL }
1097
      };
1096
      };
1098
      jsobjs[i] =
1097
      jsobjs[i] =
1099
-- gxine-0.5.905.orig/src/player.c
1098
++ gxine-0.5.905/src/player.c
Lines 302-307 void player_stop (void) Link Here
302
  play_thread = 0;
302
  play_thread = 0;
303
  if (thread)
303
  if (thread)
304
    pthread_cancel (thread);
304
    pthread_cancel (thread);
305
  gtk_video_in_spu_button (gtv, 0);
305
  xine_stop (stream);
306
  xine_stop (stream);
306
}
307
}
307
308
Lines 405-441 static void update_postproc_chain (const Link Here
405
}
406
}
406
407
407
static JSBool set_postproc_chain (const char *func, const char *pref,
408
static JSBool set_postproc_chain (const char *func, const char *pref,
408
				  JSContext *cx, JSObject *obj,
409
				  JSContext *cx, uintN argc, jsval *vp)
409
				  uintN argc, jsval *argv, jsval *rval)
410
{
410
{
411
  jsval *argv = JS_ARGV (cx, vp);
411
  se_log_fncall (func);
412
  se_log_fncall (func);
412
  se_argc_check (1, func);
413
  se_argc_check (1, func);
413
  se_arg_is_string (0, func);
414
  se_arg_is_string (0, func);
414
  update_postproc_chain (pref,
415
  char *value = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
415
			 JS_GetStringBytes (JS_ValueToString (cx, argv[0])));
416
  update_postproc_chain (pref, value);
417
  SE_JS_FREE_ENCODED_STRING(cx, value);
418
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
416
  return JS_TRUE;
419
  return JS_TRUE;
417
}
420
}
418
421
419
422
420
static JSBool set_vo_postproc_chain (JSContext *cx, JSObject *obj,
423
static JSBool set_vo_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
421
				     uintN argc, jsval *argv, jsval *rval)
422
{
424
{
423
  return set_postproc_chain ("vo_postproc.set_chain", "gui.post_plugins.video",
425
  return set_postproc_chain ("vo_postproc.set_chain", "gui.post_plugins.video",
424
			     cx, obj, argc, argv, rval);
426
			     cx, argc, vp);
425
}
427
}
426
428
427
static JSBool set_deint_postproc_chain (JSContext *cx, JSObject *obj,
429
static JSBool set_deint_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
428
					uintN argc, jsval *argv, jsval *rval)
429
{
430
{
430
  return set_postproc_chain ("vo_deinterlace.set_chain", "gui.post_plugins.deinterlace",
431
  return set_postproc_chain ("vo_deinterlace.set_chain", "gui.post_plugins.deinterlace",
431
			     cx, obj, argc, argv, rval);
432
			     cx, argc, vp);
432
}
433
}
433
434
434
static JSBool set_ao_postproc_chain (JSContext *cx, JSObject *obj,
435
static JSBool set_ao_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
435
				     uintN argc, jsval *argv, jsval *rval)
436
{
436
{
437
  return set_postproc_chain ("ao_postproc.set_chain", "gui.post_plugins.audio",
437
  return set_postproc_chain ("ao_postproc.set_chain", "gui.post_plugins.audio",
438
			     cx, obj, argc, argv, rval);
438
			     cx, argc, vp);
439
}
439
}
440
440
441
static int listen_postproc_chain (void *pref, se_t *se, se_o_t *obj,
441
static int listen_postproc_chain (void *pref, se_t *se, se_o_t *obj,
Lines 445-533 static int listen_postproc_chain (void * Link Here
445
  return 0;
445
  return 0;
446
}
446
}
447
447
448
static JSBool get_time (JSContext *cx, JSObject *obj, uintN argc,
448
static JSBool get_time (JSContext *cx, uintN argc, jsval *vp)
449
		     jsval *argv, jsval *rval)
450
{
449
{
451
  int   pos, pos_time, len;
450
  int   pos, pos_time, len;
452
  se_log_fncall ("get_time");
451
  se_log_fncall ("get_time");
453
  xine_get_pos_length (stream, &pos, &pos_time, &len);
452
  xine_get_pos_length (stream, &pos, &pos_time, &len);
454
  *rval = INT_TO_JSVAL (pos_time);
453
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (pos_time));
455
  return JS_TRUE;
454
  return JS_TRUE;
456
}
455
}
457
456
458
static JSBool get_pos (JSContext *cx, JSObject *obj, uintN argc,
457
static JSBool get_pos (JSContext *cx, uintN argc, jsval *vp)
459
		       jsval *argv, jsval *rval)
460
{
458
{
461
  int pos, pos_time, len;
459
  int pos, pos_time, len;
462
  se_log_fncall ("get_pos");
460
  se_log_fncall ("get_pos");
463
  xine_get_pos_length (stream, &pos, &pos_time, &len);
461
  xine_get_pos_length (stream, &pos, &pos_time, &len);
464
462
465
  jsdouble *pos_percent = JS_NewDouble (cx, pos / 655.35);
463
  jsval rval = JS_RVAL (cx, vp);
466
  *rval = DOUBLE_TO_JSVAL (pos_percent);
464
  SE_JS_NEW_NUMBER_VAL (cx, pos / 655.35, rval);
467
  return JS_TRUE;
465
  return JS_TRUE;
468
}
466
}
469
467
470
static JSBool has_time (JSContext *cx, JSObject *obj, uintN argc,
468
static JSBool has_time (JSContext *cx, uintN argc, jsval *vp)
471
			jsval *argv, jsval *rval)
472
{
469
{
473
  int pos, pos_time, len;
470
  int pos, pos_time, len;
474
  se_log_fncall ("has_time");
471
  se_log_fncall ("has_time");
475
  xine_get_pos_length (stream, &pos, &pos_time, &len);
472
  xine_get_pos_length (stream, &pos, &pos_time, &len);
476
  *rval = BOOLEAN_TO_JSVAL (len != 0);
473
  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (len != 0));
477
  return JS_TRUE;
474
  return JS_TRUE;
478
}
475
}
479
476
480
#ifdef WITH_OBSOLETE
477
#ifdef WITH_OBSOLETE
481
478
482
static JSBool js_get_speed (JSContext *cx, JSObject *obj, uintN argc,
479
static JSBool js_get_speed (JSContext *cx, uintN argc, jsval *vp)
483
			    jsval *argv, jsval *rval)
484
{
480
{
485
  se_prop_read_t speed;
481
  se_prop_read_t speed;
486
  se_log_fncall_obsolete ("get_speed");
482
  se_log_fncall_obsolete ("get_speed");
487
  get_speed (NULL, &speed);
483
  get_speed (NULL, &speed);
488
  *rval = INT_TO_JSVAL (speed.i);
484
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (speed.i));
489
  return JS_TRUE;
485
  return JS_TRUE;
490
}
486
}
491
487
492
static JSBool js_get_volume (JSContext *cx, JSObject *obj, uintN argc,
488
static JSBool js_get_volume (JSContext *cx, uintN argc, jsval *vp)
493
			    jsval *argv, jsval *rval)
494
{
489
{
495
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
490
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
496
  int   volume;
491
  int   volume;
497
  se_log_fncall_obsolete ("get_volume");
492
  se_log_fncall_obsolete ("get_volume");
498
  volume = xine_get_param (stream, XINE_PARAM_AUDIO_VOLUME);
493
  volume = xine_get_param (stream, XINE_PARAM_AUDIO_VOLUME);
499
  *rval = INT_TO_JSVAL (volume);
494
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (volume));
500
  return JS_TRUE;
495
  return JS_TRUE;
501
}
496
}
502
497
503
static JSBool js_get_mute (JSContext *cx, JSObject *obj, uintN argc,
498
static JSBool js_get_mute (JSContext *cx, uintN argc, jsval *vp)
504
			   jsval *argv, jsval *rval)
505
{
499
{
506
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
500
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
507
  int mute;
501
  int mute;
508
  se_log_fncall_obsolete ("get_mute");
502
  se_log_fncall_obsolete ("get_mute");
509
  mute = xine_get_param (stream, XINE_PARAM_AUDIO_MUTE);
503
  mute = xine_get_param (stream, XINE_PARAM_AUDIO_MUTE);
510
  *rval = BOOLEAN_TO_JSVAL (mute);
504
  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (mute));
511
  return JS_TRUE;
505
  return JS_TRUE;
512
}
506
}
513
507
514
static JSBool js_get_zoom (JSContext *cx, JSObject *obj, uintN argc,
508
static JSBool js_get_zoom (JSContext *cx, uintN argc, jsval *vp)
515
			   jsval *argv, jsval *rval)
516
{
509
{
517
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
510
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
518
  int   zoom;
511
  int   zoom;
519
  se_log_fncall_obsolete ("get_zoom");
512
  se_log_fncall_obsolete ("get_zoom");
520
  zoom = xine_get_param (stream, XINE_PARAM_VO_ZOOM_X);
513
  zoom = xine_get_param (stream, XINE_PARAM_VO_ZOOM_X);
521
  *rval = INT_TO_JSVAL (zoom);
514
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (zoom));
522
  return JS_TRUE;
515
  return JS_TRUE;
523
}
516
}
524
517
525
#endif /* WITH_OBSOLETE */
518
#endif /* WITH_OBSOLETE */
526
519
527
static JSBool controls_pause (JSContext *cx, JSObject *obj, uintN argc,
520
static JSBool controls_pause (JSContext *cx, uintN argc, jsval *vp)
528
			      jsval *argv, jsval *rval)
529
{
521
{
530
  int32 pause_state=-1;
522
  int32 pause_state=-1;
523
  jsval *argv = JS_ARGV (cx, vp);
531
524
532
  se_log_fncall_checkinit ("pause");
525
  se_log_fncall_checkinit ("pause");
533
  se_argc_check_max (1, "pause");
526
  se_argc_check_max (1, "pause");
Lines 553-573 static JSBool controls_pause (JSContext Link Here
553
      set_speed (XINE_SPEED_NORMAL);
546
      set_speed (XINE_SPEED_NORMAL);
554
  }
547
  }
555
548
549
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
556
  return JS_TRUE;
550
  return JS_TRUE;
557
}
551
}
558
552
559
static JSBool controls_stop (JSContext *cx, JSObject *obj, uintN argc,
553
static JSBool controls_stop (JSContext *cx, uintN argc, jsval *vp)
560
			     jsval *argv, jsval *rval)
561
{
554
{
562
  se_log_fncall_checkinit ("stop");
555
  se_log_fncall_checkinit ("stop");
563
  player_stop ();
556
  player_stop ();
564
  playlist_logo (NULL);
557
  playlist_logo (NULL);
565
  ui_set_control_adjustment (Control_SEEKER, 0);
558
  ui_set_control_adjustment (Control_SEEKER, 0);
559
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
566
  return JS_TRUE;
560
  return JS_TRUE;
567
}
561
}
568
562
569
static JSBool controls_eject (JSContext *cx, JSObject *obj, uintN argc,
563
static JSBool controls_eject (JSContext *cx, uintN argc, jsval *vp)
570
			      jsval *argv, jsval *rval)
571
{
564
{
572
  se_log_fncall_checkinit ("eject");
565
  se_log_fncall_checkinit ("eject");
573
  if (xine_get_status (stream) == XINE_STATUS_PLAY)
566
  if (xine_get_status (stream) == XINE_STATUS_PLAY)
Lines 576-592 static JSBool controls_eject (JSContext Link Here
576
  playlist_logo (cx); /* doesn't matter so long as it's not NULL */
569
  playlist_logo (cx); /* doesn't matter so long as it's not NULL */
577
  gdk_threads_enter ();
570
  gdk_threads_enter ();
578
  ui_set_control_adjustment (Control_SEEKER, 0);
571
  ui_set_control_adjustment (Control_SEEKER, 0);
572
  gtk_video_in_spu_button (gtv, 0);
579
  int ret = xine_eject (stream);
573
  int ret = xine_eject (stream);
580
  *rval = BOOLEAN_TO_JSVAL (ret);
574
  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (ret));
581
  return JS_TRUE;
575
  return JS_TRUE;
582
}
576
}
583
577
584
#ifdef WITH_OBSOLETE
578
#ifdef WITH_OBSOLETE
585
579
586
static JSBool js_set_speed (JSContext *cx, JSObject *obj, uintN argc,
580
static JSBool js_set_speed (JSContext *cx, uintN argc, jsval *vp)
587
			    jsval *argv, jsval *rval)
588
{
581
{
589
  int32 speed;
582
  int32 speed;
583
  jsval *argv = JS_ARGV (cx, vp);
590
584
591
  se_log_fncall_obsolete ("set_speed");
585
  se_log_fncall_obsolete ("set_speed");
592
586
Lines 599-611 static JSBool js_set_speed (JSContext *c Link Here
599
    speed = 0;
593
    speed = 0;
600
  set_speed (calc_speed (speed));
594
  set_speed (calc_speed (speed));
601
595
596
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
602
  return JS_TRUE;
597
  return JS_TRUE;
603
}
598
}
604
599
605
static JSBool js_set_volume (JSContext *cx, JSObject *obj, uintN argc,
600
static JSBool js_set_volume (JSContext *cx, uintN argc, jsval *vp)
606
			    jsval *argv, jsval *rval)
607
{
601
{
608
  int32 volume;
602
  int32 volume;
603
  jsval *argv = JS_ARGV (cx, vp);
609
604
610
  se_log_fncall_obsolete ("set_volume");
605
  se_log_fncall_obsolete ("set_volume");
611
  se_argc_check (1, "set_volume");
606
  se_argc_check (1, "set_volume");
Lines 618-630 static JSBool js_set_volume (JSContext * Link Here
618
  ui_set_control_adjustment (Control_VOLUME, volume);
613
  ui_set_control_adjustment (Control_VOLUME, volume);
619
  ui_xine_set_param_from_adjustment (Control_VOLUME);
614
  ui_xine_set_param_from_adjustment (Control_VOLUME);
620
615
616
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
621
  return JS_TRUE;
617
  return JS_TRUE;
622
}
618
}
623
619
624
static JSBool js_set_mute (JSContext *cx, JSObject *obj, uintN argc,
620
static JSBool js_set_mute (JSContext *cx, uintN argc, jsval *vp)
625
			   jsval *argv, jsval *rval)
626
{
621
{
627
  JSBool mute;
622
  JSBool mute;
623
  jsval *argv = JS_ARGV (cx, vp);
628
624
629
  se_log_fncall_obsolete ("set_mute");
625
  se_log_fncall_obsolete ("set_mute");
630
  se_argc_check_max (1, "set_mute");
626
  se_argc_check_max (1, "set_mute");
Lines 639-651 static JSBool js_set_mute (JSContext *cx Link Here
639
635
640
  set_mute (mute);
636
  set_mute (mute);
641
637
638
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
642
  return JS_TRUE;
639
  return JS_TRUE;
643
}
640
}
644
641
645
static JSBool js_set_zoom (JSContext *cx, JSObject *obj, uintN argc,
642
static JSBool js_set_zoom (JSContext *cx, uintN argc, jsval *vp)
646
			   jsval *argv, jsval *rval)
647
{
643
{
648
  int32 zoom;
644
  int32 zoom;
645
  jsval *argv = JS_ARGV (cx, vp);
649
646
650
  se_log_fncall_obsolete ("set_zoom");
647
  se_log_fncall_obsolete ("set_zoom");
651
  se_argc_check (1, "set_zoom");
648
  se_argc_check (1, "set_zoom");
Lines 654-659 static JSBool js_set_zoom (JSContext *cx Link Here
654
  JS_ValueToInt32 (cx, argv[0], &zoom);
651
  JS_ValueToInt32 (cx, argv[0], &zoom);
655
  set_zoom (zoom);
652
  set_zoom (zoom);
656
653
654
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
657
  return JS_TRUE;
655
  return JS_TRUE;
658
}
656
}
659
657
Lines 684-692 static gboolean set_video_size_cb (gpoin Link Here
684
  return FALSE;
682
  return FALSE;
685
}
683
}
686
684
687
static JSBool js_set_video_size (JSContext *cx, JSObject *obj, uintN argc,
685
static JSBool js_set_video_size (JSContext *cx, uintN argc, jsval *vp)
688
			   jsval *argv, jsval *rval)
689
{
686
{
687
  jsval *argv = JS_ARGV (cx, vp);
690
  se_log_fncall ("set_video_size");
688
  se_log_fncall ("set_video_size");
691
  se_argc_check (1, "set_video_size");
689
  se_argc_check (1, "set_video_size");
692
  se_arg_is_int (0, "set_video_size");
690
  se_arg_is_int (0, "set_video_size");
Lines 704-718 static JSBool js_set_video_size (JSConte Link Here
704
    g_source_remove (zoomcb_id);
702
    g_source_remove (zoomcb_id);
705
  zoomcb_id = g_idle_add ((GSourceFunc) set_video_size_cb, NULL);
703
  zoomcb_id = g_idle_add ((GSourceFunc) set_video_size_cb, NULL);
706
704
705
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
707
  return JS_TRUE;
706
  return JS_TRUE;
708
}
707
}
709
708
710
#ifdef WITH_DEPRECATED
709
#ifdef WITH_DEPRECATED
711
710
712
static JSBool js_set_fullscreen (JSContext *cx, JSObject *obj, uintN argc,
711
static JSBool js_set_fullscreen (JSContext *cx, uintN argc, jsval *vp)
713
				 jsval *argv, jsval *rval)
714
{
712
{
715
  int32 fs;
713
  int32 fs;
714
  jsval *argv = JS_ARGV (cx, vp);
716
715
717
  se_log_fncall_deprecated ("set_fullscreen");
716
  se_log_fncall_deprecated ("set_fullscreen");
718
  se_argc_check_max (1, "set_fullscreen");
717
  se_argc_check_max (1, "set_fullscreen");
Lines 728-742 static JSBool js_set_fullscreen (JSConte Link Here
728
  if (gtk_toggle_action_get_active (action_items.fullscreen) != fs)
727
  if (gtk_toggle_action_get_active (action_items.fullscreen) != fs)
729
    gtk_action_activate (GTK_ACTION (action_items.fullscreen));
728
    gtk_action_activate (GTK_ACTION (action_items.fullscreen));
730
729
730
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
731
  return JS_TRUE;
731
  return JS_TRUE;
732
}
732
}
733
733
734
#ifdef WITH_OBSOLETE
734
#ifdef WITH_OBSOLETE
735
735
736
static JSBool js_set_deinterlace (JSContext *cx, JSObject *obj, uintN argc,
736
static JSBool js_set_deinterlace (JSContext *cx, uintN argc, jsval *vp)
737
				 jsval *argv, jsval *rval)
738
{
737
{
739
  int32 di;
738
  int32 di;
739
  jsval *argv = JS_ARGV (cx, vp);
740
740
741
  se_log_fncall_obsolete ("set_deinterlace");
741
  se_log_fncall_obsolete ("set_deinterlace");
742
  se_argc_check_max (1, "set_deinterlace");
742
  se_argc_check_max (1, "set_deinterlace");
Lines 750-763 static JSBool js_set_deinterlace (JSCont Link Here
750
    di = !gtk_video_get_use_post_plugins_deinterlace ((GtkVideo *)gtv);
750
    di = !gtk_video_get_use_post_plugins_deinterlace ((GtkVideo *)gtv);
751
751
752
  set_deinterlace (di);
752
  set_deinterlace (di);
753
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
753
  return JS_TRUE;
754
  return JS_TRUE;
754
}
755
}
755
756
756
static JSBool js_set_postproc_video (JSContext *cx, JSObject *obj,
757
static JSBool js_set_postproc_video (JSContext *cx, uintN argc, jsval *vp)
757
				     uintN argc, jsval *argv, jsval *rval)
758
{
758
{
759
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
759
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
760
  int32 di;
760
  int32 di;
761
  jsval *argv = JS_ARGV (cx, vp);
761
762
762
  se_log_fncall_obsolete ("set_postproc_video");
763
  se_log_fncall_obsolete ("set_postproc_video");
763
  se_argc_check_max (1, "set_postproc_video");
764
  se_argc_check_max (1, "set_postproc_video");
Lines 767-792 static JSBool js_set_postproc_video (JSC Link Here
767
    if (JSVAL_IS_INT (argv[0]))
768
    if (JSVAL_IS_INT (argv[0]))
768
      JS_ValueToInt32 (cx, argv[0], &di);
769
      JS_ValueToInt32 (cx, argv[0], &di);
769
    else if (JSVAL_IS_STRING (argv[0]))
770
    else if (JSVAL_IS_STRING (argv[0]))
770
      return set_vo_postproc_chain (cx, obj, argc, argv, rval);
771
      return set_vo_postproc_chain (cx, argc, vp);
771
    else
772
    else
772
    {
773
    {
773
      se->print_cb (se->print_cb_data,
774
      se->print_cb (se->print_cb_data,
774
		   _("error: %s() argument %d is neither int nor string\n"),
775
		   _("error: %s() argument %d is neither int nor string\n"),
775
		   "set_postproc_video", 1);
776
		   "set_postproc_video", 1);
777
      JS_SET_RVAL (cx, vp, JSVAL_VOID);
776
      return JS_TRUE;
778
      return JS_TRUE;
777
    }
779
    }
778
  } else
780
  } else
779
    di = !gtk_video_get_use_post_plugins_video ((GtkVideo *)gtv);
781
    di = !gtk_video_get_use_post_plugins_video ((GtkVideo *)gtv);
780
782
781
  set_vo_postproc (di);
783
  set_vo_postproc (di);
784
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
782
  return JS_TRUE;
785
  return JS_TRUE;
783
}
786
}
784
787
785
static JSBool js_set_postproc_audio (JSContext *cx, JSObject *obj,
788
static JSBool js_set_postproc_audio (JSContext *cx, uintN argc, jsval *vp)
786
				     uintN argc, jsval *argv, jsval *rval)
787
{
789
{
788
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
790
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
789
  int32 di;
791
  int32 di;
792
  jsval *argv = JS_ARGV (cx, vp);
790
793
791
  se_log_fncall_obsolete ("set_postproc_audio");
794
  se_log_fncall_obsolete ("set_postproc_audio");
792
  se_argc_check_max (1, "set_postproc_audio");
795
  se_argc_check_max (1, "set_postproc_audio");
Lines 796-820 static JSBool js_set_postproc_audio (JSC Link Here
796
    if (JSVAL_IS_INT (argv[0]))
799
    if (JSVAL_IS_INT (argv[0]))
797
      JS_ValueToInt32 (cx, argv[0], &di);
800
      JS_ValueToInt32 (cx, argv[0], &di);
798
    else if (JSVAL_IS_STRING (argv[0]))
801
    else if (JSVAL_IS_STRING (argv[0]))
799
      return set_ao_postproc_chain (cx, obj, argc, argv, rval);
802
      return set_ao_postproc_chain (cx, argc, vp);
800
    else
803
    else
801
    {
804
    {
802
      se->print_cb (se->print_cb_data,
805
      se->print_cb (se->print_cb_data,
803
		   _("error: %s() argument %d is neither int nor string\n"),
806
		   _("error: %s() argument %d is neither int nor string\n"),
804
		   "set_postproc_audio", 1);
807
		   "set_postproc_audio", 1);
808
      JS_SET_RVAL (cx, vp, JSVAL_VOID);
805
      return JS_TRUE;
809
      return JS_TRUE;
806
    }
810
    }
807
  } else
811
  } else
808
    di = !gtk_video_get_use_post_plugins_audio ((GtkVideo *)gtv);
812
    di = !gtk_video_get_use_post_plugins_audio ((GtkVideo *)gtv);
809
813
810
  set_ao_postproc (di);
814
  set_ao_postproc (di);
815
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
811
  return JS_TRUE;
816
  return JS_TRUE;
812
}
817
}
813
818
814
static JSBool js_set_auto_resize (JSContext *cx, JSObject *obj, uintN argc,
819
static JSBool js_set_auto_resize (JSContext *cx, uintN argc, jsval *vp)
815
				 jsval *argv, jsval *rval)
816
{
820
{
817
  int32 ar;
821
  int32 ar;
822
  jsval *argv = JS_ARGV (cx, vp);
818
823
819
  se_log_fncall_obsolete ("set_auto_resize");
824
  se_log_fncall_obsolete ("set_auto_resize");
820
  se_argc_check_max (1, "set_auto_resize");
825
  se_argc_check_max (1, "set_auto_resize");
Lines 828-840 static JSBool js_set_auto_resize (JSCont Link Here
828
    ar = !gtk_video_get_auto_resize ((GtkVideo *)gtv);
833
    ar = !gtk_video_get_auto_resize ((GtkVideo *)gtv);
829
834
830
  set_auto_resize (ar);
835
  set_auto_resize (ar);
836
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
831
  return JS_TRUE;
837
  return JS_TRUE;
832
}
838
}
833
839
834
static JSBool js_set_auto_rescale (JSContext *cx, JSObject *obj, uintN argc,
840
static JSBool js_set_auto_rescale (JSContext *cx, uintN argc, jsval *vp)
835
				   jsval *argv, jsval *rval)
836
{
841
{
837
  int32 ar;
842
  int32 ar;
843
  jsval *argv = JS_ARGV (cx, vp);
838
844
839
  se_log_fncall_obsolete ("set_auto_rescale");
845
  se_log_fncall_obsolete ("set_auto_rescale");
840
  se_argc_check_max (1, "set_auto_rescale");
846
  se_argc_check_max (1, "set_auto_rescale");
Lines 848-860 static JSBool js_set_auto_rescale (JSCon Link Here
848
    ar = !gtk_video_get_auto_rescale ((GtkVideo *)gtv);
854
    ar = !gtk_video_get_auto_rescale ((GtkVideo *)gtv);
849
855
850
  set_auto_rescale (ar);
856
  set_auto_rescale (ar);
857
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
851
  return JS_TRUE;
858
  return JS_TRUE;
852
}
859
}
853
860
854
static JSBool js_set_aspect (JSContext *cx, JSObject *obj, uintN argc,
861
static JSBool js_set_aspect (JSContext *cx, uintN argc, jsval *vp)
855
			     jsval *argv, jsval *rval)
856
{
862
{
857
  int32 aspect;
863
  int32 aspect;
864
  jsval *argv = JS_ARGV (cx, vp);
858
865
859
  se_log_fncall_obsolete ("set_aspect");
866
  se_log_fncall_obsolete ("set_aspect");
860
  se_argc_check_max (1, "set_aspect");
867
  se_argc_check_max (1, "set_aspect");
Lines 868-885 static JSBool js_set_aspect (JSContext * Link Here
868
    aspect = xine_get_param (stream, XINE_PARAM_VO_ASPECT_RATIO) + 1;
875
    aspect = xine_get_param (stream, XINE_PARAM_VO_ASPECT_RATIO) + 1;
869
876
870
  set_aspect (aspect);
877
  set_aspect (aspect);
878
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
871
  return JS_TRUE;
879
  return JS_TRUE;
872
}
880
}
873
881
874
#endif /* WITH_OBSOLETE */
882
#endif /* WITH_OBSOLETE */
875
#endif /* WITH_DEPRECATED */
883
#endif /* WITH_DEPRECATED */
876
884
877
static JSBool js_snapshot (JSContext *cx, JSObject *obj, uintN argc,
885
static JSBool js_snapshot (JSContext *cx, uintN argc, jsval *vp)
878
			   jsval *argv, jsval *rval)
879
{
886
{
880
  JSString *str;
887
  JSString *str;
881
  char     *fname = NULL;
888
  char     *fname = NULL;
882
  int32	    scale = -1, blend = -1;
889
  int32	    scale = -1, blend = -1;
890
  jsval    *argv = JS_ARGV (cx, vp);
883
891
884
  se_log_fncall_checkinit ("snapshot");
892
  se_log_fncall_checkinit ("snapshot");
885
  se_argc_check_range (0, 3, "snapshot");
893
  se_argc_check_range (0, 3, "snapshot");
Lines 895-912 static JSBool js_snapshot (JSContext *cx Link Here
895
  case 1:
903
  case 1:
896
    se_arg_is_string (0, "snapshot");
904
    se_arg_is_string (0, "snapshot");
897
    str = JS_ValueToString (cx, argv[0]);
905
    str = JS_ValueToString (cx, argv[0]);
898
    fname = JS_GetStringBytes (str);
906
    fname = SE_JS_ENCODE_STRING (cx, str);
899
  }
907
  }
900
908
901
  make_snapshot (fname, scale, blend);
909
  make_snapshot (fname, scale, blend);
902
910
911
  SE_JS_FREE_ENCODED_STRING (cx, fname);
912
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
903
  return JS_TRUE;
913
  return JS_TRUE;
904
}
914
}
905
915
906
916
907
static JSBool controls_play (JSContext *cx, JSObject *obj, uintN argc,
917
static JSBool controls_play (JSContext *cx, uintN argc, jsval *vp)
908
			     jsval *argv, jsval *rval)
909
{
918
{
919
  jsval *argv = JS_ARGV (cx, vp);
910
  se_log_fncall_checkinit ("play");
920
  se_log_fncall_checkinit ("play");
911
  se_argc_check_max (3, "play");
921
  se_argc_check_max (3, "play");
912
922
Lines 925-931 static JSBool controls_play (JSContext * Link Here
925
935
926
      str = JS_ValueToString (cx, argv[0]);
936
      str = JS_ValueToString (cx, argv[0]);
927
937
928
      mrl = JS_GetStringBytes (str);
938
      mrl = SE_JS_ENCODE_STRING (cx, str);
929
      se_log ("playing '%s' from start\n", mrl);
939
      se_log ("playing '%s' from start\n", mrl);
930
    }
940
    }
931
    break;
941
    break;
Lines 935-943 static JSBool controls_play (JSContext * Link Here
935
      se_arg_is_number (0, "play");
945
      se_arg_is_number (0, "play");
936
      se_arg_is_int (1, "play");
946
      se_arg_is_int (1, "play");
937
947
938
      jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
948
      jsdouble posv;
939
      JS_ValueToNumber (cx, argv[0], posv);
949
      JS_ValueToNumber (cx, argv[0], &posv);
940
      pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
950
      pos = (posv >= 0 && posv < 100) ? posv * 655.35 : -1;
951
941
      JS_ValueToInt32 (cx, argv[1], &pos_time);
952
      JS_ValueToInt32 (cx, argv[1], &pos_time);
942
      mrl = NULL;
953
      mrl = NULL;
943
      se_log ("playing from %d, %d\n", pos, pos_time);
954
      se_log ("playing from %d, %d\n", pos, pos_time);
Lines 951-968 static JSBool controls_play (JSContext * Link Here
951
      se_arg_is_int (2, "play");
962
      se_arg_is_int (2, "play");
952
963
953
      JSString *str = JS_ValueToString (cx, argv[0]);
964
      JSString *str = JS_ValueToString (cx, argv[0]);
954
      jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
965
955
      JS_ValueToNumber (cx, argv[1], posv);
966
      jsdouble posv;
956
      pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
967
      JS_ValueToNumber (cx, argv[1], &posv);
968
      pos = (posv >= 0 && posv < 100) ? posv * 655.35 : -1;
969
957
      JS_ValueToInt32 (cx, argv[2], &pos_time);
970
      JS_ValueToInt32 (cx, argv[2], &pos_time);
958
      mrl = JS_GetStringBytes (str);
971
      mrl = SE_JS_ENCODE_STRING (cx, str);
959
      se_log ("playing '%s' from %d, %d\n", mrl, pos, pos_time);
972
      se_log ("playing '%s' from %d, %d\n", mrl, pos, pos_time);
960
    }
973
    }
961
    break;
974
    break;
962
  }
975
  }
963
976
964
  if (mrl)
977
  if (mrl)
978
  {
965
    playlist_play_from (playlist_add_mrl (mrl, -1), pos, pos_time);
979
    playlist_play_from (playlist_add_mrl (mrl, -1), pos, pos_time);
980
    SE_JS_FREE_ENCODED_STRING (cx, mrl);
981
  }
966
  else
982
  else
967
  {
983
  {
968
    play_item_t *item = playlist_get_current_item ();
984
    play_item_t *item = playlist_get_current_item ();
Lines 990-1004 static JSBool controls_play (JSContext * Link Here
990
  }
1006
  }
991
  set_speed (XINE_SPEED_NORMAL);
1007
  set_speed (XINE_SPEED_NORMAL);
992
1008
1009
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
993
  return JS_TRUE;
1010
  return JS_TRUE;
994
}
1011
}
995
1012
996
/* Crude hack to allow combined play/pause function.
1013
/* Crude hack to allow combined play/pause function.
997
 * (Useful on some keyboards with CD/DVD control keys.)
1014
 * (Useful on some keyboards with CD/DVD control keys.)
998
 */
1015
 */
999
static JSBool controls_play_pause (JSContext *cx, JSObject *obj, uintN argc,
1016
static JSBool controls_play_pause (JSContext *cx, uintN argc, jsval *vp)
1000
				  jsval *argv, jsval *rval)
1001
{
1017
{
1018
  jsval *argv = JS_ARGV (cx, vp);
1002
  se_log_fncall_checkinit ("play_pause");
1019
  se_log_fncall_checkinit ("play_pause");
1003
  se_argc_check_max (1, "play_pause");
1020
  se_argc_check_max (1, "play_pause");
1004
1021
Lines 1009-1030 static JSBool controls_play_pause (JSCon Link Here
1009
  {
1026
  {
1010
  case XINE_STATUS_STOP:
1027
  case XINE_STATUS_STOP:
1011
  case XINE_STATUS_IDLE:
1028
  case XINE_STATUS_IDLE:
1012
    return controls_play (cx, obj, 0, 0, rval);
1029
    return controls_play (cx, argc, vp);
1013
  default:
1030
  default:
1014
    return controls_pause (cx, obj, argc, argv, rval);
1031
    return controls_pause (cx, argc, vp);
1015
  }
1032
  }
1016
}
1033
}
1017
1034
1018
static JSBool js_is_live_stream (JSContext *cx, JSObject *obj, uintN argc,
1035
static JSBool js_is_live_stream (JSContext *cx, uintN argc, jsval *vp)
1019
				 jsval *argv, jsval *rval)
1020
{
1036
{
1021
  *rval = JSVAL_FALSE;
1037
  JS_SET_RVAL(cx, vp, JSVAL_FALSE);
1022
1038
1023
  se_log_fncall ("is_live_stream");
1039
  se_log_fncall ("is_live_stream");
1024
  se_argc_check_max (0, "is_live_stream");
1040
  se_argc_check_max (0, "is_live_stream");
1025
1041
1026
  if (player_live_stream ())
1042
  if (player_live_stream ())
1027
    *rval = JSVAL_TRUE;
1043
    JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1028
1044
1029
  return JS_TRUE;
1045
  return JS_TRUE;
1030
}
1046
}
Lines 1087-1098 static xine_audio_port_t *load_audio_out Link Here
1087
/* Properties */
1103
/* Properties */
1088
1104
1089
static void add_chain_funcs (const char *prop, const char *config,
1105
static void add_chain_funcs (const char *prop, const char *config,
1090
			     JSBool (*set_chain) (JSContext *, JSObject *,
1106
			     JSBool (*set_chain) (JSContext *, uintN, jsval *))
1091
						  uintN, jsval *, jsval *))
1092
{
1107
{
1093
  se_o_t *obj = se_find_object (gse, NULL, prop);
1108
  se_o_t *obj = se_find_object (gse, NULL, prop);
1094
  if (set_chain)
1109
  if (set_chain)
1095
    se_defun (gse, obj, "set_chain", set_chain, 0, 0, SE_GROUP_HIDDEN, NULL, NULL);
1110
    se_defun (gse, obj, "set_chain", set_chain, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL);
1096
  se_prop_create_xine_id (gse, obj, "chain", config);
1111
  se_prop_create_xine_id (gse, obj, "chain", config);
1097
  se_prop_add_listener (gse, obj, "chain",
1112
  se_prop_add_listener (gse, obj, "chain",
1098
			listen_postproc_chain, (void *)config);
1113
			listen_postproc_chain, (void *)config);
Lines 1194-1262 void player_init (void) Link Here
1194
1209
1195
  {
1210
  {
1196
    static const se_f_def_t defs[] = {
1211
    static const se_f_def_t defs[] = {
1197
      { "play", controls_play, 0, 0,
1212
      { "play", controls_play, 0, JSFUN_FAST_NATIVE,
1198
	/* help text describes function parameters */
1213
	/* help text describes function parameters */
1199
	SE_GROUP_ENGINE, N_("[mrl] [, pos, time]"),
1214
	SE_GROUP_ENGINE, N_("[mrl] [, pos, time]"),
1200
	N_("time in milliseconds") },
1215
	N_("time in milliseconds") },
1201
      { "get_time", get_time, 0, 0,
1216
      { "get_time", get_time, 0, JSFUN_FAST_NATIVE,
1202
	SE_GROUP_ENGINE, NULL, N_("stream time index") },
1217
	SE_GROUP_ENGINE, NULL, N_("stream time index") },
1203
      { "get_pos", get_pos, 0, 0,
1218
      { "get_pos", get_pos, 0, JSFUN_FAST_NATIVE,
1204
	SE_GROUP_ENGINE, NULL, N_("stream position (%)") },
1219
	SE_GROUP_ENGINE, NULL, N_("stream position (%)") },
1205
      { "has_time", has_time, 0, 0,
1220
      { "has_time", has_time, 0, JSFUN_FAST_NATIVE,
1206
	SE_GROUP_ENGINE, NULL, N_("whether the stream has a time index") },
1221
	SE_GROUP_ENGINE, NULL, N_("whether the stream has a time index") },
1207
      { "pause", controls_pause, 0, 0,
1222
      { "pause", controls_pause, 0, JSFUN_FAST_NATIVE,
1208
	SE_GROUP_ENGINE, N_("[bool]"), NULL },
1223
	SE_GROUP_ENGINE, N_("[bool]"), NULL },
1209
      { "stop", controls_stop, 0, 0,
1224
      { "stop", controls_stop, 0, JSFUN_FAST_NATIVE,
1210
	SE_GROUP_ENGINE, NULL, NULL },
1225
	SE_GROUP_ENGINE, NULL, NULL },
1211
      { "eject", controls_eject, 0, 0,
1226
      { "eject", controls_eject, 0, JSFUN_FAST_NATIVE,
1212
	SE_GROUP_ENGINE, NULL, NULL },
1227
	SE_GROUP_ENGINE, NULL, NULL },
1213
      { "play_pause", controls_play_pause, 0, 0,
1228
      { "play_pause", controls_play_pause, 0, JSFUN_FAST_NATIVE,
1214
	SE_GROUP_ENGINE, N_("[bool]"), NULL },
1229
	SE_GROUP_ENGINE, N_("[bool]"), NULL },
1215
      { "snapshot", js_snapshot, 0, 0,
1230
      { "snapshot", js_snapshot, 0, JSFUN_FAST_NATIVE,
1216
	/* these correspond to the options in the snapshot-save dialogue box */
1231
	/* these correspond to the options in the snapshot-save dialogue box */
1217
	SE_GROUP_ENGINE, N_("[file name [, scale, blend]]"), NULL },
1232
	SE_GROUP_ENGINE, N_("[file name [, scale, blend]]"), NULL },
1218
1233
1219
      { "set_video_size", js_set_video_size, 0, 0,
1234
      { "set_video_size", js_set_video_size, 0, JSFUN_FAST_NATIVE,
1220
	SE_GROUP_PROPERTIES, N_("int"), NULL },
1235
	SE_GROUP_PROPERTIES, N_("int"), NULL },
1221
1236
1222
#ifdef WITH_DEPRECATED
1237
#ifdef WITH_DEPRECATED
1223
#ifdef WITH_OBSOLETE
1238
#ifdef WITH_OBSOLETE
1224
      { "set_speed", js_set_speed, 0, 0,
1239
      { "set_speed", js_set_speed, 0, JSFUN_FAST_NATIVE,
1225
	SE_GROUP_HIDDEN, NULL, NULL },
1240
	SE_GROUP_HIDDEN, NULL, NULL },
1226
      { "get_speed", js_get_speed, 0, 0,
1241
      { "get_speed", js_get_speed, 0, JSFUN_FAST_NATIVE,
1227
	SE_GROUP_HIDDEN, NULL, NULL },
1242
	SE_GROUP_HIDDEN, NULL, NULL },
1228
      { "set_volume", js_set_volume, 0, 0,
1243
      { "set_volume", js_set_volume, 0, JSFUN_FAST_NATIVE,
1229
	SE_GROUP_HIDDEN, NULL, NULL },
1244
	SE_GROUP_HIDDEN, NULL, NULL },
1230
      { "get_volume", js_get_volume, 0, 0,
1245
      { "get_volume", js_get_volume, 0, JSFUN_FAST_NATIVE,
1231
	SE_GROUP_HIDDEN, NULL, NULL },
1246
	SE_GROUP_HIDDEN, NULL, NULL },
1232
      { "set_mute", js_set_mute, 0, 0,
1247
      { "set_mute", js_set_mute, 0, JSFUN_FAST_NATIVE,
1233
	SE_GROUP_HIDDEN, NULL, NULL },
1248
	SE_GROUP_HIDDEN, NULL, NULL },
1234
      { "get_mute", js_get_mute, 0, 0,
1249
      { "get_mute", js_get_mute, 0, JSFUN_FAST_NATIVE,
1235
	SE_GROUP_HIDDEN, NULL, NULL },
1250
	SE_GROUP_HIDDEN, NULL, NULL },
1236
      { "set_zoom", js_set_zoom, 0, 0,
1251
      { "set_zoom", js_set_zoom, 0, JSFUN_FAST_NATIVE,
1237
	SE_GROUP_HIDDEN, NULL, NULL },
1252
	SE_GROUP_HIDDEN, NULL, NULL },
1238
      { "get_zoom", js_get_zoom, 0, 0,
1253
      { "get_zoom", js_get_zoom, 0, JSFUN_FAST_NATIVE,
1239
	SE_GROUP_HIDDEN, NULL, NULL },
1254
	SE_GROUP_HIDDEN, NULL, NULL },
1240
#endif /* WITH_OBSOLETE */
1255
#endif /* WITH_OBSOLETE */
1241
      { "set_fullscreen", js_set_fullscreen, 0, 0,
1256
      { "set_fullscreen", js_set_fullscreen, 0, JSFUN_FAST_NATIVE,
1242
	SE_GROUP_HIDDEN, NULL, NULL },
1257
	SE_GROUP_HIDDEN, NULL, NULL },
1243
#ifdef WITH_OBSOLETE
1258
#ifdef WITH_OBSOLETE
1244
      { "set_aspect", js_set_aspect, 0, 0,
1259
      { "set_aspect", js_set_aspect, 0, JSFUN_FAST_NATIVE,
1245
	SE_GROUP_HIDDEN, NULL, NULL },
1260
	SE_GROUP_HIDDEN, NULL, NULL },
1246
      { "set_deinterlace", js_set_deinterlace, 0, 0,
1261
      { "set_deinterlace", js_set_deinterlace, 0, JSFUN_FAST_NATIVE,
1247
	SE_GROUP_HIDDEN, NULL, NULL },
1262
	SE_GROUP_HIDDEN, NULL, NULL },
1248
      { "set_postproc_video", js_set_postproc_video, 0, 0,
1263
      { "set_postproc_video", js_set_postproc_video, 0, JSFUN_FAST_NATIVE,
1249
	SE_GROUP_HIDDEN, NULL, NULL },
1264
	SE_GROUP_HIDDEN, NULL, NULL },
1250
      { "set_postproc_audio", js_set_postproc_audio, 0, 0,
1265
      { "set_postproc_audio", js_set_postproc_audio, 0, JSFUN_FAST_NATIVE,
1251
	SE_GROUP_HIDDEN, NULL, NULL },
1266
	SE_GROUP_HIDDEN, NULL, NULL },
1252
      { "set_auto_resize", js_set_auto_resize, 0, 0,
1267
      { "set_auto_resize", js_set_auto_resize, 0, JSFUN_FAST_NATIVE,
1253
	SE_GROUP_HIDDEN, NULL, NULL },
1268
	SE_GROUP_HIDDEN, NULL, NULL },
1254
      { "set_auto_rescale", js_set_auto_rescale, 0, 0,
1269
      { "set_auto_rescale", js_set_auto_rescale, 0, JSFUN_FAST_NATIVE,
1255
	SE_GROUP_HIDDEN, NULL, NULL },
1270
	SE_GROUP_HIDDEN, NULL, NULL },
1256
#endif /* WITH_OBSOLETE */
1271
#endif /* WITH_OBSOLETE */
1257
#endif /* WITH_DEPRECATED */
1272
#endif /* WITH_DEPRECATED */
1258
1273
1259
      { "is_live_stream", js_is_live_stream, 0, 0,
1274
      { "is_live_stream", js_is_live_stream, 0, JSFUN_FAST_NATIVE,
1260
	SE_GROUP_PROPERTIES, NULL, NULL },
1275
	SE_GROUP_PROPERTIES, NULL, NULL },
1261
      { NULL }
1276
      { NULL }
1262
    };
1277
    };
1263
-- gxine-0.5.905.orig/src/wizards.c
1278
++ gxine-0.5.905/src/wizards.c
Lines 414-430 void run_wizards (gboolean requested) Link Here
414
  }
414
  }
415
}
415
}
416
416
417
static JSBool js_run_wizards (JSContext *cx, JSObject *obj, uintN argc,
417
static JSBool js_run_wizards (JSContext *cx, uintN argc, jsval *vp)
418
			      jsval *argv, jsval *rval)
419
{
418
{
420
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
419
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
421
  se_log_fncall_checkinit ("run_wizards");
420
  se_log_fncall_checkinit ("run_wizards");
422
  run_wizards (TRUE);
421
  run_wizards (TRUE);
422
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
423
  return JS_TRUE;
423
  return JS_TRUE;
424
}
424
}
425
425
426
void wizards_init (void)
426
void wizards_init (void)
427
{
427
{
428
  se_defun (gse, NULL, "run_wizards", js_run_wizards, 0, 0,
428
  se_defun (gse, NULL, "run_wizards", js_run_wizards, 0, JSFUN_FAST_NATIVE,
429
	    SE_GROUP_HIDDEN, NULL, NULL);
429
	    SE_GROUP_HIDDEN, NULL, NULL);
430
}
430
}
431
-- gxine-0.5.905.orig/src/open_mrl.c
431
++ gxine-0.5.905/src/open_mrl.c
Lines 88-108 static void open_mrl_response_cb (GtkDia Link Here
88
  }
88
  }
89
}
89
}
90
90
91
static JSBool js_open_show (JSContext *cx, JSObject *obj, uintN argc,
91
static JSBool js_open_show (JSContext *cx, uintN argc, jsval *vp)
92
			    jsval *argv, jsval *rval)
93
{
92
{
94
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
93
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
95
  se_log_fncall_checkinit ("open_show");
94
  se_log_fncall_checkinit ("open_show");
96
  file_dialog_show ();
95
  file_dialog_show ();
96
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
97
  return JS_TRUE;
97
  return JS_TRUE;
98
}
98
}
99
99
100
static JSBool js_open_mrl_show (JSContext *cx, JSObject *obj, uintN argc,
100
static JSBool js_open_mrl_show (JSContext *cx, uintN argc, jsval *vp)
101
				jsval *argv, jsval *rval)
102
{
101
{
103
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
102
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
104
  se_log_fncall_checkinit ("open_mrl_show");
103
  se_log_fncall_checkinit ("open_mrl_show");
105
  open_mrl_show ();
104
  open_mrl_show ();
105
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
106
  return JS_TRUE;
106
  return JS_TRUE;
107
}
107
}
108
108
Lines 142-149 void open_mrl_init (void) Link Here
142
142
143
  {
143
  {
144
    static const se_f_def_t defs[] = {
144
    static const se_f_def_t defs[] = {
145
      { "open_show", js_open_show, 0, 0, SE_GROUP_FILE, NULL, NULL },
145
      { "open_show", js_open_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_FILE, NULL, NULL },
146
      { "open_mrl_show", js_open_mrl_show, 0, 0, SE_GROUP_FILE, NULL, NULL },
146
      { "open_mrl_show", js_open_mrl_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_FILE, NULL, NULL },
147
      { NULL }
147
      { NULL }
148
    };
148
    };
149
    se_defuns (gse, NULL, defs);
149
    se_defuns (gse, NULL, defs);
150
-- gxine-0.5.905.orig/src/key_events.c
150
++ gxine-0.5.905/src/key_events.c
Lines 1041-1050 static JSBool js_xine_event (int type Link Here
1041
#endif
1041
#endif
1042
1042
1043
#define JS_XINE_EVENT(L,T) \
1043
#define JS_XINE_EVENT(L,T) \
1044
  static JSBool js_##L (JSContext *cx, JSObject *obj, uintN argc, \
1044
  static JSBool js_##L (JSContext *cx, uintN argc, jsval *vp) \
1045
			jsval *argv, jsval *rval) \
1046
  { \
1045
  { \
1047
    return js_xine_event (XINE_EVENT_##T, #L); \
1046
    JSBool ret = js_xine_event (XINE_EVENT_##T, #L); \
1047
    if (ret) { \
1048
      JS_SET_RVAL (cx, vp, JSVAL_VOID); \
1049
    } \
1050
    return ret; \
1048
  }
1051
  }
1049
1052
1050
JS_XINE_EVENT (input_up, INPUT_UP);
1053
JS_XINE_EVENT (input_up, INPUT_UP);
Lines 1091-1106 JS_XINE_EVENT (input_menu3, INPUT_MENU3) Link Here
1091
JS_XINE_EVENT (input_previous, INPUT_PREVIOUS);
1094
JS_XINE_EVENT (input_previous, INPUT_PREVIOUS);
1092
JS_XINE_EVENT (input_next, INPUT_NEXT);
1095
JS_XINE_EVENT (input_next, INPUT_NEXT);
1093
1096
1094
static JSBool js_keybindings_show (JSContext *cx, JSObject *obj, uintN argc,
1097
static JSBool js_keybindings_show (JSContext *cx, uintN argc, jsval *vp)
1095
				   jsval *argv, jsval *rval)
1096
{
1098
{
1097
  se_log_fncall_checkinit ("keybindings_show");
1099
  se_log_fncall_checkinit ("keybindings_show");
1098
  kb_edit_show ();
1100
  kb_edit_show ();
1101
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1099
  return JS_TRUE;
1102
  return JS_TRUE;
1100
}
1103
}
1101
1104
1102
static JSBool js_keypad_show (JSContext *cx, JSObject *obj, uintN argc,
1105
static JSBool js_keypad_show (JSContext *cx, uintN argc, jsval *vp)
1103
			      jsval *argv, jsval *rval)
1104
{
1106
{
1105
  se_log_fncall_checkinit ("keypad_show");
1107
  se_log_fncall_checkinit ("keypad_show");
1106
  if (keypad)
1108
  if (keypad)
Lines 1110-1115 static JSBool js_keypad_show (JSContext Link Here
1110
    else
1112
    else
1111
      window_show (keypad, NULL);
1113
      window_show (keypad, NULL);
1112
  }
1114
  }
1115
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1113
  return JS_TRUE;
1116
  return JS_TRUE;
1114
}
1117
}
1115
1118
Lines 1247-1254 static const kb_xine_event_map_t xine_vd Link Here
1247
  }
1250
  }
1248
};
1251
};
1249
1252
1250
JSBool js_event_generic (JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
1253
JSBool js_event_generic (JSContext *cx, uintN argc, jsval *vp,
1251
			 jsval *rval, const char *func, const char *const *prefix,
1254
                         const char *func, const char *const *prefix,
1252
			 ...)
1255
			 ...)
1253
{
1256
{
1254
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
1257
  se_t *se = (se_t *) JS_GetContextPrivate(cx);
Lines 1257-1264 JSBool js_event_generic (JSContext *cx, Link Here
1257
  char *evstr;
1260
  char *evstr;
1258
  va_list ap;
1261
  va_list ap;
1259
  const kb_xine_event_map_t *evlist;
1262
  const kb_xine_event_map_t *evlist;
1263
  jsval *argv = JS_ARGV (cx, vp);
1260
1264
1261
  *rval = JSVAL_TRUE;
1265
  JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1262
1266
1263
  se_log_fncall (func);
1267
  se_log_fncall (func);
1264
  se_argc_check_max (1, func);
1268
  se_argc_check_max (1, func);
Lines 1275-1281 JSBool js_event_generic (JSContext *cx, Link Here
1275
1279
1276
  se_arg_is_string (0, func);
1280
  se_arg_is_string (0, func);
1277
1281
1278
  *rval = JSVAL_FALSE;
1282
  JS_SET_RVAL (cx, vp, JSVAL_FALSE);
1279
1283
1280
  if (prefix)
1284
  if (prefix)
1281
  {
1285
  {
Lines 1294-1300 JSBool js_event_generic (JSContext *cx, Link Here
1294
  }
1298
  }
1295
1299
1296
  str = JS_ValueToString (cx, argv[0]);
1300
  str = JS_ValueToString (cx, argv[0]);
1297
  evstr = JS_GetStringBytes (str);
1301
  evstr = SE_JS_ENCODE_STRING (cx, str);
1298
  event.type = 0;
1302
  event.type = 0;
1299
1303
1300
  va_start (ap, prefix);
1304
  va_start (ap, prefix);
Lines 1306-1313 JSBool js_event_generic (JSContext *cx, Link Here
1306
    event.type = kb_xine_event_lookup (NULL, evstr);
1310
    event.type = kb_xine_event_lookup (NULL, evstr);
1307
1311
1308
  if (!event.type)
1312
  if (!event.type)
1313
  {
1314
    SE_JS_FREE_ENCODED_STRING (cx, evstr);
1309
    return JS_TRUE;
1315
    return JS_TRUE;
1310
1316
  }
1311
  if (event.type != -1)
1317
  if (event.type != -1)
1312
  {
1318
  {
1313
    event.data = NULL;
1319
    event.data = NULL;
Lines 1316-1336 JSBool js_event_generic (JSContext *cx, Link Here
1316
    xine_event_send (stream, &event);
1322
    xine_event_send (stream, &event);
1317
  }
1323
  }
1318
1324
1319
  *rval = JSVAL_TRUE;
1325
  SE_JS_FREE_ENCODED_STRING (cx, evstr);
1326
  JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1320
  return JS_TRUE;
1327
  return JS_TRUE;
1321
}
1328
}
1322
1329
1323
static JSBool js_event (JSContext *cx, JSObject *obj, uintN argc,
1330
static JSBool js_event (JSContext *cx, uintN argc, jsval *vp)
1324
		      jsval *argv, jsval *rval)
1325
{
1331
{
1326
  return js_event_generic (cx, obj, argc, argv, rval, "event", NULL, NULL);
1332
  return js_event_generic (cx, argc, vp, "event", NULL, NULL);
1327
}
1333
}
1328
1334
1329
static JSBool js_vdr (JSContext *cx, JSObject *obj, uintN argc,
1335
static JSBool js_vdr (JSContext *cx, uintN argc, jsval *vp)
1330
		      jsval *argv, jsval *rval)
1331
{
1336
{
1332
  const char *const prefixes[] = { "vdr:/", "netvdr:/", NULL };
1337
  const char *const prefixes[] = { "vdr:/", "netvdr:/", NULL };
1333
  return js_event_generic (cx, obj, argc, argv, rval, "vdr", prefixes,
1338
  return js_event_generic (cx, argc, vp, "vdr", prefixes,
1334
			   &xine_vdr, NULL);
1339
			   &xine_vdr, NULL);
1335
}
1340
}
1336
1341
Lines 1528-1552 void key_events_init (void) Link Here
1528
1533
1529
  {
1534
  {
1530
    static const se_f_def_t defs[] = {
1535
    static const se_f_def_t defs[] = {
1531
      { "input_up", js_input_up, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1536
      { "input_up", js_input_up, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1532
      { "input_down", js_input_down, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1537
      { "input_down", js_input_down, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1533
      { "input_left", js_input_left, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1538
      { "input_left", js_input_left, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1534
      { "input_right", js_input_right, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1539
      { "input_right", js_input_right, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1535
      { "input_select", js_input_select, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1540
      { "input_select", js_input_select, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1536
      { "input_menu", js_input_menu, 0, 0,
1541
      { "input_menu", js_input_menu, 0, JSFUN_FAST_NATIVE,
1537
	SE_GROUP_INPUT, N_("int"), N_("range is 1 to 7") },
1542
	SE_GROUP_INPUT, N_("int"), N_("range is 1 to 7") },
1538
      { "input_menu1", js_input_menu1, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1543
      { "input_menu1", js_input_menu1, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1539
      { "input_menu2", js_input_menu2, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1544
      { "input_menu2", js_input_menu2, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1540
      { "input_menu3", js_input_menu3, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1545
      { "input_menu3", js_input_menu3, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1541
      { "input_previous", js_input_previous, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1546
      { "input_previous", js_input_previous, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1542
      { "input_next", js_input_next, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1547
      { "input_next", js_input_next, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1543
      { "keybindings_show", js_keybindings_show, 0, 0,
1548
      { "keybindings_show", js_keybindings_show, 0, JSFUN_FAST_NATIVE,
1544
	SE_GROUP_DIALOGUE, NULL, NULL },
1549
	SE_GROUP_DIALOGUE, NULL, NULL },
1545
      { "keypad_show", js_keypad_show, 0, 0,
1550
      { "keypad_show", js_keypad_show, 0, JSFUN_FAST_NATIVE,
1546
	SE_GROUP_DIALOGUE, NULL, NULL },
1551
	SE_GROUP_DIALOGUE, NULL, NULL },
1547
      { "event", js_event, 0, 0,
1552
      { "event", js_event, 0, JSFUN_FAST_NATIVE,
1548
	SE_GROUP_INPUT, N_("string"), N_("event; returns true if sent") },
1553
	SE_GROUP_INPUT, N_("string"), N_("event; returns true if sent") },
1549
      { "vdr", js_vdr, 0, 0,
1554
      { "vdr", js_vdr, 0, JSFUN_FAST_NATIVE,
1550
	SE_GROUP_EXTERNAL, N_("string"), N_("VDR event; returns true if sent") },
1555
	SE_GROUP_EXTERNAL, N_("string"), N_("VDR event; returns true if sent") },
1551
      { NULL }
1556
      { NULL }
1552
    };
1557
    };
1553
-- gxine-0.5.905.orig/src/preferences.c
1558
++ gxine-0.5.905/src/preferences.c
Lines 1106-1117 static void response_cb (GtkDialog *dbox Link Here
1106
  }
1106
  }
1107
}
1107
}
1108
1108
1109
static JSBool js_preferences_show (JSContext *cx, JSObject *obj, uintN argc,
1109
static JSBool js_preferences_show (JSContext *cx, uintN argc, jsval *vp)
1110
				   jsval *argv, jsval *rval)
1111
{
1110
{
1112
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1111
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1113
  se_log_fncall_checkinit ("preferences_show");
1112
  se_log_fncall_checkinit ("preferences_show");
1114
  preferences_show ();
1113
  preferences_show ();
1114
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1115
  return JS_TRUE;
1115
  return JS_TRUE;
1116
}
1116
}
1117
1117
Lines 1171-1177 void preferences_init (void) Link Here
1171
{
1171
{
1172
  is_visible = FALSE;
1172
  is_visible = FALSE;
1173
  /* script engine functions */
1173
  /* script engine functions */
1174
  se_defun (gse, NULL, "preferences_show", js_preferences_show, 0, 0,
1174
  se_defun (gse, NULL, "preferences_show", js_preferences_show, 0, JSFUN_FAST_NATIVE,
1175
	    SE_GROUP_DIALOGUE, NULL, NULL);
1175
	    SE_GROUP_DIALOGUE, NULL, NULL);
1176
1176
1177
  preferences_init_dbox ();
1177
  preferences_init_dbox ();
1178
-- gxine-0.5.905.orig/src/lirc.c
1178
++ gxine-0.5.905/src/lirc.c
Lines 212-219 void gxine_lirc_quit (void) Link Here
212
#endif
212
#endif
213
}
213
}
214
214
215
static JSBool js_reload_lirc (JSContext *cx, JSObject *obj, uintN argc,
215
static JSBool js_reload_lirc (JSContext *cx, uintN argc, jsval *vp)
216
			      jsval *argv, jsval *rval)
217
{
216
{
218
  se_log_fncall ("reload_lirc");
217
  se_log_fncall ("reload_lirc");
219
  se_argc_check_max (0, "reload_lirc");
218
  se_argc_check_max (0, "reload_lirc");
Lines 221-233 static JSBool js_reload_lirc (JSContext Link Here
221
  if (gxine_lirc_thread)
220
  if (gxine_lirc_thread)
222
    pthread_join (gxine_lirc_thread, NULL);
221
    pthread_join (gxine_lirc_thread, NULL);
223
  gxine_lirc_start ();
222
  gxine_lirc_start ();
224
  *rval = gxine_lirc_thread ? JSVAL_TRUE : JSVAL_FALSE;
223
  JS_SET_RVAL (cx, vp, gxine_lirc_thread ? JSVAL_TRUE : JSVAL_FALSE);
225
  return JS_TRUE;
224
  return JS_TRUE;
226
}
225
}
227
226
228
void gxine_lirc_init (void)
227
void gxine_lirc_init (void)
229
{
228
{
230
  se_defun (gse, NULL, "reload_lirc", js_reload_lirc, 0, 0,
229
  se_defun (gse, NULL, "reload_lirc", js_reload_lirc, 0, JSFUN_FAST_NATIVE,
231
	    SE_GROUP_HIDDEN, NULL, NULL);
230
	    SE_GROUP_HIDDEN, NULL, NULL);
232
  gxine_lirc_start ();
231
  gxine_lirc_start ();
233
}
232
}
234
-- gxine-0.5.905.orig/src/script_engine.h
233
++ gxine-0.5.905/src/script_engine.h
Lines 34-39 Link Here
34
#include <jsapi.h>
34
#include <jsapi.h>
35
#include <pthread.h>
35
#include <pthread.h>
36
36
37
#ifndef JSFUN_FAST_NATIVE
38
// All natives are JSFastNative
39
#define JSFUN_FAST_NATIVE 0
40
#endif
41
42
#ifdef HAVE_JS_GET_STRING_BYTES
43
# define SE_JS_ENCODE_STRING(cx, str) JS_GetStringBytes(str)
44
# define SE_JS_FREE_ENCODED_STRING(cx, str)
45
#else
46
# define SE_JS_ENCODE_STRING(cx, str) JS_EncodeString(cx, str)
47
# define SE_JS_FREE_ENCODED_STRING(cx, str) JS_free(cx, str)
48
#endif
49
50
#ifdef HAVE_JS_NEW_DOUBLE
51
# define SE_JS_NEW_NUMBER_VAL(cx, d, rval) \
52
    jsdouble *new_d = JS_NewDouble (cx, d); \
53
    rval = DOUBLE_TO_JSVAL (new_d)
54
#else
55
# define SE_JS_NEW_NUMBER_VAL(cx, d, rval) \
56
    JS_NewNumberValue (cx, d, &rval)
57
#endif
58
59
#ifdef JS_PROPERTY_OP_HAS_ID_AS_JSID
60
# define SE_JS_PROPERTY_GETTER_DECLARE(name) \
61
    static JSBool \
62
    name(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
63
# define SE_JS_PROPERTY_GETTER_INIT_VARIABLES(idval) \
64
    jsval idval; \
65
    JS_IdToValue (cx, id, &idval)
66
# define SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL(getter, cx, obj, propval, vp) __extension__ ({ \
67
    jsid propid; \
68
    JS_ValueToId (cx, propval, &propid); \
69
    JSBool ret = getter (cx, obj, propid, vp); \
70
    ret; \
71
})
72
#else
73
# define SE_JS_PROPERTY_GETTER_DECLARE(name) \
74
    static JSBool \
75
    name(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
76
# define SE_JS_PROPERTY_GETTER_INIT_VARIABLES(idval) \
77
    jsval idval = id
78
# define SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL(getter, cx, obj, propval, vp) __extension__ ({ \
79
    JSBool ret = getter (cx, obj, propval, vp); \
80
    ret; \
81
})
82
#endif
83
84
#ifdef HAVE_JS_STRICT_PROPERTY_OP
85
# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
86
    static JSBool \
87
    name(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
88
# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
89
    jsval idval; \
90
    JS_IdToValue (cx, id, &idval)
91
# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
92
    jsid propid; \
93
    JS_ValueToId (cx, propval, &propid); \
94
    JSBool ret = setter (cx, obj, propid, JS_FALSE, vp); \
95
    ret; \
96
})
97
#elif JS_PROPERTY_OP_HAS_ID_AS_JSID
98
# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
99
    static JSBool \
100
    name(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
101
# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
102
    jsval idval; \
103
    JS_IdToValue (cx, id, &idval)
104
# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
105
    jsid propid; \
106
    JS_ValueToId (cx, propval, &propid); \
107
    JSBool ret = setter (cx, obj, propid, vp); \
108
    ret; \
109
})
110
#else
111
# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
112
    static JSBool \
113
    name(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
114
# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
115
    jsval idval = id
116
# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
117
    JSBool ret = setter (cx, obj, propval, vp); \
118
    ret; \
119
})
120
#endif
121
122
#ifdef JSVAL_TO_DOUBLE_RETURNS_POINTER
123
# define SE_JSVAL_TO_DOUBLE(v) *JSVAL_TO_DOUBLE(v)
124
#else
125
# define SE_JSVAL_TO_DOUBLE(v) JSVAL_TO_DOUBLE(v)
126
#endif
127
37
typedef int (*se_prop_int_cb_t) (void *user_data, char *property, int *num);
128
typedef int (*se_prop_int_cb_t) (void *user_data, char *property, int *num);
38
typedef void (*se_print_cb_t) (void *user_data, const char *str, ...)
129
typedef void (*se_print_cb_t) (void *user_data, const char *str, ...)
39
  __attribute__ ((format (printf, 2, 3)));
130
  __attribute__ ((format (printf, 2, 3)));
40
-- gxine-0.5.905.orig/src/systray.c
131
++ gxine-0.5.905/src/systray.c
Lines 214-223 button_cb (GtkWidget *widget, GdkEventBu Link Here
214
  return TRUE;
214
  return TRUE;
215
}
215
}
216
216
217
static JSBool js_minimise (JSContext *cx, JSObject *obj, uintN argc,
217
static JSBool js_minimise (JSContext *cx, uintN argc, jsval *vp)
218
			      jsval *argv, jsval *rval)
219
{
218
{
220
  int32 tray_state=-1;
219
  int32 tray_state=-1;
220
  jsval *argv = JS_ARGV (cx, vp);
221
221
222
  se_log_fncall_checkinit ("set_minimised");
222
  se_log_fncall_checkinit ("set_minimised");
223
  se_argc_check_max (1, "set_minimised");
223
  se_argc_check_max (1, "set_minimised");
Lines 239-251 static JSBool js_minimise (JSContext *cx Link Here
239
      app_show ();
239
      app_show ();
240
  }
240
  }
241
241
242
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
242
  return JS_TRUE;
243
  return JS_TRUE;
243
}
244
}
244
245
245
void systray_init (void)
246
void systray_init (void)
246
{
247
{
247
  static const se_f_def_t defs[] = {
248
  static const se_f_def_t defs[] = {
248
    { "set_minimised", js_minimise, 0, 0,
249
    { "set_minimised", js_minimise, 0, JSFUN_FAST_NATIVE,
249
      SE_GROUP_ENGINE, N_("[bool]"),
250
      SE_GROUP_ENGINE, N_("[bool]"),
250
      N_("true to hide, false to show") },
251
      N_("true to hide, false to show") },
251
    { NULL }
252
    { NULL }
252
-- gxine-0.5.905.orig/src/settings.c
253
++ gxine-0.5.905/src/settings.c
Lines 129-138 get_sliders (const struct slider_window_ Link Here
129
  }
129
  }
130
130
131
#define JSFUNC(OBJ,FUNC) \
131
#define JSFUNC(OBJ,FUNC) \
132
  static JSBool js_##OBJ##_##FUNC (JSContext *cx, JSObject *obj, uintN argc, \
132
  static JSBool js_##OBJ##_##FUNC (JSContext *cx, uintN argc, jsval *vp) \
133
				   jsval *argv, jsval *rval) \
134
  { \
133
  { \
135
    int page = -1; \
134
    int page = -1; \
135
    jsval *argv = JS_ARGV (cx, vp); \
136
    se_log_fncall_checkinit (#OBJ"_"#FUNC); \
136
    se_log_fncall_checkinit (#OBJ"_"#FUNC); \
137
    se_argc_check_max (1, #OBJ"_"#FUNC); \
137
    se_argc_check_max (1, #OBJ"_"#FUNC); \
138
    if (argc) \
138
    if (argc) \
Lines 141-151 get_sliders (const struct slider_window_ Link Here
141
      JS_ValueToInt32 (cx, argv[0], &page); \
141
      JS_ValueToInt32 (cx, argv[0], &page); \
142
    } \
142
    } \
143
    sliders_##FUNC (&OBJ##_window, page, TRUE); \
143
    sliders_##FUNC (&OBJ##_window, page, TRUE); \
144
    if (vp) { \
145
      JS_SET_RVAL (cx, vp, JSVAL_VOID); \
146
    } \
144
    return JS_TRUE; \
147
    return JS_TRUE; \
145
  }
148
  }
146
149
147
#define JSDECL(OBJ,FUNC) \
150
#define JSDECL(OBJ,FUNC) \
148
  { #OBJ"_"#FUNC, js_##OBJ##_##FUNC, 0, 0,SE_GROUP_DIALOGUE, NULL, NULL }
151
  { #OBJ"_"#FUNC, js_##OBJ##_##FUNC, 0, JSFUN_FAST_NATIVE,SE_GROUP_DIALOGUE, NULL, NULL }
149
152
150
static void sliders_show (struct slider_window_s *window, guint page,
153
static void sliders_show (struct slider_window_s *window, guint page,
151
			  gboolean unused)
154
			  gboolean unused)
Lines 331-335 void settings_init (void) Link Here
331
334
332
void settings_clear (void)
335
void settings_clear (void)
333
{
336
{
334
  js_settings_clear (gse->cx, NULL, 0, NULL, NULL);
337
  js_settings_clear (gse->cx, 0, NULL);
335
}
338
}
336
-- gxine-0.5.905.orig/src/post.c
339
++ gxine-0.5.905/src/post.c
Lines 1079-1116 post_config_post_chain_window (gxine_cha Link Here
1079
}
1079
}
1080
1080
1081
static JSBool
1081
static JSBool
1082
js_deinterlace_show (JSContext *cx, JSObject *obj, uintN argc,
1082
js_deinterlace_show (JSContext *cx, uintN argc, jsval *vp)
1083
		     jsval *argv, jsval *rval)
1084
{
1083
{
1085
  se_log_fncall_checkinit ("deinterlace_show");
1084
  se_log_fncall_checkinit ("deinterlace_show");
1086
  return post_config_post_chain_window (&chains[POST_CHAIN_DEINTERLACE]);
1085
  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_DEINTERLACE]);
1086
  if (ret) {
1087
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1088
  }
1089
  return ret;
1087
}
1090
}
1088
1091
1089
static JSBool
1092
static JSBool
1090
js_pp_video_show (JSContext *cx, JSObject *obj, uintN argc,
1093
js_pp_video_show (JSContext *cx, uintN argc, jsval *vp)
1091
		  jsval *argv, jsval *rval)
1092
{
1094
{
1093
  se_log_fncall_checkinit ("postproc_video_show");
1095
  se_log_fncall_checkinit ("postproc_video_show");
1094
  return post_config_post_chain_window (&chains[POST_CHAIN_VIDEO]);
1096
  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_VIDEO]);
1097
  if (ret) {
1098
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1099
  }
1100
  return ret;
1095
}
1101
}
1096
1102
1097
static JSBool
1103
static JSBool
1098
js_pp_audio_show (JSContext *cx, JSObject *obj, uintN argc,
1104
js_pp_audio_show (JSContext *cx, uintN argc, jsval *vp)
1099
		  jsval *argv, jsval *rval)
1100
{
1105
{
1101
  se_log_fncall_checkinit ("postproc_audio_show");
1106
  se_log_fncall_checkinit ("postproc_audio_show");
1102
  return post_config_post_chain_window (&chains[POST_CHAIN_AUDIO]);
1107
  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_AUDIO]);
1108
  if (ret) {
1109
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1110
  }
1111
  return ret;
1103
}
1112
}
1104
1113
1105
void
1114
void
1106
post_init (void)
1115
post_init (void)
1107
{
1116
{
1108
  static const se_f_def_t defs[] = {
1117
  static const se_f_def_t defs[] = {
1109
    { "deinterlace_show", js_deinterlace_show, 0, 0,
1118
    { "deinterlace_show", js_deinterlace_show, 0, JSFUN_FAST_NATIVE,
1110
      SE_GROUP_DIALOGUE, NULL, NULL },
1119
      SE_GROUP_DIALOGUE, NULL, NULL },
1111
    { "postproc_video_show", js_pp_video_show, 0, 0,
1120
    { "postproc_video_show", js_pp_video_show, 0, JSFUN_FAST_NATIVE,
1112
      SE_GROUP_DIALOGUE, NULL, NULL },
1121
      SE_GROUP_DIALOGUE, NULL, NULL },
1113
    { "postproc_audio_show", js_pp_audio_show, 0, 0,
1122
    { "postproc_audio_show", js_pp_audio_show, 0, JSFUN_FAST_NATIVE,
1114
      SE_GROUP_DIALOGUE, NULL, NULL },
1123
      SE_GROUP_DIALOGUE, NULL, NULL },
1115
    { NULL }
1124
    { NULL }
1116
  };
1125
  };
1117
-- gxine-0.5.905.orig/src/playlist.c
1126
++ gxine-0.5.905/src/playlist.c
Lines 2123-2193 static void drop_cb (GtkTreeView *widget Link Here
2123
 * js functions
2123
 * js functions
2124
 */
2124
 */
2125
2125
2126
static JSBool js_playlist_get_item (JSContext *cx, JSObject *obj, uintN argc,
2126
static JSBool js_playlist_get_item (JSContext *cx, uintN argc, jsval *vp)
2127
				    jsval *argv, jsval *rval)
2128
{
2127
{
2129
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2128
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2130
  se_log_fncall ("playlist_get_item");
2129
  se_log_fncall ("playlist_get_item");
2131
  *rval = INT_TO_JSVAL (playlist_get_list_pos());
2130
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (playlist_get_list_pos()));
2132
  return JS_TRUE;
2131
  return JS_TRUE;
2133
}
2132
}
2134
2133
2135
static JSBool js_playlist_clear (JSContext *cx, JSObject *obj, uintN argc,
2134
static JSBool js_playlist_clear (JSContext *cx, uintN argc, jsval *vp)
2136
				 jsval *argv, jsval *rval)
2137
{
2135
{
2138
  se_log_fncall_checkinit ("playlist_clear");
2136
  se_log_fncall_checkinit ("playlist_clear");
2139
  playlist_clear ();
2137
  playlist_clear ();
2140
  *rval = JSVAL_VOID;
2138
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2141
  return JS_TRUE;
2139
  return JS_TRUE;
2142
}
2140
}
2143
2141
2144
static JSBool js_playlist_flush (JSContext *cx, JSObject *obj, uintN argc,
2142
static JSBool js_playlist_flush (JSContext *cx, uintN argc, jsval *vp)
2145
				 jsval *argv, jsval *rval)
2146
{
2143
{
2147
  se_log_fncall_checkinit ("playlist_flush");
2144
  se_log_fncall_checkinit ("playlist_flush");
2148
  playlist_flush (PLAY_ITEM_NORMAL);
2145
  playlist_flush (PLAY_ITEM_NORMAL);
2149
  *rval = JSVAL_VOID;
2146
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2150
  return JS_TRUE;
2147
  return JS_TRUE;
2151
}
2148
}
2152
2149
2153
static JSBool js_playlist_load (JSContext *cx, JSObject *obj, uintN argc,
2150
static JSBool js_playlist_load (JSContext *cx, uintN argc, jsval *vp)
2154
				jsval *argv, jsval *rval)
2155
{
2151
{
2152
  jsval *argv = JS_ARGV (cx, vp);
2156
  se_log_fncall_checkinit ("playlist_load");
2153
  se_log_fncall_checkinit ("playlist_load");
2157
2154
2158
  se_argc_check (1, "playlist_load");
2155
  se_argc_check (1, "playlist_load");
2159
  se_arg_is_string_or_null (0, "playlist_load");
2156
  se_arg_is_string_or_null (0, "playlist_load");
2160
2157
2161
  char *mrl = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
2158
  char *mrl = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
2162
2159
2163
  logprintf ("playlist_load: file=%s\n", mrl);
2160
  logprintf ("playlist_load: file=%s\n", mrl);
2164
  playlist_load_any (mrl);
2161
  playlist_load_any (mrl);
2165
2162
2166
  *rval = JSVAL_VOID;
2163
  SE_JS_FREE_ENCODED_STRING (cx, mrl);
2164
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2167
  return JS_TRUE;
2165
  return JS_TRUE;
2168
}
2166
}
2169
2167
2170
static JSBool js_playlist_add (JSContext *cx, JSObject *obj, uintN argc,
2168
static JSBool js_playlist_add (JSContext *cx, uintN argc, jsval *vp)
2171
			       jsval *argv, jsval *rval)
2172
{
2169
{
2170
  jsval *argv = JS_ARGV (cx, vp);
2173
2171
2174
  se_log_fncall_checkinit ("playlist_add");
2172
  se_log_fncall_checkinit ("playlist_add");
2175
2173
2176
  se_argc_check_range (1, 2, "playlist_add");
2174
  se_argc_check_range (1, 2, "playlist_add");
2177
  se_arg_is_string (0, "playlist_add");
2175
  se_arg_is_string (0, "playlist_add");
2178
2176
2179
  char *mrl = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
2177
  char *mrl = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
2180
  int item;
2178
  int item;
2181
2179
2182
  if (argc > 1)
2180
  if (argc > 1)
2183
  {
2181
  {
2184
    se_arg_is_string_or_null (1, "playlist_add");
2182
    se_arg_is_string_or_null (1, "playlist_add");
2185
    char *title = JSVAL_IS_STRING (argv[1])
2183
    char *title = JSVAL_IS_STRING (argv[1])
2186
		  ? JS_GetStringBytes (JS_ValueToString (cx, argv[1]))
2184
                  ? SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]))
2187
		  : NULL;
2185
		  : NULL;
2188
    logprintf ("playlist_add: MRL=%s title=%s\n", mrl, title);
2186
    logprintf ("playlist_add: MRL=%s title=%s\n", mrl, title);
2189
    play_item_t *play_item = play_item_new (title, mrl, 0, 0);
2187
    play_item_t *play_item = play_item_new (title, mrl, 0, 0);
2190
    item = playlist_add (play_item, -1);
2188
    item = playlist_add (play_item, -1);
2189
    SE_JS_FREE_ENCODED_STRING (cx, title);
2191
  }
2190
  }
2192
  else
2191
  else
2193
  {
2192
  {
Lines 2195-2208 static JSBool js_playlist_add (JSContext Link Here
2195
    item = playlist_add_mrl (mrl, -1);
2194
    item = playlist_add_mrl (mrl, -1);
2196
  }
2195
  }
2197
2196
2198
  *rval = INT_TO_JSVAL (item);
2197
  SE_JS_FREE_ENCODED_STRING (cx, mrl);
2198
  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (item));
2199
2199
2200
  return JS_TRUE;
2200
  return JS_TRUE;
2201
}
2201
}
2202
2202
2203
static JSBool js_playlist_delete (JSContext *cx, JSObject *obj, uintN argc,
2203
static JSBool js_playlist_delete (JSContext *cx, uintN argc, jsval *vp)
2204
				  jsval *argv, jsval *rval)
2205
{
2204
{
2205
  jsval *argv = JS_ARGV (cx, vp);
2206
  se_log_fncall_checkinit ("playlist_remove");
2206
  se_log_fncall_checkinit ("playlist_remove");
2207
2207
2208
  se_argc_check_range (1, 2, "playlist_remove");
2208
  se_argc_check_range (1, 2, "playlist_remove");
Lines 2227-2240 static JSBool js_playlist_delete (JSCont Link Here
2227
    gtk_list_store_remove (pl_store, &iter);
2227
    gtk_list_store_remove (pl_store, &iter);
2228
  }
2228
  }
2229
2229
2230
  *rval = JSVAL_VOID;
2230
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2231
  return JS_TRUE;
2231
  return JS_TRUE;
2232
}
2232
}
2233
2233
2234
static JSBool js_playlist_play (JSContext *cx, JSObject *obj, uintN argc,
2234
static JSBool js_playlist_play (JSContext *cx, uintN argc, jsval *vp)
2235
				jsval *argv, jsval *rval)
2236
{
2235
{
2237
  int32 item;
2236
  int32 item;
2237
  jsval *argv = JS_ARGV (cx, vp);
2238
2238
2239
  se_log_fncall_checkinit ("playlist_play");
2239
  se_log_fncall_checkinit ("playlist_play");
2240
2240
Lines 2245-2265 static JSBool js_playlist_play (JSContex Link Here
2245
2245
2246
  playlist_play (item);
2246
  playlist_play (item);
2247
2247
2248
  *rval = JSVAL_VOID;
2248
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2249
  return JS_TRUE;
2249
  return JS_TRUE;
2250
}
2250
}
2251
2251
2252
static JSBool js_playlist_show (JSContext *cx, JSObject *obj, uintN argc,
2252
static JSBool js_playlist_show (JSContext *cx, uintN argc, jsval *vp)
2253
				jsval *argv, jsval *rval)
2254
{
2253
{
2255
  se_log_fncall_checkinit ("playlist_show");
2254
  se_log_fncall_checkinit ("playlist_show");
2256
  playlist_show ();
2255
  playlist_show ();
2257
  *rval = JSVAL_VOID;
2256
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2258
  return JS_TRUE;
2257
  return JS_TRUE;
2259
}
2258
}
2260
2259
2261
static JSBool js_mrl_browser_refresh (JSContext *cx, JSObject *obj, uintN argc,
2260
static JSBool js_mrl_browser_refresh (JSContext *cx, uintN argc, jsval *vp)
2262
				      jsval *argv, jsval *rval)
2263
{
2261
{
2264
  GtkTreeIter iter;
2262
  GtkTreeIter iter;
2265
  se_log_fncall_checkinit ("mrl_browser_refresh");
2263
  se_log_fncall_checkinit ("mrl_browser_refresh");
Lines 2270-2283 static JSBool js_mrl_browser_refresh (JS Link Here
2270
      || !item_marked_current (&iter))
2268
      || !item_marked_current (&iter))
2271
  {
2269
  {
2272
    playlist_flush (PLAY_ITEM_BROWSER);
2270
    playlist_flush (PLAY_ITEM_BROWSER);
2273
    *rval = JSVAL_VOID;
2271
    JS_SET_RVAL (cx, vp, JSVAL_VOID);
2274
    return JS_TRUE;
2272
    return JS_TRUE;
2275
  }
2273
  }
2276
2274
2277
  CUR_ITEM_LOCK ();
2275
  CUR_ITEM_LOCK ();
2278
  playlist_browse_set (cur_item ? : playlist_get_item (cur_list_pos));
2276
  playlist_browse_set (cur_item ? : playlist_get_item (cur_list_pos));
2279
  CUR_ITEM_UNLOCK ();
2277
  CUR_ITEM_UNLOCK ();
2280
  *rval = JSVAL_VOID;
2278
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2281
  return JS_TRUE;
2279
  return JS_TRUE;
2282
}
2280
}
2283
2281
Lines 2604-2626 void playlist_init (void) Link Here
2604
2602
2605
  {
2603
  {
2606
    static const se_f_def_t defs[] = {
2604
    static const se_f_def_t defs[] = {
2607
      { "playlist_show", js_playlist_show, 0, 0,
2605
      { "playlist_show", js_playlist_show, 0, JSFUN_FAST_NATIVE,
2608
	SE_GROUP_DIALOGUE, NULL, NULL },
2606
	SE_GROUP_DIALOGUE, NULL, NULL },
2609
      { "playlist_clear", js_playlist_clear, 0, 0,
2607
      { "playlist_clear", js_playlist_clear, 0, JSFUN_FAST_NATIVE,
2610
	SE_GROUP_PLAYLIST, NULL, NULL },
2608
	SE_GROUP_PLAYLIST, NULL, NULL },
2611
      { "playlist_flush", js_playlist_flush, 0, 0,
2609
      { "playlist_flush", js_playlist_flush, 0, JSFUN_FAST_NATIVE,
2612
	SE_GROUP_PLAYLIST, NULL, NULL },
2610
	SE_GROUP_PLAYLIST, NULL, NULL },
2613
      { "playlist_load", js_playlist_load, 0, 0,
2611
      { "playlist_load", js_playlist_load, 0, JSFUN_FAST_NATIVE,
2614
	SE_GROUP_PLAYLIST, N_("file"), NULL },
2612
	SE_GROUP_PLAYLIST, N_("file"), NULL },
2615
      { "playlist_add", js_playlist_add, 0, 0,
2613
      { "playlist_add", js_playlist_add, 0, JSFUN_FAST_NATIVE,
2616
	SE_GROUP_PLAYLIST, N_("MRL[, title]"), NULL },
2614
	SE_GROUP_PLAYLIST, N_("MRL[, title]"), NULL },
2617
      { "playlist_delete", js_playlist_delete, 0, 0,
2615
      { "playlist_delete", js_playlist_delete, 0, JSFUN_FAST_NATIVE,
2618
	SE_GROUP_PLAYLIST, N_("int"), NULL },
2616
	SE_GROUP_PLAYLIST, N_("int"), NULL },
2619
      { "playlist_play", js_playlist_play, 0, 0,
2617
      { "playlist_play", js_playlist_play, 0, JSFUN_FAST_NATIVE,
2620
	SE_GROUP_PLAYLIST, N_("int"), N_("playlist entry number") },
2618
	SE_GROUP_PLAYLIST, N_("int"), N_("playlist entry number") },
2621
      { "playlist_get_item", js_playlist_get_item, 0, 0,
2619
      { "playlist_get_item", js_playlist_get_item, 0, JSFUN_FAST_NATIVE,
2622
	SE_GROUP_PLAYLIST, NULL, NULL },
2620
	SE_GROUP_PLAYLIST, NULL, NULL },
2623
      { "mrl_browser_refresh", js_mrl_browser_refresh, 0, 0,
2621
      { "mrl_browser_refresh", js_mrl_browser_refresh, 0, JSFUN_FAST_NATIVE,
2624
	SE_GROUP_HIDDEN, NULL, NULL },
2622
	SE_GROUP_HIDDEN, NULL, NULL },
2625
      { NULL }
2623
      { NULL }
2626
    };
2624
    };
2627
-- gxine-0.5.905.orig/src/key_events.h
2625
++ gxine-0.5.905/src/key_events.h
Lines 52-59 void save_key_bindings (void); Link Here
52
/* returns xine event number (XINE_EVENT_*) or 0 on failure */
52
/* returns xine event number (XINE_EVENT_*) or 0 on failure */
53
int kb_xine_event_lookup (const kb_xine_event_map_t *, const char *);
53
int kb_xine_event_lookup (const kb_xine_event_map_t *, const char *);
54
54
55
JSBool js_event_generic (JSContext *, JSObject *, uintN argc, jsval *argv,
55
JSBool js_event_generic (JSContext *, uintN argc, jsval *vp, const char *func,
56
			 jsval *rval, const char *func,
57
			 const char *const *mrlprefix, ...)
56
			 const char *const *mrlprefix, ...)
58
			 __attribute__ ((sentinel));
57
			 __attribute__ ((sentinel));
59
58
60
-- gxine-0.5.905.orig/src/xml_widgets.c
59
++ gxine-0.5.905/src/xml_widgets.c
Lines 186-198 stock_toggle_cb (GtkToggleButton *button Link Here
186
    ui_set_status (UI_CURRENT_STATE);
186
    ui_set_status (UI_CURRENT_STATE);
187
}
187
}
188
188
189
#define JS_WIDGET() ((se_o_t *)JS_GetPrivate (cx, obj))->user_data
189
#define JS_WIDGET() ((se_o_t *)JS_GetPrivate (cx, JS_THIS_OBJECT (cx, vp)))->user_data
190
190
191
static JSBool
191
static JSBool
192
js_set_show (JSContext *cx, JSObject *obj,
192
js_set_show (JSContext *cx, uintN argc, jsval *vp)
193
	     uintN argc, jsval *argv, jsval *rval)
194
{
193
{
195
  int v, all = 0;
194
  int v, all = 0;
195
  jsval *argv = JS_ARGV (cx, vp);
196
  se_log_fncall ("<widget>.set_show");
196
  se_log_fncall ("<widget>.set_show");
197
  se_argc_check_range (1, 2, "<widget>.set_show");
197
  se_argc_check_range (1, 2, "<widget>.set_show");
198
  se_arg_is_int_or_bool (0, "<widget>.set_show");
198
  se_arg_is_int_or_bool (0, "<widget>.set_show");
Lines 210-237 js_set_show (JSContext *cx, JSObject *ob Link Here
210
    gtk_widget_show (JS_WIDGET ());
210
    gtk_widget_show (JS_WIDGET ());
211
  else
211
  else
212
    gtk_widget_hide (JS_WIDGET ());
212
    gtk_widget_hide (JS_WIDGET ());
213
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
213
  return JS_TRUE;
214
  return JS_TRUE;
214
}
215
}
215
216
216
static JSBool
217
static JSBool
217
js_set_sensitive (JSContext *cx, JSObject *obj,
218
js_set_sensitive (JSContext *cx, uintN argc, jsval *vp)
218
		  uintN argc, jsval *argv, jsval *rval)
219
{
219
{
220
  int v;
220
  int v;
221
  jsval *argv = JS_ARGV (cx, vp);
221
  se_log_fncall ("<widget>.set_sensitive");
222
  se_log_fncall ("<widget>.set_sensitive");
222
  se_argc_check (1, "<widget>.set_sensitive");
223
  se_argc_check (1, "<widget>.set_sensitive");
223
  se_arg_is_int_or_bool (0, "<widget>.set_sensitive");
224
  se_arg_is_int_or_bool (0, "<widget>.set_sensitive");
224
  JS_ValueToBoolean (cx, argv[0], &v);
225
  JS_ValueToBoolean (cx, argv[0], &v);
225
  gtk_widget_set_sensitive (JS_WIDGET (), v);
226
  gtk_widget_set_sensitive (JS_WIDGET (), v);
227
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
226
  return JS_TRUE;
228
  return JS_TRUE;
227
}
229
}
228
230
229
static JSBool
231
static JSBool
230
js_activate (JSContext *cx, JSObject *obj,
232
js_activate (JSContext *cx, uintN argc, jsval *vp)
231
	     uintN argc, jsval *argv, jsval *rval)
232
{
233
{
233
  se_log_fncall ("<widget>.activate");
234
  se_log_fncall ("<widget>.activate");
234
  gtk_widget_activate (JS_WIDGET ());
235
  gtk_widget_activate (JS_WIDGET ());
236
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
235
  return JS_TRUE;
237
  return JS_TRUE;
236
}
238
}
237
239
Lines 1257-1265 widget_parse (xml_node_t *node) Link Here
1257
      se_o_t *se_widget;
1259
      se_o_t *se_widget;
1258
      char *se_name, *se_dot;
1260
      char *se_name, *se_dot;
1259
      static const se_f_def_t defs[] = {
1261
      static const se_f_def_t defs[] = {
1260
	{ "set_show", js_set_show, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1262
	{ "set_show", js_set_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1261
	{ "set_sensitive", js_set_sensitive, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1263
	{ "set_sensitive", js_set_sensitive, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1262
	{ "activate", js_activate, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
1264
	{ "activate", js_activate, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
1263
	{ NULL }
1265
	{ NULL }
1264
      };
1266
      };
1265
      if (!se_widget_space)
1267
      if (!se_widget_space)
1266
-- gxine-0.5.905.orig/src/mediamarks.c
1268
++ gxine-0.5.905/src/mediamarks.c
Lines 680-709 void mm_save (void) Link Here
680
  g_free(fname);
680
  g_free(fname);
681
}
681
}
682
682
683
static JSBool js_mm_add_show (JSContext *cx, JSObject *obj, uintN argc,
683
static JSBool js_mm_add_show (JSContext *cx, uintN argc, jsval *vp)
684
			      jsval *argv, jsval *rval)
685
{
684
{
686
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
685
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
687
  se_log_fncall_checkinit ("mm_add_show");
686
  se_log_fncall_checkinit ("mm_add_show");
688
  mm_add_show (NULL);
687
  mm_add_show (NULL);
688
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
689
  return JS_TRUE;
689
  return JS_TRUE;
690
}
690
}
691
691
692
static JSBool js_mm_manage_show (JSContext *cx, JSObject *obj, uintN argc,
692
static JSBool js_mm_manage_show (JSContext *cx, uintN argc, jsval *vp)
693
				 jsval *argv, jsval *rval)
694
{
693
{
695
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
694
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
696
  se_log_fncall_checkinit ("mm_manage_show");
695
  se_log_fncall_checkinit ("mm_manage_show");
697
  mm_manage_show ();
696
  mm_manage_show ();
697
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
698
  return JS_TRUE;
698
  return JS_TRUE;
699
}
699
}
700
700
701
static JSBool js_import_mediamarks (JSContext *cx, JSObject *obj, uintN argc,
701
static JSBool js_import_mediamarks (JSContext *cx, uintN argc, jsval *vp)
702
				    jsval *argv, jsval *rval)
703
{
702
{
704
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
703
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
705
  se_log_fncall_checkinit ("import_mediamarks");
704
  se_log_fncall_checkinit ("import_mediamarks");
706
  mm_import ();
705
  mm_import ();
706
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
707
  return JS_TRUE;
707
  return JS_TRUE;
708
}
708
}
709
709
Lines 950-960 void mediamarks_init (void) Link Here
950
950
951
  {
951
  {
952
    static const se_f_def_t defs[] = {
952
    static const se_f_def_t defs[] = {
953
      { "mm_add_show", js_mm_add_show, 0, 0,
953
      { "mm_add_show", js_mm_add_show, 0, JSFUN_FAST_NATIVE,
954
	SE_GROUP_DIALOGUE, NULL, NULL },
954
	SE_GROUP_DIALOGUE, NULL, NULL },
955
      { "mm_manage_show", js_mm_manage_show, 0, 0,
955
      { "mm_manage_show", js_mm_manage_show, 0, JSFUN_FAST_NATIVE,
956
	SE_GROUP_DIALOGUE, NULL, NULL },
956
	SE_GROUP_DIALOGUE, NULL, NULL },
957
      { "import_mediamarks", js_import_mediamarks, 0, 0,
957
      { "import_mediamarks", js_import_mediamarks, 0, JSFUN_FAST_NATIVE,
958
	SE_GROUP_FILE, NULL, NULL },
958
	SE_GROUP_FILE, NULL, NULL },
959
      { NULL }
959
      { NULL }
960
    };
960
    };
961
-- gxine-0.5.905.orig/src/engine.c
961
++ gxine-0.5.905/src/engine.c
Lines 56-62 GAsyncQueue *js_queue; Link Here
56
static gboolean queue_available = FALSE;
56
static gboolean queue_available = FALSE;
57
57
58
static JSBool
58
static JSBool
59
show_about (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
59
show_about (JSContext *cx, uintN argc, jsval *vp)
60
{
60
{
61
  static const gchar *const authors[] = {
61
  static const gchar *const authors[] = {
62
    "Darren Salt <dsalt@users.sourceforge.net>",
62
    "Darren Salt <dsalt@users.sourceforge.net>",
Lines 126-132 show_about (JSContext *cx, JSObject *obj Link Here
126
  }
126
  }
127
127
128
  window_show (about, NULL);
128
  window_show (about, NULL);
129
  *rval = JSVAL_VOID;
129
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
130
  return JS_TRUE;
130
  return JS_TRUE;
131
}
131
}
132
132
Lines 184-191 int engine_exec_obj (const char *cmd, se Link Here
184
  if ((str = se_result_str (gse)))
184
  if ((str = se_result_str (gse)))
185
  {
185
  {
186
    /* JS output. Could end up in a terminal or the JS console. */
186
    /* JS output. Could end up in a terminal or the JS console. */
187
    char *free_str = str;
187
    str = g_strdup_printf (_("result: %s"), str);
188
    str = g_strdup_printf (_("result: %s"), str);
188
    cb (cb_data, "%s", str);
189
    cb (cb_data, "%s", str);
190
    free (free_str);
189
    free (str);
191
    free (str);
190
  }
192
  }
191
  else if (se_result_double (gse, &num.d))
193
  else if (se_result_double (gse, &num.d))
Lines 405-416 se_startup_response_cb (GtkWidget *widge Link Here
405
}
407
}
406
408
407
static JSBool
409
static JSBool
408
show_startup (JSContext *cx, JSObject *obj, uintN argc,
410
show_startup (JSContext *cx, uintN argc, jsval *vp)
409
	      jsval *argv, jsval *rval)
410
{
411
{
411
  if (!GTK_WIDGET_VISIBLE (se_startup_window))
412
  if (!GTK_WIDGET_VISIBLE (se_startup_window))
412
    reset_startup_buffer (se_startup_cmds);
413
    reset_startup_buffer (se_startup_cmds);
413
  window_show (se_startup_window, NULL);
414
  window_show (se_startup_window, NULL);
415
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
414
  return JS_TRUE;
416
  return JS_TRUE;
415
}
417
}
416
418
Lines 439-446 void engine_init (void) Link Here
439
  gse = se_new ();
441
  gse = se_new ();
440
442
441
  static const se_f_def_t defs[] = {
443
  static const se_f_def_t defs[] = {
442
    { "about_show", show_about, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
444
    { "about_show", show_about, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
443
    { "startup_cmds_show", show_startup, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
445
    { "startup_cmds_show", show_startup, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
444
    { NULL }
446
    { NULL }
445
  };
447
  };
446
  se_defuns (gse, gse->g, defs);
448
  se_defuns (gse, gse->g, defs);
447
-- gxine-0.5.905.orig/src/log_window.c
449
++ gxine-0.5.905/src/log_window.c
Lines 220-230 static void switch_cb (GtkNotebook *note Link Here
220
  gtk_dialog_set_response_sensitive ((GtkDialog *) win, GTK_RESPONSE_YES, !is_cp);
220
  gtk_dialog_set_response_sensitive ((GtkDialog *) win, GTK_RESPONSE_YES, !is_cp);
221
}
221
}
222
222
223
static JSBool js_log_show (JSContext *cx, JSObject *obj, uintN argc,
223
static JSBool js_log_show (JSContext *cx, uintN argc, jsval *vp)
224
			   jsval *argv, jsval *rval)
225
{
224
{
226
  se_log_fncall ("log_show");
225
  se_log_fncall ("log_show");
227
  log_window_show ();
226
  log_window_show ();
227
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
228
  return JS_TRUE;
228
  return JS_TRUE;
229
}
229
}
230
230
Lines 379-385 void log_window_init (void) Link Here
379
379
380
  /* script engine functions */
380
  /* script engine functions */
381
381
382
  se_defun (gse, NULL, "log_show", js_log_show, 0, 0,
382
  se_defun (gse, NULL, "log_show", js_log_show, 0, JSFUN_FAST_NATIVE,
383
	    SE_GROUP_DIALOGUE, NULL, NULL);
383
	    SE_GROUP_DIALOGUE, NULL, NULL);
384
}
384
}
385
385
386
-- gxine-0.5.905.orig/src/vis.c
386
++ gxine-0.5.905/src/vis.c
Lines 66-88 void vis_set (const char *str) Link Here
66
    gtk_action_activate (action->data);
66
    gtk_action_activate (action->data);
67
}
67
}
68
68
69
static JSBool js_set_vis (JSContext *cx, JSObject *obj, uintN argc,
69
static JSBool js_set_vis (JSContext *cx, uintN argc, jsval *vp)
70
			  jsval *argv, jsval *rval)
71
{
70
{
71
  jsval *argv = JS_ARGV (cx, vp);
72
  se_log_fncall ("js_set_vis");
72
  se_log_fncall ("js_set_vis");
73
  se_argc_check (1, "set_vis");
73
  se_argc_check (1, "set_vis");
74
  se_arg_is_string (0, "set_vis");
74
  se_arg_is_string (0, "set_vis");
75
75
76
  JSString *str = JS_ValueToString (cx, argv[0]);
76
  JSString *str = JS_ValueToString (cx, argv[0]);
77
  vis_set (JS_GetStringBytes (str));
77
  char *cstr = SE_JS_ENCODE_STRING (cx, str);
78
  vis_set (cstr);
79
  SE_JS_FREE_ENCODED_STRING (cx, cstr);
78
80
81
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
79
  return JS_TRUE;
82
  return JS_TRUE;
80
}
83
}
81
84
82
void vis_init (void)
85
void vis_init (void)
83
{
86
{
84
  xine_cfg_entry_t entry;
87
  xine_cfg_entry_t entry;
85
  se_defun (gse, NULL, "set_vis", js_set_vis, 0, 0,
88
  se_defun (gse, NULL, "set_vis", js_set_vis, 0, JSFUN_FAST_NATIVE,
86
	    SE_GROUP_ENGINE, N_("string"), N_("visualisation name"));
89
	    SE_GROUP_ENGINE, N_("string"), N_("visualisation name"));
87
  if (xine_config_lookup_entry (xine, "post_audio_plugin", &entry))
90
  if (xine_config_lookup_entry (xine, "post_audio_plugin", &entry))
88
    gtk_video_select_vis ((GtkVideo *)gtv, entry.str_value, &audio_port);
91
    gtk_video_select_vis ((GtkVideo *)gtv, entry.str_value, &audio_port);
89
-- gxine-0.5.905.orig/src/stream_info.c
92
++ gxine-0.5.905/src/stream_info.c
Lines 180-191 static void response_cb (GtkDialog *dbox Link Here
180
  }
180
  }
181
}
181
}
182
182
183
static JSBool js_stream_info_show (JSContext *cx, JSObject *obj, uintN argc,
183
static JSBool js_stream_info_show (JSContext *cx, uintN argc, jsval *vp)
184
				   jsval *argv, jsval *rval)
185
{
184
{
186
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
185
  /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
187
  se_log_fncall_checkinit ("stream_info_show");
186
  se_log_fncall_checkinit ("stream_info_show");
188
  stream_info_show ();
187
  stream_info_show ();
188
  JS_SET_RVAL (cx, vp, JSVAL_VOID);
189
  return JS_TRUE;
189
  return JS_TRUE;
190
}
190
}
191
191
Lines 235-240 void stream_info_init (void) Link Here
235
235
236
  is_visible = FALSE;
236
  is_visible = FALSE;
237
237
238
  se_defun (gse, NULL, "stream_info_show", js_stream_info_show, 0, 0,
238
  se_defun (gse, NULL, "stream_info_show", js_stream_info_show, 0, JSFUN_FAST_NATIVE,
239
	    SE_GROUP_DIALOGUE, N_("[bool]"), NULL);
239
	    SE_GROUP_DIALOGUE, N_("[bool]"), NULL);
240
}
240
}

Return to bug 360971