From 5c73a7824c0ed0ebad0163b09ca18371ca2a3cd2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 15 Jun 2001 19:13:45 +0000 Subject: [PATCH] Changed a stupid assert in request_pad. Original commit message from CVS: Changed a stupid assert in request_pad. Some fixes for pullregion and EOS conditions. Remove an unneeded check in the scheduler (check for NULL buffer) some EOS fixes for pullregion in disksrc. Removed the macro in the gstparse.h header 'cause it's internal to gstparse.c Added a check in gstparse for NULL element. --- gst/elements/gstdisksrc.c | 10 ++++++++-- gst/gstelement.c | 3 ++- gst/gstpad.c | 3 ++- gst/gstparse.c | 4 +++- gst/gstparse.h | 2 -- gst/gstscheduler.c | 2 +- plugins/elements/gstdisksrc.c | 10 ++++++++-- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gst/elements/gstdisksrc.c b/gst/elements/gstdisksrc.c index 9431e56..694d3e3 100644 --- a/gst/elements/gstdisksrc.c +++ b/gst/elements/gstdisksrc.c @@ -229,8 +229,10 @@ gst_disksrc_get (GstPad *pad) src = GST_DISKSRC (gst_pad_get_parent (pad)); g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL); + /* deal with EOF state */ if (src->curoffset >= src->size) { + GST_DEBUG (0,"map offset %ld >= size %ld --> eos\n", src->curoffset, src->size); gst_pad_set_eos (pad); return NULL; } @@ -292,8 +294,12 @@ gst_disksrc_get_region (GstPad *pad, GstRegionType type,guint64 offset,guint64 l /* deal with EOF state */ if (offset >= src->size) { - gst_pad_set_eos (pad); - return NULL; + //gst_pad_set_eos (pad); + GST_DEBUG (0,"map offset %lld >= size %ld --> eos\n", offset, src->size); + //FIXME + buf = gst_buffer_new(); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS); + return buf; } /* create the buffer */ diff --git a/gst/gstelement.c b/gst/gstelement.c index 52775ad..2d4aa9a 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -649,7 +649,8 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name) g_return_val_if_fail (name != NULL, NULL); templ = gst_element_get_padtemplate_by_name (element, name); - g_return_val_if_fail (templ != NULL, NULL); + if (templ == NULL) + return NULL; pad = gst_element_request_pad (element, templ); diff --git a/gst/gstpad.c b/gst/gstpad.c index 0240f46..0ea2a3b 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1544,7 +1544,8 @@ gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len break; } } - while (!(GST_BUFFER_OFFSET (result) == offset && + while (result && ! GST_BUFFER_FLAG_IS_SET (result, GST_BUFFER_EOS) + && !(GST_BUFFER_OFFSET (result) == offset && GST_BUFFER_SIZE (result) == len)); return result; diff --git a/gst/gstparse.c b/gst/gstparse.c index 7c8e5ce..7814399 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -24,6 +24,8 @@ #define DEBUG_NOPREFIX(format,args...) #define VERBOSE(format,args...) +#define GST_PARSE_LISTPAD(list) ((GstPad*)(list->data)) + #include #include "gst_private.h" @@ -333,7 +335,7 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr if (!sinkpads) GST_DEBUG(0,"can't find a sink pad for %s\n", gst_element_get_name (previous)); else GST_DEBUG(0,"have sink pad %s:%s\n",GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads))); - if (!srcpads && sinkpads) { + if (!srcpads && sinkpads && previous) { dyn_connect *connect = g_malloc (sizeof (dyn_connect)); connect->srcpadname = srcpadname; diff --git a/gst/gstparse.h b/gst/gstparse.h index 7742434..ff77704 100644 --- a/gst/gstparse.h +++ b/gst/gstparse.h @@ -25,8 +25,6 @@ #include -#define GST_PARSE_LISTPAD(list) ((GstPad*)(list->data)) - gint gst_parse_launch (const gchar *cmdline, GstBin *parent); #endif /* __GST_PARSE_H__ */ diff --git a/gst/gstscheduler.c b/gst/gstscheduler.c index 9a3e3f1..ad23a17 100644 --- a/gst/gstscheduler.c +++ b/gst/gstscheduler.c @@ -116,7 +116,7 @@ gst_schedule_src_wrapper (int argc,char *argv[]) } GST_DEBUG (GST_CAT_DATAFLOW,"calling gst_pad_push on pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad)); - if (buf) gst_pad_push ((GstPad*)realpad, buf); + gst_pad_push ((GstPad*)realpad, buf); } } } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); diff --git a/plugins/elements/gstdisksrc.c b/plugins/elements/gstdisksrc.c index 9431e56..694d3e3 100644 --- a/plugins/elements/gstdisksrc.c +++ b/plugins/elements/gstdisksrc.c @@ -229,8 +229,10 @@ gst_disksrc_get (GstPad *pad) src = GST_DISKSRC (gst_pad_get_parent (pad)); g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL); + /* deal with EOF state */ if (src->curoffset >= src->size) { + GST_DEBUG (0,"map offset %ld >= size %ld --> eos\n", src->curoffset, src->size); gst_pad_set_eos (pad); return NULL; } @@ -292,8 +294,12 @@ gst_disksrc_get_region (GstPad *pad, GstRegionType type,guint64 offset,guint64 l /* deal with EOF state */ if (offset >= src->size) { - gst_pad_set_eos (pad); - return NULL; + //gst_pad_set_eos (pad); + GST_DEBUG (0,"map offset %lld >= size %ld --> eos\n", offset, src->size); + //FIXME + buf = gst_buffer_new(); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS); + return buf; } /* create the buffer */ -- 2.7.4