mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +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 <libxml/parser.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
|
|
||||||
#include "gst_analyzer.h"
|
#include "gst_analyzer.h"
|
||||||
|
@ -1034,13 +1035,13 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
ret = analyzer_ui_init ();
|
ret = analyzer_ui_init ();
|
||||||
if (!ret) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = analyzer_create_dirs ();
|
ret = analyzer_create_dirs ();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
g_error ("Failed to create the necessary dir names \n");
|
g_printerr ("Failed to create the necessary dir names\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
||||||
} else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
|
} else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gst_message_parse_error (message, &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);
|
g_error_free (error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri)
|
||||||
gst_init (NULL, NULL);
|
gst_init (NULL, NULL);
|
||||||
|
|
||||||
if (!analyzer_sink_register_static ()) {
|
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;
|
status = GST_ANALYZER_STATUS_CODEC_PARSER_MISSING;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri)
|
||||||
analyzer->pipeline = gst_pipeline_new ("pipeline");
|
analyzer->pipeline = gst_pipeline_new ("pipeline");
|
||||||
|
|
||||||
if (!analyzer->src || !analyzer->parser || !analyzer->sink) {
|
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;
|
status = GST_ANALYZER_STATUS_ERROR_UNKNOWN;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "mpeg_xml.h"
|
#include "mpeg_xml.h"
|
||||||
#include "xml_utils.h"
|
#include "xml_utils.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
create_seq_hdr_xml (xmlTextWriterPtr writer, GstMpegVideoSequenceHdr * seq_hdr)
|
create_seq_hdr_xml (xmlTextWriterPtr writer, GstMpegVideoSequenceHdr * seq_hdr)
|
||||||
|
@ -423,7 +424,7 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta,
|
||||||
|
|
||||||
if (xmlTextWriterWriteComment (writer,
|
if (xmlTextWriterWriteComment (writer,
|
||||||
(xmlChar *) "Data parssed from the mpeg2 stream") < 0) {
|
(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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,12 +533,12 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (xmlTextWriterEndElement (writer) < 0) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlTextWriterEndDocument (writer) < 0) {
|
if (xmlTextWriterEndDocument (writer) < 0) {
|
||||||
g_error ("Error: Ending document \n");
|
g_printerr ("Error: Ending document\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
*/
|
*/
|
||||||
#include "xml_parse.h"
|
#include "xml_parse.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
analyzer_node_list_free (GList * list)
|
analyzer_node_list_free (GList * list)
|
||||||
{
|
{
|
||||||
|
@ -62,13 +64,13 @@ analyzer_get_list_header_strings (char *file_name)
|
||||||
|
|
||||||
doc = xmlParseFile (file_name);
|
doc = xmlParseFile (file_name);
|
||||||
if (!doc) {
|
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;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = xmlDocGetRootElement (doc);
|
cur = xmlDocGetRootElement (doc);
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
g_error ("empty document\n");
|
g_printerr ("empty document\n");
|
||||||
xmlFreeDoc (doc);
|
xmlFreeDoc (doc);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +78,7 @@ analyzer_get_list_header_strings (char *file_name)
|
||||||
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
||||||
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
||||||
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
||||||
g_error ("document of the wrong type !!");
|
g_printerr ("document of the wrong type !!\n");
|
||||||
xmlFreeDoc (doc);
|
xmlFreeDoc (doc);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -105,22 +107,23 @@ analyzer_get_list_analyzer_node_from_xml (char *file_name, char *node_name)
|
||||||
|
|
||||||
doc = xmlParseFile (file_name);
|
doc = xmlParseFile (file_name);
|
||||||
if (!doc) {
|
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);
|
cur = xmlDocGetRootElement (doc);
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
g_error ("empty document\n");
|
|
||||||
xmlFreeDoc (doc);
|
xmlFreeDoc (doc);
|
||||||
return;
|
g_printerr ("empty document\n");
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") &&
|
||||||
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
xmlStrcmp (cur->name, (const xmlChar *) "h264") &&
|
||||||
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
xmlStrcmp (cur->name, (const xmlChar *) "h265")) {
|
||||||
g_error ("document of the wrong type !!");
|
|
||||||
xmlFreeDoc (doc);
|
xmlFreeDoc (doc);
|
||||||
return;
|
g_printerr ("document of the wrong type !!\n");
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = cur->xmlChildrenNode;
|
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);
|
list = g_list_reverse (list);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue