diff --git a/Make/dependencies b/Make/dependencies index 0b6c9441c..c5a3ba934 100644 --- a/Make/dependencies +++ b/Make/dependencies @@ -6,6 +6,8 @@ JASPER_INSTALLED ?= no FREETYPE_INSTALLED ?= yes +XINE_INSTALLED ?= no + ifeq ($(OS),Darwin) DARWIN_QUICKTIME ?= yes endif diff --git a/Make/makedefs b/Make/makedefs index 060424456..370239cde 100644 --- a/Make/makedefs +++ b/Make/makedefs @@ -217,7 +217,8 @@ ifeq ($(OS),SunOS) GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` - + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` endif @@ -306,6 +307,8 @@ ifeq ($(OS),IRIX) GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` endif @@ -399,6 +402,9 @@ endif GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + endif #### FreeBSD specific definitions @@ -432,6 +438,9 @@ ifeq ($(OS),FreeBSD) GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + endif #### MacOS X specific definitions @@ -496,6 +505,9 @@ ifeq ($(OS),Darwin) GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + endif #### Cygwin specific definitions @@ -534,6 +546,9 @@ ifeq ($(OS),CYGWIN) GDAL_LIBS = `gdal-config --dep-libs` GDAL_LIBS += `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + LIBINST = bin/$(OS)$(ARCH) PLUGININST = bin/$(OS)$(ARCH) @@ -589,6 +604,9 @@ ifeq ($(OS),MINGW) GDAL_LIB = -lgdal -ljpeg -lgeotiff -ltiff -lpng -lz + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + LIBINST = bin PLUGININST = bin/$(OS)$(ARCH) @@ -659,6 +677,9 @@ endif GDAL_INCLUDES = `gdal-config --cflags` GDAL_LIBS = `gdal-config --libs` + XINE_INCLUDES = `xine-config --cflags` + XINE_LIBS = `xine-config --libs` + endif VPATH=.. diff --git a/Make/makedirdefs b/Make/makedirdefs index 7cbbca3c9..648370284 100644 --- a/Make/makedirdefs +++ b/Make/makedirdefs @@ -75,6 +75,10 @@ ifeq ($(GDAL_INSTALLED),yes) PLUGIN_DIRS += gdal endif +ifeq ($(XINE_INSTALLED),yes) + PLUGIN_DIRS += xine +endif + ifeq ($(JASPER_INSTALLED),yes) PLUGIN_DIRS += jp2 endif diff --git a/src/osgPlugins/xine/GNUmakefile b/src/osgPlugins/xine/GNUmakefile new file mode 100644 index 000000000..9cd2df498 --- /dev/null +++ b/src/osgPlugins/xine/GNUmakefile @@ -0,0 +1,15 @@ +TOPDIR = ../../.. +include $(TOPDIR)/Make/makedefs + +CXXFILES =\ + ReaderWriterXine.cpp\ + +INC += $(XINE_INCLUDES) + +LIBS += $(OSG_LIBS) $(XINE_LIBS) $(OTHER_LIBS) + +TARGET_BASENAME = xine +include $(TOPDIR)/Make/cygwin_plugin_def +PLUGIN = $(PLUGIN_PREFIX)$(TARGET_BASENAME).$(PLUGIN_EXT) + +include $(TOPDIR)/Make/makerules diff --git a/src/osgPlugins/xine/ReaderWriterXine.cpp b/src/osgPlugins/xine/ReaderWriterXine.cpp new file mode 100644 index 000000000..8aab7f933 --- /dev/null +++ b/src/osgPlugins/xine/ReaderWriterXine.cpp @@ -0,0 +1,179 @@ +// (C) Robert Osfield, Feb 2004. +// GPL'd. + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + + +typedef enum +{ +/* PX_RGB_PLANAR = 1, ? */ + PX_ARGB = 2, /* 32 bits [a:8@24, r:8@26, g:8@8, b:8@0] */ + PX_ARGB1555 = 3, /* 16 bits [a:1@15, r:5@10, g:5@5, b:5@0] */ + PX_RGB32 = 4, /* 32 bits [r:8@16, g:8@8, b:8@0] */ + PX_RGB24 = 5, /* 24 bits [r:8@16, g:8@8, b:8@0] */ + PX_RGB16 = 6, /* 16 bits [r:5@11, g:6@5, b:5@0] */ + PX_BGRA = 7, /* 32 bits [a:8@0, r:8@8, g:8@16, b:8@24] */ + PX_BGRA5551 = 8, /* 16 bits [a:1@0, r:5@1, g:5@6, b:5@11] */ + PX_BGR32 = 9, /* 32 bits [r:8@0, g:8@8, b:8@16] */ + PX_BGR24 = 10, /* 24 bits [r:8@0, g:8@8, b:8@16] */ + PX_BGR16 = 11 /* 16 bits [r:5@0, g:6@5, b:5@11] */ + +} rgb_pixel_format_t; + + +typedef enum +{ + PXLEVEL_NONE = 0, + PXLEVEL_R = (1 << 0), + PXLEVEL_G = (1 << 1), + PXLEVEL_B = (1 << 2), + PXLEVEL_ALL = 7 /* PX_LEVEL_R | PX_LEVEL_G | PX_LEVEL_B */ + +} rgb_pixel_levels_t; + + + +/* + * Applications that want to use this driver must provide a + * callabck function (eg. for rendering frames); + * RGBout will pass it a buffer containing pixels in the format + * specified by "format" (generally you have only to BLIT + * the buffer if you want to display the frame). + * "levels" selects which RGB level is visible (if you dont't + * need this feature, set it to PXLEVEL_ALL). + * + * N.B.: DO NOT FREE THE BUFFER + * + */ + +typedef struct +{ + rgb_pixel_format_t format; + rgb_pixel_levels_t levels; + void* user_data; + void (*callback) (uint32_t width, uint32_t height, void* imageData, void* userData); + +} rgbout_visual_info_t; + + +static int ready = 0; + +static void my_render_frame(uint32_t width, uint32_t height, void* data, void* userData) +{ + osg::Image* imageStream = (osg::Image*) userData; + + GLenum pixelFormat = GL_RGB; + + imageStream->setImage(width,height,1, + GL_RGB, + pixelFormat,GL_UNSIGNED_BYTE, + (unsigned char *)data, + osg::Image::NO_DELETE, + 1); + + ready = 1; +} + +class ReaderWriterXine : public osgDB::ReaderWriter +{ + public: + + ReaderWriterXine() + { + osg::notify(osg::NOTICE)<<"I'm here"<levels = PXLEVEL_ALL; + //visual->format = PX_BGRA; + visual->format = PX_BGR24; + visual->user_data = imageStream; + visual->callback = my_render_frame; + + // set up drivers + xine_video_port_t* vo = xine_open_video_driver(_xine, "rgb", XINE_VISUAL_TYPE_FB, (void*)visual); + xine_audio_port_t* ao = xine_open_audio_driver(_xine, "none", NULL); + + // set up stream + xine_stream_t* stream = xine_stream_new(_xine, ao, vo); + + // set up queue + // xine_event_queue_t* queue = xine_event_new_queue(stream); + + int result = xine_open(stream, file.c_str()); + osg::notify(osg::NOTICE)<<"ReaderWriterXine::readImage - xine_open"<play(); + + while (!ready) + { + osg::notify(osg::NOTICE)<<"waiting..."< g_readerWriter_Xine_Proxy;