Commit d11e6574 authored by Evan Nemerson's avatar Evan Nemerson Committed by Tim-Philipp Müller

docs: annotate C examples as such

https://bugzilla.gnome.org/show_bug.cgi?id=731292
parent ac12ad07
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* created one will typically allocate memory for it and add it to the buffer. * created one will typically allocate memory for it and add it to the buffer.
* The following example creates a buffer that can hold a given video frame * The following example creates a buffer that can hold a given video frame
* with a given width, height and bits per plane. * with a given width, height and bits per plane.
* |[ * |[<!-- language="C" -->
* GstBuffer *buffer; * GstBuffer *buffer;
* GstMemory *memory; * GstMemory *memory;
* gint size, width, height, bpp; * gint size, width, height, bpp;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* handle or produce at runtime. * handle or produce at runtime.
* *
* A #GstCaps can be constructed with the following code fragment: * A #GstCaps can be constructed with the following code fragment:
* |[ * |[<!-- language="C" -->
* GstCaps *caps = gst_caps_new_simple ("video/x-raw", * GstCaps *caps = gst_caps_new_simple ("video/x-raw",
* "format", G_TYPE_STRING, "I420", * "format", G_TYPE_STRING, "I420",
* "framerate", GST_TYPE_FRACTION, 25, 1, * "framerate", GST_TYPE_FRACTION, 25, 1,
...@@ -2163,7 +2163,7 @@ gst_caps_fixate (GstCaps * caps) ...@@ -2163,7 +2163,7 @@ gst_caps_fixate (GstCaps * caps)
* can be converted back to a #GstCaps by gst_caps_from_string(). * can be converted back to a #GstCaps by gst_caps_from_string().
* *
* For debugging purposes its easier to do something like this: * For debugging purposes its easier to do something like this:
* |[ * |[<!-- language="C" -->
* GST_LOG ("caps are %" GST_PTR_FORMAT, caps); * GST_LOG ("caps are %" GST_PTR_FORMAT, caps);
* ]| * ]|
* This prints the caps in human readable form. * This prints the caps in human readable form.
......
...@@ -414,7 +414,7 @@ gst_caps_features_free (GstCapsFeatures * features) ...@@ -414,7 +414,7 @@ gst_caps_features_free (GstCapsFeatures * features)
* Converts @features to a human-readable string representation. * Converts @features to a human-readable string representation.
* *
* For debugging purposes its easier to do something like this: * For debugging purposes its easier to do something like this:
* |[ * |[<!-- language="C" -->
* GST_LOG ("features is %" GST_PTR_FORMAT, features); * GST_LOG ("features is %" GST_PTR_FORMAT, features);
* ]| * ]|
* This prints the features in human readable form. * This prints the features in human readable form.
......
...@@ -221,7 +221,7 @@ G_STMT_START { \ ...@@ -221,7 +221,7 @@ G_STMT_START { \
* the matching arguments. * the matching arguments.
* *
* Example: * Example:
* |[ * |[<!-- language="C" -->
* printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts)); * printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));
* ]| * ]|
*/ */
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
* construct and use seek events. * construct and use seek events.
* To do that gst_event_new_seek() is used to create a seek event. It takes * To do that gst_event_new_seek() is used to create a seek event. It takes
* the needed parameters to specify seeking time and mode. * the needed parameters to specify seeking time and mode.
* |[ * |[<!-- language="C" -->
* GstEvent *event; * GstEvent *event;
* gboolean result; * gboolean result;
* ... * ...
......
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
* categories. This is easily done with 3 lines. At the top of your code, * categories. This is easily done with 3 lines. At the top of your code,
* declare * declare
* the variables and set the default category. * the variables and set the default category.
* |[ * |[<!-- language="C" -->
* GST_DEBUG_CATEGORY_STATIC (my_category); // define category (statically) * GST_DEBUG_CATEGORY_STATIC (my_category); // define category (statically)
* #define GST_CAT_DEFAULT my_category // set as default * #define GST_CAT_DEFAULT my_category // set as default
* ]| * ]|
* After that you only need to initialize the category. * After that you only need to initialize the category.
* |[ * |[<!-- language="C" -->
* GST_DEBUG_CATEGORY_INIT (my_category, "my category", * GST_DEBUG_CATEGORY_INIT (my_category, "my category",
* 0, "This is my very own"); * 0, "This is my very own");
* ]| * ]|
......
...@@ -493,7 +493,7 @@ G_STMT_START{ \ ...@@ -493,7 +493,7 @@ G_STMT_START{ \
* category is not found, but GST_CAT_DEFAULT is defined, that is assigned to * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
* @cat. Otherwise @cat will be %NULL. * @cat. Otherwise @cat will be %NULL.
* *
* |[ * |[<!-- language="C" -->
* GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug); * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
* #define GST_CAT_DEFAULT gst_myplugin_debug * #define GST_CAT_DEFAULT gst_myplugin_debug
* GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* if it wants to continue using it later. * if it wants to continue using it later.
* *
* The basic use pattern of an iterator is as follows: * The basic use pattern of an iterator is as follows:
* |[ * |[<!-- language="C" -->
* GstIterator *it = _get_iterator(object); * GstIterator *it = _get_iterator(object);
* GValue item = G_VALUE_INIT; * GValue item = G_VALUE_INIT;
* done = FALSE; * done = FALSE;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* application using the #GstBus. * application using the #GstBus.
* *
* The basic use pattern of posting a message on a #GstBus is as follows: * The basic use pattern of posting a message on a #GstBus is as follows:
* |[ * |[<!-- language="C" -->
* gst_bus_post (bus, gst_message_new_eos()); * gst_bus_post (bus, gst_message_new_eos());
* ]| * ]|
* *
...@@ -994,7 +994,7 @@ gst_message_has_name (GstMessage * message, const gchar * name) ...@@ -994,7 +994,7 @@ gst_message_has_name (GstMessage * message, const gchar * name)
* output argument is a copy; the caller must free it when done. * output argument is a copy; the caller must free it when done.
* *
* Typical usage of this function might be: * Typical usage of this function might be:
* |[ * |[<!-- language="C" -->
* ... * ...
* switch (GST_MESSAGE_TYPE (msg)) { * switch (GST_MESSAGE_TYPE (msg)) {
* case GST_MESSAGE_TAG: { * case GST_MESSAGE_TAG: {
...@@ -1117,7 +1117,7 @@ gst_message_parse_buffering_stats (GstMessage * message, ...@@ -1117,7 +1117,7 @@ gst_message_parse_buffering_stats (GstMessage * message,
* Extracts the old and new states from the GstMessage. * Extracts the old and new states from the GstMessage.
* *
* Typical usage of this function might be: * Typical usage of this function might be:
* |[ * |[<!-- language="C" -->
* ... * ...
* switch (GST_MESSAGE_TYPE (msg)) { * switch (GST_MESSAGE_TYPE (msg)) {
* case GST_MESSAGE_STATE_CHANGED: { * case GST_MESSAGE_STATE_CHANGED: {
...@@ -1304,7 +1304,7 @@ gst_message_parse_structure_change (GstMessage * message, ...@@ -1304,7 +1304,7 @@ gst_message_parse_structure_change (GstMessage * message,
* in the output arguments are copies; the caller must free them when done. * in the output arguments are copies; the caller must free them when done.
* *
* Typical usage of this function might be: * Typical usage of this function might be:
* |[ * |[<!-- language="C" -->
* ... * ...
* switch (GST_MESSAGE_TYPE (msg)) { * switch (GST_MESSAGE_TYPE (msg)) {
* case GST_MESSAGE_ERROR: { * case GST_MESSAGE_ERROR: {
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
* (see gst_element_class_add_pad_template ()). * (see gst_element_class_add_pad_template ()).
* *
* The following code example shows the code to create a pad from a padtemplate. * The following code example shows the code to create a pad from a padtemplate.
* |[ * |[<!-- language="C" -->
* GstStaticPadTemplate my_template = * GstStaticPadTemplate my_template =
* GST_STATIC_PAD_TEMPLATE ( * GST_STATIC_PAD_TEMPLATE (
* "sink", // the name of the pad * "sink", // the name of the pad
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
* *
* The following example shows you how to add the padtemplate to an * The following example shows you how to add the padtemplate to an
* element class, this is usually done in the class_init of the class: * element class, this is usually done in the class_init of the class:
* |[ * |[<!-- language="C" -->
* static void * static void
* my_element_class_init (GstMyElementClass *klass) * my_element_class_init (GstMyElementClass *klass)
* { * {
......
...@@ -81,7 +81,7 @@ gst_plugin_feature_finalize (GObject * object) ...@@ -81,7 +81,7 @@ gst_plugin_feature_finalize (GObject * object)
* unaffected; use the return value instead. * unaffected; use the return value instead.
* *
* Normally this function is used like this: * Normally this function is used like this:
* |[ * |[<!-- language="C" -->
* GstPluginFeature *loaded_feature; * GstPluginFeature *loaded_feature;
* *
* loaded_feature = gst_plugin_feature_load (feature); * loaded_feature = gst_plugin_feature_load (feature);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* gst_query_parse_*() helpers. * gst_query_parse_*() helpers.
* *
* The following example shows how to query the duration of a pipeline: * The following example shows how to query the duration of a pipeline:
* |[ * |[<!-- language="C" -->
* GstQuery *query; * GstQuery *query;
* gboolean res; * gboolean res;
* query = gst_query_new_duration (GST_FORMAT_TIME); * query = gst_query_new_duration (GST_FORMAT_TIME);
......
...@@ -1993,7 +1993,7 @@ priv__gst_structure_append_template_to_gstring (GQuark field_id, ...@@ -1993,7 +1993,7 @@ priv__gst_structure_append_template_to_gstring (GQuark field_id,
* Converts @structure to a human-readable string representation. * Converts @structure to a human-readable string representation.
* *
* For debugging purposes its easier to do something like this: * For debugging purposes its easier to do something like this:
* |[ * |[<!-- language="C" -->
* GST_LOG ("structure is %" GST_PTR_FORMAT, structure); * GST_LOG ("structure is %" GST_PTR_FORMAT, structure);
* ]| * ]|
* This prints the structure in human readable form. * This prints the structure in human readable form.
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* any tags received from upstream and the tags set by the application via * any tags received from upstream and the tags set by the application via
* the interface. This can be done like this: * the interface. This can be done like this:
* *
* |[ * |[<!-- language="C" -->
* GstTagMergeMode merge_mode; * GstTagMergeMode merge_mode;
* const GstTagList *application_tags; * const GstTagList *application_tags;
* const GstTagList *event_tags; * const GstTagList *event_tags;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* The following example shows how to write a very simple typefinder that * The following example shows how to write a very simple typefinder that
* identifies the given data. You can get quite a bit more complicated than * identifies the given data. You can get quite a bit more complicated than
* that though. * that though.
* |[ * |[<!-- language="C" -->
* typedef struct { * typedef struct {
* guint8 *data; * guint8 *data;
* guint size; * guint size;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* *
* For example, a sink pad's chain function that needs to pass data to a library * For example, a sink pad's chain function that needs to pass data to a library
* in 512-byte chunks could be implemented like this: * in 512-byte chunks could be implemented like this:
* |[ * |[<!-- language="C" -->
* static GstFlowReturn * static GstFlowReturn
* sink_pad_chain (GstPad *pad, GstObject *parent, GstBuffer *buffer) * sink_pad_chain (GstPad *pad, GstObject *parent, GstBuffer *buffer)
* { * {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* #GstBaseSink provides support for exactly one sink pad, which should be * #GstBaseSink provides support for exactly one sink pad, which should be
* named "sink". A sink implementation (subclass of #GstBaseSink) should * named "sink". A sink implementation (subclass of #GstBaseSink) should
* install a pad template in its class_init function, like so: * install a pad template in its class_init function, like so:
* |[ * |[<!-- language="C" -->
* static void * static void
* my_element_class_init (GstMyElementClass *klass) * my_element_class_init (GstMyElementClass *klass)
* { * {
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
* There is only support in #GstBaseSrc for exactly one source pad, which * There is only support in #GstBaseSrc for exactly one source pad, which
* should be named "src". A source implementation (subclass of #GstBaseSrc) * should be named "src". A source implementation (subclass of #GstBaseSrc)
* should install a pad template in its class_init function, like so: * should install a pad template in its class_init function, like so:
* |[ * |[<!-- language="C" -->
* static void * static void
* my_element_class_init (GstMyElementClass *klass) * my_element_class_init (GstMyElementClass *klass)
* { * {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment