[MPlayer-cvslog] r33964 - in trunk: gui/interface.c gui/interface.h gui/ui/actions.c gui/ui/gtk/menu.c gui/ui/main.c gui/ui/render.c gui/win32/dialogs.c gui/win32/interface.c mplayer.c

ib subversion at mplayerhq.hu
Thu Aug 11 15:54:25 CEST 2011


Author: ib
Date: Thu Aug 11 15:54:24 2011
New Revision: 33964

Log:
Get rid of a bunch of needless or redundant guiInfo members.

Remove Title, use existing Track.
Remove DVD.titles, use existing Tracks (see below).
Remove DVD.current_title, use existing Track.
Remove DVD.current_chapter, use existing Chapter.
Remove DVD.current_angle, use existing Angle.

Additionally rename member VCDTracks Tracks,
move guiDVDStruct member chapters and angles to guiInterface_t struct
and rename chapters Chapters and angles Angles for consistency.

Modified:
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/ui/actions.c
   trunk/gui/ui/gtk/menu.c
   trunk/gui/ui/main.c
   trunk/gui/ui/render.c
   trunk/gui/win32/dialogs.c
   trunk/gui/win32/interface.c
   trunk/mplayer.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/interface.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -457,7 +457,7 @@ int gui(int what, void *data)
         {
             char tmp[512];
 
-            sprintf(tmp, "dvd://%d", guiInfo.Title);
+            sprintf(tmp, "dvd://%d", guiInfo.Track);
             setdup(&guiInfo.Filename, tmp);
         }
 
@@ -655,24 +655,23 @@ int gui(int what, void *data)
 #ifdef CONFIG_DVDREAD
         case STREAMTYPE_DVD:
             dvd = stream->priv;
-            guiInfo.DVD.titles   = dvd->vmg_file->tt_srpt->nr_of_srpts;
-            guiInfo.DVD.chapters = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
-            guiInfo.DVD.angles   = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
+            guiInfo.Tracks   = dvd->vmg_file->tt_srpt->nr_of_srpts;
+            guiInfo.Chapters = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
+            guiInfo.Angles   = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
             guiInfo.DVD.nr_of_audio_channels = dvd->nr_of_channels;
             memcpy(guiInfo.DVD.audio_streams, dvd->audio_streams, sizeof(dvd->audio_streams));
             guiInfo.DVD.nr_of_subtitles = dvd->nr_of_subtitles;
             memcpy(guiInfo.DVD.subtitles, dvd->subtitles, sizeof(dvd->subtitles));
-            guiInfo.DVD.current_title   = dvd_title + 1;
-            guiInfo.DVD.current_chapter = dvd_chapter + 1;
-            guiInfo.DVD.current_angle   = dvd_angle + 1;
-            guiInfo.Track = dvd_title + 1;
+            guiInfo.Track   = dvd_title + 1;
+            guiInfo.Chapter = dvd_chapter + 1;
+            guiInfo.Angle   = dvd_angle + 1;
             break;
 #endif
 
 #ifdef CONFIG_VCD
         case STREAMTYPE_VCD:
-            guiInfo.VCDTracks = 0;
-            stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.VCDTracks);
+            guiInfo.Tracks = 0;
+            stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.Tracks);
             break;
 #endif
 
@@ -803,9 +802,9 @@ int gui(int what, void *data)
             guiInfo.MovieWindow   = True;
 
 #ifdef CONFIG_DVDREAD
-            guiInfo.DVD.current_title   = 1;
-            guiInfo.DVD.current_chapter = 1;
-            guiInfo.DVD.current_angle   = 1;
+            guiInfo.Track   = 1;
+            guiInfo.Chapter = 1;
+            guiInfo.Angle   = 1;
 #endif
 
             if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) {

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/interface.h	Thu Aug 11 15:54:24 2011	(r33964)
@@ -80,12 +80,6 @@ enum {
 };
 
 typedef struct {
-    int titles;
-    int chapters;
-    int angles;
-    int current_chapter;
-    int current_title;
-    int current_angle;
     int nr_of_audio_channels;
     stream_language_t audio_streams[32];
     int nr_of_subtitles;
@@ -102,13 +96,14 @@ typedef struct {
 
 #ifdef CONFIG_DVDREAD
     guiDVDStruct DVD;
-    int Title;
-    int Angle;
+    int Chapters;
     int Chapter;
+    int Angles;
+    int Angle;
 #endif
 
-#ifdef CONFIG_VCD
-    int VCDTracks;
+#if defined(CONFIG_VCD) || defined(CONFIG_DVDREAD)
+    int Tracks;
 #endif
 
     int Playing;

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/ui/actions.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -318,16 +318,15 @@ void uiPrev(void)
 #ifdef CONFIG_DVDREAD
     case STREAMTYPE_DVD:
 
-        if (--guiInfo.DVD.current_chapter == 0) {
-            guiInfo.DVD.current_chapter = 1;
+        if (--guiInfo.Chapter == 0) {
+            guiInfo.Chapter = 1;
 
-            if (--guiInfo.DVD.current_title <= 0) {
-                guiInfo.DVD.current_title = 1;
+            if (--guiInfo.Track <= 0) {
+                guiInfo.Track = 1;
                 stop = 1;
             }
         }
 
-        guiInfo.Track = guiInfo.DVD.current_title;
         break;
 #endif
 
@@ -372,25 +371,24 @@ void uiNext(void)
 #ifdef CONFIG_DVDREAD
     case STREAMTYPE_DVD:
 
-        if (guiInfo.DVD.current_chapter++ == guiInfo.DVD.chapters) {
-            guiInfo.DVD.current_chapter = 1;
+        if (guiInfo.Chapter++ == guiInfo.Chapters) {
+            guiInfo.Chapter = 1;
 
-            if (++guiInfo.DVD.current_title > guiInfo.DVD.titles) {
-                guiInfo.DVD.current_title = guiInfo.DVD.titles;
+            if (++guiInfo.Track > guiInfo.Tracks) {
+                guiInfo.Track = guiInfo.Tracks;
                 stop = 1;
             }
         }
 
-        guiInfo.Track = guiInfo.DVD.current_title;
         break;
 #endif
 
 #ifdef CONFIG_VCD
     case STREAMTYPE_VCD:
 
-        if (++guiInfo.Track >= guiInfo.VCDTracks) {
-            stop = (guiInfo.Track > guiInfo.VCDTracks);
-            guiInfo.Track = FFMAX(2, guiInfo.VCDTracks);
+        if (++guiInfo.Track >= guiInfo.Tracks) {
+            stop = (guiInfo.Track > guiInfo.Tracks);
+            guiInfo.Track = FFMAX(2, guiInfo.Tracks);
         }
 
         break;

Modified: trunk/gui/ui/gtk/menu.c
==============================================================================
--- trunk/gui/ui/gtk/menu.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/ui/gtk/menu.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -455,10 +455,10 @@ GtkWidget * create_PopUpMenu( void )
     AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
     AddSeparator( VCDSubMenu );
     VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
-    if ( guiInfo.VCDTracks )
+    if ( guiInfo.Tracks )
      {
       char tmp[32]; int i;
-      for ( i=1;i < guiInfo.VCDTracks;i++ )
+      for ( i=1;i < guiInfo.Tracks;i++ )
        {
         snprintf( tmp,32,MSGTR_MENU_Title,i );
     //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack );
@@ -477,14 +477,14 @@ GtkWidget * create_PopUpMenu( void )
 //    AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
     AddSeparator( DVDSubMenu );
     DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
-     if ( guiInfo.DVD.titles )
+     if ( guiInfo.Tracks )
       {
        char tmp[32]; int i;
-       for ( i=1 ; i<= guiInfo.DVD.titles;i++ )
+       for ( i=1 ; i<= guiInfo.Tracks;i++ )
         {
          snprintf( tmp,32,MSGTR_MENU_Title,i);
          AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
-			   guiInfo.DVD.current_title == i,
+			   guiInfo.Track == i,
 			   (i << 16) + evSetDVDTitle );
         }
       }
@@ -494,13 +494,13 @@ GtkWidget * create_PopUpMenu( void )
         gtk_widget_set_sensitive( MenuItem,FALSE );
        }
     DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
-     if ( guiInfo.DVD.chapters )
+     if ( guiInfo.Chapters )
       {
        char tmp[32]; int i;
-       for ( i=1;i <= guiInfo.DVD.chapters;i++ )
+       for ( i=1;i <= guiInfo.Chapters;i++ )
         {
          snprintf( tmp,32,MSGTR_MENU_Chapter,i );
-         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.DVD.current_chapter == i,
+         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.Chapter == i,
 			   ( i << 16 ) + evSetDVDChapter );
         }
       }

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/ui/main.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -114,11 +114,17 @@ static void guiInfoMediumClear (int what
   }
 
 #ifdef CONFIG_DVDREAD
-  if (what & CLEAR_DVD) memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct));
+  if (what & CLEAR_DVD)
+  {
+    memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct));
+    guiInfo.Tracks = 0;
+    guiInfo.Chapters = 0;
+    guiInfo.Angles = 0;
+  }
 #endif
 
 #ifdef CONFIG_VCD
-  if (what & CLEAR_VCD) guiInfo.VCDTracks = 0;
+  if (what & CLEAR_VCD) guiInfo.Tracks = 0;
 #endif
 }
 
@@ -169,9 +175,9 @@ void uiEventHandling( int msg,float para
 #endif
 #ifdef CONFIG_DVDREAD
    case evPlayDVD:
-        guiInfo.DVD.current_title=1;
-        guiInfo.DVD.current_chapter=1;
-        guiInfo.DVD.current_angle=1;
+        guiInfo.Track=1;
+        guiInfo.Chapter=1;
+        guiInfo.Angle=1;
 play_dvd_2:
  	guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD );
         guiInfo.StreamType=STREAMTYPE_DVD;
@@ -216,9 +222,6 @@ play:
 	       uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
 	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
-		 guiInfo.Title=guiInfo.DVD.current_title;
-		 guiInfo.Chapter=guiInfo.DVD.current_chapter;
-		 guiInfo.Angle=guiInfo.DVD.current_angle;
                  guiInfo.DiskChanged=1;
 		}
                break;
@@ -237,13 +240,13 @@ play:
         goto play_dvd_2;
         break;
    case evSetDVDChapter:
-        guiInfo.DVD.current_chapter=iparam;
+        guiInfo.Chapter=iparam;
         goto play_dvd_2;
         break;
    case evSetDVDTitle:
-        guiInfo.DVD.current_title=iparam;
-	guiInfo.DVD.current_chapter=1;
-	guiInfo.DVD.current_angle=1;
+        guiInfo.Track=iparam;
+	guiInfo.Chapter=1;
+	guiInfo.Angle=1;
         goto play_dvd_2;
         break;
 #endif

Modified: trunk/gui/ui/render.c
==============================================================================
--- trunk/gui/ui/render.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/ui/render.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -74,8 +74,8 @@ static void TranslateFilename(int c, cha
 
 #ifdef CONFIG_DVDREAD
     case STREAMTYPE_DVD:
-        if (guiInfo.DVD.current_chapter)
-            snprintf(tmp, tmplen, MSGTR_Chapter, guiInfo.DVD.current_chapter);
+        if (guiInfo.Chapter)
+            snprintf(tmp, tmplen, MSGTR_Chapter, guiInfo.Chapter);
         else
             av_strlcat(tmp, MSGTR_NoChapter, tmplen);
         break;

Modified: trunk/gui/win32/dialogs.c
==============================================================================
--- trunk/gui/win32/dialogs.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/win32/dialogs.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -819,17 +819,17 @@ static LRESULT CALLBACK TitleChapterWndP
                                  NULL);
             SendMessage(chapter, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
-            for (i=0; i<guiInfo.DVD.titles; i++)
+            for (i=0; i<guiInfo.Tracks; i++)
             {
                 /* we have to reverse the order here because of the way CB_INSERTSTRING adds items */
-                sprintf(&titles[i], "%d", guiInfo.DVD.titles - i);
+                sprintf(&titles[i], "%d", guiInfo.Tracks - i);
                 SendDlgItemMessage(hwnd, ID_TITLESEL, CB_INSERTSTRING, 0, (LPARAM) &titles[i]);
             }
             SendDlgItemMessage(hwnd, ID_TITLESEL, CB_SETCURSEL, dvd_title, 0);
 
-            for (j=0; j<guiInfo.DVD.chapters; j++)
+            for (j=0; j<guiInfo.Chapters; j++)
             {
-                sprintf(&chapters[j], "%d", guiInfo.DVD.chapters - j);
+                sprintf(&chapters[j], "%d", guiInfo.Chapters - j);
                 SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_INSERTSTRING, 0, (LPARAM) &chapters[j]);
             }
             SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_SETCURSEL, dvd_chapter, 0);
@@ -844,10 +844,10 @@ static LRESULT CALLBACK TitleChapterWndP
                     return 0;
                 case ID_OK:
                 {
-                    guiInfo.DVD.current_title = SendMessage(title, CB_GETCURSEL, 0, 0) + 1;
-                    guiInfo.DVD.current_chapter = SendMessage(chapter, CB_GETCURSEL, 0, 0) + 1;
+                    guiInfo.Track = SendMessage(title, CB_GETCURSEL, 0, 0) + 1;
+                    guiInfo.Chapter = SendMessage(chapter, CB_GETCURSEL, 0, 0) + 1;
 
-                    if((guiInfo.DVD.current_title != 0 || guiInfo.DVD.current_chapter != 0))
+                    if((guiInfo.Track != 0 || guiInfo.Chapter != 0))
                     {
                         gui->startplay(gui);
                         DestroyWindow(hwnd);

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/gui/win32/interface.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -114,9 +114,9 @@ static void guiSetEvent(int event)
         case evPlayDVD:
         {
             static char dvdname[MAX_PATH];
-            guiInfo.DVD.current_title = dvd_title;
-            guiInfo.DVD.current_chapter = dvd_chapter;
-            guiInfo.DVD.current_angle = dvd_angle;
+            guiInfo.Track = dvd_title;
+            guiInfo.Chapter = dvd_chapter;
+            guiInfo.Angle = dvd_angle;
             guiInfo.DiskChanged = 1;
 
             uiSetFileName(NULL, dvd_device, STREAMTYPE_DVD);
@@ -235,9 +235,6 @@ static void guiSetEvent(int event)
 #ifdef CONFIG_DVDREAD
                 case STREAMTYPE_DVD:
                 {
-                    guiInfo.Title = guiInfo.DVD.current_title;
-                    guiInfo.Chapter = guiInfo.DVD.current_chapter;
-                    guiInfo.Angle = guiInfo.DVD.current_angle;
                     guiInfo.DiskChanged = 1;
                     gui(GUI_SET_STATE, (void *) GUI_PLAY);
                     break;
@@ -298,9 +295,9 @@ void uiNext(void)
     {
 #ifdef CONFIG_DVDREAD
         case STREAMTYPE_DVD:
-            if(guiInfo.DVD.current_chapter == (guiInfo.DVD.chapters - 1))
+            if(guiInfo.Chapter == (guiInfo.Chapters - 1))
                 return;
-            guiInfo.DVD.current_chapter++;
+            guiInfo.Chapter++;
             break;
 #endif
         default:
@@ -320,9 +317,9 @@ void uiPrev(void)
     {
 #ifdef CONFIG_DVDREAD
         case STREAMTYPE_DVD:
-            if(guiInfo.DVD.current_chapter == 1)
+            if(guiInfo.Chapter == 1)
                 return;
-            guiInfo.DVD.current_chapter--;
+            guiInfo.Chapter--;
             break;
 #endif
         default:
@@ -461,10 +458,10 @@ int gui(int what, void *data)
                 case STREAMTYPE_DVD:
                 {
                     char tmp[512];
-                    dvd_title = guiInfo.DVD.current_title;
-                    dvd_chapter = guiInfo.DVD.current_chapter;
-                    dvd_angle = guiInfo.DVD.current_angle;
-                    sprintf(tmp,"dvd://%d", guiInfo.Title);
+                    dvd_title = guiInfo.Track;
+                    dvd_chapter = guiInfo.Chapter;
+                    dvd_angle = guiInfo.Angle;
+                    sprintf(tmp,"dvd://%d", guiInfo.Track);
                     setdup(&guiInfo.Filename, tmp);
                     break;
                 }
@@ -524,16 +521,15 @@ int gui(int what, void *data)
 #ifdef CONFIG_DVDREAD
                 case STREAMTYPE_DVD:
                     dvdp = stream->priv;
-                    guiInfo.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
-                    guiInfo.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
-                    guiInfo.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
+                    guiInfo.Tracks = dvdp->vmg_file->tt_srpt->nr_of_srpts;
+                    guiInfo.Chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
+                    guiInfo.Angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
                     guiInfo.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
                     memcpy(guiInfo.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
                     guiInfo.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
                     memcpy(guiInfo.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
-                    guiInfo.DVD.current_title = dvd_title + 1;
-                    guiInfo.DVD.current_chapter = dvd_chapter + 1;
-                    guiInfo.DVD.current_angle = dvd_angle + 1;
+                    guiInfo.Chapter = dvd_chapter + 1;
+                    guiInfo.Angle = dvd_angle + 1;
                     guiInfo.Track = dvd_title + 1;
                     break;
 #endif
@@ -674,9 +670,9 @@ int gui(int what, void *data)
           guiInfo.AudioChannels = 0;
 
 #ifdef CONFIG_DVDREAD
-          guiInfo.DVD.current_title = 1;
-          guiInfo.DVD.current_chapter = 1;
-          guiInfo.DVD.current_angle = 1;
+          guiInfo.Track = 1;
+          guiInfo.Chapter = 1;
+          guiInfo.Angle = 1;
 #endif
 
           if (mygui->playlist->current == (mygui->playlist->trackcount - 1))

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Aug 10 22:17:20 2011	(r33963)
+++ trunk/mplayer.c	Thu Aug 11 15:54:24 2011	(r33964)
@@ -4006,7 +4006,7 @@ goto_enable_cache:
 #ifdef CONFIG_DVDREAD
                 if (mpctx->stream->type == STREAMTYPE_DVD) {
                     dvd_priv_t *dvdp = mpctx->stream->priv;
-                    guiInfo.DVD.current_chapter = dvd_chapter_from_cell(dvdp, guiInfo.DVD.current_title - 1, dvdp->cur_cell) + 1;
+                    guiInfo.Chapter = dvd_chapter_from_cell(dvdp, guiInfo.Track - 1, dvdp->cur_cell) + 1;
                 }
 #endif
             }


More information about the MPlayer-cvslog mailing list