OK, I've attached a patch to DirectFB-extra that puts in the Xine video
provider. I've used cvs versions of both DirectFB and Xine.
Remember to set the correct pixelformat of the surface you want to play to.
So lets hope it'll work for you :)
I'm very interested if it doesn't work for you.
that said: good luck!
Hallvar Helleseth
diff -Naur --exclude=CVS DirectFB-extra/configure.in DirectFB-extra.dev/configure.in
--- DirectFB-extra/configure.in Thu Jan 10 20:06:09 2002
+++ DirectFB-extra.dev/configure.in Thu Jan 24 16:59:10 2002
@@ -130,6 +130,26 @@
AM_CONDITIONAL(OPENQUICKTIME, test "x$openquicktime" = xyes)
+#
+# Xine check
+#
+
+AC_PATH_PROG(XINE_CONFIG, imlib2-config, no)
+if test "x$XINE_CONFIG" = xno; then
+ AC_MSG_WARN([*** Xine library not found, building without Xine support ***])
+ xine="no"
+else
+ XINE_INCLUDES=`xine-config --cflags`
+ XINE_LIBS=`xine-config --libs`
+ XINE_PLUGINDIR=`xine-config --plugindir`
+ xine="yes"
+fi
+
+AC_SUBST(XINE_LIBS)
+AC_SUBST(XINE_INCLUDES)
+AC_SUBST(XINE_PLUGINDIR)
+
+AM_CONDITIONAL(XINE, test "x$xine" = xyes)
#
# Imlib2 check
@@ -191,6 +211,7 @@
Building Video Provider:
OpenQuicktime $openquicktime
+ Xine $xine
Building Image Provider:
Imlib2 $imlib2
diff -Naur --exclude=CVS DirectFB-extra/interfaces/IDirectFBVideoProvider/Makefile.am
DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/Makefile.am
--- DirectFB-extra/interfaces/IDirectFBVideoProvider/Makefile.am Fri Dec 28
20:34:17 2001
+++ DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/Makefile.am Thu Jan 24
+17:03:46 2002
@@ -1,6 +1,7 @@
## Makefile.am for DirectFB-extra/interfaces/IDirectFBVideoProvider
idirectfbvideoproviderdir = $(MODULEDIR)/interfaces/IDirectFBVideoProvider
+xineplugdir = $(XINE_PLUGINDIR)
CFLAGS = $(DFB_CFLAGS) -DDATADIR=\"@DATADIR@\"
@@ -11,9 +12,19 @@
OPENQUICKTIME_PROVIDER =
endif
+if XINE
+XINE_PROVIDER_LTLIB = libidirectfbvideoprovider_xine.la
+XINE_PLUG_VO_OUT_LTLIB = xineplug_vo_out_directfb.la
+else
+XINE_PROVIDER_LTLIB =
+XINEP_LUG_VO_OUT_LTLIB =
+endif
+
+xineplug_LTLIBRARIES = $(XINE_PLUG_VO_OUT_LTLIB)
idirectfbvideoprovider_LTLIBRARIES = \
- $(OPENQUICKTIME_PROVIDER)
+ $(OPENQUICKTIME_PROVIDER) \
+ $(XINE_PROVIDER_LTLIB)
libidirectfbvideoprovider_openquicktime_la_SOURCES =
idirectfbvideoprovider_openquicktime.c
@@ -21,3 +32,15 @@
libidirectfbvideoprovider_openquicktime_la_LIBADD = $(OPENQUICKTIME_LIBS)
libidirectfbvideoprovider_openquicktime_la_LDFLAGS = -avoid-version -module
-disable-static
+
+libidirectfbvideoprovider_xine_la_SOURCES = idirectfbvideoprovider_xine.c
+
+libidirectfbvideoprovider_xine_la_LIBADD = $(XINE_LIBS)
+
+libidirectfbvideoprovider_xine_la_LDFLAGS = -avoid-version -module -disable-static
+
+xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c
+
+xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIBS)
+
+xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module -disable-static
diff -Naur --exclude=CVS
DirectFB-extra/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_xine.c
DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_xine.c
--- DirectFB-extra/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_xine.c
Thu Jan 1 01:00:00 1970
+++ DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_xine.c
+ Thu Jan 24 22:06:10 2002
@@ -0,0 +1,450 @@
+/*
+ (c) Copyright 2001 Kim JeongHoe <[EMAIL PROTECTED]> and Hallvar I guess..
+ All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <sys/time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <malloc.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+#include <directfb_internals.h>
+
+#include <misc/util.h>
+#include <misc/mem.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/state.h>
+#include <core/surfaces.h>
+#include <core/gfxcard.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+
+#include "xine_provider.h"
+
+static DFBResult
+Probe( const char *filename );
+
+static DFBResult
+Construct( IDirectFBVideoProvider *thiz, const char *filename );
+
+#include <interface_implementation.h>
+
+DFB_INTERFACE_IMPLEMENTATION( IDirectFBVideoProvider, Xine )
+
+static void
+IDirectFBVideoProvider_Xine_Destruct( IDirectFBVideoProvider *thiz )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ thiz->Stop( thiz );
+
+ DFBFREE( data->filename );
+
+ DFBFREE( thiz->priv );
+ thiz->priv = NULL;
+
+#ifndef DFB_DEBUG
+ DFBFREE( thiz );
+#endif
+}
+
+static DFBResult
+IDirectFBVideoProvider_Xine_AddRef( IDirectFBVideoProvider *thiz )
+{
+ INTERFACE_GET_DATA (IDirectFBVideoProvider_Xine)
+
+ data->ref++;
+
+ return DFB_OK;
+}
+
+
+static DFBResult
+IDirectFBVideoProvider_Xine_Release( IDirectFBVideoProvider *thiz )
+{
+ INTERFACE_GET_DATA (IDirectFBVideoProvider_Xine)
+
+ if (--data->ref == 0) {
+ IDirectFBVideoProvider_Xine_Destruct( thiz );
+ }
+
+ return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_Xine_GetCapabilities(
+ IDirectFBVideoProvider *thiz,
+ DFBVideoProviderCapabilities *caps )
+{
+ INTERFACE_GET_DATA (IDirectFBVideoProvider_Xine)
+
+ if (!caps)
+ return DFB_INVARG;
+
+ *caps = DVCAPS_BASIC | DVCAPS_SCALE | DVCAPS_SEEK;
+
+ return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_Xine_GetSurfaceDescription(
+ IDirectFBVideoProvider *thiz, DFBSurfaceDescription *desc )
+{
+ INTERFACE_GET_DATA (IDirectFBVideoProvider_Xine)
+
+ if (!desc)
+ return DFB_INVARG;
+
+ desc->flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+ desc->width = data->width;
+ desc->height = data->height;
+ //FIXME:
+ desc->pixelformat = data->format;
+
+ return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_Xine_PlayTo( IDirectFBVideoProvider *thiz,
+ IDirectFBSurface *destination,
+ DFBRectangle *dstrect,
+ DVFrameCallback callback,
+ void *ctx )
+{
+ DFBRectangle rect;
+ IDirectFBSurface_data *dst_data;
+
+ INTERFACE_GET_DATA (IDirectFBVideoProvider_Xine)
+
+ if (!destination)
+ return DFB_INVARG;
+
+ dst_data = (IDirectFBSurface_data*)destination->priv;
+
+ if (!dst_data)
+ return DFB_DEAD;
+
+ /* build the destination rectangle */
+ if (dstrect) {
+ if (dstrect->w < 1 || dstrect->h < 1)
+ return DFB_INVARG;
+
+ rect = *dstrect;
+
+ rect.x += dst_data->area.wanted.x;
+ rect.y += dst_data->area.wanted.y;
+ }
+ else
+ rect = dst_data->area.wanted;
+
+ /* save for later blitting operation */
+ data->dest_rect = rect;
+
+ /* build the clip rectangle */
+ if (!dfb_rectangle_intersect( &rect, &dst_data->area.current ))
+ return DFB_INVARG;
+
+ /* put the destination clip into the state */
+ data->state.clip.x1 = rect.x;
+ data->state.clip.y1 = rect.y;
+ data->state.clip.x2 = rect.x + rect.w - 1;
+ data->state.clip.y2 = rect.y + rect.h - 1;
+ data->state.destination = dst_data->surface;
+ data->state.modified = (StateModificationFlags)
+ (data->state.modified | SMF_CLIP | SMF_DESTINATION);
+
+ if (data->destination) {
+ data->destination->Release( data->destination );
+ data->destination = NULL; /* FIXME: remove listener */
+ }
+
+ destination->AddRef( destination );
+ data->destination = destination; /* FIXME: install listener */
+
+ data->callback = callback;
+ data->ctx = ctx;
+
+ data->width = dst_data->surface->width;
+ data->height = dst_data->surface->height;
+ data->dstsurface = dst_data->surface;
+
+ dfb_surfacemanager_lock(data->dstsurface->manager);
+ dfb_surfacemanager_assure_video(data->dstsurface->manager,
+data->dstsurface->back_buffer);
+ dfb_surfacemanager_unlock(data->dstsurface->manager);
+
+ data->play = 1; // hack
+ xine_play(data->xine, data->filename, 0, 0);
+
+ return DFB_OK;
+}
+
+
+static DFBResult
+IDirectFBVideoProvider_Xine_Stop( IDirectFBVideoProvider *thiz )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+
+ if (!thiz)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ xine_stop(data->xine);
+ if (!data)
+ return DFB_DEAD;
+
+ if (data->destination) {
+ data->destination->Release( data->destination );
+ data->destination = NULL; /* FIXME: remove listener */
+ }
+
+ return DFB_OK;
+}
+
+
+static DFBResult IDirectFBVideoProvider_Xine_SeekTo(
+ IDirectFBVideoProvider *thiz,
+ double seconds )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+ double rate;
+
+ if (!thiz)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ if (!data)
+ return DFB_DEAD;
+
+ //if(!xine_is_stream_seekable(data->xine))
+ // return DFB_UNIMPLEMENTED;
+
+ xine_play(data->xine, data->filename, 0, seconds);
+
+ return DFB_OK;
+}
+
+
+static DFBResult IDirectFBVideoProvider_Xine_GetPos(
+ IDirectFBVideoProvider *thiz,
+ double *seconds )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+ double rate;
+
+ if (!thiz)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ if (!data)
+ return DFB_DEAD;
+ *seconds = xine_get_current_time(data->xine);
+ return DFB_OK;
+}
+
+
+static DFBResult IDirectFBVideoProvider_Xine_GetLength(
+ IDirectFBVideoProvider *thiz,
+ double *seconds )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+ double rate;
+ long frames;
+
+ if (!thiz)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ if (!data)
+ return DFB_DEAD;
+
+ *seconds = xine_get_stream_length(data->xine);
+ return DFB_OK;
+}
+
+static DFBResult IDirectFBVideoProvider_Xine_GetColorAdjustment(
+ IDirectFBVideoProvider *thiz,
+ DFBColorAdjustment *adj )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+
+ if (!thiz || !adj)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ if (!data)
+ return DFB_DEAD;
+
+ return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult IDirectFBVideoProvider_Xine_SetColorAdjustment(
+ IDirectFBVideoProvider *thiz,
+ DFBColorAdjustment *adj )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+
+ if (!thiz || !adj)
+ return DFB_INVARG;
+
+ data = (IDirectFBVideoProvider_Xine_data*)thiz->priv;
+
+ if (!data)
+ return DFB_DEAD;
+
+ return DFB_UNIMPLEMENTED;
+}
+
+
+/* exported symbols */
+
+const char *get_type()
+{
+ return "IDirectFBVideoProvider";
+}
+
+const char *get_implementation()
+{
+ return "Xine";
+}
+
+static
+DFBResult Probe( const char *filename )
+{
+ if(!xine_check_version(0, 9, 9))
+ return DFB_INIT;
+ return DFB_OK;
+}
+
+static
+DFBResult Construct( IDirectFBVideoProvider *thiz, const char *filename )
+{
+ IDirectFBVideoProvider_Xine_data *data;
+ int audio_channel = 0;
+ int spu_channel = 0;
+ char *audio_driver_id = NULL;
+ char *configfile;
+ vo_driver_t *vo_driver;
+ ao_driver_t *ao_driver;
+ static config_values_t *config;
+ static int initted;
+
+ data = (IDirectFBVideoProvider_Xine_data *)
+ DFBCALLOC( 1, sizeof(IDirectFBVideoProvider_Xine_data) );
+
+ thiz->priv = data;
+
+ data->ref = 1;
+
+ data->filename = DFBSTRDUP( filename );
+
+ data->state.source = data->dstsurface;
+ data->state.modified = SMF_ALL;
+
+ data->thread = -1;
+
+ thiz->AddRef = IDirectFBVideoProvider_Xine_AddRef;
+ thiz->Release = IDirectFBVideoProvider_Xine_Release;
+ thiz->GetCapabilities = IDirectFBVideoProvider_Xine_GetCapabilities;
+ thiz->GetSurfaceDescription =
+ IDirectFBVideoProvider_Xine_GetSurfaceDescription;
+ thiz->PlayTo = IDirectFBVideoProvider_Xine_PlayTo;
+ thiz->Stop = IDirectFBVideoProvider_Xine_Stop;
+ thiz->SeekTo = IDirectFBVideoProvider_Xine_SeekTo;
+ thiz->GetPos = IDirectFBVideoProvider_Xine_GetPos;
+ thiz->GetLength = IDirectFBVideoProvider_Xine_GetLength;
+ thiz->GetColorAdjustment =
+ IDirectFBVideoProvider_Xine_GetColorAdjustment;
+ thiz->SetColorAdjustment =
+ IDirectFBVideoProvider_Xine_SetColorAdjustment;
+
+ /* load xine's config file */
+ if(!initted)
+ {
+ char *cfile = ".xine/config";
+ configfile = (char *) xine_xmalloc(strlen(xine_get_homedir())
+
+ + strlen(cfile) + 2);
+ sprintf (configfile, "%s/%s", xine_get_homedir(), cfile);
+ config = config_file_init (configfile);
+ initted = 1;
+ }
+ /* load xine's directfb videooutput plugin */
+ vo_driver = xine_load_video_output_plugin(config, "directfb",
+VISUAL_TYPE_DIRECTFB, (void *) data);
+
+ if(!vo_driver)
+ {
+ printf("video driver directfb failed\n");
+ return DFB_INIT;
+ }
+
+ /* load xine's (oss) audio output plugin */
+ audio_driver_id = "null";
+
+ ao_driver = xine_load_audio_output_plugin(config,
+ audio_driver_id);
+ if(!ao_driver)
+ {
+ printf("audio driver oss failed\n");
+ }
+
+ /* initialize Xine */
+ data->xine = xine_init (vo_driver, ao_driver, config);
+
+ if(!data->xine)
+ {
+ printf("xine_init() failed.\n");
+ return DFB_INIT;
+ }
+
+ /* select audio channel */
+ xine_select_audio_channel (data->xine, audio_channel);
+ xine_select_spu_channel(data->xine, spu_channel);
+
+ data->filename = filename;
+
+ /* HACK HACK HACK: we need to get width and height and pixel format */
+ data->play = 0; // this should be >0 only when it really plays!
+ data->initted = 0;
+ xine_play(data->xine, data->filename, 0, 0); // starts a thread
+
+ // don't stop before we have our width, height and format
+ while(!data->initted)
+ usleep(10000);
+
+ xine_stop(data->xine);
+
+ return DFB_OK;
+}
diff -Naur --exclude=CVS
DirectFB-extra/interfaces/IDirectFBVideoProvider/video_out_directfb.c
DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/video_out_directfb.c
--- DirectFB-extra/interfaces/IDirectFBVideoProvider/video_out_directfb.c Thu
Jan 1 01:00:00 1970
+++ DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/video_out_directfb.c Thu
+Jan 24 22:08:58 2002
@@ -0,0 +1,346 @@
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix 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_aa.c,v 1.13 2001/10/03 15:14:03 jkeil Exp $
+ *
+ * video_out_aa.c, ascii-art output plugin for xine
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+
+#include <directfb.h>
+#include <directfb_internals.h>
+
+#include <misc/util.h>
+#include <misc/mem.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+
+#include <core/surfaces.h>
+
+#include <display/idirectfbsurface.h>
+
+
+#include <xine/video_out.h>
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+
+#include "xine_provider.h"
+
+/*
+ * global variables
+ */
+
+typedef struct directfb_frame_s {
+
+ vo_frame_t vo_frame;
+
+ int width, height;
+ uint8_t *mem[3];
+
+ int ratio_code;
+
+ int format;
+
+} directfb_frame_t;
+
+typedef struct {
+
+ vo_driver_t vo_driver;
+
+ config_values_t *config;
+
+ int user_ratio;
+
+ IDirectFBVideoProvider_Xine_data *context;
+} directfb_driver_t;
+
+
+/*
+ * our video driver
+ */
+
+static uint32_t directfb_get_capabilities (vo_driver_t *this) {
+ return VO_CAP_YUY2 | VO_CAP_RGB;
+}
+
+static void *malloc_aligned (size_t alignment, size_t size, void **mem) {
+ char *aligned;
+
+ aligned = malloc (size+alignment);
+ *mem = aligned;
+
+ while ((int) aligned % alignment)
+ aligned++;
+
+ return aligned;
+}
+
+static void directfb_dispose_frame (vo_frame_t *vo_img) {
+ directfb_frame_t *frame = (directfb_frame_t *)vo_img;
+
+ if (frame->mem[0])
+ free (frame->mem[0]);
+ if (frame->mem[1])
+ free (frame->mem[1]);
+ if (frame->mem[2])
+ free (frame->mem[2]);
+
+ free (frame);
+}
+
+static void directfb_frame_field (vo_frame_t *vo_img, int which_field) {
+ /* nothing to be done here */
+}
+
+
+static vo_frame_t *directfb_alloc_frame(vo_driver_t *this) {
+ directfb_frame_t *frame;
+
+ frame = (directfb_frame_t *) malloc (sizeof (directfb_frame_t));
+ memset (frame, 0, sizeof (directfb_frame_t));
+
+ frame->vo_frame.copy = NULL;
+ frame->vo_frame.field = directfb_frame_field;
+ frame->vo_frame.dispose = directfb_dispose_frame;
+
+ return (vo_frame_t*) frame;
+}
+
+static void directfb_update_frame_format (vo_driver_t *this, vo_frame_t *img,
+ uint32_t width, uint32_t height,
+ int ratio_code, int format, int flags) {
+
+ int image_size;
+
+ directfb_frame_t *frame = (directfb_frame_t *) img;
+ directfb_driver_t *t = (directfb_driver_t *) this;
+
+ t->context->width = width;
+ t->context->height = height;
+ switch(format) {
+ case IMGFMT_YUY2:
+ case IMGFMT_YV12:
+ t->context->format = DSPF_YUY2;
+ break;
+ case IMGFMT_RGB:
+ t->context->format = DSPF_RGB16;
+ break;
+ default:
+ printf("Usupported pixelformat!\n");
+ }
+ t->context->initted = 1;
+
+ if ((frame->width != width) || (frame->height != height)
+ || (frame->format != format)) {
+
+ if (frame->mem[0]) {
+ free (frame->mem[0]);
+ frame->mem[0] = NULL;
+ }
+ if (frame->mem[1]) {
+ free (frame->mem[1]);
+ frame->mem[1] = NULL;
+ }
+
+ if (frame->mem[2]) {
+ free (frame->mem[2]);
+ frame->mem[2] = NULL;
+ }
+
+ frame->width = width;
+ frame->height = height;
+ frame->format = format;
+
+ if (format == IMGFMT_YV12) {
+ image_size = width * height;
+
+ frame->vo_frame.base[0] = malloc_aligned(16,image_size, (void**)
+&frame->mem[0]);
+ frame->vo_frame.base[1] = malloc_aligned(16,image_size/4, (void**)
+&frame->mem[1]);
+ frame->vo_frame.base[2] = malloc_aligned(16,image_size/4, (void**)
+&frame->mem[2]);
+
+ //printf ("allocated yuv memory for %d x %d image\n", width, height);
+ } else if (format == IMGFMT_YUY2) {
+ image_size = width * 2 * height;
+ frame->vo_frame.base[0] = malloc_aligned(16,image_size, (void**)
+&frame->mem[0]);
+ } else {
+ printf ("alert! unsupported image format %04x\n", format);
+ exit (1);
+ }
+ frame->ratio_code = ratio_code;
+
+ }
+}
+
+static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
+ int x,y, pitch;
+
+ uint16_t *img;
+ uint8_t *src_y;
+ uint8_t *src_u;
+ uint8_t *src_v;
+ IDirectFBVideoProvider_Xine_data *data;
+
+ directfb_driver_t *this = (directfb_driver_t*) this_gen;
+ directfb_frame_t *frame = (directfb_frame_t *) frame_gen;
+ data = (IDirectFBVideoProvider_Xine_data *) this->context;
+
+ if(data->play) {
+ src_y = frame->vo_frame.base[0];
+ src_u = frame->vo_frame.base[1];
+ src_v = frame->vo_frame.base[2];
+
+ dfb_surface_soft_lock (data->dstsurface, DSLF_WRITE, &img, &pitch, 0);
+
+ //memcpy(img, frame->vo_frame.base[0], 160000);
+
+ // converts yuv stuff ??
+
+ if (frame->format == IMGFMT_YV12)
+ {
+ for (y = 0; y<data->height; y++)
+ {
+ for (x = 0; x<data->width; x++)
+ {
+ if (x & 1)
+ img[x] = (src_v[x/2] << 8) | src_y[x];
+ else
+ img[x] = (src_u[x/2] << 8) | src_y[x];
+ }
+
+ img += pitch/2;
+ src_y += frame->width;
+
+ if (y & 1)
+ {
+ src_u += frame->width/2;
+ src_v += frame->width/2;
+ }
+ }
+ }
+ else
+ {
+ for (y = 0; y<data->height; y++)
+ {
+ for (x = 0; x<data->width; x++)
+ {
+
+ img[x] = src_y[(x + frame->width * y)];
+
+ }
+ img += pitch/2;
+ }
+ }
+
+ dfb_surface_unlock (data->dstsurface, 0);
+
+ if (data->callback)
+ data->callback (data->ctx);
+
+ frame->vo_frame.displayed (&frame->vo_frame);
+ }
+}
+
+static int directfb_get_property (vo_driver_t *this_gen, int property) {
+ directfb_driver_t *this = (directfb_driver_t*) this_gen;
+
+ if ( property == VO_PROP_ASPECT_RATIO) {
+ return this->user_ratio ;
+ } else {
+ printf ("video_out_xshm: tried to get unsupported property %d\n", property);
+ }
+
+ return 0;
+}
+
+static int directfb_set_property (vo_driver_t *this_gen,
+ int property, int value) {
+ directfb_driver_t *this = (directfb_driver_t*) this_gen;
+
+ if ( property == VO_PROP_ASPECT_RATIO) {
+ if (value>=NUM_ASPECT_RATIOS)
+ value = ASPECT_AUTO;
+ this->user_ratio = value;
+
+ } else {
+ printf ("video_out_xshm: tried to set unsupported property %d\n", property);
+ }
+
+ return value;
+}
+
+static void directfb_get_property_min_max (vo_driver_t *this_gen,
+ int property, int *min, int *max) {
+ *min = 0;
+ *max = 0;
+}
+
+static void directfb_exit (vo_driver_t *this_gen) {
+}
+
+
+vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
+ directfb_driver_t *this;
+
+ this = (directfb_driver_t*) xine_xmalloc (sizeof (directfb_driver_t));
+
+ this->context = (IDirectFBVideoProvider_Xine_data *) visual_gen;
+
+ this->config = config;
+
+ this->vo_driver.get_capabilities = directfb_get_capabilities;
+ this->vo_driver.alloc_frame = directfb_alloc_frame ;
+ this->vo_driver.update_frame_format = directfb_update_frame_format;
+ this->vo_driver.display_frame = directfb_display_frame;
+ this->vo_driver.get_property = directfb_get_property;
+ this->vo_driver.set_property = directfb_set_property;
+ this->vo_driver.get_property_min_max = directfb_get_property_min_max;
+ this->vo_driver.gui_data_exchange = NULL;
+ this->vo_driver.exit = directfb_exit;
+
+ return (vo_driver_t*) this;
+}
+
+static vo_info_t vo_info_directfb = {
+ 3,
+ "directfb",
+ "xine video output plugin using the DirectFB library",
+ VISUAL_TYPE_DIRECTFB,
+ 10
+};
+
+vo_info_t *get_video_out_plugin_info() {
+ return &vo_info_directfb;
+}
diff -Naur --exclude=CVS
DirectFB-extra/interfaces/IDirectFBVideoProvider/xine_provider.h
DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/xine_provider.h
--- DirectFB-extra/interfaces/IDirectFBVideoProvider/xine_provider.h Thu Jan 1
01:00:00 1970
+++ DirectFB-extra.dev/interfaces/IDirectFBVideoProvider/xine_provider.h Thu
+Jan 24 21:36:10 2002
@@ -0,0 +1,44 @@
+/*
+#include <directfb.h>
+#include <directfb_internals.h>
+
+#include <misc/util.h>
+#include <misc/mem.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/state.h>
+#include <core/surfaces.h>
+#include <core/gfxcard.h>
+
+#include <display/idirectfbsurface.h>
+*/
+typedef struct _xineviddata {
+ int ref;
+ int initted;
+ int play;
+
+ char *filename;
+
+ xine_t *xine;
+ int ignore_status;
+
+ pthread_t thread;
+
+ IDirectFBSurface *destination;
+ DFBRectangle dest_rect;
+ DVFrameCallback callback;
+ void *ctx;
+
+ uint32_t width;
+ uint32_t height;
+ int format;
+
+ CardState state;
+ CoreSurface *dstsurface;
+} IDirectFBVideoProvider_Xine_data;
+
+/* Should this be in xine.h instead maybe? */
+#define VISUAL_TYPE_DIRECTFB 5