reverting error patches before making a branch.

Original commit message from CVS:
reverting error patches before making a branch.
This commit is contained in:
Thomas Vander Stichele 2003-09-16 09:57:31 +00:00
parent 331ee18596
commit c4c3c998df
25 changed files with 184 additions and 306 deletions

View file

@ -23,7 +23,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstspideridentity.h"
#include "gstspider.h"
@ -414,14 +413,14 @@ gst_spider_identity_src_loop (GstSpiderIdentity *ident)
static void
gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
{
GstBuffer *buf = NULL;
GstBuffer *buf=NULL;
GstBuffer *typefindbuf = NULL;
gboolean getmorebuf = TRUE;
GList *type_list;
GstCaps *caps;
/* this should possibly be a property */
guint bufsizelimit = 40960;
guint bufsizelimit = 4096;
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
@ -435,7 +434,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
buf = gst_pad_pull (ident->sink);
/* if it's an event... */
if (GST_IS_EVENT (buf)) {
while (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (GST_EVENT (buf))){
case GST_EVENT_EOS:
getmorebuf = FALSE;
@ -444,26 +443,31 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
break;
default:
gst_pad_event_default (ident->sink, GST_EVENT (buf));
buf = gst_pad_pull (ident->sink);
buf = gst_pad_pull (ident->sink);
break;
}
/* handle DISCONT events, please */
}
typefindbuf = buf;
getmorebuf = FALSE;
/* FIXME merging doesn't work for some reason so
* we'll just typefind with the first element
if (!typefindbuf){
typefindbuf = buf;
} else {
gst_buffer_ref(buf);
}
else {
GstBuffer *oldbuf = typefindbuf;
typefindbuf = gst_buffer_merge(typefindbuf, buf);
gst_buffer_unref(oldbuf);
gst_buffer_unref(buf);
}
*/
}
if (!typefindbuf){
return;
} else {
buf = typefindbuf;
goto end;
}
/* maybe there are already valid caps now? */
@ -496,10 +500,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
}
type_list = g_list_next (type_list);
}
gst_element_error(GST_ELEMENT(ident), GST_ERROR_INVALID_DATA,
g_strdup (_("Could not find data type")),
g_strdup_printf ("spider element %s couldn't typefind the data stream",
GST_ELEMENT_NAME (ident)));
gst_element_error(GST_ELEMENT(ident), "Could not find media type", NULL);
gst_buffer_unref(buf);
buf = GST_BUFFER (gst_event_new (GST_EVENT_EOS));

View file

@ -24,7 +24,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstfakesink.h"
@ -407,9 +406,7 @@ gst_fakesink_change_state (GstElement *element)
return GST_STATE_SUCCESS;
error:
gst_element_gerror (element, GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("failed state change as requested"));
gst_element_error (element, "failed state change as requested");
return GST_STATE_FAILURE;
}

View file

@ -24,7 +24,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include <errno.h>
@ -223,9 +222,9 @@ gst_filesink_open_file (GstFileSink *sink)
sink->file = fopen (sink->filename, "w");
if (sink->file == NULL) {
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
g_strdup_printf ("Error opening file \"%s\": %s", sink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (sink),
"Error opening file %s: %s",
sink->filename, g_strerror(errno));
return FALSE;
}
@ -243,9 +242,9 @@ gst_filesink_close_file (GstFileSink *sink)
if (fclose (sink->file) != 0)
{
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
g_strdup_printf ("Error closing file \"%s\": %s", sink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (sink),
"Error closing file %s: %s",
sink->filename, g_strerror(errno));
}
else {
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
@ -341,10 +340,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
if (fflush (filesink->file))
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Error flushing file \"%s\": %s",
filesink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
switch (GST_EVENT_SEEK_METHOD(event))
{
@ -374,10 +372,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
}
case GST_EVENT_FLUSH:
if (fflush (filesink->file)) {
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Error flushing file \"%s\": %s",
filesink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
}
break;
case GST_EVENT_EOS:
@ -426,10 +423,10 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
GST_BUFFER_SIZE (buf) - bytes_written,
filesink->file);
if (wrote <= 0) {
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Only %d of %d bytes written: %s", bytes_written,
GST_BUFFER_SIZE (buf), strerror (errno)));
gst_element_error (GST_ELEMENT (filesink),
"Only %d of %d bytes written: %s",
bytes_written, GST_BUFFER_SIZE (buf),
strerror (errno));
break;
}
bytes_written += wrote;

View file

@ -23,7 +23,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include "gstfilesrc.h"
@ -399,9 +398,7 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size)
mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset);
if (mmapregion == NULL) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("could not open file %s"), src->filename),
g_strdup_printf ("couldn't map file %s", src->filename));
gst_element_error (GST_ELEMENT (src), "couldn't map file");
return NULL;
}
else if (mmapregion == MAP_FAILED) {
@ -638,11 +635,13 @@ gst_filesrc_get_read (GstFileSrc *src)
g_return_val_if_fail (buf != NULL, NULL);
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
GST_BUFFER_SIZE (buf) = ret;
if (ret < 0){
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not read file \"%s\""), src->filename),
g_strdup_printf ("Error during file reading: %s", strerror (errno)));
gst_element_error (GST_ELEMENT (src), "reading file (%s)",
strerror (errno), NULL);
return NULL;
}
if (ret < readsize) {
gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL);
return NULL;
}
@ -703,9 +702,8 @@ gst_filesrc_open_file (GstFileSrc *src)
/* open the file */
src->fd = open (src->filename, O_RDONLY);
if (src->fd < 0) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
g_strdup_printf ("Error opening file \"%s\": %s", src->filename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)",
src->filename, strerror (errno), NULL);
return FALSE;
} else {
/* check if it is a regular file, otherwise bail out */
@ -714,10 +712,8 @@ gst_filesrc_open_file (GstFileSrc *src)
fstat(src->fd, &stat_results);
if (!S_ISREG(stat_results.st_mode)) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
g_strdup_printf ("opening file \"%s\" failed. it isn't a regular file",
src->filename));
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
src->filename, NULL);
close(src->fd);
return FALSE;
}

View file

@ -26,7 +26,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstidentity.h"
@ -250,9 +249,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
identity->error_after--;
if (identity->error_after == 0) {
gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (identity), GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("errored after iterations as requested"));
gst_element_error (GST_ELEMENT (identity), "errored after iterations as requested");
return;
}
}

View file

@ -26,12 +26,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstmultidisksrc.h"
@ -255,9 +253,7 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error opening file \"%s\": %s", src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
return FALSE;
} else {
/* find the file length */
@ -265,16 +261,13 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
lseek (src->fd, 0, SEEK_SET);
/* map the file into memory */
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
madvise (src->map,src->size, 2);
/* collapse state if that failed */
if (src->map == NULL) {
close (src->fd);
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error mmapping file \"%s\": %s",
src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src),"mmapping file");
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}

View file

@ -26,12 +26,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstmultidisksrc.h"
@ -255,9 +253,7 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error opening file \"%s\": %s", src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
return FALSE;
} else {
/* find the file length */
@ -265,16 +261,13 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
lseek (src->fd, 0, SEEK_SET);
/* map the file into memory */
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
madvise (src->map,src->size, 2);
/* collapse state if that failed */
if (src->map == NULL) {
close (src->fd);
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error mmapping file \"%s\": %s",
src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src),"mmapping file");
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}

View file

@ -32,7 +32,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstpipefilter.h"
@ -149,9 +148,9 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event)
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
if (close (pipefilter->fdin[1]) < 0)
GST_DEBUG ("close");
perror("close");
if (close (pipefilter->fdout[0]) < 0)
GST_DEBUG ("close");
perror("close");
return TRUE;
}
@ -179,9 +178,8 @@ gst_pipefilter_get (GstPad *pad)
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
GST_DEBUG ("read %ld bytes", readbytes);
if (readbytes < 0) {
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE,
g_strdup (_("Could not process data")),
g_strdup_printf ("Error reading from pipe: %s", strerror (errno)));
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
@ -218,7 +216,8 @@ gst_pipefilter_chain (GstPad *pad,GstBuffer *buf)
writebytes = write(pipefilter->fdin[1],data,size);
GST_DEBUG ("written %ld bytes", writebytes);
if (writebytes < 0) {
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE, g_strdup (""), g_strdup ("writing"));
perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing");
return;
}
gst_buffer_unref(buf);
@ -273,7 +272,8 @@ gst_pipefilter_open_file (GstPipefilter *src)
if((src->childpid = fork()) == -1)
{
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("forking"));
perror("fork");
gst_element_error(GST_ELEMENT(src),"forking");
return FALSE;
}
@ -286,7 +286,8 @@ gst_pipefilter_open_file (GstPipefilter *src)
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
execvp(src->command[0], &src->command[0]);
/* will only reach if error */
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("starting child process"));
perror("exec");
gst_element_error(GST_ELEMENT(src),"starting child process");
return FALSE;
}

View file

@ -59,7 +59,7 @@ static void gst_element_real_get_property (GObject *object, guint prop_id, GVa
static void gst_element_dispose (GObject *object);
static GstElementStateReturn gst_element_change_state (GstElement *element);
static void gst_element_error_func (GstElement* element, GstElement *source, GError *error, gchar *errormsg);
static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg);
#ifndef GST_DISABLE_LOADSAVE
static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent);
@ -70,7 +70,6 @@ GType _gst_element_type = 0;
static GstObjectClass *parent_class = NULL;
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
static GQuark gst_element_error_quark;
GType gst_element_get_type (void)
{
@ -122,8 +121,8 @@ gst_element_class_init (GstElementClass *klass)
gst_element_signals[ERROR] =
g_signal_new ("error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstElementClass, error), NULL, NULL,
gst_marshal_VOID__OBJECT_POINTER_STRING, G_TYPE_NONE, 3,
G_TYPE_OBJECT, G_TYPE_POINTER, G_TYPE_STRING);
gst_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
G_TYPE_OBJECT, G_TYPE_STRING);
gst_element_signals[EOS] =
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstElementClass,eos), NULL, NULL,
@ -144,8 +143,6 @@ gst_element_class_init (GstElementClass *klass)
klass->elementfactory = NULL;
klass->padtemplates = NULL;
klass->numpadtemplates = 0;
gst_element_error_quark = g_quark_from_static_string ("GstError");
}
static void
@ -198,8 +195,7 @@ gst_element_real_get_property (GObject *object, guint prop_id, GValue *value, GP
* gst_element_default_error:
* @object: a #GObject that signalled the error.
* @orig: the #GstObject that initiated the error.
* @error: the #GError.
* @detailed: the detailed string.
* @error: the error message.
*
* Adds a default error signal callback to an
* element. The user data passed to the g_signal_connect is
@ -208,11 +204,10 @@ gst_element_real_get_property (GObject *object, guint prop_id, GValue *value, GP
* using g_print.
*/
void
gst_element_default_error (GObject *object, GstObject *orig, GError* error, gchar *detailed)
gst_element_default_error (GObject *object, GstObject *orig, gchar *error)
{
gchar *name = gst_object_get_path_string (orig);
g_print ("ERROR: %s: %s\n", name, error->message);
g_print (" %s\n", detailed);
g_print ("ERROR: %s: %s\n", name, error);
g_free (name);
}
@ -1793,17 +1788,17 @@ gst_element_unlink (GstElement *src, GstElement *dest)
static void
gst_element_error_func (GstElement* element, GstElement *source,
GError *error, gchar *errormsg)
gchar *errormsg)
{
/* tell the parent */
if (GST_OBJECT_PARENT (element)) {
GST_CAT_LOG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s",
GST_CAT_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s",
errormsg, GST_ELEMENT_NAME (element),
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
gst_object_ref (GST_OBJECT (element));
g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (element)),
gst_element_signals[ERROR], 0, source, error, errormsg);
gst_element_signals[ERROR], 0, source, errormsg);
gst_object_unref (GST_OBJECT (element));
}
}
@ -2076,48 +2071,41 @@ gst_element_convert (GstElement *element,
/**
* gst_element_error:
* @element: a #GstElement with the error.
* @file: file the error happened in (usually __FILE__)
* @function: function the error happened in or NULL if the function is not known (usually GST_FUNCTION)
* @line: line the error happened in (usually __LINE__)
* @error: the printf-style string describing the error.
* @...: the optional arguments for the string.
*
* signals an error condition on an element.
* This function is used internally.
* This function is used internally by elements.
* It results in the "error" signal.
* You normally want to use gst_element_error() instead.
*/
void
gst_element_error_detailed (GstElement *element, const gchar *file, const gchar *function,
gint line, GstErrorType type,
const gchar *error_message, const gchar *detailed)
gst_element_error (GstElement *element, const gchar *error, ...)
{
gchar *really_detailed;
GError *error = NULL;
va_list var_args;
gchar *string;
/* checks */
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (error != NULL);
/* create error message */
va_start (var_args, error);
string = g_strdup_vprintf (error, var_args);
va_end (var_args);
GST_CAT_INFO (GST_CAT_EVENT, "ERROR in %s: %s", GST_ELEMENT_NAME (element), string);
/* if the element was already in error, stop now */
if (GST_FLAG_IS_SET (element, GST_ELEMENT_ERROR)) {
GST_CAT_INFO_OBJECT (GST_CAT_EVENT, element, "recursive ERROR detected, skipping");
GST_CAT_INFO (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element));
g_free (string);
return;
}
GST_FLAG_SET (element, GST_ELEMENT_ERROR);
/* create detailed error message */
if (!function || function[0] == '\0') {
really_detailed = g_strdup_printf ("Error in line %d in file %s: %s", line, file, detailed);
} else {
really_detailed = g_strdup_printf ("Error in line %d in file %s: %s", line, file, detailed);
}
/* create the GError */
error = g_error_new_literal (gst_element_error_quark, type, error_message);
GST_FLAG_SET (element, GST_ELEMENT_ERROR);
/* emit the signal, make sure the element stays available */
gst_object_ref (GST_OBJECT (element));
g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, error, really_detailed);
g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, string);
/* tell the scheduler */
if (element->sched) {
@ -2137,7 +2125,7 @@ gst_element_error_detailed (GstElement *element, const gchar *file, const gchar
/* cleanup */
gst_object_unref (GST_OBJECT (element));
g_free (really_detailed);
g_free (string);
}
/**

View file

@ -182,7 +182,7 @@ struct _GstElementClass {
void (*state_change) (GstElement *element, GstElementState old, GstElementState state);
void (*new_pad) (GstElement *element, GstPad *pad);
void (*pad_removed) (GstElement *element, GstPad *pad);
void (*error) (GstElement *element, GstElement *source, GError *error, gchar *detailed_description);
void (*error) (GstElement *element, GstElement *source, gchar *error);
void (*eos) (GstElement *element);
/* local pointers for get/set */
@ -228,8 +228,7 @@ void gst_element_class_install_std_props (GstElementClass *kl
#define gst_element_default_deep_notify gst_object_default_deep_notify
void gst_element_default_error (GObject *object, GstObject *orig,
GError *error, gchar *detailed);
void gst_element_default_error (GObject *object, GstObject *orig, gchar *error);
GType gst_element_get_type (void);
@ -328,31 +327,7 @@ gboolean gst_element_convert (GstElement *element,
void gst_element_set_eos (GstElement *element);
#define gst_element_error(element,type,translated,detailed) G_STMT_START{\
gchar *translated_str = translated; \
gchar *detailed_str = detailed; \
GST_ERROR_OBJECT (element, detailed_str); \
gst_element_error_detailed (element, __FILE__, GST_FUNCTION, __LINE__, type, translated_str, detailed_str); \
g_free (translated_str); \
g_free (detailed_str); \
}G_STMT_END
/* FIXME: remove the next define before releasing 0.8 */
#if GST_VERSION_MINOR < 8
#define gst_element_gerror gst_element_error
#else
#define gst_element_gerror(element,type,translated,detailed) G_STMT_START{\
g_warning ("gst_element_gerror should be replaced by gst_element_error"); \
gst_element_error (element,type,translated,detailed); \
}G_STMT_END
#endif
void gst_element_error_detailed (GstElement *element,
const gchar *file,
const gchar *function,
gint line,
GstErrorType type,
const gchar *error_message,
const gchar *detailed_error);
void gst_element_error (GstElement *element, const gchar *error, ...);
gboolean gst_element_is_locked_state (GstElement *element);
void gst_element_set_locked_state (GstElement *element, gboolean locked_state);

View file

@ -6,7 +6,6 @@ VOID:POINTER
VOID:OBJECT
VOID:OBJECT,PARAM
VOID:OBJECT,POINTER
VOID:OBJECT,POINTER,STRING
VOID:OBJECT,STRING
VOID:INT,INT
VOID:INT64

View file

@ -864,11 +864,11 @@ gst_pad_unlink (GstPad *srcpad,
g_return_if_fail ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) &&
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SINK));
if (GST_RPAD_UNLINKFUNC (realsrc)) {
GST_RPAD_UNLINKFUNC (realsrc) (GST_PAD_CAST (realsrc));
if (GST_RPAD_UNLINKFUNC (srcpad)) {
GST_RPAD_UNLINKFUNC (srcpad) (srcpad);
}
if (GST_RPAD_UNLINKFUNC (realsink)) {
GST_RPAD_UNLINKFUNC (realsink) (GST_PAD_CAST (realsink));
if (GST_RPAD_UNLINKFUNC (sinkpad)) {
GST_RPAD_UNLINKFUNC (sinkpad) (sinkpad);
}
/* get the schedulers before we unlink */
@ -2077,8 +2077,8 @@ gst_pad_recover_caps_error (GstPad *pad, GstCaps *allowed)
/* report error */
parent = gst_pad_get_parent (pad);
gst_element_gerror (parent, GST_ERROR_CAPS_NEGOTIATION, g_strdup (_("Cannot decode the given data type")),
g_strdup_printf ("negotiation failed on pad %s:%s", GST_DEBUG_PAD_NAME (pad)));
gst_element_error (parent, "negotiation failed on pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
return FALSE;
}
@ -2381,9 +2381,10 @@ gst_pad_pull (GstPad *pad)
peer = GST_RPAD_PEER (pad);
if (!peer) {
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
g_strdup (_("application error: GStreamer was used wrong")),
g_strdup_printf ("pull on pad %s:%s but it was unlinked", GST_DEBUG_PAD_NAME (pad)));
gst_element_error (GST_PAD_PARENT (pad),
"pull on pad %s:%s but it was unlinked",
GST_ELEMENT_NAME (GST_PAD_PARENT (pad)),
GST_PAD_NAME (pad), NULL);
}
else {
restart:
@ -2404,16 +2405,15 @@ restart:
}
/* no null buffers allowed */
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
g_strdup (_("application error: GStreamer was used wrong")),
g_strdup_printf ("NULL buffer during pull on %s:%s", GST_DEBUG_PAD_NAME (pad)));
gst_element_error (GST_PAD_PARENT (pad),
"NULL buffer during pull on %s:%s",
GST_DEBUG_PAD_NAME (pad));
} else {
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
g_strdup (_("application error: GStreamer was used wrong")),
g_strdup_printf ("internal error: pull on pad %s:%s "
gst_element_error (GST_PAD_PARENT (pad),
"internal error: pull on pad %s:%s "
"but the peer pad %s:%s has no gethandler",
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)));
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer));
}
}
return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));

View file

@ -247,34 +247,34 @@ struct _GstGhostPadClass {
#define GST_PAD_PAD_TEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
/* GstRealPad */
#define GST_RPAD_DIRECTION(pad) (GST_REAL_PAD(pad)->direction)
#define GST_RPAD_CAPS(pad) (GST_REAL_PAD(pad)->caps)
#define GST_RPAD_FILTER(pad) (GST_REAL_PAD(pad)->filter)
#define GST_RPAD_APPFILTER(pad) (GST_REAL_PAD(pad)->appfilter)
#define GST_RPAD_PEER(pad) (GST_REAL_PAD(pad)->peer)
#define GST_RPAD_CHAINFUNC(pad) (GST_REAL_PAD(pad)->chainfunc)
#define GST_RPAD_CHAINHANDLER(pad) (GST_REAL_PAD(pad)->chainhandler)
#define GST_RPAD_GETFUNC(pad) (GST_REAL_PAD(pad)->getfunc)
#define GST_RPAD_GETHANDLER(pad) (GST_REAL_PAD(pad)->gethandler)
#define GST_RPAD_EVENTFUNC(pad) (GST_REAL_PAD(pad)->eventfunc)
#define GST_RPAD_EVENTHANDLER(pad) (GST_REAL_PAD(pad)->eventhandler)
#define GST_RPAD_CONVERTFUNC(pad) (GST_REAL_PAD(pad)->convertfunc)
#define GST_RPAD_QUERYFUNC(pad) (GST_REAL_PAD(pad)->queryfunc)
#define GST_RPAD_INTLINKFUNC(pad) (GST_REAL_PAD(pad)->intlinkfunc)
#define GST_RPAD_FORMATSFUNC(pad) (GST_REAL_PAD(pad)->formatsfunc)
#define GST_RPAD_QUERYTYPEFUNC(pad) (GST_REAL_PAD(pad)->querytypefunc)
#define GST_RPAD_EVENTMASKFUNC(pad) (GST_REAL_PAD(pad)->eventmaskfunc)
#define GST_RPAD_DIRECTION(pad) (((GstRealPad *)(pad))->direction)
#define GST_RPAD_CAPS(pad) (((GstRealPad *)(pad))->caps)
#define GST_RPAD_FILTER(pad) (((GstRealPad *)(pad))->filter)
#define GST_RPAD_APPFILTER(pad) (((GstRealPad *)(pad))->appfilter)
#define GST_RPAD_PEER(pad) (((GstRealPad *)(pad))->peer)
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc)
#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler)
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc)
#define GST_RPAD_GETHANDLER(pad) (((GstRealPad *)(pad))->gethandler)
#define GST_RPAD_EVENTFUNC(pad) (((GstRealPad *)(pad))->eventfunc)
#define GST_RPAD_EVENTHANDLER(pad) (((GstRealPad *)(pad))->eventhandler)
#define GST_RPAD_CONVERTFUNC(pad) (((GstRealPad *)(pad))->convertfunc)
#define GST_RPAD_QUERYFUNC(pad) (((GstRealPad *)(pad))->queryfunc)
#define GST_RPAD_INTLINKFUNC(pad) (((GstRealPad *)(pad))->intlinkfunc)
#define GST_RPAD_FORMATSFUNC(pad) (((GstRealPad *)(pad))->formatsfunc)
#define GST_RPAD_QUERYTYPEFUNC(pad) (((GstRealPad *)(pad))->querytypefunc)
#define GST_RPAD_EVENTMASKFUNC(pad) (((GstRealPad *)(pad))->eventmaskfunc)
#define GST_RPAD_LINKFUNC(pad) (GST_REAL_PAD(pad)->linkfunc)
#define GST_RPAD_UNLINKFUNC(pad) (GST_REAL_PAD(pad)->unlinkfunc)
#define GST_RPAD_GETCAPSFUNC(pad) (GST_REAL_PAD(pad)->getcapsfunc)
#define GST_RPAD_BUFFERPOOLFUNC(pad) (GST_REAL_PAD(pad)->bufferpoolfunc)
#define GST_RPAD_LINKFUNC(pad) (((GstRealPad *)(pad))->linkfunc)
#define GST_RPAD_UNLINKFUNC(pad) (((GstRealPad *)(pad))->unlinkfunc)
#define GST_RPAD_GETCAPSFUNC(pad) (((GstRealPad *)(pad))->getcapsfunc)
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc)
/* GstGhostPad */
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad)
/* Generic */
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? GST_REAL_PAD(pad) : GST_GPAD_REALPAD(pad))
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad))
#define GST_PAD_PEER(pad) GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))

View file

@ -413,9 +413,7 @@ restart:
if (!queue->may_deadlock) {
g_mutex_unlock (queue->qlock);
gst_data_unref (GST_DATA (buf));
gst_element_error (GST_ELEMENT (queue), GST_ERROR_UNKNOWN,
g_strdup (_("Cannot go on decoding")), /* FIXME: Better ideas? */
g_strdup ("deadlock found, source pad elements are shut down"));
gst_element_error (GST_ELEMENT (queue), "deadlock found, source pad elements are shut down");
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
return;
}
@ -495,9 +493,7 @@ restart:
/* this means the other end is shut down */
if (!queue->may_deadlock) {
g_mutex_unlock (queue->qlock);
gst_element_error (GST_ELEMENT (queue), GST_ERROR_UNKNOWN,
g_strdup (_("Cannot go on decoding")), /* FIXME: Better ideas? */
g_strdup ("deadlock found, sink pad elements are shut down"));
gst_element_error (GST_ELEMENT (queue), "deadlock found, sink pad elements are shut down");
goto restart;
}
else {

View file

@ -236,9 +236,8 @@ end:
gst_buffer_unref (buf);
if (typefind->max_buffers && typefind->num_buffer >= typefind->max_buffers) {
gst_element_gerror (GST_ELEMENT (typefind), GST_ERROR_INVALID_DATA,
g_strdup (_("The data cannot be identified")),
g_strdup_printf ("typefind could not determine type after %d buffers", typefind->num_buffer));
gst_element_error (GST_ELEMENT (typefind),
"typefind could not determine type after %d buffers", typefind->num_buffer);
}
}

View file

@ -58,25 +58,6 @@ typedef enum {
GST_RESULT_NOT_IMPL
} GstResult;
typedef enum {
/* undefined error */
GST_ERROR_UNDEFINED,
/* something that does not fit into the other categories */
GST_ERROR_UNKNOWN,
/* no error (used ie for debugging purposes) */
GST_ERROR_NO_ERROR,
/* error with device or file */
GST_ERROR_DEVICE,
/* invalid data inside the stream */
GST_ERROR_INVALID_DATA,
/* pipeline is not setup correctly */
GST_ERROR_PIPELINE,
/* no way to do caps negotiation */
GST_ERROR_CAPS_NEGOTIATION,
/* internal error - used by schedulers */
GST_ERROR_INTERNAL
} GstErrorType;
G_END_DECLS
#endif /* __GST_TYPES_H__ */

View file

@ -23,7 +23,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
@ -452,9 +451,8 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstBuffer * buf)
}
if (loop_count == 0) {
gst_element_gerror (parent, GST_ERROR_INTERNAL,
g_strdup (_("Internal error in GStreamer")),
g_strdup ("basic scheduler error: maximum number of switches exceeded"));
gst_element_error (parent,
"(internal error) basic: maximum number of switches exceeded");
return;
}
@ -521,9 +519,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad)
GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!");
pad = (GstPad *) GST_RPAD_PEER (peer);
if (!pad) {
gst_element_gerror (parent, GST_ERROR_PIPELINE,
g_strdup (_("application error")),
g_strdup_printf ("pad %s:%s is unlinked", GST_DEBUG_PAD_NAME (peer)));
gst_element_error (parent, "pad unlinked");
}
parent = GST_PAD_PARENT (pad);
peer = GST_RPAD_PEER (pad);
@ -654,10 +650,10 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
* either, we have an error */
if (different_sched && !peer_decoupled)
{
gst_element_gerror (element, GST_ERROR_PIPELINE,
g_strdup (_("application error")),
g_strdup_printf ("element \"%s\" is not decoupled but has pads "
"in different schedulers", GST_ELEMENT_NAME (element)));
gst_element_error (element,
"element \"%s\" is not decoupled but has pads "
"in different schedulers",
GST_ELEMENT_NAME (element), NULL);
return FALSE;
}
/* ok, the peer is in a different scheduler and is decoupled,
@ -723,9 +719,8 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
chain->sched->context,
wrapper_function, 0, (char **) element);
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
gst_element_gerror (element, GST_ERROR_INTERNAL,
g_strdup (_("internal GStreamer error")),
g_strdup_printf ("could not create cothread for \"%s\"", GST_ELEMENT_NAME (element)));
gst_element_error (element, "could not create cothread for \"%s\"",
GST_ELEMENT_NAME (element), NULL);
return FALSE;
}
GST_DEBUG ("created cothread %p for '%s'",

View file

@ -24,7 +24,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstfakesink.h"
@ -407,9 +406,7 @@ gst_fakesink_change_state (GstElement *element)
return GST_STATE_SUCCESS;
error:
gst_element_gerror (element, GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("failed state change as requested"));
gst_element_error (element, "failed state change as requested");
return GST_STATE_FAILURE;
}

View file

@ -24,7 +24,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include <errno.h>
@ -223,9 +222,9 @@ gst_filesink_open_file (GstFileSink *sink)
sink->file = fopen (sink->filename, "w");
if (sink->file == NULL) {
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
g_strdup_printf ("Error opening file \"%s\": %s", sink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (sink),
"Error opening file %s: %s",
sink->filename, g_strerror(errno));
return FALSE;
}
@ -243,9 +242,9 @@ gst_filesink_close_file (GstFileSink *sink)
if (fclose (sink->file) != 0)
{
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
g_strdup_printf ("Error closing file \"%s\": %s", sink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (sink),
"Error closing file %s: %s",
sink->filename, g_strerror(errno));
}
else {
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
@ -341,10 +340,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
if (fflush (filesink->file))
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Error flushing file \"%s\": %s",
filesink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
switch (GST_EVENT_SEEK_METHOD(event))
{
@ -374,10 +372,9 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
}
case GST_EVENT_FLUSH:
if (fflush (filesink->file)) {
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Error flushing file \"%s\": %s",
filesink->filename, g_strerror(errno)));
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
}
break;
case GST_EVENT_EOS:
@ -426,10 +423,10 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
GST_BUFFER_SIZE (buf) - bytes_written,
filesink->file);
if (wrote <= 0) {
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
g_strdup_printf ("Only %d of %d bytes written: %s", bytes_written,
GST_BUFFER_SIZE (buf), strerror (errno)));
gst_element_error (GST_ELEMENT (filesink),
"Only %d of %d bytes written: %s",
bytes_written, GST_BUFFER_SIZE (buf),
strerror (errno));
break;
}
bytes_written += wrote;

View file

@ -23,7 +23,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include "gstfilesrc.h"
@ -399,9 +398,7 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size)
mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset);
if (mmapregion == NULL) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("could not open file %s"), src->filename),
g_strdup_printf ("couldn't map file %s", src->filename));
gst_element_error (GST_ELEMENT (src), "couldn't map file");
return NULL;
}
else if (mmapregion == MAP_FAILED) {
@ -638,11 +635,13 @@ gst_filesrc_get_read (GstFileSrc *src)
g_return_val_if_fail (buf != NULL, NULL);
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
GST_BUFFER_SIZE (buf) = ret;
if (ret < 0){
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not read file \"%s\""), src->filename),
g_strdup_printf ("Error during file reading: %s", strerror (errno)));
gst_element_error (GST_ELEMENT (src), "reading file (%s)",
strerror (errno), NULL);
return NULL;
}
if (ret < readsize) {
gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL);
return NULL;
}
@ -703,9 +702,8 @@ gst_filesrc_open_file (GstFileSrc *src)
/* open the file */
src->fd = open (src->filename, O_RDONLY);
if (src->fd < 0) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
g_strdup_printf ("Error opening file \"%s\": %s", src->filename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)",
src->filename, strerror (errno), NULL);
return FALSE;
} else {
/* check if it is a regular file, otherwise bail out */
@ -714,10 +712,8 @@ gst_filesrc_open_file (GstFileSrc *src)
fstat(src->fd, &stat_results);
if (!S_ISREG(stat_results.st_mode)) {
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
g_strdup_printf ("opening file \"%s\" failed. it isn't a regular file",
src->filename));
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
src->filename, NULL);
close(src->fd);
return FALSE;
}

View file

@ -26,7 +26,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstidentity.h"
@ -250,9 +249,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
identity->error_after--;
if (identity->error_after == 0) {
gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (identity), GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("errored after iterations as requested"));
gst_element_error (GST_ELEMENT (identity), "errored after iterations as requested");
return;
}
}

View file

@ -26,12 +26,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstmultidisksrc.h"
@ -255,9 +253,7 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error opening file \"%s\": %s", src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
return FALSE;
} else {
/* find the file length */
@ -265,16 +261,13 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
lseek (src->fd, 0, SEEK_SET);
/* map the file into memory */
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
madvise (src->map,src->size, 2);
/* collapse state if that failed */
if (src->map == NULL) {
close (src->fd);
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error mmapping file \"%s\": %s",
src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src),"mmapping file");
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}

View file

@ -26,12 +26,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstmultidisksrc.h"
@ -255,9 +253,7 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error opening file \"%s\": %s", src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
return FALSE;
} else {
/* find the file length */
@ -265,16 +261,13 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
lseek (src->fd, 0, SEEK_SET);
/* map the file into memory */
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
madvise (src->map,src->size, 2);
/* collapse state if that failed */
if (src->map == NULL) {
close (src->fd);
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
g_strdup_printf (_("Could not open file \"%s\""), src->currentfilename),
g_strdup_printf ("error mmapping file \"%s\": %s",
src->currentfilename, strerror (errno)));
gst_element_error (GST_ELEMENT (src),"mmapping file");
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}

View file

@ -32,7 +32,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstpipefilter.h"
@ -149,9 +148,9 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event)
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
if (close (pipefilter->fdin[1]) < 0)
GST_DEBUG ("close");
perror("close");
if (close (pipefilter->fdout[0]) < 0)
GST_DEBUG ("close");
perror("close");
return TRUE;
}
@ -179,9 +178,8 @@ gst_pipefilter_get (GstPad *pad)
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
GST_DEBUG ("read %ld bytes", readbytes);
if (readbytes < 0) {
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE,
g_strdup (_("Could not process data")),
g_strdup_printf ("Error reading from pipe: %s", strerror (errno)));
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
@ -218,7 +216,8 @@ gst_pipefilter_chain (GstPad *pad,GstBuffer *buf)
writebytes = write(pipefilter->fdin[1],data,size);
GST_DEBUG ("written %ld bytes", writebytes);
if (writebytes < 0) {
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE, g_strdup (""), g_strdup ("writing"));
perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing");
return;
}
gst_buffer_unref(buf);
@ -273,7 +272,8 @@ gst_pipefilter_open_file (GstPipefilter *src)
if((src->childpid = fork()) == -1)
{
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("forking"));
perror("fork");
gst_element_error(GST_ELEMENT(src),"forking");
return FALSE;
}
@ -286,7 +286,8 @@ gst_pipefilter_open_file (GstPipefilter *src)
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
execvp(src->command[0], &src->command[0]);
/* will only reach if error */
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("starting child process"));
perror("exec");
gst_element_error(GST_ELEMENT(src),"starting child process");
return FALSE;
}

View file

@ -413,9 +413,7 @@ restart:
if (!queue->may_deadlock) {
g_mutex_unlock (queue->qlock);
gst_data_unref (GST_DATA (buf));
gst_element_error (GST_ELEMENT (queue), GST_ERROR_UNKNOWN,
g_strdup (_("Cannot go on decoding")), /* FIXME: Better ideas? */
g_strdup ("deadlock found, source pad elements are shut down"));
gst_element_error (GST_ELEMENT (queue), "deadlock found, source pad elements are shut down");
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
return;
}
@ -495,9 +493,7 @@ restart:
/* this means the other end is shut down */
if (!queue->may_deadlock) {
g_mutex_unlock (queue->qlock);
gst_element_error (GST_ELEMENT (queue), GST_ERROR_UNKNOWN,
g_strdup (_("Cannot go on decoding")), /* FIXME: Better ideas? */
g_strdup ("deadlock found, sink pad elements are shut down"));
gst_element_error (GST_ELEMENT (queue), "deadlock found, sink pad elements are shut down");
goto restart;
}
else {