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
This commit is contained in:
Benjamin Otte 2003-07-16 19:25:11 +00:00
parent 73f2d45295
commit 8461453b10
2 changed files with 41 additions and 14 deletions

View file

@ -183,6 +183,43 @@ gst_event_new_seek (GstSeekType type, gint64 offset)
return event;
}
/**
* gst_event_new_discontinuousv:
* @new_media: A flag indicating a new media type starts
* @format1: The format of the discont value
* @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
* 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_discontinuousv (gboolean new_media, GstFormat format1, va_list var_args)
{
GstEvent *event;
gint count = 0;
event = gst_event_new (GST_EVENT_DISCONTINUOUS);
GST_EVENT_DISCONT_NEW_MEDIA (event) = new_media;
while (format1 != GST_FORMAT_UNDEFINED && count < 8) {
GST_EVENT_DISCONT_OFFSET (event, count).format = format1 & GST_SEEK_FORMAT_MASK;
GST_EVENT_DISCONT_OFFSET (event, count).value = va_arg (var_args, gint64);
format1 = va_arg (var_args, GstFormat);
count++;
}
GST_EVENT_DISCONT_OFFSET_LEN (event) = count;
return event;
}
/**
* gst_event_new_discontinuous:
* @new_media: A flag indicating a new media type starts
@ -201,26 +238,13 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...)
{
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;
GST_EVENT_DISCONT_OFFSET (event, count).value = va_arg (var_args, gint64);
event = gst_event_new_discontinuousv (new_media, format1, var_args);
format1 = va_arg (var_args, GstFormat);
count++;
}
va_end (var_args);
GST_EVENT_DISCONT_OFFSET_LEN (event) = count;
return event;
}

View file

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