diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-engine/audio_out.c | 26 | ||||
-rw-r--r-- | src/xine-engine/audio_out.h | 8 | ||||
-rw-r--r-- | src/xine-engine/post.c | 14 | ||||
-rw-r--r-- | src/xine-engine/video_out.c | 22 | ||||
-rw-r--r-- | src/xine-engine/video_out.h | 5 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 52 | ||||
-rw-r--r-- | src/xine-engine/xine_interface.c | 37 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 5 |
8 files changed, 160 insertions, 9 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 7cb88d5e3..5897963ab 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.94 2002/12/26 21:53:42 miguelfreitas Exp $ + * $Id: audio_out.c,v 1.95 2002/12/27 03:40:07 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> @@ -1126,6 +1126,27 @@ static void ao_flush (xine_audio_port_t *this_gen) { } } +static int ao_status (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; + xine_stream_t *cur; + int ret = 0; + + pthread_mutex_lock(&this->streams_lock); + for (cur = xine_list_first_content(this->streams); cur; + cur = xine_list_next_content(this->streams)) + if (cur == stream) { + *bits = this->input.bits; + *rate = this->input.rate; + *mode = this->input.mode; + ret = 1; + break; + } + pthread_mutex_unlock(&this->streams_lock); + + return ret; +} + xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) { config_values_t *config = xine->config; @@ -1153,7 +1174,8 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) { this->ao.set_property = ao_set_property; this->ao.control = ao_control; this->ao.flush = ao_flush; - + this->ao.status = ao_status; + this->audio_loop_running = 0; this->audio_paused = 0; this->flush_audio_driver = 0; diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 1367c6c3d..82d1577f3 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.47 2002/12/27 02:03:06 miguelfreitas Exp $ + * $Id: audio_out.h,v 1.48 2002/12/27 03:40:07 miguelfreitas Exp $ */ #ifndef HAVE_AUDIO_OUT_H #define HAVE_AUDIO_OUT_H @@ -220,6 +220,12 @@ struct xine_audio_port_s { * Flush audio_out fifo. */ void (*flush) (xine_audio_port_t *this); + + /* + * Check if port is opened for this stream and get parameters. + */ + int (*status) (xine_audio_port_t *this, xine_stream_t *stream, + uint32_t *bits, uint32_t *rate, int *mode); }; diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index 33a14ca6e..475a9b12f 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.5 2002/12/26 21:53:42 miguelfreitas Exp $ + * $Id: post.c,v 1.6 2002/12/27 03:40:07 miguelfreitas Exp $ */ /* @@ -75,6 +75,10 @@ static void post_video_flush(xine_video_port_t *port_gen) { port->original_port->flush(port->original_port); } +static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream) { + post_video_port_t *port = (post_video_port_t *)port_gen; + return port->original_port->status(port->original_port, stream); +} post_video_port_t *post_intercept_video_port(post_plugin_t *post, xine_video_port_t *original) { post_video_port_t *post_port = (post_video_port_t *)malloc(sizeof(post_video_port_t)); @@ -91,6 +95,7 @@ post_video_port_t *post_intercept_video_port(post_plugin_t *post, xine_video_por post_port->port.exit = post_video_exit; post_port->port.get_overlay_instance = post_video_get_overlay_instance; post_port->port.flush = post_video_flush; + post_port->port.status = post_video_status; post_port->port.driver = original->driver; post_port->original_port = original; @@ -230,6 +235,12 @@ static void post_audio_flush(xine_audio_port_t *port_gen) { return port->original_port->flush(port->original_port); } +static int post_audio_status(xine_audio_port_t *port_gen, xine_stream_t *stream, + uint32_t *bits, uint32_t *rate, int *mode) { + post_audio_port_t *port = (post_audio_port_t *)port_gen; + return port->original_port->status(port->original_port, stream, bits, rate, mode); +} + post_audio_port_t *post_intercept_audio_port(post_plugin_t *post, xine_audio_port_t *original) { post_audio_port_t *post_port = (post_audio_port_t *)malloc(sizeof(post_audio_port_t)); @@ -246,6 +257,7 @@ 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.status = post_audio_status; post_port->original_port = original; post_port->post = post; diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index dbe56b13c..71068a958 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.125 2002/12/23 21:04:02 miguelfreitas Exp $ + * $Id: video_out.c,v 1.126 2002/12/27 03:40:07 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -933,6 +933,25 @@ static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream) { pthread_mutex_unlock(&this->streams_lock); } +static int vo_status (xine_video_port_t *this_gen, xine_stream_t *stream) { + + vos_t *this = (vos_t *) this_gen; + xine_stream_t *cur; + int ret = 0; + + pthread_mutex_lock(&this->streams_lock); + for (cur = xine_list_first_content(this->streams); cur; + cur = xine_list_next_content(this->streams)) + if (cur == stream) { + ret = 1; + break; + } + pthread_mutex_unlock(&this->streams_lock); + + return ret; +} + + static void vo_free_img_buffers (xine_video_port_t *this_gen) { vos_t *this = (vos_t *) this_gen; vo_frame_t *img; @@ -1068,6 +1087,7 @@ xine_video_port_t *vo_new_port (xine_t *xine, vo_driver_t *driver) { this->vo.enable_ovl = vo_enable_overlay; this->vo.get_overlay_instance = vo_get_overlay_instance; this->vo.flush = vo_flush; + this->vo.status = vo_status; this->vo.driver = driver; this->num_frames_delivered = 0; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 89a5ffbb0..9c30d151a 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.76 2002/12/27 02:03:06 miguelfreitas Exp $ + * $Id: video_out.h,v 1.77 2002/12/27 03:40:07 miguelfreitas Exp $ * * * xine version of video_out.h @@ -173,6 +173,9 @@ struct xine_video_port_s { /* flush video_out fifo */ void (*flush) (xine_video_port_t *this); + /* return true if port is opened for this stream */ + int (*status) (xine_video_port_t *this, xine_stream_t *stream); + /* the driver in use */ vo_driver_t *driver; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 063333178..57b74387a 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.204 2002/12/27 00:53:50 guenter Exp $ + * $Id: xine.c,v 1.205 2002/12/27 03:40:07 miguelfreitas Exp $ * * top-level xine functions * @@ -275,6 +275,46 @@ void xine_close (xine_stream_t *stream) { pthread_mutex_unlock (&stream->frontend_lock); } +static int xine_stream_rewire_audio(xine_post_out_t *output, void *data) +{ + xine_stream_t *stream = (xine_stream_t *)output->data; + xine_audio_port_t *new_port = (xine_audio_port_t *)data; + uint32_t bits, rate; + int mode; + + if (!data) + return 0; + + if (stream->audio_out && + stream->audio_out->status(stream->audio_out, stream, &bits, &rate, &mode)) { + /* register our stream at the new output port */ + stream->audio_out->close(stream->audio_out, stream); + new_port->open(new_port, stream, bits, rate, mode); + } + /* reconnect ourselves */ + stream->audio_out = new_port; + return 1; +} + +static int xine_stream_rewire_video(xine_post_out_t *output, void *data) +{ + xine_stream_t *stream = (xine_stream_t *)output->data; + xine_video_port_t *new_port = (xine_video_port_t *)data; + + if (!data) + return 0; + + if (stream->video_out && + stream->video_out->status(stream->video_out, stream)) { + /* register our stream at the new output port */ + stream->video_out->close(stream->video_out, stream); + new_port->open(new_port, stream); + } + /* reconnect ourselves */ + stream->video_out = new_port; + return 1; +} + xine_stream_t *xine_stream_new (xine_t *this, xine_audio_port_t *ao, xine_video_port_t *vo) { @@ -375,6 +415,16 @@ xine_stream_t *xine_stream_new (xine_t *this, pthread_mutex_unlock (&this->streams_lock); + stream->video_source.name = "video source"; + stream->video_source.type = XINE_POST_DATA_VIDEO; + stream->video_source.data = stream; + stream->video_source.rewire = xine_stream_rewire_video; + + stream->audio_source.name = "audio source"; + stream->audio_source.type = XINE_POST_DATA_AUDIO; + stream->audio_source.data = stream; + stream->audio_source.rewire = xine_stream_rewire_audio; + return stream; } diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 122befb41..70ae17f8e 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.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_interface.c,v 1.35 2002/12/25 15:02:23 mroi Exp $ + * $Id: xine_interface.c,v 1.36 2002/12/27 03:40:08 miguelfreitas Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -646,3 +646,38 @@ int xine_post_wire(xine_post_out_t *source, xine_post_in_t *target) { } return 0; } + +int xine_post_wire_video_port(xine_post_out_t *source, xine_video_port_t *vo) { + if (source && source->rewire) { + if (vo) { + if (source->type == XINE_POST_DATA_VIDEO) + return source->rewire(source, vo); + else + return 0; + } else + return source->rewire(source, NULL); + } + return 0; +} + +int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *ao) { + if (source && source->rewire) { + if (ao) { + if (source->type == XINE_POST_DATA_AUDIO) + return source->rewire(source, ao); + else + return 0; + } else + return source->rewire(source, NULL); + } + return 0; +} + +xine_post_out_t * xine_get_video_source(xine_stream_t *stream) { + return &stream->video_source; +} + +xine_post_out_t * xine_get_audio_source(xine_stream_t *stream) { + return &stream->audio_source; +} + diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 3a0704da1..c022b44d8 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.117 2002/12/27 02:03:06 miguelfreitas Exp $ + * $Id: xine_internal.h,v 1.118 2002/12/27 03:40:08 miguelfreitas Exp $ * */ @@ -235,6 +235,9 @@ struct xine_stream_s { extra_info_t *current_extra_info; int video_seek_count; + xine_post_out_t video_source; + xine_post_out_t audio_source; + int err; }; |