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.
This commit is contained in:
Wim Taymans 2001-06-15 19:13:45 +00:00
parent 710fb2ad9f
commit 5c73a7824c
7 changed files with 24 additions and 10 deletions

View file

@ -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 */

View file

@ -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);

View file

@ -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;

View file

@ -24,6 +24,8 @@
#define DEBUG_NOPREFIX(format,args...)
#define VERBOSE(format,args...)
#define GST_PARSE_LISTPAD(list) ((GstPad*)(list->data))
#include <string.h>
#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;

View file

@ -25,8 +25,6 @@
#include <gst/gstbin.h>
#define GST_PARSE_LISTPAD(list) ((GstPad*)(list->data))
gint gst_parse_launch (const gchar *cmdline, GstBin *parent);
#endif /* __GST_PARSE_H__ */

View file

@ -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));

View file

@ -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 */