diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-09-05 12:52:24 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-09-05 12:52:24 +0000 |
commit | 984d6daaac3b8d0da02efc7cb27a4b0586877395 (patch) | |
tree | 77cf96de02c0bf4f124f14066a4f83283095db31 | |
parent | ca7a1e86bac881a5732408757f1745d1302ebeb3 (diff) | |
download | xine-lib-984d6daaac3b8d0da02efc7cb27a4b0586877395.tar.gz xine-lib-984d6daaac3b8d0da02efc7cb27a4b0586877395.tar.bz2 |
dxr3 adapted to new api, should at least compile now
CVS patchset: 2612
CVS date: 2002/09/05 12:52:24
-rw-r--r-- | src/dxr3/dxr3_decode_spu.c | 39 | ||||
-rw-r--r-- | src/dxr3/dxr3_decode_video.c | 69 | ||||
-rw-r--r-- | src/dxr3/dxr3_mpeg_encoders.c | 18 | ||||
-rw-r--r-- | src/dxr3/dxr3_scr.c | 22 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.c | 195 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.h | 6 |
6 files changed, 178 insertions, 171 deletions
diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 7e8cb0739..6cfcf619c 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.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_decode_spu.c,v 1.16 2002/08/28 15:46:55 mroi Exp $ + * $Id: dxr3_decode_spu.c,v 1.17 2002/09/05 12:52:24 mroi Exp $ */ /* dxr3 spu decoder plugin. @@ -53,7 +53,23 @@ /* plugin initialization function */ -spu_decoder_t *init_spu_decoder_plugin(int iface_version, xine_t *xine); +static void *dxr3_spudec_init_plugin(xine_t *xine, void *); + + +/* plugin catalog information */ +static uint32_t supported_types[] = { BUF_SPU_PACKAGE, BUF_SPU_CLUT, BUF_SPU_NAV, BUF_SPU_SUBP_CONTROL, 0 }; + +static decoder_info_t dxr3_spudec_info = { + supported_types, /* supported types */ + 10 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_SPU_DECODER, 10, "dxr3-spudec", XINE_VERSION_CODE, &dxr3_spudec_info, &dxr3_spudec_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + /* functions required by xine api */ static char *dxr3_spudec_get_id(void); @@ -102,27 +118,19 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em static void dxr3_swab_clut(int* clut); -spu_decoder_t *init_spu_decoder_plugin(int iface_version, xine_t *xine) +static void *dxr3_spudec_init_plugin(xine_t *xine, void* data) { dxr3_spudec_t *this; const char *confstr; int dashpos; - if (iface_version != 9) { - printf(_("dxr3_decode_spu: plugin doesn't support plugin API version %d.\n" - "dxr3_decode_spu: this means there's a version mismatch between xine and this " - "dxr3_decode_spu: decoder plugin. Installing current plugins should help.\n"), - iface_version); - return NULL; - } - if (!dxr3_present(xine)) return NULL; this = (dxr3_spudec_t *)malloc(sizeof(dxr3_spudec_t)); if (!this) return NULL; confstr = xine->config->register_string(xine->config, - CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, NULL, NULL); + CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); strncpy(this->devname, confstr, 128); this->devname[127] = '\0'; dashpos = strlen(this->devname) - 2; /* the dash in the new device naming scheme would be here */ @@ -136,7 +144,6 @@ spu_decoder_t *init_spu_decoder_plugin(int iface_version, xine_t *xine) this->devnum[0] = '\0'; } - this->spu_decoder.interface_version = iface_version; this->spu_decoder.get_identifier = dxr3_spudec_get_id; this->spu_decoder.can_handle = dxr3_spudec_can_handle; this->spu_decoder.init = dxr3_spudec_init; @@ -156,7 +163,7 @@ spu_decoder_t *init_spu_decoder_plugin(int iface_version, xine_t *xine) this->pci.hli.hl_gi.hli_ss = 0; this->buttonN = 1; - this->aspect = XINE_ASPECT_RATIO_4_3; + this->aspect = XINE_VO_ASPECT_4_3; xine_register_event_listener(xine, dxr3_spudec_event_listener, this); @@ -349,7 +356,7 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) #endif return; } - if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && + if (this->aspect == XINE_VO_ASPECT_ANAMORPHIC && this->xine->spu_channel_user == -1 && this->xine->spu_channel_letterbox >= 0 && this->xine->video_driver->get_property(this->xine->video_driver, VO_PROP_VO_TYPE) == VO_TYPE_DXR3_LETTERBOXED) { @@ -551,7 +558,7 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 btn->top = button_ptr->y_start; btn->right = button_ptr->x_end; btn->bottom = button_ptr->y_end; - if (this->aspect == XINE_ASPECT_RATIO_ANAMORPHIC && + if (this->aspect == XINE_VO_ASPECT_ANAMORPHIC && this->xine->video_driver->get_property(this->xine->video_driver, VO_PROP_VO_TYPE) == VO_TYPE_DXR3_LETTERBOXED && this->xine->spu_channel_user == -1 && this->xine->spu_channel_letterbox != this->xine->spu_channel && diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index 8e4bc78b7..0ae45e8b1 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.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_decode_video.c,v 1.12 2002/07/10 14:09:56 mroi Exp $ + * $Id: dxr3_decode_video.c,v 1.13 2002/09/05 12:52:24 mroi Exp $ */ /* dxr3 video decoder plugin. @@ -58,11 +58,26 @@ /* plugin initialization function */ -video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine); +static void *dxr3_init_plugin(xine_t *xine, void *); + + +/* plugin catalog information */ +static uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; + +static decoder_info_t dxr3_video_decoder_info = { + supported_types, /* supported types */ + 10 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "dxr3-mpeg2", XINE_VERSION_CODE, &dxr3_video_decoder_info, &dxr3_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + /* functions required by xine api */ static char *dxr3_get_id(void); -static int dxr3_can_handle(video_decoder_t *this_gen, int buf_type); static void dxr3_init(video_decoder_t *this_gen, vo_instance_t *video_out); static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf); static void dxr3_flush(video_decoder_t *this_gen); @@ -115,13 +130,13 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t *buffer); static int get_duration(dxr3_decoder_t *this); /* config callbacks */ -static void dxr3_update_priority(void *this_gen, cfg_entry_t *entry); -static void dxr3_update_sync_mode(void *this_gen, cfg_entry_t *entry); -static void dxr3_update_enhanced_mode(void *this_gen, cfg_entry_t *entry); -static void dxr3_update_correct_durations(void *this_gen, cfg_entry_t *entry); +static void dxr3_update_priority(void *this_gen, xine_cfg_entry_t *entry); +static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry); +static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry); +static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry); -video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine) +static void *dxr3_init_plugin(xine_t *xine, void *data) { dxr3_decoder_t *this; config_values_t *cfg; @@ -129,21 +144,13 @@ video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine) int dashpos; int64_t cur_offset; - if (iface_version != 10) { - printf(_("dxr3_decode_video: plugin doesn't support plugin API version %d.\n" - "dxr3_decode_video: this means there's a version mismatch between xine and this\n" - "dxr3_decode_video: decoder plugin. Installing current plugins should help.\n"), - iface_version); - return NULL; - } - if (!dxr3_present(xine)) return NULL; this = (dxr3_decoder_t *)malloc(sizeof (dxr3_decoder_t)); if (!this) return NULL; cfg = xine->config; - confstr = cfg->register_string(cfg, CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, NULL, NULL); + confstr = cfg->register_string(cfg, CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); strncpy(this->devname, confstr, 128); this->devname[127] = '\0'; dashpos = strlen(this->devname) - 2; /* the dash in the new device naming scheme would be here */ @@ -157,9 +164,7 @@ video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine) this->devnum[0] = '\0'; } - this->video_decoder.interface_version = iface_version; this->video_decoder.get_identifier = dxr3_get_id; - this->video_decoder.can_handle = dxr3_can_handle; this->video_decoder.init = dxr3_init; this->video_decoder.decode_data = dxr3_decode_data; this->video_decoder.flush = dxr3_flush; @@ -168,7 +173,7 @@ video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine) this->video_decoder.dispose = dxr3_dispose; this->video_decoder.priority = cfg->register_num(cfg, "dxr3.decoder_priority", 10, _("Dxr3: video decoder priority"), - _("Decoder priorities greater 5 enable hardware decoding, 0 disables it."), + _("Decoder priorities greater 5 enable hardware decoding, 0 disables it."), 20, dxr3_update_priority, this); this->scr = NULL; @@ -176,15 +181,15 @@ video_decoder_t *init_video_decoder_plugin(int iface_version, xine_t *xine) this->sync_every_frame = cfg->register_bool(cfg, "dxr3.sync_every_frame", 0, _("Try to sync video every frame"), - _("This is relevant for progressive video only (most PAL films)."), + _("This is relevant for progressive video only (most PAL films)."), 20, dxr3_update_sync_mode, this); this->enhanced_mode = cfg->register_bool(cfg, "dxr3.alt_play_mode", 1, _("Use alternate Play mode"), - _("Enabling this option will utilise a smoother play mode."), + _("Enabling this option will utilise a smoother play mode."), 10, dxr3_update_enhanced_mode, this); this->correct_durations = cfg->register_bool(cfg, "dxr3.correct_durations", 0, _("Correct frame durations in broken streams"), - _("Enable this for streams with wrong frame durations."), + _("Enable this for streams with wrong frame durations."), 10, dxr3_update_correct_durations, this); /* set a/v offset to compensate dxr3 internal delay */ @@ -200,12 +205,6 @@ static char *dxr3_get_id(void) return "dxr3-mpeg2"; } -static int dxr3_can_handle(video_decoder_t *this_gen, int buf_type) -{ - buf_type &= 0xFFFF0000; - return (buf_type == BUF_VIDEO_MPEG); -} - static void dxr3_init(video_decoder_t *this_gen, vo_instance_t *video_out) { dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; @@ -263,9 +262,9 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) if (buf->decoder_flags & BUF_FLAG_SPECIAL) { if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) { this->aspect = this->force_aspect = buf->decoder_info[2]; - if (buf->decoder_info[3] == 0x1 && this->force_aspect == XINE_ASPECT_RATIO_ANAMORPHIC) + if (buf->decoder_info[3] == 0x1 && this->force_aspect == XINE_VO_ASPECT_ANAMORPHIC) /* letterboxing is denied, we have to do pan&scan */ - this->aspect = this->force_aspect = XINE_ASPECT_RATIO_PAN_SCAN; + this->aspect = this->force_aspect = XINE_VO_ASPECT_PAN_SCAN; /* when aspect changed, we have to send an event for dxr3 spu decoder */ if (!this->last_aspect || this->last_aspect != this->aspect) { xine_frame_change_event_t event; @@ -673,28 +672,28 @@ static int get_duration(dxr3_decoder_t *this) return duration; } -static void dxr3_update_priority(void *this_gen, cfg_entry_t *entry) +static void dxr3_update_priority(void *this_gen, xine_cfg_entry_t *entry) { ((dxr3_decoder_t *)this_gen)->video_decoder.priority = entry->num_value; printf("dxr3_decode_video: setting decoder priority to %d\n", entry->num_value); } -static void dxr3_update_sync_mode(void *this_gen, cfg_entry_t *entry) +static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry) { ((dxr3_decoder_t *)this_gen)->sync_every_frame = entry->num_value; printf("dxr3_decode_video: setting sync_every_frame to %s\n", (entry->num_value ? "on" : "off")); } -static void dxr3_update_enhanced_mode(void *this_gen, cfg_entry_t *entry) +static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry) { ((dxr3_decoder_t *)this_gen)->enhanced_mode = entry->num_value; printf("dxr3_decode_video: setting enhanced mode to %s\n", (entry->num_value ? "on" : "off")); } -static void dxr3_update_correct_durations(void *this_gen, cfg_entry_t *entry) +static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry) { ((dxr3_decoder_t *)this_gen)->correct_durations = entry->num_value; printf("dxr3_decode_video: setting correct_durations mode to %s\n", diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index c28e84ef2..e661753b1 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.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_mpeg_encoders.c,v 1.8 2002/07/17 14:58:12 mroi Exp $ + * $Id: dxr3_mpeg_encoders.c,v 1.9 2002/09/05 12:52:24 mroi Exp $ */ /* mpeg encoders for the dxr3 video out plugin. @@ -177,10 +177,10 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) return 0; } - this->rte_bitrate = drv->config->register_range(drv->config, + this->rte_bitrate = drv->xine->config->register_range(drv->xine->config, "dxr3.rte_bitrate", 10000, 1000, 20000, _("Dxr3enc: rte mpeg output bitrate (kbit/s)"), - _("The bitrate the mpeg encoder library librte should use for dxr3's encoding mode"), + _("The bitrate the mpeg encoder library librte should use for dxr3's encoding mode"), 10, NULL, NULL); this->rte_bitrate *= 1000; /* config in kbit/s, rte wants bit/s */ @@ -191,7 +191,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) * and context->video_bytes (= width * height * bytes/pixel) */ rte_set_video_parameters(context, - (frame->vo_frame.format == IMGFMT_YV12 ? RTE_YUV420 : RTE_YUYV), + (frame->vo_frame.format == XINE_IMGFMT_YV12 ? RTE_YUV420 : RTE_YUYV), context->width, context->height, context->video_rate, context->output_video_bits, context->gop_sequence); @@ -256,7 +256,7 @@ static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) if ((this->width == frame->vo_frame.pitches[0]) && (this->height == frame->oheight)) { /* This frame belongs to current context. */ size = frame->vo_frame.pitches[0] * frame->oheight; - if (frame->vo_frame.format == IMGFMT_YV12) + if (frame->vo_frame.format == XINE_IMGFMT_YV12) xine_fast_memcpy(this->rte_ptr, frame->real_base[0], size * 3/2); else xine_fast_memcpy(this->rte_ptr, frame->real_base[0], size * 2); @@ -345,7 +345,7 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* if YUY2 and dimensions changed, we need to re-allocate the * internal YV12 buffer */ - if (frame->vo_frame.format == IMGFMT_YUY2) { + if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = drv->video_width * drv->video_oheight; this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, @@ -384,10 +384,10 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) } this->fp = init_fp; - this->fp.quality = drv->config->register_range(drv->config, + this->fp.quality = drv->xine->config->register_range(drv->xine->config, "dxr3.fame_quality", 90, 10, 100, _("Dxr3enc: fame mpeg encoding quality"), - _("The encoding quality of the libfame mpeg encoder library."), + _("The encoding quality of the libfame mpeg encoder library."), 10, NULL,NULL); #if LOG_ENC /* the really interesting bit is the quantizer scale. The formula @@ -527,7 +527,7 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_ if (frame->vo_frame.bad_frame) return 1; - if (frame->vo_frame.format == IMGFMT_YUY2) { + if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { /* need YUY2->YV12 conversion */ if (!(this->out[0] && this->out[1] && this->out[2]) ) { printf("dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); diff --git a/src/dxr3/dxr3_scr.c b/src/dxr3/dxr3_scr.c index 9ad245403..e78d0ae54 100644 --- a/src/dxr3/dxr3_scr.c +++ b/src/dxr3/dxr3_scr.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_scr.c,v 1.4 2002/06/12 15:09:08 mroi Exp $ + * $Id: dxr3_scr.c,v 1.5 2002/09/05 12:52:24 mroi Exp $ */ /* dxr3 scr plugin. @@ -50,7 +50,7 @@ static void dxr3_scr_exit(scr_plugin_t *scr); static int dxr3_mvcommand(int fd_control, int command); /* config callback */ -static void dxr3_scr_update_priority(void *this_gen, cfg_entry_t *entry); +static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry); dxr3_scr_t *dxr3_scr_init(xine_t *xine) @@ -61,7 +61,7 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) this = (dxr3_scr_t *)malloc(sizeof(dxr3_scr_t)); confstr = xine->config->register_string(xine->config, - CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, NULL, NULL); + CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); if ((this->fd_control = open(confstr, O_WRONLY)) < 0) { printf("dxr3_scr: Failed to open control device %s (%s)\n", confstr, strerror(errno)); @@ -79,7 +79,7 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) this->priority = xine->config->register_num( xine->config, "dxr3.scr_priority", 10, _("Dxr3: SCR plugin priority"), - _("Scr priorities greater 5 make the dxr3 xine's master clock."), + _("Scr priorities greater 5 make the dxr3 xine's master clock."), 20, dxr3_scr_update_priority, this); this->offset = 0; this->last_pts = 0; @@ -172,27 +172,27 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) int playmode; switch (speed) { - case SPEED_PAUSE: + case XINE_SPEED_PAUSE: em_speed = 0; playmode = MVCOMMAND_PAUSE; break; - case SPEED_SLOW_4: + case XINE_SPEED_SLOW_4: em_speed = 0x900 / 4; playmode = MVCOMMAND_START; break; - case SPEED_SLOW_2: + case XINE_SPEED_SLOW_2: em_speed = 0x900 / 2; playmode = MVCOMMAND_START; break; - case SPEED_NORMAL: + case XINE_SPEED_NORMAL: em_speed = 0x900; playmode = MVCOMMAND_SYNC; break; - case SPEED_FAST_2: + case XINE_SPEED_FAST_2: em_speed = 0x900 * 2; playmode = MVCOMMAND_START; break; - case SPEED_FAST_4: + case XINE_SPEED_FAST_4: em_speed = 0x900 * 4; playmode = MVCOMMAND_START; break; @@ -238,7 +238,7 @@ static int dxr3_mvcommand(int fd_control, int command) return ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®s); } -static void dxr3_scr_update_priority(void *this_gen, cfg_entry_t *entry) +static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry) { ((dxr3_scr_t *)this_gen)->priority = entry->num_value; printf("dxr3_scr: setting scr priority to %d\n", diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index d8643ecf3..d7004d101 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.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_out_dxr3.c,v 1.52 2002/08/27 19:19:39 mroi Exp $ + * $Id: video_out_dxr3.c,v 1.53 2002/09/05 12:52:24 mroi Exp $ */ /* mpeg1 encoding video out plugin for the dxr3. @@ -55,9 +55,6 @@ #include "xine_internal.h" #include "xineutils.h" #include "video_out.h" -#ifdef HAVE_X11 -# include "../video_out/video_out_x11.h" -#endif #include "alphablend.h" #include "dxr3.h" #include "video_out_dxr3.h" @@ -68,30 +65,45 @@ /* plugin initialization functions */ vo_info_t *get_video_out_plugin_info(); -vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen); +static void *dxr3_vo_init_plugin(xine_t *xine, void *visual_gen); + + +/* plugin catalog information */ +static vo_info_t vo_info_dxr3 = { + 10, /* priority */ + "dxr3", /* description */ + XINE_VISUAL_TYPE_X11 /* visual type */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_OUT, 6, "dxr3", XINE_VERSION_CODE, &vo_info_dxr3, &dxr3_vo_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + /* functions required by xine api */ -static uint32_t dxr3_get_capabilities(vo_driver_t *this_gen); -static vo_frame_t *dxr3_alloc_frame(vo_driver_t *this_gen); +static uint32_t dxr3_get_capabilities(xine_vo_driver_t *this_gen); +static vo_frame_t *dxr3_alloc_frame(xine_vo_driver_t *this_gen); static void dxr3_frame_copy(vo_frame_t *frame_gen, uint8_t **src); static void dxr3_frame_field(vo_frame_t *vo_img, int which_field); static void dxr3_frame_dispose(vo_frame_t *frame_gen); -static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, +static void dxr3_update_frame_format(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags); -static void dxr3_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed); -static void dxr3_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, +static void dxr3_overlay_begin(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed); +static void dxr3_overlay_blend(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay); -static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen); -static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen); -static int dxr3_redraw_needed(vo_driver_t *this_gen); -static int dxr3_get_property(vo_driver_t *this_gen, int property); -static int dxr3_set_property(vo_driver_t *this_gen, int property, int value); -static void dxr3_get_property_min_max(vo_driver_t *this_gen, int property, - int *min, int *max); -static int dxr3_gui_data_exchange(vo_driver_t *this_gen, +static void dxr3_overlay_end(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen); +static void dxr3_display_frame(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen); +static int dxr3_redraw_needed(xine_vo_driver_t *this_gen); +static int dxr3_get_property(xine_vo_driver_t *this_gen, int property); +static int dxr3_set_property(xine_vo_driver_t *this_gen, int property, int value); +static void dxr3_get_property_min_max(xine_vo_driver_t *this_gen, int property, + int *min, int *max); +static int dxr3_gui_data_exchange(xine_vo_driver_t *this_gen, int data_type, void *data); -static void dxr3_exit(vo_driver_t *this_gen); +static void dxr3_exit(xine_vo_driver_t *this_gen); /* overlay helper functions only called once during plugin init */ static void gather_screen_vars(dxr3_driver_t *this, x11_visual_t *vis); @@ -107,26 +119,12 @@ static void dxr3_translate_gui2video(dxr3_driver_t *this, int x, int y, static int is_fullscreen(dxr3_driver_t *this); /* config callbacks */ -static void dxr3_update_add_bars(void *data, cfg_entry_t *entry); -static void dxr3_update_swap_fields(void *data, cfg_entry_t *entry); -static void dxr3_update_enhanced_mode(void *this_gen, cfg_entry_t *entry); - - -vo_info_t *get_video_out_plugin_info() -{ - static vo_info_t vo_info_dxr3 = { - 6, /* api version */ - "dxr3", - NULL, - VISUAL_TYPE_X11, - 10 /* priority */ - }; +static void dxr3_update_add_bars(void *data, xine_cfg_entry_t *entry); +static void dxr3_update_swap_fields(void *data, xine_cfg_entry_t *entry); +static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry); - vo_info_dxr3.description = _("xine video output plugin for dxr3 cards"); - return &vo_info_dxr3; -} -vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) +static void *dxr3_vo_init_plugin(xine_t *xine, void *visual_gen) { dxr3_driver_t *this; char tmpstr[100]; @@ -160,19 +158,22 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) pthread_mutex_init(&this->spu_device_lock, NULL); - this->config = config; - this->swap_fields = config->register_bool(config, - "dxr3.enc_swap_fields", 0, _("swap odd and even lines"), - NULL, dxr3_update_swap_fields, this); - this->add_bars = config->register_bool(config, + this->xine = xine; + this->swap_fields = xine->config->register_bool(xine->config, + "dxr3.enc_swap_fields", 0, _("swap odd and even lines"), NULL, 10, + dxr3_update_swap_fields, this); + this->add_bars = xine->config->register_bool(xine->config, "dxr3.enc_add_bars", 1, _("Add black bars to correct aspect ratio"), - _("If disabled, will assume source has 4:3 aspect ratio."), dxr3_update_add_bars, this); - this->enhanced_mode = config->register_bool(config, + _("If disabled, will assume source has 4:3 aspect ratio."), 10, + dxr3_update_add_bars, this); + this->enhanced_mode = xine->config->register_bool(xine->config, "dxr3.enc_alt_play_mode", 1, _("dxr3: use alternate play mode for mpeg encoder playback"), - _("Enabling this option will utilise a smoother play mode."), dxr3_update_enhanced_mode, this); + _("Enabling this option will utilise a smoother play mode."), 10, + dxr3_update_enhanced_mode, this); - confstr = config->register_string(config, CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, NULL, NULL); + confstr = xine->config->register_string(xine->config, + CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); strncpy(this->devname, confstr, 128); this->devname[127] = '\0'; dashpos = strlen(this->devname) - 2; /* the dash in the new device naming scheme would be here */ @@ -229,10 +230,10 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) printf("none\n"); #endif if (encoder) { - encoder = config->register_enum(config, "dxr3.encoder", + encoder = xine->config->register_enum(xine->config, "dxr3.encoder", 0, available_encoders, _("the encoder for non mpeg content"), _("Content other than mpeg has to pass an additional reencoding stage, " - "because the dxr3 handles mpeg only."), NULL, NULL); + "because the dxr3 handles mpeg only."), 10, NULL, NULL); #ifdef HAVE_LIBRTE if ((strcmp(available_encoders[encoder], "rte") == 0) && !dxr3_rte_init(this)) { printf("video_out_dxr3: Mpeg encoder rte failed to init.\n"); @@ -260,16 +261,16 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) if (ioctl(this->fd_control, EM8300_IOCTL_GETBCS, &this->bcs)) printf("video_out_dxr3: cannot read bcs values (%s)\n", strerror(errno)); - this->bcs.contrast = config->register_range(config, "dxr3.contrast", - this->bcs.contrast, 100, 900, _("Dxr3: contrast control"), NULL, NULL, NULL); - this->bcs.saturation = config->register_range(config, "dxr3.saturation", - this->bcs.saturation, 100, 900, _("Dxr3: saturation control"), NULL, NULL, NULL); - this->bcs.brightness = config->register_range(config, "dxr3.brightness", - this->bcs.brightness, 100, 900, _("Dxr3: brightness control"), NULL, NULL, NULL); + this->bcs.contrast = xine->config->register_range(xine->config, "dxr3.contrast", + this->bcs.contrast, 100, 900, _("Dxr3: contrast control"), NULL, 0, NULL, NULL); + this->bcs.saturation = xine->config->register_range(xine->config, "dxr3.saturation", + this->bcs.saturation, 100, 900, _("Dxr3: saturation control"), NULL, 0, NULL, NULL); + this->bcs.brightness = xine->config->register_range(xine->config, "dxr3.brightness", + this->bcs.brightness, 100, 900, _("Dxr3: brightness control"), NULL, 0, NULL, NULL); /* overlay or tvout? */ - confnum = config->register_enum(config, "dxr3.videoout_mode", 0, videoout_modes, - _("Dxr3: videoout mode (tv or overlay)"), NULL, NULL, NULL); + confnum = xine->config->register_enum(xine->config, "dxr3.videoout_mode", 0, videoout_modes, + _("Dxr3: videoout mode (tv or overlay)"), NULL, 0, NULL, NULL); #if LOG_VID printf("video_out_dxr3: overlaymode = %s\n", videoout_modes[confnum]); #endif @@ -296,12 +297,12 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) this->overlay_enabled = 1; this->tv_switchable = 1; this->widescreen_enabled = 0; - confstr = config->register_string(config, "dxr3.keycolor", "0x80a040", - _("Dxr3: overlay colorkey value"), NULL, NULL, NULL); + confstr = xine->config->register_string(xine->config, "dxr3.keycolor", "0x80a040", + _("Dxr3: overlay colorkey value"), NULL, 10, NULL, NULL); sscanf(confstr, "%x", &this->overlay.colorkey); - confstr = config->register_string(config, "dxr3.color_interval", "50.0", + confstr = xine->config->register_string(xine->config, "dxr3.color_interval", "50.0", _("Dxr3: overlay colorkey range"), - _("A greater value widens the tolerance for the overlay keycolor"), NULL, NULL); + _("A greater value widens the tolerance for the overlay keycolor"), 10, NULL, NULL); sscanf(confstr, "%f", &this->overlay.color_interval); } else { printf("video_out_dxr3: please run autocal, overlay disabled\n"); @@ -313,8 +314,8 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) } /* init tvmode */ - confnum = config->register_enum(config, "dxr3.preferred_tvmode", 3, tv_modes, - _("dxr3 preferred tv mode"), NULL, NULL, NULL); + confnum = xine->config->register_enum(xine->config, "dxr3.preferred_tvmode", 3, tv_modes, + _("dxr3 preferred tv mode"), NULL, 0, NULL, NULL); switch (confnum) { case 0: /* ntsc */ this->tv_mode = EM8300_VIDEOMODE_NTSC; @@ -376,13 +377,13 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) return &this->vo_driver; } -static uint32_t dxr3_get_capabilities(vo_driver_t *this_gen) +static uint32_t dxr3_get_capabilities(xine_vo_driver_t *this_gen) { return VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_SATURATION | VO_CAP_BRIGHTNESS | VO_CAP_CONTRAST; } -static vo_frame_t *dxr3_alloc_frame(vo_driver_t *this_gen) +static vo_frame_t *dxr3_alloc_frame(xine_vo_driver_t *this_gen) { dxr3_frame_t *frame; dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -426,7 +427,7 @@ static void dxr3_frame_dispose(vo_frame_t *frame_gen) free(frame); } -static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, +static void dxr3_update_frame_format(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -458,7 +459,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge frame->vo_frame.height = height; frame->vo_frame.ratio = ratio_code; frame->oheight = height; - frame->pan_scan = (ratio_code == XINE_ASPECT_RATIO_PAN_SCAN); + frame->pan_scan = (ratio_code == XINE_VO_ASPECT_PAN_SCAN); frame->aspect = 0; if (frame->mem) { @@ -485,19 +486,19 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge if (this->add_bars == 0) { /* don't add black bars; assume source is in 4:3 */ - ratio_code = XINE_ASPECT_RATIO_4_3; + ratio_code = XINE_VO_ASPECT_4_3; } if ((this->video_width != width) || (this->video_iheight != height) || (this->video_ratio != ratio_code)) { /* check aspect ratio, see if we need to add black borders */ switch (ratio_code) { - case XINE_ASPECT_RATIO_4_3: + case XINE_VO_ASPECT_4_3: frame->aspect = ASPECT_FULL; oheight = height; break; - case XINE_ASPECT_RATIO_ANAMORPHIC: - case XINE_ASPECT_RATIO_PAN_SCAN: + case XINE_VO_ASPECT_ANAMORPHIC: + case XINE_VO_ASPECT_PAN_SCAN: frame->aspect = ASPECT_ANAMORPHIC; oheight = height; break; @@ -544,7 +545,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* make top black bar multiple of 16, * so old and new macroblocks overlap */ this->top_bar = ((oheight - height) / 32) * 16; - if (format == IMGFMT_YUY2) { + if (format == XINE_IMGFMT_YUY2) { int i, image_size; /* calculate pitch and size including black bars */ @@ -614,7 +615,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge frame->swap_fields = this->swap_fields; } -static void dxr3_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) +static void dxr3_overlay_begin(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -632,14 +633,14 @@ static void dxr3_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, int this->spu_enc->overlay = NULL; } -static void dxr3_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, +static void dxr3_overlay_blend(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { if (frame_gen->format != IMGFMT_MPEG) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; if (overlay->rle) { - if (frame_gen->format == IMGFMT_YV12) + if (frame_gen->format == XINE_IMGFMT_YV12) blend_yuv(frame->vo_frame.base, overlay, frame->vo_frame.width, frame->vo_frame.height); else blend_yuy2(frame->vo_frame.base[0], overlay, frame->vo_frame.width, frame->vo_frame.height); @@ -652,7 +653,7 @@ static void dxr3_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, } } -static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) +static void dxr3_overlay_end(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; em8300_button_t btn; @@ -726,7 +727,7 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) pthread_mutex_unlock(&this->spu_device_lock); } -static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) +static void dxr3_display_frame(xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; @@ -737,14 +738,14 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) frame->aspect = this->aspect; frame->pan_scan = 0; switch (frame->vo_frame.ratio) { - case XINE_ASPECT_RATIO_SQUARE: - case XINE_ASPECT_RATIO_4_3: + case XINE_VO_ASPECT_SQUARE: + case XINE_VO_ASPECT_4_3: frame->aspect = ASPECT_FULL; break; - case XINE_ASPECT_RATIO_PAN_SCAN: + case XINE_VO_ASPECT_PAN_SCAN: if (!this->overlay_enabled) frame->pan_scan = 1; - case XINE_ASPECT_RATIO_ANAMORPHIC: - case XINE_ASPECT_RATIO_211_1: + case XINE_VO_ASPECT_ANAMORPHIC: + case XINE_VO_ASPECT_DVB: frame->aspect = ASPECT_ANAMORPHIC; } } @@ -774,7 +775,7 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) } } -static int dxr3_redraw_needed(vo_driver_t *this_gen) +static int dxr3_redraw_needed(xine_vo_driver_t *this_gen) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -782,7 +783,7 @@ static int dxr3_redraw_needed(vo_driver_t *this_gen) return 0; } -static int dxr3_get_property(vo_driver_t *this_gen, int property) +static int dxr3_get_property(xine_vo_driver_t *this_gen, int property) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -810,7 +811,7 @@ static int dxr3_get_property(vo_driver_t *this_gen, int property) return 0; } -static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) +static int dxr3_set_property(xine_vo_driver_t *this_gen, int property, int value) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; int val, bcs_changed = 0; @@ -906,15 +907,15 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) if (bcs_changed) { if (ioctl(this->fd_control, EM8300_IOCTL_SETBCS, &this->bcs)) printf("video_out_dxr3: bcs set failed (%s)\n", strerror(errno)); - this->config->update_num(this->config, "dxr3.contrast", this->bcs.contrast); - this->config->update_num(this->config, "dxr3.saturation", this->bcs.saturation); - this->config->update_num(this->config, "dxr3.brightness", this->bcs.brightness); + this->xine->config->update_num(this->xine->config, "dxr3.contrast", this->bcs.contrast); + this->xine->config->update_num(this->xine->config, "dxr3.saturation", this->bcs.saturation); + this->xine->config->update_num(this->xine->config, "dxr3.brightness", this->bcs.brightness); } return value; } -static void dxr3_get_property_min_max(vo_driver_t *this_gen, int property, +static void dxr3_get_property_min_max(xine_vo_driver_t *this_gen, int property, int *min, int *max) { switch (property) { @@ -930,7 +931,7 @@ static void dxr3_get_property_min_max(vo_driver_t *this_gen, int property, } } -static int dxr3_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *data) +static int dxr3_gui_data_exchange(xine_vo_driver_t *this_gen, int data_type, void *data) { #ifdef HAVE_X11 dxr3_driver_t *this = (dxr3_driver_t *)this_gen; @@ -938,17 +939,17 @@ static int dxr3_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *da if (!this->overlay_enabled && !this->tv_switchable) return 0; switch (data_type) { - case GUI_DATA_EX_EXPOSE_EVENT: + case XINE_GUI_SEND_EXPOSE_EVENT: this->need_redraw = 1; dxr3_overlay_update(this); break; - case GUI_DATA_EX_DRAWABLE_CHANGED: + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->win = (Drawable)data; XFreeGC(this->display, this->gc); this->gc = XCreateGC(this->display, this->win, 0, NULL); dxr3_set_property(this_gen, VO_PROP_ASPECT_RATIO, this->aspect); break; - case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: { int x1, y1, x2, y2; x11_rectangle_t *rect = data; @@ -960,7 +961,7 @@ static int dxr3_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *da rect->h = y2 - y1; } break; - case GUI_DATA_EX_VIDEOWIN_VISIBLE: + case XINE_GUI_SEND_VIDEOWIN_VISIBLE: { int window_showing = (int)data; int val; @@ -989,7 +990,7 @@ static int dxr3_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *da return 0; } -static void dxr3_exit(vo_driver_t *this_gen) +static void dxr3_exit(xine_vo_driver_t *this_gen) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; int val = EM8300_OVERLAY_MODE_OFF; @@ -1374,7 +1375,7 @@ static int is_fullscreen(dxr3_driver_t *this) } -static void dxr3_update_add_bars(void *data, cfg_entry_t *entry) +static void dxr3_update_add_bars(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->add_bars = entry->num_value; @@ -1382,7 +1383,7 @@ static void dxr3_update_add_bars(void *data, cfg_entry_t *entry) (this->add_bars ? "on" : "off")); } -static void dxr3_update_swap_fields(void *data, cfg_entry_t *entry) +static void dxr3_update_swap_fields(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->swap_fields = entry->num_value; @@ -1390,7 +1391,7 @@ static void dxr3_update_swap_fields(void *data, cfg_entry_t *entry) (this->swap_fields ? "on" : "off")); } -static void dxr3_update_enhanced_mode(void *data, cfg_entry_t *entry) +static void dxr3_update_enhanced_mode(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->enhanced_mode = entry->num_value; diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index ae6e7f6a1..733be297f 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.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: video_out_dxr3.h,v 1.9 2002/08/17 14:30:10 mroi Exp $ + * $Id: video_out_dxr3.h,v 1.10 2002/09/05 12:52:24 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -69,8 +69,8 @@ typedef struct dxr3_overlay_s { } dxr3_overlay_t; typedef struct dxr3_driver_s { - vo_driver_t vo_driver; - config_values_t *config; + xine_vo_driver_t vo_driver; + xine_t *xine; char devname[128]; char devnum[3]; |