Commit be1eaa4d authored by Benjamin Otte's avatar Benjamin Otte
Browse files

implement translatable error messages using gerror.

Original commit message from CVS:
implement translatable error messages using gerror.

Includes bugfixes for:
- crash when unlinking Ghostpads
- make *_PAD_* macros use glib casts
- make spider typefinding merge buffers correctly
parent ce8fe777
......@@ -23,6 +23,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstspideridentity.h"
#include "gstspider.h"
......@@ -413,14 +414,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 = 4096;
guint bufsizelimit = 40960;
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
......@@ -434,7 +435,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
buf = gst_pad_pull (ident->sink);
/* if it's an event... */
while (GST_IS_EVENT (buf)) {
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (GST_EVENT (buf))){
case GST_EVENT_EOS:
getmorebuf = FALSE;
......@@ -443,31 +444,26 @@ 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;
gst_buffer_ref(buf);
}
else {
} else {
GstBuffer *oldbuf = typefindbuf;
typefindbuf = gst_buffer_merge(typefindbuf, buf);
gst_buffer_unref(oldbuf);
gst_buffer_unref(buf);
}
*/
}
if (!typefindbuf){
goto end;
return;
} else {
buf = typefindbuf;
}
/* maybe there are already valid caps now? */
......@@ -500,7 +496,10 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
}
type_list = g_list_next (type_list);
}
gst_element_error(GST_ELEMENT(ident), "Could not find media type", NULL);
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_buffer_unref(buf);
buf = GST_BUFFER (gst_event_new (GST_EVENT_EOS));
......
......@@ -24,6 +24,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstfakesink.h"
......@@ -406,7 +407,9 @@ gst_fakesink_change_state (GstElement *element)
return GST_STATE_SUCCESS;
error:
gst_element_error (element, "failed state change as requested");
gst_element_gerror (element, GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("failed state change as requested"));
return GST_STATE_FAILURE;
}
......
......@@ -24,6 +24,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include <errno.h>
......@@ -222,9 +223,9 @@ gst_filesink_open_file (GstFileSink *sink)
sink->file = fopen (sink->filename, "w");
if (sink->file == NULL) {
gst_element_error (GST_ELEMENT (sink),
"Error opening file %s: %s",
sink->filename, g_strerror(errno));
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)));
return FALSE;
}
......@@ -242,9 +243,9 @@ gst_filesink_close_file (GstFileSink *sink)
if (fclose (sink->file) != 0)
{
gst_element_error (GST_ELEMENT (sink),
"Error closing file %s: %s",
sink->filename, g_strerror(errno));
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)));
}
else {
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
......@@ -340,9 +341,10 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
if (fflush (filesink->file))
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
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)));
switch (GST_EVENT_SEEK_METHOD(event))
{
......@@ -372,9 +374,10 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
}
case GST_EVENT_FLUSH:
if (fflush (filesink->file)) {
gst_element_error (GST_ELEMENT (filesink),
"Error flushing file %s: %s",
filesink->filename, g_strerror(errno));
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)));
}
break;
case GST_EVENT_EOS:
......@@ -423,10 +426,10 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
GST_BUFFER_SIZE (buf) - bytes_written,
filesink->file);
if (wrote <= 0) {
gst_element_error (GST_ELEMENT (filesink),
"Only %d of %d bytes written: %s",
bytes_written, GST_BUFFER_SIZE (buf),
strerror (errno));
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)));
break;
}
bytes_written += wrote;
......
......@@ -23,6 +23,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include <gst/gst.h>
#include "gstfilesrc.h"
......@@ -398,7 +399,9 @@ 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_error (GST_ELEMENT (src), "couldn't map file");
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));
return NULL;
}
else if (mmapregion == MAP_FAILED) {
......@@ -635,13 +638,11 @@ 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_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);
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)));
return NULL;
}
......@@ -702,8 +703,9 @@ gst_filesrc_open_file (GstFileSrc *src)
/* open the file */
src->fd = open (src->filename, O_RDONLY);
if (src->fd < 0) {
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)",
src->filename, strerror (errno), NULL);
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)));
return FALSE;
} else {
/* check if it is a regular file, otherwise bail out */
......@@ -712,8 +714,10 @@ gst_filesrc_open_file (GstFileSrc *src)
fstat(src->fd, &stat_results);
if (!S_ISREG(stat_results.st_mode)) {
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
src->filename, NULL);
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));
close(src->fd);
return FALSE;
}
......
......@@ -26,6 +26,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstidentity.h"
......@@ -249,7 +250,9 @@ 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), "errored after iterations as requested");
gst_element_error (GST_ELEMENT (identity), GST_ERROR_NO_ERROR,
g_strdup (_("user selected error")),
g_strdup ("errored after iterations as requested"));
return;
}
}
......
......@@ -26,10 +26,12 @@
#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"
......@@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
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)));
return FALSE;
} else {
/* find the file length */
......@@ -261,13 +265,16 @@ 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_error (GST_ELEMENT (src),"mmapping file");
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)));
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}
......
......@@ -26,10 +26,12 @@
#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"
......@@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
if (src->fd < 0) {
perror ("open");
gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
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)));
return FALSE;
} else {
/* find the file length */
......@@ -261,13 +265,16 @@ 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_error (GST_ELEMENT (src),"mmapping file");
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)));
return FALSE;
}
madvise (src->map, src->size, 2);
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
src->new_seek = TRUE;
}
......
......@@ -32,6 +32,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gst/gst_private.h"
#include "gstpipefilter.h"
......@@ -148,9 +149,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)
perror("close");
GST_DEBUG ("close");
if (close (pipefilter->fdout[0]) < 0)
perror("close");
GST_DEBUG ("close");
return TRUE;
}
......@@ -178,8 +179,9 @@ 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) {
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
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)));
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
......@@ -216,8 +218,7 @@ gst_pipefilter_chain (GstPad *pad,GstBuffer *buf)
writebytes = write(pipefilter->fdin[1],data,size);
GST_DEBUG ("written %ld bytes", writebytes);
if (writebytes < 0) {
perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing");
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE, g_strdup (""), g_strdup ("writing"));
return;
}
gst_buffer_unref(buf);
......@@ -272,8 +273,7 @@ gst_pipefilter_open_file (GstPipefilter *src)
if((src->childpid = fork()) == -1)
{
perror("fork");
gst_element_error(GST_ELEMENT(src),"forking");
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("forking"));
return FALSE;
}
......@@ -286,8 +286,7 @@ 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 */
perror("exec");
gst_element_error(GST_ELEMENT(src),"starting child process");
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("starting child process"));
return FALSE;
}
......
......@@ -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, gchar *errormsg);
static void gst_element_error_func (GstElement* element, GstElement *source, GError *error, gchar *errormsg);
#ifndef GST_DISABLE_LOADSAVE
static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent);
......@@ -70,6 +70,7 @@ 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)
{
......@@ -121,8 +122,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_STRING, G_TYPE_NONE, 2,
G_TYPE_OBJECT, G_TYPE_STRING);
gst_marshal_VOID__OBJECT_POINTER_STRING, G_TYPE_NONE, 3,
G_TYPE_OBJECT, G_TYPE_POINTER, 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,
......@@ -143,6 +144,8 @@ 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
......@@ -1788,17 +1791,17 @@ gst_element_unlink (GstElement *src, GstElement *dest)
static void
gst_element_error_func (GstElement* element, GstElement *source,
gchar *errormsg)
GError *error, gchar *errormsg)
{
/* tell the parent */
if (GST_OBJECT_PARENT (element)) {
GST_CAT_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s",
GST_CAT_LOG (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, errormsg);
gst_element_signals[ERROR], 0, source, error, errormsg);
gst_object_unref (GST_OBJECT (element));
}
}
......@@ -2079,33 +2082,36 @@ gst_element_convert (GstElement *element,
* It results in the "error" signal.
*/
void
gst_element_error (GstElement *element, const gchar *error, ...)
gst_element_error_detailed (GstElement *element, const gchar *file, const gchar *function,
gint line, GstErrorType type,
const gchar *error_message, const gchar *detailed)
{
va_list var_args;
gchar *string;
gchar *really_detailed;
GError *error;
/* 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 (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element));
g_free (string);
GST_CAT_INFO_OBJECT (GST_CAT_EVENT, element, "recursive ERROR detected, skipping");
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);
/* 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, string);
g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, error, really_detailed);
/* tell the scheduler */
if (element->sched) {
......@@ -2125,7 +2131,7 @@ gst_element_error (GstElement *element, const gchar *error, ...)
/* cleanup */
gst_object_unref (GST_OBJECT (element));
g_free (string);
g_free (really_detailed);
}
/**
......
......@@ -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, gchar *error);
void (*error) (GstElement *element, GstElement *source, GError *error, gchar *detailed_description);
void (*eos) (GstElement *element);
/* local pointers for get/set */
......@@ -327,7 +327,31 @@ gboolean gst_element_convert (GstElement *element,
void gst_element_set_eos (GstElement *element);
void gst_element_error (GstElement *element, const gchar *error, ...);
#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);
gboolean gst_element_is_locked_state (GstElement *element);
void gst_element_set_locked_state (GstElement *element, gboolean locked_state);
......
......@@ -6,6 +6,7 @@ VOID:POINTER
VOID:OBJECT
VOID:OBJECT,PARAM
VOID:OBJECT,POINTER
VOID:OBJECT,POINTER,STRING
VOID:OBJECT,STRING
VOID:INT,INT
VOID:INT64
......@@ -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 (srcpad)) {
GST_RPAD_UNLINKFUNC (srcpad) (srcpad);
if (GST_RPAD_UNLINKFUNC (realsrc)) {
GST_RPAD_UNLINKFUNC (realsrc) (GST_PAD_CAST (realsrc));
}
if (GST_RPAD_UNLINKFUNC (sinkpad)) {
GST_RPAD_UNLINKFUNC (sinkpad) (sinkpad);
if (GST_RPAD_UNLINKFUNC (realsink)) {
GST_RPAD_UNLINKFUNC (realsink) (GST_PAD_CAST (realsink));
}
/* 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_error (parent, "negotiation failed on pad %s:%s",
GST_DEBUG_PAD_NAME (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)));
return FALSE;
}
......@@ -2381,10 +2381,9 @@ gst_pad_pull (GstPad *pad)
peer = GST_RPAD_PEER (pad);
if (!peer) {
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);
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)));
}
else {
restart:
......@@ -2405,15 +2404,16 @@ restart:
}
/* no null buffers allowed */
gst_element_error (GST_PAD_PARENT (pad),
"NULL buffer during pull on %s:%s",
GST_DEBUG_PAD_NAME (pad));
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,