summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-10-20 02:01:51 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-10-20 02:01:51 +0000
commit439907def64a3bdbc3fd6a73af623c6fb7a55497 (patch)
treeb1fbbec16558d5dd7b882682359d91cec19f9611 /src
parentfc4c873cd43fbac488f56041e38a5010e2656b10 (diff)
downloadxine-lib-439907def64a3bdbc3fd6a73af623c6fb7a55497.tar.gz
xine-lib-439907def64a3bdbc3fd6a73af623c6fb7a55497.tar.bz2
big event cleanup: one single mechanism is now used for all communications between gui, plugins and the xine engine; code cleanup
CVS patchset: 837 CVS date: 2001/10/20 02:01:51
Diffstat (limited to 'src')
-rw-r--r--src/audio_out/audio_alsa_out.c110
-rw-r--r--src/demuxers/demux.h13
-rw-r--r--src/demuxers/demux_asf.c8
-rw-r--r--src/demuxers/demux_avi.c9
-rw-r--r--src/demuxers/demux_elem.c8
-rw-r--r--src/demuxers/demux_mpeg.c10
-rw-r--r--src/demuxers/demux_mpeg_block.c41
-rw-r--r--src/demuxers/demux_mpgaudio.c9
-rw-r--r--src/demuxers/demux_ogg.c11
-rw-r--r--src/demuxers/demux_pes.c10
-rw-r--r--src/demuxers/demux_qt.c9
-rw-r--r--src/demuxers/demux_ts.c8
-rw-r--r--src/input/input_dvd.c5
-rw-r--r--src/input/input_file.c5
-rw-r--r--src/input/input_net.c3
-rw-r--r--src/input/input_plugin.h26
-rw-r--r--src/input/input_rtp.c3
-rw-r--r--src/input/input_stdin_fifo.c5
-rw-r--r--src/input/input_vcd.c5
-rw-r--r--src/libmpeg2/decode.c3
-rw-r--r--src/libspudec/spu_decoder_api.h6
-rw-r--r--src/libspudec/xine_decoder.c33
-rw-r--r--src/xine-engine/audio_decoder.c141
-rw-r--r--src/xine-engine/events.c17
-rw-r--r--src/xine-engine/events.h115
-rw-r--r--src/xine-engine/load_plugins.c4
-rw-r--r--src/xine-engine/video_decoder.c28
-rw-r--r--src/xine-engine/xine.c117
-rw-r--r--src/xine-engine/xine_internal.h49
29 files changed, 386 insertions, 425 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 3004222ec..22d2a946c 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.31 2001/10/14 17:47:45 guenter Exp $
+ * $Id: audio_alsa_out.c,v 1.32 2001/10/20 02:01:51 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -122,26 +122,26 @@ static snd_output_t *jcd_out;
static int ao_alsa_get_percent_from_volume(long val, long min, long max)
{
- int range = max - min;
- int tmp;
-
- if (range == 0)
- return 0;
- val -= min;
- tmp = rint((double)val / (double)range * 100);
- return tmp;
+ int range = max - min;
+ int tmp;
+
+ if (range == 0)
+ return 0;
+ val -= min;
+ tmp = rint((double)val / (double)range * 100);
+ return tmp;
}
static long ao_alsa_get_volume_from_percent(int val, long min, long max)
{
- int range = max - min;
- long tmp;
-
- if (range == 0)
- return 0;
- val -= min;
- tmp = (long) ((range * val) / 100);
- return tmp;
+ int range = max - min;
+ long tmp;
+
+ if (range == 0)
+ return 0;
+ val -= min;
+ tmp = (long) ((range * val) / 100);
+ return tmp;
}
@@ -198,7 +198,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
pcm_device = this->audio_a52_device;
break;
default:
- error ("ALSA Driver does not support the requested mode: 0x%X",mode);
+ printf ("audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode);
return 0;
}
@@ -222,8 +222,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
err=snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode);
if(err <0 ) {
- error("snd_pcm_open() failed: %s", snd_strerror(err));
- error(">>> Check if another program don't already use PCM <<<");
+ printf ("audio_alsa_out: snd_pcm_open() failed: %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: >>> check if another program don't already use PCM <<<\n");
return 0;
}
@@ -234,8 +234,9 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
fprintf(stderr, "info: %s\n", snd_strerror(err));
goto __close;
}
- printf("device: %d, subdevice: %d\n", snd_pcm_info_get_device(info),
- snd_pcm_info_get_subdevice(info));
+ printf ("audio_alsa_out: device: %d, subdevice: %d\n",
+ snd_pcm_info_get_device(info),
+ snd_pcm_info_get_subdevice(info));
spdif.status[0] = IEC958_AES0_NONAUDIO |
IEC958_AES0_CON_EMPHASIS_NONE;
@@ -252,18 +253,19 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
snd_ctl_elem_value_set_iec958(ctl, &spdif);
ctl_card = snd_pcm_info_get_card(info);
if (ctl_card < 0) {
- fprintf(stderr, "Unable to setup the IEC958 (S/PDIF) interface - PCM has no assigned card");
+ printf ("audio_alsa_out: unable to setup the IEC958 (S/PDIF) interface - PCM has no assigned card");
goto __close;
}
sprintf(ctl_name, "hw:%d", ctl_card);
printf("hw:%d\n", ctl_card);
if ((err = snd_ctl_open(&ctl_handle, ctl_name, 0)) < 0) {
- fprintf(stderr, "Unable to open the control interface '%s':
- %s", ctl_name, snd_strerror(err));
+ printf ("audio_alsa_out: unable to open the control interface '%s':%s",
+ ctl_name, snd_strerror(err));
goto __close;
}
if ((err = snd_ctl_elem_write(ctl_handle, ctl)) < 0) {
- fprintf(stderr, "Unable to update the IEC958 control: %s", snd_strerror(err));
+ printf ("audio_alsa_out: unable to update the IEC958 control: %s",
+ snd_strerror(err));
goto __close;
}
snd_ctl_close(ctl_handle);
@@ -276,35 +278,35 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
*/
err = snd_pcm_hw_params_any(this->audio_fd, params);
if (err < 0) {
- error("Broken configuration for this PCM: no configurations available");
+ printf ("audio_alsa_out: broken configuration for this PCM: no configurations available\n");
goto __close;
}
/* set interleaved access */
err = snd_pcm_hw_params_set_access(this->audio_fd, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- error("Access type not available");
+ printf ("audio_alsa_out: access type not available\n");
goto __close;
}
err = snd_pcm_hw_params_set_format(this->audio_fd, params, bits == 16 ? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_U8);
if (err < 0) {
- error("Sample format non available");
+ printf ("audio_alsa_out: sample format non available\n");
goto __close;
}
err = snd_pcm_hw_params_set_channels(this->audio_fd, params, this->num_channels);
if (err < 0) {
- error("Channels count non available");
+ printf ("audio_alsa_out: channels count non available\n");
goto __close;
}
err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, rate, 0);
if (err < 0) {
- error("Rate not available");
+ printf ("audio_alsa_out: rate not available\n");
goto __close;
}
buffer_time = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params,
500000, 0);
if (buffer_time < 0) {
- error("Buffer time not available");
+ printf ("audio_alsa_out: buffer time not available\n");
goto __close;
}
step = 2;
@@ -321,16 +323,16 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
period_time = 10000 * 2;
}
if (period_time < 0) {
- fprintf(stderr, "Period time not available");
+ printf ("audio_alsa_out: period time not available");
goto __close;
}
} while (buffer_time == period_time && period_time > 10000);
if (buffer_time == period_time) {
- error("Buffer time and period time match, could not use");
+ printf ("audio_alsa_out: buffer time and period time match, could not use\n");
goto __close;
}
if ((err = snd_pcm_hw_params(this->audio_fd, params)) < 0) {
- error("PCM hw_params failed: %s", snd_strerror(err));
+ printf ("audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err));
goto __close;
}
this->output_sample_rate = this->input_sample_rate;
@@ -393,7 +395,7 @@ void xrun(alsa_driver_t *this)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(this->audio_fd, status))<0) {
- printf("status error: %s", snd_strerror(res));
+ printf ("audio_alsa_out: status error: %s\n", snd_strerror(res));
return;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@@ -401,9 +403,9 @@ void xrun(alsa_driver_t *this)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
- fprintf(stderr, "xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
+ printf ("audio_alsa_out: xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if ((res = snd_pcm_prepare(this->audio_fd))<0) {
- printf("xrun: prepare error: %s", snd_strerror(res));
+ printf ("audio_alsa_out: xrun: prepare error: %s", snd_strerror(res));
return;
}
return; /* ok, data should be accepted again */
@@ -471,13 +473,13 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) {
if(this->mixer.elem) {
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
&this->mixer.left_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
goto __done;
}
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT,
&this->mixer.right_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
goto __done;
}
@@ -513,13 +515,13 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value)
if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
this->mixer.left_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
return ~value;
}
if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT,
this->mixer.right_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
return ~value;
}
@@ -579,12 +581,12 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
snd_ctl_card_info_alloca(&hw_info);
if ((err = snd_ctl_open (&ctl_handle, this->audio_default_device, 0)) < 0) {
- printf("snd_ctl_open(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err));
return;
}
if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0) {
- printf("snd_ctl_card_info(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err));
snd_ctl_close(ctl_handle);
return;
}
@@ -595,18 +597,18 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
* Open mixer device
*/
if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) {
- printf("snd_mixer_open(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err));
return;
}
if ((err = snd_mixer_attach (this->mixer.handle, this->audio_default_device)) < 0) {
- printf("snd_mixer_attach(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
if ((err = snd_mixer_selem_register (this->mixer.handle, NULL, NULL)) < 0) {
- printf("snd_mixer_selem_register(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
@@ -614,14 +616,14 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
// snd_mixer_set_callback (mixer_handle, mixer_event);
if ((err = snd_mixer_load (this->mixer.handle)) < 0) {
- printf("snd_mixer_load(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
mixer_sid = alloca(snd_mixer_selem_id_sizeof() * snd_mixer_get_count(this->mixer.handle));
if (mixer_sid == NULL) {
- printf("alloca() failed: %s\n", strerror(errno));
+ printf ("audio_alsa_out: alloca() failed: %s\n", strerror(errno));
snd_mixer_close(this->mixer.handle);
return;
}
@@ -649,14 +651,14 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
&this->mixer.min, &this->mixer.max);
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
&this->mixer.left_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT,
&this->mixer.right_vol)) < 0) {
- printf("snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ printf ("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
@@ -766,13 +768,13 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) {
*/
err = snd_pcm_hw_params_any(this->audio_fd, params);
if (err < 0) {
- error("Broken configuration for this PCM: no configurations available");
+ printf ("audio_alsa_out: broken configuration for this PCM: no configurations available\n");
return NULL;
}
err = snd_pcm_hw_params_set_access(this->audio_fd, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- error("Access type not available");
+ printf ("audio_alsa_out: access type not available");
return NULL;
}
this->capabilities = 0;
@@ -797,7 +799,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) {
this->capabilities |= AO_CAP_MODE_A52;
this->capabilities |= AO_CAP_MODE_AC5;
}
- printf("audio_alsa_out: Capabilities 0x%X\n",this->capabilities);
+ printf("audio_alsa_out: capabilities 0x%X\n",this->capabilities);
this->config = config;
diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h
index 7a52364d8..c020b2e79 100644
--- a/src/demuxers/demux.h
+++ b/src/demuxers/demux.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: demux.h,v 1.10 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux.h,v 1.11 2001/10/20 02:01:51 guenter Exp $
*/
#ifndef HAVE_DEMUX_H
@@ -35,7 +35,7 @@ extern "C" {
#include "input_plugin.h"
#endif
-#define DEMUXER_PLUGIN_IFACE_VERSION 4
+#define DEMUXER_PLUGIN_IFACE_VERSION 5
#define DEMUX_OK 0
#define DEMUX_FINISHED 1
@@ -51,11 +51,6 @@ extern "C" {
#define STAGE_BY_CONTENT 1
#define STAGE_BY_EXTENSION 2
-/* called when xine tries to branch seamlessly to the next mrl */
-typedef char* (*gui_get_next_mrl_cb_t) (void);
-/* called when xine branched successfully to the next mrl */
-typedef void (*gui_branched_cb_t) (void);
-
/*
* a demux plugin must implement these functions
*/
@@ -95,9 +90,7 @@ struct demux_plugin_s
void (*start) (demux_plugin_t *this, fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb) ;
+ off_t start_pos, int start_time);
/*
* stop & kill demux thread, free resources associated with current
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 1f9f53c8c..5ef3ae971 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.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_asf.c,v 1.2 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_asf.c,v 1.3 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for asf streams
*
@@ -943,9 +943,7 @@ static int demux_asf_get_status (demux_plugin_t *this_gen) {
static void demux_asf_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb) {
+ off_t start_pos, int start_time) {
demux_asf_t *this = (demux_asf_t *) this_gen;
buf_element_t *buf;
@@ -1081,7 +1079,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_asf_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_asf: plugin doesn't support plugin API version %d.\n"
"demux_asf: this means there's a version mismatch between xine and this "
"demux_asf: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 52b3f06cf..ceb544497 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.45 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_avi.c,v 1.46 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for avi streams
*
@@ -865,10 +865,7 @@ static int demux_avi_get_status (demux_plugin_t *this_gen) {
static void demux_avi_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
buf_element_t *buf;
demux_avi_t *this = (demux_avi_t *) this_gen;
uint32_t video_pts = 0;
@@ -1200,7 +1197,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_avi_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_avi: this plugin doesn't support plugin API version %d.\n"
"demux_avi: this means there's a version mismatch between xine and this "
"demux_avi: demuxer plugin.\nInstalling current demuxer plugins should help.\n",
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index d316639a9..4416c072f 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.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_elem.c,v 1.23 2001/10/19 14:35:52 guenter Exp $
+ * $Id: demux_elem.c,v 1.24 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -180,9 +180,7 @@ static int demux_mpeg_elem_get_status (demux_plugin_t *this_gen) {
static void demux_mpeg_elem_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb) {
+ off_t start_pos, int start_time) {
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
buf_element_t *buf;
@@ -329,7 +327,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_elem_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_elem: plugin doesn't support plugin API version %d.\n"
"demux_elem: this means there's a version mismatch between xine and this "
"demux_elem: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index a3d0f5939..832340f52 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.37 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.38 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -660,10 +660,8 @@ static int demux_mpeg_get_status (demux_plugin_t *this_gen) {
static void demux_mpeg_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
+
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
buf_element_t *buf;
int err;
@@ -852,7 +850,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
"demux_mpeg: this means there's a version mismatch between xine and this "
"demux_mpeg: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 38c051dfb..b49d5cec1 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.55 2001/10/18 14:29:44 jkeil Exp $
+ * $Id: demux_mpeg_block.c,v 1.56 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -46,6 +46,8 @@ static uint32_t xine_debug;
typedef struct demux_mpeg_block_s {
demux_plugin_t demux_plugin;
+ xine_t *xine;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -61,9 +63,6 @@ typedef struct demux_mpeg_block_s {
int send_end_buffers;
int warned; /* encryption warning */
- gui_get_next_mrl_cb_t next_mrl_cb;
- gui_branched_cb_t branched_cb;
-
char cur_mrl[256];
uint8_t *scratch;
@@ -84,7 +83,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
buf = this->input->read_block (this->input, this->video_fifo, this->blocksize);
if (buf==NULL) {
- char *next_mrl;
+ xine_next_mrl_event_t event;
printf ("demux_mpeg_block: read_block failed\n");
@@ -92,8 +91,14 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
* check if seamless branching is possible
*/
- if (this->next_mrl_cb
- && (next_mrl = this->next_mrl_cb () )) {
+ event.event.type = XINE_EVENT_NEED_NEXT_MRL;
+ event.handled = 0;
+ xine_send_event (this->xine, &event.event);
+
+ if (event.handled) {
+
+ char *next_mrl = event.mrl;
+
printf ("demux_mpeg_block: checking if we can branch to %s\n", next_mrl);
if (this->input->is_branch_possible
@@ -103,10 +108,10 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
this->input->close (this->input);
this->input->open (this->input, next_mrl);
-
- if (this->branched_cb)
- this->branched_cb ();
+ event.event.type = XINE_EVENT_BRANCHED;
+ xine_send_event (this->xine, &event.event);
+
buf = this->input->read_block (this->input, this->video_fifo, this->blocksize);
if (!buf) {
this->status = DEMUX_FINISHED;
@@ -711,10 +716,7 @@ static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) {
static void demux_mpeg_block_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
buf_element_t *buf;
@@ -722,8 +724,6 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen,
this->video_fifo = video_fifo;
this->audio_fifo = audio_fifo;
- this->next_mrl_cb = next_mrl_cb;
- this->branched_cb = branched_cb;
/*
* send start buffer
@@ -947,15 +947,16 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_block_t *this;
config_values_t *config;
- if (iface != 4) {
- printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
- "demux_mpeg: this means there's a version mismatch between xine and this "
- "demux_mpeg: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ if (iface != 5) {
+ printf( "demux_mpeg_block: plugin doesn't support plugin API version %d.\n"
+ "demux_mpeg_block: this means there's a version mismatch between xine and this "
+ "demux_mpeg_block: demuxer plugin.\nInstalling current demux plugins should help.\n",
iface);
return NULL;
}
this = xmalloc (sizeof (demux_mpeg_block_t));
+ this->xine = xine;
config = xine->config;
xine_debug = config->lookup_int (config, "xine_debug", 0);
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 94c0cb30e..da4421b99 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.23 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_mpgaudio.c,v 1.24 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -299,9 +299,8 @@ static uint32_t demux_mpgaudio_read_head(input_plugin_t *input)
static void demux_mpgaudio_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb) {
+ off_t start_pos, int start_time) {
+
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
buf_element_t *buf;
int err;
@@ -425,7 +424,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpgaudio_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
"demux_mpeg: this means there's a version mismatch between xine and this "
"demux_mpeg: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index ea9a73578..0a56e4555 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.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_ogg.c,v 1.4 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_ogg.c,v 1.5 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for ogg streams
*
@@ -269,10 +269,7 @@ static int demux_ogg_get_status (demux_plugin_t *this_gen) {
static void demux_ogg_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
demux_ogg_t *this = (demux_ogg_t *) this_gen;
buf_element_t *buf;
@@ -386,7 +383,7 @@ static char *demux_ogg_get_id(void) {
static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
+ /* demux_ogg_t *this = (demux_ogg_t *) this_gen; */
return 0;
}
@@ -396,7 +393,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ogg_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_ogg: plugin doesn't support plugin API version %d.\n"
"demux_ogg: this means there's a version mismatch between xine and this "
"demux_ogg: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c
index 25075b389..0a9e9abee 100644
--- a/src/demuxers/demux_pes.c
+++ b/src/demuxers/demux_pes.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_pes.c,v 1.9 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_pes.c,v 1.10 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for mpeg 2 PES (Packetized Elementary Streams)
* reads streams of variable blocksizes
@@ -400,10 +400,8 @@ static int demux_pes_get_status (demux_plugin_t *this_gen) {
static void demux_pes_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
+
demux_pes_t *this = (demux_pes_t *) this_gen;
buf_element_t *buf;
int err;
@@ -564,7 +562,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_pes_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_pes: plugin doesn't support plugin API version %d.\n"
"demux_pes: this means there's a version mismatch between xine and this "
"demux_pes: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 1c4cd67d1..0380d142b 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.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_qt.c,v 1.7 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_qt.c,v 1.8 2001/10/20 02:01:51 guenter Exp $
*
* demultiplexer for quicktime streams, based on:
*
@@ -4206,10 +4206,7 @@ static int demux_qt_detect_compressors (demux_qt_t *this) {
static void demux_qt_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb)
-{
+ off_t start_pos, int start_time) {
demux_qt_t *this = (demux_qt_t *) this_gen;
buf_element_t *buf;
@@ -4382,7 +4379,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_qt_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf( "demux_qt: plugin doesn't support plugin API version %d.\n"
"demux_qt: this means there's a version mismatch between xine and this "
"demux_qt: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 982e466a4..65d9e7a9a 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.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_ts.c,v 1.18 2001/10/17 20:33:09 guenter Exp $
+ * $Id: demux_ts.c,v 1.19 2001/10/20 02:01:51 guenter Exp $
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -877,9 +877,7 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input,
static void demux_ts_start(demux_plugin_t *this_gen,
fifo_buffer_t *fifoVideo,
fifo_buffer_t *fifoAudio,
- off_t start_pos, int start_time,
- gui_get_next_mrl_cb_t next_mrl_cb,
- gui_branched_cb_t branched_cb) {
+ off_t start_pos, int start_time) {
demux_ts *this = (demux_ts *)this_gen;
buf_element_t *buf;
@@ -973,7 +971,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
config_values_t *config;
int i;
- if (iface != 4) {
+ if (iface != 5) {
printf("demux_ts: plugin doesn't support plugin API version %d.\n"
"demux_ts: this means there's a version mismatch between xine and this "
"demux_ts: demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index 918c9aa1a..a494f4a41 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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: input_dvd.c,v 1.33 2001/10/17 20:33:09 guenter Exp $
+ * $Id: input_dvd.c,v 1.34 2001/10/20 02:01:51 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -738,7 +738,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
int i;
- if (iface != 4) {
+ if (iface != 5) {
printf("dvd input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -774,7 +774,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = dvd_plugin_get_mrl;
this->input_plugin.get_autoplay_list = dvd_plugin_get_autoplay_list;
this->input_plugin.get_optional_data = dvd_plugin_get_optional_data;
- this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
this->device = config->lookup_str(config, "dvd_device", DVD);
diff --git a/src/input/input_file.c b/src/input/input_file.c
index bf104087e..ab7b70356 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.26 2001/10/17 20:33:09 guenter Exp $
+ * $Id: input_file.c,v 1.27 2001/10/20 02:01:51 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -740,7 +740,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
file_input_plugin_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf("file input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -771,7 +771,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = file_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = file_plugin_get_optional_data;
- this->input_plugin.handle_input_event = NULL;
this->input_plugin.is_branch_possible = NULL;
this->fh = -1;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index af74335cd..d7a576030 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -301,7 +301,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
net_input_plugin_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf("net input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -332,7 +332,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = net_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = net_plugin_get_optional_data;
- this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h
index 890787e87..b00b501d4 100644
--- a/src/input/input_plugin.h
+++ b/src/input/input_plugin.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: input_plugin.h,v 1.14 2001/10/18 23:46:40 guenter Exp $
+ * $Id: input_plugin.h,v 1.15 2001/10/20 02:01:51 guenter Exp $
*/
#ifndef HAVE_INPUT_PLUGIN_H
@@ -33,7 +33,7 @@ extern "C" {
#include "buffer.h"
#include "configfile.h"
-#define INPUT_PLUGIN_IFACE_VERSION 4
+#define INPUT_PLUGIN_IFACE_VERSION 5
/*
* Return pointer of allocate/cleaned memory size *size*.
@@ -267,18 +267,11 @@ struct input_plugin_s
/*
- * Request optional datas from input plugin.
+ * request optional data from input plugin.
*/
int (*get_optional_data) (input_plugin_t *this, void *data, int data_type);
/*
- * deliver an input event (mouse press/move, keypress)
- * optional: may be NULL
- */
- void (*handle_input_event) (input_plugin_t *this, int event_type, int key,
- int x, int y);
-
- /*
* check if it is possible/valid to directly branch to this MRL
* optional: may be NULL
*/
@@ -297,6 +290,7 @@ struct input_plugin_s
#define INPUT_CAP_BROWSABLE 0x00000010
#define INPUT_CAP_CLUT 0x00000020
#define INPUT_CAP_AUDIOLANG 0x00000040
+#define INPUT_CAP_SPULANG 0x00000080
#define INPUT_OPTIONAL_UNSUPPORTED 0
@@ -304,17 +298,7 @@ struct input_plugin_s
#define INPUT_OPTIONAL_DATA_CLUT 1
#define INPUT_OPTIONAL_DATA_AUDIOLANG 2
-
-#define INPUT_EVENT_MOUSEBUTTON 1
-#define INPUT_EVENT_KEYPRESS 2
-#define INPUT_EVENT_MOUSEMOVE 3
-#define INPUT_EVENT_UP 4
-#define INPUT_EVENT_DOWN 5
-#define INPUT_EVENT_LEFT 6
-#define INPUT_EVENT_RIGHT 7
-#define INPUT_EVENT_MENU1 8
-#define INPUT_EVENT_MENU2 9
-#define INPUT_EVENT_MENU3 10
+#define INPUT_OPTIONAL_DATA_SPULANG 3
/*
* each input plugin _must_ implement this function:
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index b83d7ebf2..488980be7 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -461,7 +461,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
int bufn;
- if (iface != 4) {
+ if (iface != 5) {
printf("rtp input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -508,7 +508,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = rtp_plugin_get_mrl;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = rtp_plugin_get_optional_data;
- this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index b13271833..f0b2ccd54 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.14 2001/10/17 20:33:09 guenter Exp $
+ * $Id: input_stdin_fifo.c,v 1.15 2001/10/20 02:01:51 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -256,7 +256,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
stdin_input_plugin_t *this;
config_values_t *config;
- if (iface != 4) {
+ if (iface != 5) {
printf("rtp input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -287,7 +287,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = stdin_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = stdin_plugin_get_optional_data;
- this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 74b83073e..9c6581dd5 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.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: input_vcd.c,v 1.28 2001/10/17 20:33:09 guenter Exp $
+ * $Id: input_vcd.c,v 1.29 2001/10/20 02:01:51 guenter Exp $
*
*/
@@ -1099,7 +1099,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
int i;
- if (iface != 4) {
+ if (iface != 5) {
printf("vcd input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -1134,7 +1134,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = vcd_plugin_get_mrl;
this->input_plugin.get_autoplay_list = vcd_plugin_get_autoplay_list;
this->input_plugin.get_optional_data = vcd_plugin_get_optional_data;
- this->input_plugin.handle_input_event= NULL;
this->input_plugin.is_branch_possible= NULL;
this->device = config->lookup_str(config, "vcd_device", CDROM);
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 96e7a86e2..355f07fbf 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -362,6 +362,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec)
}
*/
+ /*
if (picture->forward_reference_frame) {
printf ("libmpeg2: blasting out forward reference frame on close\n");
picture->forward_reference_frame->PTS = 0;
@@ -369,7 +370,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec)
picture->forward_reference_frame->draw (picture->forward_reference_frame);
picture->forward_reference_frame->free (picture->forward_reference_frame);
}
-
+ */
if (picture->throwaway_frame) {
printf ("libmpeg2: blasting out throwaway frame on close\n");
picture->throwaway_frame->PTS = 0;
diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h
index 6a02cef3f..c0c44834b 100644
--- a/src/libspudec/spu_decoder_api.h
+++ b/src/libspudec/spu_decoder_api.h
@@ -29,7 +29,7 @@
*
* for a dynamic plugin make sure you provide this function call:
* spu_decoder_t *init_spu_decoder_plugin (int iface_version,
- * config_values_t *cfg);
+ * xine_t *xine);
*/
typedef struct spu_decoder_s spu_decoder_t;
@@ -44,8 +44,6 @@ struct spu_decoder_s {
void (*decode_data) (spu_decoder_t *this, buf_element_t *buf);
- void (*event) (spu_decoder_t *this, spu_event_t *event);
-
void (*close) (spu_decoder_t *this);
char* (*get_identifier) (void);
@@ -56,7 +54,6 @@ struct spu_decoder_s {
};
-#define SPU_EVENT_BUTTON 0x100
typedef struct spu_button_s spu_button_t;
struct spu_button_s {
int show;
@@ -66,7 +63,6 @@ struct spu_button_s {
int top, bottom;
};
-#define SPU_EVENT_CLUT 0x101
typedef struct spu_cltbl_s spu_cltbl_t;
struct spu_cltbl_s {
uint32_t clut[16];
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index 5f6109868..6fba7372e 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.15 2001/10/18 14:42:59 richwareham Exp $
+ * $Id: xine_decoder.c,v 1.16 2001/10/20 02:01:51 guenter Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -69,6 +69,8 @@ typedef struct spudec_decoder_s {
spu_decoder_t spu_decoder;
ovl_src_t ovl_src;
+ xine_t *xine;
+
spu_seq_t seq_list[NUM_SEQ_BUFFERS];
spu_seq_t *cur_seq;
spu_seq_t *ra_seq;
@@ -223,15 +225,16 @@ static vo_overlay_t* spudec_get_overlay(ovl_src_t *ovl_src, int pts) {
return NULL;
}
-static void spudec_event(spu_decoder_t *this_gen, spu_event_t *event) {
- spudec_decoder_t *this = (spudec_decoder_t*) this_gen;
+static void spudec_event_listener (void *this_gen, xine_event_t *event_gen) {
+ spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
+ xine_spu_event_t *event = (xine_spu_event_t *) event_gen;
if((!this) || (!event)) {
return;
}
- switch (event->sub_type) {
- case SPU_EVENT_BUTTON:
+ switch (event->event.type) {
+ case XINE_EVENT_SPU_BUTTON:
{
spu_button_t *but = event->data;
if (!this->state.menu) return;
@@ -253,18 +256,22 @@ static void spudec_event(spu_decoder_t *this_gen, spu_event_t *event) {
spuUpdateMenu(&this->state, &this->ovl);
}
break;
- case SPU_EVENT_CLUT:
+ case XINE_EVENT_SPU_CLUT:
{
spu_cltbl_t *clut = event->data;
- memcpy(this->state.clut, clut->clut, sizeof(int32_t)*16);
- this->state.need_clut = 0;
+ if (clut){
+ memcpy(this->state.clut, clut->clut, sizeof(int32_t)*16);
+ this->state.need_clut = 0;
+ }
}
break;
+ /* FIXME
case XINE_UI_GET_SPU_LANG:
{
this->state.need_clut = 1;
}
break;
+ */
}
}
@@ -272,11 +279,11 @@ static char *spudec_get_id(void) {
return "spudec";
}
-spu_decoder_t *init_spu_decoder_plugin (int iface_version, config_values_t *cfg) {
+spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) {
spudec_decoder_t *this ;
- if (iface_version != 3) {
+ if (iface_version != 4) {
fprintf(stderr,
"libspudec: Doesn't support plugin API version %d.\n"
"libspudec: This means there is a version mismatch between XINE and\n"
@@ -287,17 +294,19 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, config_values_t *cfg)
this = (spudec_decoder_t *) malloc (sizeof (spudec_decoder_t));
memset (this, 0, sizeof(*this));
- this->spu_decoder.interface_version = 3;
+ this->spu_decoder.interface_version = 4;
this->spu_decoder.can_handle = spudec_can_handle;
this->spu_decoder.init = spudec_init;
this->spu_decoder.decode_data = spudec_decode_data;
- this->spu_decoder.event = spudec_event;
this->spu_decoder.close = spudec_close;
this->spu_decoder.get_identifier = spudec_get_id;
this->spu_decoder.priority = 1;
this->ovl_src.src_gen = this;
this->ovl_src.get_overlay = spudec_get_overlay;
+ this->xine = xine;
+
+ xine_register_event_listener(xine, spudec_event_listener, this);
return (spu_decoder_t *) this;
}
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index e829ec463..5862ce597 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.47 2001/10/18 18:50:53 guenter Exp $
+ * $Id: audio_decoder.c,v 1.48 2001/10/20 02:01:51 guenter Exp $
*
*
* functions that implement audio decoding
@@ -73,6 +73,7 @@ void *audio_decoder_loop (void *this_gen) {
if (this->cur_audio_decoder_plugin) {
this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
this->cur_audio_decoder_plugin = NULL;
+ this->audio_type = 0;
}
pthread_mutex_lock (&this->finished_lock);
@@ -90,6 +91,7 @@ void *audio_decoder_loop (void *this_gen) {
if (this->cur_audio_decoder_plugin) {
this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
this->cur_audio_decoder_plugin = NULL;
+ this->audio_type = 0;
}
pthread_mutex_lock (&this->finished_lock);
@@ -104,6 +106,8 @@ void *audio_decoder_loop (void *this_gen) {
pthread_mutex_unlock (&this->finished_lock);
+ this->audio_channel_suggested = -1;
+
/* future magic - coming soon
lrb_flush (this->audio_temp);
*/
@@ -114,6 +118,7 @@ void *audio_decoder_loop (void *this_gen) {
if (this->cur_audio_decoder_plugin) {
this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
this->cur_audio_decoder_plugin = NULL;
+ this->audio_type = 0;
}
running = 0;
break;
@@ -130,22 +135,18 @@ void *audio_decoder_loop (void *this_gen) {
break;
case BUF_CONTROL_AUDIO_CHANNEL:
+ {
+ xine_event_t event;
- printf ("audio_decoder: switching to streamtype %08x\n",
- buf->decoder_info[0]);
- if (this->audio_channel != (buf->decoder_info[0] & 0xff) ) {
- /* close old audio decoder */
- if (this->cur_audio_decoder_plugin) {
- this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
- this->cur_audio_decoder_plugin = NULL;
- }
- }
- this->audio_channel = buf->decoder_info[0] & 0xff;
+ printf ("audio_decoder: suggested switching to streamtype %08x\n",
+ buf->decoder_info[0]);
+
+ this->audio_channel_suggested = buf->decoder_info[0] & 0xff;
- /* future magic - coming soon
- lrb_feedback (this->audio_temp, this->audio_fifo);
- */
+ event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
+ xine_send_event(this, &event);
+ }
break;
default:
@@ -154,42 +155,83 @@ void *audio_decoder_loop (void *this_gen) {
xine_usec_sleep (50000);
}
- if (this->audio_mute)
+ if (this->audio_mute) {
+ /*
+ lrb_add (this->audio_temp, buf);
+ continue;
+ */
break;
+ }
profiler_start_count (prof_audio_decode);
if ( (buf->type & 0xFF000000) == BUF_AUDIO_BASE ) {
- /* now, decode this buffer if it's the right track */
-
- if (this->audio_channel == (buf->type & 0xFF) ) {
+ uint32_t audio_type = 0;
+ int i,j;
+
+ /* update track map */
+
+ i = 0;
+ while ( (i<this->audio_track_map_entries) && (this->audio_track_map[i]<buf->type) )
+ i++;
+
+ if ( (i==this->audio_track_map_entries) || (this->audio_track_map[i] != buf->type) ) {
+
+ j = this->audio_track_map_entries;
+ while (j>i) {
+ this->audio_track_map[j] = this->audio_track_map[j-1];
+ j--;
+ }
+ this->audio_track_map[i] = buf->type;
+ this->audio_track_map_entries++;
+ }
+
+ /* find out which audio type to decode */
+
+ if (this->audio_channel == -1) {
+
+ if ((this->audio_channel_suggested>=0) &&
+ ((buf->type & 0xFF) == this->audio_channel_suggested) )
+ audio_type = buf->type;
+ else
+ audio_type = this->audio_track_map[0];
+
+ } else
+ audio_type = this->audio_track_map[this->audio_channel];
+
+ /* now, decode this buffer if it's the right audio type */
+
+ if (buf->type == audio_type) {
int streamtype = (buf->type>>16) & 0xFF;
+
decoder = this->audio_decoder_plugins [streamtype];
- if (decoder) {
- if (this->cur_audio_decoder_plugin != decoder) {
- if (this->cur_audio_decoder_plugin)
- this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
- this->cur_audio_decoder_plugin = decoder;
- this->cur_audio_decoder_plugin->init (this->cur_audio_decoder_plugin, this->audio_out);
+ /* close old decoder of audio type has changed */
+
+ if (audio_type != this->audio_type) {
+ if (this->cur_audio_decoder_plugin) {
+ this->cur_audio_decoder_plugin->close (this->cur_audio_decoder_plugin);
+ this->cur_audio_decoder_plugin = NULL;
+ }
+
+ if (decoder) {
printf ("audio_loop: using decoder >%s< \n",
decoder->get_identifier());
-
+ this->cur_audio_decoder_plugin = decoder;
+ this->cur_audio_decoder_plugin->init (this->cur_audio_decoder_plugin, this->audio_out);
+
+ this->audio_type = audio_type;
}
- /* printf ("audio_loop: sending data to decoder\n"); */
- decoder->decode_data (decoder, buf);
- /* printf ("audio_loop: decoding is done\n"); */
}
- } else {
- /*
- printf ("audio_decoder: wrong channel\n");
- lrb_add (this->audio_temp, buf);
- continue;
- */
- }
+
+ /* finally - decode data */
+
+ if (decoder)
+ decoder->decode_data (decoder, buf);
+ }
} else
printf ("audio_loop: unknown buffer type: %08x\n", buf->type);
@@ -215,6 +257,9 @@ void audio_decoder_init (xine_t *this) {
}
this->audio_fifo = fifo_buffer_new (1500, 8192);
+ this->audio_channel = -1;
+ this->audio_channel_suggested = -1;
+ this->audio_type = 0;
/* future magic - coming soon
this->audio_temp = lrb_new (100, this->audio_fifo);
@@ -254,3 +299,29 @@ void audio_decoder_shutdown (xine_t *this) {
}
+int xine_get_audio_channel (xine_t *this) {
+
+ printf ("audio type : %d\n", this->audio_type);
+
+ return 0;
+
+ /* return this->audio_type & 0xFFFF; */
+}
+
+void xine_select_audio_channel (xine_t *this, int channel) {
+
+ pthread_mutex_lock (&this->xine_lock);
+
+ if (channel < -1)
+ channel = -1;
+
+ this->audio_channel = channel;
+
+ pthread_mutex_unlock (&this->xine_lock);
+}
+
+int xine_get_audio_selection (xine_t *this) {
+
+
+ return this->audio_channel;
+}
diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c
index 43768c631..5db72b59c 100644
--- a/src/xine-engine/events.c
+++ b/src/xine-engine/events.c
@@ -29,7 +29,8 @@
#include "xine_internal.h"
-int xine_register_event_listener(xine_t *this, event_listener_t listener) {
+int xine_register_event_listener(xine_t *this, xine_event_listener_t listener,
+ void *user_data) {
/* Ensure the listener is non-NULL */
if(listener == NULL) {
return 0;
@@ -37,23 +38,28 @@ int xine_register_event_listener(xine_t *this, event_listener_t listener) {
/* Check we hava a slot free */
if(this->num_event_listeners < XINE_MAX_EVENT_LISTENERS) {
- this->event_listeners[this->num_event_listeners++] = listener;
+
+ this->event_listeners[this->num_event_listeners] = listener;
+ this->event_listener_user_data[this->num_event_listeners] = user_data;
+
+ this->num_event_listeners++;
+
return 1;
}
return 0;
}
-void xine_send_event(xine_t *this, event_t *event, void *data) {
+void xine_send_event(xine_t *this, xine_event_t *event) {
uint16_t i;
/* Itterate through all event handlers */
for(i=0; i < this->num_event_listeners; i++) {
- (this->event_listeners[i]) (this, event, data);
+ (this->event_listeners[i]) (this->event_listener_user_data[i], event);
}
}
-int xine_remove_event_listener(xine_t *this, event_listener_t listener) {
+int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener) {
uint16_t i, found;
found = 1; i = 0;
@@ -69,6 +75,7 @@ int xine_remove_event_listener(xine_t *this, event_listener_t listener) {
/* If possible, move the last listener to the hole thats left */
if(this->num_event_listeners > 1) {
this->event_listeners[i] = this->event_listeners[this->num_event_listeners - 1];
+ this->event_listener_user_data[i] = this->event_listener_user_data[this->num_event_listeners - 1];
this->event_listeners[this->num_event_listeners - 1] = NULL;
}
diff --git a/src/xine-engine/events.h b/src/xine-engine/events.h
index 305351647..57031724f 100644
--- a/src/xine-engine/events.h
+++ b/src/xine-engine/events.h
@@ -30,85 +30,76 @@ extern "C" {
#include <inttypes.h>
-/**
- * This file defines types for many events which can be sent in Xine.
+/*
+ * This file defines types for many events which can be sent in xine.
*/
-/**
- * Generic Event type.
+/* event types */
+
+#define XINE_EVENT_MOUSE_BUTTON 1
+#define XINE_EVENT_MOUSE_MOVE 2
+#define XINE_EVENT_SPU_BUTTON 3
+#define XINE_EVENT_SPU_CLUT 4
+#define XINE_EVENT_UI_CHANNELS_CHANGED 5 /* inform ui that new channel info is available */
+#define XINE_EVENT_UI_SET_TITLE 6 /* request title display change in ui */
+#define XINE_EVENT_INPUT_MENU1 7
+#define XINE_EVENT_INPUT_MENU2 8
+#define XINE_EVENT_INPUT_MENU3 9
+#define XINE_EVENT_INPUT_UP 10
+#define XINE_EVENT_INPUT_DOWN 11
+#define XINE_EVENT_INPUT_LEFT 12
+#define XINE_EVENT_INPUT_RIGHT 13
+#define XINE_EVENT_INPUT_SELECT 14
+#define XINE_EVENT_PLAYBACK_FINISHED 15
+#define XINE_EVENT_BRANCHED 16
+#define XINE_EVENT_NEED_NEXT_MRL 17
+
+/*
+ * generic event type.
*/
typedef struct {
uint32_t type; /* The event type (determines remainder of struct) */
/* Event dependent data goes after this. */
-} event_t;
+} xine_event_t;
-/**
- * Mouse event.
+/*
+ * input events
*/
-#define XINE_MOUSE_EVENT 0x0001
typedef struct {
- event_t event;
- uint8_t button; /* Generally 1 = left, 2 = mid, 3 = right */
- uint16_t x,y; /* In Image space */
-} mouse_event_t;
-
-/**
- * Overlay event - used for plugins/UIs to request that a specific overlay be
- * displayed.
- */
-#define XINE_OVERLAY_EVENT 0x0002
-typedef struct overlay_event_s {
- event_t event;
- vo_overlay_t overlay;
-} overlay_event_t;
+ xine_event_t event;
+ uint8_t button; /* Generally 1 = left, 2 = mid, 3 = right */
+ uint16_t x,y; /* In Image space */
+} xine_input_event_t;
-/**
+/*
* SPU event - send control events to the spu decoder
*/
-#define XINE_SPU_EVENT 0x0003
-typedef struct spu_event_s {
- event_t event;
- int sub_type;
- void *data;
-} spu_event_t;
-
-/**
+typedef struct {
+ xine_event_t event;
+ void *data;
+} xine_spu_event_t;
+
+/*
* UI event - send information to/from UI.
*/
-#define XINE_UI_EVENT 0x0004
-typedef struct ui_event_s {
- event_t event;
- int sub_type;
- void *data;
- uint32_t data_len;
- int handled;
-} ui_event_t;
-
-/* UI sub-types */
-
-/* Warn Xine UI that spu/audio stream has changed and to
- * update accordingly, data is unused. */
-#define XINE_UI_UPDATE_CHANNEL 0x0001
-/* UI asks for conversion of spu stream number into language.
- * if the listener can do it, it sets handled to 1 and writes
- * the string into data. data_len is how big this buffer is*/
-#define XINE_UI_GET_SPU_LANG 0x0002
-/* As above but for audio streams */
-#define XINE_UI_GET_AUDIO_LANG 0x0003
-/* Change the title label to the contents of the NULL-terminated
- * array of chars pointed to by data.
- */
-#define XINE_UI_SET_TITLE 0x0004
-/* EOF UI sub-types */
-
-/**
- * MENU events
+typedef struct {
+ xine_event_t event;
+ void *data;
+ uint32_t data_len;
+ int handled;
+} xine_ui_event_t;
+
+/*
+ * next_mrl
*/
-#define XINE_MENU1_EVENT 0x0005
-#define XINE_MENU2_EVENT 0x0006
-#define XINE_MENU3_EVENT 0x0007
+typedef struct {
+ xine_event_t event;
+ char *mrl;
+ int handled;
+} xine_next_mrl_event_t;
+
#ifdef __cplusplus
}
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index ec5908416..d533bd01d 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.44 2001/10/17 20:33:09 guenter Exp $
+ * $Id: load_plugins.c,v 1.45 2001/10/20 02:01:51 guenter Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -374,7 +374,7 @@ void load_decoder_plugins (xine_t *this,
spu_decoder_t *sdp;
int streamtype;
- sdp = (spu_decoder_t *) initplug(3, config);
+ sdp = (spu_decoder_t *) initplug(4, this);
if (sdp) {
sdp->metronom = this->metronom;
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 3e214bba1..182594930 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.56 2001/10/18 18:50:53 guenter Exp $
+ * $Id: video_decoder.c,v 1.57 2001/10/20 02:01:51 guenter Exp $
*
*/
@@ -226,26 +226,6 @@ void *video_decoder_loop (void *this_gen) {
pthread_exit(NULL);
}
-static void spu_event_handler(xine_t *this, event_t *event, void *data) {
- /* Check Xine handle is not NULL */
- if (this == NULL) {
- return;
- }
-
- switch(event->type) {
- case XINE_SPU_EVENT:
- /* -- This can cause a segfault!
- if (!this->cur_spu_decoder_plugin)
- update_spu_decoder(this, BUF_SPU_CLUT);
- */
-
- if (this->cur_spu_decoder_plugin)
- this->cur_spu_decoder_plugin->event(this->cur_spu_decoder_plugin,
- (spu_event_t*) event);
- break;
- }
-}
-
void video_decoder_init (xine_t *this) {
pthread_attr_t pth_attrs;
@@ -254,10 +234,6 @@ void video_decoder_init (xine_t *this) {
this->video_fifo = fifo_buffer_new (500, 4096);
- if((xine_register_event_listener(this, spu_event_handler)) < 1) {
- fprintf(stderr, "xine_register_event_listener() failed.\n");
- }
-
pthread_attr_init(&pth_attrs);
pthread_attr_getschedparam(&pth_attrs, &pth_params);
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
@@ -277,8 +253,6 @@ void video_decoder_shutdown (xine_t *this) {
buf_element_t *buf;
void *p;
- xine_remove_event_listener(this, spu_event_handler);
-
/* this->video_fifo->clear(this->video_fifo); */
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index d7fb4f34c..12452aaee 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.69 2001/10/18 23:46:40 guenter Exp $
+ * $Id: xine.c,v 1.70 2001/10/20 02:01:51 guenter Exp $
*
* top-level xine functions
*
@@ -62,11 +62,13 @@ uint32_t xine_debug;
void * xine_notify_stream_finished_thread (void * this_gen) {
xine_t *this = this_gen;
+ xine_event_t event;
xine_stop (this);
- if (this->stream_end_cb)
- this->stream_end_cb (this->status);
+ event.type = XINE_EVENT_PLAYBACK_FINISHED;
+
+ xine_send_event (this, &event);
return NULL;
}
@@ -291,9 +293,7 @@ void xine_play (xine_t *this, char *mrl,
this->cur_demuxer_plugin->start (this->cur_demuxer_plugin,
this->video_fifo,
this->audio_fifo,
- pos, start_time,
- this->get_next_mrl_cb,
- this->branched_cb);
+ pos, start_time);
if (this->cur_demuxer_plugin->get_status(this->cur_demuxer_plugin) != DEMUX_OK) {
printf("xine_play: demuxer failed to start\n");
@@ -381,69 +381,13 @@ void xine_exit (xine_t *this) {
}
-static void event_handler(xine_t *xine, event_t *event, void *data) {
- /* Check Xine handle/current input plugin is not NULL */
- if((xine == NULL) || (xine->cur_input_plugin == NULL)) {
- return;
- }
-
- switch(event->type) {
- case XINE_MOUSE_EVENT:
- {
- mouse_event_t *mevent = (mouse_event_t*)event;
-
- /* Send event to imput plugin if appropriate. */
- if(xine->cur_input_plugin->handle_input_event != NULL) {
- if(mevent->button != 0) {
- /* Click event. */
- xine->cur_input_plugin->handle_input_event(xine->cur_input_plugin,
- INPUT_EVENT_MOUSEBUTTON,
- 0, mevent->x, mevent->y);
- } else {
- /* Motion event */
- xine->cur_input_plugin->handle_input_event(xine->cur_input_plugin,
- INPUT_EVENT_MOUSEMOVE,
- 0, mevent->x, mevent->y);
- }
- }
- }
- break;
- case XINE_MENU1_EVENT:
- xine->cur_input_plugin->handle_input_event(xine->cur_input_plugin,
- INPUT_EVENT_MENU1,
- 0, 0, 0);
- break;
- case XINE_MENU2_EVENT:
- xine->cur_input_plugin->handle_input_event(xine->cur_input_plugin,
- INPUT_EVENT_MENU2,
- 0, 0, 0);
- break;
- case XINE_MENU3_EVENT:
- xine->cur_input_plugin->handle_input_event(xine->cur_input_plugin,
- INPUT_EVENT_MENU3,
- 0, 0, 0);
- break;
- case XINE_SPU_EVENT:
- if (xine->cur_spu_decoder_plugin)
- xine->cur_spu_decoder_plugin->event(xine->cur_spu_decoder_plugin,
- (spu_event_t*) event);
- break;
- }
-}
-
xine_t *xine_init (vo_driver_t *vo,
ao_driver_t *ao,
- config_values_t *config,
- gui_stream_end_cb_t stream_end_cb,
- gui_get_next_mrl_cb_t get_next_mrl_cb,
- gui_branched_cb_t branched_cb) {
+ config_values_t *config) {
xine_t *this = xmalloc (sizeof (xine_t));
printf("xine_init entered\n");
- this->stream_end_cb = stream_end_cb;
- this->get_next_mrl_cb = get_next_mrl_cb;
- this->branched_cb = branched_cb;
this->config = config;
xine_debug = config->lookup_int (config, "xine_debug", 0);
@@ -498,29 +442,9 @@ xine_t *xine_init (vo_driver_t *vo,
audio_decoder_init (this);
printf("xine_init returning\n");
- /* Add an event listener */
-
- if((xine_register_event_listener(this, event_handler)) < 1) {
- fprintf(stderr, "xine_register_event_listener() failed.\n");
- }
-
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);
-
- this->audio_channel = channel;
-
- pthread_mutex_unlock (&this->xine_lock);
-}
-
int xine_get_spu_channel (xine_t *this) {
return this->spu_channel;
@@ -716,3 +640,30 @@ int xine_get_current_frame (xine_t *this, int *width, int *height,
return 1;
}
+void xine_get_spu_lang (xine_t *this, char *str) {
+
+ if (this->cur_input_plugin) {
+ if (this->cur_input_plugin->get_capabilities (this->cur_input_plugin) & INPUT_CAP_SPULANG) {
+ this->cur_input_plugin->get_optional_data (this->cur_input_plugin, str,
+ INPUT_OPTIONAL_DATA_SPULANG);
+ return;
+ }
+ }
+
+ sprintf (str, "%3d", this->spu_channel);
+}
+
+void xine_get_audio_lang (xine_t *this, char *str) {
+
+ if (this->cur_input_plugin) {
+ if (this->cur_input_plugin->get_capabilities (this->cur_input_plugin) & INPUT_CAP_AUDIOLANG) {
+ this->cur_input_plugin->get_optional_data (this->cur_input_plugin, str,
+ INPUT_OPTIONAL_DATA_AUDIOLANG);
+ return;
+ }
+ }
+
+ sprintf (str, "%3d", this->audio_channel);
+}
+
+
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 70e7e5d2e..8582793b1 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.50 2001/10/18 18:50:53 guenter Exp $
+ * $Id: xine_internal.h,v 1.51 2001/10/20 02:01:51 guenter Exp $
*
*/
@@ -120,9 +120,6 @@ struct audio_decoder_s {
*
*/
-/* called when xine has finished a stream (_not_ if xine was stopped/paused) */
-typedef void (*gui_stream_end_cb_t)(int nStatus);
-
/*
* player status constants:
*/
@@ -133,7 +130,7 @@ typedef void (*gui_stream_end_cb_t)(int nStatus);
typedef struct xine_s xine_t;
-typedef void (*event_listener_t) (xine_t *, event_t *, void *);
+typedef void (*xine_event_listener_t) (void *user_data, xine_event_t *);
struct xine_s {
@@ -166,6 +163,7 @@ struct xine_s {
int spu_finished;
int audio_channel;
+ int audio_channel_suggested;
int spu_channel;
vo_instance_t *video_out;
@@ -186,10 +184,7 @@ struct xine_s {
int audio_track_map_entries;
int audio_finished;
int audio_mute;
-
- gui_stream_end_cb_t stream_end_cb;
- gui_get_next_mrl_cb_t get_next_mrl_cb;
- gui_branched_cb_t branched_cb;
+ uint32_t audio_type;
/* Lock for xine player functions */
pthread_mutex_t xine_lock;
@@ -198,9 +193,9 @@ struct xine_s {
pthread_mutex_t finished_lock;
/* Array of event handlers. */
- event_listener_t event_listeners[XINE_MAX_EVENT_LISTENERS];
+ xine_event_listener_t event_listeners[XINE_MAX_EVENT_LISTENERS];
+ void *event_listener_user_data[XINE_MAX_EVENT_LISTENERS];
uint16_t num_event_listeners;
-
};
/*
@@ -211,15 +206,11 @@ config_values_t *config_file_init (char *filename);
/*
* init xine - call once at startup
- *
*/
xine_t *xine_init (vo_driver_t *vo,
ao_driver_t *ao,
- config_values_t *config,
- gui_stream_end_cb_t stream_end_cb,
- gui_get_next_mrl_cb_t get_next_mrl_cb,
- gui_branched_cb_t branched_cb);
+ config_values_t *config);
/*
* open a stream sekk to a given position and play it
@@ -292,12 +283,22 @@ int xine_get_current_time (xine_t *this);
int xine_get_stream_length (xine_t *this);
/*
- * return the current audio channel
+ * return the current physical audio channel
*/
int xine_get_audio_channel (xine_t *this);
/*
- * set desired audio channel
+ * return the current logical audio channel
+ */
+int xine_get_audio_selection (xine_t *this);
+
+/*
+ * try to find out current audio language
+ */
+void xine_get_audio_lang (xine_t *this, char *str);
+
+/*
+ * set desired logical audio channel (-1 => auto)
*/
void xine_select_audio_channel (xine_t *this, int channel);
@@ -312,6 +313,11 @@ int xine_get_spu_channel (xine_t *this);
void xine_select_spu_channel (xine_t *this, int channel);
/*
+ * try to find out current spu language
+ */
+void xine_get_spu_lang (xine_t *this, char *str);
+
+/*
* exit xine
*/
void xine_exit (xine_t *this);
@@ -495,20 +501,21 @@ ao_driver_t *xine_load_audio_output_plugin(config_values_t *config, char *id);
* returns 0 if the listener was registerd, non-zero if it could not.
*/
-int xine_register_event_listener(xine_t *this, event_listener_t listener);
+int xine_register_event_listener(xine_t *this, xine_event_listener_t listener,
+ void *user_data);
/*
* attempt to remove a registered event listener.
* returns 0 if the listener was removed, non-zero if not (e.g. not found).
*/
-int xine_remove_event_listener(xine_t *this, event_listener_t listener);
+int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener);
/*
* send an event to all listeners.
*/
-void xine_send_event(xine_t *this, event_t *event, void *data);
+void xine_send_event(xine_t *this, xine_event_t *event);
/*
* snapshot function