Commit 409f93dd authored by Sam Hocevar's avatar Sam Hocevar

  * 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.
parent 7de920d3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ioctl.c: DVD ioctl replacement function * dvd_ioctl.c: DVD ioctl replacement function
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -252,7 +252,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid ) ...@@ -252,7 +252,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, IODVD_REPORT_KEY, &dvdioctl ); i_ret = ioctl( i_fd, IODVD_REPORT_KEY, &dvdioctl );
*pi_asf = p_buffer[ 7 ] >> 6; *pi_agid = p_buffer[ 7 ] >> 6;
#else #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
......
...@@ -159,6 +159,8 @@ typedef struct intf_sys_s ...@@ -159,6 +159,8 @@ typedef struct intf_sys_s
EventLoopTimerRef manageTimer; EventLoopTimerRef manageTimer;
Rect aboutRect; Rect aboutRect;
WindowRef p_aboutWindow; WindowRef p_aboutWindow;
int playback_status; //moved from vout ; prolly didn't belong
//there for a good reason ; more like Beos
} intf_sys_t; } intf_sys_t;
/***************************************************************************** /*****************************************************************************
...@@ -179,6 +181,7 @@ OSErr MyOpenDocument(const FSSpecPtr defaultLocationfssPtr); ...@@ -179,6 +181,7 @@ OSErr MyOpenDocument(const FSSpecPtr defaultLocationfssPtr);
void playorpause ( intf_thread_t *p_intf ); void playorpause ( intf_thread_t *p_intf );
void stop ( intf_thread_t *p_intf ); void stop ( intf_thread_t *p_intf );
void silence ( intf_thread_t *p_intf );
#ifndef CarbonEvents #ifndef CarbonEvents
...@@ -527,27 +530,37 @@ void DoEvent( intf_thread_t *p_intf , EventRecord *event) ...@@ -527,27 +530,37 @@ void DoEvent( intf_thread_t *p_intf , EventRecord *event)
//the code for playorpause and stop taken almost directly from the BeOS code //the code for playorpause and stop taken almost directly from the BeOS code
void playorpause ( intf_thread_t *p_intf ) void playorpause ( intf_thread_t *p_intf )
{ {
// pause the playback int i_index;
// pause the playback
if (p_intf->p_input != NULL ) if (p_intf->p_input != NULL )
{ {
// mute the volume if currently playing // mute the volume if currently playing
if (p_main->p_vout->p_sys->playback_status == PLAYING) if (p_intf->p_sys->playback_status == PLAYING)
{ {
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 = 0; 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;
} }
p_main->p_vout->p_sys->playback_status = PAUSED; vlc_mutex_unlock( &p_aout_bank->lock );
p_intf->p_sys->playback_status = PAUSED;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPlay"); SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPlay");
} }
else else
// restore the volume // restore 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_main->p_vout->p_sys->vol_val; 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;
} }
p_main->p_vout->p_sys->playback_status = PLAYING; vlc_mutex_unlock( &p_aout_bank->lock );
p_intf->p_sys->playback_status = PLAYING;
SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPause"); SetMenuItemText( GetMenuHandle(kMenuControls), kControlsPlayORPause, "\pPause");
} }
//snooze(400000); //snooze(400000);
...@@ -557,18 +570,24 @@ void playorpause ( intf_thread_t *p_intf ) ...@@ -557,18 +570,24 @@ void playorpause ( intf_thread_t *p_intf )
void stop ( intf_thread_t *p_intf ) void stop ( intf_thread_t *p_intf )
{ {
int i_index;
// this currently stops playback not nicely // this currently stops playback not nicely
if (p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
// silence the sound, otherwise very horrible // silence the sound, otherwise very horrible
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 = 0; 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;
} }
//snooze(400000); vlc_mutex_unlock( &p_aout_bank->lock );
input_SetStatus(p_intf->p_input, INPUT_STATUS_END);
//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) ...@@ -576,7 +595,8 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
{ {
short menuID; /* the resource ID of the selected menu */ short menuID; /* the resource ID of the selected menu */
short menuItem; /* the item number 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 */ menuID = HiWord(menuResult); /* use macros to get item & menu number */
menuItem = LoWord(menuResult); menuItem = LoWord(menuResult);
...@@ -607,8 +627,15 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -607,8 +627,15 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
switch (menuItem) switch (menuItem)
{ {
case kFileNew: case kFileNew:
ShowWindow( p_main->p_vout->p_sys->p_window ); vlc_mutex_lock( &p_vout_bank->lock );
SelectWindow( p_main->p_vout->p_sys->p_window ); /* 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); DisableMenuItem( GetMenuHandle(kMenuFile), kFileNew);
EnableMenuItem( GetMenuHandle(kMenuFile), kFileClose); EnableMenuItem( GetMenuHandle(kMenuFile), kFileClose);
//hmm, can't say to play() right now because I don't know if a file is in playlist yet. //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) ...@@ -623,7 +650,18 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
case kFileClose: case kFileClose:
HideWindow( FrontWindow() ); 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 //calling this even if no file open shouldn't be bad... not sure of opposite situation above
stop( p_intf ); stop( p_intf );
...@@ -657,10 +695,14 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -657,10 +695,14 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
// cycle the fast playback modes // cycle the fast playback modes
if (p_intf->p_input != NULL ) if (p_intf->p_input != NULL )
{ {
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 = 0; 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); //snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER); input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
} }
...@@ -670,12 +712,16 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -670,12 +712,16 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
// cycle the slow playback modes // cycle the slow playback modes
if (p_intf->p_input != NULL ) if (p_intf->p_input != NULL )
{ {
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 = 0; 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); //snooze(400000);
input_SetStatus(p_intf->p_input, INPUT_STATUS_SLOWER); input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
} }
break; break;
...@@ -704,36 +750,45 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult) ...@@ -704,36 +750,45 @@ void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
case kControlsVolumeUp: case kControlsVolumeUp:
// adjust the volume // 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; break;
case kControlsVolumeDown: case kControlsVolumeDown:
// adjust the volume // 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; break;
case kControlsVolumeMute: case kControlsVolumeMute:
// mute // 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_main->p_aout->i_vol == 0) if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
{ {
//p_vol->SetEnabled(true); p_aout_bank->pp_aout[i_index]->i_volume =
p_main->p_aout->i_vol = p_main->p_vout->p_sys->vol_val; p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
} }
else else
{ {
//p_vol->SetEnabled(false); p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_main->p_vout->p_sys->vol_val = p_main->p_aout->i_vol; p_aout_bank->pp_aout[i_index]->i_volume;
p_main->p_aout->i_vol = 0; p_aout_bank->pp_aout[i_index]->i_volume = 0;
} }
} }
vlc_mutex_unlock( &p_aout_bank->lock );
break; break;
case kControlsEject: case kControlsEject:
......
...@@ -69,7 +69,4 @@ typedef struct vout_sys_s ...@@ -69,7 +69,4 @@ typedef struct vout_sys_s
Ptr theBase; Ptr theBase;
int theRow; int theRow;
int theDepth; int theDepth;
int playback_status; // remember playback state
int vol_val; // remember the current volume
} vout_sys_t; } vout_sys_t;
...@@ -456,7 +456,8 @@ static void vout_Display( vout_thread_t *p_vout ) ...@@ -456,7 +456,8 @@ static void vout_Display( vout_thread_t *p_vout )
{ {
// intf_ErrMsg( "vout_Display()" ); // 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 ); BlitToWindow ( p_vout, p_vout->i_buffer_index );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method * vout_sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include "config.h" #include "config.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_x11.c: X11 video output display method * vout_x11.c: X11 video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -42,6 +42,10 @@ ...@@ -42,6 +42,10 @@
#include <sys/ipc.h> #include <sys/ipc.h>
#endif #endif
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <sys/shm.h> /* shmget(), shmctl() */ #include <sys/shm.h> /* shmget(), shmctl() */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method * vout_xvideo.c: Xvideo video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN * 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> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#include <sys/ipc.h> #include <sys/ipc.h>
#endif #endif
#ifndef WIN32
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#include <sys/shm.h> /* shmget(), shmctl() */ #include <sys/shm.h> /* shmget(), shmctl() */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -73,8 +73,6 @@ ...@@ -73,8 +73,6 @@
#include "main.h" #include "main.h"
/* #include <netutils.h> */
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
......
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