summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/demuxers/demux_mpeg_block.c6
-rw-r--r--src/liba52/parse.c5
-rw-r--r--src/libmpeg2/decode.c19
-rw-r--r--src/libmpeg2/mpeg2.h4
-rw-r--r--src/libspucc/cc_decoder.c4
-rw-r--r--src/video_out/Makefile.am7
-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
-rw-r--r--src/xine-utils/utils.c79
-rw-r--r--src/xine-utils/xineutils.h20
12 files changed, 70 insertions, 125 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 01722a15c..5c1378f1f 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.81 2002/03/21 21:48:49 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.82 2002/03/24 14:15:36 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -72,7 +72,7 @@ typedef struct demux_mpeg_block_s {
char cur_mrl[256];
- uint8_t *scratch;
+ uint8_t *scratch, *scratch_base;
int64_t last_scr;
int64_t nav_last_end_pts;
@@ -1133,7 +1133,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
this->demux_plugin.get_stream_length = demux_mpeg_block_get_stream_length;
this->demux_plugin.get_mimetypes = demux_mpeg_block_get_mimetypes;
- this->scratch = xine_xmalloc_aligned (512, 4096);
+ this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base);
return (demux_plugin_t *) this;
}
diff --git a/src/liba52/parse.c b/src/liba52/parse.c
index e92474761..e98841902 100644
--- a/src/liba52/parse.c
+++ b/src/liba52/parse.c
@@ -42,12 +42,13 @@ static uint8_t halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3};
sample_t * a52_init (uint32_t mm_accel)
{
- sample_t * samples;
+ sample_t * samples, *samples_base;
int i;
imdct_init (mm_accel);
- samples = xine_xmalloc_aligned (16, 256 * 12 * sizeof (sample_t));
+ samples = xine_xmalloc_aligned (16, 256 * 12 * sizeof (sample_t),
+ &samples_base);
if (samples == NULL)
return NULL;
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index d7245afaa..b78b178d5 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -63,9 +63,11 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec,
}
if( !mpeg2dec->chunk_buffer )
- mpeg2dec->chunk_buffer = xine_xmalloc_aligned (16, BUFFER_SIZE + 4);
+ mpeg2dec->chunk_buffer = xine_xmalloc_aligned (16, BUFFER_SIZE + 4,
+ (void**)&mpeg2dec->chunk_base);
if( !mpeg2dec->picture )
- mpeg2dec->picture = xine_xmalloc_aligned (16, sizeof (picture_t));
+ mpeg2dec->picture = xine_xmalloc_aligned (16, sizeof (picture_t),
+ (void**)&mpeg2dec->picture_base);
mpeg2dec->shift = 0xffffff00;
mpeg2dec->is_sequence_needed = 1;
@@ -511,18 +513,11 @@ void mpeg2_flush (mpeg2dec_t * mpeg2dec) {
img->scr = 0;
img->bad_frame = 0;
img->drawn = 1;
-
+
img->draw(img);
img->free(img);
-#ifdef LOG
- } else {
- printf ("libmpeg2: flush called, but I have no frame to flush\n");
-
- }
-#else
}
-#endif
}
@@ -572,12 +567,12 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec)
}
if ( mpeg2dec->chunk_buffer ) {
- xine_free_aligned (mpeg2dec->chunk_buffer);
+ free (mpeg2dec->chunk_base);
mpeg2dec->chunk_buffer = NULL;
}
if ( mpeg2dec->picture ) {
- xine_free_aligned (mpeg2dec->picture);
+ free (mpeg2dec->picture_base);
mpeg2dec->picture = NULL;
}
}
diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h
index a0efeaac5..6e70f4bd9 100644
--- a/src/libmpeg2/mpeg2.h
+++ b/src/libmpeg2/mpeg2.h
@@ -25,7 +25,7 @@ typedef struct mpeg2dec_s {
vo_instance_t * output;
/* this is where we keep the state of the decoder */
- struct picture_s * picture;
+ struct picture_s * picture, *picture_base;
uint32_t shift;
int is_sequence_needed;
@@ -37,7 +37,7 @@ typedef struct mpeg2dec_s {
/* which is 224K for MP@ML streams. */
/* (we make no pretenses of decoding anything more than that) */
/* allocated in init - gcc has problems allocating such big structures */
- uint8_t * chunk_buffer;
+ uint8_t * chunk_buffer, *chunk_base;
/* pointer to current position in chunk_buffer */
uint8_t * chunk_ptr;
/* last start code ? */
diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c
index db1312016..d34cc88df 100644
--- a/src/libspucc/cc_decoder.c
+++ b/src/libspucc/cc_decoder.c
@@ -4,7 +4,7 @@
* Copyright (C) Christian Vogler
* cvogler@gradient.cis.upenn.edu - December 2001
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,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: cc_decoder.c,v 1.11 2002/03/20 18:50:37 cvogler Exp $
+ * $Id: cc_decoder.c,v 1.12 2002/03/24 14:15:37 guenter Exp $
*
* stuff needed to provide closed captioning decoding and display
*
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index 089013d70..cb4d76efe 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -40,11 +40,12 @@ endif
# "xineplug_vo_out_*"
# FIXME: temporarily disabled until they're adapted to new interface
-# lib_LTLIBRARIES = $(xv_module) $(syncfb_module) $(xshm_module) $(aa_module) \
-# $(fb_module) $(sdl_module) $(opengl_module) $(directfb_module)
+# $(sdl_module) $(opengl_module) $(directfb_module)
+
+# no adapted to new xmalloc_aligned: $(fb_module)
lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(directfb_module) $(aa_module) \
- $(fb_module) $(syncfb_module)
+ $(syncfb_module)
xineplug_vo_out_xv_la_SOURCES = deinterlace.c alphablend.c video_out_xv.c
xineplug_vo_out_xv_la_LIBADD = $(XV_LIB) $(X_LIBS) -lXext
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
*/
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 11e45e5cd..61058b26b 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2000-2001 the xine project
+ * Copyright (C) 2000-2002 the xine project
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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: utils.c,v 1.4 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: utils.c,v 1.5 2002/03/24 14:15:37 guenter Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -38,9 +38,6 @@
#include "compat.h"
-/*
- *
- */
void *xine_xmalloc(size_t size) {
void *ptr;
@@ -55,72 +52,19 @@ void *xine_xmalloc(size_t size) {
return ptr;
}
-typedef struct mem_aligned_s {
- struct mem_aligned_s *next;
- void *ptr;
- void *aligned_ptr;
-} mem_aligned_t;
+void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) {
-static mem_aligned_t *mem_aligned;
-static pthread_mutex_t mem_aligned_mutex;
-
-/*
- *
- */
-void *xine_xmalloc_aligned (size_t alignment, size_t size) {
- char *pMem, *ptr;
- mem_aligned_t *reg;
+ char *ptr;
- ptr = pMem = xine_xmalloc (size+alignment);
+ *base = ptr = xine_xmalloc (size+alignment);
- while ((int) pMem % alignment)
- pMem++;
+ while ((int) ptr % alignment)
+ ptr++;
- pthread_mutex_lock (&mem_aligned_mutex);
- reg = malloc( sizeof(mem_aligned_t) );
- reg->next = mem_aligned;
- reg->ptr = ptr;
- reg->aligned_ptr = pMem;
- mem_aligned = reg;
- pthread_mutex_unlock (&mem_aligned_mutex);
-
- return pMem;
-}
-
-
-void xine_free_aligned( void *p ) {
- mem_aligned_t *reg, *last;
-
- pthread_mutex_lock (&mem_aligned_mutex);
-
- last = NULL;
- reg = mem_aligned;
- while( reg != NULL ) {
- if ( reg->aligned_ptr == p ) {
- free( reg->ptr );
- if( last )
- last->next = reg->next;
- else
- mem_aligned = reg->next;
- free( reg );
- pthread_mutex_unlock (&mem_aligned_mutex);
- return;
- }
- last = reg;
- reg = reg->next;
- }
- pthread_mutex_unlock (&mem_aligned_mutex);
+ return ptr;
}
-void xine_init_mem_aligned(void) {
- mem_aligned = NULL;
- pthread_mutex_init (&mem_aligned_mutex, NULL);
-}
-
-/*
- *
- */
const char *xine_get_homedir(void) {
struct passwd *pw = NULL;
char *homedir = NULL;
@@ -155,9 +99,6 @@ const char *xine_get_homedir(void) {
return homedir;
}
-/*
- *
- */
char *xine_chomp(char *str) {
char *pbuf;
@@ -177,7 +118,7 @@ char *xine_chomp(char *str) {
/*
- * A thread-safe usecond sleep
+ * a thread-safe usecond sleep
*/
void xine_usec_sleep(unsigned usec) {
#if HAVE_NANOSLEEP
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index ca8085d57..d1bc913fb 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2000-2001 the xine project
+ * Copyright (C) 2000-2002 the xine project
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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: xineutils.h,v 1.11 2002/03/23 22:39:11 guenter Exp $
+ * $Id: xineutils.h,v 1.12 2002/03/24 14:15:37 guenter Exp $
*
*/
#ifndef XINEUTILS_H
@@ -612,18 +612,10 @@ void *xine_xmalloc(size_t size);
/*
* Same as above, but memory is aligned to 'alignement'.
+ * **base is used to return pointer to un-aligned memory, use
+ * this to free the mem chunk
*/
-void *xine_xmalloc_aligned(size_t alignment, size_t size);
-
-/*
- * Free memory allocated with the above function
- */
-void *xine_free_aligned(void *p);
-
-/*
- * Initialize aligned memory allocator
- */
-void xine_init_mem_aligned(void);
+void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base);
/*
* Get user home directory.