Commit 25095c7a authored by Christophe Massiot's avatar Christophe Massiot

Beuheuheuheuhuehueuhuehuehu forgot to add new QuickTime files :*-(((

parent 28c71156
/*****************************************************************************
* intf_macosx.c: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors: Colin Delacroix <colin@zoy.org>
*
* 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.
*****************************************************************************/
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include <sys/param.h> /* for MAXPATHLEN */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "interface.h"
#include "intf_msg.h"
#include "intf_playlist.h"
#include "main.h"
#include "modules.h"
#include "modules_export.h"
#include "macosx_qt_common.h"
/*****************************************************************************
* 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 );
/* OS specific */
#define kMainLoopFrequency (kEventDurationSecond) //45 for good measure
static pascal OSStatus FS_suspend_resume_handler(EventHandlerCallRef ref, EventRef event, void *dummy) ;
static pascal void APP_timer_handler(EventLoopTimerRef timer, void *dummy) ;
/*****************************************************************************
* 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_qt" ) )
{
return( 999 );
}
/* Under MacOS X, this plugin always works */
return( 90 );
}
/*****************************************************************************
* intf_Open: initialize interface
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
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 )
{
static EventTypeSpec suspendResumeEvent[2] = {{kEventClassApplication,kEventAppActivated}, {kEventClassApplication,kEventAppDeactivated}} ;
BeginFullScreen(&p_intf->p_sys->before_fullscreen, nil, 0, 0, &p_intf->p_sys->p_window, 0, fullScreenAllowEvents) ;
InstallStandardEventHandler(GetApplicationEventTarget()) ;
InstallApplicationEventHandler(NewEventHandlerUPP(FS_suspend_resume_handler), 2, suspendResumeEvent, &p_intf->p_sys->p_window, NULL) ;
InstallEventLoopTimer(GetMainEventLoop(), 0, kMainLoopFrequency, NewEventLoopTimerUPP(APP_timer_handler), NULL, &p_intf->p_sys->r_timer) ;
ShowWindow(p_intf->p_sys->p_window );
p_intf->p_sys->b_active = 1 ;
RunApplicationEventLoop() ;
p_intf->p_sys->b_active = 0 ;
EndFullScreen(p_intf->p_sys->before_fullscreen, nil) ;
}
static pascal void APP_timer_handler(EventLoopTimerRef timer, void *dummy)
{
p_main->p_intf->pf_manage(p_main->p_intf) ;
if (p_main->p_intf->b_die) QuitApplicationEventLoop() ;
}
static pascal OSStatus FS_suspend_resume_handler(EventHandlerCallRef ref, EventRef event, void *dummy)
{
switch (GetEventKind(event))
{
case kEventAppActivated: ShowWindow(p_main->p_intf->p_sys->p_window) ;
SetPortWindowPort(p_main->p_intf->p_sys->p_window) ;
intf_WarnMsg(1, "Application is on foreground") ;
break ;
case kEventAppDeactivated: HideWindow(p_main->p_intf->p_sys->p_window) ;
intf_WarnMsg(1, "Application sent to background") ;
break ;
}
return noErr ;
}
/*****************************************************************************
* macosx.c : MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: macosx_qt.c,v 1.1 2001/10/08 23:10:28 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
*
* 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.
*****************************************************************************/
#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"
/*****************************************************************************
* 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 );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for MacOS X QuickTime module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_VOUT
| MODULE_CAPABILITY_AOUT
| MODULE_CAPABILITY_INTF;
p_module->psz_longname = "MacOS X QuickTime output";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
_M( vout_getfunctions )( &p_module->p_functions->vout );
_M( aout_getfunctions )( &p_module->p_functions->aout );
_M( intf_getfunctions )( &p_module->p_functions->intf );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* macosx.c : MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: macosx_qt_common.h,v 1.1 2001/10/08 23:10:28 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Constants & more
*****************************************************************************/
#ifndef __CARBONPREFIX__
#define __CARBONPREFIX__
// Needed for carbonization
#define TARGET_API_MAC_CARBON 1
// For the pascal to C or C to pascal string conversions in carbon
#define OLDP2C 1
#endif
#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include <CoreServices/CoreServices.h>
#include <QuickTime/QuickTime.h>
#include <ApplicationServices/ApplicationServices.h>
/*****************************************************************************
* Type declarations that unfortunately need to be known to both
* ...
* Kind of a hack due to the fact that on Mac OS, there is little difference
* between the interface and the video output, and hence little separation
* between those elements.
*****************************************************************************/
extern main_t *p_main;
/*****************************************************************************
* 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
{
ImageDescriptionHandle h_img_descr ;
ImageSequence i_seq ;
unsigned int i_img_size ;
unsigned char *p_img ;
} vout_sys_t;
/*****************************************************************************
* intf_sys_t: description and status of the interface
*****************************************************************************/
typedef struct intf_sys_s
{
Ptr before_fullscreen ;
WindowRef p_window;
EventLoopTimerRef r_timer ;
unsigned int b_active ;
} intf_sys_t;
This diff is collapsed.
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