summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_decoder.c8
-rw-r--r--src/xine-engine/audio_out.c28
-rw-r--r--src/xine-engine/audio_out.h6
-rw-r--r--src/xine-engine/demux.c15
-rw-r--r--src/xine-engine/load_plugins.c4
-rw-r--r--src/xine-engine/video_decoder.c18
-rw-r--r--src/xine-engine/xine.c121
-rw-r--r--src/xine-engine/xine_interface.c13
-rw-r--r--src/xine-engine/xine_internal.h13
9 files changed, 152 insertions, 74 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index cabd18b03..9ad8ddfdc 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.83 2002/09/04 23:31:13 guenter Exp $
+ * $Id: audio_decoder.c,v 1.84 2002/09/18 00:51:34 guenter Exp $
*
*
* functions that implement audio decoding
@@ -247,9 +247,9 @@ void *audio_decoder_loop (void *this_gen) {
if (decoder) {
xine_event_t event;
- xine_log (this, XINE_LOG_FORMAT,
- "audio_decoder: using audio decoder plugin '%s'\n",
- decoder->get_identifier());
+
+ this->meta_info[XINE_META_INFO_AUDIOCODEC]
+ = strdup (decoder->get_identifier());
xine_report_codec( this, XINE_CODEC_AUDIO, 0, buf->type, 1);
this->cur_audio_decoder_plugin = decoder;
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 89ac7afde..a890b5e41 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.64 2002/09/04 23:31:13 guenter Exp $
+ * $Id: audio_out.c,v 1.65 2002/09/18 00:51:34 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>
@@ -531,9 +531,29 @@ static int ao_open(ao_instance_t *this,
int output_sample_rate, err;
- xine_log (this->xine, XINE_LOG_FORMAT,
- "audio_out: stream audio format is %d kHz sampling rate, %d bits. mode is %d.\n",
- rate, bits, mode);
+ /*
+ * set metainfo
+ */
+
+ switch (mode) {
+ case AO_CAP_MODE_MONO:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 1;
+ case AO_CAP_MODE_STEREO:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 2;
+ case AO_CAP_MODE_4CHANNEL:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 4;
+ case AO_CAP_MODE_5CHANNEL:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 5;
+ case AO_CAP_MODE_5_1CHANNEL:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 6;
+ case AO_CAP_MODE_A52:
+ case AO_CAP_MODE_AC5:
+ default:
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = 255; /* unknown */
+ }
+
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_BITS] = bits;
+ this->xine->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] = rate;
this->input.mode = mode;
this->input.rate = rate;
diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h
index a83e37f6b..e43d5f3a4 100644
--- a/src/xine-engine/audio_out.h
+++ b/src/xine-engine/audio_out.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: audio_out.h,v 1.33 2002/09/04 23:31:13 guenter Exp $
+ * $Id: audio_out.h,v 1.34 2002/09/18 00:51:34 guenter Exp $
*/
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index d8b4ed225..008f6ca1d 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -75,6 +75,21 @@ void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags ) {
}
}
+void xine_demux_control_headers_done (xine_t *this) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_HEADERS_DONE;
+ 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_HEADERS_DONE;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
void xine_demux_control_start( xine_t *this ) {
buf_element_t *buf;
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 639b900f9..83f96158c 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.93 2002/09/16 21:49:35 miguelfreitas Exp $
+ * $Id: load_plugins.c,v 1.94 2002/09/18 00:51:34 guenter Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -929,7 +929,7 @@ void dispose_plugins (xine_t *this) {
demux_plugin_t *dp = node->plugin;
if (dp)
- dp->close (dp);
+ dp->dispose (dp);
node = xine_list_next_content (this->plugin_catalog->demux);
}
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index af6fa4b93..0ebbe223c 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.96 2002/09/04 23:31:13 guenter Exp $
+ * $Id: video_decoder.c,v 1.97 2002/09/18 00:51:34 guenter Exp $
*
*/
@@ -97,6 +97,10 @@ void *video_decoder_loop (void *this_gen) {
#endif
switch (buf->type & 0xffff0000) {
+ case BUF_CONTROL_HEADERS_DONE:
+ this->header_sent_counter++;
+ break;
+
case BUF_CONTROL_START:
if (this->cur_video_decoder_plugin) {
@@ -279,12 +283,9 @@ void *video_decoder_loop (void *this_gen) {
this->cur_video_decoder_plugin = decoder;
this->cur_video_decoder_plugin->init (this->cur_video_decoder_plugin, this->video_out);
- printf ("video_decoder: using decoder >%s< \n",
- decoder->get_identifier());
+ this->meta_info[XINE_META_INFO_VIDEOCODEC]
+ = strdup (decoder->get_identifier());
- xine_log (this, XINE_LOG_FORMAT, "using video decoder plugin '%s'\n",
- decoder->get_identifier());
-
xine_report_codec( this, XINE_CODEC_VIDEO, 0, buf->type, 1);
ui_event.event.type = XINE_EVENT_OUTPUT_VIDEO;
@@ -355,12 +356,17 @@ void video_decoder_shutdown (xine_t *this) {
buf_element_t *buf;
void *p;
+ printf ("video_decoder: shutdown...\n");
+
/* this->video_fifo->clear(this->video_fifo); */
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ printf ("video_decoder: shutdown...2\n");
buf->type = BUF_CONTROL_QUIT;
this->video_fifo->put (this->video_fifo, buf);
+ printf ("video_decoder: shutdown...3\n");
pthread_join (this->video_thread, &p);
+ printf ("video_decoder: shutdown...4\n");
}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index f00ce7a18..246c7bccb 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.158 2002/09/15 11:35:09 jcdutton Exp $
+ * $Id: xine.c,v 1.159 2002/09/18 00:51:34 guenter Exp $
*
* top-level xine functions
*
@@ -365,11 +365,23 @@ static int find_demuxer(xine_t *this) {
int xine_open_internal (xine_t *this, const char *mrl) {
- printf ("xine_open: mrl '%s'\n", mrl);
+ printf ("xine: open mrl '%s'\n", mrl);
- if (this->speed != XINE_SPEED_NORMAL) {
- xine_set_speed_internal (this, XINE_SPEED_NORMAL);
+ /*
+ * is this an 'opt:' mrlstyle ?
+ */
+ if (xine_config_change_opt(this->config, mrl)) {
+ xine_event_t event;
+
+ this->status = XINE_STATUS_STOP;
+
+ event.type = XINE_EVENT_PLAYBACK_FINISHED;
+ pthread_mutex_unlock (&this->xine_lock);
+ xine_send_event (this, &event);
+ pthread_mutex_lock (&this->xine_lock);
+ return 1;
}
+
/*
* stop engine only for different mrl
*/
@@ -377,6 +389,11 @@ int xine_open_internal (xine_t *this, const char *mrl) {
if ((this->status == XINE_STATUS_PLAY && strcmp (mrl, this->cur_mrl))
|| (this->status == XINE_STATUS_LOGO)) {
+ printf ("xine: stopping engine\n");
+
+ if (this->speed != XINE_SPEED_NORMAL)
+ xine_set_speed_internal (this, XINE_SPEED_NORMAL);
+
if(this->cur_demuxer_plugin) {
this->playing_logo = 0;
this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin);
@@ -394,38 +411,31 @@ int xine_open_internal (xine_t *this, const char *mrl) {
this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS);
this->status = XINE_STATUS_STOP;
- } else {
}
- if (strcmp (mrl, this->cur_mrl)) {
- /* Is it an 'opt:' mrlstyle ? */
- if (xine_config_change_opt(this->config, mrl)) {
- xine_event_t event;
-
- this->status = XINE_STATUS_STOP;
-
- event.type = XINE_EVENT_PLAYBACK_FINISHED;
- pthread_mutex_unlock (&this->xine_lock);
- xine_send_event (this, &event);
- pthread_mutex_lock (&this->xine_lock);
- return 1;
- }
- }
-
- if (this->status == XINE_STATUS_STOP ) {
+ if (this->status == XINE_STATUS_STOP) {
plugin_node_t *node;
- int i;
+ int i, header_count;
/*
- * reset metainfo
+ * (1/3) reset metainfo
*/
for (i=0; i<XINE_STREAM_INFO_MAX; i++) {
this->stream_info[i] = 0;
- this->meta_info [i] = NULL;
+ if (this->meta_info[i]) {
+ free (this->meta_info[i]);
+ this->meta_info[i] = NULL;
+ }
}
+ /*
+ * (2/3) start engine for new mrl'
+ */
+
+ printf ("xine: starting engine for new mrl\n");
+
/*
* find input plugin
*/
@@ -444,7 +454,7 @@ int xine_open_internal (xine_t *this, const char *mrl) {
}
if (!this->cur_input_plugin) {
- xine_log (this, XINE_LOG_FORMAT,
+ xine_log (this, XINE_LOG_MSG,
_("xine: cannot find input plugin for this MRL\n"));
this->cur_demuxer_plugin = NULL;
this->err = XINE_ERROR_NO_INPUT_PLUGIN;
@@ -452,37 +462,46 @@ int xine_open_internal (xine_t *this, const char *mrl) {
return 0;
}
- printf ("xine: using input plugin >%s< for this MRL (%s).\n",
- this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl);
-
- xine_log (this, XINE_LOG_FORMAT,
- _("using input plugin '%s' for MRL '%s'\n"),
- this->cur_input_plugin->get_identifier(this->cur_input_plugin),
- mrl);
+ this->meta_info[XINE_META_INFO_INPUT_PLUGIN]
+ = strdup (this->cur_input_plugin->get_identifier(this->cur_input_plugin));
/*
* find demuxer plugin
*/
+ header_count = this->header_sent_counter+1;
if (!find_demuxer(this)) {
- xine_log (this, XINE_LOG_FORMAT,
+ xine_log (this, XINE_LOG_MSG,
_("xine: couldn't find demuxer for >%s<\n"), mrl);
this->cur_input_plugin->close(this->cur_input_plugin);
this->err = XINE_ERROR_NO_DEMUXER_PLUGIN;
return 0;
}
- xine_log (this, XINE_LOG_FORMAT,
- _("system layer format '%s' detected.\n"),
- this->cur_demuxer_plugin->get_identifier());
- }
+ this->meta_info[XINE_META_INFO_SYSTEMLAYER]
+ = strdup (this->cur_demuxer_plugin->get_identifier());
- /* FIXME: ?? limited length ??? */
- strncpy (this->cur_mrl, mrl, 1024);
+ /* FIXME: ?? limited length ??? */
+ strncpy (this->cur_mrl, mrl, 1024);
- printf ("xine: xine_open done.\n");
+ printf ("xine: engine start successful - waiting for headers to be sent\n");
- return 1;
+ /*
+ * (3/3) wait for headers to be sent and decoded
+ */
+
+ while (header_count>this->header_sent_counter) {
+ printf ("xine: waiting for headers.\n");
+ xine_usec_sleep (20000);
+ }
+
+ printf ("xine: xine_open done.\n");
+
+ return 1;
+ }
+
+ printf ("xine: xine_open ignored (same mrl, already playing)\n");
+ return 0;
}
int xine_play_internal (xine_t *this, int start_pos, int start_time) {
@@ -493,8 +512,11 @@ int xine_play_internal (xine_t *this, int start_pos, int start_time) {
printf ("xine: xine_play_internal\n");
+ if (this->speed != XINE_SPEED_NORMAL)
+ xine_set_speed_internal (this, XINE_SPEED_NORMAL);
+
/*
- * start demuxer
+ * start/seek demuxer
*/
if (start_pos) {
/* FIXME: do we need to protect concurrent access to input plugin here? */
@@ -507,8 +529,6 @@ int xine_play_internal (xine_t *this, int start_pos, int start_time) {
if (this->status == XINE_STATUS_STOP) {
demux_status = this->cur_demuxer_plugin->start (this->cur_demuxer_plugin,
- this->video_fifo,
- this->audio_fifo,
pos, start_time);
} else {
demux_status = this->cur_demuxer_plugin->seek (this->cur_demuxer_plugin,
@@ -535,6 +555,8 @@ int xine_play_internal (xine_t *this, int start_pos, int start_time) {
this->curtime_needed_for_osd = 5;
}
+ printf ("xine: xine_play_internal ...done\n");
+
return 1;
}
@@ -693,6 +715,16 @@ xine_p xine_new (void) {
this->cur_input_plugin = NULL;
this->cur_spu_decoder_plugin = NULL;
this->report_codec_cb = NULL;
+ this->header_sent_counter = 0;
+
+ /*
+ * meta info
+ */
+
+ for (i=0; i<XINE_STREAM_INFO_MAX; i++) {
+ this->stream_info[i] = 0;
+ this->meta_info [i] = NULL;
+ }
/*
* plugins
@@ -1052,7 +1084,6 @@ int xine_get_log_section_count (xine_p this_ro) {
const char *const *xine_get_log_names (xine_p this_ro) {
static const char *log_sections[XINE_LOG_NUM + 1];
- log_sections[XINE_LOG_FORMAT] = _("stream format");
log_sections[XINE_LOG_MSG] = _("messages");
log_sections[XINE_LOG_PLUGIN] = _("plugin");
log_sections[XINE_LOG_NUM] = NULL;
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 99c9b4dfe..9f902209c 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.13 2002/09/16 15:09:36 jcdutton Exp $
+ * $Id: xine_interface.c,v 1.14 2002/09/18 00:51:34 guenter Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -419,15 +419,18 @@ uint32_t xine_get_stream_info (xine_p this, int info) {
return this->cur_input_plugin->get_capabilities (this->cur_input_plugin) & INPUT_CAP_CHAPTERS;
return 0;
- case XINE_STREAM_INFO_WIDTH:
- case XINE_STREAM_INFO_HEIGHT:
- case XINE_STREAM_INFO_VIDEO_FOURCC:
+ case XINE_STREAM_INFO_BITRATE:
+ case XINE_STREAM_INFO_VIDEO_WIDTH:
+ case XINE_STREAM_INFO_VIDEO_HEIGHT:
+ case XINE_STREAM_INFO_VIDEO_RATIO:
case XINE_STREAM_INFO_VIDEO_CHANNELS:
case XINE_STREAM_INFO_VIDEO_STREAMS:
- case XINE_STREAM_INFO_AUDIO_FOURCC:
+ case XINE_STREAM_INFO_VIDEO_BITRATE:
+ case XINE_STREAM_INFO_FRAME_DURATION:
case XINE_STREAM_INFO_AUDIO_CHANNELS:
case XINE_STREAM_INFO_AUDIO_BITS:
case XINE_STREAM_INFO_AUDIO_SAMPLERATE:
+ case XINE_STREAM_INFO_AUDIO_BITRATE:
return this->stream_info[info];
default:
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index cfa9d684a..1e8fed0bf 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.99 2002/09/13 18:25:23 guenter Exp $
+ * $Id: xine_internal.h,v 1.100 2002/09/18 00:51:34 guenter Exp $
*
*/
@@ -131,10 +131,9 @@ struct audio_decoder_s {
* log constants
*/
-#define XINE_LOG_FORMAT 0 /* stream format, decoders, video size... */
-#define XINE_LOG_MSG 1 /* warnings, errors, ... */
-#define XINE_LOG_PLUGIN 2
-#define XINE_LOG_NUM 3 /* # of log buffers defined */
+#define XINE_LOG_MSG 0 /* warnings, errors, ... */
+#define XINE_LOG_PLUGIN 1
+#define XINE_LOG_NUM 2 /* # of log buffers defined */
#define XINE_STREAM_INFO_MAX 99
@@ -246,6 +245,8 @@ struct xine_s {
/* stream meta information */
int stream_info[XINE_STREAM_INFO_MAX];
char *meta_info [XINE_STREAM_INFO_MAX];
+
+ int header_sent_counter; /* wait for headers sent */
};
/*
@@ -275,6 +276,8 @@ void xine_demux_flush_engine (xine_t *this);
void xine_demux_control_newpts (xine_t *this, int64_t pts, uint32_t flags );
+void xine_demux_control_headers_done (xine_t *this );
+
void xine_demux_control_start (xine_t *this );
void xine_demux_control_end (xine_t *this, uint32_t flags );