Commit 52f0fa68 authored by Sam Hocevar's avatar Sam Hocevar

  * Function prototypes for the forthcoming Darwin and MacOS X port.
  * Gtk+ interface: fixed a precision issue in the scale.
  * Qt interface: somebody pop up us the menu!!
parent b16d6fab
......@@ -301,6 +301,9 @@ PLUGIN_BEOS = plugins/beos/beos.o \
plugins/beos/DrawingTidbits.o \
plugins/beos/TransportButton.o
PLUGIN_DARWIN = plugins/darwin/darwin.o \
plugins/darwin/aout_darwin.o
PLUGIN_DSP = plugins/dsp/dsp.o \
plugins/dsp/aout_dsp.o
......@@ -360,6 +363,10 @@ PLUGIN_IDCTMMX = plugins/idct/idctmmx.o \
PLUGIN_IDCTMMXEXT = plugins/idct/idctmmxext.o \
plugins/idct/idct_common.o
PLUGIN_MACOSX = plugins/macosx/macosx.o \
plugins/macosx/intf_macosx.o \
plugins/macosx/vout_macosx.o
PLUGIN_MGA = plugins/mga/mga.o \
plugins/mga/vout_mga.o
......@@ -403,6 +410,7 @@ PLUGIN_YUVMMX = plugins/yuv/yuvmmx.o \
STD_PLUGIN_OBJ = \
$(PLUGIN_ALSA) \
$(PLUGIN_DARWIN) \
$(PLUGIN_DSP) \
$(PLUGIN_DUMMY) \
$(PLUGIN_DVD) \
......@@ -413,6 +421,7 @@ STD_PLUGIN_OBJ = \
$(PLUGIN_IDCTCLASSIC) \
$(PLUGIN_IDCTMMX) \
$(PLUGIN_IDCTMMXEXT) \
$(PLUGIN_MACOSX) \
$(PLUGIN_MGA) \
$(PLUGIN_MOTION) \
$(PLUGIN_MOTIONMMX) \
......@@ -641,6 +650,12 @@ else
$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -laudiofile -lesd
endif
lib/macosx.so: $(PLUGIN_MACOSX)
$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
lib/darwin.so: $(PLUGIN_DARWIN)
$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
lib/dsp.so: $(PLUGIN_DSP)
$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
......
This diff is collapsed.
......@@ -115,6 +115,12 @@ AC_CHECK_HEADERS(sys/ioctl.h,
AC_EGREP_HEADER(dvd,linux/cdrom.h,[AC_DEFINE(LINUX_DVD,1,DVD support for linux)])])
ARCH=${host_cpu}
AC_ARG_ENABLE(dummy,
[ --disable-dummy dummy module (default enabled)])
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
AC_ARG_ENABLE(null,
[ --disable-null Null module (default enabled)])
if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi
AC_ARG_ENABLE(ppro,
[ --disable-ppro Disable PentiumPro optimizations (default enabled for x86)],
[ if test x$enableval = xyes; then ARCH=${ARCH}" ppro"; fi ],
......@@ -142,19 +148,13 @@ SYS=${host_os}
# special cases
if test x$host_os = xbeos; then
PLUGINS=${PLUGINS}"dummy null beos "
PLUGINS=${PLUGINS}"beos "
dnl default case
else
GVLC=0
AC_ARG_ENABLE(dummy,
[ --disable-dummy dummy module (default enabled)])
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
AC_ARG_ENABLE(null,
[ --disable-null Null module (default enabled)])
if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi
AC_ARG_ENABLE(dsp,
[ --disable-dsp Linux /dev/dsp support (default enabled)])
if test x$enable_dsp != xno; then
......@@ -165,6 +165,12 @@ fi
AC_ARG_ENABLE(esd,
[ --enable-esd Esound library support (default disabled)],
[if test x$enable_esd = xyes; then PLUGINS=${PLUGINS}"esd "; fi])
AC_ARG_ENABLE(darwin,
[ --enable-darwin Darwin sound support (default disabled)],
[if test x$enable_darwin = xyes; then PLUGINS=${PLUGINS}"darwin "; fi])
AC_ARG_ENABLE(macosx,
[ --enable-macosx Mac OS X interface support (default disabled)],
[if test x$enable_macosx = xyes; then PLUGINS=${PLUGINS}"macosx "; fi])
AC_ARG_ENABLE(fb,
[ --enable-fb Linux framebuffer support (default disabled)],
[if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; fi])
......
......@@ -44,24 +44,24 @@
*/
/* I can't believe I need to do this to change foo to "foo" */
#define UGLY_KLUDGE( z ) NASTY_CROCK( z )
#define NASTY_CROCK( z ) #z
#define STRINGIFY( z ) UGLY_KLUDGE( z )
#define UGLY_KLUDGE( z ) #z
/* And I need to do _this_ to change foo bar to module_foo_bar ! */
#define AWFUL_BRITTLE( y, z ) CRUDE_HACK( y, z )
#define CRUDE_HACK( y, z ) module_##y##_##z
#define CONCATENATE( y, z ) CRUDE_HACK( y, z )
#define CRUDE_HACK( y, z ) module_##y##_##z
#define MODULE_VAR( z ) "VLC_MODULE_" #z
/* If the module is built-in, then we need to define foo_InitModule instead
* of InitModule. Same for Activate- and DeactivateModule. */
#ifdef BUILTIN
# define _M( function ) AWFUL_BRITTLE( MODULE_NAME, function )
# define _M( function ) CONCATENATE( MODULE_NAME, function )
# define MODULE_INIT \
int AWFUL_BRITTLE( MODULE_NAME, InitModule ) ( module_t *p_module )
int CONCATENATE( MODULE_NAME, InitModule ) ( module_t *p_module )
# define MODULE_ACTIVATE \
int AWFUL_BRITTLE( MODULE_NAME, ActivateModule ) ( module_t *p_module )
int CONCATENATE( MODULE_NAME, ActivateModule ) ( module_t *p_module )
# define MODULE_DEACTIVATE \
int AWFUL_BRITTLE( MODULE_NAME, DeactivateModule )( module_t *p_module )
int CONCATENATE( MODULE_NAME, DeactivateModule )( module_t *p_module )
#else
# define _M( function ) function
# define MODULE_INIT int InitModule ( module_t *p_module )
......@@ -70,7 +70,7 @@
#endif
/* Now the real stuff */
#define MODULE_STRING UGLY_KLUDGE( MODULE_NAME )
#define MODULE_STRING STRINGIFY( MODULE_NAME )
/*****************************************************************************
* Macros used to build the configuration structure.
......
/*****************************************************************************
* aout_darwin.c : Darwin audio output plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors:
*
* This program 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.
*
* This program 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, USA.
*****************************************************************************/
#define MODULE_NAME darwin
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "audio_output.h" /* aout_thread_t */
#include "main.h"
#include "modules.h"
/*****************************************************************************
* aout_sys_t: private audio output method descriptor
*****************************************************************************
* This structure is part of the audio output thread descriptor.
* It describes the Darwin specific properties of an output thread.
*****************************************************************************/
typedef struct aout_sys_s
{
} aout_sys_t;
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int aout_Probe ( probedata_t *p_data );
static int aout_Open ( aout_thread_t *p_aout );
static int aout_SetFormat ( aout_thread_t *p_aout );
static long aout_GetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
static void aout_Play ( aout_thread_t *p_aout,
byte_t *buffer, int i_size );
static void aout_Close ( aout_thread_t *p_aout );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( aout_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = aout_Probe;
p_function_list->functions.aout.pf_open = aout_Open;
p_function_list->functions.aout.pf_setformat = aout_SetFormat;
p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo;
p_function_list->functions.aout.pf_play = aout_Play;
p_function_list->functions.aout.pf_close = aout_Close;
}
/*****************************************************************************
* aout_Probe: probe the audio device and return a score
*****************************************************************************/
static int aout_Probe( probedata_t *p_data )
{
if( TestMethod( AOUT_METHOD_VAR, "darwin" ) )
{
return( 999 );
}
/* The Darwin plugin always works under Darwin or MacOS X */
return( 100 );
}
/*****************************************************************************
* aout_Open: opens a dummy audio device
*****************************************************************************/
static int aout_Open( aout_thread_t *p_aout )
{
/* Initialize some variables */
p_aout->i_format = AOUT_FORMAT_DEFAULT;
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR,
AOUT_RATE_DEFAULT );
return( 0 );
}
/*****************************************************************************
* aout_SetFormat: pretends to set the dsp output format
*****************************************************************************/
static int aout_SetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_GetBufInfo: returns available bytes in buffer
*****************************************************************************/
static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
}
/*****************************************************************************
* aout_Play: pretends to play a sound
*****************************************************************************/
static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{
;
}
/*****************************************************************************
* aout_Close: closes the dummy audio device
*****************************************************************************/
static void aout_Close( aout_thread_t *p_aout )
{
;
}
/*****************************************************************************
* darwin.c : Darwin plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors:
*
* This program 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.
*
* This program 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, USA.
*****************************************************************************/
#define MODULE_NAME darwin
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "modules.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for Darwin module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( aout_getfunctions )( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
MODULE_INIT
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "Darwin sound support module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_AOUT;
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
MODULE_ACTIVATE
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
_M( aout_getfunctions )( &p_module->p_functions->aout );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
MODULE_DEACTIVATE
{
free( p_module->p_functions );
return( 0 );
}
......@@ -453,14 +453,14 @@ create_intf_window (void)
gtk_widget_show (label_bar);
gtk_box_pack_start (GTK_BOX (hbox4), label_bar, FALSE, FALSE, 0);
slider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 0, 6.25, 0)));
slider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 6.25, 0)));
gtk_widget_ref (slider);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "slider", slider,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (slider);
gtk_box_pack_start (GTK_BOX (vbox2), slider, TRUE, TRUE, 0);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_scale_set_digits (GTK_SCALE (slider), 0);
gtk_scale_set_digits (GTK_SCALE (slider), 3);
appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
gtk_widget_ref (appbar);
......
......@@ -567,12 +567,12 @@
</signal>
<draw_value>False</draw_value>
<value_pos>GTK_POS_TOP</value_pos>
<digits>0</digits>
<digits>3</digits>
<policy>GTK_UPDATE_CONTINUOUS</policy>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<step>0</step>
<step>1</step>
<page>6.25</page>
<page_size>0</page_size>
<child>
......
......@@ -562,6 +562,7 @@ create_intf_window (void)
gtk_widget_show (slider);
gtk_box_pack_start (GTK_BOX (vbox2), slider, TRUE, TRUE, 0);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_scale_set_digits (GTK_SCALE (slider), 3);
intf_statusbar = gtk_statusbar_new ();
gtk_widget_ref (intf_statusbar);
......
......@@ -568,7 +568,7 @@
</signal>
<draw_value>False</draw_value>
<value_pos>GTK_POS_TOP</value_pos>
<digits>1</digits>
<digits>3</digits>
<policy>GTK_UPDATE_CONTINUOUS</policy>
<value>0</value>
<lower>0</lower>
......
/*****************************************************************************
* intf_macosx.c: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors:
*
* This program 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.
*
* This program 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, USA.
*****************************************************************************/
#define MODULE_NAME macosx
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "intf_msg.h"
#include "interface.h"
#include "modules.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of the interface
*****************************************************************************/
typedef struct intf_sys_s
{
} intf_sys_t;
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int intf_Probe ( probedata_t *p_data );
static int intf_Open ( intf_thread_t *p_intf );
static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( intf_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = intf_Probe;
p_function_list->functions.intf.pf_open = intf_Open;
p_function_list->functions.intf.pf_close = intf_Close;
p_function_list->functions.intf.pf_run = intf_Run;
}
/*****************************************************************************
* intf_Probe: probe the interface and return a score
*****************************************************************************
* This function checks the interface can be run and returns a score to the
* plugin manager so that it can select the best plugin.
*****************************************************************************/
static int intf_Probe( probedata_t *p_data )
{
if( TestMethod( INTF_METHOD_VAR, "macosx" ) )
{
return( 999 );
}
/* Under MacOS X, this plugin always works */
return( 100 );
}
/*****************************************************************************
* intf_Open: initialize interface
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
return( 0 );
}
/*****************************************************************************
* intf_Close: destroy interface
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_Run: main loop
*****************************************************************************/
static void intf_Run( intf_thread_t *p_intf )
{
while( !p_intf->b_die )
{
/* Manage core vlc functions through the callback */
p_intf->pf_manage( p_intf );
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
}
/*****************************************************************************
* macosx.c : MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors:
*
* This program 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.
*
* This program 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, USA.
*****************************************************************************/
#define MODULE_NAME macosx
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "modules.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for MacOS X module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( aout_getfunctions )( function_list_t * p_function_list );
void _M( vout_getfunctions )( function_list_t * p_function_list );
void _M( intf_getfunctions )( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
MODULE_INIT
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "MacOS X interface and video module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_VOUT
| MODULE_CAPABILITY_INTF;
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
MODULE_ACTIVATE
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
_M( aout_getfunctions )( &p_module->p_functions->aout );
_M( vout_getfunctions )( &p_module->p_functions->vout );
_M( intf_getfunctions )( &p_module->p_functions->intf );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
MODULE_DEACTIVATE
{
free( p_module->p_functions );
return( 0 );
}
/*****************************************************************************
* vout_macosx.c: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors:
*
* This program 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.
*
* This program 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, USA.
*****************************************************************************/
#define MODULE_NAME macosx
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#include "modules.h"
#define DUMMY_WIDTH 16
#define DUMMY_HEIGHT 16
#define DUMMY_BITS_PER_PLANE 16
#define DUMMY_BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: MacOS X video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the MacOS X specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* MacOS X video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int vout_Probe ( probedata_t *p_data );
static int vout_Create ( struct vout_thread_s * );
static int vout_Init ( struct vout_thread_s * );
static void vout_End ( struct vout_thread_s * );
static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * );
static void vout_Display ( struct vout_thread_s * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( vout_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = vout_Probe;
p_function_list->functions.vout.pf_create = vout_Create;
p_function_list->functions.vout.pf_init = vout_Init;
p_function_list->functions.vout.pf_end = vout_End;
p_function_list->functions.vout.pf_destroy = vout_Destroy;
p_function_list->functions.vout.pf_manage = vout_Manage;
p_function_list->functions.vout.pf_display = vout_Display;
p_function_list->functions.vout.pf_setpalette = NULL;
}
/*****************************************************************************
* intf_Probe: return a score
*****************************************************************************/
static int vout_Probe( probedata_t *p_data )
{
if( TestMethod( VOUT_METHOD_VAR, "macosx" ) )
{
return( 999 );
}
return( 100 );
}
/*****************************************************************************
* vout_Create: allocates MacOS X video thread output method
*****************************************************************************
* This function allocates and initializes a MacOS X vout method.
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s", strerror(ENOMEM) );
return( 1 );
}
p_vout->i_width = DUMMY_WIDTH;
p_vout->i_height = DUMMY_HEIGHT;
p_vout->i_screen_depth = DUMMY_BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = DUMMY_BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = DUMMY_WIDTH * DUMMY_BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = DUMMY_WIDTH * DUMMY_HEIGHT
* DUMMY_BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( 2 * p_vout->p_sys->i_page_size );
if( p_vout->p_sys->p_video == NULL )
{
intf_ErrMsg( "vout error: can't map video memory (%s)",
strerror(errno) );
free( p_vout->p_sys );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* vout_Init: initialize video thread output method
*****************************************************************************/
static int vout_Init( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_End: terminate video thread output method
*****************************************************************************/
static void vout_End( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_Destroy: destroy video thread output method
*****************************************************************************/
static void vout_Destroy( vout_thread_t *p_vout )
{
free( p_vout->p_sys->p_video );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_Manage: handle events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
static int vout_Manage( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_Display: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
static void vout_Display( vout_thread_t *p_vout )
{
;
}
......@@ -2,7 +2,7 @@
* intf_qt.cpp: Qt interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_qt.cpp,v 1.1 2001/03/15 01:42:20 sam Exp $
* $Id: intf_qt.cpp,v 1.2 2001/03/18 00:01:13 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -69,6 +69,7 @@ extern "C"
#include <qmessagebox.h>
#include <qlabel.h>
#include <qtimer.h>
#include <qiconset.h>
#include <qvbox.h>
#include <qhbox.h>
......@@ -275,7 +276,8 @@ IntfWindow::IntfWindow( intf_thread_t *p_intf )
p_toolbar = new QToolBar( this, "toolbar" );
p_toolbar->setHorizontalStretchable( TRUE );
QPixmap pixmap = QPixmap( 0, 0 );
QIconSet * set = new QIconSet();
QPixmap pixmap = set->pixmap( QIconSet::Automatic, QIconSet::Normal );
#define addbut( l, t, s ) new QToolButton( pixmap, l, t, this, s, p_toolbar );
addbut( "Open", "Open a File", SLOT(FileOpen()) );
......@@ -487,13 +489,10 @@ void IntfWindow::Manage( void )
#undef p_area
}
/* If the "display popup" flag has changed */
/* If the "display popup" flag has changed, popup the context menu */
if( p_intf->b_menu_change )
{
/* FIXME: find a way to display this menu right under the mouse */
p_popup->popup( QPoint(
p_intf->p_sys->p_app->desktop()->width() / 2,
p_intf->p_sys->p_app->desktop()->height() / 2 ), 0 );
p_popup->popup( QCursor::pos() );
p_intf->b_menu_change = 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment