+2004-08-12 Benjamin Otte <in7y118@public.uni-hamburg.de>
+
+ * gst/elements/gstfilesrc.c: (gst_filesrc_get_mmap):
+ work with non-regular files that can be mmapped (like /dev/zero)
+ * gst/elements/gsttypefindelement.c: (gst_type_find_element_chain):
+ get rid of typefinds that require a seek when we can't seek instead
+ of trying them over and over again
+ * tools/gst-launch.c: (idle_func), (error_cb), (main):
+ return non-zero failure value when the pipeline was interrupted or
+ an error occurred
+
2004-08-11 Steve Lhomme <steve.lhomme@free.fr>
* win32/config.h:
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
/* check to see if we're going to overflow the end of the file */
- if (readend > src->filelen) {
- if (!gst_filesrc_check_filesize (src) || readend > src->filelen) {
- readsize = src->filelen - src->curoffset;
- readend = src->curoffset + readsize;
+ if (src->is_regular) {
+ if (readend > src->filelen) {
+ if (!gst_filesrc_check_filesize (src) || readend > src->filelen) {
+ readsize = src->filelen - src->curoffset;
+ readend = src->curoffset + readsize;
+ }
}
}
if (typefind->caps) {
stop_typefinding (typefind);
} else if (typefind->possibilities == NULL) {
+ error:
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
stop_typefinding (typefind);
} else {
}
if (!walk) {
/* find out if we should seek */
+ restart:
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
entry = (TypeFindEntry *) walk->data;
if (entry->requested_size > 0) {
GST_DEBUG_OBJECT (typefind,
"'%s' was reset - couldn't seek to %" G_GINT64_FORMAT,
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
- entry->requested_size = 0;
- entry->requested_offset = 0;
+ if (entry->probability == 0) {
+ free_entry (entry);
+ typefind->possibilities =
+ g_list_delete_link (typefind->possibilities, walk);
+ /* FIXME: too many gotos */
+ if (!typefind->possibilities)
+ goto error;
+ /* we modified the list, let's restart */
+ goto restart;
+ } else {
+ entry->requested_size = 0;
+ entry->requested_offset = 0;
+ }
}
}
}
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
/* check to see if we're going to overflow the end of the file */
- if (readend > src->filelen) {
- if (!gst_filesrc_check_filesize (src) || readend > src->filelen) {
- readsize = src->filelen - src->curoffset;
- readend = src->curoffset + readsize;
+ if (src->is_regular) {
+ if (readend > src->filelen) {
+ if (!gst_filesrc_check_filesize (src) || readend > src->filelen) {
+ readsize = src->filelen - src->curoffset;
+ readend = src->curoffset + readsize;
+ }
}
}
if (typefind->caps) {
stop_typefinding (typefind);
} else if (typefind->possibilities == NULL) {
+ error:
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
stop_typefinding (typefind);
} else {
}
if (!walk) {
/* find out if we should seek */
+ restart:
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
entry = (TypeFindEntry *) walk->data;
if (entry->requested_size > 0) {
GST_DEBUG_OBJECT (typefind,
"'%s' was reset - couldn't seek to %" G_GINT64_FORMAT,
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
- entry->requested_size = 0;
- entry->requested_offset = 0;
+ if (entry->probability == 0) {
+ free_entry (entry);
+ typefind->possibilities =
+ g_list_delete_link (typefind->possibilities, walk);
+ /* FIXME: too many gotos */
+ if (!typefind->possibilities)
+ goto error;
+ /* we modified the list, let's restart */
+ goto restart;
+ } else {
+ entry->requested_size = 0;
+ entry->requested_offset = 0;
+ }
}
}
}
static GstClock *s_clock;
static GstElement *pipeline;
gboolean caught_intr = FALSE;
+gboolean caught_error = FALSE;
gboolean
idle_func (gpointer data)
min = MIN (min, diff);
max = MAX (max, diff);
- if (!busy || caught_intr || (max_iterations > 0
- && iterations >= max_iterations)) {
+ if (!busy || caught_intr || caught_error ||
+ (max_iterations > 0 && iterations >= max_iterations)) {
char *s_iterations;
char *s_sum;
char *s_ave;
g_free (str);
}
}
+
static void
found_tag (GObject * pipeline, GstElement * source, GstTagList * tags)
{
gst_tag_list_foreach (tags, print_tag, NULL);
}
+static void
+error_cb (GObject * object, GstObject * source, GError * error, gchar * debug)
+{
+ gst_element_default_error (object, source, error, debug);
+ caught_error = TRUE;
+}
+
#ifndef DISABLE_FAULT_HANDLER
/* we only use sighandler here because the registers are not important */
static void
} else {
fprintf (stderr, _("ERROR: pipeline could not be constructed.\n"));
}
- exit (1);
+ return 1;
} else if (error) {
fprintf (stderr, _("WARNING: erroneous pipeline: %s\n"), error->message);
fprintf (stderr, _(" Trying to run anyway.\n"));
if (tags) {
g_signal_connect (pipeline, "found-tag", G_CALLBACK (found_tag), NULL);
}
- g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error),
- NULL);
+ g_signal_connect (pipeline, "error", G_CALLBACK (error_cb), NULL);
#ifndef GST_DISABLE_LOADSAVE
if (savefile) {
if (real_pipeline == NULL) {
fprintf (stderr, _("ERROR: the 'pipeline' element wasn't found.\n"));
- exit (1);
+ return 1;
}
gst_bin_add (GST_BIN (real_pipeline), pipeline);
pipeline = real_pipeline;
gst_element_wait_state_change (pipeline);
g_print ("got the state change.\n");
}
+ if (caught_intr)
+ res = 2;
+ if (caught_error)
+ res = 3;
gst_element_set_state (pipeline, GST_STATE_NULL);
}