message: rename category to code

This commit is contained in:
Wim Taymans 2011-01-06 18:55:43 +01:00
parent 37fbb5e20f
commit ec1bbd36bf
5 changed files with 21 additions and 21 deletions

View file

@ -33,7 +33,7 @@ The main reason for adding these extra progress notifications is twofold:
1) to give the application more information of what is going on 1) to give the application more information of what is going on
When there are well defined progress information categories, applications When there are well defined progress information codes, applications
can let the user know about the status of the progress. We anticipate to can let the user know about the status of the progress. We anticipate to
have at least DNS resolving and server connections and requests be well have at least DNS resolving and server connections and requests be well
defined. defined.
@ -140,10 +140,10 @@ Messages
an error, an error message will have been posted before. an error, an error message will have been posted before.
GST_PROGRESS_TYPE_COMPLETE: A task completed successfully. GST_PROGRESS_TYPE_COMPLETE: A task completed successfully.
- "category", G_TYPE_STRING - "code", G_TYPE_STRING
A generic extensible string that can be used to programatically determine the A generic extensible string that can be used to programatically determine the
action that is in progress. Some standard predefined categories will be action that is in progress. Some standard predefined codes will be
defined. defined.
- "text", G_TYPE_STRING - "text", G_TYPE_STRING
@ -160,7 +160,7 @@ Messages
- .... - ....
Depending on the category, more fields can be put here. Depending on the code, more fields can be put here.
Implementation Implementation
@ -168,7 +168,7 @@ Implementation
Elements should not do blocking operations from the state change function. Elements should not do blocking operations from the state change function.
Instead, elements should post an appropriate progress message with the right Instead, elements should post an appropriate progress message with the right
category and of type GST_PROGRESS_TYPE_START and then start a thread to perform code and of type GST_PROGRESS_TYPE_START and then start a thread to perform
the blocking calls in a cancelable manner. the blocking calls in a cancelable manner.
It is highly recommended to only start async operations from the READY to PAUSED It is highly recommended to only start async operations from the READY to PAUSED
@ -180,7 +180,7 @@ the presence of devices.
The progress message needs to be posted from the state change function so that The progress message needs to be posted from the state change function so that
the application can immediately take appropriate action after setting the state. the application can immediately take appropriate action after setting the state.
The threads will usually perform many blocking calls with different categories The threads will usually perform many blocking calls with different codes
in a row, a client might first do a DNS query and then continue with in a row, a client might first do a DNS query and then continue with
establishing a connection to the server. For this purpose the establishing a connection to the server. For this purpose the
GST_PROGRESS_TYPE_CONTINUE must be used. GST_PROGRESS_TYPE_CONTINUE must be used.
@ -205,7 +205,7 @@ GST_PROGRESS_TYPE_ERROR progress message.
Categories Categories
~~~~~~~~~~ ~~~~~~~~~~
We want to propose some standard categories here: We want to propose some standard codes here:
"open" : A resource is being opened "open" : A resource is being opened
"close" : A resource is being closed "close" : A resource is being closed
@ -224,4 +224,4 @@ Categories
"unmount" : A volume is being unmounted "unmount" : A volume is being unmounted
More categories can be posted by elements and can be made official later. More codes can be posted by elements and can be made official later.

View file

@ -2085,13 +2085,13 @@ gst_message_parse_qos_stats (GstMessage * message, GstFormat * format,
* gst_message_new_progress: * gst_message_new_progress:
* @src: The object originating the message. * @src: The object originating the message.
* @type: a #GstProgressType * @type: a #GstProgressType
* @category: a progress category * @code: a progress code
* @text: free, user visible text describing the progress * @text: free, user visible text describing the progress
* *
* Progress messages are posted by elements when they use an asynchronous task * Progress messages are posted by elements when they use an asynchronous task
* to perform actions triggered by a state change. * to perform actions triggered by a state change.
* *
* @category contains a well defined string describing the action. * @code contains a well defined string describing the action.
* @test should contain a user visible string detailing the current action. * @test should contain a user visible string detailing the current action.
* *
* Returns: (transfer full): The new qos message. * Returns: (transfer full): The new qos message.
@ -2100,13 +2100,13 @@ gst_message_parse_qos_stats (GstMessage * message, GstFormat * format,
*/ */
GstMessage * GstMessage *
gst_message_new_progress (GstObject * src, GstProgressType type, gst_message_new_progress (GstObject * src, GstProgressType type,
const gchar * category, const gchar * text) const gchar * code, const gchar * text)
{ {
GstMessage *message; GstMessage *message;
GstStructure *structure; GstStructure *structure;
gint percent = 100; gint percent = 100;
g_return_val_if_fail (category != NULL, NULL); g_return_val_if_fail (code != NULL, NULL);
g_return_val_if_fail (text != NULL, NULL); g_return_val_if_fail (text != NULL, NULL);
if (type == GST_PROGRESS_TYPE_START || type == GST_PROGRESS_TYPE_CONTINUE) if (type == GST_PROGRESS_TYPE_START || type == GST_PROGRESS_TYPE_CONTINUE)
@ -2114,7 +2114,7 @@ gst_message_new_progress (GstObject * src, GstProgressType type,
structure = gst_structure_id_new (GST_QUARK (MESSAGE_PROGRESS), structure = gst_structure_id_new (GST_QUARK (MESSAGE_PROGRESS),
GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type, GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type,
GST_QUARK (CATEGORY), G_TYPE_STRING, category, GST_QUARK (CODE), G_TYPE_STRING, code,
GST_QUARK (TEXT), G_TYPE_STRING, text, GST_QUARK (TEXT), G_TYPE_STRING, text,
GST_QUARK (PERCENT), G_TYPE_INT, percent, NULL); GST_QUARK (PERCENT), G_TYPE_INT, percent, NULL);
message = gst_message_new_custom (GST_MESSAGE_PROGRESS, src, structure); message = gst_message_new_custom (GST_MESSAGE_PROGRESS, src, structure);
@ -2126,22 +2126,22 @@ gst_message_new_progress (GstObject * src, GstProgressType type,
* gst_message_parse_progress: * gst_message_parse_progress:
* @message: A valid #GstMessage of type GST_MESSAGE_PROGRESS. * @message: A valid #GstMessage of type GST_MESSAGE_PROGRESS.
* @type: (out) (allow-none): location for the type * @type: (out) (allow-none): location for the type
* @category: (out) (allow-none) (transfer full): location for the category * @code: (out) (allow-none) (transfer full): location for the code
* @text: (out) (allow-none) (transfer full): location for the text * @text: (out) (allow-none) (transfer full): location for the text
* *
* Parses the progress @type, @category and @text. * Parses the progress @type, @code and @text.
* *
* Since: 0.10.33 * Since: 0.10.33
*/ */
void void
gst_message_parse_progress (GstMessage * message, GstProgressType * type, gst_message_parse_progress (GstMessage * message, GstProgressType * type,
gchar ** category, gchar ** text) gchar ** code, gchar ** text)
{ {
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS);
gst_structure_id_get (message->structure, gst_structure_id_get (message->structure,
GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type, GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type,
GST_QUARK (CATEGORY), G_TYPE_STRING, category, GST_QUARK (CODE), G_TYPE_STRING, code,
GST_QUARK (TEXT), G_TYPE_STRING, text, NULL); GST_QUARK (TEXT), G_TYPE_STRING, text, NULL);
} }

View file

@ -517,9 +517,9 @@ void gst_message_parse_qos_values (GstMessage * message, gint64 *
void gst_message_parse_qos_stats (GstMessage * message, GstFormat * format, guint64 * processed, void gst_message_parse_qos_stats (GstMessage * message, GstFormat * format, guint64 * processed,
guint64 * dropped); guint64 * dropped);
/* PROGRESS */ /* PROGRESS */
GstMessage * gst_message_new_progress (GstObject * src, GstProgressType type, const gchar *category, GstMessage * gst_message_new_progress (GstObject * src, GstProgressType type, const gchar *code,
const gchar *text); const gchar *text);
void gst_message_parse_progress (GstMessage * message, GstProgressType * type, gchar ** category, void gst_message_parse_progress (GstMessage * message, GstProgressType * type, gchar ** code,
gchar ** text); gchar ** text);

View file

@ -50,7 +50,7 @@ static const gchar *_quark_strings[] = {
"intermediate", "GstMessageStepStart", "active", "eos", "sink-message", "intermediate", "GstMessageStepStart", "active", "eos", "sink-message",
"message", "GstMessageQOS", "running-time", "stream-time", "jitter", "message", "GstMessageQOS", "running-time", "stream-time", "jitter",
"quality", "processed", "dropped", "buffering-ranges", "GstMessageProgress", "quality", "processed", "dropped", "buffering-ranges", "GstMessageProgress",
"category", "text", "percent" "code", "text", "percent"
}; };
GQuark _priv_gst_quark_table[GST_QUARK_MAX]; GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -128,7 +128,7 @@ typedef enum _GstQuarkId
GST_QUARK_DROPPED = 99, GST_QUARK_DROPPED = 99,
GST_QUARK_BUFFERING_RANGES = 100, GST_QUARK_BUFFERING_RANGES = 100,
GST_QUARK_MESSAGE_PROGRESS = 101, GST_QUARK_MESSAGE_PROGRESS = 101,
GST_QUARK_CATEGORY = 102, GST_QUARK_CODE = 102,
GST_QUARK_TEXT = 103, GST_QUARK_TEXT = 103,
GST_QUARK_PERCENT = 104, GST_QUARK_PERCENT = 104,