From 1af7640685d629b8b939f9a266b63fdd410830ef Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 6 Dec 2000 23:04:12 +0000 Subject: [PATCH] Added pulregion handling. Original commit message from CVS: Added pulregion handling. Added GstCapsListFactory in headers --- gst/elements/gstasyncdisksrc.c | 1 + gst/gstbin.c | 16 +++++++++++++--- gst/gstcaps.c | 6 +++++- gst/gstcaps.h | 1 + gst/gstpad.c | 19 +++++++++++++++++++ plugins/elements/gstasyncdisksrc.c | 1 + 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/gst/elements/gstasyncdisksrc.c b/gst/elements/gstasyncdisksrc.c index be1bc642e9..907c447848 100644 --- a/gst/elements/gstasyncdisksrc.c +++ b/gst/elements/gstasyncdisksrc.c @@ -123,6 +123,7 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc) g_print("init\n"); asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull); + gst_pad_set_pullregion_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull_region); // FIXME must set pullregion gst_element_add_pad (GST_ELEMENT (asyncdisksrc), asyncdisksrc->srcpad); diff --git a/gst/gstbin.c b/gst/gstbin.c index bb36bdf51b..84d912c0ba 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -576,8 +576,18 @@ gst_bin_pullsrc_wrapper (int argc,char *argv[]) while (pads) { pad = GST_PAD (pads->data); if (pad->direction == GST_PAD_SRC) { - if (pad->pullfunc == NULL) fprintf(stderr,"error, no pullfunc in \"%s\"\n", name); - (pad->pullfunc)(pad); + region_struct *region = cothread_get_data (element->threadstate, "region"); + if (region) { + //gst_src_push_region (GST_SRC (element), region->offset, region->size); + if (pad->pullregionfunc == NULL) + fprintf(stderr,"error, no pullregionfunc in \"%s\"\n", name); + (pad->pullregionfunc)(pad, region->offset, region->size); + } + else { + if (pad->pullfunc == NULL) + fprintf(stderr,"error, no pullfunc in \"%s\"\n", name); + (pad->pullfunc)(pad); + } } pads = g_list_next(pads); } @@ -732,7 +742,7 @@ gst_bin_create_plan_func (GstBin *bin) } if (!pad->pullfunc) pad->pullfunc = gst_bin_pullfunc_proxy; - if (!pad->pullfunc) + if (!pad->pullregionfunc) pad->pullregionfunc = gst_bin_pullregionfunc_proxy; /* we only worry about sink pads */ diff --git a/gst/gstcaps.c b/gst/gstcaps.c index f4d1704772..58a0bc834a 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -57,6 +57,10 @@ gst_caps_create_entry (GstCapsFactory factory, gint *skipped) case GST_CAPS_LIST_ID: g_print("gstcaps: list not allowed in list\n"); break; + case GST_CAPS_BOOL_ID: + entry->capstype = GST_CAPS_BOOL_ID_NUM; + entry->data.bool_data = GPOINTER_TO_INT (factory[i++]); + break; default: g_print("gstcaps: unknown caps id found\n"); g_free (entry); @@ -181,7 +185,7 @@ gst_caps_dump_entry_func (GstCapsEntry *entry) entry->data.int_range_data.max); break; case GST_CAPS_FOURCC_ID_NUM: - g_print("gstcaps: fourcc 0x%08x (%4.4s)\n", entry->data.fourcc_data, &entry->data.fourcc_data); + g_print("gstcaps: fourcc 0x%08x (%4.4s)\n", entry->data.fourcc_data, (gchar *)&entry->data.fourcc_data); break; case GST_CAPS_BOOL_ID_NUM: g_print("gstcaps: boolean %d\n", entry->data.bool_data); diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 62d95ba3ef..20c4b6de59 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -26,6 +26,7 @@ typedef struct _GstCaps GstCaps; typedef gpointer GstCapsFactoryEntry; typedef GstCapsFactoryEntry GstCapsFactory[]; +typedef GstCapsFactory *GstCapsListFactory[]; typedef enum { GST_CAPS_END_ID_NUM = 0, diff --git a/gst/gstpad.c b/gst/gstpad.c index 67b9d1e174..86be1ba110 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -245,6 +245,25 @@ gst_pad_set_pull_function (GstPad *pad, pad->pullfunc = pull; } +/** + * gst_pad_set_pullregion_function: + * @pad: the pad to set the pull function for + * @pull: the pull function + * + * Set the given pull function for the pad + */ +void +gst_pad_set_pullregion_function (GstPad *pad, + GstPadPullRegionFunction pull) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_PAD (pad)); + + g_print("gstpad: pad setting pullregion function\n"); + + pad->pullregionfunc = pull; +} + /** * gst_pad_set_chain_function: * @pad: the pad to set the chain function for diff --git a/plugins/elements/gstasyncdisksrc.c b/plugins/elements/gstasyncdisksrc.c index be1bc642e9..907c447848 100644 --- a/plugins/elements/gstasyncdisksrc.c +++ b/plugins/elements/gstasyncdisksrc.c @@ -123,6 +123,7 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc) g_print("init\n"); asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_pull_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull); + gst_pad_set_pullregion_function (asyncdisksrc->srcpad,gst_asyncdisksrc_pull_region); // FIXME must set pullregion gst_element_add_pad (GST_ELEMENT (asyncdisksrc), asyncdisksrc->srcpad);