sinek/src gtkxine.c,1.3,1.4
[email protected] Sun, 05 Jan 2003 05:04:46 -0800
| Newsgroups | gmane.comp.video.sinek.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/sinek/sinek/src
In directory sc8-pr-cvs1:/tmp/cvs-serv10925/src
Modified Files:
gtkxine.c
Log Message:
alright, i couldn't sleep; segv now fixed.
Index: gtkxine.c
===================================================================
RCS file: /cvsroot/sinek/sinek/src/gtkxine.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gtkxine.c 5 Jan 2003 12:07:17 -0000 1.3
+++ gtkxine.c 5 Jan 2003 13:04:44 -0000 1.4
@@ -39,7 +39,8 @@
x11_visual_t visual;
int video_width, video_height;
- /* 1.0.0 API */
+ /* x11 specific stuff */
+ char *display_name;
};
static void default_warning_cb (const char *msg)
@@ -63,6 +64,7 @@
xine->error_cb = default_error_cb;
xine->video_win_title = g_strdup ("Xine Video Output");
+ xine->display_name = NULL;
/* XXX: is this correct? */
gtk_set_locale ();
@@ -499,9 +501,109 @@
return name;
}
-const char *gtk_xine_set_video_driver (GtkXine *xine, const char *name)
+#if 0
+static int do_x11_best_visual (GtkXine *xine, Display *display)
+{
+ XVisualInfo *vi, tmpl;
+ int nr, depth, prf, best_prf = -1;
+ Visual *visual;
+
+ tmpl.screen = DefaultScreen (display);
+ tmpl.class = TrueColor;
+
+ vi = XGetVisualInfo (display, VisualScreenMask | VisualClassMask, &tmpl, &nr);
+ if (vi) {
+ for (i = 0; i < nr; i++) {
+ if (vi[i].depth > 8 && vi[i].depth <= 16)
+ prf = 3;
+ else if (vi[i].depth > 16)
+ prf = 2;
+ else
+ prf = 1;
+
+ if (prf > best_prf) {
+ depth = vi[i].depth;
+ visual = vi[i].visual;
+ }
+ }
+ XFree (vi);
+ }
+ if (best_prf == -1) {
+
+ ...
+
+
+ }
+}
+static int do_x11_voodoo (GtkXine *xine)
+{
+ Display *display;
+ int screen, fd;
+
+ if (!xine->display_name)
+ xine->display_name = gdk_get_display ();
+ display = XOpenDisplay (xine->display_name);
+ if (!display) {
+ char *t = g_strconcat (_("cannot connect to display '%s'."), xine->display_name, NULL);
+ xine->error_cb (t);
+ g_free (t);
+ return 1;
+ }
+ XLockDisplay (display);
+ screen = DefaultScreen (display);
+ fd = ConnectionNumber (display);
+
+
+}
+#endif
+
+static void frame_output_cb (void *user_data, int vid_w, int vid_h, double vidp_aspect, int *dest_x, int *dest_y, int *dest_w, int *dest_h, double *dest_vidp_aspect, int *win_x, int *win_y)
+{
+ /*GtkXine *xine = GTK_XINE (user_data);*/
+ g_print ("%s(): unimplemented\n", __FUNCTION__);
+ *dest_x = *dest_y = *dest_h = *dest_w = *win_x = *win_y = 0;
+ *dest_vidp_aspect = 1.0;
+}
+
+static void dest_size_cb (void *user_data, int vid_w, int vid_h, double vidp_aspect, int *dest_w, int *dest_h, double *dest_vidp_aspect)
+{
+ g_print ("%s(): unimplemented\n", __FUNCTION__);
+ *dest_w = *dest_h = 0;
+ *dest_vidp_aspect = 1.0;
+}
+
+static void do_x11_voodoo (GtkXine *xine, x11_visual_t *vis)
+{
+ GtkWidget *videowin = gtk_drawing_area_new ();
+ gtk_widget_realize (videowin);
+
+ /* TODO:
+ * GtkRequisition req;
+ * GdkVisual *visual;
+ * gtk_widget_size_request (videowin, &req);
+ * width = req.width;
+ * height = req.height;
+ * visual = gdk_drawable_get_visual (videowin->window);
+ */
+ /*
+ visual.display = GDK_WINDOW_XDISPLAY (video_area->window);
+ visual.screen = gdk_x11_get_default_screen ();
+ visual.d = GDK_WINDOW_XWINDOW (video_area->window);
+
+*/
+ vis->display = gdk_x11_drawable_get_xdisplay (videowin->window);
+ vis->screen = gdk_x11_get_default_screen ();
+ vis->d = gdk_x11_drawable_get_xid (videowin->window);
+ vis->user_data = (void *) xine;
+ vis->dest_size_cb = dest_size_cb;
+ vis->frame_output_cb = frame_output_cb;
+
+}
+
+const char *gtk_xine_set_x11_video_driver (GtkXine *xine, const char *name)
{
const char *const *driver_ids;
+ x11_visual_t vis;
int i;
if (xine->vo_driver) {
@@ -511,14 +613,17 @@
if (strcmp (name, "null") == 0)
return name;
+
+ do_x11_voodoo (xine, &vis);
+
if (strcmp (name, "auto") != 0)
- xine->vo_driver = xine_open_video_driver (xine->xine, name, XINE_VISUAL_TYPE_X11, NULL);
+ xine->vo_driver = xine_open_video_driver (xine->xine, name, XINE_VISUAL_TYPE_X11, &vis);
if (xine->vo_driver == NULL) {
/* autodetect */
driver_ids = xine_list_video_output_plugins (xine->xine);
for (i = 0; driver_ids[i] != NULL; i++) {
- xine->vo_driver = xine_open_video_driver (xine->xine, driver_ids[i], XINE_VISUAL_TYPE_X11, NULL); /* TODO: pass a visual type struct */
+ xine->vo_driver = xine_open_video_driver (xine->xine, driver_ids[i], XINE_VISUAL_TYPE_X11, &vis);
if (xine->vo_driver) {
name = (const char *) driver_ids[i];
break;
@@ -683,7 +788,7 @@
w = gtk_xine_new ();
gtk_xine_config_load (GTK_XINE (w), rcfile ());
g_print ("Loaded audio driver '%s'\n", gtk_xine_set_audio_driver (GTK_XINE (w), "auto"));
- g_print ("Loaded video driver '%s'\n", gtk_xine_set_video_driver (GTK_XINE (w), "auto"));
+ g_print ("Loaded video driver '%s'\n", gtk_xine_set_x11_video_driver (GTK_XINE (w), "auto"));
gtk_main();
gtk_widget_destroy (w);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf