summaryrefslogtreecommitdiff
path: root/src/xine-engine/buffer.h
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2003-10-14 22:16:32 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2003-10-14 22:16:32 +0000
commit5233af2142e5fd045f922a82fef0c76c62684a7b (patch)
treec1b767730eb7360794c51b1af7b78e4d43fca18c /src/xine-engine/buffer.h
parent90a24be6db150d94d8ceea2b1f56dff8a2880d01 (diff)
downloadxine-lib-5233af2142e5fd045f922a82fef0c76c62684a7b.tar.gz
xine-lib-5233af2142e5fd045f922a82fef0c76c62684a7b.tar.bz2
Add a callback to the buffer_pool_alloc function.
The goal is to detect in the net_buf_ctrl if there is no more free buffer in a fifo, which indicates there will be a deadlock if the engine is not unpaused. Currently this detection is done from the "put" callback, it's not a safe solution, nothing prevents a demuxer to allocate 2 buffers before calling put(). The impact is low, only one test per buffer_pool_alloc call if no callback is registered. It's done exactly the same way as the put and get callbacks. CVS patchset: 5520 CVS date: 2003/10/14 22:16:32
Diffstat (limited to 'src/xine-engine/buffer.h')
-rw-r--r--src/xine-engine/buffer.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index da2afa28f..abe3457b7 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.h,v 1.120 2003/08/05 15:20:00 mroi Exp $
+ * $Id: buffer.h,v 1.121 2003/10/14 22:16:32 tmattern Exp $
*
*
* contents:
@@ -467,8 +467,11 @@ struct fifo_buffer_s
/* the same as put but insert at the head of the fifo */
void (*insert) (fifo_buffer_t *fifo, buf_element_t *buf);
+ /* callbacks */
+ void (*register_alloc_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, void *), void *cb_data);
void (*register_put_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *), void *cb_data);
void (*register_get_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *), void *cb_data);
+ void (*unregister_alloc_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, void *));
void (*unregister_put_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *));
void (*unregister_get_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *));
@@ -479,11 +482,13 @@ struct fifo_buffer_s
pthread_mutex_t buffer_pool_mutex;
pthread_cond_t buffer_pool_cond_not_empty;
int buffer_pool_num_free;
- int buffer_pool_capacity;
- int buffer_pool_buf_size;
+ int buffer_pool_capacity;
+ int buffer_pool_buf_size;
void *buffer_pool_base; /*used to free mem chunk */
+ void (*alloc_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, void *data_cb);
void (*put_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, buf_element_t *buf, void *data_cb);
void (*get_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, buf_element_t *buf, void *data_cb);
+ void *alloc_cb_data[BUF_MAX_CALLBACKS];
void *put_cb_data[BUF_MAX_CALLBACKS];
void *get_cb_data[BUF_MAX_CALLBACKS];
} ;