Ejemplo n.º 1
0
static JSBool 
js_createBool(JSContext *cx, JSObject *obj, uintN argc, 
	      jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  JSBool def;
  JSBool persistent = JS_FALSE;
  JSObject *func;

  if(!JS_ConvertArguments(cx, argc, argv, "ssbo/b",
			  &id, &title, &def, &func, &persistent))
    return JS_FALSE;

  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, persistent);
  if(jss == NULL)
    return JS_FALSE;

  if(persistent && jsg->jsg_kv_url)
    def = kv_url_opt_get_int(jsg->jsg_kv_url, KVSTORE_DOMAIN_PLUGIN, 
			     id, def);

  jss->jss_s =
    settings_create_bool(jsg->jsg_root, id, _p(title),
			 def, jsg->jsg_store,
			 js_store_update_bool, jss,
			 SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,
			 js_global_pc,
			 js_setting_group_save, jsg);
  jss->jss_cx = NULL;

  return JS_TRUE;
}
Ejemplo n.º 2
0
void
opensub_init(void)
{
  prop_t *s;
  hts_mutex_init(&opensub_mutex);

  s = subtitle_settings_dir;

  settings_create_divider(s, _p("Settings for opensubtitles.org"));

  htsmsg_t *store = htsmsg_store_load("opensubtitles");
  if(store == NULL)
    store = htsmsg_create_map();

  settings_create_bool(s, "enable", _p("Use opensubtitles.org"), 0, 
		       store, set_enable, NULL,
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings,
		       (void *)"opensubtitles");

  settings_create_string(s, "username", _p("Username"), NULL, 
			 store, set_username, NULL,
			 SETTINGS_INITIAL_UPDATE,  NULL,
			 settings_generic_save_settings, 
			 (void *)"opensubtitles");

  settings_create_string(s, "password", _p("Password"), NULL, 
			 store, set_password, NULL, 
			 SETTINGS_INITIAL_UPDATE | SETTINGS_PASSWORD, NULL,
			 settings_generic_save_settings,
			 (void *)"opensubtitles");
}
Ejemplo n.º 3
0
static JSBool 
js_createBool(JSContext *cx, JSObject *obj, uintN argc, 
	      jsval *argv, jsval *rval)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *id;
  const char *title;
  JSBool def;
  JSObject *func;

  if(!JS_ConvertArguments(cx, argc, argv, "ssbo",
			  &id, &title, &def, &func))
    return JS_FALSE;

  js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg);
  if(jss == NULL)
    return JS_FALSE;

  jss->jss_s = settings_create_bool(jsg->jsg_root, id, _p(title),
				    def, jsg->jsg_store,
				    js_store_update_bool, jss,
				    SETTINGS_INITIAL_UPDATE, js_global_pc,
				    js_setting_group_save, jsg);
  jss->jss_cx = NULL;

  return JS_TRUE;
}
Ejemplo n.º 4
0
void
audio_mode_register(audio_mode_t *am)
{
  prop_t *r;
  htsmsg_t *m;

  TAILQ_INSERT_TAIL(&audio_modes, am, am_link);

  settings_multiopt_add_opt_cstr(audio_settings_current_device,
				 am->am_id, am->am_title,
				 0);
 
  m = htsmsg_store_load("audio/devices/%s", am->am_id);

  r = settings_add_dir_cstr(audio_settings_root, am->am_title, "sound", NULL,
			    am->am_description, NULL);

  settings_create_int(r, "delay", _p("Audio/Video sync delay"),
		      0, m, -1000, 1000, 10, am_set_av_sync, am,
		      SETTINGS_INITIAL_UPDATE, "ms", NULL, NULL, NULL);

  if(am->am_multich_controls) {
    settings_create_bool(r, "phantom_center", _p("Phantom center"),
			 0, m, am_set_phantom_center, am,
			 SETTINGS_INITIAL_UPDATE, NULL, NULL, NULL);
    settings_create_bool(r, "phantom_lfe", _p("Phantom LFE"),
			 0, m, am_set_phantom_lfe, am,
			 SETTINGS_INITIAL_UPDATE, NULL, NULL, NULL);
    settings_create_bool(r, "small_front", _p("Small front speakers"),
			 0, m, am_set_small_front, am,
			 SETTINGS_INITIAL_UPDATE, NULL, NULL, NULL);
    settings_create_bool(r, "force_downmix", _p("Force stereo downmix"),
			 0, m, am_set_force_downmix, am,
			 SETTINGS_INITIAL_UPDATE, NULL, NULL, NULL);
    settings_create_bool(r, "swap_surround",
			 _p("Swap LFE+center with surround"),
			 0, m, am_set_swap_surround, am,
			 SETTINGS_INITIAL_UPDATE, NULL, NULL, NULL);
  }

  if(m != NULL)
    htsmsg_destroy(m);
}
Ejemplo n.º 5
0
static void
init_dev_settings(void)
{
  htsmsg_t *store;

  if((store = htsmsg_store_load("dev")) == NULL)
    store = htsmsg_create_map();

  settings_dev = settings_add_dir(prop_create_root(NULL),
				  _p("Developer settings"), NULL, NULL,
				  _p("Settings useful for developers"),
				  "settings:dev");

  prop_t *r = setting_add(settings_dev, NULL, "info", 0);
  prop_set_string(prop_create(r, "description"),
		  "Settings for developers. If you don't know what this is, don't touch it");


  prop_t *t;
  
  t = prop_create_root(NULL);
  prop_set_string(t, "Enable binrelpace");

  settings_create_bool(settings_dev, "binreplace", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_bin_replace, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Enable omnigrade");

  settings_create_bool(settings_dev, "omnigrade", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_omnigrade, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


}
Ejemplo n.º 6
0
static void
sd_add_service(service_instance_t *si, const char *title,
	       const char *url, const char *contents,
	       int probe, const char *description)
{
  si->si_probe = probe;
  if(si->si_settings == NULL) {
    char tmp[100];

    si->si_url = strdup(url);
    
    snprintf(tmp, sizeof(tmp), "sd/%s", url);
    remove_bad_chars(tmp+3);

    si->si_settings_path = strdup(tmp);
    si->si_settings_store = htsmsg_store_load(tmp) ?: htsmsg_create_map();

    si->si_settings = settings_add_dir_cstr(gconf.settings_sd,
					    title, NULL, NULL,
					    description, NULL);
    
    si->si_setting_enabled = 
      settings_create_bool(si->si_settings, "enabled", _p("Enabled"), 1,
			   si->si_settings_store, NULL, NULL,
			   SETTINGS_INITIAL_UPDATE, NULL,
			   sd_settings_saver, si);

    si->si_setting_title = 
      settings_create_string(si->si_settings, "title", _p("Name"), title,
			     si->si_settings_store, NULL, NULL,
			     SETTINGS_INITIAL_UPDATE, NULL,
			     sd_settings_saver, si);

    si->si_setting_type = 
      settings_create_string(si->si_settings, "type", _p("Type"), contents,
			     si->si_settings_store, NULL, NULL,
			     SETTINGS_INITIAL_UPDATE, NULL,
			     sd_settings_saver, si);
  }
Ejemplo n.º 7
0
static void
init_dev_settings(void)
{
  htsmsg_t *store;

  if((store = htsmsg_store_load("dev")) == NULL)
    store = htsmsg_create_map();

  gconf.settings_dev = settings_add_dir(prop_create_root(NULL),
				  _p("Developer settings"), NULL, NULL,
				  _p("Settings useful for developers"),
				  "settings:dev");

  prop_t *r = setting_add(gconf.settings_dev, NULL, "info", 0);
  prop_set_string(prop_create(r, "description"),
		  "Settings for developers. If you don't know what this is, don't touch it");


  prop_t *t;
  
  t = prop_create_root(NULL);
  prop_set_string(t, "Experimental features (Use at own risk)");

  settings_create_bool(gconf.settings_dev, "experimental", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_experimental, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


  t = prop_create_root(NULL);
  prop_set_string(t, "Enable binrelpace");

  settings_create_bool(gconf.settings_dev, "binreplace", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_bin_replace, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Enable omnigrade");

  settings_create_bool(gconf.settings_dev, "omnigrade", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_omnigrade, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


  t = prop_create_root(NULL);
  prop_set_string(t, "Debug all HTTP requests");

  settings_create_bool(gconf.settings_dev, "httpdebug", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_http_debug, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Disable HTTP connection reuse");

  settings_create_bool(gconf.settings_dev, "nohttpreuse", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.disable_http_reuse, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


}
Ejemplo n.º 8
0
void
video_settings_init(void)
{
  htsmsg_t *store;
  prop_t *s;
  setting_t *x;

  s = settings_add_dir(NULL, _p("Video playback"), "video", NULL,
		       _p("Video acceleration and display behaviour"),
		       NULL);

  if((store = htsmsg_store_load("videoplayback")) == NULL)
    store = htsmsg_create_map();
#if ENABLE_VDPAU 
  settings_create_bool(s, "vdpau", _p("Enable VDPAU"), 1,
		       store, set_vdpau, NULL, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"videoplayback");

  x = settings_create_multiopt(s, "vdpau_deinterlace",
			       _p("Preferred VDPAU deinterlacer method"), 0);

  settings_multiopt_add_opt(x, "2", _p("Temporal/Spatial"), 1);
  settings_multiopt_add_opt(x, "1", _p("Temporal"), 0);
  settings_multiopt_add_opt(x, "0", _p("Off"), 0);

  settings_multiopt_initiate(x, set_vdpau_deinterlace, NULL, NULL, 
			     store, settings_generic_save_settings,
                             (void *)"videoplayback");

  x = settings_create_multiopt(s, "vdpau_deinterlace_resolution_limit",
			       _p("Maximum resolution for deinterlacer"), 0);
  settings_multiopt_add_opt(x, "576", _p("576"), 0);
  settings_multiopt_add_opt(x, "720", _p("720"), 0);
  settings_multiopt_add_opt(x, "1080", _p("1080"), 0);
  settings_multiopt_add_opt(x, "0", _p("No limit"), 1);

  settings_multiopt_initiate(x, set_vdpau_deinterlace_resolution_limit, NULL, NULL, 
			     store, settings_generic_save_settings,
                             (void *)"videoplayback");

#endif

#if ENABLE_VDA
  settings_create_bool(s, "vda", _p("Enable VDA"), 1,
		       store, set_vda, NULL, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"videoplayback");
#endif

  settings_create_bool(s, "stretch_horizontal",
		       _p("Stretch video to widescreen"), 0,
		       store, set_stretch_horizontal, NULL, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"videoplayback");

  settings_create_bool(s, "stretch_fullscreen",
		       _p("Stretch video to fullscreen"), 0,
		       store, set_stretch_fullscreen, NULL, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"videoplayback");

  settings_create_int(s, "vzoom",
		      _p("Video zoom"), 100, store, 50, 200,
		      1, set_vzoom, NULL,
		      SETTINGS_INITIAL_UPDATE,
		      "%", NULL,
		      settings_generic_save_settings, 
		      (void *)"videoplayback");
  
  video_settings.resume_mode = 1;
  x = settings_create_multiopt(s, "resumemode",
			       _p("Resume video playback"), 0);

  settings_multiopt_add_opt(x, "1", _p("Yes"), 1);
  settings_multiopt_add_opt(x, "0", _p("No"), 0);

  settings_multiopt_initiate(x, set_video_resumemode, NULL, NULL,
			     store, settings_generic_save_settings, 
			     (void *)"videoplayback");

  settings_create_int(s, "played_threshold",
		      _p("Count video as played when reaching"),
		      90, store, 1, 100,
		      1, set_played_threshold, NULL,
		      SETTINGS_INITIAL_UPDATE,
		      "%", NULL,
		      settings_generic_save_settings, 
		      (void *)"videoplayback");

  settings_create_bool(s, "continuous_playback",
		       _p("Automatically play next video in list"), 0,
		       store, set_continuous_playback, NULL, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"videoplayback");


  //----------------------------------------------------------

  s = settings_add_dir(NULL, _p("Subtitles"), "subtitle", NULL,
		       _p("Generic settings for video subtitles"),
		       NULL);
  subtitle_settings_dir = s;

  if((store = htsmsg_store_load("subtitles")) == NULL)
    store = htsmsg_create_map();

  settings_create_bool(s, "allsubsindir",
		       _p("Include all subtitle files from movie directory"), 0, 
		       store, set_subtitle_include_all_subs, NULL,
		       SETTINGS_INITIAL_UPDATE,  NULL,
		       settings_generic_save_settings, 
		       (void *)"subtitles");

  settings_create_bool(s, "alwaysselect",
		       _p("Always try to select a subtitle"), 1, 
		       store, set_subtitle_always_select, NULL,
		       SETTINGS_INITIAL_UPDATE,  NULL,
		       settings_generic_save_settings, 
		       (void *)"subtitles");

  settings_create_divider(s, _p("Subtitle size and positioning"));

  settings_create_int(s, "scale", _p("Subtitle size"),
		      100, store, 30, 500, 5, set_subtitle_scale, NULL,
		      SETTINGS_INITIAL_UPDATE, "%", NULL,
		      settings_generic_save_settings, 
		      (void *)"subtitles");

  settings_create_bool(s, "subonvideoframe",
		       _p("Force subtitles to reside on video frame"), 0, 
		       store, set_subtitle_align_on_video, NULL,
		       SETTINGS_INITIAL_UPDATE,  NULL,
		       settings_generic_save_settings, 
		       (void *)"subtitles");

  x = settings_create_multiopt(s, "align", _p("Subtitle position"), 0);
			       

  settings_multiopt_add_opt(x, "2", _p("Center"), 1);
  settings_multiopt_add_opt(x, "1", _p("Left"), 0);
  settings_multiopt_add_opt(x, "3", _p("Right"), 0);
  settings_multiopt_add_opt(x, "0", _p("Auto"), 0);

  settings_multiopt_initiate(x,set_subtitle_alignment, NULL, NULL,
			     store, settings_generic_save_settings, 
			     (void *)"subtitles");

  settings_create_divider(s, _p("Subtitle styling"));

  settings_create_string(s, "color", _p("Color"), "FFFFFF", 
			 store, set_subtitle_color, NULL,
			 SETTINGS_INITIAL_UPDATE,  NULL,
			 settings_generic_save_settings, 
			 (void *)"subtitles");

  settings_create_string(s, "shadowcolor", _p("Shadow color"),
			 "000000", 
			 store, set_subtitle_shadow_color, NULL,
			 SETTINGS_INITIAL_UPDATE,  NULL,
			 settings_generic_save_settings, 
			 (void *)"subtitles");

  settings_create_int(s, "shadowcolorsize", _p("Shadow offset"),
		      2, store, 0, 10, 1, set_subtitle_shadow_size, NULL,
		      SETTINGS_INITIAL_UPDATE, "px", NULL,
		      settings_generic_save_settings, 
		      (void *)"subtitles");

  settings_create_string(s, "outlinecolor", _p("Outline color"),
			 "000000", 
			 store, set_subtitle_outline_color, NULL,
			 SETTINGS_INITIAL_UPDATE,  NULL,
			 settings_generic_save_settings, 
			 (void *)"subtitles");

  settings_create_int(s, "shadowoutlinesize", _p("Outline size"),
		      1, store, 0, 4, 1, set_subtitle_outline_size, NULL,
		      SETTINGS_INITIAL_UPDATE, "px", NULL,
		      settings_generic_save_settings, 
		      (void *)"subtitles");

  settings_create_bool(s, "styleoverride",
		       _p("Ignore embedded styling"), 0, 
		       store, set_subtitle_style_override, NULL,
		       SETTINGS_INITIAL_UPDATE,  NULL,
		       settings_generic_save_settings, 
		       (void *)"subtitles");
}