diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-06-16 14:34:48 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-06-16 14:34:48 +0000 |
commit | 528a7fbfe28ea118599df54bdb17b4c5f4850704 (patch) | |
tree | 911cee93cc6b5fcc7ce6c6b9540d1802635f9cc8 | |
parent | 6756ef958edc37a504f7ec4e1645e7b22ba8967c (diff) | |
download | xine-lib-528a7fbfe28ea118599df54bdb17b4c5f4850704.tar.gz xine-lib-528a7fbfe28ea118599df54bdb17b4c5f4850704.tar.bz2 |
more seeking/stopping bugfixes
CVS patchset: 191
CVS date: 2001/06/16 14:34:48
-rw-r--r-- | src/demuxers/demux_avi.c | 22 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg.c | 21 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg_block.c | 17 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 16 | ||||
-rw-r--r-- | src/libmpeg2/decode.c | 14 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 2 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 3 | ||||
-rw-r--r-- | src/xine-engine/audio_decoder.c | 15 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 11 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 44 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 6 |
11 files changed, 86 insertions, 85 deletions
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 87f42e152..1c1bfe23d 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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_avi.c,v 1.17 2001/06/09 19:05:59 guenter Exp $ + * $Id: demux_avi.c,v 1.18 2001/06/16 14:34:48 guenter Exp $ * * demultiplexer for avi streams * @@ -845,8 +845,9 @@ static void *demux_avi_loop (void *this_gen) { } static void demux_avi_stop (demux_plugin_t *this_gen) { - void *p; - demux_avi_t *this = (demux_avi_t *) this_gen; + void *p; + demux_avi_t *this = (demux_avi_t *) this_gen; + buf_element_t *buf; this->status = DEMUX_FINISHED; @@ -854,6 +855,21 @@ static void demux_avi_stop (demux_plugin_t *this_gen) { AVI_close (this->avi); this->avi = NULL; + + + this->video_fifo->clear(this->video_fifo); + this->audio_fifo->clear(this->audio_fifo); + + buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); + buf->type = BUF_CONTROL_END; + this->video_fifo->put (this->video_fifo, buf); + + if(this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + buf->type = BUF_CONTROL_END; + this->audio_fifo->put (this->audio_fifo, buf); + } + } static void demux_avi_close (demux_plugin_t *this_gen) { diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index ebda3f6d7..ab2353431 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.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.c,v 1.17 2001/06/14 10:48:24 guenter Exp $ + * $Id: demux_mpeg.c,v 1.18 2001/06/16 14:34:48 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -153,7 +153,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int nID) { if(this->audio_fifo) buf = this->input->read_block (this->input, this->audio_fifo, nLen-4); else { - buf = this->input->read (this->input, this->dummy_space, nLen); + this->input->read (this->input, this->dummy_space, nLen); return; } @@ -375,7 +375,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int nID) if(this->audio_fifo) { buf = this->input->read_block (this->input, this->audio_fifo, nLen); } else { - buf = this->input->read (this->input, this->dummy_space, nLen); + this->input->read (this->input, this->dummy_space, nLen); return; } @@ -543,10 +543,25 @@ static void *demux_mpeg_loop (void *this_gen) { static void demux_mpeg_stop (demux_plugin_t *this_gen) { void *p; demux_mpeg_t *this = (demux_mpeg_t *) this_gen; + buf_element_t *buf; this->status = DEMUX_FINISHED; pthread_join (this->thread, &p); + + this->video_fifo->clear(this->video_fifo); + this->audio_fifo->clear(this->audio_fifo); + + buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); + buf->type = BUF_CONTROL_END; + this->video_fifo->put (this->video_fifo, buf); + + if(this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + buf->type = BUF_CONTROL_END; + this->audio_fifo->put (this->audio_fifo, buf); + } + } static int demux_mpeg_get_status (demux_plugin_t *this_gen) { diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 11869a0b8..b3e7e422f 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.14 2001/06/10 13:59:33 guenter Exp $ + * $Id: demux_mpeg_block.c,v 1.15 2001/06/16 14:34:48 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -363,10 +363,25 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; void *p; + buf_element_t *buf; this->status = DEMUX_FINISHED; pthread_join (this->thread, &p); + + this->video_fifo->clear(this->video_fifo); + this->audio_fifo->clear(this->audio_fifo); + + buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); + buf->type = BUF_CONTROL_END; + this->video_fifo->put (this->video_fifo, buf); + + if(this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + buf->type = BUF_CONTROL_END; + this->audio_fifo->put (this->audio_fifo, buf); + } + } static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) { diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 555b381c2..f99c77ffc 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.10 2001/06/13 22:37:13 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.11 2001/06/16 14:34:48 guenter Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -133,10 +133,24 @@ static void *demux_mpgaudio_loop (void *this_gen) { static void demux_mpgaudio_stop (demux_plugin_t *this_gen) { demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen; void *p; + buf_element_t *buf; this->status = DEMUX_FINISHED; pthread_join (this->thread, &p); + + this->video_fifo->clear(this->video_fifo); + this->audio_fifo->clear(this->audio_fifo); + + buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); + buf->type = BUF_CONTROL_END; + this->video_fifo->put (this->video_fifo, buf); + + if(this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + buf->type = BUF_CONTROL_END; + this->audio_fifo->put (this->audio_fifo, buf); + } } static int demux_mpgaudio_get_status (demux_plugin_t *this_gen) { diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index d23d8d106..cc813ba82 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -82,6 +82,9 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (mpeg2dec->is_sequence_needed && (code != 0xb3)) return 0; + if (mpeg2dec->is_frame_needed && (code != 0x00)) + return 0; + stats_header (code, buffer); picture = mpeg2dec->picture; @@ -93,7 +96,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (((picture->picture_structure == FRAME_PICTURE) || (picture->second_field)) ) { - picture->current_frame->bFrameBad = mpeg2dec->drop_frame; + picture->current_frame->bFrameBad |= mpeg2dec->drop_frame; if (picture->picture_coding_type == B_TYPE) { if (picture->mpeg1) @@ -120,6 +123,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, exit (1); } + mpeg2dec->is_frame_needed=0; + if (!picture->second_field) { /* find out if we want to skip this frame */ mpeg2dec->drop_frame = 0; @@ -229,6 +234,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->backward_reference_frame; picture->backward_reference_frame = picture->current_frame; } + picture->current_frame->bFrameBad = 0; picture->current_frame->PTS = mpeg2dec->pts; mpeg2dec->pts = 0; @@ -301,6 +307,8 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; mpeg2dec->code = 0xb4; mpeg2dec->seek_mode = 0; + mpeg2dec->shift = 0xffffff00; + mpeg2dec->is_frame_needed = 1; } while (current != end) { @@ -310,6 +318,7 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, return ret; ret += parse_chunk (mpeg2dec, code, mpeg2dec->chunk_buffer); } + return ret; } @@ -318,7 +327,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) static uint8_t finalizer[] = {0,0,1,0xb4}; picture_t *picture = mpeg2dec->picture; - mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4, 0); + /* mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4, 0); */ if (picture->throwaway_frame) picture->throwaway_frame->free (picture->throwaway_frame); @@ -356,7 +365,6 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec, } if (mpeg2dec->is_sequence_needed) { - printf ("libmpeg2: found sequence header! :-)\n"); mpeg2dec->is_sequence_needed = 0; picture->forward_reference_frame = diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index 7f70bca05..4172d2291 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -32,7 +32,7 @@ typedef struct mpeg2dec_s { int is_sequence_needed; int frames_to_drop, drop_frame; int in_slice; - int seek_mode; + int seek_mode, is_frame_needed; /* the maximum chunk size is determined by vbv_buffer_size */ /* which is 224K for MP@ML streams. */ diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 9094ecb0f..7490e9e56 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_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: xine_decoder.c,v 1.8 2001/06/14 09:19:44 guenter Exp $ + * $Id: xine_decoder.c,v 1.9 2001/06/16 14:34:49 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -69,6 +69,7 @@ static void mpeg2dec_close (video_decoder_t *this_gen) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; mpeg2_close (&this->mpeg2); + this->video_out->close(this->video_out); } diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index fe78c43d4..9effea450 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.18 2001/06/14 10:48:24 guenter Exp $ + * $Id: audio_decoder.c,v 1.19 2001/06/16 14:34:49 guenter Exp $ * * * functions that implement audio decoding @@ -181,19 +181,6 @@ void audio_decoder_init (xine_t *this) { pthread_create (&this->audio_thread, NULL, audio_decoder_loop, this) ; } -void audio_decoder_stop (xine_t *this) { - - if (this->audio_fifo) { - - this->audio_fifo->clear(this->audio_fifo); - - if (this->cur_audio_decoder_plugin) { - this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin); - this->cur_audio_decoder_plugin = NULL; - } - } -} - void audio_decoder_shutdown (xine_t *this) { buf_element_t *buf; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 028e3546d..adb5876e5 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.22 2001/06/14 10:48:24 guenter Exp $ + * $Id: video_decoder.c,v 1.23 2001/06/16 14:34:49 guenter Exp $ * */ @@ -141,15 +141,6 @@ void video_decoder_init (xine_t *this) { pthread_create (&this->video_thread, NULL, video_decoder_loop, this) ; } -void video_decoder_stop (xine_t *this) { - this->video_fifo->clear(this->video_fifo); - - if (this->cur_video_decoder_plugin) { - this->cur_video_decoder_plugin->close (this->cur_video_decoder_plugin); - this->cur_video_decoder_plugin = NULL; - } -} - void video_decoder_shutdown (xine_t *this) { buf_element_t *buf; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index ebced5169..46e00783b 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.23 2001/06/14 09:19:44 guenter Exp $ + * $Id: xine.c,v 1.24 2001/06/16 14:34:49 guenter Exp $ * * top-level xine functions * @@ -67,9 +67,6 @@ void xine_notify_stream_finished (xine_t *this) { } -/* - * - */ void xine_stop (xine_t *this) { if (!this->cur_input_plugin) @@ -89,9 +86,6 @@ void xine_stop (xine_t *this) { this->cur_input_plugin = NULL; } - video_decoder_stop (this); - audio_decoder_stop (this); - this->spu_fifo->clear(this->spu_fifo); this->metronom->stop_clock (this->metronom); @@ -167,9 +161,6 @@ static int find_demuxer(xine_t *this, const char *MRL) { return 0; } -/* - * - */ static void xine_play_internal (xine_t *this, char *MRL, int spos, off_t pos) { @@ -273,9 +264,6 @@ static void xine_play_internal (xine_t *this, char *MRL, printf ("xine: play_internal done.\n"); } -/* - * - */ void xine_play (xine_t *this, char *MRL, int spos) { pthread_mutex_lock (&this->xine_lock); @@ -286,9 +274,6 @@ void xine_play (xine_t *this, char *MRL, int spos) { pthread_mutex_unlock (&this->xine_lock); } -/* - * - */ int xine_eject (xine_t *this) { if(this->cur_input_plugin == NULL) @@ -308,9 +293,6 @@ int xine_eject (xine_t *this) { return 0; } -/* - * - */ void xine_exit (xine_t *this) { /* @@ -344,9 +326,6 @@ void xine_exit (xine_t *this) { printf ("xine_exit: bye!\n"); } -/* - * - */ void xine_pause (xine_t *this) { pthread_mutex_lock (&this->xine_lock); @@ -386,9 +365,6 @@ void xine_pause (xine_t *this) { pthread_mutex_unlock (&this->xine_lock); } -/* - * - */ xine_t *xine_init (vo_driver_t *vo, ao_functions_t *ao, gui_status_callback_func_t gui_status_callback, @@ -458,17 +434,11 @@ xine_t *xine_init (vo_driver_t *vo, return this; } -/* - * - */ int xine_get_audio_channel (xine_t *this) { return this->audio_channel; } -/* - * - */ void xine_select_audio_channel (xine_t *this, int channel) { pthread_mutex_lock (&this->xine_lock); @@ -480,17 +450,11 @@ void xine_select_audio_channel (xine_t *this, int channel) { pthread_mutex_unlock (&this->xine_lock); } -/* - * - */ int xine_get_spu_channel (xine_t *this) { return this->spu_channel; } -/* - * - */ void xine_select_spu_channel (xine_t *this, int channel) { pthread_mutex_lock (&this->xine_lock); @@ -500,9 +464,6 @@ void xine_select_spu_channel (xine_t *this, int channel) { pthread_mutex_unlock (&this->xine_lock); } -/* - * - */ int xine_get_current_position (xine_t *this) { off_t len; @@ -526,9 +487,6 @@ int xine_get_current_position (xine_t *this) { return (int) share; } -/* - * - */ int xine_get_status(xine_t *this) { return this->status; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 7a787907b..c3277499a 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.21 2001/06/10 23:10:52 heikos Exp $ + * $Id: xine_internal.h,v 1.22 2001/06/16 14:34:49 guenter Exp $ * */ @@ -289,8 +289,6 @@ void xine_notify_stream_finished (xine_t *this); void video_decoder_init (xine_t *this); -void video_decoder_stop (xine_t *this); - /* * quit video thread */ @@ -304,8 +302,6 @@ void video_decoder_shutdown (xine_t *this); void audio_decoder_init (xine_t *this); -void audio_decoder_stop (xine_t *this); - /* * quit audio thread */ |