Esempio n. 1
0
void
audio_init(void)
{
  htsmsg_t *store = htsmsg_store_load("audio2");
  if(store == NULL)
    store = htsmsg_create_map();

  prop_t *asettings =
    settings_add_dir(NULL, _p("Audio settings"), NULL, NULL,
                     _p("Setup audio output"),
                     "settings:audio");

  audio_mastervol_init();
  audio_class = audio_driver_init(asettings, store);

  settings_create_separator(asettings,
			    _p("Audio settings during video playback"));

  gconf.setting_av_volume =
    setting_create(SETTING_INT, asettings,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Audio gain adjustment during video playback")),
                   SETTING_RANGE(-12, 12),
                   SETTING_UNIT_CSTR("dB"),
                   SETTING_HTSMSG("videovolume", store, "audio2"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  gconf.setting_av_sync =
    setting_create(SETTING_INT, asettings,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Audio delay")),
                   SETTING_RANGE(-5000, 5000),
                   SETTING_STEP(50),
                   SETTING_UNIT_CSTR("ms"),
                   SETTING_HTSMSG("avdelta", store, "audio2"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);


#if CONFIG_AUDIOTEST
  audio_test_init(asettings);
#endif
}
Esempio n. 2
0
static JSBool 
js_createInt(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;
  int def;
  int min;
  int max;
  int step;
  const char* unit;
  JSObject *func;
  JSBool persistent = JS_FALSE;

  if(!JS_ConvertArguments(cx, argc, argv, "ssiiiiso/b",
			  &id, &title, &def, &min, &max, &step, &unit, &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 =
    setting_create(SETTING_INT, jsg->jsg_root,
                   SETTINGS_INITIAL_UPDATE | jsg->jsg_settings_flags,

                   SETTING_TITLE_CSTR(title),
                   SETTING_VALUE(def),
                   SETTING_RANGE(min, max),
                   SETTING_STEP(step),
                   SETTING_UNIT_CSTR(unit),
                   SETTING_COURIER(js_global_pc),
                   SETTING_CALLBACK(js_store_update_int, jss),
                   SETTING_HTSMSG_CUSTOM_SAVER(id, jsg->jsg_store,
                                               js_setting_group_save, jsg),
                   NULL);
  jss->jss_cx = NULL;

  return JS_TRUE;
}
Esempio n. 3
0
static void
init_autostandby(void)
{
  setting_create(SETTING_INT, gconf.settings_general, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Automatic standby")),
                 SETTING_STORE("runcontrol", "autostandby"),
                 SETTING_WRITE_INT(&standby_delay),
                 SETTING_RANGE(0, 60),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("min"),
                 SETTING_ZERO_TEXT(_p("Off")),
                 NULL);

  last_activity = arch_get_ts();

  prop_subscribe(0,
		 PROP_TAG_NAME("global", "media", "current", "playstatus"),
		 PROP_TAG_CALLBACK_STRING, current_media_playstatus, NULL,
		 NULL);

  callout_arm(&autostandby_timer, check_autostandby, NULL, 1);
}
Esempio n. 4
0
void
video_settings_init(void)
{
  prop_t *s;

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

#if ENABLE_VDPAU
  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Enable VDPAU")),
                 SETTING_VALUE(1),
                 SETTING_WRITE_BOOL(&video_settings.vdpau),
                 SETTING_STORE("videoplayback", "vdpau"),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Preferred VDPAU deinterlacer method")),
                 SETTING_STORE("videoplayback", "vdpau_deinterlace"),
                 SETTING_WRITE_INT(&video_settings.vdpau_deinterlace),
                 SETTING_OPTION("2", _p("Temporal/Spatial")),
                 SETTING_OPTION("1", _p("Temporal")),
                 SETTING_OPTION("0", _p("Off")),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Maximum resolution for deinterlacer")),
                 SETTING_STORE("videoplayback",
                                "vdpau_deinterlace_resolution_limit"),
                 SETTING_WRITE_INT(&video_settings.
                                   vdpau_deinterlace_resolution_limit),
                 SETTING_OPTION     ("0", _p("No limit")),
                 SETTING_OPTION_CSTR("576",  "576"),
                 SETTING_OPTION_CSTR("720",  "720"),
                 SETTING_OPTION_CSTR("1080", "1080"),
                 NULL);
#endif

#if defined(__APPLE__) || defined(__ANDROID__)
  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Hardware accelerated decoding")),
                 SETTING_STORE("videoplayback", "videoaccel"),
#if defined(__APPLE__)
                 SETTING_VALUE(1),
#else
                 SETTING_VALUE(0),
#endif
                 SETTING_WRITE_BOOL(&video_settings.video_accel),
                 NULL);
#endif

  video_settings.vzoom_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Video zoom")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(50, 200),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "vzoom"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.pan_horizontal_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal pan")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(-100, 100),
                   SETTING_VALUE(0),
                   SETTING_STORE("videoplayback", "horizontalpan"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.pan_vertical_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical pan")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(-100, 100),
                   SETTING_VALUE(0),
                   SETTING_STORE("videoplayback", "verticalpan"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.scale_horizontal_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal scale")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(10, 300),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "horizontalscale"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.scale_vertical_setting =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical scale")),
                   SETTING_UNIT_CSTR("%"),
                   SETTING_RANGE(10, 300),
                   SETTING_VALUE(100),
                   SETTING_STORE("videoplayback", "verticalscale"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.stretch_horizontal_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Stretch video to widescreen")),
                   SETTING_STORE("videoplayback", "stretch_horizontal"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.stretch_fullscreen_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Stretch video to fullscreen")),
                   SETTING_STORE("videoplayback", "stretch_fullscreen"),
                   SETTING_VALUE_ORIGIN("global"),
                   NULL);

  video_settings.vinterpolate_setting =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Video frame interpolation")),
                   SETTING_STORE("videoplayback", "vinterpolate"),
                   SETTING_VALUE_ORIGIN("global"),
                   SETTING_VALUE(1),
                   NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Resume video playback")),
                 SETTING_WRITE_INT(&video_settings.resume_mode),
                 SETTING_STORE("videoplayback", "resumemode"),
                 SETTING_OPTION("2", _p("Ask")),
                 SETTING_OPTION("1", _p("Always")),
                 SETTING_OPTION("0", _p("Never")),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Count video as played when reaching")),
                 SETTING_VALUE(90),
                 SETTING_RANGE(1, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_WRITE_INT(&video_settings.played_threshold),
                 SETTING_STORE("videoplayback", "played_threshold"),
                 NULL);

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Automatically play next video in list")),
                 SETTING_STORE("videoplayback", "continuous_playback"),
                 SETTING_WRITE_BOOL(&video_settings.continuous_playback),
                 NULL);

  setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Up / Down during video playback controls")),
                 SETTING_WRITE_INT(&video_settings.dpad_up_down_mode),
                 SETTING_STORE("videoplayback", "dpad_up_down_mode"),
                 SETTING_OPTION("0", _p("Master volume")),
                 SETTING_OPTION("1", _p("Per-file volume")),
                 NULL);



  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Show clock during playback")),
                 SETTING_STORE("videoplayback", "show_clock"),
                 SETTING_WRITE_PROP(prop_create(prop_create(prop_get_global(),
                                                            "clock"),
                                                "showDuringVideo")),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Step when seeking backward")),
                 SETTING_VALUE(15),
                 SETTING_RANGE(3, 60),
                 SETTING_UNIT_CSTR("s"),
                 SETTING_WRITE_INT(&video_settings.seek_back_step),
                 SETTING_STORE("videoplayback", "seekbackstep"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Step when seeking forward")),
                 SETTING_VALUE(30),
                 SETTING_RANGE(3, 60),
                 SETTING_UNIT_CSTR("s"),
                 SETTING_WRITE_INT(&video_settings.seek_fwd_step),
                 SETTING_STORE("videoplayback", "seekfwdstep"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Video buffer size")),
                 SETTING_VALUE(48),
                 SETTING_RANGE(16, gconf.max_video_buffer_size ?: 128),
                 SETTING_UNIT_CSTR("MB"),
                 SETTING_STORE("videoplayback", "videobuffersize"),
                 SETTING_WRITE_INT(&video_settings.video_buffer_size),
                 NULL);
}
Esempio n. 5
0
void
glw_settings_init(void)
{
  glw_settings.gs_settings_store = htsmsg_store_load("glw");

  if(glw_settings.gs_settings_store == NULL)
    glw_settings.gs_settings_store = htsmsg_create_map();


  glw_settings.gs_settings = prop_create_root(NULL);
  prop_concat_add_source(gconf.settings_look_and_feel,
			 prop_create(glw_settings.gs_settings, "nodes"),
			 NULL);

  prop_t *s = glw_settings.gs_settings;
  htsmsg_t *store = glw_settings.gs_settings_store;

  glw_settings.gs_setting_size =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Font and icon size")),
                   SETTING_RANGE(-10, 30),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_size),
                   SETTING_HTSMSG("size", store, "glw"),
                   NULL);

  glw_settings.gs_setting_underscan_h =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Horizontal underscan")),
                   SETTING_RANGE(-100, 100),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_underscan_h),
                   SETTING_HTSMSG("underscan_h", store, "glw"),
                   NULL);

  glw_settings.gs_setting_underscan_v =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Vertical underscan")),
                   SETTING_RANGE(-100, 100),
                   SETTING_UNIT_CSTR("px"),
                   SETTING_WRITE_INT(&glw_settings.gs_underscan_v),
                   SETTING_HTSMSG("underscan_v", store, "glw"),
                   NULL);

  glw_settings.gs_setting_screensaver =
    setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Screensaver delay")),
                   SETTING_VALUE(10),
                   SETTING_RANGE(0, 60),
		   SETTING_ZERO_TEXT(_p("Off")),
                   SETTING_UNIT_CSTR("min"),
                   SETTING_WRITE_INT(&glw_settings.gs_screensaver_delay),
                   SETTING_HTSMSG("screensaver", store, "glw"),
                   NULL);

  glw_settings.gs_setting_wrap =
    setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                   SETTING_TITLE(_p("Wrap when reaching beginning/end of lists")),
                   SETTING_VALUE(1),
                   SETTING_WRITE_BOOL(&glw_settings.gs_wrap),
                   SETTING_HTSMSG("wrap", store, "glw"),
                   NULL);

  prop_t *p = prop_create(prop_get_global(), "glw");
  p = prop_create(p, "osk");
  kv_prop_bind_create(p, "showtime:glw:osk");
}
Esempio n. 6
0
void
mp_settings_init(media_pipe_t *mp, const char *url, const char *dir_url,
                 const char *parent_title)
{
  setting_t *p;
  prop_t *c = mp->mp_prop_ctrl;
  char set_directory_title[256];
  char clr_directory_title[256];

  mp_settings_clear(mp);

  if(url == NULL || !(mp->mp_flags & MP_VIDEO))
    return;

  TRACE(TRACE_DEBUG, "media",
        "Settings initialized for URL %s in folder: %s [%s]",
        url, parent_title ?: "<unset>", dir_url ?: "<unset>");

  if(dir_url != NULL) {
    rstr_t *fmt;

    fmt = _("Save as defaults for folder '%s'");
    snprintf(set_directory_title, sizeof(set_directory_title), rstr_get(fmt),
             parent_title);
    rstr_release(fmt);

    fmt = _("Reset defaults for folder '%s'");
    snprintf(clr_directory_title, sizeof(clr_directory_title), rstr_get(fmt),
             parent_title);
    rstr_release(fmt);
  }

  // --- Video -------------------------------------------------

  p = make_dir_setting(SETTING_INT, "vzoom", &mp->mp_settings_video_dir,
                       dir_url, video_settings.vzoom_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Video zoom")),
                 SETTING_RANGE(50, 200),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "vzoom")),
                 SETTING_KVSTORE(url, "vzoom"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "panhorizontal", &mp->mp_settings_video_dir,
                       dir_url, video_settings.pan_horizontal_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Horizontal pan")),
                 SETTING_RANGE(-100, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "panhorizontal")),
                 SETTING_KVSTORE(url, "panhorizontal"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "panvertical", &mp->mp_settings_video_dir,
                       dir_url, video_settings.pan_vertical_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Vertical pan")),
                 SETTING_RANGE(-100, 100),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_WRITE_PROP(prop_create(c, "panvertical")),
                 SETTING_KVSTORE(url, "panvertical"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "hstretch", &mp->mp_settings_video_dir,
                       dir_url, video_settings.stretch_horizontal_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Stretch video to widescreen")),
                 SETTING_WRITE_PROP(prop_create(c, "hstretch")),
                 SETTING_KVSTORE(url, "hstretch"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "fstretch", &mp->mp_settings_video_dir,
                       dir_url, video_settings.stretch_fullscreen_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Stretch video to fullscreen")),
                 SETTING_WRITE_PROP(prop_create(c, "fstretch")),
                 SETTING_KVSTORE(url, "fstretch"),
                 SETTING_GROUP(&mp->mp_settings_video),
                 SETTING_INHERIT(p),
                 NULL);

  if(video_settings.vinterpolate_setting != NULL) {
    p = make_dir_setting(SETTING_BOOL, "vinterpolate",
                         &mp->mp_settings_video_dir,
                         dir_url, video_settings.vinterpolate_setting, mp);

    setting_create(SETTING_BOOL, mp->mp_setting_video_root,
                   SETTINGS_INITIAL_UPDATE,
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_TITLE(_p("Video frame interpolation")),
                   SETTING_WRITE_PROP(prop_create(c, "vinterpolate")),
                   SETTING_KVSTORE(url, "vinterpolate"),
                   SETTING_GROUP(&mp->mp_settings_video),
                   SETTING_INHERIT(p),
                   NULL);
  }

  setting_create(SETTING_SEPARATOR, mp->mp_setting_video_root, 0,
                 SETTING_GROUP(&mp->mp_settings_video),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_video_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_video),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_video_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_video),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_video_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_video_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_video),
                   NULL);
  }

  // --- Audio ---------------------------------------------


  p = make_dir_setting(SETTING_INT, "audiovolume", &mp->mp_settings_audio_dir,
                       dir_url, gconf.setting_av_volume, mp);

  mp->mp_vol_setting =
  setting_create(SETTING_INT, mp->mp_setting_audio_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Audio volume")),
                 SETTING_RANGE(-12, MAX_USER_AUDIO_GAIN),
                 SETTING_UNIT_CSTR("dB"),
                 SETTING_CALLBACK(update_audio_volume_user, mp),
                 SETTING_WRITE_PROP(prop_create(c, "audiovolume")),
                 SETTING_KVSTORE(url, "audiovolume"),
                 SETTING_PROP_ENABLER(prop_create(c, "canAdjustVolume")),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "avdelta", &mp->mp_settings_audio_dir,
                       dir_url, gconf.setting_av_sync, mp);

  setting_create(SETTING_INT, mp->mp_setting_audio_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Audio delay")),
                 SETTING_RANGE(-5000, 5000),
                 SETTING_STEP(50),
                 SETTING_UNIT_CSTR("ms"),
                 SETTING_CALLBACK(update_av_delta, mp),
                 SETTING_WRITE_PROP(prop_create(c, "avdelta")),
                 SETTING_KVSTORE(url, "avdelta"),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 SETTING_INHERIT(p),
                 NULL);

  setting_create(SETTING_SEPARATOR, mp->mp_setting_audio_root, 0,
                 SETTING_GROUP(&mp->mp_settings_audio),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_audio_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_audio),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_audio_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_audio),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_audio_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_audio_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_audio),
                   NULL);
  }


  // --- Subtitle ------------------------------------------

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Subtitle delay")),
                 SETTING_RANGE(-600000, 600000),
                 SETTING_STEP(500),
                 SETTING_UNIT_CSTR("ms"),
                 SETTING_CALLBACK(update_sv_delta, mp),
                 SETTING_WRITE_PROP(prop_create(c, "svdelta")),
                 SETTING_KVSTORE(url, "svdelta"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subscale", &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.scaling_setting, mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Subtitle scaling")),
                 SETTING_RANGE(30, 500),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_WRITE_PROP(prop_create(c, "subscale")),
                 SETTING_KVSTORE(url, "subscale"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_BOOL, "subalign", &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.align_on_video_setting, mp);

  setting_create(SETTING_BOOL, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_TITLE(_p("Align subtitles on video frame")),
                 SETTING_WRITE_PROP(prop_create(c, "subalign")),
                 SETTING_KVSTORE(url, "subalign"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subvdisplace",
                       &mp->mp_settings_subtitle_dir,
                       dir_url, subtitle_settings.vertical_displacement_setting,
                       mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_RANGE(-300, 300),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("px"),
                 SETTING_TITLE(_p("Subtitle vertical displacement")),
                 SETTING_WRITE_PROP(prop_create(c, "subvdisplace")),
                 SETTING_KVSTORE(url, "subvdisplace"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  p = make_dir_setting(SETTING_INT, "subhdisplace", 
                       &mp->mp_settings_subtitle_dir,
                       dir_url,
                       subtitle_settings.horizontal_displacement_setting,
                       mp);

  setting_create(SETTING_INT, mp->mp_setting_subtitle_root,
                 SETTINGS_INITIAL_UPDATE,
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_RANGE(-300, 300),
                 SETTING_STEP(5),
                 SETTING_UNIT_CSTR("px"),
                 SETTING_TITLE(_p("Subtitle horizontal displacement")),
                 SETTING_WRITE_PROP(prop_create(c, "subhdisplace")),
                 SETTING_KVSTORE(url, "subhdisplace"),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 SETTING_INHERIT(p),
                 NULL);

  setting_create(SETTING_SEPARATOR, mp->mp_setting_subtitle_root, 0,
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                 SETTING_TITLE(_p("Save as global default")),
                 SETTING_MUTEX(mp),
                 SETTING_LOCKMGR(mp_lockmgr),
                 SETTING_CALLBACK(set_subtitle_global_defaults, mp),
                 SETTING_GROUP(&mp->mp_settings_subtitle),
                 NULL);

  if(dir_url != NULL) {
    setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                   SETTING_TITLE_CSTR(set_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(set_subtitle_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_subtitle),
                   NULL);

    setting_create(SETTING_ACTION, mp->mp_setting_subtitle_root, 0,
                   SETTING_TITLE_CSTR(clr_directory_title),
                   SETTING_MUTEX(mp),
                   SETTING_LOCKMGR(mp_lockmgr),
                   SETTING_CALLBACK(clr_subtitle_directory_defaults, mp),
                   SETTING_GROUP(&mp->mp_settings_subtitle),
                   NULL);
  }

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


  if(gconf.can_standby) {
      setting_create(SETTING_BOOL, mp->mp_setting_root,
                     SETTINGS_INITIAL_UPDATE,
                     SETTING_MUTEX(mp),
                     SETTING_LOCKMGR(mp_lockmgr),
                     SETTING_WRITE_INT(&mp->mp_auto_standby),
                     SETTING_TITLE(_p("Go to standby after video ends")),
                     SETTING_GROUP(&mp->mp_settings_other),
                     NULL);
  }
}
Esempio n. 7
0
void
torrent_settings_init(void)
{
  prop_t *dir = setting_get_dir("general:filebrowse");
  prop_t *s = settings_add_dir(dir, _p("BitTorrent"),
                               NULL, NULL, NULL, "settings:bittorrent");

  char defpath[1024];
  int freespace = 10;

#ifdef STOS
  freespace = 75;
#endif

  snprintf(defpath, sizeof(defpath), "%s/bittorrentcache", gconf.cache_path);

  setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Enable bittorrent")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_WRITE_BOOL(&btg.btg_enabled),
                 SETTING_VALUE(1),
                 SETTING_STORE("bittorrent", "enable"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Max upload speed")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_upload_speed, NULL),
                 SETTING_VALUE(5),
                 SETTING_RANGE(0, 100),
                 SETTING_UNIT_CSTR("Mbit/s"),
                 SETTING_STORE("bittorrent", "uploadspeed"),
                 NULL);

  setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE,
                 SETTING_TITLE(_p("Max usage of free space for caching torrents")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_free_percentage, NULL),
                 SETTING_VALUE(freespace),
                 SETTING_RANGE(1, 90),
                 SETTING_UNIT_CSTR("%"),
                 SETTING_STORE("bittorrent", "freepercentage"),
                 NULL);

  setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE | SETTINGS_DIR,
                 SETTING_TITLE(_p("Torrent cache path")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(set_torrent_cache_path, NULL),
                 SETTING_VALUE(defpath),
                 SETTING_STORE("bittorrent", "path"),
                 NULL);

  setting_create(SETTING_ACTION, s, 0,
                 SETTING_TITLE(_p("Clear cache")),
                 SETTING_MUTEX(&bittorrent_mutex),
                 SETTING_CALLBACK(torrent_diskio_cache_clear, NULL),
                 NULL);


  settings_create_separator(s, _p("Status"));

  btg.btg_torrent_status = prop_create_root(NULL);
  settings_create_info(s, NULL, btg.btg_torrent_status);

  btg.btg_disk_status = prop_create_root(NULL);
  settings_create_info(s, NULL, btg.btg_disk_status);

  allow_update = 1;
  torrent_diskio_scan(0);
}