diff options
-rw-r--r-- | src/dxr3/dxr3_decoder.c | 26 | ||||
-rw-r--r-- | src/dxr3/dxr3_video_out.h | 3 | ||||
-rw-r--r-- | src/dxr3/dxr3_vo_standard.c | 30 |
3 files changed, 53 insertions, 6 deletions
diff --git a/src/dxr3/dxr3_decoder.c b/src/dxr3/dxr3_decoder.c index f9e8a0caa..085221203 100644 --- a/src/dxr3/dxr3_decoder.c +++ b/src/dxr3/dxr3_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: dxr3_decoder.c,v 1.42 2001/12/11 15:30:05 miguelfreitas Exp $ + * $Id: dxr3_decoder.c,v 1.43 2001/12/15 20:56:21 hrm Exp $ * * dxr3 video and spu decoder plugin. Accepts the video and spu data * from XINE and sends it directly to the corresponding dxr3 devices. @@ -78,9 +78,11 @@ static char *devname; #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 @@ typedef struct dxr3_decoder_s { 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 scr_plugin_t* dxr3scr_init (dxr3_decoder_t *dxr3) { 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 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, 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 @@ typedef struct spudec_decoder_s { 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 @@ static void swab_clut(int* clut) 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; diff --git a/src/dxr3/dxr3_video_out.h b/src/dxr3/dxr3_video_out.h index bf9174fe8..7e7187220 100644 --- a/src/dxr3/dxr3_video_out.h +++ b/src/dxr3/dxr3_video_out.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_video_out.h,v 1.9 2001/12/11 02:26:59 hrm Exp $ + * $Id: dxr3_video_out.h,v 1.10 2001/12/15 20:56:21 hrm Exp $ * */ @@ -173,4 +173,3 @@ int dxr3_set_property (vo_driver_t *this_gen, int property, int value); 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); - diff --git a/src/dxr3/dxr3_vo_standard.c b/src/dxr3/dxr3_vo_standard.c index a466f04d2..7e7618790 100644 --- a/src/dxr3/dxr3_vo_standard.c +++ b/src/dxr3/dxr3_vo_standard.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: dxr3_vo_standard.c,v 1.8 2001/12/11 02:26:59 hrm Exp $ + * $Id: dxr3_vo_standard.c,v 1.9 2001/12/15 20:56:21 hrm Exp $ * ******************************************************************* * Dummy video out plugin for the dxr3. Is responsible for setting * @@ -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 @@ void dxr3_exit (vo_driver_t *this_gen) 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 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) dxr3_get_keycolor(this); dxr3_overlay_buggy_preinit(&this->overlay, this->fd_control); } - + + dxr3_set_vo(this, 1); return &this->vo_driver; } |