changeset 5665:3e7f39c4110c

fix dvd playing under gui
author pontscho
date Wed, 17 Apr 2002 21:12:12 +0000
parents ee6c9530729f
children 685df37d2c80
files Gui/app.c Gui/app.h Gui/interface.c Gui/interface.h Gui/mplayer/mw.h Gui/mplayer/play.c Gui/skin/skin.c mplayer.c
diffstat 8 files changed, 68 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/app.c	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/app.c	Wed Apr 17 21:12:12 2002 +0000
@@ -38,7 +38,6 @@
  item->fontid=0;
  if ( item->label ) free( item->label ); item->label=NULL;
  item->event=0;
- item->used=0;
 }
 
 void appCopy( listItems * dest,listItems * source )
--- a/Gui/app.h	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/app.h	Wed Apr 17 21:12:12 2002 +0000
@@ -34,7 +34,6 @@
  int        pressed,disabled,tmp;
  int        key,key2;
  int        phases;
- int        used;
  float      value;
  txSample   Bitmap;
  txSample   Mask;
--- a/Gui/interface.c	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/interface.c	Wed Apr 17 21:12:12 2002 +0000
@@ -14,6 +14,7 @@
 #include "app.h"
 #include "../libvo/x11_common.h"
 #include "../input/input.h"
+#include "../libmpdemux/stream.h"
 
 guiInterface_t guiIntfStruct;
 
@@ -46,6 +47,7 @@
 
 void guiGetEvent( int type,char * arg )
 {
+ dvd_priv_t * dvdp = (dvd_priv_t *) arg;
  switch ( type )
   {
    case guiXEvent:
@@ -60,6 +62,27 @@
           case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
 	 }
         break;
+   case guiSetState:
+	mplState();
+        break;
+   case guiSetFileName:
+        if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
+        break;
+#ifdef USE_DVDREAD
+   case guiSetDVD:
+        guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
+        guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
+        guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
+        guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
+        memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
+        guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
+        memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
+        guiIntfStruct.DVD.current_title=dvd_title + 1;
+        guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
+        guiIntfStruct.DVD.current_angle=dvd_angle + 1;
+        guiIntfStruct.Track=dvd_title + 1;
+        break;
+#endif
 #ifdef HAVE_NEW_INPUT
    case guiIEvent:
         printf( "cmd: %d\n",(int)arg );
--- a/Gui/interface.h	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/interface.h	Wed Apr 17 21:12:12 2002 +0000
@@ -93,9 +93,12 @@
 
 extern guiInterface_t guiIntfStruct;
 
-#define guiXEvent 0
-#define guiCEvent 1
-#define guiIEvent 2
+#define guiXEvent      0
+#define guiCEvent      1
+#define guiIEvent      2
+#define guiSetDVD      3
+#define guiSetFileName 4
+#define guiSetState    5
 
 #define guiSetStop  0
 #define guiSetPlay  1
--- a/Gui/mplayer/mw.h	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/mplayer/mw.h	Wed Apr 17 21:12:12 2002 +0000
@@ -200,6 +200,7 @@
 extern void exit_player(char* how);
 extern int audio_id;
 extern int dvdsub_id;
+extern char * dvd_device;
 
 void mplEventHandling( int msg,float param )
 {
@@ -214,16 +215,16 @@
 
 #ifdef USE_DVDREAD
    case evPlayDVD:
-        dvd_title=1;
-        dvd_chapter=1;
-        dvd_angle=1;
+        guiIntfStruct.DVD.current_title=1;
+        guiIntfStruct.DVD.current_chapter=1;
+        guiIntfStruct.DVD.current_angle=1;
 play_dvd_2:
         guiIntfStruct.StreamType=STREAMTYPE_DVD;
 #endif
    case evPlay:
    case evPlaySwitchToPause:
         mplMainAutoPlay=0;
-        if ( ( msg == evPlaySwitchToPause )&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
+        if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
 
         switch ( guiIntfStruct.StreamType )
          {
@@ -234,7 +235,12 @@
                break;
 #ifdef USE_DVDREAD
           case STREAMTYPE_DVD:
-               guiSetFilename( guiIntfStruct.Filename,"/dev/dvd" );
+	       if ( !dvd_device ) dvd_device=DEFAULT_DVD_DEVICE;
+               guiSetFilename( guiIntfStruct.Filename,dvd_device );
+	       dvd_title=guiIntfStruct.DVD.current_title;
+	       dvd_angle=guiIntfStruct.DVD.current_angle;
+               dvd_chapter=guiIntfStruct.DVD.current_chapter;
+               guiIntfStruct.DVDChanged=1;
                break;
 #endif
          }
@@ -244,32 +250,20 @@
 #ifdef USE_DVDREAD
    case evSetDVDSubtitle:
         dvdsub_id=(int)param;
-        dvd_title=guiIntfStruct.DVD.current_title;
-        dvd_angle=guiIntfStruct.DVD.current_angle;
-        dvd_chapter=guiIntfStruct.DVD.current_chapter;
-        guiIntfStruct.DVDChanged=1;
         goto play_dvd_2;
         break;
    case evSetDVDAudio:
         audio_id=(int)param;
-        dvd_title=guiIntfStruct.DVD.current_title;
-        dvd_angle=guiIntfStruct.DVD.current_angle;
-        dvd_chapter=guiIntfStruct.DVD.current_chapter;
-        guiIntfStruct.DVDChanged=1;
         goto play_dvd_2;
         break;
    case evSetDVDChapter:
-        dvd_title=guiIntfStruct.DVD.current_title;
-        dvd_angle=guiIntfStruct.DVD.current_angle;
-        dvd_chapter=(int)param;
-        guiIntfStruct.DVDChanged=1;
+        guiIntfStruct.DVD.current_chapter=(int)param;
         goto play_dvd_2;
         break;
    case evSetDVDTitle:
-        dvd_title=(int)param;
-        dvd_chapter=1;
-        dvd_angle=1;
-        guiIntfStruct.DVDChanged=1;
+        guiIntfStruct.DVD.current_title=(int)param;
+	guiIntfStruct.DVD.current_chapter=1;
+	guiIntfStruct.DVD.current_angle=1;
         goto play_dvd_2;
         break;
 #endif
@@ -439,7 +433,6 @@
           item=&appMPlayer.Items[SelectedItem];
           itemtype=item->type;
           item->pressed=btnPressed;
-          item->used=1;
           switch( item->type )
            {
             case itButton:
@@ -461,7 +454,6 @@
            {
             case itPotmeter:
             case itHPotmeter:
-                 item->used=0;
                  btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
                  switch ( item->msg )
                   {
@@ -489,7 +481,6 @@
           item=&appMPlayer.Items[currentselected];
           if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
            {
-            item->used=0;
             item->value+=value;
             btnModify( item->msg,item->value );
             switch ( item->msg )
--- a/Gui/mplayer/play.c	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/mplayer/play.c	Wed Apr 17 21:12:12 2002 +0000
@@ -9,6 +9,7 @@
 #include "../../config.h"
 #include "../../help_mp.h"
 #include "../../libvo/x11_common.h"
+#include "../../input/input.h"
 
 #include "../app.h"
 
@@ -65,13 +66,13 @@
  guiIntfStruct.TimeSec=0;
  guiIntfStruct.Position=0;
  guiIntfStruct.AudioType=0;
+ mplState();
 // if ( !guiIntfStruct.Playing ) return;
  if ( !appMPlayer.subWindow.isFullScreen )
   {
    wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
    wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
   }
- guiGetEvent( guiCEvent,guiSetStop );
  mplSubRender=1;
  wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
  wsClearWindow( appMPlayer.subWindow );
@@ -93,16 +94,10 @@
 
 void mplPause( void )
 {
- switch( guiIntfStruct.Playing )
-  {
-   case 1: // playing
-        guiIntfStruct.Playing=2;
-        break;
-   case 2: // paused
-        guiIntfStruct.Playing=1;
-        break;
-  }
- mplState();
+ mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
+ cmd->id=MP_CMD_PAUSE;
+ cmd->name=strdup("pause");
+ mp_input_queue_cmd(cmd);
  mplSubRender=0;
 }
 
--- a/Gui/skin/skin.c	Wed Apr 17 20:46:12 2002 +0000
+++ b/Gui/skin/skin.c	Wed Apr 17 21:12:12 2002 +0000
@@ -648,7 +648,6 @@
  for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
   if ( appMPlayer.Items[j].msg == event )
    {
-    if ( appMPlayer.Items[j].used ) continue;
     switch ( appMPlayer.Items[j].type )
      {
       case itButton:
--- a/mplayer.c	Wed Apr 17 20:46:12 2002 +0000
+++ b/mplayer.c	Wed Apr 17 21:12:12 2002 +0000
@@ -769,17 +769,8 @@
 #ifdef HAVE_NEW_GUI
     if ( use_gui ) {
 
-#ifdef USE_DVDREAD 
-     if ( guiIntfStruct.DVDChanged ) 
-      {
-       guiIntfStruct.DVDChanged=0;
-       guiGetEvent( guiCEvent,(char *)guiSetPlay );
-       filename="/dev/dvd";
-       goto play_dvd;
-      }
-#endif
-
-      while(guiIntfStruct.Playing!=1){
+      while ( guiIntfStruct.Playing != 1 )
+       {
 #ifdef HAVE_NEW_INPUT
         mp_cmd_t* cmd;                                                                                   
 #endif
@@ -788,9 +779,16 @@
 #ifdef HAVE_NEW_INPUT
 	if ( (cmd = mp_input_get_cmd(0,0)) != NULL) guiGetEvent( guiIEvent,(char *)cmd->id );
 #endif
+       } 
+
+#ifdef USE_DVDREAD 
+     if ( guiIntfStruct.DVDChanged )
+      {
+       guiIntfStruct.DVDChanged=0;
+       guiGetEvent( guiCEvent,(char *)guiSetPlay );
+       filename=DEFAULT_DVD_DEVICE;
       }
-
-play_dvd:
+#endif
 
 #ifdef USE_SUB
       if ( guiIntfStruct.SubtitleChanged || !guiIntfStruct.FilenameChanged )
@@ -799,7 +797,11 @@
         guiIntfStruct.SubtitleChanged=0;
        }
 #endif
-      if ( guiIntfStruct.FilenameChanged || !filename )
+      if ( ( guiIntfStruct.FilenameChanged || !filename )
+#ifdef USE_DVDREAD
+           && ( guiIntfStruct.StreamType != STREAMTYPE_DVD )
+#endif
+       )      
        {
         play_tree_t * entry = play_tree_new();
         play_tree_add_file( entry,guiIntfStruct.Filename );
@@ -819,7 +821,6 @@
 	    filename = play_tree_iter_get_file(playtree_iter,1);
 	   }
          }
-//	filename=playtree->child->files[0]; 
    	guiIntfStruct.FilenameChanged=0;
        } 
     }
@@ -1284,25 +1285,11 @@
      guiIntfStruct.MovieWidth=sh_video->disp_w;
      guiIntfStruct.MovieHeight=sh_video->disp_h;
      guiIntfStruct.StreamType=stream->type;
-     guiSetFilename( guiIntfStruct.Filename,filename );
+     guiGetEvent( guiSetFileName,filename );
      if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels;
       else guiIntfStruct.AudioType=0;
 #ifdef USE_DVDREAD
-     if ( stream->type == STREAMTYPE_DVD )
-      {
-       dvd_priv_t * dvdp = stream->priv;
-       guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
-       guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
-       guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
-       guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
-       memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
-       guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
-       memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
-       guiIntfStruct.DVD.current_title=dvd_title + 1;
-       guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
-       guiIntfStruct.DVD.current_angle=dvd_angle + 1;
-       guiIntfStruct.Track=dvd_title + 1;
-      } 
+     if ( stream->type == STREAMTYPE_DVD ) guiGetEvent( guiSetDVD,(char *)stream->priv );
 #endif
     }
 #endif