diff options
Diffstat (limited to 'src/xine-engine/xine.c')
-rw-r--r-- | src/xine-engine/xine.c | 536 |
1 files changed, 286 insertions, 250 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 3fb22f370..866775863 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.148 2002/08/29 22:48:00 f1rmb Exp $ + * $Id: xine.c,v 1.149 2002/09/04 23:31:13 guenter Exp $ * * top-level xine functions * @@ -41,6 +41,7 @@ #endif #include "xine_internal.h" +#include "plugin_catalog.h" #include "audio_out.h" #include "video_out.h" #include "demuxers/demux.h" @@ -58,18 +59,20 @@ #define LOGO_DELAY 500000 /* usec */ -static void play_logo_internal(xine_t *this) { +static void play_logo_internal (xine_t *this) { pthread_mutex_lock (&this->logo_lock); this->playing_logo = 1; - if( !xine_play_internal(this, this->logo_mrl, 0, 0) ) + if( !xine_open_internal(this, this->logo_mrl) ) this->playing_logo = 0; - else - this->status = XINE_LOGO; + else { + xine_play_internal (this, 0, 0); + this->status = XINE_STATUS_LOGO; + } pthread_mutex_unlock (&this->logo_lock); } /* config callback for logo mrl changing */ -static void _logo_change_cb(void *data, cfg_entry_t *cfg) { +static void _logo_change_cb(void *data, xine_cfg_entry_t *cfg) { xine_t *this = (xine_t *) data; pthread_mutex_lock (&this->logo_lock); @@ -78,10 +81,10 @@ static void _logo_change_cb(void *data, cfg_entry_t *cfg) { /* * Start playback of new mrl only if - * current status is XINE_STOP or XINE_LOGO + * current status is XINE_STATUS_STOP or XINE_STATUS_LOGO */ pthread_mutex_lock (&this->xine_lock); - if((this->status == XINE_LOGO) || (this->status == XINE_STOP)) { + if((this->status == XINE_STATUS_LOGO) || (this->status == XINE_STATUS_STOP)) { xine_stop_internal(this); this->metronom->adjust_clock(this->metronom, this->metronom->get_current_time(this->metronom) + 30 * 90000 ); @@ -104,7 +107,7 @@ void * xine_notify_stream_finished_thread (void * this_gen) { xine_usec_sleep (LOGO_DELAY); pthread_mutex_lock (&this->xine_lock); - if (this->status == XINE_STOP) { + if (this->status == XINE_STATUS_STOP) { play_logo_internal(this); } pthread_mutex_unlock (&this->xine_lock); @@ -115,7 +118,7 @@ void * xine_notify_stream_finished_thread (void * this_gen) { void xine_notify_stream_finished (xine_t *this) { int err; - if (this->status == XINE_QUIT) + if (this->status == XINE_STATUS_QUIT) return; if (this->finished_thread_running) @@ -161,8 +164,9 @@ void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t } } -int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec, - void *user_data) { +int xine_register_report_codec_cb(xine_t *this, + xine_report_codec_cb_t report_codec, + void *user_data) { this->report_codec_cb = report_codec; this->report_codec_user_data = user_data; @@ -197,7 +201,7 @@ void xine_internal_osd (xine_t *this, char *str, int duration) { } } -static void update_osd_display(void *this_gen, cfg_entry_t *entry) +static void update_osd_display(void *this_gen, xine_cfg_entry_t *entry) { xine_t *this = (xine_t *) this_gen; @@ -211,14 +215,14 @@ static void xine_set_speed_internal (xine_t *this, int speed) { /* see coment on audio_out loop about audio_paused */ if( this->audio_out ) { - this->audio_out->audio_paused = (speed != SPEED_NORMAL) + - (speed == SPEED_PAUSE); + this->audio_out->audio_paused = (speed != XINE_SPEED_NORMAL) + + (speed == XINE_SPEED_PAUSE); - if (speed != SPEED_NORMAL && speed != SPEED_PAUSE) + if (speed != XINE_SPEED_NORMAL && speed != XINE_SPEED_PAUSE) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); this->audio_out->control(this->audio_out, - speed == SPEED_PAUSE ? AO_CTRL_PLAY_PAUSE : AO_CTRL_PLAY_RESUME); + speed == XINE_SPEED_PAUSE ? AO_CTRL_PLAY_PAUSE : AO_CTRL_PLAY_RESUME); } this->speed = speed; @@ -229,7 +233,7 @@ void xine_stop_internal (xine_t *this) { printf ("xine_stop\n"); - if (this->status == XINE_STOP) { + if (this->status == XINE_STATUS_STOP) { printf ("xine_stop ignored\n"); return; } @@ -237,11 +241,11 @@ void xine_stop_internal (xine_t *this) { if (this->audio_out) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); - xine_set_speed_internal(this, SPEED_NORMAL); + xine_set_speed_internal(this, XINE_SPEED_NORMAL); /* Don't change status if we're quitting */ - if(this->status != XINE_QUIT) - this->status = XINE_STOP; + if(this->status != XINE_STATUS_QUIT) + this->status = XINE_STATUS_STOP; printf ("xine_stop: stopping demuxer\n"); if(this->cur_demuxer_plugin) { @@ -271,7 +275,7 @@ void xine_stop (xine_t *this) { this->metronom->adjust_clock(this->metronom, this->metronom->get_current_time(this->metronom) + 30 * 90000 ); - if(this->status == XINE_STOP) { + if(this->status == XINE_STATUS_STOP) { play_logo_internal(this); } @@ -280,94 +284,96 @@ void xine_stop (xine_t *this) { /* - * ***** - * Demuxers probing stuff + * demuxer probing */ -static int try_demux_with_stages(xine_t *this, const char *MRL, - int stage1, int stage2) { - int s = 0, i; +static int probe_demux (xine_t *this, char *MRL, int stage1, int stage2) { + + int i; int stages[3]; stages[0] = stage1; stages[1] = stage2; stages[2] = -1; - if(stages[0] == -1) { - printf (_("%s(%d) wrong first stage = %d !!\n"), - __XINE_FUNCTION__, __LINE__, stage1); + if (stages[0] == -1) { + printf ("xine: probe_demux stage1 = %d is not allowed \n", stage1); return 0; } - while(stages[s] != -1) { - for(i = 0; i < this->num_demuxer_plugins; i++) { - /* printf ("trying demuxer %s\n", this->demuxer_plugins[i]->get_identifier()); */ - if(this->demuxer_plugins[i]->open(this->demuxer_plugins[i], - this->cur_input_plugin, - stages[s]) == DEMUX_CAN_HANDLE) { + i = 0; + while (stages[i] != -1) { + + plugin_node_t *node; + + node = xine_list_first_content (this->plugin_catalog->demux); + + while (node) { + demux_plugin_t *plugin; + + plugin = (demux_plugin_t *) node->plugin; + + if (plugin->open (plugin, + this->cur_input_plugin, + stages[i]) == DEMUX_CAN_HANDLE) { - this->cur_demuxer_plugin = this->demuxer_plugins[i]; + this->cur_demuxer_plugin = plugin; return 1; } + node = xine_list_next_content (this->plugin_catalog->demux); } - s++; + i++; } return 0; } + /* - * Try to find a demuxer which handle the MRL stream + * try to find a demuxer which handle the MRL stream */ -static int find_demuxer(xine_t *this, const char *MRL) { +static int find_demuxer(xine_t *this, char *MRL) { this->cur_demuxer_plugin = NULL; - switch(this->demux_strategy) { + switch (this->demux_strategy) { case DEMUX_DEFAULT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_CONTENT, STAGE_BY_EXTENSION)) + if (probe_demux (this, MRL, STAGE_BY_CONTENT, STAGE_BY_EXTENSION)) return 1; break; case DEMUX_REVERT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_EXTENSION, STAGE_BY_CONTENT)) + if (probe_demux (this, MRL, STAGE_BY_EXTENSION, STAGE_BY_CONTENT)) return 1; break; case DEMUX_CONTENT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_CONTENT, -1)) + if (probe_demux (this, MRL, STAGE_BY_CONTENT, -1)) return 1; break; case DEMUX_EXTENSION_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_EXTENSION, -1)) + if (probe_demux (this, MRL, STAGE_BY_EXTENSION, -1)) return 1; break; - } return 0; } -int xine_play_internal (xine_t *this, char *mrl, - int start_pos, int start_time) { +int xine_open_internal (xine_t *this, char *mrl) { - double share ; - off_t pos, len; - int i; - int demux_status; - - printf ("xine_play: xine open %s, start pos = %d, start time = %d (sec)\n", - mrl, start_pos, start_time); + printf ("xine_open: mrl '%s'\n", mrl); - if (this->speed != SPEED_NORMAL) { - xine_set_speed_internal (this, SPEED_NORMAL); + if (this->speed != XINE_SPEED_NORMAL) { + xine_set_speed_internal (this, XINE_SPEED_NORMAL); } /* * stop engine only for different mrl */ - if ((this->status == XINE_PLAY && strcmp (mrl, this->cur_mrl)) || (this->status == XINE_LOGO)) { + if ((this->status == XINE_STATUS_PLAY && strcmp (mrl, this->cur_mrl)) + || (this->status == XINE_STATUS_LOGO)) { if(this->cur_demuxer_plugin) { this->playing_logo = 0; @@ -385,16 +391,16 @@ int xine_play_internal (xine_t *this, char *mrl, if (this->audio_out) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); - this->status = XINE_STOP; + this->status = XINE_STATUS_STOP; } else { } if (strcmp (mrl, this->cur_mrl)) { /* Is it an 'opt:' mrlstyle ? */ - if(config_file_change_opt(this->config, mrl)) { + if (xine_config_change_opt(this->config, mrl)) { xine_event_t event; - this->status = XINE_STOP; + this->status = XINE_STATUS_STOP; event.type = XINE_EVENT_PLAYBACK_FINISHED; pthread_mutex_unlock (&this->xine_lock); @@ -404,21 +410,29 @@ int xine_play_internal (xine_t *this, char *mrl, } } - if (this->status == XINE_STOP ) { + if (this->status == XINE_STATUS_STOP ) { + + plugin_node_t *node; + /* * find input plugin */ this->cur_input_plugin = NULL; - - for (i = 0; i < this->num_input_plugins; i++) { - if (this->input_plugins[i]->open(this->input_plugins[i], mrl)) { - this->cur_input_plugin = this->input_plugins[i]; + node = xine_list_first_content (this->plugin_catalog->input); + while (node) { + input_plugin_t *plugin; + + plugin = (input_plugin_t *) node->plugin; + + if (plugin->open (plugin, mrl)) { + this->cur_input_plugin = plugin; break; } + node = xine_list_next_content (this->plugin_catalog->input); } if (!this->cur_input_plugin) { - xine_log (this, XINE_LOG_FORMAT, + xine_log (this, XINE_LOG_FORMAT, _("xine: cannot find input plugin for this MRL\n")); this->cur_demuxer_plugin = NULL; this->err = XINE_ERROR_NO_INPUT_PLUGIN; @@ -429,7 +443,7 @@ int xine_play_internal (xine_t *this, char *mrl, 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, + 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); @@ -439,7 +453,7 @@ int xine_play_internal (xine_t *this, char *mrl, */ if (!find_demuxer(this, mrl)) { - xine_log (this, XINE_LOG_FORMAT, + xine_log (this, XINE_LOG_FORMAT, _("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; @@ -450,7 +464,22 @@ int xine_play_internal (xine_t *this, char *mrl, _("system layer format '%s' detected.\n"), this->cur_demuxer_plugin->get_identifier()); } - + + strncpy (this->cur_mrl, mrl, 1024); + + printf ("xine: xine_open done.\n"); + + return 1; +} + +int xine_play_internal (xine_t *this, int start_pos, int start_time) { + + double share ; + off_t pos, len; + int demux_status; + + printf ("xine: xine_play_internal\n"); + /* * start demuxer */ @@ -462,31 +491,31 @@ int xine_play_internal (xine_t *this, char *mrl, } else pos = 0; - if( this->status == XINE_STOP ) { + 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 { + } else { demux_status = this->cur_demuxer_plugin->seek (this->cur_demuxer_plugin, pos, start_time); } + if (demux_status != DEMUX_OK) { xine_log (this, XINE_LOG_MSG, _("xine_play: demuxer failed to start\n")); this->err = XINE_ERROR_DEMUXER_FAILED; - if( this->status == XINE_STOP ) + if( this->status == XINE_STATUS_STOP ) this->cur_input_plugin->close(this->cur_input_plugin); return 0; } else { - this->status = XINE_PLAY; - strncpy (this->cur_mrl, mrl, 1024); + this->status = XINE_STATUS_PLAY; /* osd will be updated as soon as we know cur_input_time */ if( !this->playing_logo ) @@ -496,17 +525,27 @@ int xine_play_internal (xine_t *this, char *mrl, return 1; } -int xine_play (xine_t *this, char *mrl, - int start_pos, int start_time) { -int ret; +int xine_open (xine_t *this, char *mrl) { + int ret; + + pthread_mutex_lock (&this->xine_lock); + ret = xine_open_internal (this, mrl); + pthread_mutex_unlock (&this->xine_lock); + + return ret; +} + +int xine_play (xine_t *this, int start_pos, int start_time) { + int ret; pthread_mutex_lock (&this->xine_lock); - ret = xine_play_internal (this, mrl, start_pos, start_time); + ret = xine_play_internal (this, start_pos, start_time); pthread_mutex_unlock (&this->xine_lock); return ret; } + int xine_eject (xine_t *this) { int status; @@ -517,7 +556,7 @@ int xine_eject (xine_t *this) { pthread_mutex_lock (&this->xine_lock); status = 0; - if (((this->status == XINE_STOP) || (this->status == XINE_LOGO)) + if (((this->status == XINE_STATUS_STOP) || (this->status == XINE_STATUS_LOGO)) && this->last_input_plugin && this->last_input_plugin->eject_media) { status = this->last_input_plugin->eject_media (this->last_input_plugin); @@ -531,7 +570,7 @@ void xine_exit (xine_t *this) { int i; - this->status = XINE_QUIT; + this->status = XINE_STATUS_QUIT; xine_stop(this); @@ -554,7 +593,7 @@ void xine_exit (xine_t *this) { this->video_out->exit (this->video_out); this->video_fifo->dispose (this->video_fifo); - this->status = XINE_QUIT; + this->status = XINE_STATUS_QUIT; printf ("xine_exit: bye!\n"); @@ -563,20 +602,7 @@ void xine_exit (xine_t *this) { this->metronom->exit (this->metronom); - for (i = 0; i < this->num_demuxer_plugins; i++) - this->demuxer_plugins[i]->close (this->demuxer_plugins[i]); - - for (i = 0; i < this->num_input_plugins; i++) - this->input_plugins[i]->dispose (this->input_plugins[i]); - - for (i = 0; i < this->num_audio_decoders_loaded; i++) - this->audio_decoders_loaded[i]->dispose (this->audio_decoders_loaded[i]); - - for (i = 0; i < this->num_video_decoders_loaded; i++) - this->video_decoders_loaded[i]->dispose (this->video_decoders_loaded[i]); - - for (i = 0; i < this->num_spu_decoders_loaded; i++) - this->spu_decoders_loaded[i]->dispose (this->spu_decoders_loaded[i]); + dispose_plugins (this); xine_profiler_print_results (); @@ -589,45 +615,26 @@ void xine_exit (xine_t *this) { } -xine_t *xine_init (vo_driver_t *vo, - ao_driver_t *ao, - config_values_t *config) { +xine_t *xine_new (void) { - xine_t *this = xine_xmalloc (sizeof (xine_t)); - static char *demux_strategies[] = {"default", "reverse", "content", - "extension", NULL}; + xine_t *this; int i; - /* setting default logo mrl */ - pthread_mutex_init (&this->logo_lock, NULL); - - pthread_mutex_lock (&this->logo_lock); - this->logo_mrl = config->register_string(config, "misc.logo_mrl", XINE_LOGO_FILE, - _("logo mrl, displayed in video output window"), - NULL, _logo_change_cb, (void *) this); - pthread_mutex_unlock (&this->logo_lock); - - this->video_driver = vo; - - /* initialize color conversion tables and functions */ - init_yuv_conversion(); - - /* init log buffers */ - for (i = 0; i < XINE_LOG_NUM; i++) - this->log_buffers[i] = new_scratch_buffer (25); + this = xine_xmalloc (sizeof (xine_t)); + if (!this) { + printf ("xine: failed to malloc xine_t\n"); + abort(); + } + #ifdef ENABLE_NLS + /* + * i18n + */ + bindtextdomain("xine-lib", XINE_LOCALEDIR); #endif - - printf ("xine: xine_init entered\n"); - - this->err = XINE_ERROR_NONE; - this->config = config; - /* probe for optimized memcpy or config setting */ - xine_probe_fast_memcpy(config); - /* * init locks */ @@ -641,61 +648,115 @@ xine_t *xine_init (vo_driver_t *vo, this->finished_thread_running = 0; /* - * init event listeners + * config + */ + + this->config = xine_config_init (); + + /* + * log buffers + */ + + for (i = 0; i < XINE_LOG_NUM; i++) + this->log_buffers[i] = new_scratch_buffer (25); + + /* + * defaults */ - this->num_event_listeners = 0; /* Initially there are none */ - this->cur_input_plugin = NULL; /* In case the input plugin event handlers - * are called too early. */ + + this->err = XINE_ERROR_NONE; + this->spu_channel_auto = -1; + this->spu_channel_letterbox = -1; + this->spu_channel_pan_scan = -1; + this->spu_channel_user = -1; + this->cur_input_pos = 0; + this->cur_input_length = 0; + this->last_input_plugin = NULL; + this->num_event_listeners = 0; /* initially there are none */ + this->cur_input_plugin = NULL; this->cur_spu_decoder_plugin = NULL; - this->report_codec_cb = NULL; + this->report_codec_cb = NULL; + + /* + * plugins + */ + scan_plugins(this); + /* - * create a metronom + * logo */ - this->metronom = metronom_init (ao != NULL, (void *)this); + pthread_mutex_init (&this->logo_lock, NULL); + + pthread_mutex_lock (&this->logo_lock); + this->logo_mrl = this->config->register_string(this->config, + "misc.logo_mrl", + XINE_LOGO_FILE, + _("logo mrl, displayed in video output window"), + NULL, 0, _logo_change_cb, + (void *) this); + pthread_mutex_unlock (&this->logo_lock); + + return this; + +} + +void xine_init (xine_t *this, + xine_ao_driver_t *ao, + xine_vo_driver_t *vo) { + + static char *demux_strategies[] = {"default", "reverse", "content", + "extension", NULL}; + + this->video_driver = vo; + + /* initialize color conversion tables and functions */ + init_yuv_conversion(); + + /* - * load input and demuxer plugins + * create a metronom */ - load_input_plugins (this, config); - - this->demux_strategy = config->register_enum (config, "misc.demux_strategy", 0, - demux_strategies, "demuxer selection strategy", - NULL, NULL, NULL); + this->metronom = metronom_init ( (ao != NULL), this); + + /* probe for optimized memcpy or config setting */ + xine_probe_fast_memcpy (this->config); - load_demux_plugins(this, config); + /* + * content detection strategy + */ - this->spu_channel_auto = -1; - this->spu_channel_letterbox = -1; - this->spu_channel_pan_scan = -1; - this->spu_channel_user = -1; - this->cur_input_pos = 0; - this->cur_input_length = 0; - this->last_input_plugin = NULL; + this->demux_strategy = this->config->register_enum (this->config, + "misc.demux_strategy", + 0, + demux_strategies, + "media format detection strategy", + NULL, 10, NULL, NULL); /* * init and start decoder threads */ - load_decoder_plugins (this, config); - this->video_out = vo_new_instance (vo, this); video_decoder_init (this); - this->osd_renderer = osd_renderer_init (this->video_out->get_overlay_instance (this->video_out), config ); + this->osd_renderer = osd_renderer_init (this->video_out->get_overlay_instance (this->video_out), this->config ); this->osd = this->osd_renderer->new_object (this->osd_renderer, 300, 100); this->osd_renderer->set_font (this->osd, "cetus", 24); this->osd_renderer->set_text_palette (this->osd, TEXTPALETTE_WHITE_BLACK_TRANSPARENT, OSD_TEXT1 ); this->osd_renderer->set_position (this->osd, 10,10); - this->osd_display = config->register_bool(config, "misc.osd_display", 1, - "Show status on play, pause, ff, ...", NULL, - update_osd_display, this ); + this->osd_display = this->config->register_bool (this->config, + "misc.osd_display", 1, + "Show status on play, pause, ff, ...", + NULL, 0, + update_osd_display, this ); - if(ao) + if (ao) this->audio_out = ao_new_instance (ao, this); audio_decoder_init (this); @@ -719,14 +780,9 @@ xine_t *xine_init (vo_driver_t *vo, this->osd_renderer->hide (this->osd, 300000); } - play_logo_internal(this); + this->status = XINE_STATUS_STOP; - return this; -} - -int xine_get_spu_channel (xine_t *this) { - - return this->spu_channel_user; + play_logo_internal(this); } void xine_select_spu_channel (xine_t *this, int channel) { @@ -752,7 +808,7 @@ void xine_select_spu_channel (xine_t *this, int channel) { pthread_mutex_unlock (&this->xine_lock); } -int xine_get_current_position (xine_t *this) { +static int xine_get_current_position (xine_t *this) { off_t len; double share; @@ -779,68 +835,11 @@ int xine_get_status(xine_t *this) { int status; status = this->status; - if( status == XINE_LOGO ) - status = XINE_STOP; + if( status == XINE_STATUS_LOGO ) + status = XINE_STATUS_STOP; return status; } -/* *** - * Version information/check - */ - -/* - * Return version in string, like "0.5.0" - */ -char *xine_get_str_version(void) { - return VERSION; -} - -/* - * Return major version - */ -int xine_get_major_version(void) { - return XINE_MAJOR; -} - -/* - * Return minor version - */ -int xine_get_minor_version(void) { - return XINE_MINOR; -} - -/* - * Return sub version - */ -int xine_get_sub_version(void) { - return XINE_SUB; -} - -/* - * Check if xine version is <= to specifier version. - */ -int xine_check_version(int major, int minor, int sub) { - - if((XINE_MAJOR > major) || - ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || - ((XINE_MAJOR == major) && (XINE_MINOR == minor) && (XINE_SUB >= sub))) - return 1; - - return 0; -} - -/* - * manually adjust a/v sync - */ - -void xine_set_av_offset (xine_t *this, int offset_pts) { - this->metronom->set_option (this->metronom, METRONOM_AV_OFFSET, offset_pts); -} - -int xine_get_av_offset (xine_t *this) { - return this->metronom->get_option (this->metronom, METRONOM_AV_OFFSET); -} - /* * trick play */ @@ -849,31 +848,31 @@ void xine_set_speed (xine_t *this, int speed) { pthread_mutex_lock (&this->xine_lock); - if (speed <= SPEED_PAUSE) - speed = SPEED_PAUSE; - else if (speed > SPEED_FAST_4) - speed = SPEED_FAST_4; + if (speed <= XINE_SPEED_PAUSE) + speed = XINE_SPEED_PAUSE; + else if (speed > XINE_SPEED_FAST_4) + speed = XINE_SPEED_FAST_4; /* osd */ pthread_mutex_lock (&this->osd_lock); switch (speed) { - case SPEED_PAUSE: + case XINE_SPEED_PAUSE: xine_internal_osd (this, "<", 90000); break; - case SPEED_SLOW_4: + case XINE_SPEED_SLOW_4: xine_internal_osd (this, "<>", 20000 * speed); break; - case SPEED_SLOW_2: + case XINE_SPEED_SLOW_2: xine_internal_osd (this, "@>", 20000 * speed); break; - case SPEED_NORMAL: + case XINE_SPEED_NORMAL: xine_internal_osd (this, ">", 20000 * speed); break; - case SPEED_FAST_2: + case XINE_SPEED_FAST_2: xine_internal_osd (this, "$$", 20000 * speed); break; - case SPEED_FAST_4: + case XINE_SPEED_FAST_4: xine_internal_osd (this, "$$$", 20000 * speed); break; } @@ -894,11 +893,7 @@ int xine_get_speed (xine_t *this) { * time measurement / seek */ -int xine_get_current_time (xine_t *this) { - return this->cur_input_time; -} - -int xine_get_stream_length (xine_t *this) { +static int xine_get_stream_length (xine_t *this) { if(this->cur_demuxer_plugin) return this->cur_demuxer_plugin->get_stream_length (this->cur_demuxer_plugin); @@ -906,7 +901,17 @@ int xine_get_stream_length (xine_t *this) { return 0; } -int xine_get_audio_capabilities(xine_t *this) { +int xine_get_pos_length (xine_t *this, int *pos_stream, + int *pos_time, int *length_time) { + + *pos_stream = xine_get_current_position (this); + *pos_time = this->cur_input_time * 1000; + *length_time = xine_get_stream_length (this) * 1000; + + return 1; +} + +static int xine_get_audio_capabilities(xine_t *this) { if(this->audio_out) return (this->audio_out->get_capabilities(this->audio_out)); @@ -914,7 +919,7 @@ int xine_get_audio_capabilities(xine_t *this) { return AO_CAP_NOCAP; } -int xine_get_audio_property(xine_t *this, int property) { +static int xine_get_audio_property(xine_t *this, int property) { if(this->audio_out) return(this->audio_out->get_property(this->audio_out, property)); @@ -922,7 +927,7 @@ int xine_get_audio_property(xine_t *this, int property) { return 0; } -int xine_set_audio_property(xine_t *this, int property, int value) { +static int xine_set_audio_property(xine_t *this, int property, int value) { if(this->audio_out) return(this->audio_out->set_property(this->audio_out, property, value)); @@ -932,7 +937,7 @@ int xine_set_audio_property(xine_t *this, int property, int value) { int xine_get_current_frame (xine_t *this, int *width, int *height, int *ratio_code, int *format, - uint8_t **y, uint8_t **u, uint8_t **v) { + uint8_t *img) { vo_frame_t *frame; @@ -947,14 +952,31 @@ int xine_get_current_frame (xine_t *this, int *width, int *height, *ratio_code = frame->ratio; *format = frame->format; - *y = frame->base[0]; - *u = frame->base[1]; - *v = frame->base[2]; + switch (frame->format) { + + case XINE_IMGFMT_YV12: + memcpy (img, frame->base[0], frame->width*frame->height); + memcpy (img+frame->width*frame->height, frame->base[1], + frame->width*frame->height/4); + memcpy (img+frame->width*frame->height+frame->width*frame->height/4, + frame->base[1], + frame->width*frame->height/4); + break; + + case XINE_IMGFMT_YUY2: + memcpy (img, frame->base[0], frame->width * frame->height * 2); + break; + + default: + printf ("xine: error, snapshot function not implemented for format 0x%x\n", + frame->format); + abort (); + } return 1; } -void xine_get_spu_lang (xine_t *this, char *str) { +int xine_get_spu_lang (xine_t *this, int channel, char *str) { switch (this->spu_channel_user) { case -2: @@ -966,7 +988,7 @@ void xine_get_spu_lang (xine_t *this, char *str) { this->cur_input_plugin->get_optional_data (this->cur_input_plugin, this->str, INPUT_OPTIONAL_DATA_SPULANG); sprintf (str, "*(%s)", this->str); - return; + return 1; } } if (this->spu_channel_auto == -1) @@ -977,10 +999,10 @@ void xine_get_spu_lang (xine_t *this, char *str) { default: sprintf (str, "%3d", this->spu_channel_user); } - + return 0; } -void xine_get_audio_lang (xine_t *this, char *str) { +int xine_get_audio_lang (xine_t *this, int channel, char *str) { switch (this->audio_channel_user) { case -2: @@ -994,7 +1016,7 @@ void xine_get_audio_lang (xine_t *this, char *str) { sprintf (str, "*(%s)", this->str); - return; + return 1; } } if (this->audio_channel_auto == -1) @@ -1005,6 +1027,7 @@ void xine_get_audio_lang (xine_t *this, char *str) { default: sprintf (str, "%3d", this->audio_channel_user); } + return 0; } int xine_is_stream_seekable (xine_t *this) { @@ -1062,6 +1085,19 @@ char **xine_get_log (xine_t *this, int buf) { return this->log_buffers[buf]->get_content (this->log_buffers[buf]); } +void xine_register_log_cb (xine_t *self, xine_log_cb_t *cb, void *user_data) { + + printf ("xine: xine_register_log_cb: not implemented yet.\n"); + abort(); +} + + int xine_get_error (xine_t *this) { return this->err; } + +int xine_trick_mode (xine_t *this, int mode, int value) { + printf ("xine: xine_trick_mode not implemented yet.\n"); + abort (); +} + |