docs/random/ds/0.9-suggested-changes: random notes

Original commit message from CVS:
* docs/random/ds/0.9-suggested-changes: random notes
* gst/elements/gstfakesrc.c: (gst_fakesrc_get_formats),
(gst_fakesrc_get_query_types), (gst_fakesrc_get_event_mask):
Replace GST_PAD_EVENT_MASK_FUNCTION() (et al.) with its
expansion.
* gst/elements/gstfilesink.c: (gst_filesink_get_formats),
(gst_filesink_get_query_types): same
* gst/elements/gstfilesrc.c: (gst_filesrc_get_event_mask),
(gst_filesrc_get_query_types), (gst_filesrc_get_formats): same
* gst/gstcaps.h: deprecate GST_DEBUG_CAPS(), and fix the macro
to use new GST_PTR_FORMAT.
* gst/gstelement.h: deprecate function factory macros
GST_ELEMENT_QUERY_TYPE_FUNCTION(), GST_ELEMENT_EVENT_MASK_FUNCTION().
These are our last variadic macros that can't be replaced with
inlines.  Celebrate!  Also fix a typo in an #ifdef that was
attempting to deprecate gst_element_clock_wait().
* gst/gstevent.h: same
* gst/gstpad.c: (gst_pad_link_intersect), (gst_pad_link_fixate),
(gst_pad_try_set_caps): replace GST_DEBUG_CAPS() with GST_DEBUG()
* gst/gstpad.h: deprecate function factory macros similar to above.
This commit is contained in:
David Schleef 2004-02-04 19:38:33 +00:00
parent 4dbd7366a8
commit ad3863ac5e
13 changed files with 225 additions and 96 deletions

View file

@ -1,3 +1,26 @@
2004-02-04 David Schleef <ds@schleef.org>
* docs/random/ds/0.9-suggested-changes: random notes
* gst/elements/gstfakesrc.c: (gst_fakesrc_get_formats),
(gst_fakesrc_get_query_types), (gst_fakesrc_get_event_mask):
Replace GST_PAD_EVENT_MASK_FUNCTION() (et al.) with its
expansion.
* gst/elements/gstfilesink.c: (gst_filesink_get_formats),
(gst_filesink_get_query_types): same
* gst/elements/gstfilesrc.c: (gst_filesrc_get_event_mask),
(gst_filesrc_get_query_types), (gst_filesrc_get_formats): same
* gst/gstcaps.h: deprecate GST_DEBUG_CAPS(), and fix the macro
to use new GST_PTR_FORMAT.
* gst/gstelement.h: deprecate function factory macros
GST_ELEMENT_QUERY_TYPE_FUNCTION(), GST_ELEMENT_EVENT_MASK_FUNCTION().
These are our last variadic macros that can't be replaced with
inlines. Celebrate! Also fix a typo in an #ifdef that was
attempting to deprecate gst_element_clock_wait().
* gst/gstevent.h: same
* gst/gstpad.c: (gst_pad_link_intersect), (gst_pad_link_fixate),
(gst_pad_try_set_caps): replace GST_DEBUG_CAPS() with GST_DEBUG()
* gst/gstpad.h: deprecate function factory macros similar to above.
2004-02-04 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:

View file

@ -4,6 +4,7 @@ API:
- replace object/structure set/get macros with actual functions.
- events should all use GstStructure
caps:
@ -27,6 +28,16 @@ caps:
But that's 0.10 material."
bugs with interesting info:
XML descriptions of plugin information:
http://bugzilla.gnome.org/show_bug.cgi?id=114216
- a method for elements to know when downstream elements are ignoring
the data stream. This would allow automatic shutoff of pipelines
whose processing is being dumped.

View file

@ -316,16 +316,28 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ, const g
return srcpad;
}
GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT
)
static const GstFormat *
gst_fakesrc_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_DEFAULT,
0,
};
return formats;
}
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
GST_QUERY_START,
GST_QUERY_SEGMENT_END
)
static const GstQueryType *
gst_fakesrc_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
GST_QUERY_START,
GST_QUERY_SEGMENT_END,
0,
};
return types;
}
static gboolean
gst_fakesrc_query (GstPad *pad, GstQueryType type,
@ -352,11 +364,17 @@ gst_fakesrc_query (GstPad *pad, GstQueryType type,
return TRUE;
}
GST_PAD_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 }
)
static const GstEventMask *
gst_fakesrc_get_event_mask (GstPad *pad)
{
static const GstEventMask masks[] = {
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 },
{ 0, 0 },
};
return masks;
}
static gboolean
gst_fakesrc_event_handler (GstPad *pad, GstEvent *event)

View file

@ -59,15 +59,26 @@ enum {
ARG_LOCATION
};
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesink_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION
)
GST_PAD_FORMATS_FUNCTION (gst_filesink_get_formats,
GST_FORMAT_BYTES
)
static const GstFormat *
gst_filesink_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_BYTES,
0,
};
return formats;
}
static const GstQueryType *
gst_filesink_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
0
};
return types;
}
static void gst_filesink_dispose (GObject *object);

View file

@ -102,23 +102,41 @@ enum {
ARG_TOUCH
};
GST_PAD_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_FLUSH, 0 },
{ GST_EVENT_SIZE, 0 }
)
static const GstEventMask *
gst_filesrc_get_event_mask (GstPad *pad)
{
static const GstEventMask masks[] = {
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_FLUSH, 0 },
{ GST_EVENT_SIZE, 0 },
{ 0, 0 }
};
return masks;
}
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION
)
static const GstQueryType *
gst_filesrc_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
0
};
return types;
}
GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES
)
static const GstFormat *
gst_filesrc_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_BYTES,
0,
};
return formats;
}
static void gst_filesrc_dispose (GObject *object);

View file

@ -58,12 +58,10 @@ struct _GstStaticCaps {
#define GST_TYPE_CAPS gst_caps_get_type()
/* FIXME Company should decide the best way to do this */
#define GST_DEBUG_CAPS(string, caps) do { \
char *s = gst_caps_to_string(caps); \
GST_DEBUG ( "%s: %s", (string), s); \
g_free(s); \
}while(0)
#ifndef GST_DISABLE_DEPRECATED
#define GST_DEBUG_CAPS(string, caps) \
GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps)
#endif
void _gst_caps_initialize (void);

View file

@ -80,6 +80,7 @@ extern GType _gst_element_type;
#define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass))
/* convenience functions */
#ifndef GST_DISABLE_DEPRECATED
#ifdef G_HAVE_ISO_VARARGS
#define GST_ELEMENT_QUERY_TYPE_FUNCTION(functionname, ...) \
GST_QUERY_TYPE_FUNCTION (GstElement*, functionname, __VA_ARGS__);
@ -95,6 +96,7 @@ extern GType _gst_element_type;
#define GST_ELEMENT_EVENT_MASK_FUNCTION(functionname, a...) \
GST_EVENT_MASK_FUNCTION (GstElement*, functionname, a);
#endif
#endif
typedef enum {
/* element is complex (for some def.) and generally require a cothread */
@ -285,7 +287,7 @@ gboolean gst_element_requires_clock (GstElement *element);
gboolean gst_element_provides_clock (GstElement *element);
GstClock* gst_element_get_clock (GstElement *element);
void gst_element_set_clock (GstElement *element, GstClock *clock);
#ifndef GST_DEISABLE_DEPRECATED
#ifndef GST_DISABLE_DEPRECATED
GstClockReturn gst_element_clock_wait (GstElement *element,
GstClockID id, GstClockTimeDiff *jitter);
#endif

View file

@ -86,6 +86,7 @@ typedef struct
GstEventFlag flags;
} GstEventMask;
#ifndef GST_DISABLE_DEPRECATED
#ifdef G_HAVE_ISO_VARARGS
#define GST_EVENT_MASK_FUNCTION(type,functionname, ...) \
static const GstEventMask* \
@ -109,6 +110,7 @@ functionname (type pad) \
return masks; \
}
#endif
#endif
/* seek events, extends GstEventFlag */
typedef enum {

View file

@ -35,9 +35,6 @@
#define GST_CAT_DEFAULT GST_CAT_PADS
/* FIXME */
#define gst_caps_debug(a,b) GST_DEBUG_CAPS(b,a)
enum {
TEMPL_PAD_CREATED,
@ -1046,21 +1043,21 @@ static void gst_pad_link_intersect (GstPadLink *link)
GST_DEBUG ("intersecting link from %s:%s to %s:%s",
GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad));
GST_DEBUG_CAPS ("srccaps", link->srccaps);
GST_DEBUG_CAPS ("sinkcaps", link->sinkcaps);
GST_DEBUG_CAPS ("filtercaps", link->filtercaps);
GST_DEBUG ("srccaps " GST_PTR_FORMAT, link->srccaps);
GST_DEBUG ("sinkcaps " GST_PTR_FORMAT, link->sinkcaps);
GST_DEBUG ("filtercaps " GST_PTR_FORMAT, link->filtercaps);
pad_intersection = gst_caps_intersect (link->srccaps, link->sinkcaps);
if (link->filtercaps) {
GST_DEBUG_CAPS ("unfiltered intersection", pad_intersection);
GST_DEBUG ("unfiltered intersection " GST_PTR_FORMAT, pad_intersection);
link->caps = gst_caps_intersect (pad_intersection, link->filtercaps);
gst_caps_free (pad_intersection);
} else {
link->caps = pad_intersection;
}
GST_DEBUG_CAPS ("intersection", link->caps);
GST_DEBUG ("intersection " GST_PTR_FORMAT, link->caps);
}
static gboolean
@ -1095,7 +1092,7 @@ gst_pad_link_fixate (GstPadLink *link)
g_return_if_fail (caps != NULL);
g_return_if_fail (!gst_caps_is_empty(caps));
GST_DEBUG_CAPS ("trying to fixate caps", caps);
GST_DEBUG ("trying to fixate caps " GST_PTR_FORMAT, caps);
while (!gst_caps_is_fixed (caps)) {
int i;
@ -1106,31 +1103,31 @@ gst_pad_link_fixate (GstPadLink *link)
case 0:
g_signal_emit (G_OBJECT (link->srcpad),
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
GST_DEBUG_CAPS ("app srcpad signal fixated to", newcaps);
GST_DEBUG ("app srcpad signal fixated to " GST_PTR_FORMAT, newcaps);
break;
case 1:
g_signal_emit (G_OBJECT (link->sinkpad),
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
GST_DEBUG_CAPS ("app sinkpad signal fixated to", newcaps);
GST_DEBUG ("app sinkpad signal fixated to " GST_PTR_FORMAT, newcaps);
break;
case 2:
if (GST_RPAD_FIXATEFUNC(link->srcpad)) {
newcaps = GST_RPAD_FIXATEFUNC(link->srcpad) (
GST_PAD (link->srcpad), caps);
GST_DEBUG_CAPS ("srcpad fixated to", newcaps);
GST_DEBUG ("srcpad fixated to " GST_PTR_FORMAT, newcaps);
}
break;
case 3:
if (GST_RPAD_FIXATEFUNC(link->sinkpad)) {
newcaps = GST_RPAD_FIXATEFUNC(link->sinkpad) (
GST_PAD (link->sinkpad), caps);
GST_DEBUG_CAPS ("sinkpad fixated to", newcaps);
GST_DEBUG ("sinkpad fixated to " GST_PTR_FORMAT, newcaps);
}
break;
case 4:
newcaps = _gst_pad_default_fixate_func (
GST_PAD(link->srcpad), caps);
GST_DEBUG_CAPS ("core fixated to", newcaps);
GST_DEBUG ("core fixated to GST_PTR_FORMAT", newcaps);
break;
}
if (newcaps) {
@ -1332,7 +1329,7 @@ gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps)
g_warning ("trying to set non fixed caps on pad %s:%s, not allowed",
GST_DEBUG_PAD_NAME (pad));
gst_caps_debug (caps, "unfixed caps");
GST_DEBUG ("unfixed caps " GST_PTR_FORMAT, caps);
return GST_PAD_LINK_REFUSED;
}

View file

@ -94,6 +94,7 @@ typedef enum {
#define GST_PAD_LINK_SUCCESSFUL(ret) (ret >= GST_PAD_LINK_OK)
/* convenience functions */
#ifndef GST_DISABLE_DEPRECATED
#ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, __VA_ARGS__);
#define GST_PAD_FORMATS_FUNCTION(functionname, ...) GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
@ -103,6 +104,7 @@ typedef enum {
#define GST_PAD_FORMATS_FUNCTION(functionname, a...) GST_FORMATS_FUNCTION (GstPad *, functionname, a);
#define GST_PAD_EVENT_MASK_FUNCTION(functionname, a...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, a);
#endif
#endif
/* this defines the functions used to chain buffers

View file

@ -316,16 +316,28 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ, const g
return srcpad;
}
GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT
)
static const GstFormat *
gst_fakesrc_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_DEFAULT,
0,
};
return formats;
}
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
GST_QUERY_START,
GST_QUERY_SEGMENT_END
)
static const GstQueryType *
gst_fakesrc_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
GST_QUERY_START,
GST_QUERY_SEGMENT_END,
0,
};
return types;
}
static gboolean
gst_fakesrc_query (GstPad *pad, GstQueryType type,
@ -352,11 +364,17 @@ gst_fakesrc_query (GstPad *pad, GstQueryType type,
return TRUE;
}
GST_PAD_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 }
)
static const GstEventMask *
gst_fakesrc_get_event_mask (GstPad *pad)
{
static const GstEventMask masks[] = {
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 },
{ 0, 0 },
};
return masks;
}
static gboolean
gst_fakesrc_event_handler (GstPad *pad, GstEvent *event)

View file

@ -59,15 +59,26 @@ enum {
ARG_LOCATION
};
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesink_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION
)
GST_PAD_FORMATS_FUNCTION (gst_filesink_get_formats,
GST_FORMAT_BYTES
)
static const GstFormat *
gst_filesink_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_BYTES,
0,
};
return formats;
}
static const GstQueryType *
gst_filesink_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
0
};
return types;
}
static void gst_filesink_dispose (GObject *object);

View file

@ -102,23 +102,41 @@ enum {
ARG_TOUCH
};
GST_PAD_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_FLUSH, 0 },
{ GST_EVENT_SIZE, 0 }
)
static const GstEventMask *
gst_filesrc_get_event_mask (GstPad *pad)
{
static const GstEventMask masks[] = {
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_FLUSH, 0 },
{ GST_EVENT_SIZE, 0 },
{ 0, 0 }
};
return masks;
}
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
GST_QUERY_TOTAL,
GST_QUERY_POSITION
)
static const GstQueryType *
gst_filesrc_get_query_types (GstPad *pad)
{
static const GstQueryType types[] = {
GST_QUERY_TOTAL,
GST_QUERY_POSITION,
0
};
return types;
}
GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES
)
static const GstFormat *
gst_filesrc_get_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_BYTES,
0,
};
return formats;
}
static void gst_filesrc_dispose (GObject *object);