Пример #1
0
htsmsg_t *
tvh_input_stream_create_msg
  ( tvh_input_stream_t *st )
{
  htsmsg_t *m = htsmsg_create_map();
  htsmsg_add_str(m, "uuid", st->uuid);
  if (st->input_name)
    htsmsg_add_str(m, "input",  st->input_name);
  if (st->stream_name)
    htsmsg_add_str(m, "stream", st->stream_name);
  htsmsg_add_u32(m, "subs", st->subs_count);
  htsmsg_add_u32(m, "weight", st->max_weight);
  htsmsg_add_s32(m, "signal", st->stats.signal);
  htsmsg_add_u32(m, "signal_scale", st->stats.signal_scale);
  htsmsg_add_u32(m, "ber", st->stats.ber);
  htsmsg_add_s32(m, "snr", st->stats.snr);
  htsmsg_add_u32(m, "snr_scale", st->stats.snr_scale);
  htsmsg_add_u32(m, "unc", st->stats.unc);
  htsmsg_add_u32(m, "bps", st->stats.bps);
  htsmsg_add_u32(m, "te", st->stats.te);
  htsmsg_add_u32(m, "cc", st->stats.cc);
  htsmsg_add_u32(m, "ec_bit", st->stats.ec_bit);
  htsmsg_add_u32(m, "tc_bit", st->stats.tc_bit);
  htsmsg_add_u32(m, "ec_block", st->stats.ec_block);
  htsmsg_add_u32(m, "tc_block", st->stats.tc_block);
  return m;
}
Пример #2
0
static JSBool
jsg_set_prop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *name;

  if(jsg->jsg_frozen)
    return JS_TRUE;

  name = JSVAL_IS_STRING(id) ? JS_GetStringBytes(JSVAL_TO_STRING(id)) : NULL;
  if(name != NULL) {
    jsval v = *vp;
    
    if(JSVAL_IS_INT(v)) {
      htsmsg_delete_field(jsg->jsg_store, name);
      htsmsg_add_s32(jsg->jsg_store, name, JSVAL_TO_INT(v));
    } else if(JSVAL_IS_DOUBLE(v)) {
      double d;
      if(JS_ValueToNumber(cx, v, &d)) {
	htsmsg_delete_field(jsg->jsg_store, name);
	htsmsg_add_dbl(jsg->jsg_store, name, d);
      }
    } else if(JSVAL_IS_STRING(v)) {
      htsmsg_delete_field(jsg->jsg_store, name);
      htsmsg_add_str(jsg->jsg_store, name, 
		     JS_GetStringBytes(JS_ValueToString(cx, v)));
    } else {
      return JS_TRUE;
    }
    htsmsg_store_save(jsg->jsg_store, jsg->jsg_spath);
  }
  return JS_TRUE;
}
Пример #3
0
static void
save_matervol(void *opaque, float value)
{
  htsmsg_t *m = htsmsg_create_map();
  TRACE(TRACE_DEBUG, "audio", "Master volume set to %f dB", value);

  htsmsg_add_s32(m, "master-volume", value * 1000);
  htsmsg_store_save(m, "audiomixer");
  htsmsg_destroy(m);
}
Пример #4
0
static void
save_matervol(void *opaque, float value)
{
  audio_master_volume = pow(10, (value / 20));

  htsmsg_t *m = htsmsg_create_map();
  TRACE(TRACE_DEBUG, "audio", "Master volume set to %f dB", value);

  htsmsg_add_s32(m, "master-volume", value * 1000);
  htsmsg_store_save(m, "audiomixer");
  htsmsg_release(m);
}
Пример #5
0
static void
settings_int_callback(void *opaque, int v)
{
  setting_t *s = opaque;
  prop_callback_int_t *cb = s->s_callback;

  if(cb) cb(s->s_opaque, v);

  if(s->s_store && s->s_saver) {
    htsmsg_delete_field(s->s_store, s->s_id);
    htsmsg_add_s32(s->s_store, s->s_id, v);
    s->s_saver(s->s_saver_opaque, s->s_store);
  }
}
Пример #6
0
static void
audio_mode_save_settings(audio_mode_t *am)
{
  htsmsg_t *m = htsmsg_create_map();

  htsmsg_add_u32(m, "phantom_center", am->am_phantom_center);
  htsmsg_add_u32(m, "phantom_lfe", am->am_phantom_lfe);
  htsmsg_add_u32(m, "small_front", am->am_small_front);
  htsmsg_add_u32(m, "force_downmix", am->am_force_downmix);
  htsmsg_add_u32(m, "swap_surround", am->am_swap_surround);
  htsmsg_add_s32(m, "delay", am->am_audio_delay);

  htsmsg_store_save(m, "audio/devices/%s", am->am_id);
  htsmsg_destroy(m);
}
Пример #7
0
static htsmsg_t *
cm_GetCurrentConnectionInfo(http_connection_t *hc, htsmsg_t *args,
			    const char *myhost, int myport)
{
  const char *uri = htsmsg_get_str(args, "ConnectionID");
  if(uri == NULL || strcmp(uri, "0"))
    return UPNP_CONTROL_INVALID_ARGS;

  htsmsg_t *out = htsmsg_create_map();
  htsmsg_add_u32(out, "RcsID", 0);
  htsmsg_add_u32(out, "AVTransportID", 0);
  htsmsg_add_str(out, "ProtocolInfo", "");
  htsmsg_add_str(out, "PeerConnectionManager", "");
  htsmsg_add_s32(out, "PeerConnectionID", -1);
  htsmsg_add_str(out, "Direction", "Input");
  htsmsg_add_str(out, "Status", "OK");
  return out;
}