From 8461453b10aab1914249428abfd39b06b473259e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 16 Jul 2003 19:25:11 +0000 Subject: [PATCH] add valist function for gst_event_new_discontinuous original patch from Brett Kosinski fixes #117348 Original commit message from CVS: add valist function for gst_event_new_discontinuous original patch from Brett Kosinski fixes #117348 --- gst/gstevent.c | 38 +++++++++++++++++++++++++++++++------- gst/gstevent.h | 3 +++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/gst/gstevent.c b/gst/gstevent.c index 3fc0509..a213e8a 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -184,10 +184,10 @@ gst_event_new_seek (GstSeekType type, gint64 offset) } /** - * gst_event_new_discontinuous: + * gst_event_new_discontinuousv: * @new_media: A flag indicating a new media type starts * @format1: The format of the discont value - * @...: more discont values and formats + * @var_args: more discont values and formats * * Allocate a new discontinuous event with the given format/value pairs. Note * that the values are of type gint64 - you may not use simple integers such @@ -197,17 +197,14 @@ gst_event_new_seek (GstSeekType type, gint64 offset) * Returns: A new discontinuous event. */ GstEvent* -gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...) +gst_event_new_discontinuousv (gboolean new_media, GstFormat format1, va_list var_args) { - va_list var_args; GstEvent *event; gint count = 0; event = gst_event_new (GST_EVENT_DISCONTINUOUS); GST_EVENT_DISCONT_NEW_MEDIA (event) = new_media; - va_start (var_args, format1); - while (format1 != GST_FORMAT_UNDEFINED && count < 8) { GST_EVENT_DISCONT_OFFSET (event, count).format = format1 & GST_SEEK_FORMAT_MASK; @@ -217,7 +214,6 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...) count++; } - va_end (var_args); GST_EVENT_DISCONT_OFFSET_LEN (event) = count; @@ -225,6 +221,34 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...) } /** + * gst_event_new_discontinuous: + * @new_media: A flag indicating a new media type starts + * @format1: The format of the discont value + * @...: more discont values and formats + * + * Allocate a new discontinuous event with the given format/value pairs. Note + * that the values are of type gint64 - you may not use simple integers such + * as "0" when calling this function, always cast them like "(gint64) 0". + * Terminate the list with #GST_FORMAT_UNDEFINED. + * + * Returns: A new discontinuous event. + */ +GstEvent* +gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...) +{ + va_list var_args; + GstEvent *event; + + va_start (var_args, format1); + + event = gst_event_new_discontinuousv (new_media, format1, var_args); + + va_end (var_args); + + return event; +} + +/** * gst_event_discont_get_value: * @event: The event to query * @format: The format of the discont value diff --git a/gst/gstevent.h b/gst/gstevent.h index bf7077b..ac3d452 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -207,6 +207,9 @@ GstEvent* gst_event_new_size (GstFormat format, gint64 value); /* discontinous event */ GstEvent* gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...); +GstEvent* gst_event_new_discontinuousv (gboolean new_media, + GstFormat format1, + va_list var_args); gboolean gst_event_discont_get_value (GstEvent *event, GstFormat format, gint64 *value); #define gst_event_new_filler() gst_event_new(GST_EVENT_FILLER) -- 2.7.4