summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/buffer.c27
-rw-r--r--src/xine-engine/buffer.h3
-rw-r--r--src/xine-engine/metronom.c16
-rw-r--r--src/xine-engine/xine.c5
4 files changed, 33 insertions, 18 deletions
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c
index cb1dee715..b69752e85 100644
--- a/src/xine-engine/buffer.c
+++ b/src/xine-engine/buffer.c
@@ -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.c,v 1.15 2002/03/12 11:04:07 guenter Exp $
+ * $Id: buffer.c,v 1.16 2002/03/24 14:15:37 guenter Exp $
*
*
* contents:
@@ -225,7 +225,7 @@ static int fifo_buffer_size (fifo_buffer_t *this) {
static void fifo_buffer_dispose (fifo_buffer_t *this) {
buf_element_t *buf, *next;
- unsigned char *mem = NULL;
+ int received = 0;
this->clear( this );
buf = this->buffer_pool_top;
@@ -234,15 +234,25 @@ static void fifo_buffer_dispose (fifo_buffer_t *this) {
next = buf->next;
- if (mem == NULL || buf->mem < mem)
- mem = buf->mem;
-
free (buf);
+ received++;
buf = next;
}
+
+ while (received < this->buffer_pool_capacity) {
+
+ buf = this->get(this);
+
+ free(buf);
+ received++;
+ }
- xine_free_aligned (mem);
+ free (this->buffer_pool_base);
+ pthread_mutex_destroy(&this->mutex);
+ pthread_cond_destroy(&this->not_empty);
+ pthread_mutex_destroy(&this->buffer_pool_mutex);
+ pthread_cond_destroy(&this->buffer_pool_cond_not_empty);
free (this);
}
@@ -282,7 +292,8 @@ fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size) {
printf ("Allocating %d buffers of %ld bytes in one chunk (alignment = %d)\n",
num_buffers, (long int) buf_size, alignment);
*/
- multi_buffer = xine_xmalloc_aligned (alignment, num_buffers * buf_size);
+ multi_buffer = xine_xmalloc_aligned (alignment, num_buffers * buf_size,
+ &this->buffer_pool_base);
this->buffer_pool_top = NULL;
@@ -311,5 +322,3 @@ fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size) {
return this;
}
-
-
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index e0a0a6630..e4be9b9bb 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.37 2002/03/20 23:12:58 guenter Exp $
+ * $Id: buffer.h,v 1.38 2002/03/24 14:15:37 guenter Exp $
*
*
* contents:
@@ -214,6 +214,7 @@ struct fifo_buffer_s
int buffer_pool_num_free;
int buffer_pool_capacity;
int buffer_pool_buf_size;
+ void *buffer_pool_base; /*used to free mem chunk */
} ;
/*
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 416d74467..5846e5408 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -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: metronom.c,v 1.74 2002/03/23 18:56:56 guenter Exp $
+ * $Id: metronom.c,v 1.75 2002/03/24 14:15:37 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -573,15 +573,23 @@ static int metronom_register_scr (metronom_t *this, scr_plugin_t *scr) {
static void metronom_unregister_scr (metronom_t *this, scr_plugin_t *scr) {
int i;
+ int64_t time;
- /* Never unregister scr_list[0]! */
+ /* never unregister scr_list[0]! */
for (i=1; i<MAX_SCR_PROVIDERS; i++)
- if (this->scr_list[i] == scr) break;
+ if (this->scr_list[i] == scr)
+ break;
if (i >= MAX_SCR_PROVIDERS)
return; /* Not found */
-
+
this->scr_list[i] = NULL;
+ time = this->get_current_time(this);
+
+ /* master could have been adjusted, others must follow now */
+ for (i=0; i<MAX_SCR_PROVIDERS; i++)
+ if (this->scr_list[i]) this->scr_list[i]->adjust(this->scr_list[i], time);
+
this->scr_master = get_master_scr(this);
}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 2a8b6b071..abe7d9db9 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -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: xine.c,v 1.112 2002/03/23 18:56:56 guenter Exp $
+ * $Id: xine.c,v 1.113 2002/03/24 14:15:37 guenter Exp $
*
* top-level xine functions
*
@@ -469,9 +469,6 @@ xine_t *xine_init (vo_driver_t *vo,
/* probe for optimized memcpy or config setting */
xine_probe_fast_memcpy(config);
- /* initialize aligned mem allocator */
- xine_init_mem_aligned();
-
/*
* init locks
*/