]> git.sesse.net Git - vlc/commitdiff
* Fixed a warning for *BSD compilation.
authorSam Hocevar <sam@videolan.org>
Fri, 25 May 2001 13:20:10 +0000 (13:20 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 25 May 2001 13:20:10 +0000 (13:20 +0000)
  * 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.

plugins/dvd/dvd_ioctl.c
plugins/macosx/intf_macosx.c
plugins/macosx/macosx_common.h
plugins/macosx/vout_macosx.c
plugins/sdl/vout_sdl.c
plugins/x11/vout_x11.c
plugins/x11/vout_xvideo.c
src/input/input.c

index 930858a8b9f60d9eb4534e860a6086e85a3c3a96..63c10da172c2ff673e1f9ec2ae486a96d2e7cd4d 100644 (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 */
index 60aabbbf2242f62bebe5906d945b5bb330182542..def873f7e7dc4316b33d9bccc0492d06a6f1c2ce 100644 (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 )
+    ifp_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
index a3a4c052825da735288532c428b539ab3dee4676..8bfc7d053613f3d709ad2b49d249011c0cfc22ee 100755 (executable)
@@ -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;
index 5a88ca9b1f44f459d6b68ebf9edad081a2d43741..7d4705e1b24bde3a7ce31e64a764641ab75d6c38 100644 (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 );
 }
 
index 0fc2e47291e75fa521e9df398f732a3bdda73a32..900356a4659e0e6cc764fa42ecc50e767fda606b 100644 (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>
 #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"
index 774c2aa982283747d5c5019c28a3835970729b7b..a2e830bd65575b577cc4115dff69f8d1f2472ea8 100644 (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>
 #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>
index caa7c85a84be251bfdbb270f59f73f7c0d3f9bd3..ac1de28bbef93cdb80c9e5ff23a0a4556bd69408 100644 (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>
 #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>
index 1ba25fa6e2309e0c412770d7d75b15476aeb8693..975c02ece4c31fdabbfb306a9f1145b05fdff780 100644 (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