mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
discoverer: Fixup DiscovererResult handling
This was a leftover from the changes from a flag to an enum
This commit is contained in:
parent
3912e59488
commit
6ecbdab1fe
2 changed files with 54 additions and 27 deletions
|
@ -942,6 +942,7 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
|
|||
/* We need to stop */
|
||||
done = TRUE;
|
||||
|
||||
GST_DEBUG ("Setting result to ERROR");
|
||||
dc->priv->current_info->result = GST_DISCOVERER_ERROR;
|
||||
}
|
||||
break;
|
||||
|
@ -965,6 +966,7 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
|
|||
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) {
|
||||
|
@ -1018,7 +1020,7 @@ handle_current_sync (GstDiscoverer * dc)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -1117,6 +1119,7 @@ static gboolean
|
|||
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);
|
||||
|
@ -1140,14 +1143,14 @@ start_discovering (GstDiscoverer * 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;
|
||||
}
|
||||
|
@ -1347,7 +1350,11 @@ gst_discoverer_discover_uri (GstDiscoverer * discoverer, const gchar * uri,
|
|||
*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);
|
||||
|
|
|
@ -245,35 +245,55 @@ static void
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue