diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-12-26 21:53:41 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-12-26 21:53:41 +0000 |
commit | 4b80217cb872335e6f01de22d58fc0778da265c6 (patch) | |
tree | aec4ac26159e8e0670263c00cbab7be4ce3e4cab | |
parent | c42215d759320ab0cfb4d997064535c0bf32f785 (diff) | |
download | xine-lib-4b80217cb872335e6f01de22d58fc0778da265c6.tar.gz xine-lib-4b80217cb872335e6f01de22d58fc0778da265c6.tar.bz2 |
- cleanup internal interfaces for rewiring
- fix UI_PLAYBACK_FINISHED rifle
CVS patchset: 3686
CVS date: 2002/12/26 21:53:41
-rw-r--r-- | src/input/net_buf_ctrl.c | 4 | ||||
-rw-r--r-- | src/liba52/xine_decoder.c | 20 | ||||
-rw-r--r-- | src/libmpeg2/decode.c | 8 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 6 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 8 | ||||
-rw-r--r-- | src/libspucc/xine_decoder.c | 6 | ||||
-rw-r--r-- | src/libspudec/spu.c | 6 | ||||
-rw-r--r-- | src/libspudec/spu.h | 3 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 11 | ||||
-rw-r--r-- | src/xine-engine/audio_decoder.c | 15 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 140 | ||||
-rw-r--r-- | src/xine-engine/audio_out.h | 45 | ||||
-rw-r--r-- | src/xine-engine/post.c | 4 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 12 | ||||
-rw-r--r-- | src/xine-engine/video_out.h | 4 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 6 |
16 files changed, 149 insertions, 149 deletions
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index e31049284..0622ad3ad 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -102,14 +102,14 @@ void nbc_check_buffers (nbc_t *this) { this->stream->xine->clock->set_speed (this->stream->xine->clock, XINE_SPEED_PAUSE); this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0); if (this->stream->audio_out) - this->stream->audio_out->audio_paused = 2; + this->stream->audio_out->set_property(this->stream->audio_out,AO_PROP_PAUSED,2); this->buffering = 1; } else if ( (fifo_fill>this->high_water_mark) && (this->buffering)) { this->stream->xine->clock->set_speed (this->stream->xine->clock, XINE_SPEED_NORMAL); this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); if (this->stream->audio_out) - this->stream->audio_out->audio_paused = 0; + this->stream->audio_out->set_property(this->stream->audio_out,AO_PROP_PAUSED,0); this->buffering = 0; } diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index 0dd629bb7..6fb57b532 100644 --- a/src/liba52/xine_decoder.c +++ b/src/liba52/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.44 2002/12/22 23:32:30 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.45 2002/12/26 21:53:42 miguelfreitas Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -79,7 +79,6 @@ typedef struct a52dec_decoder_s { int a52_flags_map[11]; int ao_flags_map[11]; - xine_audio_port_t *audio_out; int audio_caps; int bypass_mode; int output_sampling_rate; @@ -223,10 +222,10 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { || (output_mode != this->output_mode)) { if (this->output_open) - this->audio_out->close (this->audio_out, this->stream); + this->stream->audio_out->close (this->stream->audio_out, this->stream); - this->output_open = this->audio_out->open (this->audio_out, + this->output_open = this->stream->audio_out->open (this->stream->audio_out, this->stream, 16, this->a52_sample_rate, output_mode) ; @@ -243,7 +242,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { * decode a52 and convert/interleave samples */ - buf = this->audio_out->get_buffer (this->audio_out); + buf = this->stream->audio_out->get_buffer (this->stream->audio_out); int_samples = buf->mem; buf->num_frames = 256*6; @@ -294,7 +293,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { /* output decoded samples */ buf->vpts = pts; - this->audio_out->put_buffer (this->audio_out, buf, this->stream); + this->stream->audio_out->put_buffer (this->stream->audio_out, buf, this->stream); } else { @@ -308,7 +307,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { a52_syncinfo (this->frame_buffer, &flags, &sample_rate, &bit_rate); - this->output_open = this->audio_out->open (this->audio_out, + this->output_open = this->stream->audio_out->open (this->stream->audio_out, this->stream, 16, sample_rate, AO_CAP_MODE_A52) ; @@ -321,7 +320,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { */ uint32_t syncword, crc1, fscod,frmsizecod,bsid,bsmod,frame_size; uint8_t *data_out,*data_in; - audio_buffer_t *buf = this->audio_out->get_buffer (this->audio_out); + audio_buffer_t *buf = this->stream->audio_out->get_buffer (this->stream->audio_out); data_in=(uint8_t *) this->frame_buffer; data_out=(uint8_t *) buf->mem; syncword = data_in[0] | (data_in[1] << 8); @@ -343,7 +342,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) { buf->num_frames = 1536; buf->vpts = pts; - this->audio_out->put_buffer (this->audio_out, buf, this->stream); + this->stream->audio_out->put_buffer (this->stream->audio_out, buf, this->stream); } } @@ -506,7 +505,7 @@ static void a52dec_dispose (audio_decoder_t *this_gen) { a52dec_decoder_t *this = (a52dec_decoder_t *) this_gen; if (this->output_open) - this->audio_out->close (this->audio_out, this->stream); + this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; @@ -551,7 +550,6 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre /* int i; */ - this->audio_out = stream->audio_out; this->audio_caps = stream->audio_out->get_capabilities(stream->audio_out); this->syncword = 0; this->sync_todo = 7; diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 838dead73..cfe387f33 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -50,8 +50,7 @@ static void process_userdata(mpeg2dec_t *mpeg2dec, uint8_t *buffer); -void mpeg2_init (mpeg2dec_t * mpeg2dec, - xine_video_port_t * output) +void mpeg2_init (mpeg2dec_t * mpeg2dec) { static int do_init = 1; uint32_t mm_accel; @@ -76,7 +75,6 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, mpeg2dec->frames_to_drop = 0; mpeg2dec->drop_frame = 0; mpeg2dec->in_slice = 0; - mpeg2dec->output = output; mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; mpeg2dec->code = 0xb4; mpeg2dec->seek_mode = 0; @@ -441,7 +439,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (picture->picture_coding_type == B_TYPE) picture->current_frame = - mpeg2dec->output->get_frame (mpeg2dec->output, + mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out, picture->coded_picture_width, picture->coded_picture_height, picture->aspect_ratio_information, @@ -449,7 +447,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->picture_structure); else { picture->current_frame = - mpeg2dec->output->get_frame (mpeg2dec->output, + mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out, picture->coded_picture_width, picture->coded_picture_height, picture->aspect_ratio_information, diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index bd966baeb..8cb0070b0 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -22,8 +22,6 @@ /* Structure for the mpeg2dec decoder */ typedef struct mpeg2dec_s { - xine_video_port_t * output; - /* this is where we keep the state of the decoder */ struct picture_s * picture, *picture_base; @@ -46,6 +44,7 @@ typedef struct mpeg2dec_s { int64_t pts; uint32_t rff_pattern; int force_aspect; + xine_stream_t *stream; /* a spu decoder for possible closed captions */ @@ -55,8 +54,7 @@ typedef struct mpeg2dec_s { /* initialize mpegdec with a opaque user pointer */ -void mpeg2_init (mpeg2dec_t * mpeg2dec, - xine_video_port_t * output); +void mpeg2_init (mpeg2dec_t * mpeg2dec); /* destroy everything which was allocated, shutdown the output */ void mpeg2_close (mpeg2dec_t * mpeg2dec); diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index f09cc45c3..7232dd66b 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.46 2002/12/22 15:03:04 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.47 2002/12/26 21:53:42 miguelfreitas Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -50,7 +50,6 @@ typedef struct mpeg2dec_decoder_s { mpeg2dec_t mpeg2; mpeg2_class_t *class; xine_stream_t *stream; - xine_video_port_t *video_out; } mpeg2dec_decoder_t; static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { @@ -116,7 +115,7 @@ static void mpeg2dec_dispose (video_decoder_t *this_gen) { mpeg2_close (&this->mpeg2); - this->video_out->close(this->video_out, this->stream); + this->stream->video_out->close(this->stream->video_out, this->stream); free (this); } @@ -136,9 +135,8 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre this->class = (mpeg2_class_t *) class_gen; this->mpeg2.stream = stream; - mpeg2_init (&this->mpeg2, stream->video_out); + mpeg2_init (&this->mpeg2); stream->video_out->open(stream->video_out, stream); - this->video_out = stream->video_out; this->mpeg2.force_aspect = 0; return &this->video_decoder; diff --git a/src/libspucc/xine_decoder.c b/src/libspucc/xine_decoder.c index c02cf9e72..845fae699 100644 --- a/src/libspucc/xine_decoder.c +++ b/src/libspucc/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.23 2002/12/21 12:56:48 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.24 2002/12/26 21:53:42 miguelfreitas Exp $ * * closed caption spu decoder. receive data by events. * @@ -106,7 +106,7 @@ static void spucc_do_close(spucc_decoder_t *this) /* CAUTION: THIS FUNCTION ASSUMES THAT THE MUTEX IS ALREADY LOCKED! */ -static void spucc_do_init (spucc_decoder_t *this, xine_video_port_t *vo_out) +static void spucc_do_init (spucc_decoder_t *this) { if (! this->cc_open) { #ifdef LOG_DEBUG @@ -306,7 +306,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { pthread_mutex_lock(&this->cc_mutex); if (this->cc_cfg.cc_enabled) { if( !this->cc_open ) - spucc_do_init (this, NULL); + spucc_do_init (this); if(this->cc_cfg.can_cc) { decode_cc(this->ccdec, buf->content, buf->size, diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index c05e949c2..b96a9ae9d 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -35,7 +35,7 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spu.c,v 1.57 2002/11/26 16:05:00 mroi Exp $ + * $Id: spu.c,v 1.58 2002/12/26 21:53:42 miguelfreitas Exp $ * */ @@ -84,7 +84,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { uint32_t header_len; pci_t pci; dsi_t dsi; - video_overlay_instance_t *ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); + video_overlay_instance_t *ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out); p = buf->content; if (p[0] || p[1] || (p[2] != 1)) { @@ -276,7 +276,7 @@ void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len) void spudec_process (spudec_decoder_t *this, uint32_t stream_id) { spudec_seq_t *cur_seq; - video_overlay_instance_t *ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); + video_overlay_instance_t *ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out); int pending = 1; cur_seq = &this->spudec_stream_state[stream_id].ra_seq; diff --git a/src/libspudec/spu.h b/src/libspudec/spu.h index 807048b2b..79bec4fe5 100644 --- a/src/libspudec/spu.h +++ b/src/libspudec/spu.h @@ -19,7 +19,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: spu.h,v 1.18 2002/11/26 16:05:00 mroi Exp $ + * $Id: spu.h,v 1.19 2002/12/26 21:53:42 miguelfreitas Exp $ * * This file was originally part of the OMS program. * @@ -111,7 +111,6 @@ typedef struct spudec_decoder_s { spudec_state_t state; - xine_video_port_t *vo_out; vo_overlay_t overlay; int ovl_caps; int output_open; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index e948a9a82..83c974964 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,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.91 2002/12/21 16:35:46 esnel Exp $ + * $Id: xine_decoder.c,v 1.92 2002/12/26 21:53:42 miguelfreitas Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -146,7 +146,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { static void spudec_reset (spu_decoder_t *this_gen) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; - video_overlay_instance_t *ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); + video_overlay_instance_t *ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out); int i; if( this->menu_handle >= 0 ) @@ -172,7 +172,7 @@ static void spudec_dispose (spu_decoder_t *this_gen) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; int i; - video_overlay_instance_t *ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); + video_overlay_instance_t *ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out); if( this->menu_handle >= 0 ) ovl_instance->free_handle(ovl_instance, @@ -266,8 +266,8 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t overlay_event->event_type = OVERLAY_EVENT_HIDE; } overlay_event->vpts = 0; - if (this->vo_out) { - ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); + if (this->stream->video_out) { + ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out); #ifdef LOG_BUTTON fprintf(stderr, "libspudec: add_event type=%d : current time=%lld, spu vpts=%lli\n", overlay_event->event_type, @@ -306,7 +306,6 @@ static spu_decoder_t *open_plugin (spu_decoder_class_t *class_gen, xine_stream_t pthread_mutex_init(&this->nav_pci_lock, NULL); - this->vo_out = stream->video_out; this->ovl_caps = stream->video_out->get_capabilities(stream->video_out); this->output_open = 0; this->last_event_vpts = 0; diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 844643b0a..b5c8bf79c 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.94 2002/12/21 16:13:43 miguelfreitas Exp $ + * $Id: audio_decoder.c,v 1.95 2002/12/26 21:53:42 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -114,21 +114,12 @@ void *audio_decoder_loop (void *stream_gen) { pthread_cond_broadcast (&stream->counter_changed); - if (stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO]) { - - while (stream->finished_count_video < stream->finished_count_audio) { - pthread_cond_wait (&stream->counter_changed, &stream->counter_lock); - } + while (stream->finished_count_video < stream->finished_count_audio) { + pthread_cond_wait (&stream->counter_changed, &stream->counter_lock); } pthread_mutex_unlock (&stream->counter_lock); - if (!stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO]) { - /* set engine status, send frontend notification event */ - xine_handle_stream_end (stream, - buf->decoder_flags & BUF_FLAG_END_STREAM); - } - stream->audio_channel_auto = -1; break; diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 42f78f335..7cb88d5e3 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.93 2002/12/24 14:00:55 miguelfreitas Exp $ + * $Id: audio_out.c,v 1.94 2002/12/26 21:53:42 miguelfreitas Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -106,6 +106,50 @@ #define SYNC_BUF_INTERVAL NUM_AUDIO_BUFFERS / 2 #define SYNC_GAP_RATE 4 + +typedef struct { + + xine_audio_port_t ao; /* public part */ + + /* private stuff */ + ao_driver_t *driver; + pthread_mutex_t driver_lock; + metronom_clock_t *clock; + xine_t *xine; + xine_list_t *streams; + pthread_mutex_t streams_lock; + + int audio_loop_running; + int audio_paused; + pthread_t audio_thread; + + int audio_step; /* pts per 32 768 samples (sample = #bytes/2) */ + int32_t frames_per_kpts; /* frames per 1024/90000 sec */ + + ao_format_t input, output; /* format conversion done at audio_out.c */ + double frame_rate_factor; + + int resample_conf; + int force_rate; /* force audio output rate to this value if non-zero */ + int do_resample; + int gap_tolerance; + audio_fifo_t *free_fifo; + audio_fifo_t *out_fifo; + int64_t last_audio_vpts; + + audio_buffer_t *frame_buf[2]; /* two buffers for "stackable" conversions */ + int16_t *zero_space; + + int64_t passthrough_offset; + int flush_audio_driver; + int discard_buffers; + + int do_compress; + double compression_factor; /* current compression */ + double compression_factor_max; /* user limit on compression */ + +} aos_t; + struct audio_fifo_s { audio_buffer_t *first; audio_buffer_t *last; @@ -206,8 +250,8 @@ static audio_buffer_t *fifo_remove (audio_fifo_t *fifo) { } -static void write_pause_burst(xine_audio_port_t *this, uint32_t num_frames) { - +static void write_pause_burst(aos_t *this, uint32_t num_frames) { + int error = 0; unsigned char buf[8192]; unsigned short *sbuf = (unsigned short *)&buf[0]; @@ -244,7 +288,7 @@ static void write_pause_burst(xine_audio_port_t *this, uint32_t num_frames) { } -static void ao_fill_gap (xine_audio_port_t *this, int64_t pts_len) { +static void ao_fill_gap (aos_t *this, int64_t pts_len) { int num_frames ; @@ -285,7 +329,7 @@ static void ensure_buffer_size (audio_buffer_t *buf, int bytes_per_frame, buf->num_frames = frames; } -static audio_buffer_t * swap_frame_buffers ( xine_audio_port_t *this ) { +static audio_buffer_t * swap_frame_buffers ( aos_t *this ) { audio_buffer_t *tmp; tmp = this->frame_buf[1]; @@ -310,7 +354,7 @@ static int mode_channels( int mode ) { return 0; } -static void audio_filter_compress (xine_audio_port_t *this, int16_t *mem, int num_frames) { +static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { int i, maxs; double f_max; @@ -358,7 +402,7 @@ static void audio_filter_compress (xine_audio_port_t *this, int16_t *mem, int nu } } -static audio_buffer_t* prepare_samples( xine_audio_port_t *this, audio_buffer_t *buf) { +static audio_buffer_t* prepare_samples( aos_t *this, audio_buffer_t *buf) { double acc_output_frames, output_frame_excess = 0; int num_output_frames ; @@ -492,7 +536,7 @@ static audio_buffer_t* prepare_samples( xine_audio_port_t *this, audio_buffer_t */ static void *ao_loop (void *this_gen) { - xine_audio_port_t *this = (xine_audio_port_t *) this_gen; + aos_t *this = (aos_t *) this_gen; int64_t hw_vpts; audio_buffer_t *in_buf, *out_buf; int64_t gap; @@ -532,7 +576,7 @@ static void *ao_loop (void *this_gen) { } if (this->flush_audio_driver) { - this->control(this, AO_CTRL_FLUSH_BUFFERS); + this->ao.control(&this->ao, AO_CTRL_FLUSH_BUFFERS); this->flush_audio_driver = 0; continue; } @@ -701,9 +745,10 @@ static void *ao_loop (void *this_gen) { * open the audio device for writing to, start audio output thread */ -static int ao_open(xine_audio_port_t *this, xine_stream_t *stream, +static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode) { + aos_t *this = (aos_t *) this_gen; int output_sample_rate, err; pthread_attr_t pth_attrs; @@ -837,7 +882,9 @@ static int ao_open(xine_audio_port_t *this, xine_stream_t *stream, return this->output.rate; } -static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this) { +static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this_gen) { + + aos_t *this = (aos_t *) this_gen; audio_buffer_t *buf; buf = fifo_remove (this->free_fifo); @@ -846,8 +893,10 @@ static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this) { return buf; } -static void ao_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, xine_stream_t *stream) { +static void ao_put_buffer (xine_audio_port_t *this_gen, + audio_buffer_t *buf, xine_stream_t *stream) { + aos_t *this = (aos_t *) this_gen; int64_t pts; if (buf->num_frames == 0) { @@ -876,8 +925,9 @@ static void ao_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, xine_st #endif } -static void ao_close(xine_audio_port_t *this, xine_stream_t *stream) { +static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { + aos_t *this = (aos_t *) this_gen; audio_buffer_t *audio_buffer; xine_stream_t *cur; @@ -910,7 +960,8 @@ static void ao_close(xine_audio_port_t *this, xine_stream_t *stream) { pthread_mutex_unlock( &this->driver_lock ); } -static void ao_exit(xine_audio_port_t *this) { +static void ao_exit(xine_audio_port_t *this_gen) { + aos_t *this = (aos_t *) this_gen; int vol; int prop = 0; @@ -971,7 +1022,8 @@ static void ao_exit(xine_audio_port_t *this) { free (this); } -static uint32_t ao_get_capabilities (xine_audio_port_t *this) { +static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) { + aos_t *this = (aos_t *) this_gen; uint32_t result; pthread_mutex_lock( &this->driver_lock ); @@ -981,7 +1033,8 @@ static uint32_t ao_get_capabilities (xine_audio_port_t *this) { return result; } -static int ao_get_property (xine_audio_port_t *this, int property) { +static int ao_get_property (xine_audio_port_t *this_gen, int property) { + aos_t *this = (aos_t *) this_gen; int ret; switch (property) { @@ -993,6 +1046,10 @@ static int ao_get_property (xine_audio_port_t *this, int property) { ret = this->discard_buffers; break; + case AO_PROP_PAUSED: + ret = this->audio_paused; + break; + default: pthread_mutex_lock( &this->driver_lock ); ret = this->driver->get_property(this->driver, property); @@ -1001,7 +1058,8 @@ static int ao_get_property (xine_audio_port_t *this, int property) { return ret; } -static int ao_set_property (xine_audio_port_t *this, int property, int value) { +static int ao_set_property (xine_audio_port_t *this_gen, int property, int value) { + aos_t *this = (aos_t *) this_gen; int ret; switch (property) { @@ -1018,6 +1076,11 @@ static int ao_set_property (xine_audio_port_t *this, int property, int value) { ret = this->discard_buffers; break; + case AO_PROP_PAUSED: + this->audio_paused = value; + ret = this->audio_paused; + break; + default: pthread_mutex_lock( &this->driver_lock ); ret = this->driver->set_property(this->driver, property, value); @@ -1027,23 +1090,25 @@ static int ao_set_property (xine_audio_port_t *this, int property, int value) { return ret; } -static int ao_control (xine_audio_port_t *this, int cmd, ...) { +static int ao_control (xine_audio_port_t *this_gen, int cmd, ...) { + aos_t *this = (aos_t *) this_gen; va_list args; void *arg; int rval; + pthread_mutex_lock( &this->driver_lock ); va_start(args, cmd); arg = va_arg(args, void*); - pthread_mutex_lock( &this->driver_lock ); rval = this->driver->control(this->driver, cmd, arg); - pthread_mutex_unlock( &this->driver_lock ); va_end(args); + pthread_mutex_unlock( &this->driver_lock ); return rval; } -static void ao_flush (xine_audio_port_t *this) { +static void ao_flush (xine_audio_port_t *this_gen) { + aos_t *this = (aos_t *) this_gen; audio_buffer_t *buf; if( this->audio_loop_running ) { @@ -1064,11 +1129,11 @@ static void ao_flush (xine_audio_port_t *this) { xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) { config_values_t *config = xine->config; - xine_audio_port_t *this; + aos_t *this; int i; static char *resample_modes[] = {"auto", "off", "on", NULL}; - this = xine_xmalloc (sizeof (xine_audio_port_t)) ; + this = xine_xmalloc (sizeof (aos_t)) ; this->driver = driver; this->xine = xine; @@ -1078,16 +1143,17 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) { pthread_mutex_init( &this->streams_lock, NULL ); pthread_mutex_init( &this->driver_lock, NULL ); - this->open = ao_open; - this->get_buffer = ao_get_buffer; - this->put_buffer = ao_put_buffer; - this->close = ao_close; - this->exit = ao_exit; - this->get_capabilities = ao_get_capabilities; - this->get_property = ao_get_property; - this->set_property = ao_set_property; - this->control = ao_control; - this->flush = ao_flush; + this->ao.open = ao_open; + this->ao.get_buffer = ao_get_buffer; + this->ao.put_buffer = ao_put_buffer; + this->ao.close = ao_close; + this->ao.exit = ao_exit; + this->ao.get_capabilities = ao_get_capabilities; + this->ao.get_property = ao_get_property; + this->ao.set_property = ao_set_property; + this->ao.control = ao_control; + this->ao.flush = ao_flush; + this->audio_loop_running = 0; this->audio_paused = 0; this->flush_audio_driver = 0; @@ -1161,14 +1227,14 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) { 0, NULL, NULL)) { int prop = 0; - if((ao_get_capabilities(this)) & AO_CAP_MIXER_VOL) + if((ao_get_capabilities(&this->ao)) & AO_CAP_MIXER_VOL) prop = AO_PROP_MIXER_VOL; - else if((ao_get_capabilities(this)) & AO_CAP_PCM_VOL) + else if((ao_get_capabilities(&this->ao)) & AO_CAP_PCM_VOL) prop = AO_PROP_PCM_VOL; - ao_set_property(this, prop, vol); + ao_set_property(&this->ao, prop, vol); } } - return this; + return &this->ao; } diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index fd63e762f..383ee5e81 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.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: audio_out.h,v 1.45 2002/12/24 14:00:57 miguelfreitas Exp $ + * $Id: audio_out.h,v 1.46 2002/12/26 21:53:42 miguelfreitas Exp $ */ #ifndef HAVE_AUDIO_OUT_H #define HAVE_AUDIO_OUT_H @@ -220,45 +220,6 @@ struct xine_audio_port_s { */ void (*flush) (xine_audio_port_t *this); - /* the driver in use */ - ao_driver_t *driver; - - /* private stuff */ - pthread_mutex_t driver_lock; - metronom_clock_t *clock; - xine_t *xine; - xine_list_t *streams; - pthread_mutex_t streams_lock; - - int audio_loop_running; - int audio_paused; - pthread_t audio_thread; - - int audio_step; /* pts per 32 768 samples (sample = #bytes/2) */ - int32_t frames_per_kpts; /* frames per 1024/90000 sec */ - - ao_format_t input, output; /* format conversion done at audio_out.c */ - double frame_rate_factor; - - int resample_conf; - int force_rate; /* force audio output rate to this value if non-zero */ - int do_resample; - int gap_tolerance; - audio_fifo_t *free_fifo; - audio_fifo_t *out_fifo; - int64_t last_audio_vpts; - - audio_buffer_t *frame_buf[2]; /* two buffers for "stackable" conversions */ - int16_t *zero_space; - - int64_t passthrough_offset; - int flush_audio_driver; - int discard_buffers; - - int do_compress; - double compression_factor; /* current compression */ - double compression_factor_max; /* user limit on compression */ - }; typedef struct audio_driver_class_s audio_driver_class_t; @@ -322,12 +283,12 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) ; #define AO_PROP_MUTE_VOL 2 #define AO_PROP_COMPRESSOR 3 #define AO_PROP_DISCARD_BUFFERS 4 - +#define AO_PROP_PAUSED 5 /* audio device control ops */ #define AO_CTRL_PLAY_PAUSE 0 #define AO_CTRL_PLAY_RESUME 1 -#define AO_CTRL_FLUSH_BUFFERS 2 +#define AO_CTRL_FLUSH_BUFFERS 2 /* above that value audio frames are discarded */ #define AO_MAX_GAP 15000 diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index b43265a92..33a14ca6e 100644 --- a/src/xine-engine/post.c +++ b/src/xine-engine/post.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: post.c,v 1.4 2002/12/25 15:03:20 mroi Exp $ + * $Id: post.c,v 1.5 2002/12/26 21:53:42 miguelfreitas Exp $ */ /* @@ -246,8 +246,6 @@ post_audio_port_t *post_intercept_audio_port(post_plugin_t *post, xine_audio_por post_port->port.set_property = post_audio_set_property; post_port->port.control = post_audio_control; post_port->port.flush = post_audio_flush; - post_port->port.driver = original->driver; - post_port->original_port = original; post_port->post = post; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 218578734..5618c80d6 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.116 2002/12/22 15:02:06 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.117 2002/12/26 21:53:42 miguelfreitas Exp $ * */ @@ -143,8 +143,7 @@ void *video_decoder_loop (void *stream_gen) { pthread_cond_broadcast (&stream->counter_changed); - if (stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] - && stream->audio_fifo) { + if (stream->audio_fifo) { while (stream->finished_count_video > stream->finished_count_audio) { pthread_cond_wait (&stream->counter_changed, &stream->counter_lock); @@ -153,11 +152,8 @@ void *video_decoder_loop (void *stream_gen) { pthread_mutex_unlock (&stream->counter_lock); - if (stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO]) { - /* set engine status, send frontend notification event */ - xine_handle_stream_end (stream, - buf->decoder_flags & BUF_FLAG_END_STREAM); - } + /* set engine status, send frontend notification event */ + xine_handle_stream_end (stream, buf->decoder_flags & BUF_FLAG_END_STREAM); /* Wake up xine_play if it's waiting for a frame */ pthread_mutex_lock (&stream->first_frame_lock); diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 52b2bda4b..008483fde 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.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: video_out.h,v 1.74 2002/12/21 12:56:52 miguelfreitas Exp $ + * $Id: video_out.h,v 1.75 2002/12/26 21:53:42 miguelfreitas Exp $ * * * xine version of video_out.h @@ -175,8 +175,6 @@ struct xine_video_port_s { /* the driver in use */ vo_driver_t *driver; - /* private stuff can be added here */ - }; /* constants for the get/set property functions */ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 94c1e81cd..1d1816eb4 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.202 2002/12/22 23:30:29 miguelfreitas Exp $ + * $Id: xine.c,v 1.203 2002/12/26 21:53:42 miguelfreitas Exp $ * * top-level xine functions * @@ -126,8 +126,8 @@ static void xine_set_speed_internal (xine_stream_t *stream, int speed) { /* see coment on audio_out loop about audio_paused */ if( stream->audio_out ) { - stream->audio_out->audio_paused = (speed != XINE_SPEED_NORMAL) + - (speed == XINE_SPEED_PAUSE); + stream->audio_out->set_property( stream->audio_out, AO_PROP_PAUSED, + (speed != XINE_SPEED_NORMAL) + (speed == XINE_SPEED_PAUSE) ); /* * slow motion / fast forward does not play sound, drop buffered |