* Fixed a warning for *BSD compilation.

* Fixed a typo in yesterday's Darwin ioctl fixes.
  * Patch by Eugenio so that the OS X interface and video output handle the
    aout and vout banks.
This commit is contained in:
Sam Hocevar 2001-05-25 13:20:10 +00:00
parent 7de920d351
commit 409f93dd9f
8 changed files with 137 additions and 74 deletions

View File

@ -2,7 +2,7 @@
* dvd_ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.12 2001/05/25 04:23:37 sam Exp $
* $Id: dvd_ioctl.c,v 1.13 2001/05/25 13:20:09 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
@ -252,7 +252,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, IODVD_REPORT_KEY, &dvdioctl );
*pi_asf = p_buffer[ 7 ] >> 6;
*pi_agid = p_buffer[ 7 ] >> 6;
#else
/* DVD ioctls unavailable - do as if the ioctl failed */

View File

@ -159,6 +159,8 @@ typedef struct intf_sys_s
EventLoopTimerRef manageTimer;
Rect aboutRect;
WindowRef p_aboutWindow;
int playback_status; //moved from vout ; prolly didn't belong
//there for a good reason ; more like Beos
} intf_sys_t;
/*****************************************************************************
@ -179,6 +181,7 @@ OSErr MyOpenDocument(const FSSpecPtr defaultLocationfssPtr);
void playorpause ( intf_thread_t *p_intf );
void stop ( intf_thread_t *p_intf );
void silence ( intf_thread_t *p_intf );
#ifndef CarbonEvents
@ -527,48 +530,64 @@ void DoEvent( intf_thread_t *p_intf , EventRecord *event)
//the code for playorpause and stop taken almost directly from the BeOS code
void playorpause ( intf_thread_t *p_intf )
{
// pause the playback
int i_index;
// pause the playback
if (p_intf->p_input != NULL )
{
// mute the volume if currently playing
if (p_main->p_vout->p_sys->playback_status == PLAYING)
// mute the volume if currently playing
if (p_intf->p_sys->playback_status == PLAYING)
{
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if (p_main->p_aout != NULL)
{
p_main->p_aout->i_vol = 0;
}
p_main->p_vout->p_sys->playback_status = PAUSED;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPlay");
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
else
// restore the volume
vlc_mutex_unlock( &p_aout_bank->lock );
p_intf->p_sys->playback_status = PAUSED;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPlay");
}
else
// restore the volume
{
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if (p_main->p_aout != NULL)
{
p_main->p_aout->i_vol = p_main->p_vout->p_sys->vol_val;
}
p_main->p_vout->p_sys->playback_status = PLAYING;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPause");
p_aout_bank->pp_aout[i_index]->i_volume =
p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
}
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_PAUSE);
vlc_mutex_unlock( &p_aout_bank->lock );
p_intf->p_sys->playback_status = PLAYING;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPause");
}
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_PAUSE);
}
}
void stop ( intf_thread_t *p_intf )
{
int i_index;
// this currently stops playback not nicely
if (p_intf->p_input != NULL )
if( p_intf->p_input != NULL )
{
// silence the sound, otherwise very horrible
if (p_main->p_aout != NULL)
{
p_main->p_aout->i_vol = 0;
}
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_END);
// silence the sound, otherwise very horrible
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume = p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
//snooze( 400000 );
input_SetStatus( p_intf->p_input, INPUT_STATUS_END );
}
p_main->p_vout->p_sys->playback_status = STOPPED;
p_intf->p_sys->playback_status = STOPPED;
}
@ -576,7 +595,8 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
{
short menuID; /* the resource ID of the selected menu */
short menuItem; /* the item number of the selected menu */
int i_index;
vout_thread_t *p_vout;
menuID = HiWord(menuResult); /* use macros to get item & menu number */
menuItem = LoWord(menuResult);
@ -607,8 +627,15 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
switch (menuItem)
{
case kFileNew:
ShowWindow( p_main->p_vout->p_sys->p_window );
SelectWindow( p_main->p_vout->p_sys->p_window );
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only test the first video output */
if( p_vout_bank->i_count )
{
p_vout = p_vout_bank->pp_vout[0];
ShowWindow( p_vout->p_sys->p_window );
SelectWindow( p_vout->p_sys->p_window );
}
vlc_mutex_unlock( &p_vout_bank->lock );
DisableMenuItem( GetMenuHandle(kMenuFile), kFileNew);
EnableMenuItem( GetMenuHandle(kMenuFile), kFileClose);
//hmm, can't say to play() right now because I don't know if a file is in playlist yet.
@ -623,7 +650,18 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
case kFileClose:
HideWindow( FrontWindow() );
if ( ! IsWindowVisible( p_main->p_vout->p_sys->p_window ) && ! IsWindowVisible( p_intf->p_sys->p_aboutWindow ) )
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only test the first video output */
if( p_vout_bank->i_count )
{
p_vout = p_vout_bank->pp_vout[0];
printf("ok\n");
}
else printf("NO\n");
vlc_mutex_unlock( &p_vout_bank->lock );
if ( ! IsWindowVisible( p_vout->p_sys->p_window ) && ! IsWindowVisible( p_intf->p_sys->p_aboutWindow ) )
{
//calling this even if no file open shouldn't be bad... not sure of opposite situation above
stop( p_intf );
@ -657,12 +695,16 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
// cycle the fast playback modes
if (p_intf->p_input != NULL )
{
if (p_main->p_aout != NULL)
{
p_main->p_aout->i_vol = 0;
}
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
}
break;
@ -670,12 +712,16 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
// cycle the slow playback modes
if (p_intf->p_input != NULL )
{
if (p_main->p_aout != NULL)
{
p_main->p_aout->i_vol = 0;
}
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_SLOWER);
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
//snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
}
break;
@ -704,37 +750,46 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
case kControlsVolumeUp:
// adjust the volume
if (p_main->p_aout != NULL)
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_main->p_aout->i_vol++;
// ++p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = ++p_aout_bank->pp_aout[i_index]->i_volume;
}
vlc_mutex_unlock( &p_aout_bank->lock );
break;
case kControlsVolumeDown:
// adjust the volume
if (p_main->p_aout != NULL)
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_main->p_aout->i_vol--;
// --p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = --p_aout_bank->pp_aout[i_index]->i_volume;
}
vlc_mutex_unlock( &p_aout_bank->lock );
break;
case kControlsVolumeMute:
// mute
if (p_main->p_aout != NULL)
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
{
if (p_main->p_aout->i_vol == 0)
{
//p_vol->SetEnabled(true);
p_main->p_aout->i_vol = p_main->p_vout->p_sys->vol_val;
}
else
{
//p_vol->SetEnabled(false);
p_main->p_vout->p_sys->vol_val = p_main->p_aout->i_vol;
p_main->p_aout->i_vol = 0;
}
}
break;
p_aout_bank->pp_aout[i_index]->i_volume =
p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
}
else
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
break;
case kControlsEject:
//Fixme

View File

@ -69,7 +69,4 @@ typedef struct vout_sys_s
Ptr theBase;
int theRow;
int theDepth;
int playback_status; // remember playback state
int vol_val; // remember the current volume
} vout_sys_t;

View File

@ -456,7 +456,8 @@ static void vout_Display( vout_thread_t *p_vout )
{
// intf_ErrMsg( "vout_Display()" );
if ( p_vout->p_sys->playback_status != PAUSED && p_vout->p_sys->playback_status != STOPPED )
//we should not be called if we set the status to paused or stopped via the interface
// if ( p_vout->p_sys->playback_status != PAUSED && p_vout->p_sys->playback_status != STOPPED )
BlitToWindow ( p_vout, p_vout->i_buffer_index );
}

View File

@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_sdl.c,v 1.51 2001/05/07 04:42:42 sam Exp $
* $Id: vout_sdl.c,v 1.52 2001/05/25 13:20:09 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
@ -35,6 +35,10 @@
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <SDL/SDL.h>
#include "config.h"

View File

@ -2,7 +2,7 @@
* vout_x11.c: X11 video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_x11.c,v 1.24 2001/05/07 03:14:09 stef Exp $
* $Id: vout_x11.c,v 1.25 2001/05/25 13:20:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
@ -42,6 +42,10 @@
#include <sys/ipc.h>
#endif
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <sys/shm.h> /* shmget(), shmctl() */
#include <X11/Xlib.h>
#include <X11/Xutil.h>

View File

@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: vout_xvideo.c,v 1.16 2001/05/07 04:42:42 sam Exp $
* $Id: vout_xvideo.c,v 1.17 2001/05/25 13:20:09 sam Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
@ -43,6 +43,10 @@
#include <sys/ipc.h>
#endif
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <sys/shm.h> /* shmget(), shmctl() */
#include <X11/Xlib.h>
#include <X11/Xutil.h>

View File

@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.108 2001/05/19 00:39:30 stef Exp $
* $Id: input.c,v 1.109 2001/05/25 13:20:10 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -73,8 +73,6 @@
#include "main.h"
/* #include <netutils.h> */
/*****************************************************************************
* Local prototypes