validate: report: Simplify the issue ID registering using GQuarks

+ Remove unused issue types

https://bugzilla.gnome.org/show_bug.cgi?id=737790
This commit is contained in:
Thibault Saunier 2014-10-02 15:34:28 +02:00 committed by Mathieu Duponchelle
parent bb93dbb9fb
commit 8ec61ddac2
7 changed files with 82 additions and 176 deletions

View file

@ -40,7 +40,7 @@ gst_validate_create_overrides (void)
gst-launch videotestsrc num-buffers=10 ! video/x-raw-yuv ! fakesink */
o = gst_validate_override_new ();
gst_validate_override_change_severity (o,
GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD,
g_quark_from_string ("caps::is-missing-field"),
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
gst_validate_override_register_by_name ("capsfilter0", o);
return 1;

View file

@ -233,10 +233,6 @@ check_file_size (GstValidateMediaInfo * mi)
filepath = g_filename_from_uri (mi->uri, NULL, &err);
if (!filepath) {
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND,
"Failed to get filepath from uri %s. %s", fc->uri, err->message);
#endif
g_error_free (err);
return FALSE;
}
@ -244,10 +240,6 @@ check_file_size (GstValidateMediaInfo * mi)
if (g_stat (filepath, &statbuf) == 0) {
size = statbuf.st_size;
} else {
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND,
"Failed to get file stats from uri %s", fc->uri);
#endif
ret = FALSE;
goto end;
}
@ -531,10 +523,6 @@ check_playback_scenario (GstValidateMediaInfo * mi,
if (!playbin || !videosink || !audiosink) {
*error_message = g_strdup ("Playbin and/or fakesink not available");
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN,
"file check requires " "playbin and fakesink to be available");
#endif
}
g_object_set (playbin, "video-sink", videosink, "audio-sink", audiosink,
@ -544,10 +532,6 @@ check_playback_scenario (GstValidateMediaInfo * mi,
state_ret = gst_element_set_state (playbin, GST_STATE_PAUSED);
if (state_ret == GST_STATE_CHANGE_FAILURE) {
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
"Failed to " "change pipeline state to playing");
#endif
*error_message = g_strdup ("Failed to change pipeline to paused");
ret = FALSE;
goto end;
@ -590,11 +574,6 @@ check_playback_scenario (GstValidateMediaInfo * mi,
gst_message_parse_error (msg, &error, &debug);
*error_message = g_strdup_printf ("Playback error: %s : %s",
error->message, debug);
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
"%s - File %s failed " "during playback. Error: %s : %s",
messages_prefix, fc->uri, error->message, debug);
#endif
g_error_free (error);
g_free (debug);
@ -606,10 +585,6 @@ check_playback_scenario (GstValidateMediaInfo * mi,
} else {
ret = FALSE;
*error_message = g_strdup ("Playback finihshed unexpectedly");
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR, "%s - "
"File playback finished unexpectedly", messages_prefix);
#endif
}
end:
@ -637,10 +612,6 @@ send_reverse_seek (GstValidateMediaInfo * mi, GstElement * pipeline,
if (!ret) {
*msg = g_strdup ("Reverse playback seek failed");
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
"Reverse playback seek failed");
#endif
}
return ret;
}
@ -910,10 +881,6 @@ check_track_selection (GstValidateMediaInfo * mi, gchar ** error_message)
if (!playbin || !videosink || !audiosink) {
*error_message = g_strdup ("Playbin and/or fakesink not available");
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN,
"file check requires " "playbin and fakesink to be available");
#endif
}
g_object_set (playbin, "video-sink", videosink, "audio-sink", audiosink,
@ -925,10 +892,6 @@ check_track_selection (GstValidateMediaInfo * mi, gchar ** error_message)
state_ret = gst_element_set_state (playbin, GST_STATE_PAUSED);
if (state_ret == GST_STATE_CHANGE_FAILURE) {
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
"Failed to " "change pipeline state to playing");
#endif
*error_message = g_strdup ("Failed to change pipeline to paused");
ret = FALSE;
goto end;
@ -990,11 +953,6 @@ check_track_selection (GstValidateMediaInfo * mi, gchar ** error_message)
gst_message_parse_error (msg, &error, &debug);
*error_message = g_strdup_printf ("Playback error: %s : %s",
error->message, debug);
#if 0
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
"%s - File %s failed " "during playback. Error: %s : %s",
messages_prefix, fc->uri, error->message, debug);
#endif
g_error_free (error);
g_free (debug);

View file

@ -75,11 +75,17 @@ gst_validate_issue_new (GstValidateIssueId issue_id, const gchar * summary,
const gchar * description, GstValidateReportLevel default_level)
{
GstValidateIssue *issue = g_slice_new (GstValidateIssue);
gchar **area_name = g_strsplit (g_quark_to_string (issue_id), "::", 2);
g_return_val_if_fail (area_name[0] != NULL && area_name[1] != 0 &&
area_name[2] == NULL, NULL);
issue->issue_id = issue_id;
issue->summary = g_strdup (summary);
issue->description = g_strdup (description);
issue->default_level = default_level;
issue->area = area_name[0];
issue->name = area_name[1];
return issue;
}
@ -89,6 +95,9 @@ gst_validate_issue_free (GstValidateIssue * issue)
{
g_free (issue->summary);
g_free (issue->description);
/* We are using an string array for area and name */
g_strfreev (&issue->area);
g_slice_free (GstValidateIssue, issue);
}
@ -103,7 +112,7 @@ gst_validate_issue_register (GstValidateIssue * issue)
}
#define REGISTER_VALIDATE_ISSUE(lvl,id,sum,desc) \
gst_validate_issue_register (gst_validate_issue_new (GST_VALIDATE_ISSUE_ID_##id, \
gst_validate_issue_register (gst_validate_issue_new (id, \
sum, desc, GST_VALIDATE_REPORT_LEVEL_##lvl))
static void
gst_validate_report_load_issues (void)
@ -208,29 +217,20 @@ gst_validate_report_load_issues (void)
REGISTER_VALIDATE_ISSUE (CRITICAL, STATE_CHANGE_FAILURE,
_("state change failed"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_SIZE_IS_ZERO,
_("resulting file size is 0"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, FILE_SIZE_INCORRECT,
_("resulting file size wasn't within the expected values"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, FILE_DURATION_INCORRECT,
_("resulting file duration wasn't within the expected values"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, FILE_SEEKABLE_INCORRECT,
_("resulting file wasn't seekable or not seekable as expected"), NULL);
REGISTER_VALIDATE_ISSUE (ISSUE, FILE_TAG_DETECTION_INCORRECT,
_("detected tags are different than expected ones"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_PROFILE_INCORRECT,
_("resulting file stream profiles didn't match expected values"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_NOT_FOUND,
_("resulting file could not be found for testing"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_CHECK_FAILURE,
_("an error occured while checking the file for conformance"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_PLAYBACK_START_FAILURE,
_("an error occured while starting playback of the test file"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, FILE_PLAYBACK_ERROR,
_("an error during playback of the file"), NULL);
REGISTER_VALIDATE_ISSUE (ISSUE, FILE_TAG_DETECTION_INCORRECT,
_("detected tags are different than expected ones"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, FILE_NO_STREAM_ID,
_("the discoverer found a stream that had no stream ID"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, ALLOCATION_FAILURE,
_("a memory allocation failed during Validate run"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, MISSING_PLUGIN,
@ -353,36 +353,6 @@ gst_validate_report_level_get_name (GstValidateReportLevel level)
}
}
const gchar *
gst_validate_report_area_get_name (GstValidateReportArea area)
{
switch (area) {
case GST_VALIDATE_AREA_EVENT:
return "event";
case GST_VALIDATE_AREA_BUFFER:
return "buffer";
case GST_VALIDATE_AREA_QUERY:
return "query";
case GST_VALIDATE_AREA_CAPS:
return "caps";
case GST_VALIDATE_AREA_SEEK:
return "seek";
case GST_VALIDATE_AREA_STATE:
return "state";
case GST_VALIDATE_AREA_FILE_CHECK:
return "file-check";
case GST_VALIDATE_AREA_RUN_ERROR:
return "run-error";
case GST_VALIDATE_AREA_OTHER:
return "other";
case GST_VALIDATE_AREA_SCENARIO:
return "scenario";
default:
g_assert_not_reached ();
return "unknown";
}
}
gboolean
gst_validate_report_should_print (GstValidateReport * report)
{

View file

@ -53,81 +53,57 @@ typedef enum {
GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES,
} GstValidateReportLevel;
typedef enum {
GST_VALIDATE_AREA_EVENT=1,
GST_VALIDATE_AREA_BUFFER,
GST_VALIDATE_AREA_QUERY,
GST_VALIDATE_AREA_CAPS,
GST_VALIDATE_AREA_SEEK,
GST_VALIDATE_AREA_STATE,
GST_VALIDATE_AREA_FILE_CHECK,
GST_VALIDATE_AREA_SCENARIO,
GST_VALIDATE_AREA_RUN_ERROR,
GST_VALIDATE_AREA_OTHER=100,
} GstValidateReportArea;
#define _QUARK g_quark_from_static_string
#define GST_VALIDATE_ISSUE_ID_UNKNOWN 0
#define BUFFER_BEFORE_SEGMENT _QUARK("buffer::before-segment")
#define BUFFER_IS_OUT_OF_SEGMENT _QUARK("buffer::is-out-of-segment")
#define BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE _QUARK("buffer::timestamp-out-of-received-range")
#define FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO _QUARK("buffer::first-buffer-running-time-is-not-zero")
#define WRONG_FLOW_RETURN _QUARK("buffer::wrong-flow-return")
#define BUFFER_AFTER_EOS _QUARK("buffer::after-eos")
#define WRONG_BUFFER _QUARK("buffer::not-expected-one")
#define GST_VALIDATE_ISSUE_ID_SHIFT 16
#define GST_VALIDATE_ISSUE_ID_CUSTOM_FIRST (2 << 15)
#define CAPS_IS_MISSING_FIELD _QUARK("caps::is-missing-field")
#define CAPS_FIELD_HAS_BAD_TYPE _QUARK("caps::field-has-bad-type")
#define CAPS_EXPECTED_FIELD_NOT_FOUND _QUARK("caps::expected-field-not-found")
#define GET_CAPS_NOT_PROXYING_FIELDS _QUARK("caps::not-proxying-fields")
#define CAPS_FIELD_UNEXPECTED_VALUE _QUARK("caps::field-unexpected-value")
#define GST_VALIDATE_ISSUE_ID_BUFFER_BEFORE_SEGMENT (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_WRONG_FLOW_RETURN (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_BUFFER_AFTER_EOS (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_WRONG_BUFFER (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define EVENT_NEWSEGMENT_NOT_PUSHED _QUARK("event::newsegment-not-pushed")
#define SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME _QUARK("event::serialized-event-wasnt-pushed-in-time")
#define EVENT_HAS_WRONG_SEQNUM _QUARK("event::has-wrong-seqnum")
#define EVENT_SERIALIZED_OUT_OF_ORDER _QUARK("event::serialized-out-of-order")
#define EVENT_NEW_SEGMENT_MISMATCH _QUARK("event::segment-mismatch")
#define EVENT_FLUSH_START_UNEXPECTED _QUARK("event::flush-start-unexpected")
#define EVENT_FLUSH_STOP_UNEXPECTED _QUARK("event::flush-stop-unexpected")
#define EVENT_CAPS_DUPLICATE _QUARK("event::caps-duplicate")
#define EVENT_SEEK_NOT_HANDLED _QUARK("event::seek-not-handled")
#define EVENT_SEEK_RESULT_POSITION_WRONG _QUARK("event::seek-result-position-wrong")
#define GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_CAPS_EXPECTED_FIELD_NOT_FOUND (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_GET_CAPS_NOT_PROXYING_FIELDS (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_CAPS_FIELD_UNEXPECTED_VALUE (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define STATE_CHANGE_FAILURE _QUARK("state::change-failure")
#define GST_VALIDATE_ISSUE_ID_EVENT_NEWSEGMENT_NOT_PUSHED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_EVENT_HAS_WRONG_SEQNUM (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_EVENT_SERIALIZED_OUT_OF_ORDER (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define GST_VALIDATE_ISSUE_ID_EVENT_CAPS_DUPLICATE (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 8)
#define FILE_NO_STREAM_ID _QUARK("file-checking::no-stream-id")
#define FILE_TAG_DETECTION_INCORRECT _QUARK("file-checking::tag-detection-incorrect")
#define FILE_SIZE_INCORRECT _QUARK("file-checking::size-incorrect")
#define FILE_DURATION_INCORRECT _QUARK("file-checking::duration-incorrect")
#define FILE_SEEKABLE_INCORRECT _QUARK("file-checking::seekable-incorrect")
#define FILE_PROFILE_INCORRECT _QUARK("file-checking::profile-incorrect")
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define ALLOCATION_FAILURE _QUARK("runtime::allocation-failure")
#define MISSING_PLUGIN _QUARK("runtime::missing-plugin")
#define WARNING_ON_BUS _QUARK("runtime::warning-on-bus")
#define ERROR_ON_BUS _QUARK("runtime::error-on-bus")
#define GST_VALIDATE_ISSUE_ID_STATE_CHANGE_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_STATE) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define QUERY_POSITION_SUPERIOR_DURATION _QUARK("query::position-superior-duration")
#define QUERY_POSITION_OUT_OF_SEGMENT _QUARK("query::position-out-of-segment")
#define GST_VALIDATE_ISSUE_ID_FILE_SIZE_IS_ZERO (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_FILE_SIZE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_FILE_DURATION_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_FILE_SEEKABLE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_FILE_PROFILE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_FILE_CHECK_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 8)
#define GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 9)
#define GST_VALIDATE_ISSUE_ID_FILE_NO_STREAM_ID (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 10)
#define GST_VALIDATE_ISSUE_ID_FILE_TAG_DETECTION_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 11)
#define SCENARIO_NOT_ENDED _QUARK("scenario::not-ended")
#define SCENARIO_ACTION_EXECUTION_ERROR _QUARK("scenario::execution-error")
#define SCENARIO_ACTION_EXECUTION_ISSUE _QUARK("scenario::execution-issue")
#define GST_VALIDATE_ISSUE_ID_ALLOCATION_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_WARNING_ON_BUS (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_ERROR_ON_BUS (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_QUERY_POSITION_SUPERIOR_DURATION (((GstValidateIssueId) GST_VALIDATE_AREA_QUERY) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_QUERY_POSITION_OUT_OF_SEGMENT (((GstValidateIssueId) GST_VALIDATE_AREA_QUERY) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_SCENARIO_NOT_ENDED (((GstValidateIssueId) GST_VALIDATE_AREA_SCENARIO) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_SCENARIO_ACTION_EXECUTION_ERROR (((GstValidateIssueId) GST_VALIDATE_AREA_SCENARIO) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_SCENARIO_ACTION_EXECUTION_ISSUE (((GstValidateIssueId) GST_VALIDATE_AREA_SCENARIO) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_G_LOG_ISSUE (((GstValidateIssueId) GST_VALIDATE_AREA_OTHER) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_G_LOG_WARNING (((GstValidateIssueId) GST_VALIDATE_AREA_OTHER) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_G_LOG_CRITICAL (((GstValidateIssueId) GST_VALIDATE_AREA_OTHER) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_AREA(id) ((guintptr)(id >> GST_VALIDATE_ISSUE_ID_SHIFT))
#define G_LOG_ISSUE _QUARK("g-log::issue")
#define G_LOG_WARNING _QUARK("g-log::warning")
#define G_LOG_CRITICAL _QUARK("g-log::critical")
typedef struct {
GstValidateIssueId issue_id;
@ -141,14 +117,18 @@ typedef struct {
*/
gchar *description;
/* The name of the area of issue
* this one is in */
gchar *area;
/* The name of the issue type */
gchar *name;
/* default_level: The default level of severity for this
* issue. */
GstValidateReportLevel default_level;
} GstValidateIssue;
#define GST_VALIDATE_ISSUE_AREA(i) (GST_VALIDATE_ISSUE_ID_AREA (gst_validate_issue_get_id (i)))
struct _GstValidateReport {
gint refcount;
@ -156,10 +136,10 @@ struct _GstValidateReport {
GstValidateIssue *issue;
GstValidateReportLevel level;
/* The reporter that reported the issue (to get names, info, ...) */
GstValidateReporter *reporter;
/* timestamp: The time at which this issue happened since
* the process start (to stay in sync with gst logging) */
GstClockTime timestamp;
@ -181,10 +161,14 @@ struct _GstValidateReport {
GstValidateReportingLevel reporting_level;
};
#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s(%" G_GUINTPTR_FORMAT "): %s"
#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), gst_validate_report_level_get_name (i->default_level), \
gst_validate_report_area_get_name (GST_VALIDATE_ISSUE_AREA (i)), GST_VALIDATE_ISSUE_AREA (i), \
i->summary
void gst_validate_report_add_message (GstValidateReport *report,
const gchar *message);
#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s: %s"
#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), \
gst_validate_report_level_get_name (i->default_level), \
i->area, \
i->summary
#define GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT " <%s>: %" GST_VALIDATE_ISSUE_FORMAT ": %s"
#define GST_VALIDATE_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
@ -201,8 +185,8 @@ GstValidateIssue *gst_validate_issue_new (GstValidateIssueId issue_id, const gc
GstValidateReportLevel default_level);
GstValidateReport *gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter,
const gchar * message);
GstValidateReporter * reporter,
const gchar * message);
void gst_validate_report_unref (GstValidateReport * report);
GstValidateReport *gst_validate_report_ref (GstValidateReport * report);
@ -216,8 +200,6 @@ void gst_validate_report_print_details (GstValidateReport *report)
void gst_validate_report_print_description (GstValidateReport *report);
const gchar * gst_validate_report_level_get_name (GstValidateReportLevel level);
const gchar * gst_validate_report_area_get_name (GstValidateReportArea area);
const gchar * gst_validate_report_subarea_get_name (GstValidateReportArea area, gint subarea);
void gst_validate_printf (gpointer source,
const gchar * format,

View file

@ -41,7 +41,7 @@ G_BEGIN_DECLS
#define GST_VALIDATE_REPORT(m, issue_id, ...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), \
GST_VALIDATE_ISSUE_ID_##issue_id, \
issue_id, \
__VA_ARGS__ ); \
} G_STMT_END
@ -50,7 +50,7 @@ G_BEGIN_DECLS
#define GST_VALIDATE_REPORT(m, issue_id, args...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), \
GST_VALIDATE_ISSUE_ID_##issue_id, ##args ); \
issue_id, ##args ); \
} G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */

View file

@ -297,7 +297,7 @@ _find_stream_id (GstPad * pad, GstEvent ** event,
}
if (!snode || snode->pad) {
GST_VALIDATE_REPORT (writer, FILE_CHECK_FAILURE,
GST_VALIDATE_REPORT (writer, FILE_NO_STREAM_ID,
"Got pad %s:%s where Discoverer found no stream ID",
GST_DEBUG_PAD_NAME (pad));

View file

@ -78,8 +78,7 @@ GST_START_TEST (buffer_before_segment)
assert_equals_int (g_list_length (reports), 1);
report = reports->data;
fail_unless_equals_int (report->level, GST_VALIDATE_REPORT_LEVEL_WARNING);
fail_unless_equals_int (report->issue->issue_id,
GST_VALIDATE_ISSUE_ID_BUFFER_BEFORE_SEGMENT);
fail_unless_equals_int (report->issue->issue_id, BUFFER_BEFORE_SEGMENT);
g_list_free_full (reports, (GDestroyNotify) gst_validate_report_unref);
}
@ -165,8 +164,7 @@ GST_START_TEST (buffer_outside_segment)
assert_equals_int (g_list_length (reports), 1);
report = reports->data;
fail_unless_equals_int (report->level, GST_VALIDATE_REPORT_LEVEL_ISSUE);
fail_unless_equals_int (report->issue->issue_id,
GST_VALIDATE_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT);
fail_unless_equals_int (report->issue->issue_id, BUFFER_IS_OUT_OF_SEGMENT);
g_list_free_full (reports, (GDestroyNotify) gst_validate_report_unref);
}
@ -243,7 +241,7 @@ _first_buffer_running_time (gboolean failing)
report = reports->data;
fail_unless_equals_int (report->level, GST_VALIDATE_REPORT_LEVEL_WARNING);
fail_unless_equals_int (report->issue->issue_id,
GST_VALIDATE_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO);
FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO);
} else {
assert_equals_int (g_list_length (reports), 0);
}
@ -357,8 +355,7 @@ _test_flow_aggregation (GstFlowReturn flow, GstFlowReturn flow1,
assert_equals_int (g_list_length (reports), 1);
report = reports->data;
fail_unless_equals_int (report->level, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
fail_unless_equals_int (report->issue->issue_id,
GST_VALIDATE_ISSUE_ID_WRONG_FLOW_RETURN);
fail_unless_equals_int (report->issue->issue_id, WRONG_FLOW_RETURN);
} else {
assert_equals_int (g_list_length (reports), 0);
@ -663,8 +660,7 @@ _check_media_info (GstSegment * segment, BufferDesc * bufs)
fail_unless_equals_int (report->level,
GST_VALIDATE_REPORT_LEVEL_WARNING);
fail_unless_equals_int (report->issue->issue_id,
GST_VALIDATE_ISSUE_ID_WRONG_BUFFER);
fail_unless_equals_int (report->issue->issue_id, WRONG_BUFFER);
tmp = tmp->next;
}
}