mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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
This commit is contained in:
parent
ce8fe777e6
commit
be1eaa4de3
25 changed files with 294 additions and 179 deletions
|
@ -23,6 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstspideridentity.h"
|
#include "gstspideridentity.h"
|
||||||
#include "gstspider.h"
|
#include "gstspider.h"
|
||||||
|
@ -413,14 +414,14 @@ gst_spider_identity_src_loop (GstSpiderIdentity *ident)
|
||||||
static void
|
static void
|
||||||
gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
|
gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
|
||||||
{
|
{
|
||||||
GstBuffer *buf=NULL;
|
GstBuffer *buf = NULL;
|
||||||
GstBuffer *typefindbuf = NULL;
|
GstBuffer *typefindbuf = NULL;
|
||||||
gboolean getmorebuf = TRUE;
|
gboolean getmorebuf = TRUE;
|
||||||
GList *type_list;
|
GList *type_list;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
/* this should possibly be a property */
|
/* this should possibly be a property */
|
||||||
guint bufsizelimit = 4096;
|
guint bufsizelimit = 40960;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
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);
|
buf = gst_pad_pull (ident->sink);
|
||||||
|
|
||||||
/* if it's an event... */
|
/* if it's an event... */
|
||||||
while (GST_IS_EVENT (buf)) {
|
if (GST_IS_EVENT (buf)) {
|
||||||
switch (GST_EVENT_TYPE (GST_EVENT (buf))){
|
switch (GST_EVENT_TYPE (GST_EVENT (buf))){
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
getmorebuf = FALSE;
|
getmorebuf = FALSE;
|
||||||
|
@ -449,25 +450,20 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
|
||||||
/* handle DISCONT events, please */
|
/* 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){
|
if (!typefindbuf){
|
||||||
typefindbuf = buf;
|
typefindbuf = buf;
|
||||||
gst_buffer_ref(buf);
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
GstBuffer *oldbuf = typefindbuf;
|
GstBuffer *oldbuf = typefindbuf;
|
||||||
typefindbuf = gst_buffer_merge(typefindbuf, buf);
|
typefindbuf = gst_buffer_merge(typefindbuf, buf);
|
||||||
gst_buffer_unref(oldbuf);
|
gst_buffer_unref(oldbuf);
|
||||||
gst_buffer_unref(buf);
|
gst_buffer_unref(buf);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!typefindbuf){
|
if (!typefindbuf){
|
||||||
goto end;
|
return;
|
||||||
|
} else {
|
||||||
|
buf = typefindbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* maybe there are already valid caps now? */
|
/* 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);
|
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);
|
gst_buffer_unref(buf);
|
||||||
buf = GST_BUFFER (gst_event_new (GST_EVENT_EOS));
|
buf = GST_BUFFER (gst_event_new (GST_EVENT_EOS));
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstfakesink.h"
|
#include "gstfakesink.h"
|
||||||
|
|
||||||
|
@ -406,7 +407,9 @@ gst_fakesink_change_state (GstElement *element)
|
||||||
return GST_STATE_SUCCESS;
|
return GST_STATE_SUCCESS;
|
||||||
|
|
||||||
error:
|
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;
|
return GST_STATE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -222,9 +223,9 @@ gst_filesink_open_file (GstFileSink *sink)
|
||||||
|
|
||||||
sink->file = fopen (sink->filename, "w");
|
sink->file = fopen (sink->filename, "w");
|
||||||
if (sink->file == NULL) {
|
if (sink->file == NULL) {
|
||||||
gst_element_error (GST_ELEMENT (sink),
|
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
|
||||||
"Error opening file %s: %s",
|
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
|
||||||
sink->filename, g_strerror(errno));
|
g_strdup_printf ("Error opening file \"%s\": %s", sink->filename, g_strerror(errno)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +243,9 @@ gst_filesink_close_file (GstFileSink *sink)
|
||||||
|
|
||||||
if (fclose (sink->file) != 0)
|
if (fclose (sink->file) != 0)
|
||||||
{
|
{
|
||||||
gst_element_error (GST_ELEMENT (sink),
|
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
|
||||||
"Error closing file %s: %s",
|
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
|
||||||
sink->filename, g_strerror(errno));
|
g_strdup_printf ("Error closing file \"%s\": %s", sink->filename, g_strerror(errno)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
|
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 (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
||||||
if (fflush (filesink->file))
|
if (fflush (filesink->file))
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Error flushing file %s: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
filesink->filename, g_strerror(errno));
|
g_strdup_printf ("Error flushing file \"%s\": %s",
|
||||||
|
filesink->filename, g_strerror(errno)));
|
||||||
|
|
||||||
switch (GST_EVENT_SEEK_METHOD(event))
|
switch (GST_EVENT_SEEK_METHOD(event))
|
||||||
{
|
{
|
||||||
|
@ -372,9 +374,10 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
if (fflush (filesink->file)) {
|
if (fflush (filesink->file)) {
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Error flushing file %s: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
filesink->filename, g_strerror(errno));
|
g_strdup_printf ("Error flushing file \"%s\": %s",
|
||||||
|
filesink->filename, g_strerror(errno)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
@ -423,10 +426,10 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
filesink->file);
|
filesink->file);
|
||||||
if (wrote <= 0) {
|
if (wrote <= 0) {
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Only %d of %d bytes written: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
bytes_written, GST_BUFFER_SIZE (buf),
|
g_strdup_printf ("Only %d of %d bytes written: %s", bytes_written,
|
||||||
strerror (errno));
|
GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bytes_written += wrote;
|
bytes_written += wrote;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "gstfilesrc.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);
|
mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset);
|
||||||
|
|
||||||
if (mmapregion == NULL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (mmapregion == MAP_FAILED) {
|
else if (mmapregion == MAP_FAILED) {
|
||||||
|
@ -635,13 +638,11 @@ gst_filesrc_get_read (GstFileSrc *src)
|
||||||
g_return_val_if_fail (buf != NULL, NULL);
|
g_return_val_if_fail (buf != NULL, NULL);
|
||||||
|
|
||||||
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
|
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
|
||||||
|
GST_BUFFER_SIZE (buf) = ret;
|
||||||
if (ret < 0){
|
if (ret < 0){
|
||||||
gst_element_error (GST_ELEMENT (src), "reading file (%s)",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
strerror (errno), NULL);
|
g_strdup_printf (_("Could not read file \"%s\""), src->filename),
|
||||||
return NULL;
|
g_strdup_printf ("Error during file reading: %s", strerror (errno)));
|
||||||
}
|
|
||||||
if (ret < readsize) {
|
|
||||||
gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,8 +703,9 @@ gst_filesrc_open_file (GstFileSrc *src)
|
||||||
/* open the file */
|
/* open the file */
|
||||||
src->fd = open (src->filename, O_RDONLY);
|
src->fd = open (src->filename, O_RDONLY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
src->filename, strerror (errno), NULL);
|
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
|
||||||
|
g_strdup_printf ("Error opening file \"%s\": %s", src->filename, strerror (errno)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* check if it is a regular file, otherwise bail out */
|
/* 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);
|
fstat(src->fd, &stat_results);
|
||||||
|
|
||||||
if (!S_ISREG(stat_results.st_mode)) {
|
if (!S_ISREG(stat_results.st_mode)) {
|
||||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
src->filename, NULL);
|
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);
|
close(src->fd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstidentity.h"
|
#include "gstidentity.h"
|
||||||
|
|
||||||
|
@ -249,7 +250,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
identity->error_after--;
|
identity->error_after--;
|
||||||
if (identity->error_after == 0) {
|
if (identity->error_after == 0) {
|
||||||
gst_buffer_unref (buf);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstmultidisksrc.h"
|
#include "gstmultidisksrc.h"
|
||||||
|
|
||||||
|
@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
|
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
perror ("open");
|
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;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
|
@ -261,13 +265,16 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map,src->size, 2);
|
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
madvise (src->map, src->size, 2);
|
||||||
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
||||||
src->new_seek = TRUE;
|
src->new_seek = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstmultidisksrc.h"
|
#include "gstmultidisksrc.h"
|
||||||
|
|
||||||
|
@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
|
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
perror ("open");
|
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;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
|
@ -261,13 +265,16 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map,src->size, 2);
|
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
madvise (src->map, src->size, 2);
|
||||||
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
||||||
src->new_seek = TRUE;
|
src->new_seek = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstpipefilter.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));
|
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
|
||||||
if (close (pipefilter->fdin[1]) < 0)
|
if (close (pipefilter->fdin[1]) < 0)
|
||||||
perror("close");
|
GST_DEBUG ("close");
|
||||||
if (close (pipefilter->fdout[0]) < 0)
|
if (close (pipefilter->fdout[0]) < 0)
|
||||||
perror("close");
|
GST_DEBUG ("close");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +179,9 @@ gst_pipefilter_get (GstPad *pad)
|
||||||
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
|
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
|
||||||
GST_DEBUG ("read %ld bytes", readbytes);
|
GST_DEBUG ("read %ld bytes", readbytes);
|
||||||
if (readbytes < 0) {
|
if (readbytes < 0) {
|
||||||
perror("read");
|
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE,
|
||||||
gst_element_error(GST_ELEMENT(pipefilter),"reading");
|
g_strdup (_("Could not process data")),
|
||||||
|
g_strdup_printf ("Error reading from pipe: %s", strerror (errno)));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* if we didn't get as many bytes as we asked for, we're at EOF */
|
/* 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);
|
writebytes = write(pipefilter->fdin[1],data,size);
|
||||||
GST_DEBUG ("written %ld bytes", writebytes);
|
GST_DEBUG ("written %ld bytes", writebytes);
|
||||||
if (writebytes < 0) {
|
if (writebytes < 0) {
|
||||||
perror("write");
|
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE, g_strdup (""), g_strdup ("writing"));
|
||||||
gst_element_error(GST_ELEMENT(pipefilter),"writing");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gst_buffer_unref(buf);
|
gst_buffer_unref(buf);
|
||||||
|
@ -272,8 +273,7 @@ gst_pipefilter_open_file (GstPipefilter *src)
|
||||||
|
|
||||||
if((src->childpid = fork()) == -1)
|
if((src->childpid = fork()) == -1)
|
||||||
{
|
{
|
||||||
perror("fork");
|
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("forking"));
|
||||||
gst_element_error(GST_ELEMENT(src),"forking");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,8 +286,7 @@ gst_pipefilter_open_file (GstPipefilter *src)
|
||||||
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||||
execvp(src->command[0], &src->command[0]);
|
execvp(src->command[0], &src->command[0]);
|
||||||
/* will only reach if error */
|
/* will only reach if error */
|
||||||
perror("exec");
|
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("starting child process"));
|
||||||
gst_element_error(GST_ELEMENT(src),"starting child process");
|
|
||||||
return FALSE;
|
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 void gst_element_dispose (GObject *object);
|
||||||
|
|
||||||
static GstElementStateReturn gst_element_change_state (GstElement *element);
|
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
|
#ifndef GST_DISABLE_LOADSAVE
|
||||||
static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent);
|
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 GstObjectClass *parent_class = NULL;
|
||||||
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
static GQuark gst_element_error_quark;
|
||||||
|
|
||||||
GType gst_element_get_type (void)
|
GType gst_element_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -121,8 +122,8 @@ gst_element_class_init (GstElementClass *klass)
|
||||||
gst_element_signals[ERROR] =
|
gst_element_signals[ERROR] =
|
||||||
g_signal_new ("error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GstElementClass, error), NULL, NULL,
|
G_STRUCT_OFFSET (GstElementClass, error), NULL, NULL,
|
||||||
gst_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
|
gst_marshal_VOID__OBJECT_POINTER_STRING, G_TYPE_NONE, 3,
|
||||||
G_TYPE_OBJECT, G_TYPE_STRING);
|
G_TYPE_OBJECT, G_TYPE_POINTER, G_TYPE_STRING);
|
||||||
gst_element_signals[EOS] =
|
gst_element_signals[EOS] =
|
||||||
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GstElementClass,eos), NULL, NULL,
|
G_STRUCT_OFFSET (GstElementClass,eos), NULL, NULL,
|
||||||
|
@ -143,6 +144,8 @@ gst_element_class_init (GstElementClass *klass)
|
||||||
klass->elementfactory = NULL;
|
klass->elementfactory = NULL;
|
||||||
klass->padtemplates = NULL;
|
klass->padtemplates = NULL;
|
||||||
klass->numpadtemplates = 0;
|
klass->numpadtemplates = 0;
|
||||||
|
|
||||||
|
gst_element_error_quark = g_quark_from_static_string ("GstError");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1788,17 +1791,17 @@ gst_element_unlink (GstElement *src, GstElement *dest)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_element_error_func (GstElement* element, GstElement *source,
|
gst_element_error_func (GstElement* element, GstElement *source,
|
||||||
gchar *errormsg)
|
GError *error, gchar *errormsg)
|
||||||
{
|
{
|
||||||
/* tell the parent */
|
/* tell the parent */
|
||||||
if (GST_OBJECT_PARENT (element)) {
|
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),
|
errormsg, GST_ELEMENT_NAME (element),
|
||||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||||
|
|
||||||
gst_object_ref (GST_OBJECT (element));
|
gst_object_ref (GST_OBJECT (element));
|
||||||
g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (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));
|
gst_object_unref (GST_OBJECT (element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2079,33 +2082,36 @@ gst_element_convert (GstElement *element,
|
||||||
* It results in the "error" signal.
|
* It results in the "error" signal.
|
||||||
*/
|
*/
|
||||||
void
|
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 *really_detailed;
|
||||||
gchar *string;
|
GError *error;
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||||
g_return_if_fail (error != NULL);
|
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 the element was already in error, stop now */
|
||||||
if (GST_FLAG_IS_SET (element, GST_ELEMENT_ERROR)) {
|
if (GST_FLAG_IS_SET (element, GST_ELEMENT_ERROR)) {
|
||||||
GST_CAT_INFO (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element));
|
GST_CAT_INFO_OBJECT (GST_CAT_EVENT, element, "recursive ERROR detected, skipping");
|
||||||
g_free (string);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_FLAG_SET (element, GST_ELEMENT_ERROR);
|
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 */
|
/* emit the signal, make sure the element stays available */
|
||||||
gst_object_ref (GST_OBJECT (element));
|
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 */
|
/* tell the scheduler */
|
||||||
if (element->sched) {
|
if (element->sched) {
|
||||||
|
@ -2125,7 +2131,7 @@ gst_element_error (GstElement *element, const gchar *error, ...)
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
gst_object_unref (GST_OBJECT (element));
|
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 (*state_change) (GstElement *element, GstElementState old, GstElementState state);
|
||||||
void (*new_pad) (GstElement *element, GstPad *pad);
|
void (*new_pad) (GstElement *element, GstPad *pad);
|
||||||
void (*pad_removed) (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);
|
void (*eos) (GstElement *element);
|
||||||
|
|
||||||
/* local pointers for get/set */
|
/* 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_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);
|
gboolean gst_element_is_locked_state (GstElement *element);
|
||||||
void gst_element_set_locked_state (GstElement *element, gboolean locked_state);
|
void gst_element_set_locked_state (GstElement *element, gboolean locked_state);
|
||||||
|
|
|
@ -6,6 +6,7 @@ VOID:POINTER
|
||||||
VOID:OBJECT
|
VOID:OBJECT
|
||||||
VOID:OBJECT,PARAM
|
VOID:OBJECT,PARAM
|
||||||
VOID:OBJECT,POINTER
|
VOID:OBJECT,POINTER
|
||||||
|
VOID:OBJECT,POINTER,STRING
|
||||||
VOID:OBJECT,STRING
|
VOID:OBJECT,STRING
|
||||||
VOID:INT,INT
|
VOID:INT,INT
|
||||||
VOID:INT64
|
VOID:INT64
|
||||||
|
|
32
gst/gstpad.c
32
gst/gstpad.c
|
@ -864,11 +864,11 @@ gst_pad_unlink (GstPad *srcpad,
|
||||||
g_return_if_fail ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) &&
|
g_return_if_fail ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) &&
|
||||||
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SINK));
|
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SINK));
|
||||||
|
|
||||||
if (GST_RPAD_UNLINKFUNC (srcpad)) {
|
if (GST_RPAD_UNLINKFUNC (realsrc)) {
|
||||||
GST_RPAD_UNLINKFUNC (srcpad) (srcpad);
|
GST_RPAD_UNLINKFUNC (realsrc) (GST_PAD_CAST (realsrc));
|
||||||
}
|
}
|
||||||
if (GST_RPAD_UNLINKFUNC (sinkpad)) {
|
if (GST_RPAD_UNLINKFUNC (realsink)) {
|
||||||
GST_RPAD_UNLINKFUNC (sinkpad) (sinkpad);
|
GST_RPAD_UNLINKFUNC (realsink) (GST_PAD_CAST (realsink));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the schedulers before we unlink */
|
/* get the schedulers before we unlink */
|
||||||
|
@ -2077,8 +2077,8 @@ gst_pad_recover_caps_error (GstPad *pad, GstCaps *allowed)
|
||||||
|
|
||||||
/* report error */
|
/* report error */
|
||||||
parent = gst_pad_get_parent (pad);
|
parent = gst_pad_get_parent (pad);
|
||||||
gst_element_error (parent, "negotiation failed on pad %s:%s",
|
gst_element_gerror (parent, GST_ERROR_CAPS_NEGOTIATION, g_strdup (_("Cannot decode the given data type")),
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
g_strdup_printf ("negotiation failed on pad %s:%s", GST_DEBUG_PAD_NAME (pad)));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2381,10 +2381,9 @@ gst_pad_pull (GstPad *pad)
|
||||||
peer = GST_RPAD_PEER (pad);
|
peer = GST_RPAD_PEER (pad);
|
||||||
|
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
gst_element_error (GST_PAD_PARENT (pad),
|
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
|
||||||
"pull on pad %s:%s but it was unlinked",
|
g_strdup (_("application error: GStreamer was used wrong")),
|
||||||
GST_ELEMENT_NAME (GST_PAD_PARENT (pad)),
|
g_strdup_printf ("pull on pad %s:%s but it was unlinked", GST_DEBUG_PAD_NAME (pad)));
|
||||||
GST_PAD_NAME (pad), NULL);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
restart:
|
restart:
|
||||||
|
@ -2405,15 +2404,16 @@ restart:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no null buffers allowed */
|
/* no null buffers allowed */
|
||||||
gst_element_error (GST_PAD_PARENT (pad),
|
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
|
||||||
"NULL buffer during pull on %s:%s",
|
g_strdup (_("application error: GStreamer was used wrong")),
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
g_strdup_printf ("NULL buffer during pull on %s:%s", GST_DEBUG_PAD_NAME (pad)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gst_element_error (GST_PAD_PARENT (pad),
|
gst_element_gerror (GST_PAD_PARENT (pad), GST_ERROR_PIPELINE,
|
||||||
"internal error: pull on pad %s:%s "
|
g_strdup (_("application error: GStreamer was used wrong")),
|
||||||
|
g_strdup_printf ("internal error: pull on pad %s:%s "
|
||||||
"but the peer pad %s:%s has no gethandler",
|
"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));
|
return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT));
|
||||||
|
|
44
gst/gstpad.h
44
gst/gstpad.h
|
@ -247,34 +247,34 @@ struct _GstGhostPadClass {
|
||||||
#define GST_PAD_PAD_TEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
|
#define GST_PAD_PAD_TEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
|
||||||
|
|
||||||
/* GstRealPad */
|
/* GstRealPad */
|
||||||
#define GST_RPAD_DIRECTION(pad) (((GstRealPad *)(pad))->direction)
|
#define GST_RPAD_DIRECTION(pad) (GST_REAL_PAD(pad)->direction)
|
||||||
#define GST_RPAD_CAPS(pad) (((GstRealPad *)(pad))->caps)
|
#define GST_RPAD_CAPS(pad) (GST_REAL_PAD(pad)->caps)
|
||||||
#define GST_RPAD_FILTER(pad) (((GstRealPad *)(pad))->filter)
|
#define GST_RPAD_FILTER(pad) (GST_REAL_PAD(pad)->filter)
|
||||||
#define GST_RPAD_APPFILTER(pad) (((GstRealPad *)(pad))->appfilter)
|
#define GST_RPAD_APPFILTER(pad) (GST_REAL_PAD(pad)->appfilter)
|
||||||
#define GST_RPAD_PEER(pad) (((GstRealPad *)(pad))->peer)
|
#define GST_RPAD_PEER(pad) (GST_REAL_PAD(pad)->peer)
|
||||||
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc)
|
#define GST_RPAD_CHAINFUNC(pad) (GST_REAL_PAD(pad)->chainfunc)
|
||||||
#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler)
|
#define GST_RPAD_CHAINHANDLER(pad) (GST_REAL_PAD(pad)->chainhandler)
|
||||||
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc)
|
#define GST_RPAD_GETFUNC(pad) (GST_REAL_PAD(pad)->getfunc)
|
||||||
#define GST_RPAD_GETHANDLER(pad) (((GstRealPad *)(pad))->gethandler)
|
#define GST_RPAD_GETHANDLER(pad) (GST_REAL_PAD(pad)->gethandler)
|
||||||
#define GST_RPAD_EVENTFUNC(pad) (((GstRealPad *)(pad))->eventfunc)
|
#define GST_RPAD_EVENTFUNC(pad) (GST_REAL_PAD(pad)->eventfunc)
|
||||||
#define GST_RPAD_EVENTHANDLER(pad) (((GstRealPad *)(pad))->eventhandler)
|
#define GST_RPAD_EVENTHANDLER(pad) (GST_REAL_PAD(pad)->eventhandler)
|
||||||
#define GST_RPAD_CONVERTFUNC(pad) (((GstRealPad *)(pad))->convertfunc)
|
#define GST_RPAD_CONVERTFUNC(pad) (GST_REAL_PAD(pad)->convertfunc)
|
||||||
#define GST_RPAD_QUERYFUNC(pad) (((GstRealPad *)(pad))->queryfunc)
|
#define GST_RPAD_QUERYFUNC(pad) (GST_REAL_PAD(pad)->queryfunc)
|
||||||
#define GST_RPAD_INTLINKFUNC(pad) (((GstRealPad *)(pad))->intlinkfunc)
|
#define GST_RPAD_INTLINKFUNC(pad) (GST_REAL_PAD(pad)->intlinkfunc)
|
||||||
#define GST_RPAD_FORMATSFUNC(pad) (((GstRealPad *)(pad))->formatsfunc)
|
#define GST_RPAD_FORMATSFUNC(pad) (GST_REAL_PAD(pad)->formatsfunc)
|
||||||
#define GST_RPAD_QUERYTYPEFUNC(pad) (((GstRealPad *)(pad))->querytypefunc)
|
#define GST_RPAD_QUERYTYPEFUNC(pad) (GST_REAL_PAD(pad)->querytypefunc)
|
||||||
#define GST_RPAD_EVENTMASKFUNC(pad) (((GstRealPad *)(pad))->eventmaskfunc)
|
#define GST_RPAD_EVENTMASKFUNC(pad) (GST_REAL_PAD(pad)->eventmaskfunc)
|
||||||
|
|
||||||
#define GST_RPAD_LINKFUNC(pad) (((GstRealPad *)(pad))->linkfunc)
|
#define GST_RPAD_LINKFUNC(pad) (GST_REAL_PAD(pad)->linkfunc)
|
||||||
#define GST_RPAD_UNLINKFUNC(pad) (((GstRealPad *)(pad))->unlinkfunc)
|
#define GST_RPAD_UNLINKFUNC(pad) (GST_REAL_PAD(pad)->unlinkfunc)
|
||||||
#define GST_RPAD_GETCAPSFUNC(pad) (((GstRealPad *)(pad))->getcapsfunc)
|
#define GST_RPAD_GETCAPSFUNC(pad) (GST_REAL_PAD(pad)->getcapsfunc)
|
||||||
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc)
|
#define GST_RPAD_BUFFERPOOLFUNC(pad) (GST_REAL_PAD(pad)->bufferpoolfunc)
|
||||||
|
|
||||||
/* GstGhostPad */
|
/* GstGhostPad */
|
||||||
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad)
|
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad)
|
||||||
|
|
||||||
/* Generic */
|
/* Generic */
|
||||||
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
|
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? GST_REAL_PAD(pad) : GST_GPAD_REALPAD(pad))
|
||||||
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(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_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad))
|
||||||
#define GST_PAD_PEER(pad) GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))
|
#define GST_PAD_PEER(pad) GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))
|
||||||
|
|
|
@ -413,7 +413,9 @@ restart:
|
||||||
if (!queue->may_deadlock) {
|
if (!queue->may_deadlock) {
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
gst_data_unref (GST_DATA (buf));
|
gst_data_unref (GST_DATA (buf));
|
||||||
gst_element_error (GST_ELEMENT (queue), "deadlock found, source pad elements are shut down");
|
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"));
|
||||||
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
|
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +495,9 @@ restart:
|
||||||
/* this means the other end is shut down */
|
/* this means the other end is shut down */
|
||||||
if (!queue->may_deadlock) {
|
if (!queue->may_deadlock) {
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
gst_element_error (GST_ELEMENT (queue), "deadlock found, sink pad elements are shut down");
|
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"));
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -236,8 +236,9 @@ end:
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
if (typefind->max_buffers && typefind->num_buffer >= typefind->max_buffers) {
|
if (typefind->max_buffers && typefind->num_buffer >= typefind->max_buffers) {
|
||||||
gst_element_error (GST_ELEMENT (typefind),
|
gst_element_gerror (GST_ELEMENT (typefind), GST_ERROR_INVALID_DATA,
|
||||||
"typefind could not determine type after %d buffers", typefind->num_buffer);
|
g_strdup (_("The data cannot be identified")),
|
||||||
|
g_strdup_printf ("typefind could not determine type after %d buffers", typefind->num_buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,25 @@ typedef enum {
|
||||||
GST_RESULT_NOT_IMPL
|
GST_RESULT_NOT_IMPL
|
||||||
} GstResult;
|
} 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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_TYPES_H__ */
|
#endif /* __GST_TYPES_H__ */
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
@ -451,8 +452,9 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loop_count == 0) {
|
if (loop_count == 0) {
|
||||||
gst_element_error (parent,
|
gst_element_gerror (parent, GST_ERROR_INTERNAL,
|
||||||
"(internal error) basic: maximum number of switches exceeded");
|
g_strdup (_("Internal error in GStreamer")),
|
||||||
|
g_strdup ("basic scheduler error: maximum number of switches exceeded"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +521,9 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad)
|
||||||
GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!");
|
GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!");
|
||||||
pad = (GstPad *) GST_RPAD_PEER (peer);
|
pad = (GstPad *) GST_RPAD_PEER (peer);
|
||||||
if (!pad) {
|
if (!pad) {
|
||||||
gst_element_error (parent, "pad unlinked");
|
gst_element_gerror (parent, GST_ERROR_PIPELINE,
|
||||||
|
g_strdup (_("application error")),
|
||||||
|
g_strdup_printf ("pad %s:%s is unlinked", GST_DEBUG_PAD_NAME (peer)));
|
||||||
}
|
}
|
||||||
parent = GST_PAD_PARENT (pad);
|
parent = GST_PAD_PARENT (pad);
|
||||||
peer = GST_RPAD_PEER (pad);
|
peer = GST_RPAD_PEER (pad);
|
||||||
|
@ -650,10 +654,10 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
||||||
* either, we have an error */
|
* either, we have an error */
|
||||||
if (different_sched && !peer_decoupled)
|
if (different_sched && !peer_decoupled)
|
||||||
{
|
{
|
||||||
gst_element_error (element,
|
gst_element_gerror (element, GST_ERROR_PIPELINE,
|
||||||
"element \"%s\" is not decoupled but has pads "
|
g_strdup (_("application error")),
|
||||||
"in different schedulers",
|
g_strdup_printf ("element \"%s\" is not decoupled but has pads "
|
||||||
GST_ELEMENT_NAME (element), NULL);
|
"in different schedulers", GST_ELEMENT_NAME (element)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* ok, the peer is in a different scheduler and is decoupled,
|
/* ok, the peer is in a different scheduler and is decoupled,
|
||||||
|
@ -719,8 +723,9 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
||||||
chain->sched->context,
|
chain->sched->context,
|
||||||
wrapper_function, 0, (char **) element);
|
wrapper_function, 0, (char **) element);
|
||||||
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
|
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
|
||||||
gst_element_error (element, "could not create cothread for \"%s\"",
|
gst_element_gerror (element, GST_ERROR_INTERNAL,
|
||||||
GST_ELEMENT_NAME (element), NULL);
|
g_strdup (_("internal GStreamer error")),
|
||||||
|
g_strdup_printf ("could not create cothread for \"%s\"", GST_ELEMENT_NAME (element)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
GST_DEBUG ("created cothread %p for '%s'",
|
GST_DEBUG ("created cothread %p for '%s'",
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstfakesink.h"
|
#include "gstfakesink.h"
|
||||||
|
|
||||||
|
@ -406,7 +407,9 @@ gst_fakesink_change_state (GstElement *element)
|
||||||
return GST_STATE_SUCCESS;
|
return GST_STATE_SUCCESS;
|
||||||
|
|
||||||
error:
|
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;
|
return GST_STATE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -222,9 +223,9 @@ gst_filesink_open_file (GstFileSink *sink)
|
||||||
|
|
||||||
sink->file = fopen (sink->filename, "w");
|
sink->file = fopen (sink->filename, "w");
|
||||||
if (sink->file == NULL) {
|
if (sink->file == NULL) {
|
||||||
gst_element_error (GST_ELEMENT (sink),
|
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
|
||||||
"Error opening file %s: %s",
|
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
|
||||||
sink->filename, g_strerror(errno));
|
g_strdup_printf ("Error opening file \"%s\": %s", sink->filename, g_strerror(errno)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +243,9 @@ gst_filesink_close_file (GstFileSink *sink)
|
||||||
|
|
||||||
if (fclose (sink->file) != 0)
|
if (fclose (sink->file) != 0)
|
||||||
{
|
{
|
||||||
gst_element_error (GST_ELEMENT (sink),
|
gst_element_gerror (GST_ELEMENT (sink), GST_ERROR_DEVICE,
|
||||||
"Error closing file %s: %s",
|
g_strdup_printf (_("Could not open file \"%s\""), sink->filename),
|
||||||
sink->filename, g_strerror(errno));
|
g_strdup_printf ("Error closing file \"%s\": %s", sink->filename, g_strerror(errno)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
|
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 (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
||||||
if (fflush (filesink->file))
|
if (fflush (filesink->file))
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Error flushing file %s: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
filesink->filename, g_strerror(errno));
|
g_strdup_printf ("Error flushing file \"%s\": %s",
|
||||||
|
filesink->filename, g_strerror(errno)));
|
||||||
|
|
||||||
switch (GST_EVENT_SEEK_METHOD(event))
|
switch (GST_EVENT_SEEK_METHOD(event))
|
||||||
{
|
{
|
||||||
|
@ -372,9 +374,10 @@ gst_filesink_handle_event (GstPad *pad, GstEvent *event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
if (fflush (filesink->file)) {
|
if (fflush (filesink->file)) {
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Error flushing file %s: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
filesink->filename, g_strerror(errno));
|
g_strdup_printf ("Error flushing file \"%s\": %s",
|
||||||
|
filesink->filename, g_strerror(errno)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
@ -423,10 +426,10 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
filesink->file);
|
filesink->file);
|
||||||
if (wrote <= 0) {
|
if (wrote <= 0) {
|
||||||
gst_element_error (GST_ELEMENT (filesink),
|
gst_element_gerror (GST_ELEMENT (filesink), GST_ERROR_DEVICE,
|
||||||
"Only %d of %d bytes written: %s",
|
g_strdup_printf (_("Could not write to file \"%s\""), filesink->filename),
|
||||||
bytes_written, GST_BUFFER_SIZE (buf),
|
g_strdup_printf ("Only %d of %d bytes written: %s", bytes_written,
|
||||||
strerror (errno));
|
GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bytes_written += wrote;
|
bytes_written += wrote;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "gstfilesrc.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);
|
mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset);
|
||||||
|
|
||||||
if (mmapregion == NULL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (mmapregion == MAP_FAILED) {
|
else if (mmapregion == MAP_FAILED) {
|
||||||
|
@ -635,13 +638,11 @@ gst_filesrc_get_read (GstFileSrc *src)
|
||||||
g_return_val_if_fail (buf != NULL, NULL);
|
g_return_val_if_fail (buf != NULL, NULL);
|
||||||
|
|
||||||
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
|
ret = read (src->fd, GST_BUFFER_DATA (buf), readsize);
|
||||||
|
GST_BUFFER_SIZE (buf) = ret;
|
||||||
if (ret < 0){
|
if (ret < 0){
|
||||||
gst_element_error (GST_ELEMENT (src), "reading file (%s)",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
strerror (errno), NULL);
|
g_strdup_printf (_("Could not read file \"%s\""), src->filename),
|
||||||
return NULL;
|
g_strdup_printf ("Error during file reading: %s", strerror (errno)));
|
||||||
}
|
|
||||||
if (ret < readsize) {
|
|
||||||
gst_element_error (GST_ELEMENT (src), "unexpected end of file", NULL);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,8 +703,9 @@ gst_filesrc_open_file (GstFileSrc *src)
|
||||||
/* open the file */
|
/* open the file */
|
||||||
src->fd = open (src->filename, O_RDONLY);
|
src->fd = open (src->filename, O_RDONLY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" (%s)",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
src->filename, strerror (errno), NULL);
|
g_strdup_printf (_("Could not open file \"%s\""), src->filename),
|
||||||
|
g_strdup_printf ("Error opening file \"%s\": %s", src->filename, strerror (errno)));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* check if it is a regular file, otherwise bail out */
|
/* 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);
|
fstat(src->fd, &stat_results);
|
||||||
|
|
||||||
if (!S_ISREG(stat_results.st_mode)) {
|
if (!S_ISREG(stat_results.st_mode)) {
|
||||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
|
gst_element_gerror (GST_ELEMENT (src), GST_ERROR_DEVICE,
|
||||||
src->filename, NULL);
|
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);
|
close(src->fd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstidentity.h"
|
#include "gstidentity.h"
|
||||||
|
|
||||||
|
@ -249,7 +250,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
identity->error_after--;
|
identity->error_after--;
|
||||||
if (identity->error_after == 0) {
|
if (identity->error_after == 0) {
|
||||||
gst_buffer_unref (buf);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstmultidisksrc.h"
|
#include "gstmultidisksrc.h"
|
||||||
|
|
||||||
|
@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
|
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
perror ("open");
|
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;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
|
@ -261,13 +265,16 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map,src->size, 2);
|
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
madvise (src->map, src->size, 2);
|
||||||
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
||||||
src->new_seek = TRUE;
|
src->new_seek = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstmultidisksrc.h"
|
#include "gstmultidisksrc.h"
|
||||||
|
|
||||||
|
@ -253,7 +255,9 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
|
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
perror ("open");
|
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;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
|
@ -261,13 +265,16 @@ gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map,src->size, 2);
|
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
madvise (src->map, src->size, 2);
|
||||||
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
|
||||||
src->new_seek = TRUE;
|
src->new_seek = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "gst/gst_private.h"
|
||||||
|
|
||||||
#include "gstpipefilter.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));
|
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
|
||||||
if (close (pipefilter->fdin[1]) < 0)
|
if (close (pipefilter->fdin[1]) < 0)
|
||||||
perror("close");
|
GST_DEBUG ("close");
|
||||||
if (close (pipefilter->fdout[0]) < 0)
|
if (close (pipefilter->fdout[0]) < 0)
|
||||||
perror("close");
|
GST_DEBUG ("close");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +179,9 @@ gst_pipefilter_get (GstPad *pad)
|
||||||
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
|
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
|
||||||
GST_DEBUG ("read %ld bytes", readbytes);
|
GST_DEBUG ("read %ld bytes", readbytes);
|
||||||
if (readbytes < 0) {
|
if (readbytes < 0) {
|
||||||
perror("read");
|
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE,
|
||||||
gst_element_error(GST_ELEMENT(pipefilter),"reading");
|
g_strdup (_("Could not process data")),
|
||||||
|
g_strdup_printf ("Error reading from pipe: %s", strerror (errno)));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* if we didn't get as many bytes as we asked for, we're at EOF */
|
/* 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);
|
writebytes = write(pipefilter->fdin[1],data,size);
|
||||||
GST_DEBUG ("written %ld bytes", writebytes);
|
GST_DEBUG ("written %ld bytes", writebytes);
|
||||||
if (writebytes < 0) {
|
if (writebytes < 0) {
|
||||||
perror("write");
|
gst_element_gerror (GST_ELEMENT(pipefilter), GST_ERROR_DEVICE, g_strdup (""), g_strdup ("writing"));
|
||||||
gst_element_error(GST_ELEMENT(pipefilter),"writing");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gst_buffer_unref(buf);
|
gst_buffer_unref(buf);
|
||||||
|
@ -272,8 +273,7 @@ gst_pipefilter_open_file (GstPipefilter *src)
|
||||||
|
|
||||||
if((src->childpid = fork()) == -1)
|
if((src->childpid = fork()) == -1)
|
||||||
{
|
{
|
||||||
perror("fork");
|
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("forking"));
|
||||||
gst_element_error(GST_ELEMENT(src),"forking");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,8 +286,7 @@ gst_pipefilter_open_file (GstPipefilter *src)
|
||||||
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||||
execvp(src->command[0], &src->command[0]);
|
execvp(src->command[0], &src->command[0]);
|
||||||
/* will only reach if error */
|
/* will only reach if error */
|
||||||
perror("exec");
|
gst_element_gerror (GST_ELEMENT(src), GST_ERROR_UNKNOWN, g_strdup (""), g_strdup ("starting child process"));
|
||||||
gst_element_error(GST_ELEMENT(src),"starting child process");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,9 @@ restart:
|
||||||
if (!queue->may_deadlock) {
|
if (!queue->may_deadlock) {
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
gst_data_unref (GST_DATA (buf));
|
gst_data_unref (GST_DATA (buf));
|
||||||
gst_element_error (GST_ELEMENT (queue), "deadlock found, source pad elements are shut down");
|
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"));
|
||||||
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
|
/* we don't want to goto out_unref here, since we want to clean up before calling gst_element_error */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +495,9 @@ restart:
|
||||||
/* this means the other end is shut down */
|
/* this means the other end is shut down */
|
||||||
if (!queue->may_deadlock) {
|
if (!queue->may_deadlock) {
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
gst_element_error (GST_ELEMENT (queue), "deadlock found, sink pad elements are shut down");
|
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"));
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue