multiqueue: hook up low/high percent

Hook up the low/high percent properties for the buffering mode.
This commit is contained in:
Wim Taymans 2009-10-21 11:30:40 -04:00 committed by Wim Taymans
parent b9d4f6e550
commit 6ac9191527
2 changed files with 46 additions and 0 deletions

View file

@ -218,6 +218,8 @@ enum
#define DEFAULT_EXTRA_SIZE_TIME 3 * GST_SECOND #define DEFAULT_EXTRA_SIZE_TIME 3 * GST_SECOND
#define DEFAULT_USE_BUFFERING FALSE #define DEFAULT_USE_BUFFERING FALSE
#define DEFAULT_LOW_PERCENT 10
#define DEFAULT_HIGH_PERCENT 99
enum enum
{ {
@ -229,6 +231,8 @@ enum
PROP_MAX_SIZE_BUFFERS, PROP_MAX_SIZE_BUFFERS,
PROP_MAX_SIZE_TIME, PROP_MAX_SIZE_TIME,
PROP_USE_BUFFERING, PROP_USE_BUFFERING,
PROP_LOW_PERCENT,
PROP_HIGH_PERCENT,
PROP_LAST PROP_LAST
}; };
@ -368,6 +372,33 @@ gst_multi_queue_class_init (GstMultiQueueClass * klass)
"Emit GST_MESSAGE_BUFFERING based on low-/high-percent thresholds" "Emit GST_MESSAGE_BUFFERING based on low-/high-percent thresholds"
" (not implemented yet)", " (not implemented yet)",
DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstMultiQueue:low-percent
*
* Low threshold percent for buffering to start.
*
* Not implemented yet.
*
* Since: 0.10.26
*/
g_object_class_install_property (gobject_class, PROP_LOW_PERCENT,
g_param_spec_int ("low-percent", "Low percent",
"Low threshold for buffering to start (not implemented)", 0, 100,
DEFAULT_LOW_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstMultiQueue:high-percent
*
* High threshold percent for buffering to finish.
*
* Not implemented yet.
*
* Since: 0.10.26
*/
g_object_class_install_property (gobject_class, PROP_HIGH_PERCENT,
g_param_spec_int ("high-percent", "High percent",
"High threshold for buffering to finish (not implemented)", 0, 100,
DEFAULT_HIGH_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_multi_queue_finalize); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_multi_queue_finalize);
@ -392,6 +423,8 @@ gst_multi_queue_init (GstMultiQueue * mqueue, GstMultiQueueClass * klass)
mqueue->extra_size.time = DEFAULT_EXTRA_SIZE_TIME; mqueue->extra_size.time = DEFAULT_EXTRA_SIZE_TIME;
mqueue->use_buffering = DEFAULT_USE_BUFFERING; mqueue->use_buffering = DEFAULT_USE_BUFFERING;
mqueue->low_percent = DEFAULT_LOW_PERCENT;
mqueue->high_percent = DEFAULT_HIGH_PERCENT;
mqueue->counter = 1; mqueue->counter = 1;
mqueue->highid = -1; mqueue->highid = -1;
@ -462,6 +495,12 @@ gst_multi_queue_set_property (GObject * object, guint prop_id,
case PROP_USE_BUFFERING: case PROP_USE_BUFFERING:
mq->use_buffering = g_value_get_boolean (value); mq->use_buffering = g_value_get_boolean (value);
break; break;
case PROP_LOW_PERCENT:
mq->low_percent = g_value_get_int (value);
break;
case PROP_HIGH_PERCENT:
mq->high_percent = g_value_get_int (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -498,6 +537,12 @@ gst_multi_queue_get_property (GObject * object, guint prop_id,
case PROP_USE_BUFFERING: case PROP_USE_BUFFERING:
g_value_set_boolean (value, mq->use_buffering); g_value_set_boolean (value, mq->use_buffering);
break; break;
case PROP_LOW_PERCENT:
g_value_set_int (value, mq->low_percent);
break;
case PROP_HIGH_PERCENT:
g_value_set_int (value, mq->high_percent);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;

View file

@ -59,6 +59,7 @@ struct _GstMultiQueue {
GstDataQueueSize max_size, extra_size; GstDataQueueSize max_size, extra_size;
gboolean use_buffering; gboolean use_buffering;
gint low_percent, high_percent;
guint32 counter; /* incoming object counter, protected with STREAM_LOCK */ guint32 counter; /* incoming object counter, protected with STREAM_LOCK */
guint32 highid; /* contains highest id of last outputted object */ guint32 highid; /* contains highest id of last outputted object */