Commit 9286f126 authored by Wim Taymans's avatar Wim Taymans

Added a size event to optimize buffer sizes make filesrc update its blocksize...

Added a size event to optimize buffer sizes make filesrc update its blocksize when it receives a size event

Original commit message from CVS:
Added a size event to optimize buffer sizes
make filesrc update its blocksize when it receives a size event
parent 319a6a36
......@@ -727,6 +727,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
src->seek_happened = TRUE;
src->need_flush = GST_EVENT_SEEK_FLAGS(event) & GST_SEEK_FLAG_FLUSH;
break;
case GST_EVENT_SIZE:
if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) {
return FALSE;
}
src->block_size = GST_EVENT_SIZE_VALUE (event);
g_object_notify (G_OBJECT (src), "blocksize");
break;
case GST_EVENT_FLUSH:
src->need_flush = TRUE;
break;
......
......@@ -235,5 +235,17 @@ gst_event_discont_get_value (GstEvent *event, GstFormat format, gint64 *value)
}
GstEvent*
gst_event_new_size (GstFormat format, gint64 value)
{
GstEvent *event;
event = gst_event_new (GST_EVENT_SIZE);
GST_EVENT_SIZE_FORMAT (event) = format;
GST_EVENT_SIZE_VALUE (event) = value;
return event;
}
......@@ -41,6 +41,7 @@ typedef enum {
GST_EVENT_QOS,
GST_EVENT_SEEK,
GST_EVENT_FILLER,
GST_EVENT_SIZE,
} GstEventType;
extern GType _gst_event_type;
......@@ -93,6 +94,9 @@ typedef struct
#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_SIZE_FORMAT(event) (GST_EVENT(event)->event_data.size.format)
#define GST_EVENT_SIZE_VALUE(event) (GST_EVENT(event)->event_data.size.value)
struct _GstEvent {
GstData data;
......@@ -111,6 +115,10 @@ struct _GstEvent {
gint noffsets;
gboolean new_media;
} discont;
struct {
GstFormat format;
gint64 value;
} size;
} event_data;
};
......@@ -123,6 +131,9 @@ void gst_event_free (GstEvent *event);
/* seek event */
GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset);
/* size events */
GstEvent* gst_event_new_size (GstFormat format, gint64 value);
/* discontinous event */
GstEvent* gst_event_new_discontinuous (gboolean new_media,
GstFormat format1, ...);
......
......@@ -727,6 +727,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
src->seek_happened = TRUE;
src->need_flush = GST_EVENT_SEEK_FLAGS(event) & GST_SEEK_FLAG_FLUSH;
break;
case GST_EVENT_SIZE:
if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) {
return FALSE;
}
src->block_size = GST_EVENT_SIZE_VALUE (event);
g_object_notify (G_OBJECT (src), "blocksize");
break;
case GST_EVENT_FLUSH:
src->need_flush = TRUE;
break;
......
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