/* We need to stop */
done = TRUE;
+ GST_DEBUG ("Setting result to ERROR");
dc->priv->current_info->result = GST_DISCOVERER_ERROR;
}
break;
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg),
"structure %" GST_PTR_FORMAT, msg->structure);
if (sttype == _MISSING_PLUGIN_QUARK) {
+ GST_DEBUG ("Setting result to MISSING_PLUGINS");
dc->priv->current_info->result = GST_DISCOVERER_MISSING_PLUGINS;
dc->priv->current_info->misc = gst_structure_copy (msg->structure);
} else if (sttype == _STREAM_TOPOLOGY_QUARK) {
/* return result */
if (!done) {
- GST_DEBUG ("we timed out!");
+ GST_DEBUG ("we timed out! Setting result to TIMEOUT");
dc->priv->current_info->result = GST_DISCOVERER_TIMEOUT;
}
async_timeout_cb (GstDiscoverer * dc)
{
dc->priv->timeoutid = 0;
+ GST_DEBUG ("Setting result to TIMEOUT");
dc->priv->current_info->result = GST_DISCOVERER_TIMEOUT;
dc->priv->processing = FALSE;
discoverer_collect (dc);
DISCO_LOCK (dc);
if (dc->priv->pending_uris == NULL) {
GST_WARNING ("No URI to process");
- res |= GST_DISCOVERER_URI_INVALID;
+ res = GST_DISCOVERER_URI_INVALID;
DISCO_UNLOCK (dc);
goto beach;
}
if (dc->priv->current_info != NULL) {
GST_WARNING ("Already processing a file");
- res |= GST_DISCOVERER_BUSY;
+ res = GST_DISCOVERER_BUSY;
DISCO_UNLOCK (dc);
goto beach;
}
*err = g_error_copy (discoverer->priv->current_error);
else
*err = NULL;
- discoverer->priv->current_info->result = res;
+ if (res != GST_DISCOVERER_OK) {
+ GST_DEBUG ("Setting result to %d (was %d)", res,
+ discoverer->priv->current_info->result);
+ discoverer->priv->current_info->result = res;
+ }
info = discoverer->priv->current_info;
discoverer_cleanup (discoverer);
print_info (GstDiscovererInfo * info, GError * err)
{
GstDiscovererResult result = gst_discoverer_info_get_result (info);
+ GstDiscovererStreamInfo *sinfo;
g_print ("Done discovering %s\n", gst_discoverer_info_get_uri (info));
- if (result & GST_DISCOVERER_URI_INVALID)
- g_print ("URI is not valid\n");
- else if (result & GST_DISCOVERER_TIMEOUT)
- g_print ("Timeout !\n");
- if (result & GST_DISCOVERER_ERROR) {
- g_print ("An error was encountered while discovering the file\n");
- g_print (" %s\n", err->message);
- if (verbose && (result & GST_DISCOVERER_MISSING_PLUGINS)) {
- gchar *tmp =
- gst_structure_to_string (gst_discoverer_info_get_misc (info));
- g_print (" (%s)\n", tmp);
- g_free (tmp);
+ switch (result) {
+ case GST_DISCOVERER_OK:
+ {
+ sinfo = gst_discoverer_info_get_stream_info (info);
+ g_print ("\nTopology:\n");
+ print_topology (sinfo, 1);
+ g_print ("\nDuration:\n");
+ print_duration (info, 1);
+ gst_discoverer_stream_info_unref (sinfo);
+ break;
+ }
+ case GST_DISCOVERER_URI_INVALID:
+ {
+ g_print ("URI is not valid\n");
+ break;
+ }
+ case GST_DISCOVERER_ERROR:
+ {
+ g_print ("An error was encountered while discovering the file\n");
+ g_print (" %s\n", err->message);
+ break;
+ }
+ case GST_DISCOVERER_TIMEOUT:
+ {
+ g_print ("Analyzing URI timed out\n");
+ break;
+ }
+ case GST_DISCOVERER_BUSY:
+ {
+ g_print ("Discoverer was busy\n");
+ break;
+ }
+ case GST_DISCOVERER_MISSING_PLUGINS:
+ {
+ g_print ("Missing plugins\n");
+ if (verbose) {
+ gchar *tmp =
+ gst_structure_to_string (gst_discoverer_info_get_misc (info));
+ g_print (" (%s)\n", tmp);
+ g_free (tmp);
+ }
+ break;
}
-
- return;
}
- if (!(result & (GST_DISCOVERER_ERROR | GST_DISCOVERER_TIMEOUT))) {
- GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info);
- g_print ("\nTopology:\n");
- print_topology (sinfo, 1);
- g_print ("\nDuration:\n");
- print_duration (info, 1);
- gst_discoverer_stream_info_unref (sinfo);
- }
g_print ("\n");
-
}
static void