gst/gstevent.*: We'll need the end offset in discont soon.

Original commit message from CVS:
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_discont_get_value):
* gst/gstevent.h:
We'll need the end offset in discont soon.
This commit is contained in:
Wim Taymans 2004-12-31 18:18:45 +00:00
parent af728740a3
commit 0f74c8b5f1
3 changed files with 26 additions and 11 deletions

View file

@ -1,3 +1,10 @@
2004-12-31 Wim Taymans <wim@fluendo.com>
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_discont_get_value):
* gst/gstevent.h:
We'll need the end offset in discont soon.
2004-12-31 Wim Taymans <wim@fluendo.com> 2004-12-31 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock),

View file

@ -220,20 +220,23 @@ gst_event_new_seek (GstSeekType type, gint64 offset)
* Returns: A new discontinuous event. * Returns: A new discontinuous event.
*/ */
GstEvent * GstEvent *
gst_event_new_discontinuous_valist (gboolean new_media, GstFormat format1, gst_event_new_discontinuous_valist (gdouble rate, GstFormat format1,
va_list var_args) va_list var_args)
{ {
GstEvent *event; GstEvent *event;
gint count = 0; gint count = 0;
event = gst_event_new (GST_EVENT_DISCONTINUOUS); event = gst_event_new (GST_EVENT_DISCONTINUOUS);
GST_EVENT_DISCONT_NEW_MEDIA (event) = new_media; GST_EVENT_DISCONT_RATE (event) = rate;
while (format1 != GST_FORMAT_UNDEFINED && count < 8) { while (format1 != GST_FORMAT_UNDEFINED && count < 8) {
GST_EVENT_DISCONT_OFFSET (event, count).format = GST_EVENT_DISCONT_OFFSET (event, count).format =
format1 & GST_SEEK_FORMAT_MASK; format1 & GST_SEEK_FORMAT_MASK;
GST_EVENT_DISCONT_OFFSET (event, count).value = va_arg (var_args, gint64); GST_EVENT_DISCONT_OFFSET (event, count).start_value =
va_arg (var_args, gint64);
GST_EVENT_DISCONT_OFFSET (event, count).end_value =
va_arg (var_args, gint64);
format1 = va_arg (var_args, GstFormat); format1 = va_arg (var_args, GstFormat);
@ -285,18 +288,21 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...)
* format/value pair. * format/value pair.
*/ */
gboolean gboolean
gst_event_discont_get_value (GstEvent * event, GstFormat format, gint64 * value) gst_event_discont_get_value (GstEvent * event, GstFormat format,
gint64 * start_value, gint64 * end_value)
{ {
gint i, n; gint i, n;
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE); g_return_val_if_fail (start_value != NULL, FALSE);
g_return_val_if_fail (end_value != NULL, FALSE);
n = GST_EVENT_DISCONT_OFFSET_LEN (event); n = GST_EVENT_DISCONT_OFFSET_LEN (event);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (GST_EVENT_DISCONT_OFFSET (event, i).format == format) { if (GST_EVENT_DISCONT_OFFSET (event, i).format == format) {
*value = GST_EVENT_DISCONT_OFFSET (event, i).value; *start_value = GST_EVENT_DISCONT_OFFSET (event, i).start_value;
*end_value = GST_EVENT_DISCONT_OFFSET (event, i).end_value;
return TRUE; return TRUE;
} }
} }

View file

@ -130,7 +130,8 @@ typedef enum {
typedef struct typedef struct
{ {
GstFormat format; GstFormat format;
gint64 value; gint64 start_value;
gint64 end_value;
} GstFormatValue; } GstFormatValue;
#define GST_EVENT_SEEK_TYPE(event) (GST_EVENT(event)->event_data.seek.type) #define GST_EVENT_SEEK_TYPE(event) (GST_EVENT(event)->event_data.seek.type)
@ -141,7 +142,7 @@ typedef struct
#define GST_EVENT_SEEK_ENDOFFSET(event) (GST_EVENT(event)->event_data.seek.endoffset) #define GST_EVENT_SEEK_ENDOFFSET(event) (GST_EVENT(event)->event_data.seek.endoffset)
#define GST_EVENT_SEEK_ACCURACY(event) (GST_EVENT(event)->event_data.seek.accuracy) #define GST_EVENT_SEEK_ACCURACY(event) (GST_EVENT(event)->event_data.seek.accuracy)
#define GST_EVENT_DISCONT_NEW_MEDIA(event) (GST_EVENT(event)->event_data.discont.new_media) #define GST_EVENT_DISCONT_RATE(event) (GST_EVENT(event)->event_data.discont.rate)
#define GST_EVENT_DISCONT_OFFSET(event,i) (GST_EVENT(event)->event_data.discont.offsets[i]) #define GST_EVENT_DISCONT_OFFSET(event,i) (GST_EVENT(event)->event_data.discont.offsets[i])
#define GST_EVENT_DISCONT_OFFSET_LEN(event) (GST_EVENT(event)->event_data.discont.noffsets) #define GST_EVENT_DISCONT_OFFSET_LEN(event) (GST_EVENT(event)->event_data.discont.noffsets)
@ -168,7 +169,7 @@ struct _GstEvent {
struct { struct {
GstFormatValue offsets[8]; GstFormatValue offsets[8];
gint noffsets; gint noffsets;
gboolean new_media; gdouble rate;
} discont; } discont;
struct { struct {
GstFormat format; GstFormat format;
@ -212,10 +213,11 @@ GstEvent* gst_event_new_size (GstFormat format, gint64 value);
/* discontinous event */ /* discontinous event */
GstEvent* gst_event_new_discontinuous (gboolean new_media, GstEvent* gst_event_new_discontinuous (gboolean new_media,
GstFormat format1, ...); GstFormat format1, ...);
GstEvent* gst_event_new_discontinuous_valist (gboolean new_media, GstEvent* gst_event_new_discontinuous_valist (gdouble rate,
GstFormat format1, GstFormat format1,
va_list var_args); va_list var_args);
gboolean gst_event_discont_get_value (GstEvent *event, GstFormat format, gint64 *value); gboolean gst_event_discont_get_value (GstEvent *event, GstFormat format,
gint64 *start_value, gint64 *end_value);
#define gst_event_new_filler() gst_event_new(GST_EVENT_FILLER) #define gst_event_new_filler() gst_event_new(GST_EVENT_FILLER)