summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-05-16 15:32:03 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-05-16 15:32:03 +0000
commit7123b57cd37715baec8db83e1eec5d100443cab5 (patch)
tree8fccaeef9c55002d99a7612817033273df4dae39
parent00d21a2b2994e685bc7ae4eb19186ad9c01de359 (diff)
downloadxine-lib-7123b57cd37715baec8db83e1eec5d100443cab5.tar.gz
xine-lib-7123b57cd37715baec8db83e1eec5d100443cab5.tar.bz2
finished video window realted code removal
CVS patchset: 73 CVS date: 2001/05/16 15:32:03
-rw-r--r--include/xine.h.tmpl.in144
-rw-r--r--src/video_out/video_out_x11.h20
-rw-r--r--src/video_out/video_out_xv.c163
-rw-r--r--src/xine-engine/video_out.c39
-rw-r--r--src/xine-engine/xine.c88
5 files changed, 113 insertions, 341 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in
index addb3f478..0f9175327 100644
--- a/include/xine.h.tmpl.in
+++ b/include/xine.h.tmpl.in
@@ -29,7 +29,7 @@
\endverbatim
*/
/*
- * $Id: xine.h.tmpl.in,v 1.14 2001/05/03 23:26:40 f1rmb Exp $
+ * $Id: xine.h.tmpl.in,v 1.15 2001/05/16 15:32:03 guenter Exp $
*
*/
@@ -286,148 +286,6 @@ int xine_get_spu_channel (xine_t *this);
*/
void xine_select_spu_channel (xine_t *this, int channel);
-/**
- * \fn void *xine_get_output_window(xine_t *this);
- * \brief Get the output window.
- * \param this Current xine engine configuration ( #see xine_init() )
- * \return Return output window as void pointer.
- *
- * Get whatever is usefull to contact the window/video output
- * (mostly usefull for the gui if it wants to access
- * the video output window). The calling application should
- * cast the void pointer to desired type.
- */
-void *xine_get_window_output(xine_t *this);
-
-#define VO_CAP_HUE 0x00000010 /* driver can set HUE value */
-#define VO_CAP_SATURATION 0x00000020 /* driver can set SATURATION value*/
-#define VO_CAP_BRIGHTNESS 0x00000040 /* driver can set BRIGHTNESS value*/
-#define VO_CAP_CONTRAST 0x00000080 /* driver can set CONTRAST value */
-#define VO_CAP_COLORKEY 0x00000100 /* driver can set COLORKEY value */
-
-/**
- * \fn uint32_t xine_get_window_capabilities(xine_t *this);
- * \brief
- * \param
- * \return
- *
- *
- */
-uint32_t xine_get_window_capabilities(xine_t *this);
-
-#define VO_PROP_WINDOW_VISIBLE 0
-#define VO_PROP_CURSOR_VISIBLE 1
-#define VO_PROP_FULLSCREEN 2
-#define VO_PROP_INTERLACED 3
-#define VO_PROP_ASPECT_RATIO 4
-#define VO_PROP_HUE 5
-#define VO_PROP_SATURATION 6
-#define VO_PROP_CONTRAST 7
-#define VO_PROP_BRIGHTNESS 8
-#define VO_PROP_COLORKEY 9
-#define VO_NUM_PROPERTIES 10
-
-/**
- * \fn int xine_get_window_property(xine_t *this, int property);
- * \brief
- * \param
- * \return
- *
- *
- */
-int xine_get_window_property(xine_t *this, int property);
-
-/**
- * \fn int xine_set_window_property(xine_t *this, int property, int value);
- * \brief
- * \param
- * \return
- *
- *
- */
-int xine_set_window_property(xine_t *this, int property, int value);
-
-/**
- * \fn void xine_get_window_property_min_max(xine_t *this, int property, int *min, int *max);
- * \brief
- * \param
- * \return
- *
- *
- */
-void xine_get_window_property_min_max(xine_t *this, int property, int *min, int *max);
-
-/**
- * \fn void xine_window_handle_event(xine_t *this, void *event);
- * \brief
- * \param
- * \return
- *
- *
- */
-void xine_window_handle_event(xine_t *this, void *event);
-
-/**
- * \fn void xine_set_window_fullscreen(xine_t *this, int fullscreen);
- * \brief
- * \param
- * \return
- *
- *
- */
-void xine_set_window_fullscreen(xine_t *this, int fullscreen);
-
-/**
- * \fn int xine_get_window_fullscreen(xine_t *this);
- * \brief
- * \param
- * \return
- *
- *
- */
-int xine_get_window_fullscreen(xine_t *this);
-
-/**
- * \fn void xine_set_window_visible(xine_t *this, int visible);
- * \brief
- * \param
- * \return
- *
- *
- */
-void xine_set_window_visible(xine_t *this, int visible);
-
-/**
- * \fn int xine_get_window_visible(xine_t *this);
- * \brief
- * \param
- * \return
- *
- *
- */
-int xine_get_window_visible(xine_t *this);
-
-/**
- * \fn void xine_set_display_cursor(xine_t *this, int show);
- * \brief
- * \param
- * \return
- *
- *
- */
-void xine_set_display_cursor(xine_t *this, int show);
-
-/**
- * \fn int xine_get_display_cursor(xine_t *this);
- * \brief
- * \param
- * \return
- *
- *
- */
-int xine_get_display_cursor(xine_t *this);
-
-/** @} end of xine_management_api */
/**
* @defgroup browsegroup Browsing support
diff --git a/src/video_out/video_out_x11.h b/src/video_out/video_out_x11.h
index 62a15211f..424cf7380 100644
--- a/src/video_out/video_out_x11.h
+++ b/src/video_out/video_out_x11.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_x11.h,v 1.1 2001/05/08 23:00:03 guenter Exp $
+ * $Id: video_out_x11.h,v 1.2 2001/05/16 15:32:03 guenter Exp $
*
* structs and defines specific to all x11 related output plugins
* (any x11 base xine ui should include this)
@@ -26,6 +26,13 @@
#ifndef HAVE_VIDEO_OUT_X11_H
#define HAVE_VIDEO_OUT_X11_H
+typedef struct {
+
+ /* area of that drawable to be used by video */
+ int x,y,w,h;
+
+} x11_rectangle_t;
+
/*
* this is the visual data struct any x11 gui should supply
* (pass this to init_video_out_plugin or the xine_load_video_output_plugin
@@ -43,7 +50,7 @@ typedef struct {
Drawable d;
/* area of that drawable to be used by video */
- int x,y,w,h;
+ x11_rectangle_t dest_area;
/*
* calc dest size
@@ -70,9 +77,9 @@ typedef struct {
* preserving aspect ration and stuff).
*/
- void (*reques_dest_size) (int video_width, int video_height,
- int *dest_x, int *dest_y,
- int *dest_height, int *dest_width);
+ void (*request_dest_size) (int video_width, int video_height,
+ int *dest_x, int *dest_y,
+ int *dest_width, int *dest_height);
} x11_visual_t;
@@ -80,9 +87,10 @@ typedef struct {
* constants for gui_data_exhange's data_type parameter
*/
+/* x11_rectangle_t *data */
#define GUI_DATA_EX_DEST_POS_SIZE_CHANGED 0
+/* xevent *data */
#define GUI_DATA_EX_COMPLETION_EVENT 1
#endif
-
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 45b83725b..70cbf524e 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.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_xv.c,v 1.14 2001/05/08 23:00:03 guenter Exp $
+ * $Id: video_out_xv.c,v 1.15 2001/05/16 15:32:03 guenter Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -42,14 +42,12 @@
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
-#ifdef HAVE_XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "monitor.h"
#include "video_out.h"
@@ -88,6 +86,7 @@ typedef struct xv_driver_s {
/* X11 / Xv related stuff */
Display *display;
int screen;
+ Drawable drawable;
unsigned int xv_format_rgb, xv_format_yv12, xv_format_yuy2;
XVisualInfo vinfo;
GC gc;
@@ -109,7 +108,13 @@ typedef struct xv_driver_s {
int output_yoffset;
/* display anatomy */
- double display_ratio; /* calced from display resolution */
+ double display_ratio; /* given by visual parameter from init function */
+
+ /* gui callback */
+
+ void (*request_dest_size) (int video_width, int video_height,
+ int *dest_x, int *dest_y,
+ int *dest_height, int *dest_width);
} xv_driver_t;
@@ -235,9 +240,34 @@ static void xv_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen
frame->ratio_code = ratio_code;
}
+static void xv_adapt_to_output_area (xv_driver_t *this, int dest_x, int dest_y, int dest_width, int dest_height) {
+
+ /*
+ * make the frames fit into the given destination area
+ */
+
+ if ( ((double) dest_width / this->ratio_factor) < dest_height ) {
+
+ this->output_width = dest_width ;
+ this->output_height = (double) dest_width / this->ratio_factor ;
+ this->output_xoffset = dest_x;
+ this->output_yoffset = dest_y + (dest_height - this->output_height) / 2;
+
+ } else {
+
+ this->output_width = (double) dest_height * this->ratio_factor ;
+ this->output_height = dest_height;
+ this->output_xoffset = dest_x + (dest_width - this->output_width) / 2;
+ this->output_yoffset = dest_y;
+ }
+}
+
static void xv_calc_format (xv_driver_t *this, int width, int height, int ratio_code) {
double image_ratio, desired_ratio;
+ double corr_factor;
+ int ideal_width, ideal_height;
+ int dest_x, dest_y, dest_width, dest_height;
this->delivered_width = width;
this->delivered_height = height;
@@ -284,51 +314,35 @@ static void xv_calc_format (xv_driver_t *this, int width, int height, int ratio_
/* this->ratio_factor = display_ratio * desired_ratio / image_ratio ; */
this->ratio_factor = this->display_ratio * desired_ratio;
-
/*
- * calc output frame size
+ * calc ideal output frame size
*/
- if (this->props[VO_PROP_FULLSCREEN].value) {
-
- if ( ((double) this->fullscreen_width / this->ratio_factor) < this->fullscreen_height ) {
-
- this->output_width = this->fullscreen_width ;
- this->output_height = (double) this->fullscreen_width / this->ratio_factor ;
- this->output_xoffset = 0;
- this->output_yoffset = (this->fullscreen_height - this->output_height) / 2;
-
- } else {
-
- this->output_width = (double) this->fullscreen_height * this->ratio_factor ;
- this->output_height = this->fullscreen_height;
- this->output_xoffset = (this->fullscreen_width - this->output_width) / 2;
- this->output_yoffset = 0;
- }
-
- } else {
-
- double corr_factor = this->ratio_factor / image_ratio ;
+ corr_factor = this->ratio_factor / image_ratio ;
+ if (corr_factor >= 1.0) {
+ ideal_width = this->delivered_width * corr_factor;
+ ideal_height = this->delivered_height ;
+ }
+ else {
+ ideal_width = this->delivered_width;
+ ideal_height = this->delivered_height / corr_factor;
+ }
- if (corr_factor >= 1.0) {
- this->output_width = this->delivered_width * corr_factor;
- this->output_height = this->delivered_height ;
- }
- else {
- this->output_width = this->delivered_width;
- this->output_height = this->delivered_height / corr_factor;
- }
+ /* little hack to zoom mpeg1 / other small streams by default*/
+ if (ideal_width<400) {
+ ideal_width *=2;
+ ideal_height *=2;
+ }
- /* little hack to zoom mpeg1 / other small streams by default*/
- if (this->output_width<600) {
- this->output_width *=2;
- this->output_height *=2;
- }
+ /*
+ * ask gui to adapt to this size
+ */
- this->output_xoffset = 0;
- this->output_yoffset = 0;
- }
+ this->request_dest_size (ideal_width, ideal_height,
+ &dest_x, &dest_y, &dest_width, &dest_height);
+
+ xv_adapt_to_output_area (this, dest_x, dest_y, dest_width, dest_height);
}
static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
@@ -340,12 +354,11 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
|| (frame->ratio_code != this->delivered_ratio_code) ) {
xv_calc_format (this, frame->width, frame->height, frame->ratio_code);
- xv_setup_window (this);
}
XLockDisplay (this->display);
- XvShmPutImage(this->display, this->xv_port, this->window, this->gc, frame->image,
+ XvShmPutImage(this->display, this->xv_port, this->drawable, this->gc, frame->image,
0, 0, frame->width, frame->height,
this->output_xoffset, this->output_yoffset,
this->output_width, this->output_height, False);
@@ -389,17 +402,13 @@ static int xv_set_property (vo_driver_t *this_gen,
return this->props[property].value;
} else {
switch (property) {
- case VO_PROP_FULLSCREEN:
- this->props[property].value = value;
- xv_setup_window(this);
- break;
case VO_PROP_INTERLACED:
this->props[property].value = value;
- printf("VO_PROP_INTERLACED(%d)\n", this->props[property].value);
+ printf("video_out_xv: VO_PROP_INTERLACED(%d)\n", this->props[property].value);
break;
case VO_PROP_ASPECT_RATIO:
this->props[property].value = value;
- printf("VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value);
+ printf("video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value);
break;
}
}
@@ -416,8 +425,27 @@ static void xv_get_property_min_max (vo_driver_t *this_gen,
*max = this->props[property].max;
}
-static void xv_gui_data_exchange (vo_driver_t *this, int data_type, void *data) {
- /* FIXME : implement */
+static int xv_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) {
+
+ xv_driver_t *this = (xv_driver_t *) this_gen;
+ x11_rectangle_t *area;
+
+ switch (data_type) {
+ case GUI_DATA_EX_DEST_POS_SIZE_CHANGED:
+
+ area = (x11_rectangle_t *) data;
+
+ xv_adapt_to_output_area (this, area->x, area->y, area->w, area->h);
+
+ break;
+ case GUI_DATA_EX_COMPLETION_EVENT:
+
+ /* FIXME : implement */
+
+ break;
+ }
+
+ return 0;
}
static void xv_exit (vo_driver_t *this_gen) {
@@ -463,7 +491,6 @@ static void xv_check_capability (xv_driver_t *this,
xv_set_property (&this->vo_driver, property, this->config->lookup_int (this->config, str_prop, nDefault) );
}
-
vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
xv_driver_t *this;
@@ -475,14 +502,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
XvAdaptorInfo *adaptor_info;
XvImageFormatValues *fo;
int nattr;
- double res_h, res_v;
- XColor ignored;
- int dummy_a, dummy_b;
x11_visual_t *visual;
-#ifdef HAVE_XINERAMA
- int screens;
- XineramaScreenInfo *screeninfo = NULL;
-#endif
visual = (x11_visual_t *) visual_gen;
@@ -545,12 +565,19 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
memset (this, 0, sizeof(xv_driver_t));
- this->display = display;
- this->screen = visual->screen;
- this->xv_port = xv_port;
- this->capabilities = 0;
- this->config = config;
- this->display_ratio = visual->display_ratio;
+ this->config = config;
+ this->display = visual->display;
+ this->screen = visual->screen;
+ this->display_ratio = visual->display_ratio;
+ this->request_dest_size = visual->request_dest_size;
+ this->output_xoffset = visual->dest_area.x;
+ this->output_yoffset = visual->dest_area.y;
+ this->output_width = visual->dest_area.w;
+ this->output_height = visual->dest_area.h;
+ this->drawable = visual->d;
+ this->gc = XCreateGC (this->display, this->drawable, 0, NULL);
+ this->xv_port = xv_port;
+ this->capabilities = 0;
this->vo_driver.get_capabilities = xv_get_capabilities;
this->vo_driver.alloc_frame = xv_alloc_frame;
@@ -559,7 +586,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
this->vo_driver.get_property = xv_get_property;
this->vo_driver.set_property = xv_set_property;
this->vo_driver.get_property_min_max = xv_get_property_min_max;
- this->vo_driver.gui_data_exchange = xv_data_exchange;
+ this->vo_driver.gui_data_exchange = xv_gui_data_exchange;
this->vo_driver.exit = xv_exit;
/*
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index c13fbf16d..b42660434 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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.c,v 1.3 2001/05/03 22:20:45 f1rmb Exp $
+ * $Id: video_out.c,v 1.4 2001/05/16 15:32:04 guenter Exp $
*
*/
@@ -28,6 +28,7 @@
#include <signal.h>
#include <sys/time.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include "video_out.h"
@@ -249,7 +250,6 @@ static void vo_open (vo_instance_t *this) {
if (!this->video_loop_running) {
this->video_loop_running = 1;
- this->driver->set_logo_mode (this->driver, 0);
pthread_create (&this->video_thread, NULL, video_out_loop, this) ;
} else
printf ("video_out: vo_open : warning! video thread already running\n");
@@ -292,8 +292,6 @@ static void vo_close (vo_instance_t *this) {
this->video_loop_running = 0;
pthread_join (this->video_thread, &p);
}
-
- this->driver->set_logo_mode (this->driver, 1);
}
static void vo_free_img_buffers (vo_instance_t *this) {
@@ -319,33 +317,6 @@ static void vo_exit (vo_instance_t *this) {
}
-static void *vo_get_window(vo_instance_t *this) {
- return this->driver->get_window (this->driver);
-}
-
-static uint32_t vo_get_capabilities (vo_instance_t *this) {
- return this->driver->get_capabilities (this->driver);
-}
-
-static int vo_get_property (vo_instance_t *this, int property) {
- return this->driver->get_property (this->driver, property);
-}
-
-static int vo_set_property (vo_instance_t *this, int property,
- int value) {
- return this->driver->set_property (this->driver, property, value);
-}
-
-static void vo_get_property_min_max (vo_instance_t *this,
- int property,
- int *min, int *max) {
- this->driver->get_property_min_max (this->driver, property, min, max);
-}
-
-static void vo_handle_event (vo_instance_t *this, void *event) {
- this->driver->handle_event (this->driver, event);
-}
-
static void vo_frame_displayed (vo_frame_t *img) {
pthread_mutex_lock (&img->mutex);
@@ -445,16 +416,10 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
this->driver = driver;
this->metronom = metronom;
- this->get_capabilities = vo_get_capabilities;
this->open = vo_open;
this->get_frame = vo_get_frame;
this->close = vo_close;
this->exit = vo_exit;
- this->get_window = vo_get_window;
- this->get_property = vo_get_property;
- this->set_property = vo_set_property;
- this->get_property_min_max = vo_get_property_min_max;
- this->handle_event = vo_handle_event;
this->num_frames_delivered = 0;
this->num_frames_skipped = 0;
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 06586e223..20b9fe195 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.15 2001/05/07 01:31:44 f1rmb Exp $
+ * $Id: xine.c,v 1.16 2001/05/16 15:32:04 guenter Exp $
*
* top-level xine functions
*
@@ -531,89 +531,3 @@ int xine_get_status(xine_t *this) {
return this->status;
}
-uint32_t xine_get_window_capabilities(xine_t *this) {
-
- return (this->video_out->get_capabilities(this->video_out));
-}
-/*
- *
- */
-void *xine_get_window_output(xine_t *this) {
-
- return (this->video_out->get_window(this->video_out));
-}
-
-/*
- *
- */
-int xine_get_window_property(xine_t *this, int property) {
-
- return (this->video_out->get_property(this->video_out, property));
-}
-
-/*
- *
- */
-int xine_set_window_property(xine_t *this, int property, int value) {
-
- return (this->video_out->set_property(this->video_out, property, value));
-}
-
-/*
- *
- */
-void xine_get_window_property_min_max(xine_t *this,
- int property, int *min, int *max) {
-
- this->video_out->get_property_min_max(this->video_out, property, min, max);
-}
-
-/*
- *
- */
-void xine_window_handle_event(xine_t *this, void *event) {
-
- this->video_out->handle_event(this->video_out, event);
-}
-
-/*
- *
- */
-void xine_set_window_fullscreen(xine_t *this, int fullscreen) {
-
- xine_set_window_property(this, VO_PROP_FULLSCREEN, fullscreen);
-}
-
-/*
- *
- */
-int xine_get_window_fullscreen(xine_t *this) {
-
- return (xine_get_window_property(this, VO_PROP_FULLSCREEN));
-}
-
-/*
- *
- */
-void xine_set_window_visible(xine_t *this, int visible) {
-
- xine_set_window_property(this, VO_PROP_WINDOW_VISIBLE, visible);
-}
-
-/*
- *
- */
-int xine_get_window_visible(xine_t *this) {
-
- return (xine_get_window_property(this, VO_PROP_WINDOW_VISIBLE));
-}
-
-void xine_set_display_cursor(xine_t *this, int show) {
-
- xine_set_window_property(this, VO_PROP_CURSOR_VISIBLE, show);
-}
-
-int xine_get_display_cursor(xine_t *this) {
-
- return (xine_get_window_property(this, VO_PROP_CURSOR_VISIBLE));
-}