sinek/src video.c,1.27,1.28
[email protected] Sat, 18 Jan 2003 21:57:42 -0800
| Newsgroups | gmane.comp.video.sinek.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/sinek/sinek/src
In directory sc8-pr-cvs1:/tmp/cvs-serv6906
Modified Files:
video.c
Log Message:
gtkxine changes
Index: video.c
===================================================================
RCS file: /cvsroot/sinek/sinek/src/video.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- video.c 3 Jan 2003 09:42:20 -0000 1.27
+++ video.c 19 Jan 2003 05:57:40 -0000 1.28
@@ -9,6 +9,7 @@
*/
#include "common.h"
+#include "gtkxine.h"
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
@@ -51,107 +52,21 @@
static gboolean handle_event(GIOChannel *gio, GIOCondition cond, gpointer data);
static GIOChannel *lala;
-
-static void frame_out_cb(void *user_data, sinek_x11_type *di)
-{
- sinek.vid_w = di->frame_w;
- sinek.vid_h = di->frame_h;
- di->out_x = 0;
- di->out_y = 0;
- di->out_w = di->win_w;
- di->out_h = di->win_h;
-}
-
-
-int video_init(void)
-{
- static unsigned char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- Pixmap bm_no;
- XColor dummy;
- int ret;
-
- if(sinek.video_display_name)
- {
- display = XOpenDisplay(sinek.video_display_name);
- if(!display)
- {
- printf("Cannot connect to display '%s'.\n", sinek.video_display_name);
- return 0;
- }
- XLockDisplay(display);
- screen = DefaultScreen(display);
- }
- else
- {
- display = XOpenDisplay(gdk_get_display());
- XLockDisplay(display);
- screen = gdk_x11_get_default_screen();
- }
- sinek.display = display;
- xfred = ConnectionNumber(display);
- find_best_visual();
- sinek.depth = depth;
-
- XAllocNamedColor(display, DefaultColormap(display, screen), "black", &black, &dummy);
-
- xc_hint = XAllocClassHint();
- if(xc_hint)
- {
- xc_hint->res_name = "video";
- xc_hint->res_class = "sinek";
- }
-/* wm_hint = XAllocWMHints();
- if(!wm_hint)
- {
- printf(_("XAllocWMHints failed.\n"));
- return 0;
- }
-*/
- wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
-
- lala = g_io_channel_unix_new(xfred);
- g_io_add_watch(lala, G_IO_IN, handle_event, NULL);
-
- bm_no = XCreateBitmapFromData(display, RootWindow(display, screen), bm_no_data, 8, 8);
- cursor[0] = XCreatePixmapCursor(display, bm_no, bm_no, &black, &black, 0, 0);
- cursor[1] = XCreateFontCursor(display, XC_left_ptr);
-
- sinek.vid_w = sinek.geo_w;
- sinek.vid_h = sinek.geo_h;
- video_set_mode(sinek.video_mode);
-
- display_info.display = display;
- display_info.screen = screen;
- display_info.drawable = videowin;
- display_info.frame_out_cb = frame_out_cb;
-
- ret = sinek_video_set_output(media, &display_info);
-
- XUnlockDisplay(display);
-
- return ret;
-}
-
-
void video_show(void)
{
- XMapWindow(display, videowin);
- XFlush(display);
+ gtk_widget_show(sinek.videowin);
if(video_visible != 1) sinek.nr_mapped++;
video_visible = 1;
}
-
void video_hide(void)
{
- XUnmapWindow(display, videowin);
- XFlush(display);
+ gtk_widget_hide(sinek.videowin);
if(video_visible == 1) sinek.nr_mapped--;
video_visible = 0;
if(0 == sinek.nr_mapped) gtk_main_quit();
}
-
void video_cursor(int show)
{
static int old = 2;
@@ -159,10 +74,13 @@
if(show == old) return;
old = show;
if(show == 1) sinek.cursor_timer = 0;
+#if 0
+ // TODO
XLockDisplay(display);
XDefineCursor(display, videowin, cursor[show]);
XFlush(display);
XUnlockDisplay(display);
+#endif
}
@@ -214,11 +132,11 @@
if(0 == ret) try_subtitle(mrl, ".srt");
}
- if(sinek_open(media, mrl))
+ if (gtk_xine_load(GTK_XINE(sinek.xine), mrl) && gtk_xine_play(GTK_XINE(sinek.xine)))
{
- int x, y, length;
+ int length;
- xine_get_pos_length(sinek.stream, &x, &y, &length);
+ length = gtk_xine_get_stream_length(GTK_XINE(sinek.xine));
scrsaver_disable();
control_update_slider(0, length);
control_mrl(mrl);
@@ -232,7 +150,7 @@
void video_seek(int secs)
{
scrsaver_disable();
- sinek_seek(media, secs);
+ gtk_xine_play_from_time(GTK_XINE(sinek.xine), secs);
}
@@ -243,52 +161,48 @@
if(val == 0)
{
/* reset zoom */
- tmp = xine_get_param(sinek.stream, XINE_PARAM_VO_ASPECT_RATIO);
- xine_set_param(sinek.stream, XINE_PARAM_VO_ASPECT_RATIO, tmp);
+ tmp = gtk_xine_get_aspect_ratio(GTK_XINE(sinek.xine));
+ gtk_xine_set_aspect_ratio(GTK_XINE(sinek.xine), tmp);
return;
}
else
{
- tmp = xine_get_param(sinek.stream, XINE_PARAM_VO_ZOOM_X);
- xine_set_param(sinek.stream, XINE_PARAM_VO_ZOOM_X, tmp + val);
- tmp = xine_get_param(sinek.stream, XINE_PARAM_VO_ZOOM_Y);
- xine_set_param(sinek.stream, XINE_PARAM_VO_ZOOM_Y, tmp + val);
+ tmp = gtk_xine_get_video_zoom_x(GTK_XINE(sinek.xine));
+ gtk_xine_set_video_zoom_x(GTK_XINE(sinek.xine), tmp + val);
+ tmp = gtk_xine_get_video_zoom_y(GTK_XINE(sinek.xine));
+ gtk_xine_set_video_zoom_y(GTK_XINE(sinek.xine), tmp + val);
}
}
void video_scale(float factor)
{
- int x, y;
- unsigned int w, h, b, d;
- Window root;
+ int x, y, w, h;
if(sinek.video_mode != VIDEO_WINDOW) return;
- XLockDisplay(display);
- XGetGeometry(display, videowin, &root, &x, &y, &w, &h, &b, &d);
+ gtk_xine_get_video_win_size(GTK_XINE(sinek.xine), &x, &y, &w, &h);
w *= factor;
h *= factor;
- XResizeWindow(display, videowin, w, h);
- XUnlockDisplay(display);
+ g_print("%s(): unimplemented!\n", __FUNCTION__);
+ /* TODO: send a configure signal to sinek.videowin
+ XResizeWindow(display, videowin, w, h); */
}
void video_scale_abs(float factor)
{
- int x, y;
- unsigned int w, h, b, d;
- Window root;
+ int x, y, w, h;
if(sinek.video_mode != VIDEO_WINDOW) return;
- XLockDisplay(display);
- XGetGeometry(display, videowin, &root, &x, &y, &w, &h, &b, &d);
+ gtk_xine_get_video_win_size(GTK_XINE(sinek.xine), &x, &y, &w, &h);
w = factor * sinek.vid_w;
h = factor * sinek.vid_h;
- XResizeWindow(display, videowin, w, h);
- XUnlockDisplay(display);
+/* TODO: send a configure signal to sinek.videowin
+ XResizeWindow(display, videowin, w, h); */
}
+#if 0
static gboolean handle_event(GIOChannel *gio, GIOCondition cond, gpointer data)
{
XEvent xev;
@@ -616,3 +530,4 @@
XSendEvent(disp, RootWindow(disp, screen), False, SubstructureNotifyMask, (XEvent *)&ev);
XRaiseWindow(disp, w);
}
+#endif
-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com - A 128-bit supercerts will
allow you to extend the highest allowed 128 bit encryption to all your
clients even if they use browsers that are limited to 40 bit encryption.
Get a guide here:http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0030en