本文整理汇总了C++中prop_set函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_set函数的具体用法?C++ prop_set怎么用?C++ prop_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glw_update_sizes
static void
glw_update_sizes(glw_root_t *gr)
{
int val;
int base_size = gr->gr_height / 35; // 35 is just something
val = GLW_CLAMP(base_size + glw_settings.gs_size, 14, 40);
if(gr->gr_current_size != val) {
gr->gr_current_size = val;
prop_set(gr->gr_prop_ui, "size", PROP_SET_INT, val);
glw_text_flush(gr);
glw_icon_flush(gr);
TRACE(TRACE_DEBUG, "GLW", "UI size scale changed to %d", val);
}
val = GLW_CLAMP(gr->gr_base_underscan_h + glw_settings.gs_underscan_h,
0, 100);
if(gr->gr_underscan_h != val) {
prop_set(gr->gr_prop_ui, "underscan_h", PROP_SET_INT, val);
gr->gr_underscan_h = val;
}
val = GLW_CLAMP(gr->gr_base_underscan_v + glw_settings.gs_underscan_v,
0, 100);
if(gr->gr_underscan_v != val) {
prop_set(gr->gr_prop_ui, "underscan_v", PROP_SET_INT, val);
gr->gr_underscan_v = val;
}
}
示例2: update_state
static void
update_state(plugin_t *pl)
{
int canInstall = 0;
int canUninstall = 0;
int canUpgrade = 0;
int cantUpgrade = 0;
rstr_t *status = NULL;
int version_dep_ok =
pl->pl_app_min_version == NULL ||
parse_version_int(pl->pl_app_min_version) <=
app_get_version_int();
prop_set(pl->pl_status, "minver", PROP_SET_VOID);
pl->pl_new_version_avail = 0;
if(pl->pl_installed == 0) {
if(!version_dep_ok) {
status = _("Not installable");
prop_set(pl->pl_status, "minver", PROP_SET_STRING,
pl->pl_app_min_version);
} else {
status = _("Not installed");
canInstall = 1;
}
} else if(!strcmp(pl->pl_inst_ver ?: "", pl->pl_repo_ver ?: "")) {
status = _("Up to date");
canUninstall = 1;
} else {
示例3: device_register
void
device_register(struct device *dev, void *aux)
{
struct device *parent = dev->dv_parent;
if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
/* Set the frequency of the on-chip UART. */
int freq = COM_FREQ * 6;
if (prop_set(dev_propdb, dev, "frequency",
&freq, sizeof(freq), PROP_INT, 0) != 0)
printf("WARNING: unable to set frequency "
"property for %s\n", dev->dv_xname);
return;
}
if (strcmp(dev->dv_cfdata->cf_name, "emac") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
/* Set the mac-addr of the on-chip Ethernet. */
/* XXX 405GP only has one; what about CPUs with two? */
if (prop_set(dev_propdb, dev, "mac-addr",
&board_data.mac_address_local,
sizeof(board_data.mac_address_local),
PROP_CONST, 0) != 0)
printf("WARNING: unable to set mac-addr "
"property for %s\n", dev->dv_xname);
return;
}
}
示例4: connman_init
void
connman_init(void)
{
TAILQ_INIT(&connman_services);
netconf_model = prop_create_root(NULL);
prop_concat_t *pc = prop_concat_create(prop_create(netconf_model, "nodes"));
net_state = prop_create(netconf_model, "status");
prop_set(netconf_model, "type", PROP_SET_STRING, "directory");
prop_t *m = prop_create(netconf_model, "metadata");
prop_set(m, "title", PROP_SET_RSTRING, _("Network connections"));
// service_nodes contains list of items we receive from connman
service_nodes = prop_create_root(NULL);
prop_concat_add_source(pc, service_nodes, NULL);
// settings
connman_settings = prop_create_root(NULL);
prop_t *delim = prop_create_root(NULL);
prop_set_string(prop_create(delim, "type"), "separator");
prop_concat_add_source(pc, prop_create(connman_settings, "nodes"), delim);
settings_add_url(gconf.settings_network,
_p("Network connections"), NULL, NULL, NULL, MYURL,
SETTINGS_FIRST);
hts_thread_create_detached("connman", connman_thread, NULL,
THREAD_PRIO_BGTASK);
}
示例5: create_channel
HRESULT create_channel( WS_CHANNEL_TYPE type, WS_CHANNEL_BINDING binding,
const WS_CHANNEL_PROPERTY *properties, ULONG count, struct channel **ret )
{
struct channel *channel;
ULONG i, msg_size = 65536;
HRESULT hr;
if (!(channel = alloc_channel())) return E_OUTOFMEMORY;
prop_set( channel->prop, channel->prop_count, WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE,
&msg_size, sizeof(msg_size) );
for (i = 0; i < count; i++)
{
hr = prop_set( channel->prop, channel->prop_count, properties[i].id, properties[i].value,
properties[i].valueSize );
if (hr != S_OK)
{
free_channel( channel );
return hr;
}
}
channel->type = type;
channel->binding = binding;
*ret = channel;
return S_OK;
}
示例6: add_news_locked
static prop_t *
add_news_locked(const char *id, const char *message,
const char *location, const char *caption,
const char *action)
{
prop_t *p, *ret = NULL;
prop_t *root = prop_create(prop_get_global(), "news");
if(dismissed_news_out != NULL) {
if(htsmsg_get_u32_or_default(dismissed_news_in, id, 0)) {
dismis_news(id);
} else {
p = prop_create_root(id);
prop_set(p, "message", PROP_SET_STRING, message);
prop_set(p, "id", PROP_SET_STRING, id);
prop_set(p, "location", PROP_SET_STRING, location);
prop_set(p, "caption", PROP_SET_STRING, caption);
prop_set(p, "action", PROP_SET_STRING, action);
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
PROP_TAG_ROOT, prop_create(p, "eventSink"),
PROP_TAG_MUTEX, &news_mutex,
NULL);
ret = prop_ref_inc(p);
if(prop_set_parent(p, root))
prop_destroy(p);
}
}
return ret;
}
示例7: init_global_info
/**
* Set some info in the global property tree that might be interesting
*/
static void
init_global_info(void)
{
prop_t *s = prop_create(prop_get_global(), "app");
extern const char *htsversion;
extern const char *htsversion_full;
prop_set(s, "name", PROP_SET_STRING, APPNAMEUSER);
prop_set(s, "version", PROP_SET_STRING, htsversion);
prop_set(s, "fullversion", PROP_SET_STRING, htsversion_full);
prop_set(s, "copyright", PROP_SET_STRING, "© 2006 - 2015 Lonelycoder AB");
}
示例8: file_open_audio
/**
* Try to open the given URL with a playqueue context
*/
static int
file_open_audio(prop_t *page, const char *url)
{
char parent[URL_MAX];
char parent2[URL_MAX];
struct fa_stat fs;
prop_t *model;
if(fa_parent(parent, sizeof(parent), url))
return 1;
if(fa_stat(parent, &fs, NULL, 0))
return 1;
model = prop_create(page, "model");
prop_set_string(prop_create(model, "type"), "directory");
/* Find a meaningful page title (last component of URL) */
rstr_t *title = title_from_url(parent);
prop_set(model, "metadata", "title", NULL, PROP_SET_RSTRING, title);
// Set parent
if(!fa_parent(parent2, sizeof(parent2), parent))
prop_set_string(prop_create(page, "parent"), parent2);
fa_scanner(parent, fs.fs_mtime, model, url, prop_create(page, "directClose"),
title);
rstr_release(title);
return 0;
}
示例9: mp_reset
void
mp_reset(media_pipe_t *mp)
{
cancellable_reset(mp->mp_cancellable);
prop_set(mp->mp_prop_io, "bitrate", PROP_SET_VOID);
prop_set(mp->mp_prop_io, "bitrateValid", PROP_SET_VOID);
prop_destroy_childs(mp->mp_prop_audio_tracks);
prop_destroy_childs(mp->mp_prop_subtitle_tracks);
prop_set_void(mp->mp_prop_audio_track_current);
mp_add_track_off(mp->mp_prop_subtitle_tracks, "sub:off");
prop_set_string(mp->mp_prop_subtitle_track_current, "sub:off");
}
示例10: mp_set_duration
void
mp_set_duration(media_pipe_t *mp, int64_t duration)
{
if(duration == AV_NOPTS_VALUE) {
mp->mp_duration = 0;
prop_set(mp->mp_prop_metadata, "duration", PROP_SET_VOID);
return;
}
mp->mp_duration = duration;
float d = mp->mp_duration / 1000000.0;
prop_set(mp->mp_prop_metadata, "duration", PROP_SET_FLOAT, d);
if(duration && mp->mp_prop_metadata_source)
prop_set(mp->mp_prop_metadata_source, "duration", PROP_SET_FLOAT, d);
}
示例11: create_proxy
static HRESULT create_proxy( WS_CHANNEL *channel, const WS_PROXY_PROPERTY *properties, ULONG count,
WS_SERVICE_PROXY **handle )
{
struct proxy *proxy;
HRESULT hr;
ULONG i;
if (!(proxy = alloc_proxy())) return E_OUTOFMEMORY;
for (i = 0; i < count; i++)
{
hr = prop_set( proxy->prop, proxy->prop_count, properties[i].id, properties[i].value,
properties[i].valueSize );
if (hr != S_OK)
{
free_proxy( proxy );
return hr;
}
}
proxy->channel = channel;
*handle = (WS_SERVICE_PROXY *)proxy;
return S_OK;
}
示例12: audio_setup_spdif_muxer
static void
audio_setup_spdif_muxer(audio_decoder_t *ad, AVCodec *codec,
media_queue_t *mq)
{
AVOutputFormat *ofmt = av_guess_format("spdif", NULL, NULL);
if(ofmt == NULL)
return;
const int mux_buffer_size = 16384;
assert(ad->ad_mux_buffer == NULL);
ad->ad_mux_buffer = malloc(mux_buffer_size);
AVFormatContext *fctx = avformat_alloc_context();
fctx->oformat = ofmt;
fctx->pb = avio_alloc_context(ad->ad_mux_buffer, mux_buffer_size,
1, ad, NULL, spdif_mux_write, NULL);
AVStream *s = avformat_new_stream(fctx, codec);
s->codec->sample_rate = 48000; // ???
if(avcodec_open2(s->codec, codec, NULL)) {
TRACE(TRACE_ERROR, "audio", "Unable to open %s codec for SPDIF",
codec->name);
bad:
av_free(fctx->pb);
free(ad->ad_mux_buffer);
ad->ad_mux_buffer = NULL;
avformat_free_context(fctx);
return;
}
if(avformat_write_header(fctx, NULL)) {
TRACE(TRACE_ERROR, "audio", "Unable to open SPDIF muxer",
codec->name);
goto bad;
}
ad->ad_spdif_muxer = fctx;
TRACE(TRACE_DEBUG, "audio", "SPDIF muxer opened");
const char *name;
switch(codec->id) {
case AV_CODEC_ID_DTS: name = "DTS"; break;
case AV_CODEC_ID_AC3: name = "AC3"; break;
case AV_CODEC_ID_EAC3: name = "EAC3"; break;
default:
name = "";
break;
}
char str[64];
snprintf(str, sizeof(str), "%s%sPass-Through", name, *name ? " " : "");
prop_set_string(mq->mq_prop_codec, str);
ad->ad_in_sample_rate = 0;
ad->ad_in_sample_format = 0;
ad->ad_in_channel_layout = 0;
prop_set(ad->ad_mp->mp_prop_ctrl, "canAdjustVolume", PROP_SET_INT, 0);
}
示例13: js_item_disable
static JSBool
js_item_disable(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
js_item_t *ji = JS_GetPrivate(cx, obj);
prop_set(ji->ji_root, "enabled", PROP_SET_INT, 0);
*rval = JSVAL_VOID;
return JS_TRUE;
}
示例14: WsSetChannelProperty
/**************************************************************************
* WsSetChannelProperty [[email protected]]
*/
HRESULT WINAPI WsSetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID id, const void *value,
ULONG size, WS_ERROR *error )
{
struct channel *channel = (struct channel *)handle;
TRACE( "%p %u %p %u\n", handle, id, value, size );
if (error) FIXME( "ignoring error parameter\n" );
return prop_set( channel->prop, channel->prop_count, id, value, size );
}
示例15: mp_reset
void
mp_reset(media_pipe_t *mp)
{
mp_unhold(mp, MP_HOLD_PRE_BUFFERING | MP_HOLD_STREAM | MP_HOLD_SYNC);
cancellable_reset(mp->mp_cancellable);
prop_set(mp->mp_prop_io, "bitrate", PROP_SET_VOID);
prop_set(mp->mp_prop_io, "bitrateValid", PROP_SET_VOID);
prop_t *p = prop_create(mp->mp_prop_io, "infoNodes");
prop_destroy_childs(p);
prop_destroy_childs(mp->mp_prop_audio_tracks);
prop_destroy_childs(mp->mp_prop_subtitle_tracks);
prop_set_void(mp->mp_prop_audio_track_current);
mp_add_track_off(mp->mp_prop_subtitle_tracks, "sub:off");
prop_set_string(mp->mp_prop_subtitle_track_current, "sub:off");
}