diff options
Diffstat (limited to 'src/video_out/video_out_xvmc.c')
-rw-r--r-- | src/video_out/video_out_xvmc.c | 167 |
1 files changed, 40 insertions, 127 deletions
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 53d09b7d5..6aa8f430d 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -15,10 +15,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * $Id: video_out_xvmc.c,v 1.29 2007/03/25 23:07:23 dgp85 Exp $ - * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * * based on mpeg2dec code from @@ -68,15 +66,12 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> #include "accel_xvmc.h" -/* TODO - delete these? */ -#include "deinterlace.h" - -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> /* #define LOG1 */ /* #define DLOG */ @@ -198,11 +193,6 @@ struct xvmc_driver_s { double ratio_factor; /* output frame must fullfill: height = width * ratio_factor */ - - xvmc_frame_t deinterlace_frame; - int deinterlace_method; - int deinterlace_enabled; - /* gui callback */ void (*frame_output_cb) (void *user_data, @@ -489,9 +479,9 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, int second_field, xvmc_macroblocks_t *macroblocks) { xvmc_driver_t *this = (xvmc_driver_t *) current_image->driver; - xvmc_frame_t *current_frame = (xvmc_frame_t *) current_image; - xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image; - xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image; + xvmc_frame_t *current_frame = XVMC_FRAME(current_image); + xvmc_frame_t *forward_frame = XVMC_FRAME(forward_ref_image); + xvmc_frame_t *backward_frame = XVMC_FRAME(backward_ref_image); int flags; lprintf ("xvmc_render_macro_blocks\n"); @@ -564,6 +554,7 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { return NULL; frame->vo_frame.accel_data = &frame->xvmc_data; + frame->xvmc_data.vo_frame = &frame->vo_frame; /* keep track of frames and how many frames alocated. */ this->frames[this->num_frame_buffers++] = frame; @@ -766,6 +757,11 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; xine_xvmc_t *xvmc = (xine_xvmc_t *) frame_gen->accel_data; + if (format != XINE_IMGFMT_XVMC) { + xprintf (this->xine, XINE_VERBOSITY_LOG, "xvmc_update_frame_format: frame format %08x not supported\n", format); + _x_abort(); + } + lprintf ("xvmc_update_frame_format\n"); if ((frame->width != width) @@ -853,6 +849,8 @@ static void xvmc_overlay_blend (vo_driver_t *this_gen, _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); + else + xprintf (this->xine, XINE_VERBOSITY_LOG, "xvmc_overlay_blend: overlay blending not supported for frame format %08x\n", frame->format); } } @@ -966,24 +964,13 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { /* Make sure the surface has finished rendering before we display */ XvMCSyncSurface(this->display, &this->cur_frame->surface); - if (this->deinterlace_enabled && - (this->deinterlace_method == DEINTERLACE_ONEFIELD)) { - XvMCPutSurface(this->display, &this->cur_frame->surface, - this->drawable, - this->sc.displayed_xoffset, this->sc.displayed_yoffset, - this->sc.displayed_width, this->sc.displayed_height, - this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, - XVMC_TOP_FIELD); - } else { /* WEAVE */ - XvMCPutSurface(this->display, &this->cur_frame->surface, - this->drawable, - this->sc.displayed_xoffset, this->sc.displayed_yoffset, - this->sc.displayed_width, this->sc.displayed_height, - this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, - XVMC_FRAME_PICTURE); - } + XvMCPutSurface(this->display, &this->cur_frame->surface, + this->drawable, + this->sc.displayed_xoffset, this->sc.displayed_yoffset, + this->sc.displayed_width, this->sc.displayed_height, + this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height, + XVMC_FRAME_PICTURE); XUnlockDisplay (this->display); @@ -1004,6 +991,18 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } return this->props[property].value; @@ -1047,16 +1046,6 @@ static int xvmc_set_property (vo_driver_t *this_gen, } else { switch (property) { - case VO_PROP_INTERLACED: - this->props[property].value = value; - lprintf("VO_PROP_INTERLACED(%d)\n", this->props[property].value); - this->deinterlace_enabled = value; - - if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { - xvmc_compute_ideal_size (this); - } - break; - case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; @@ -1288,14 +1277,6 @@ static void xvmc_check_capability (xvmc_driver_t *this, this->props[property].value = int_default; } -static void xvmc_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { - xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - - lprintf ("xvmc_update_deinterlace method = %d\n",entry->num_value); - - this->deinterlace_method = entry->num_value; -} - static void xvmc_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; @@ -1366,7 +1347,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* TODO CLEAN UP THIS */ this->user_data = visual->user_data; - this->deinterlace_method = 0; this->use_colorkey = 0; this->colorkey = 0; @@ -1453,7 +1433,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi class->adaptor_info[class->adaptor_num].base_id, "XV_AUTOPAINT_COLORKEY", "video.device.xv_autopaint_colorkey", _("autopaint colour key"), - _("Make Xv autopaint its colorkey.")); + _("Make Xv autopaint its colour key.")); } else if(!strcmp(attr[k].name, "XV_DOUBLE_BUFFER")) { int xvmc_double_buffer; @@ -1517,65 +1497,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi dispose_ximage (this, &myshminfo, myimage); XUnLockDisplay(this->display); */ - - this->deinterlace_method = - config->register_enum (config, "video.output.xv_deinterlace_method", 4, - deinterlace_methods, - _("deinterlace method (deprecated)"), - _("This config setting is deprecated. You should use the new deinterlacing " - "post processing settings instead.\n\n" - "From the old days of analog television, where the even and odd numbered " - "lines of a video frame would be displayed at different times comes the " - "idea to increase motion smoothness by also recording the lines at " - "different times. This is called \"interlacing\". But unfortunately, " - "todays displays show the even and odd numbered lines as one complete frame " - "all at the same time (called \"progressive display\"), which results in " - "ugly frame errors known as comb artifacts. Software deinterlacing is an " - "approach to reduce these artifacts. The individual values are:\n\n" - "none\n" - "Disables software deinterlacing.\n\n" - "bob\n" - "Interpolates between the lines for moving parts of the image.\n\n" - "weave\n" - "Similar to bob, but with a tendency to preserve the full resolution, " - "better for high detail in low movement scenes.\n\n" - "greedy\n" - "Very good adaptive deinterlacer, but needs a lot of CPU power.\n\n" - "onefield\n" - "Always interpolates and reduces vertical resolution.\n\n" - "onefieldxv\n" - "Same as onefield, but does the interpolation in hardware.\n\n" - "linearblend\n" - "Applies a slight vertical blur to remove the comb artifacts. Good results " - "with medium CPU usage."), - 10, xvmc_update_deinterlace, this); - - this->deinterlace_enabled = 1; /* default is enabled */ - lprintf("deinterlace_methods %d ",this->deinterlace_method); - - switch(this->deinterlace_method) { - case DEINTERLACE_NONE: - lprintf("NONE\n"); - break; - case DEINTERLACE_BOB: - lprintf("BOB\n"); - break; - case DEINTERLACE_WEAVE: - lprintf("WEAVE\n"); - break; - case DEINTERLACE_GREEDY: - lprintf("GREEDY\n"); - break; - case DEINTERLACE_ONEFIELD: - lprintf("ONEFIELD\n"); - break; - case DEINTERLACE_ONEFIELDXV: - lprintf("ONEFIELDXV\n"); - break; - case DEINTERLACE_LINEARBLEND: - lprintf("LINEARBLEND\n"); - break; - } lprintf("initialization of plugin successful\n"); return &this->vo_driver; @@ -1585,14 +1506,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi * class functions */ -static char* get_identifier (video_driver_class_t *this_gen) { - return "XvMC"; -} - -static char* get_description (video_driver_class_t *this_gen) { - return _("xine video output plugin using the XvMC X video extension"); -} - static void dispose_class (video_driver_class_t *this_gen) { xvmc_class_t *this = (xvmc_class_t *) this_gen; @@ -1744,7 +1657,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { else { xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: using Xv port %ld from adaptor %s\n" - " for hardware colorspace conversion and scaling\n"), + " for hardware colour space conversion and scaling\n"), xv_port, adaptor_info[adaptor_num].name); if(IDCTaccel&XINE_VO_IDCT_ACCEL) @@ -1765,8 +1678,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { return NULL; this->driver_class.open_plugin = open_plugin; - this->driver_class.get_identifier = get_identifier; - this->driver_class.get_description = get_description; + this->driver_class.identifier = "XvMC"; + this->driver_class.description = N_("xine video output plugin using the XvMC X video extension"); this->driver_class.dispose = dispose_class; this->display = display; @@ -1798,7 +1711,7 @@ static const vo_info_t vo_info_xvmc = { const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 21, "xvmc", XINE_VERSION_CODE, &vo_info_xvmc, init_class }, + { PLUGIN_VIDEO_OUT, 22, "xvmc", XINE_VERSION_CODE, &vo_info_xvmc, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |