当前位置: 首页>>代码示例>>C++>>正文


C++ G_VALUE_TYPE函数代码示例

本文整理汇总了C++中G_VALUE_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_VALUE_TYPE函数的具体用法?C++ G_VALUE_TYPE怎么用?C++ G_VALUE_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G_VALUE_TYPE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gst_base_video_decoder_sink_setcaps

static gboolean
gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
{
  GstBaseVideoDecoder *base_video_decoder;
  GstBaseVideoDecoderClass *base_video_decoder_class;
  GstStructure *structure;
  const GValue *codec_data;
  GstVideoState *state;
  gboolean ret = TRUE;

  base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad));
  base_video_decoder_class =
      GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder);

  GST_DEBUG ("setcaps %" GST_PTR_FORMAT, caps);

  state = &base_video_decoder->state;

  gst_base_video_decoder_reset_state (state);

  structure = gst_caps_get_structure (caps, 0);

  gst_video_format_parse_caps (caps, NULL, &state->width, &state->height);
  gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d);
  gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d);
  gst_structure_get_boolean (structure, "interlaced", &state->interlaced);

  codec_data = gst_structure_get_value (structure, "codec_data");
  if (codec_data && G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER)
    state->codec_data = gst_value_get_buffer (codec_data);

  if (base_video_decoder_class->set_sink_caps)
    ret = base_video_decoder_class->set_sink_caps (base_video_decoder, caps);

  g_object_unref (base_video_decoder);

  return ret;
}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:38,代码来源:gstbasevideodecoder.c

示例2: _owr_deep_notify

void _owr_deep_notify(GObject *object, GstObject *orig,
    GParamSpec *pspec, gpointer user_data)
{
    GValue value = G_VALUE_INIT;
    gchar *str = NULL;
    GstObject *it;
    gchar *prevpath, *path;

    OWR_UNUSED(user_data);
    OWR_UNUSED(object);

    path = g_strdup("");

    for (it = orig; GST_IS_OBJECT(it); it = GST_OBJECT_PARENT(it)) {
        prevpath = path;
        path = g_strjoin("/", GST_OBJECT_NAME(it), prevpath, NULL);
        g_free(prevpath);
    }

    if (pspec->flags & G_PARAM_READABLE) {
        g_value_init(&value, pspec->value_type);
        g_object_get_property(G_OBJECT(orig), pspec->name, &value);

        if (G_VALUE_TYPE(&value) == GST_TYPE_CAPS)
            str = gst_caps_to_string(gst_value_get_caps(&value));
        else if (G_VALUE_HOLDS_STRING(&value))
            str = g_value_dup_string(&value);
        else
            str = gst_value_serialize(&value);

        GST_INFO_OBJECT(object, "%s%s = %s\n", path, pspec->name, str);
        g_free(str);
        g_value_unset(&value);
    } else
        GST_INFO_OBJECT(object, "Parameter %s not readable in %s.", pspec->name, path);

    g_free(path);
}
开发者ID:AIMA2015,项目名称:openwebrtc,代码行数:38,代码来源:owr_utils.c

示例3: conting_attributes_get_valist

void
conting_attributes_get_valist(ContingAttributes *self,
        const gchar *first, va_list ap)
{
    g_return_if_fail(self != NULL && CONTING_IS_ATTRIBUTES(self));

    while (first) {
        gpointer *pointer;
        const GValue *value;

        pointer = va_arg(ap, gpointer *);

        value = conting_attributes_get_value(self, first);

        if (value == NULL) {
            *pointer = NULL;
        } else {
            switch (G_VALUE_TYPE(value)) {
				case G_TYPE_INT:
					*((gint *) pointer) = g_value_get_int(value);
					break;
				case G_TYPE_DOUBLE:
					*((gdouble *) pointer) = g_value_get_double(value);
					break;
				case G_TYPE_STRING:
					*((const gchar **) pointer) = g_value_get_string(value);
					break;
				case G_TYPE_POINTER:
				default:
					*pointer = g_value_get_pointer(value);
					break;
			}

        }

        first = va_arg(ap, const gchar *);
    }
}
开发者ID:gcms,项目名称:gustavo,代码行数:38,代码来源:contingattributes.c

示例4: enum_flags_format_cell_data

static void
enum_flags_format_cell_data (GtkCellLayout * cell_layout,
                             GtkCellRenderer * cell,
                             GtkTreeModel * tree_model,
                             GtkTreeIter * iter, gpointer data)
{
  gint colnum =
      GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column-number"));
  GValue value = { 0, };
  gchar *string;

  gtk_tree_model_get_value (tree_model, iter, NUM_COLUMNS + colnum, &value);

  string = glade_utils_string_from_value (&value);

  g_object_set (cell, "text", string && string[0] ?
                glade_get_displayable_value (G_VALUE_TYPE (&value),
                                             string) : "", NULL);

  g_free (string);

  g_value_unset (&value);
}
开发者ID:metaltrrocker,项目名称:glade,代码行数:23,代码来源:glade-model-data.c

示例5: g_value_to_string

static gchar *
g_value_to_string (const GValue * val)
{
  gchar *ret = NULL;

  if (G_VALUE_TYPE (val) == GST_TYPE_BUFFER) {
    GstBuffer *buf = gst_value_get_buffer (val);
    GstMapInfo map;

    gst_buffer_map (buf, &map, GST_MAP_READ);
    ret = g_base64_encode (map.data, map.size);
    gst_buffer_unmap (buf, &map);
  } else {
    GValue s = { 0, };

    g_value_init (&s, G_TYPE_STRING);
    if (g_value_transform (val, &s)) {
      ret = g_value_dup_string (&s);
      g_value_unset (&s);
    }
  }
  return ret;
}
开发者ID:0p1pp1,项目名称:gst-plugins-bad,代码行数:23,代码来源:mxfdemux-structure.c

示例6: audacious_dbus_string

gboolean audacious_dbus_string(DBusGProxy *proxy, const char *method, int pos, const char *arg, char* dest)
{
	GValue val;
	memset(&val, 0, sizeof(GValue));
	GError *error = 0;
	if (!dbus_g_proxy_call_with_timeout(proxy, method, DBUS_TIMEOUT, &error,
				G_TYPE_UINT, pos,
				G_TYPE_STRING, arg,
				G_TYPE_INVALID,
				G_TYPE_VALUE, &val,
				G_TYPE_INVALID))
	{
		trace("Failed to make dbus call %s: %s", method, error->message);
		return FALSE;
	}

	if (G_VALUE_TYPE(&val) == G_TYPE_STRING) {
		strncpy(dest, g_value_get_string(&val), STRLEN);
		dest[STRLEN-1] = 0;
	}
	g_value_unset(&val);
	return TRUE;
}
开发者ID:jon-turney,项目名称:pidgin-musictracker,代码行数:23,代码来源:audacious.c

示例7: g_value_array_insert

/**
 * g_value_array_insert:
 * @value_array: #GValueArray to add an element to
 * @index_: insertion position, must be <= value_array->;n_values
 * @value: (allow-none): #GValue to copy into #GValueArray, or %NULL
 *
 * Insert a copy of @value at specified position into @value_array. If @value
 * is %NULL, an uninitialized value is inserted.
 *
 * Returns: (transfer none): the #GValueArray passed in as @value_array
 *
 * Deprecated: 2.32: Use #GArray and g_array_insert_val() instead.
 */
GValueArray*
g_value_array_insert (GValueArray  *value_array,
		      guint         index,
		      const GValue *value)
{
  guint i;

  g_return_val_if_fail (value_array != NULL, NULL);
  g_return_val_if_fail (index <= value_array->n_values, value_array);

  i = value_array->n_values;
  value_array_grow (value_array, value_array->n_values + 1, FALSE);
  if (index + 1 < value_array->n_values)
    memmove (value_array->values + index + 1, value_array->values + index,
             (i - index) * sizeof (value_array->values[0]));
  memset (value_array->values + index, 0, sizeof (value_array->values[0]));
  if (value)
    {
      g_value_init (value_array->values + index, G_VALUE_TYPE (value));
      g_value_copy (value, value_array->values + index);
    }
  return value_array;
}
开发者ID:Leon555,项目名称:glib,代码行数:36,代码来源:gvaluearray.c

示例8: gsf_doc_prop_glue_get_val

void
gsf_doc_prop_glue_get_val (GsfDocProp const *prop, GType *type, GValue *value) 
{
	GValue const *prop_val;
	
	if (prop == NULL)
	  return;
	
	prop_val = gsf_doc_prop_get_val (prop);
	
	if (prop_val != NULL && G_IS_VALUE (prop_val)) {
	  
	  *type = G_VALUE_TYPE (prop_val);
	  
	  g_value_init (value, *type);
	  g_value_copy (prop_val, value);
	  
	  /*
	    printf ("Type == %d, G_TYPE_STRING=%d, G_VALUE_TYPE (prop_val)=%d\n", 
	    *type, G_TYPE_STRING, G_VALUE_TYPE (prop_val));
	    */
  }    
}
开发者ID:mono,项目名称:gsf-sharp,代码行数:23,代码来源:gsf-doc-prop-glue.c

示例9: set_param_from_value

static gboolean
set_param_from_value (const TpCMParamSpec *paramspec,
                      GValue *value,
                      const TpCMParamSetter set_param,
                      void *params,
                      GError **error)
{
  if (G_VALUE_TYPE (value) != paramspec->gtype)
    {
      DEBUG ("expected type %s for parameter %s, got %s",
               g_type_name (paramspec->gtype), paramspec->name,
               G_VALUE_TYPE_NAME (value));
      g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
          "expected type %s for account parameter %s, got %s",
          g_type_name (paramspec->gtype), paramspec->name,
          G_VALUE_TYPE_NAME (value));
      return FALSE;
    }

  set_param (paramspec, value, params);

  return TRUE;
}
开发者ID:izaackgerard,项目名称:Sintetizador_Voz,代码行数:23,代码来源:base-connection-manager.c

示例10: mkdg_backend_get_key

GValue *backend_command_get_key_value(const gchar * key, GValue * value)
{
    gchar cmdBuf[COMMAND_BUFFER_SIZE];
    gchar *cKey = mkdg_backend_get_key(backend, NULL, key, NULL);
#ifdef USE_GSETTINGS
    g_snprintf(cmdBuf, COMMAND_BUFFER_SIZE, "gsettings get %s %s",
	       QUOTE_ME(PROJECT_SCHEMA_ID), cKey);
#else
    g_snprintf(cmdBuf, COMMAND_BUFFER_SIZE, "gconftool-2 --get  %s/%s",
	       QUOTE_ME(PROJECT_GCONF2_SCHEMA_DIR), cKey);
#endif
    gchar *retStr = command_run_obtain_output(cmdBuf);

#ifdef USE_GSETTINGS
    /* gsettings prepend 'uint32 ' before actual value */
    if (G_VALUE_TYPE(value) == G_TYPE_UINT) {
	gint offset = strlen("uint32 ");
	retStr += offset;
    }
#endif
    mkdg_g_value_from_string(value, retStr);
    return value;
}
开发者ID:alwayschoco,项目名称:ibus-chewing,代码行数:23,代码来源:MakerDialogBackend-test.c

示例11: build_field_template

static gboolean
build_field_template (GQuark field_id, const GValue * value, gpointer user_data)
{
  GString *s = (GString *) user_data;
  const GstStructure *sub;
  GValue template_value = { 0, };
  GType type = G_TYPE_INVALID;
  GstTracerValueFlags flags = GST_TRACER_VALUE_FLAGS_NONE;
  gboolean res;

  if (G_VALUE_TYPE (value) != GST_TYPE_STRUCTURE) {
    GST_WARNING ("expected field of type GstStructure, but %s is %s",
        g_quark_to_string (field_id), G_VALUE_TYPE_NAME (value));
    return FALSE;
  }

  sub = gst_value_get_structure (value);
  gst_structure_get (sub, "type", G_TYPE_GTYPE, &type, "flags",
      GST_TYPE_TRACER_VALUE_FLAGS, &flags, NULL);

  if (flags & GST_TRACER_VALUE_FLAGS_OPTIONAL) {
    gchar *opt_name = g_strconcat ("have-", g_quark_to_string (field_id), NULL);

    /* add a boolean field, that indicates the presence of the next field */
    g_value_init (&template_value, G_TYPE_BOOLEAN);
    priv__gst_structure_append_template_to_gstring (g_quark_from_string
        (opt_name), &template_value, s);
    g_value_unset (&template_value);
    g_free (opt_name);
  }

  g_value_init (&template_value, type);
  res = priv__gst_structure_append_template_to_gstring (field_id,
      &template_value, s);
  g_value_unset (&template_value);
  return res;
}
开发者ID:like0403,项目名称:gstreamer,代码行数:37,代码来源:gsttracerrecord.c

示例12: __set_expression_value

static void 
__set_expression_value (GValue *dest, GValue *src)
{
	gchar *str;

	switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (src))) {
	
		case G_TYPE_STRING:
			  str = g_strdup_printf ("'%s'", g_value_get_string (src));
			  break;

		case G_TYPE_UINT:
			  str = g_strdup_printf ("%d", g_value_get_uint (src));
			  break;

		case G_TYPE_INT:
			  str = g_strdup_printf ("%d", g_value_get_int (src));
			  break;

		case G_TYPE_FLOAT:
			  str = g_strdup_printf ("%.04f", g_value_get_float (src));
			  break;

		case G_TYPE_BOOLEAN:
			  str = g_strdup_printf ("%d", g_value_get_boolean (src));
			  break;

		case G_TYPE_BOXED:
			  g_print ("BOXED type not implemented \n");
			  break;

		default:
			  break;
	}

	g_value_take_string (dest, str);
}
开发者ID:jerryjj,项目名称:midgard-core,代码行数:37,代码来源:midgard_query_constraint.c

示例13: main

int main (int argc, char *argv[])
{
  GskXmlProcessor *xml_processor;
  GskXmlConfig *config;
  GValue value = { 0 };
  int i;

  gsk_init_without_threads (&argc, &argv);

  config = gsk_xml_config_new (NULL);
  g_return_val_if_fail (config, -1);
  gsk_xml_config_add_type_test (config, return_true, NULL, NULL);
  gsk_xml_config_set_loader (config, gsk_xml_loader_introspective, NULL, NULL);
  xml_processor =
    gsk_xml_processor_new (config, G_TYPE_OBJECT, handle_value, &value, NULL);
  g_return_val_if_fail (xml_processor, -1);

  for (i = 0; i < G_N_ELEMENTS (tests); ++i)
    {
      TestObject *object;
      char *xml;

      if (!gsk_xml_processor_input (xml_processor, tests[i], strlen (tests[i])))
	g_error ("error parsing XML '%s'", tests[i]);
      g_return_val_if_fail (G_VALUE_TYPE (&value) == G_TYPE_OBJECT, -1);
      g_return_val_if_fail (TEST_IS_OBJECT (g_value_get_object (&value)), -1);
      object = TEST_OBJECT (g_value_get_object (&value));
      xml = test_object_get_xml (object);
      g_return_val_if_fail (strcmp (xml, tests[i]) == 0, -1);
      g_free (xml);
      g_value_unset (&value);
    }

  gsk_xml_processor_destroy (xml_processor);
  gsk_xml_config_unref (config);
  return 0;
}
开发者ID:davebenson,项目名称:gsk,代码行数:37,代码来源:test-xml-processor.c

示例14: moto_variation_save_param

void moto_variation_save_param(MotoVariation *self, MotoParam *p)
{
    MotoVariationPriv *priv = MOTO_VARIATION_GET_PRIVATE(self);

    GValue none = {0,};

    guint id = moto_param_get_id(p);
    GValue *pv = moto_param_get_value(p);
    GType pt = G_VALUE_TYPE(pv);
    GHashTable *params = priv->params;

    GValue *v = (GValue *)g_hash_table_lookup(params, &id);
    if( ! v)
    {
        v = g_slice_new(GValue);
        *v = none;
        g_value_init(v, pt);

        guint *key = g_slice_new(guint);
        *key = id;
        g_hash_table_insert(params, key, v);
    }
    else if(g_type_is_a(pt, G_TYPE_OBJECT))
    {
        GObject *o = g_value_get_object(v);
        if(o)
            g_object_weak_unref(o, (GWeakNotify)null_value, v);
    }

    if(g_type_is_a(pt, G_TYPE_OBJECT))
    {
        GObject *o = moto_param_get_object(p);
        if(o)
            g_object_weak_ref(o, (GWeakNotify)null_value, v);
    }
    g_value_copy(pv, v);
}
开发者ID:qewerty,项目名称:moto.old,代码行数:37,代码来源:moto-variation.c

示例15: create_new_row

static GdaRow *
create_new_row (GdaDataAccessWrapper *model)
{
	gint i;
	GdaRow *row;

	row = gda_row_new (model->priv->nb_cols);
	for (i = 0; i < model->priv->nb_cols; i++) {
		GdaHolder *holder;
		GValue *dest;
		dest = gda_row_get_value (row, i);
		if (model->priv->rows_mapping)
			holder = gda_set_get_nth_holder ((GdaSet *) model->priv->iter, model->priv->rows_mapping [i]);
		else
			holder = gda_set_get_nth_holder ((GdaSet *) model->priv->iter, i);
		if (holder) {
			const GValue *cvalue = gda_holder_get_value (holder);
			if (cvalue) {
				gda_value_reset_with_type (dest, G_VALUE_TYPE ((GValue *) cvalue));
				g_value_copy (cvalue, dest);
			}
			else
				gda_value_set_null (dest);
		}
		else
			gda_row_invalidate_value (row, dest);
	}

	gint *ptr;
	ptr = g_new (gint, 1);
	*ptr = model->priv->iter_row;
	g_hash_table_insert (model->priv->rows, ptr, row);
	/*g_print ("%s(%d)\n", __FUNCTION__, model->priv->iter_row);*/

	return row;
}
开发者ID:arthurnn,项目名称:libgda,代码行数:36,代码来源:gda-data-access-wrapper.c


注:本文中的G_VALUE_TYPE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。