summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xine.h.in3
-rw-r--r--misc/xine-config.in7
-rw-r--r--src/video_out/Makefile.am16
-rw-r--r--src/video_out/macosx/Makefile.am21
-rw-r--r--src/video_out/macosx/video_window.h64
-rw-r--r--src/video_out/video_out_macosx.m355
-rw-r--r--src/video_out/video_out_none.c3
-rw-r--r--src/xine-engine/load_plugins.c7
8 files changed, 469 insertions, 7 deletions
diff --git a/include/xine.h.in b/include/xine.h.in
index 2baa7eeb5..e619fbe38 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -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.h.in,v 1.121 2004/05/05 09:11:38 hadess Exp $
+ * $Id: xine.h.in,v 1.122 2004/06/05 16:06:12 jcdutton Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -167,6 +167,7 @@ void xine_close_video_driver (xine_t *self, xine_video_port_t *driver);
#define XINE_VISUAL_TYPE_PM 6 /* used by the OS/2 port */
#define XINE_VISUAL_TYPE_DIRECTX 7 /* used by the win32/msvc port */
#define XINE_VISUAL_TYPE_CACA 8
+#define XINE_VISUAL_TYPE_MACOSX 9
/*
* free all resources, close all plugins, close engine.
diff --git a/misc/xine-config.in b/misc/xine-config.in
index a1ddb013c..d78125b04 100644
--- a/misc/xine-config.in
+++ b/misc/xine-config.in
@@ -21,6 +21,7 @@ Options:
[--datadir]
[--scriptdir]
[--localedir]
+ [--objcflags]
EOF
exit $1
}
@@ -76,6 +77,9 @@ while test $# -gt 0; do
--localedir)
echo_localedir=yes
;;
+ --objcflags)
+ echo_objcflags=yes
+ ;;
*)
usage 1 1>&2
;;
@@ -114,3 +118,6 @@ fi
if test "$echo_localedir" = "yes"; then
echo "@XINE_LOCALEPATH@"
fi
+if test "$echo_objcflags" = "yes"; then
+ echo "@OBJCFLAGS@"
+fi
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index acdfe1273..dca4fb711 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -1,8 +1,8 @@
include $(top_srcdir)/misc/Makefile.common
-SUBDIRS = libdha vidix
+SUBDIRS = libdha vidix macosx
-EXTRA_DIST = video_out_directfb.c video_out_opengl.c video_out_directx.c
+EXTRA_DIST = video_out_directfb.c video_out_opengl.c video_out_directx.c video_out_macosx.c
VIDIX_CFLAGS = -I$(top_builddir)/src/video_out/vidix \
-I$(top_srcdir)/src/video_out/vidix
@@ -70,6 +70,11 @@ if HAVE_DIRECTX
directx_module = xineplug_vo_out_directx.la
endif
+if HAVE_MACOSX_VIDEO
+macosx_module = xineplug_vo_out_macosx.la
+endif
+
+
# important:
#
# all xine video out plugins should be named
@@ -86,6 +91,7 @@ lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \
$(stk_module) \
$(directx_module) \
$(caca_module) \
+ $(macosx_module) \
xineplug_vo_out_none.la
xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \
@@ -159,5 +165,11 @@ xineplug_vo_out_none_la_SOURCES = video_out_none.c
xineplug_vo_out_none_la_LIBADD = $(XINE_LIB)
xineplug_vo_out_none_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
+xineplug_vo_out_macosx_la_SOURCES = alphablend.c video_out_macosx.m
+xineplug_vo_out_macosx_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \
+ $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) macosx/libxine_macosx_video.la
+xineplug_vo_out_macosx_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ -framework Cocoa -framework OpenGL -lobjc -umbrella AppKit
+xineplug_vo_out_macosx_la_OBJCFLAGS = $(OBJCFLAGS) $(AM_CFLAGS)
+
noinst_HEADERS = alphablend.h deinterlace.h video_out_syncfb.h \
yuv2rgb.h x11osd.h
diff --git a/src/video_out/macosx/Makefile.am b/src/video_out/macosx/Makefile.am
new file mode 100644
index 000000000..ad79199dd
--- /dev/null
+++ b/src/video_out/macosx/Makefile.am
@@ -0,0 +1,21 @@
+include $(top_srcdir)/misc/Makefile.common
+
+if HAVE_MACOSX_VIDEO
+
+AM_CFLAGS = $(X_CFLAGS) -DXINE_COMPILE \
+ $(SUNDGA_CFLAGS) $(SDL_CFLAGS) $(VIDIX_CFLAGS) \
+ $(AALIB_CFLAGS) $(MLIB_CFLAGS) $(LIBSTK_CFLAGS) \
+ $(DIRECTFB_CFLAGS) $(DIRECTX_CFLAGS) $(CACA_CFLAGS)
+
+macosx_module = xineplug_vo_out_macosx.la
+
+lib_LTLIBRARIES = libxine_macosx_video.la
+
+libxine_macosx_video_la_SOURCES = video_window.m
+libxine_macosx_video_la_LIBADD =
+libxine_macosx_video_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+libxine_macosx_video_la_OBJCFLAGS = $(OBJCFLAGS)
+
+include_HEADERS = video_window.h
+
+endif
diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h
new file mode 100644
index 000000000..d37859d93
--- /dev/null
+++ b/src/video_out/macosx/video_window.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2004 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * $Id:
+ *
+ */
+
+#include <Cocoa/Cocoa.h>
+
+@interface XineOpenGLView : NSOpenGLView {
+ int width, height;
+ char *texture_buffer;
+ unsigned long i_texture;
+ float f_x;
+ float f_y;
+ int initDone;
+ int isFullScreen;
+ NSOpenGLContext * opengl_context;
+ NSOpenGLContext * fullScreenContext;
+ NSOpenGLContext * currentContext;
+}
+
+- (void) drawQuad;
+- (void) drawRect: (NSRect) rect;
+- (void) goFullScreen;
+- (void) exitFullScreen;
+- (void) reshape;
+- (void) initTextures;
+- (void) reloadTexture;
+- (id) initWithFrame: (NSRect) frame;
+- (char *) getTextureBuffer;
+- (void) setVideoSize: (int) w: (int) h;
+
+@end
+
+
+@interface XineVideoWindow : NSWindow {
+ int width, height;
+ XineOpenGLView *openGLView;
+}
+
+- (void) setContentSize: (NSSize) size;
+- (void) displayTexture;
+- (XineOpenGLView *) getGLView;
+- (void) goFullScreen;
+- (void) exitFullScreen;
+
+@end
diff --git a/src/video_out/video_out_macosx.m b/src/video_out/video_out_macosx.m
new file mode 100644
index 000000000..68a9de836
--- /dev/null
+++ b/src/video_out/video_out_macosx.m
@@ -0,0 +1,355 @@
+/*
+ * Copyright (C) 2000-2003 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * $Id: video_out_macosx.m,v 1.1 2004/06/05 16:06:13 jcdutton Exp $
+ *
+ * This output driver makes use of xine's objective-c video_output
+ * classes located in the macosx folder.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "xine.h"
+#include "video_out.h"
+#include "xine_internal.h"
+#include "xineutils.h"
+#include "vo_scale.h"
+
+#include "macosx/video_window.h"
+
+typedef struct {
+ vo_frame_t vo_frame;
+ int width;
+ int height;
+ double ratio;
+ int format;
+ xine_t *xine;
+} macosx_frame_t;
+
+typedef struct {
+ vo_driver_t vo_driver;
+ config_values_t *config;
+ int ratio;
+ xine_t *xine;
+ XineVideoWindow *window;
+} macosx_driver_t;
+
+typedef struct {
+ video_driver_class_t driver_class;
+ config_values_t *config;
+ xine_t *xine;
+} macosx_class_t;
+
+
+static void free_framedata(macosx_frame_t* frame) {
+ if(frame->vo_frame.base[0]) {
+ free(frame->vo_frame.base[0]);
+ frame->vo_frame.base[0] = NULL;
+ frame->vo_frame.base[1] = NULL;
+ frame->vo_frame.base[2] = NULL;
+ }
+}
+
+static void macosx_frame_dispose(vo_frame_t *vo_frame) {
+ macosx_frame_t *frame = (macosx_frame_t *)vo_frame;
+ free_framedata(frame);
+ free (frame);
+}
+
+static void macosx_frame_field(vo_frame_t *vo_frame, int which_field) {
+ /* do nothing */
+}
+
+static uint32_t macosx_get_capabilities(vo_driver_t *vo_driver) {
+ /* both styles, country and western */
+ return VO_CAP_YV12 | VO_CAP_YUY2;
+}
+
+static vo_frame_t *macosx_alloc_frame(vo_driver_t *vo_driver) {
+ /* macosx_driver_t *this = (macosx_driver_t *) vo_driver; */
+ macosx_frame_t *frame;
+
+ frame = (macosx_frame_t *) xine_xmalloc(sizeof(macosx_frame_t));
+ if(!frame)
+ return NULL;
+
+ frame->vo_frame.base[0] = NULL;
+ frame->vo_frame.base[1] = NULL;
+ frame->vo_frame.base[2] = NULL;
+
+ frame->vo_frame.proc_slice = NULL;
+ frame->vo_frame.proc_frame = NULL;
+ frame->vo_frame.field = macosx_frame_field;
+ frame->vo_frame.dispose = macosx_frame_dispose;
+ frame->vo_frame.driver = vo_driver;
+
+ return (vo_frame_t *)frame;
+}
+
+static void macosx_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_frame,
+ uint32_t width, uint32_t height,
+ double ratio, int format, int flags) {
+ macosx_driver_t *this = (macosx_driver_t *) vo_driver;
+ macosx_frame_t *frame = (macosx_frame_t *) vo_frame;
+
+ if((frame->width != width) || (frame->height != height) || (frame->format != format)) {
+
+ free_framedata(frame);
+
+ frame->width = width;
+ frame->height = height;
+ frame->format = format;
+
+ switch(format) {
+
+ case XINE_IMGFMT_YV12:
+ {
+ int y_size, uv_size;
+
+ frame->vo_frame.pitches[0] = 8*((width + 7) / 8);
+ frame->vo_frame.pitches[1] = 8*((width + 15) / 16);
+ frame->vo_frame.pitches[2] = 8*((width + 15) / 16);
+
+ y_size = frame->vo_frame.pitches[0] * height;
+ uv_size = frame->vo_frame.pitches[1] * ((height+1)/2);
+
+ frame->vo_frame.base[0] = malloc (y_size + 2*uv_size);
+ frame->vo_frame.base[1] = frame->vo_frame.base[0]+y_size+uv_size;
+ frame->vo_frame.base[2] = frame->vo_frame.base[0]+y_size;
+ }
+ break;
+
+ case XINE_IMGFMT_YUY2:
+ frame->vo_frame.pitches[0] = 8*((width + 3) / 4);
+ frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height);
+ frame->vo_frame.base[1] = NULL;
+ frame->vo_frame.base[2] = NULL;
+ break;
+
+ default:
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_macosx: unknown frame format %04x)\n", format);
+ break;
+
+ }
+
+ NSSize nssize;
+ nssize.width = width;
+ nssize.height = height;
+
+ [this->window setContentSize: nssize];
+
+ if((format == XINE_IMGFMT_YV12
+ && (frame->vo_frame.base[0] == NULL
+ || frame->vo_frame.base[1] == NULL
+ || frame->vo_frame.base[2] == NULL))
+ || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) {
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG,
+ "video_out_macosx: error. (framedata allocation failed: out of memory)\n");
+ free_framedata(frame);
+ }
+ }
+
+ frame->ratio = ratio;
+}
+
+static void macosx_display_frame(vo_driver_t *vo_driver, vo_frame_t *vo_frame) {
+ macosx_driver_t *driver = (macosx_driver_t *)vo_driver;
+ macosx_frame_t *frame = (macosx_frame_t *)vo_frame;
+ char *texture_buffer = [[driver->window getGLView] getTextureBuffer];
+
+ switch (vo_frame->format) {
+ case XINE_IMGFMT_YV12:
+ yv12_to_yuy2 (vo_frame->base[0], vo_frame->pitches[0],
+ vo_frame->base[1], vo_frame->pitches[1],
+ vo_frame->base[2], vo_frame->pitches[2],
+ texture_buffer, vo_frame->width * 2,
+ vo_frame->width, vo_frame->height, 0);
+
+ [driver->window displayTexture];
+ break;
+ case XINE_IMGFMT_YUY2:
+ memcpy (texture_buffer, vo_frame->base[0], vo_frame->pitches[0] * vo_frame->height * 3);
+ [driver->window displayTexture];
+ break;
+ default:
+ /* unsupported frame format, do nothing. */
+ break;
+ }
+
+ frame->vo_frame.free(&frame->vo_frame);
+}
+
+static int macosx_get_property(vo_driver_t *vo_driver, int property) {
+ macosx_driver_t *driver = (macosx_driver_t *)vo_driver;
+
+ switch(property) {
+
+ case VO_PROP_ASPECT_RATIO:
+ return driver->ratio;
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static int macosx_set_property(vo_driver_t *vo_driver, int property, int value) {
+ macosx_driver_t *driver = (macosx_driver_t *)vo_driver;
+
+ switch(property) {
+
+ case VO_PROP_ASPECT_RATIO:
+ if(value >= XINE_VO_ASPECT_NUM_RATIOS)
+ value = XINE_VO_ASPECT_AUTO;
+
+ driver->ratio = value;
+ break;
+
+ default:
+ break;
+ }
+ return value;
+}
+
+static void macosx_get_property_min_max(vo_driver_t *vo_driver,
+ int property, int *min, int *max) {
+ *min = 0;
+ *max = 0;
+}
+
+static int macosx_gui_data_exchange(vo_driver_t *vo_driver, int data_type, void *data) {
+/* macosx_driver_t *this = (macosx_driver_t *) vo_driver; */
+
+ switch (data_type) {
+ case XINE_GUI_SEND_COMPLETION_EVENT:
+ case XINE_GUI_SEND_DRAWABLE_CHANGED:
+ case XINE_GUI_SEND_EXPOSE_EVENT:
+ case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO:
+ case XINE_GUI_SEND_VIDEOWIN_VISIBLE:
+ case XINE_GUI_SEND_SELECT_VISUAL:
+ break;
+ }
+
+ return 0;
+}
+static void macosx_dispose(vo_driver_t *vo_driver) {
+ macosx_driver_t *this = (macosx_driver_t *) vo_driver;
+
+ free(this);
+}
+
+static int macosx_redraw_needed(vo_driver_t *vo_driver) {
+ return 0;
+}
+
+
+static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void *visual) {
+ macosx_class_t *class = (macosx_class_t *) driver_class;
+ macosx_driver_t *driver;
+ XineVideoWindow *window = (XineVideoWindow *) visual;
+
+ driver = (macosx_driver_t *) xine_xmalloc(sizeof(macosx_driver_t));
+
+ driver->config = class->config;
+ driver->xine = class->xine;
+ driver->ratio = XINE_VO_ASPECT_AUTO;
+ driver->window = window;
+
+ driver->vo_driver.get_capabilities = macosx_get_capabilities;
+ driver->vo_driver.alloc_frame = macosx_alloc_frame ;
+ driver->vo_driver.update_frame_format = macosx_update_frame_format;
+ driver->vo_driver.overlay_begin = NULL;
+ driver->vo_driver.overlay_blend = NULL;
+ driver->vo_driver.overlay_end = NULL;
+ driver->vo_driver.display_frame = macosx_display_frame;
+ driver->vo_driver.get_property = macosx_get_property;
+ driver->vo_driver.set_property = macosx_set_property;
+ driver->vo_driver.get_property_min_max = macosx_get_property_min_max;
+ driver->vo_driver.gui_data_exchange = macosx_gui_data_exchange;
+ driver->vo_driver.dispose = macosx_dispose;
+ driver->vo_driver.redraw_needed = macosx_redraw_needed;
+
+ NSSize s;
+ s.width = 720;
+ s.height = 576;
+
+
+ return &driver->vo_driver;
+}
+
+/*
+ * Class related functions.
+ */
+static char* get_identifier (video_driver_class_t *driver_class) {
+ return "MacOSX";
+}
+
+static char* get_description (video_driver_class_t *driver_class) {
+ return _("xine video output plugin for MacOSX");
+}
+
+static void dispose_class (video_driver_class_t *driver_class) {
+ macosx_class_t *this = (macosx_class_t *) driver_class;
+
+ free (this);
+}
+
+static void *init_class (xine_t *xine, void *visual) {
+ macosx_class_t *this;
+
+ this = (macosx_class_t *) xine_xmalloc(sizeof(macosx_class_t));
+
+ this->driver_class.open_plugin = open_plugin;
+ this->driver_class.get_identifier = get_identifier;
+ this->driver_class.get_description = get_description;
+ this->driver_class.dispose = dispose_class;
+
+ this->config = xine->config;
+ this->xine = xine;
+
+ return this;
+}
+
+static vo_info_t vo_info_macosx = {
+ 1, /* Priority */
+ XINE_VISUAL_TYPE_MACOSX /* Visual type */
+};
+
+plugin_info_t xine_plugin_info[] = {
+ /* type, API, "name", version, special_info, init_function */
+ { PLUGIN_VIDEO_OUT, 19, "macosx", XINE_VERSION_CODE, &vo_info_macosx, init_class },
+ { PLUGIN_NONE, 0, "", 0, NULL, NULL }
+};
+
+/* Dirty hack to get around the problem that dlclose() is not allowed to
+ * get rid of an image module which contains objective C code and simply
+ * crashes with a Trace/BPT trap when we try to do so.
+ * If this symbol if found in the library, dlclose() will be omitted.
+ */
+int plugin_contains_objc_code = 1;
+
diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c
index 1b24d695f..31d45cce0 100644
--- a/src/video_out/video_out_none.c
+++ b/src/video_out/video_out_none.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_none.c,v 1.20 2003/12/14 22:13:25 siggi Exp $
+ * $Id: video_out_none.c,v 1.21 2004/06/05 16:06:13 jcdutton Exp $
*
* Was originally part of toxine frontend.
* ...but has now been adapted to xine coding style standards ;)
@@ -35,7 +35,6 @@
#include "xine.h"
-#include "xine.h"
#include "video_out.h"
#include "xine_internal.h"
#include "xineutils.h"
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 70e7961d9..b7db9fc85 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.176 2004/05/16 17:58:16 tmattern Exp $
+ * $Id: load_plugins.c,v 1.177 2004/06/05 16:06:13 jcdutton Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -583,7 +583,10 @@ static void collect_plugins(xine_t *this, char *path){
_("load_plugins: can't get plugin info from %s:\n%s\n"), str, error);
}
if( lib )
- dlclose(lib);
+#ifdef HOST_OS_DARWIN
+ if (dlsym (lib, "plugin_contains_objc_code") == NULL)
+#endif
+ dlclose(lib);
}
break;
case S_IFDIR: