本文整理汇总了C++中prop_set_int函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_set_int函数的具体用法?C++ prop_set_int怎么用?C++ prop_set_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_set_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message_popup
int
message_popup(const char *message, int flags)
{
prop_t *p;
int rval;
p = prop_create_root(NULL);
prop_set_string(prop_create(p, "type"), "message");
prop_set_string_ex(prop_create(p, "message"), NULL, message,
flags & MESSAGE_POPUP_RICH_TEXT ?
PROP_STR_RICH : PROP_STR_UTF8);
if(flags & MESSAGE_POPUP_CANCEL)
prop_set_int(prop_create(p, "cancel"), 1);
if(flags & MESSAGE_POPUP_OK)
prop_set_int(prop_create(p, "ok"), 1);
event_t *e = popup_display(p);
prop_destroy(p);
if(event_is_action(e, ACTION_OK))
rval = MESSAGE_POPUP_OK;
else if(event_is_action(e, ACTION_CANCEL))
rval = MESSAGE_POPUP_CANCEL;
else
rval = 0;
event_release(e);
return rval;
}
示例2: mp_become_primary
void
mp_become_primary(struct media_pipe *mp)
{
mp_init_audio(mp);
if(media_primary == mp)
return;
hts_mutex_lock(&media_mutex);
assert(mp->mp_flags & MP_PRIMABLE);
if(media_primary != NULL) {
prop_set_int(media_primary->mp_prop_primary, 0);
event_t *e = event_create_action(ACTION_STOP);
mp_enqueue_event(media_primary, e);
event_release(e);
}
media_primary = mp_retain(mp);
prop_select(mp->mp_prop_root);
prop_link(mp->mp_prop_root, media_prop_current);
prop_set_int(mp->mp_prop_primary, 1);
hts_mutex_unlock(&media_mutex);
}
示例3: mp_set_clr_flags_locked
static void
mp_set_clr_flags_locked(media_pipe_t *mp, int set, int clr)
{
mp->mp_flags &= ~clr;
mp->mp_flags |= set;
prop_set_int(mp->mp_prop_canSeek, mp->mp_flags & MP_CAN_SEEK ? 1 : 0);
prop_set_int(mp->mp_prop_canPause, mp->mp_flags & MP_CAN_PAUSE ? 1 : 0);
prop_set_int(mp->mp_prop_canEject, mp->mp_flags & MP_CAN_EJECT ? 1 : 0);
}
示例4: nav_open_error
int
nav_open_error(prop_t *root, const char *msg)
{
prop_t *model = prop_create(root, "model");
prop_set_string(prop_create(model, "type"), "openerror");
prop_set_int(prop_create(model, "loading"), 0);
prop_set_string(prop_create(model, "error"), msg);
prop_set_int(prop_create(root, "directClose"), 1);
return 0;
}
示例5: message_popup
int
message_popup(const char *message, int flags, const char **extra)
{
prop_t *p;
int rval;
p = prop_ref_inc(prop_create_root(NULL));
TRACE(TRACE_DEBUG, "Notification", "%s", message);
prop_set_string(prop_create(p, "type"), "message");
prop_set_string_ex(prop_create(p, "message"), NULL, message,
flags & MESSAGE_POPUP_RICH_TEXT ?
PROP_STR_RICH : PROP_STR_UTF8);
if(extra) {
int cnt = 1;
prop_t *btns = prop_create(p, "buttons");
while(*extra) {
prop_t *b = prop_create_root(NULL);
prop_set_string(prop_create(b, "title"), *extra);
char action[10];
snprintf(action, sizeof(action), "btn%d", cnt);
prop_set_string(prop_create(b, "action"), action);
if(prop_set_parent(b, btns))
abort();
cnt++;
extra++;
}
}
if(flags & MESSAGE_POPUP_CANCEL)
prop_set_int(prop_create(p, "cancel"), 1);
if(flags & MESSAGE_POPUP_OK)
prop_set_int(prop_create(p, "ok"), 1);
event_t *e = popup_display(p);
prop_destroy(p);
prop_ref_dec(p);
const event_payload_t *ep = (const event_payload_t *)e;
if(event_is_action(e, ACTION_OK))
rval = MESSAGE_POPUP_OK;
else if(event_is_action(e, ACTION_CANCEL))
rval = MESSAGE_POPUP_CANCEL;
else if(event_is_type(e, EVENT_DYNAMIC_ACTION) &&
!strncmp(ep->payload, "btn", 3))
rval = atoi(ep->payload + 3);
else
rval = 0;
event_release(e);
return rval;
}
示例6: js_item_addOptAction
static JSBool
js_item_addOptAction(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
js_item_t *ji = JS_GetPrivate(cx, obj);
const char *title;
const char *action;
if (!JS_ConvertArguments(cx, argc, argv, "ss", &title, &action))
return JS_FALSE;
prop_t *p = prop_create_root(NULL);
prop_set_string(prop_create(p, "type"), "action");
prop_set_string(prop_create(prop_create(p, "metadata"), "title"), title);
prop_set_int(prop_create(p, "enabled"), 1);
prop_set_string(prop_create(p, "action"), action);
prop_t *opts = prop_create_r(ji->ji_root, "options");
if(prop_set_parent(p, opts))
prop_destroy(p);
prop_ref_dec(opts);
*rval = JSVAL_VOID;
return JS_TRUE;
}
示例7: settings_create_bool
setting_t *
settings_create_bool(prop_t *parent, const char *id, prop_t *title,
int initial, htsmsg_t *store,
prop_callback_int_t *cb, void *opaque,
int flags, prop_courier_t *pc,
settings_saver_t *saver, void *saver_opaque)
{
setting_t *s = setting_create_leaf(parent, title, "bool", "value", flags);
prop_sub_t *sub;
s->s_id = strdup(id);
s->s_callback = cb;
s->s_opaque = opaque;
if(store != NULL)
initial = htsmsg_get_u32_or_default(store, id, initial);
prop_set_int(s->s_val, !!initial);
if(flags & SETTINGS_INITIAL_UPDATE)
settings_int_callback(s, !!initial);
sub = prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_INT, settings_int_callback, s,
PROP_TAG_ROOT, s->s_val,
PROP_TAG_COURIER, pc,
NULL);
s->s_sub = sub;
s->s_store = store;
s->s_saver = saver;
s->s_saver_opaque = saver_opaque;
return s;
}
示例8: audio_mastervol_init
void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *prop_audio;
prop_audio = prop_create(prop_get_global(), "audio");
prop_mastervol = prop_create(prop_audio, "mastervolume");
prop_mastermute = prop_create(prop_audio, "mastermute");
prop_set_float_clipping_range(prop_mastervol, -75, 0);
prop_set_int(prop_mastermute, 0);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(prop_mastervol, (float)i32 / 1000);
htsmsg_destroy(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, prop_mastervol,
NULL);
}
示例9: nav_create
static navigator_t *
nav_create(prop_t *prop)
{
navigator_t *nav = calloc(1, sizeof(navigator_t));
nav->nav_prop_root = prop;
TAILQ_INIT(&nav->nav_pages);
TAILQ_INIT(&nav->nav_history);
nav->nav_prop_pages = prop_create(nav->nav_prop_root, "pages");
nav->nav_prop_curpage = prop_create(nav->nav_prop_root, "currentpage");
nav->nav_prop_can_go_back = prop_create(nav->nav_prop_root, "canGoBack");
nav->nav_prop_can_go_fwd = prop_create(nav->nav_prop_root, "canGoForward");
nav->nav_prop_can_go_home = prop_create(nav->nav_prop_root, "canGoHome");
prop_set_int(nav->nav_prop_can_go_home, 1);
nav->nav_pc = prop_courier_create_thread(NULL, "navigator");
nav->nav_eventsink =
prop_subscribe(0,
PROP_TAG_NAME("nav", "eventsink"),
PROP_TAG_CALLBACK, nav_eventsink, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
nav->nav_dtor_tracker =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, nav_dtor_tracker, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
return nav;
}
示例10: darwin_init_cpu_monitor
void
darwin_init_cpu_monitor(void)
{
kern_return_t r;
processor_info_t pinfo;
mach_msg_type_number_t msg_count;
p_sys = prop_create(prop_get_global(), "system");
r = host_processor_info(mach_host_self (),
PROCESSOR_CPU_LOAD_INFO,
&cpu_count,
(processor_info_array_t *)&pinfo,
&msg_count);
if(r != KERN_SUCCESS) {
TRACE(TRACE_ERROR, "darwin",
"host_processor_info(PROCESSOR_CPU_LOAD_INFO) failed %d", r);
return;
}
p_cpu = calloc(cpu_count, sizeof(prop_t *));
p_load = calloc(cpu_count, sizeof(prop_t *));
last_total = calloc(cpu_count, sizeof(unsigned int));
last_idle = calloc(cpu_count, sizeof(unsigned int));
prop_set_int(prop_create(prop_create(p_sys, "cpuinfo"), "available"), 1);
p_cpuroot = prop_create(prop_create(p_sys, "cpuinfo"), "cpus");
vm_deallocate(mach_task_self(),
(vm_address_t)pinfo,
(vm_size_t)sizeof(*pinfo) * msg_count);
cpu_monitor_do();
callout_arm(&timer, timercb, NULL, 1);
}
示例11: audio_mastervol_init
static void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *pa, *mv, *mm;
pa = prop_create(prop_get_global(), "audio");
mv = prop_create(pa, "mastervolume");
mm = prop_create(pa, "mastermute");
prop_set_float_clipping_range(mv, -75, 12);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(mv, (float)i32 / 1000);
prop_set_int(mm, 0);
htsmsg_release(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, mv,
NULL);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_SET_INT, &audio_master_mute,
PROP_TAG_ROOT, mm,
NULL);
}
示例12: bookmarks_init
void
bookmarks_init(void)
{
htsmsg_field_t *f;
htsmsg_t *m, *n, *o;
hts_mutex_init(&bookmark_mutex);
bookmarks = prop_create(settings_add_dir(NULL, "Bookmarks", "bookmark", NULL),
"model");
prop_set_int(prop_create(bookmarks, "mayadd"), 1);
prop_subscribe(0,
PROP_TAG_CALLBACK, bookmarks_callback, NULL,
PROP_TAG_ROOT, prop_create(bookmarks, "nodes"),
PROP_TAG_MUTEX, &bookmark_mutex,
NULL);
if((m = htsmsg_store_load("bookmarks")) != NULL) {
n = htsmsg_get_map(m, "nodes");
HTSMSG_FOREACH(f, n) {
if((o = htsmsg_get_map_by_field(f)) == NULL)
continue;
bookmark_load(o);
}
htsmsg_destroy(m);
}
示例13: search_class_create
int
search_class_create(prop_t *parent, prop_t **nodesp, prop_t **entriesp,
const char *title, const char *icon)
{
prop_t *p = prop_create_root(NULL);
prop_t *m = prop_create(p, "metadata");
prop_t *n, *e;
char url[URL_MAX];
backend_prop_make(p, url, sizeof(url));
prop_set_string(prop_create(p, "url"), url);
prop_set_string(prop_create(m, "title"), title);
if(icon != NULL)
prop_set_string(prop_create(m, "icon"), icon);
prop_set_string(prop_create(p, "type"), "directory");
n = prop_create(p, "nodes");
e = prop_create(p, "entries");
prop_set_int(e, 0);
*nodesp = prop_ref_inc(n);
*entriesp = prop_ref_inc(e);
if(prop_set_parent(p, parent)) {
prop_destroy(p);
return 1;
}
return 0;
}
示例14: update_abitrate
static void
update_abitrate(media_pipe_t *mp, media_queue_t *mq,
int size, audio_decoder_t *ad)
{
int i;
int64_t sum;
ad->ad_frame_size[ad->ad_frame_size_ptr] = size;
ad->ad_frame_size_ptr = (ad->ad_frame_size_ptr + 1) & AD_FRAME_SIZE_MASK;
int d = ad->ad_estimated_duration;
if(d == 0) {
ad->ad_last_pts = ad->ad_saved_pts;
ad->ad_saved_pts = ad->ad_pts;
if(ad->ad_pts != PTS_UNSET && ad->ad_last_pts != PTS_UNSET) {
int64_t d64 = ad->ad_pts - ad->ad_last_pts;
if(d64 > 100 && d64 < 500000)
d = d64;
}
}
if(d == 0 || (ad->ad_frame_size_ptr & 7) != 0)
return;
sum = 0;
for(i = 0; i < AD_FRAME_SIZE_LEN; i++)
sum += ad->ad_frame_size[i];
sum = 8000000LL * sum / AD_FRAME_SIZE_LEN / d;
prop_set_int(mq->mq_prop_bitrate, sum / 1000);
}
示例15: mip_set
static void
mip_set(metadb_item_prop_t *mip, const metadb_item_info_t *mii)
{
prop_set_int_ex(mip->mip_playcount, mip->mip_playcount_sub,
mii->mii_playcount);
prop_set_int(mip->mip_lastplayed, mii->mii_lastplayed);
prop_set_float(mip->mip_restartpos, mii->mii_restartpos / 1000.0);
}