Commit 3cfdcab1 authored by Wim Taymans's avatar Wim Taymans

gst/: Added rate to the discont event to prepare for variable speed and reverse playback.

Original commit message from CVS:
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_new_discontinuous), (gst_event_discont_get_value):
* gst/gstevent.h:
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_pull_range):
Added rate to the discont event to prepare for variable speed
and reverse playback.
parent dbd5e617
2005-03-31 Wim Taymans <wim@fluendo.com>
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_new_discontinuous), (gst_event_discont_get_value):
* gst/gstevent.h:
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_pull_range):
Added rate to the discont event to prepare for variable speed
and reverse playback.
2005-03-29 David Schleef <ds@schleef.org>
* configure.ac:
......
......@@ -223,20 +223,23 @@ gst_event_new_seek (GstSeekType type, gint64 offset)
* Returns: A new discontinuous event.
*/
GstEvent *
gst_event_new_discontinuous_valist (gboolean new_media, GstFormat format1,
gst_event_new_discontinuous_valist (gdouble rate, 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;
GST_EVENT_DISCONT_RATE (event) = rate;
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);
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);
......@@ -262,14 +265,14 @@ gst_event_new_discontinuous_valist (gboolean new_media, GstFormat format1,
* Returns: A new discontinuous event.
*/
GstEvent *
gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...)
gst_event_new_discontinuous (gdouble rate, GstFormat format1, ...)
{
va_list var_args;
GstEvent *event;
va_start (var_args, format1);
event = gst_event_new_discontinuous_valist (new_media, format1, var_args);
event = gst_event_new_discontinuous_valist (rate, format1, var_args);
va_end (var_args);
......@@ -288,18 +291,21 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...)
* format/value pair.
*/
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;
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);
for (i = 0; i < n; i++) {
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;
}
}
......
......@@ -142,7 +142,8 @@ typedef enum {
typedef struct
{
GstFormat format;
gint64 value;
gint64 start_value;
gint64 end_value;
} GstFormatValue;
#define GST_EVENT_SEEK_TYPE(event) (GST_EVENT(event)->event_data.seek.type)
......@@ -153,7 +154,7 @@ typedef struct
#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_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_LEN(event) (GST_EVENT(event)->event_data.discont.noffsets)
......@@ -182,7 +183,7 @@ struct _GstEvent {
struct {
GstFormatValue offsets[8];
gint noffsets;
gboolean new_media;
gdouble rate;
} discont;
struct {
gboolean done;
......@@ -227,12 +228,13 @@ GstEvent* gst_event_new_segment_seek (GstSeekType type, gint64 start, gint64 sto
GstEvent* gst_event_new_size (GstFormat format, gint64 value);
/* discontinous event */
GstEvent* gst_event_new_discontinuous (gboolean new_media,
GstEvent* gst_event_new_discontinuous (gdouble rate,
GstFormat format1, ...);
GstEvent* gst_event_new_discontinuous_valist (gboolean new_media,
GstEvent* gst_event_new_discontinuous_valist (gdouble rate,
GstFormat format1,
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)
......
......@@ -2957,7 +2957,6 @@ no_function:
}
}
/**
* gst_pad_check_pull_range:
* @pad: a sink #GstRealPad.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment