From: Harm v. d. H. <hr...@us...> - 2001-12-15 20:56:23
|
Update of /cvsroot/xine/xine-lib/src/dxr3 In directory usw-pr-cvs1:/tmp/cvs-serv21568 Modified Files: dxr3_decoder.c dxr3_video_out.h dxr3_vo_standard.c Log Message: dxr3 decoder can now check if the dxr3 video out plugin is active. If it isn't, it will report 0 capabilities, thus giving libmpeg2 a chance. For users this means you can finally say xine -V Xv dvdnav://:main to use libmpeg2 + Xvideo and xine -V dxr3 dvdnav://:main to use dxr3 hardware decoding. Previously, it used the dxr3 decoder plugin no matter which output plugin was active. Index: dxr3_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/dxr3/dxr3_decoder.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- dxr3_decoder.c 2001/12/11 15:30:05 1.42 +++ dxr3_decoder.c 2001/12/15 20:56:21 1.43 @@ -78,9 +78,11 @@ #define MVCOMMAND_SCAN 4 #endif + typedef struct dxr3_decoder_s { video_decoder_t video_decoder; vo_instance_t *video_out; + config_values_t *config; int fd_control; int fd_video; @@ -95,6 +97,17 @@ int enhanced_mode; } dxr3_decoder_t; +/* Function to check whether the dxr3 video out plugin is active. + * Without it, we can't work and must give it to libmpeg2. + * We (ab)use a config value for this (set by dxr3 video out init/exit) + */ +static int dxr3_check_vo(config_values_t* cfg) +{ + cfg_entry_t* entry; + entry = cfg->lookup_entry(cfg, "dxr3.active"); + return (entry && entry->num_value); +} + static int dxr3_tested = 0; static int dxr3_ok; @@ -287,6 +300,10 @@ static int dxr3_can_handle (video_decoder_t *this_gen, int buf_type) { + if (! dxr3_check_vo(((dxr3_decoder_t*)this_gen)->config)) { + /* dxr3 video out is not active. Play dead. */ + return 0; + } buf_type &= 0xFFFF0000; return (buf_type == BUF_VIDEO_MPEG) || (buf_type == BUF_VIDEO_FILL); } @@ -587,6 +604,7 @@ this->video_decoder.get_identifier = dxr3_get_id; this->video_decoder.flush = dxr3_flush; this->video_decoder.priority = 10; + this->config = cfg; this->scr_prio = cfg->register_num(cfg, "dxr3.scr_priority", 10, "Dxr3: SCR plugin priority",NULL,NULL,NULL); @@ -619,6 +637,10 @@ static int spudec_can_handle (spu_decoder_t *this_gen, int buf_type) { int type = buf_type & 0xFFFF0000; + if (! dxr3_check_vo(((spudec_decoder_t*)this_gen)->xine->config) ) { + /* dxr3 video out is not active. Play dead. */ + return 0; + } return (type == BUF_SPU_PACKAGE || type == BUF_SPU_CLUT || type == BUF_SPU_SUBP_CONTROL); } @@ -650,7 +672,7 @@ clut[i] = bswap_32(clut[i]); } -static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf, uint32_t scr) +static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; ssize_t written; Index: dxr3_video_out.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/dxr3/dxr3_video_out.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- dxr3_video_out.h 2001/12/11 02:26:59 1.9 +++ dxr3_video_out.h 2001/12/15 20:56:21 1.10 @@ -173,4 +173,3 @@ void dxr3_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max); int dxr3_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data); - Index: dxr3_vo_standard.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/dxr3/dxr3_vo_standard.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- dxr3_vo_standard.c 2001/12/11 02:26:59 1.8 +++ dxr3_vo_standard.c 2001/12/15 20:56:21 1.9 @@ -43,6 +43,28 @@ /* Dxr3 videoout globals */ #include "dxr3_video_out.h" +/* some helper stuff so that the decoder plugin can test for the + * presence of the dxr3 vo driver */ +/* to be called by dxr3 video out init and exit handlers */ +static void dxr3_set_vo(dxr3_driver_t* this, int active) +{ + cfg_entry_t *entry; + config_values_t *config = this->config; + + entry = config->lookup_entry(config, "dxr3.active"); + if (! entry) { + /* register first */ + config->register_num(config, "dxr3.active", active, + "state of dxr3 video out", + "(internal variable; do not edit)", + NULL, NULL); + } + else { + entry->num_value = active; + } + printf("dxr3: %s dxr3 video out", (active ? "enabled" : "disabled")); +} + static uint32_t dxr3_get_capabilities (vo_driver_t *this_gen) { /* Since we have no vo format, we return dummy values here */ @@ -155,6 +177,9 @@ if(this->overlay_enabled) dxr3_overlay_set_mode(&this->overlay, EM8300_OVERLAY_MODE_OFF ); close(this->fd_control); + + dxr3_set_vo(this, 0); + free(this); } vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) @@ -207,7 +232,8 @@ dxr3_get_keycolor(this); dxr3_overlay_buggy_preinit(&this->overlay, this->fd_control); } - + + dxr3_set_vo(this, 1); return &this->vo_driver; } |