queue2: Add use-ring-buffer and ring-buffer-max-size properties

This commit is contained in:
Robert Swain 2010-05-05 10:21:55 +02:00 committed by Wim Taymans
parent dbfcc727ab
commit f093707189
2 changed files with 45 additions and 0 deletions

View file

@ -102,6 +102,8 @@ enum
#define DEFAULT_LOW_PERCENT 10
#define DEFAULT_HIGH_PERCENT 99
#define DEFAULT_TEMP_REMOVE TRUE
#define DEFAULT_USE_RING_BUFFER FALSE
#define DEFAULT_RING_BUFFER_MAX_SIZE (16 * 1024 * 1024) /* 16 MB */
/* other defines */
#define DEFAULT_BUFFER_SIZE 4096
@ -123,6 +125,8 @@ enum
PROP_TEMP_TEMPLATE,
PROP_TEMP_LOCATION,
PROP_TEMP_REMOVE,
PROP_USE_RING_BUFFER,
PROP_RING_BUFFER_MAX_SIZE,
PROP_LAST
};
@ -349,6 +353,32 @@ gst_queue2_class_init (GstQueue2Class * klass)
"Remove the temp-location after use",
DEFAULT_TEMP_REMOVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstQueue2:use-ring-buffer
*
* When use-ring-buffer is set, buffer data into a ring buffer containing ranges
* of source data. Default FALSE.
*
* Since: 0.10.30
*/
g_object_class_install_property (gobject_class, PROP_USE_RING_BUFFER,
g_param_spec_boolean ("use-ring-buffer", "Use a ring buffer",
"Use a ring buffer of size ring-buffer-max-size kB",
DEFAULT_USE_RING_BUFFER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstQueue2:ring-buffer-max-size
*
* The maximum size of the ring buffer in kilobytes. If set to 0 kB then the size
* is unlimited. Default 16 megabytes.
*
* Since: 0.10.30
*/
g_object_class_install_property (gobject_class, PROP_RING_BUFFER_MAX_SIZE,
g_param_spec_uint ("ring-buffer-max-size", "Max. ring buffer size (kB)",
"Max. amount of data in the ring buffer (bytes, 0=unlimited)",
0, G_MAXUINT, DEFAULT_RING_BUFFER_MAX_SIZE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* set several parent class virtual functions */
gobject_class->finalize = gst_queue2_finalize;
@ -2413,6 +2443,12 @@ gst_queue2_set_property (GObject * object,
case PROP_TEMP_REMOVE:
queue->temp_remove = g_value_get_boolean (value);
break;
case PROP_USE_RING_BUFFER:
queue->use_ring_buffer = g_value_get_boolean (value);
break;
case PROP_RING_BUFFER_MAX_SIZE:
queue->ring_buffer_max_size = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -2469,6 +2505,12 @@ gst_queue2_get_property (GObject * object,
case PROP_TEMP_REMOVE:
g_value_set_boolean (value, queue->temp_remove);
break;
case PROP_USE_RING_BUFFER:
g_value_set_boolean (value, queue->use_ring_buffer);
break;
case PROP_RING_BUFFER_MAX_SIZE:
g_value_set_uint (value, queue->ring_buffer_max_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -132,6 +132,9 @@ struct _GstQueue2
* because we can't save it on the file */
gboolean segment_event_received;
GstEvent *starting_segment;
gboolean use_ring_buffer;
guint ring_buffer_max_size;
};
struct _GstQueue2Class