diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 21 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 8 | ||||
-rw-r--r-- | src/xine-engine/audio_decoder.c | 3 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 24 | ||||
-rw-r--r-- | src/xine-engine/buffer.c | 30 | ||||
-rw-r--r-- | src/xine-engine/buffer.h | 4 | ||||
-rw-r--r-- | src/xine-engine/metronom.c | 49 | ||||
-rw-r--r-- | src/xine-engine/metronom.h | 7 | ||||
-rw-r--r-- | src/xine-engine/osd.c | 1 | ||||
-rw-r--r-- | src/xine-engine/scratch.c | 17 | ||||
-rw-r--r-- | src/xine-engine/scratch.h | 4 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 3 | ||||
-rw-r--r-- | src/xine-engine/video_out.c | 7 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 15 |
15 files changed, 170 insertions, 25 deletions
@@ -188,7 +188,7 @@ Contributions 'cloudy' skin. Ewald Snel <ewald@rambo.its.tudelft.nl> - metronom sync loop fix, safe ffmpeg multithread init + metronom sync loop fix, safe ffmpeg multithread init, memleak fixes Bruno Pinaud <bpinaud@wanadoo.fr> french translation updates/fixes. diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 203d1f20e..a18fd831a 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 the xine project + * Copyright (C) 2001-2002 the xine project * * This file is part of xine, a free video player. * @@ -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_qt.c,v 1.21 2002/02/17 17:32:50 guenter Exp $ + * $Id: demux_qt.c,v 1.22 2002/03/01 09:29:50 guenter Exp $ * * demultiplexer for quicktime streams, based on: * @@ -3115,22 +3115,25 @@ static int quicktime_trak_shift_offsets(quicktime_trak_t *trak, longest offset) /* moov.c */ -static int quicktime_moov_init(quicktime_moov_t *moov) -{ +static int quicktime_moov_init(quicktime_moov_t *moov) { + int i; moov->total_tracks = 0; - for(i = 0 ; i < MAXTRACKS; i++) moov->trak[i] = 0; + for (i = 0 ; i < MAXTRACKS; i++) + moov->trak[i] = 0; quicktime_mvhd_init(&(moov->mvhd)); quicktime_udta_init(&(moov->udta)); quicktime_ctab_init(&(moov->ctab)); return 0; } -static int quicktime_moov_delete(quicktime_moov_t *moov) -{ +static int quicktime_moov_delete(quicktime_moov_t *moov) { + /* int i; */ - while(moov->total_tracks) quicktime_delete_trak(moov); + while(moov->total_tracks) + quicktime_delete_trak(moov); + quicktime_mvhd_delete(&(moov->mvhd)); quicktime_udta_delete(&(moov->udta)); quicktime_ctab_delete(&(moov->ctab)); @@ -4367,7 +4370,7 @@ static int demux_qt_open(demux_plugin_t *this_gen, return DEMUX_CAN_HANDLE; } } - return DEMUX_CANNOT_HANDLE; + return DEMUX_CANNOT_HANDLE; } break; diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 3f220ce3e..529b220fd 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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: video_out_xshm.c,v 1.64 2002/02/25 01:23:41 guenter Exp $ + * $Id: video_out_xshm.c,v 1.65 2002/03/01 09:29:50 guenter Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -1138,8 +1138,12 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, static void xshm_exit (vo_driver_t *this_gen) { - /* xshm_driver_t *this = (xshm_driver_t *) this_gen; */ + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + if (this->cur_frame) + this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); + free (this); } diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 19510a3c7..8ae8d2901 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.60 2002/02/18 15:55:44 guenter Exp $ + * $Id: audio_decoder.c,v 1.61 2002/03/01 09:29:50 guenter Exp $ * * * functions that implement audio decoding @@ -302,6 +302,7 @@ void audio_decoder_shutdown (xine_t *this) { if(this->audio_out) this->audio_out->exit (this->audio_out); + this->audio_fifo->dispose (this->audio_fifo); } int xine_get_audio_channel (xine_t *this) { diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 8ec3094c8..2c0bd80d4 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.42 2002/02/18 15:55:44 guenter Exp $ + * $Id: audio_out.c,v 1.43 2002/03/01 09:29:50 guenter Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -523,7 +523,29 @@ static void ao_close(ao_instance_t *this) { } static void ao_exit(ao_instance_t *this) { + + audio_buffer_t *buf, *next; + this->driver->exit(this->driver); + + free (this->frame_buffer); + free (this->zero_space); + + buf = this->free_fifo->first; + + while (buf != NULL) { + + next = buf->next; + + free (buf->mem); + free (buf); + + buf = next; + } + + free (this->free_fifo); + free (this->out_fifo); + free (this); } static uint32_t ao_get_capabilities (ao_instance_t *this) { diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index e7a71f764..29f4d2227 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.12 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: buffer.c,v 1.13 2002/03/01 09:29:50 guenter Exp $ * * * contents: @@ -220,6 +220,33 @@ static int fifo_buffer_size (fifo_buffer_t *this) { } /* + * Destroy the buffer + */ +static void fifo_buffer_dispose (fifo_buffer_t *this) { + + buf_element_t *buf, *next; + char *mem = NULL; + + this->clear( this ); + buf = this->buffer_pool_top; + + while (buf != NULL) { + + next = buf->next; + + if (mem == NULL || buf->mem < mem) + mem = buf->mem; + + free (buf); + + buf = next; + } + + xine_free_aligned (mem); + free (this); +} + +/* * allocate and initialize new (empty) fifo buffer */ fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size) { @@ -238,6 +265,7 @@ fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size) { this->get = fifo_buffer_get; this->clear = fifo_buffer_clear; this->size = fifo_buffer_size; + this->dispose = fifo_buffer_dispose; pthread_mutex_init (&this->mutex, NULL); pthread_cond_init (&this->not_empty, NULL); diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 685faf347..995249a43 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.33 2002/02/09 07:13:24 guenter Exp $ + * $Id: buffer.h,v 1.34 2002/03/01 09:29:50 guenter Exp $ * * * contents: @@ -178,6 +178,8 @@ struct fifo_buffer_s int (*size) (fifo_buffer_t *fifo); + void (*dispose) (fifo_buffer_t *fifo); + /* * alloc buffer for this fifo from global buf pool * you don't have to use this function to allocate a buffer, diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 1517d948c..d24f28ac7 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.59 2002/02/27 13:09:30 heikos Exp $ + * $Id: metronom.c,v 1.60 2002/03/01 09:29:50 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -155,6 +155,13 @@ static int64_t unixscr_get_current (scr_plugin_t *scr) { return pts; } +static void unixscr_exit (scr_plugin_t *scr) { + unixscr_t *this = (unixscr_t*) scr; + + pthread_mutex_destroy (&this->lock); + free(this); +} + static scr_plugin_t* unixscr_init () { unixscr_t *this; @@ -167,6 +174,7 @@ static scr_plugin_t* unixscr_init () { this->scr.adjust = unixscr_adjust; this->scr.start = unixscr_start; this->scr.get_current = unixscr_get_current; + this->scr.exit = unixscr_exit; pthread_mutex_init (&this->lock, NULL); @@ -668,6 +676,8 @@ static void metronom_unregister_scr (metronom_t *this, scr_plugin_t *scr) { static int metronom_sync_loop (metronom_t *this) { + struct timeval tv; + struct timespec ts; scr_plugin_t** scr; int64_t pts; @@ -677,11 +687,41 @@ static int metronom_sync_loop (metronom_t *this) { for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) if (*scr && *scr != this->scr_master) (*scr)->adjust(*scr, pts); - sleep(5); /* synchronise every 5 seconds */ + /* synchronise every 5 seconds */ + pthread_mutex_lock (&this->lock); + + gettimeofday(&tv, NULL); + ts.tv_sec = tv.tv_sec + 5; + ts.tv_nsec = tv.tv_usec * 1000; + pthread_cond_timedwait (&this->cancel, &this->lock, &ts); + + pthread_mutex_unlock (&this->lock); } return 0; } +static void metronom_exit (metronom_t *this) { + + scr_plugin_t** scr; + + pthread_mutex_lock (&this->lock); + pthread_cond_signal (&this->cancel); + pthread_mutex_unlock (&this->lock); + + pthread_join (this->sync_thread, NULL); + + pthread_mutex_destroy (&this->lock); + pthread_cond_destroy (&this->video_discontinuity_reached); + pthread_cond_destroy (&this->audio_discontinuity_reached); + pthread_cond_destroy (&this->cancel); + + for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) + if (*scr) (*scr)->exit(*scr); + + free (this->scr_list); + free (this); +} + metronom_t * metronom_init (int have_audio, void *xine) { @@ -705,16 +745,19 @@ metronom_t * metronom_init (int have_audio, void *xine) { this->register_scr = metronom_register_scr; this->unregister_scr = metronom_unregister_scr; this->set_speed = metronom_set_speed; + this->exit = metronom_exit; this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*)); this->register_scr(this, unixscr_init()); + pthread_mutex_init (&this->lock, NULL); + pthread_cond_init (&this->cancel, NULL); + if ((err = pthread_create(&this->sync_thread, NULL, (void*(*)(void*)) metronom_sync_loop, this)) != 0) printf ("metronom: cannot create sync thread (%s)\n", strerror(err)); - pthread_mutex_init (&this->lock, NULL); pthread_cond_init (&this->video_discontinuity_reached, NULL); pthread_cond_init (&this->audio_discontinuity_reached, NULL); diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index 1b6a841cc..cca444be1 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.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: metronom.h,v 1.17 2002/02/09 07:13:24 guenter Exp $ + * $Id: metronom.h,v 1.18 2002/03/01 09:29:50 guenter Exp $ * * metronom: general pts => virtual calculation/assoc * @@ -195,6 +195,8 @@ struct metronom_s { int (*register_scr) (metronom_t *this, scr_plugin_t *scr); void (*unregister_scr) (metronom_t *this, scr_plugin_t *scr); + void (*exit) (metronom_t *this); + /* * metronom internal stuff */ @@ -231,6 +233,7 @@ struct metronom_s { int audio_discontinuity_count; pthread_cond_t video_discontinuity_reached; pthread_cond_t audio_discontinuity_reached; + pthread_cond_t cancel; }; @@ -261,6 +264,8 @@ struct scr_plugin_s int64_t (*get_current) (scr_plugin_t *this); + void (*exit) (scr_plugin_t *this); + metronom_t *metronom; }; diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 53411639a..d5b505861 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -831,6 +831,7 @@ static void osd_renderer_close (osd_renderer_t *this) { while( this->fonts ) osd_renderer_unload_font( this, this->fonts->name ); + free(this->event.object.overlay); free(this); } diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 154a9bb67..c47c7a9b6 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.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: scratch.c,v 1.6 2002/01/16 17:35:34 miguelfreitas Exp $ + * $Id: scratch.c,v 1.7 2002/03/01 09:29:50 guenter Exp $ * * top-level xine functions * @@ -71,6 +71,20 @@ static char **scratch_get_content (scratch_buffer_t *this) { } +static void scratch_dispose (scratch_buffer_t *this) { + + int i; + + for(i = 0; i < this->num_lines; i++ ) { + free (this->lines[i]); + } + + free (this->lines); + free (this->ordered); + free (this); + +} + scratch_buffer_t *new_scratch_buffer (int num_lines) { scratch_buffer_t *this; @@ -90,6 +104,7 @@ scratch_buffer_t *new_scratch_buffer (int num_lines) { this->scratch_printf = scratch_printf; this->get_content = scratch_get_content; + this->dispose = scratch_dispose; this->num_lines = num_lines; this->cur = 0; diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index 770c83fb1..4390641a8 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.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: scratch.h,v 1.2 2002/01/16 17:35:34 miguelfreitas Exp $ + * $Id: scratch.h,v 1.3 2002/03/01 09:29:50 guenter Exp $ * * scratch buffer for log output * @@ -36,6 +36,8 @@ struct scratch_buffer_s { char **(*get_content) (scratch_buffer_t *this); + void (*dispose) (scratch_buffer_t *this); + char **lines; char **ordered; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d8b55dbf9..d8cef1ed1 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.73 2002/02/17 17:32:51 guenter Exp $ + * $Id: video_decoder.c,v 1.74 2002/03/01 09:29:50 guenter Exp $ * */ @@ -293,5 +293,6 @@ void video_decoder_shutdown (xine_t *this) { pthread_join (this->video_thread, &p); this->video_out->exit (this->video_out); + this->video_fifo->dispose (this->video_fifo); } diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 7f8c6fbe7..ee61adc8e 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.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: video_out.c,v 1.77 2002/02/18 17:30:40 guenter Exp $ + * $Id: video_out.c,v 1.78 2002/03/01 09:29:50 guenter Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -862,6 +862,11 @@ static void vo_exit (vo_instance_t *this_gen) { #ifdef LOG printf ("video_out: vo_exit... done\n"); #endif + + free (this->free_img_buf_queue); + free (this->display_img_buf_queue); + free (this->logo_yuy2); + free (this); } static vo_frame_t *vo_get_last_frame (vo_instance_t *this_gen) { diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 30d794119..1e8216a5f 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.104 2002/02/17 17:32:51 guenter Exp $ + * $Id: xine.c,v 1.105 2002/03/01 09:29:50 guenter Exp $ * * top-level xine functions * @@ -86,6 +86,8 @@ void * xine_notify_stream_finished_thread (void * this_gen) { xine_send_event (this, &event); + pthread_detach( pthread_self() ); + return NULL; } @@ -413,6 +415,8 @@ int xine_eject (xine_t *this) { void xine_exit (xine_t *this) { + int i; + xine_stop(this); LOG_MSG(this, _("xine_exit: shutdown audio\n")); @@ -423,12 +427,21 @@ void xine_exit (xine_t *this) { video_decoder_shutdown (this); + this->osd_renderer->close( this->osd_renderer ); + this->status = XINE_QUIT; LOG_MSG(this, _("xine_exit: bye!\n")); + for (i = 0; i < XINE_LOG_NUM; i++) + this->log_buffers[i]->dispose (this->log_buffers[i]); + + this->metronom->exit (this->metronom); + xine_profiler_print_results (); + free (this); + } xine_t *xine_init (vo_driver_t *vo, |