mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
codecanalyzer: do not use g_error if abort is not desired
Use g_printerr() instead. g_error() calls abort after outputting the message so these blocks' return statements and free()s were unreachable. Aditionally, fix wrong void returns on non-void function, drop trailing whitespace before newline and add \n's as needed (default handler won't add one).
This commit is contained in:
parent
969f12ab46
commit
13010830b6
4 changed files with 24 additions and 16 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <libxml/parser.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#include "gst_analyzer.h"
|
||||
|
@ -1034,13 +1035,13 @@ main (int argc, char *argv[])
|
|||
|
||||
ret = analyzer_ui_init ();
|
||||
if (!ret) {
|
||||
g_error ("Failed to activate the gtk+-3.x backend \n");
|
||||
g_printerr ("Failed to activate the gtk+-3.x backend\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = analyzer_create_dirs ();
|
||||
if (!ret) {
|
||||
g_error ("Failed to create the necessary dir names \n");
|
||||
g_printerr ("Failed to create the necessary dir names\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
|||
} else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
|
||||
GError *error = NULL;
|
||||
gst_message_parse_error (message, &error, NULL);
|
||||
g_error ("gstreamer error : %s", error->message);
|
||||
g_printerr ("gstreamer error : %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri)
|
|||
gst_init (NULL, NULL);
|
||||
|
||||
if (!analyzer_sink_register_static ()) {
|
||||
g_error ("Failed to register static plugins.... \n");
|
||||
g_printerr ("Failed to register static plugins....\n");
|
||||
status = GST_ANALYZER_STATUS_CODEC_PARSER_MISSING;
|
||||
goto error;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri)
|
|||
analyzer->pipeline = gst_pipeline_new ("pipeline");
|
||||
|
||||
if (!analyzer->src || !analyzer->parser || !analyzer->sink) {
|
||||
g_error ("Failed to create the necessary gstreamer elements..");
|
||||
g_printerr ("Failed to create the necessary gstreamer elements..\n");
|
||||
status = GST_ANALYZER_STATUS_ERROR_UNKNOWN;
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mpeg_xml.h"
|
||||
#include "xml_utils.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static gboolean
|
||||
create_seq_hdr_xml (xmlTextWriterPtr writer, GstMpegVideoSequenceHdr * seq_hdr)
|
||||
|
@ -423,7 +424,7 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta,
|
|||
|
||||
if (xmlTextWriterWriteComment (writer,
|
||||
(xmlChar *) "Data parssed from the mpeg2 stream") < 0) {
|
||||
g_error ("Error: Failed to write the comment \n");
|
||||
g_printerr ("Error: Failed to write the comment\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -532,12 +533,12 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta,
|
|||
}
|
||||
#endif
|
||||
if (xmlTextWriterEndElement (writer) < 0) {
|
||||
g_error ("Error: Failed to end mpeg2 root element \n");
|
||||
g_printerr ("Error: Failed to end mpeg2 root element\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (xmlTextWriterEndDocument (writer) < 0) {
|
||||
g_error ("Error: Ending document \n");
|
||||
g_printerr ("Error: Ending document\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
*/
|
||||
#include "xml_parse.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
void
|
||||
analyzer_node_list_free (GList * list)
|
||||
{
|
||||
|
@ -62,13 +64,13 @@ analyzer_get_list_header_strings (char *file_name)
|
|||
|
||||
doc = xmlParseFile (file_name);
|
||||
if (!doc) {
|
||||
g_error ("Failed to do xmlParseFile for the file.. %s\n", file_name);
|
||||
g_printerr ("Failed to do xmlParseFile for the file.. %s\n", file_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
cur = xmlDocGetRootElement (doc);
|
||||
if (cur == NULL) {
|
||||
g_error ("empty document\n");
|
||||
g_printerr ("empty document\n");
|
||||
xmlFreeDoc (doc);
|
||||
goto error;
|
||||
}
|
||||
|
@ -76,7 +78,7 @@ analyzer_get_list_header_strings (char *file_name)
|
|||
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
||||
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
||||
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
||||
g_error ("document of the wrong type !!");
|
||||
g_printerr ("document of the wrong type !!\n");
|
||||
xmlFreeDoc (doc);
|
||||
goto error;
|
||||
}
|
||||
|
@ -105,22 +107,23 @@ analyzer_get_list_analyzer_node_from_xml (char *file_name, char *node_name)
|
|||
|
||||
doc = xmlParseFile (file_name);
|
||||
if (!doc) {
|
||||
g_error ("Failed to do xmlParseFile for the file.. %s\n", file_name);
|
||||
g_printerr ("Failed to do xmlParseFile for the file.. %s\n", file_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
cur = xmlDocGetRootElement (doc);
|
||||
if (cur == NULL) {
|
||||
g_error ("empty document\n");
|
||||
xmlFreeDoc (doc);
|
||||
return;
|
||||
g_printerr ("empty document\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
||||
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
||||
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
||||
g_error ("document of the wrong type !!");
|
||||
xmlFreeDoc (doc);
|
||||
return;
|
||||
g_printerr ("document of the wrong type !!\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
tmp = cur->xmlChildrenNode;
|
||||
|
@ -179,4 +182,7 @@ analyzer_get_list_analyzer_node_from_xml (char *file_name, char *node_name)
|
|||
list = g_list_reverse (list);
|
||||
|
||||
return list;
|
||||
|
||||
error:
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue