diff --git a/ChangeLog b/ChangeLog index b6fa9a5bd2..a4646e4b76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-01-19 Wim Taymans + + * gst/elements/gstfilesrc.c: (gst_filesrc_getrange), + (gst_filesrc_open_file), (gst_filesrc_loop), + (gst_filesrc_activate), (filesrc_find_peek), + (gst_filesrc_type_find): + * gst/elements/gstfilesrc.h: + Fix filesrc push based scheduling. + 2005-01-18 Wim Taymans * gst/elements/gstfilesrc.c: (gst_filesrc_getrange), diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index c5283f9eb5..3371b3c58e 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -899,22 +899,22 @@ gst_filesrc_close_file (GstFileSrc * src) } static void -gst_filesrc_loop (GstElement * element) +gst_filesrc_loop (GstPad * pad) { GstFileSrc *filesrc; gboolean result; GstBuffer *buffer; - filesrc = GST_FILESRC (element); + filesrc = GST_FILESRC (GST_PAD_PARENT (pad)); - result = gst_filesrc_get (filesrc->srcpad, &buffer); + result = gst_filesrc_get (pad, &buffer); if (result != GST_FLOW_OK) { - gst_task_stop (filesrc->task); + gst_task_pause (GST_RPAD_TASK (pad)); return; } - result = gst_pad_push (filesrc->srcpad, buffer); + result = gst_pad_push (pad, buffer); if (result != GST_FLOW_OK) { - gst_task_stop (filesrc->task); + gst_task_pause (GST_RPAD_TASK (pad)); } } @@ -943,7 +943,6 @@ gst_filesrc_activate (GstPad * pad, GstActivateMode mode) break; case GST_ACTIVATE_PULL: result = TRUE; - filesrc->task = NULL; break; case GST_ACTIVATE_NONE: /* step 1, unblock clock sync (if any) */ @@ -951,11 +950,7 @@ gst_filesrc_activate (GstPad * pad, GstActivateMode mode) /* step 2, make sure streaming finishes */ GST_STREAM_LOCK (pad); /* step 3, stop the task */ - if (filesrc->task) { - gst_task_stop (filesrc->task); - gst_object_unref (GST_OBJECT (filesrc->task)); - filesrc->task = NULL; - } + gst_task_stop (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); result = TRUE; @@ -1201,6 +1196,7 @@ gst_filesrc_type_find (GstFileSrc * src) find.src = src; find.best_probability = 0; find.caps = NULL; + find.buffer = NULL; gst_find.data = &find; gst_find.peek = filesrc_find_peek; gst_find.suggest = filesrc_find_suggest; diff --git a/gst/elements/gstfilesrc.h b/gst/elements/gstfilesrc.h index d69f0e8f4e..17230088c4 100644 --- a/gst/elements/gstfilesrc.h +++ b/gst/elements/gstfilesrc.h @@ -69,8 +69,6 @@ struct _GstFileSrc { gboolean is_regular; /* whether it's (symlink to) a regular file */ - GstTask *task; - GstBuffer *mapbuf; size_t mapsize; diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index c5283f9eb5..3371b3c58e 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -899,22 +899,22 @@ gst_filesrc_close_file (GstFileSrc * src) } static void -gst_filesrc_loop (GstElement * element) +gst_filesrc_loop (GstPad * pad) { GstFileSrc *filesrc; gboolean result; GstBuffer *buffer; - filesrc = GST_FILESRC (element); + filesrc = GST_FILESRC (GST_PAD_PARENT (pad)); - result = gst_filesrc_get (filesrc->srcpad, &buffer); + result = gst_filesrc_get (pad, &buffer); if (result != GST_FLOW_OK) { - gst_task_stop (filesrc->task); + gst_task_pause (GST_RPAD_TASK (pad)); return; } - result = gst_pad_push (filesrc->srcpad, buffer); + result = gst_pad_push (pad, buffer); if (result != GST_FLOW_OK) { - gst_task_stop (filesrc->task); + gst_task_pause (GST_RPAD_TASK (pad)); } } @@ -943,7 +943,6 @@ gst_filesrc_activate (GstPad * pad, GstActivateMode mode) break; case GST_ACTIVATE_PULL: result = TRUE; - filesrc->task = NULL; break; case GST_ACTIVATE_NONE: /* step 1, unblock clock sync (if any) */ @@ -951,11 +950,7 @@ gst_filesrc_activate (GstPad * pad, GstActivateMode mode) /* step 2, make sure streaming finishes */ GST_STREAM_LOCK (pad); /* step 3, stop the task */ - if (filesrc->task) { - gst_task_stop (filesrc->task); - gst_object_unref (GST_OBJECT (filesrc->task)); - filesrc->task = NULL; - } + gst_task_stop (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); result = TRUE; @@ -1201,6 +1196,7 @@ gst_filesrc_type_find (GstFileSrc * src) find.src = src; find.best_probability = 0; find.caps = NULL; + find.buffer = NULL; gst_find.data = &find; gst_find.peek = filesrc_find_peek; gst_find.suggest = filesrc_find_suggest; diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h index d69f0e8f4e..17230088c4 100644 --- a/plugins/elements/gstfilesrc.h +++ b/plugins/elements/gstfilesrc.h @@ -69,8 +69,6 @@ struct _GstFileSrc { gboolean is_regular; /* whether it's (symlink to) a regular file */ - GstTask *task; - GstBuffer *mapbuf; size_t mapsize;