validate:tools: Add a 'discover-only' option to media-check

This commit is contained in:
Thibault Saunier 2014-01-29 17:37:57 +01:00
parent a61ebe671e
commit a406ebb4c2
3 changed files with 33 additions and 19 deletions

View file

@ -92,6 +92,7 @@ gst_validate_media_info_init (GstValidateMediaInfo * mi)
mi->reverse_playback_error = NULL;
mi->track_switch_error = NULL;
mi->is_image = FALSE;
mi->discover_only = FALSE;
}
void
@ -1064,7 +1065,7 @@ check_is_image (GstDiscovererInfo *info)
gboolean
gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi,
const gchar * uri, GError ** err)
const gchar * uri, gboolean discover_only, GError ** err)
{
GstDiscovererInfo *info;
GstDiscoverer *discoverer = gst_discoverer_new (GST_SECOND * 60, err);
@ -1094,7 +1095,10 @@ gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi,
if (mi->is_image)
goto done;
ret = check_seekable (mi, info) & ret;
check_seekable (mi, info);
if (discover_only)
goto done;
ret = check_playback (mi, &mi->playback_error) & ret;
ret = check_reverse_playback (mi, &mi->reverse_playback_error) & ret;
ret = check_track_selection (mi, &mi->track_switch_error) & ret;
@ -1125,21 +1129,25 @@ gst_validate_media_info_compare (GstValidateMediaInfo * expected,
g_print ("File isn't seekable anymore\n");
ret = FALSE;
}
if (expected->playback_error == NULL && extracted->playback_error) {
g_print ("Playback is now failing with: %s\n", extracted->playback_error);
ret = FALSE;
}
if (expected->reverse_playback_error == NULL
&& extracted->reverse_playback_error) {
g_print ("Reverse playback is now failing with: %s\n",
extracted->reverse_playback_error);
ret = FALSE;
}
if (expected->track_switch_error == NULL && extracted->track_switch_error) {
g_print ("Track switching is now failing with: %s\n",
extracted->track_switch_error);
ret = FALSE;
if (extracted->discover_only == FALSE) {
if (expected->playback_error == NULL && extracted->playback_error) {
g_print ("Playback is now failing with: %s\n", extracted->playback_error);
ret = FALSE;
}
if (expected->reverse_playback_error == NULL
&& extracted->reverse_playback_error) {
g_print ("Reverse playback is now failing with: %s\n",
extracted->reverse_playback_error);
ret = FALSE;
}
if (expected->track_switch_error == NULL && extracted->track_switch_error) {
g_print ("Track switching is now failing with: %s\n",
extracted->track_switch_error);
ret = FALSE;
}
}
if (expected->stream_info
&& !gst_caps_is_equal_fixed (expected->stream_info->caps,
extracted->stream_info->caps)) {

View file

@ -56,6 +56,8 @@ struct _GstValidateMediaInfo {
gchar *uri;
gboolean discover_only;
GstValidateStreamInfo *stream_info;
};
@ -67,7 +69,8 @@ gchar * gst_validate_media_info_to_string (GstValidateMediaInfo * mi, gsize * le
gboolean gst_validate_media_info_save (GstValidateMediaInfo * mi, const gchar * path, GError ** err);
GstValidateMediaInfo * gst_validate_media_info_load (const gchar * path, GError ** err);
gboolean gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi, const gchar * uri, GError ** err);
gboolean gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi, const gchar * uri,
gboolean discover_only, GError ** err);
gboolean gst_validate_media_info_compare (GstValidateMediaInfo * expected, GstValidateMediaInfo * extracted);

View file

@ -171,7 +171,7 @@ main (int argc, gchar ** argv)
gchar *expected_file = NULL;
gchar *output = NULL;
gsize outputlength;
gboolean ret;
gboolean ret, discover_only;
GOptionEntry options[] = {
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME,
@ -181,6 +181,9 @@ main (int argc, gchar ** argv)
&expected_file, "Path to file containing the expected results "
"(or the last results found) for comparison with new results",
NULL},
{"discover-only", 'e', 0, G_OPTION_ARG_NONE,
&discover_only, "Only discover files, no other playback tests",
NULL},
{NULL}
};
@ -213,7 +216,7 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx);
gst_validate_media_info_init (&mi);
ret = gst_validate_media_info_inspect_uri (&mi, argv[1], NULL);
ret = gst_validate_media_info_inspect_uri (&mi, argv[1], discover_only, NULL);
output = gst_validate_media_info_to_string (&mi, &outputlength);
if (output_file)