changeset 33876:4789b8eed97e

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.
author ib
date Thu, 11 Aug 2011 13:54:24 +0000
parents e23e8c872ae5
children c52940fe54dd
files 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
diffstat 9 files changed, 80 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/interface.c	Thu Aug 11 13:54:24 2011 +0000
@@ -457,7 +457,7 @@
         {
             char tmp[512];
 
-            sprintf(tmp, "dvd://%d", guiInfo.Title);
+            sprintf(tmp, "dvd://%d", guiInfo.Track);
             setdup(&guiInfo.Filename, tmp);
         }
 
@@ -655,24 +655,23 @@
 #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 @@
             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) {
--- a/gui/interface.h	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/interface.h	Thu Aug 11 13:54:24 2011 +0000
@@ -80,12 +80,6 @@
 };
 
 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 @@
 
 #ifdef CONFIG_DVDREAD
     guiDVDStruct DVD;
-    int Title;
+    int Chapters;
+    int Chapter;
+    int Angles;
     int Angle;
-    int Chapter;
 #endif
 
-#ifdef CONFIG_VCD
-    int VCDTracks;
+#if defined(CONFIG_VCD) || defined(CONFIG_DVDREAD)
+    int Tracks;
 #endif
 
     int Playing;
--- a/gui/ui/actions.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/ui/actions.c	Thu Aug 11 13:54:24 2011 +0000
@@ -318,16 +318,15 @@
 #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 @@
 #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;
--- a/gui/ui/gtk/menu.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/ui/gtk/menu.c	Thu Aug 11 13:54:24 2011 +0000
@@ -455,10 +455,10 @@
     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 @@
 //    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 @@
         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 );
         }
       }
--- a/gui/ui/main.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/ui/main.c	Thu Aug 11 13:54:24 2011 +0000
@@ -114,11 +114,17 @@
   }
 
 #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 @@
 #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 @@
 	       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 @@
         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
--- a/gui/ui/render.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/ui/render.c	Thu Aug 11 13:54:24 2011 +0000
@@ -74,8 +74,8 @@
 
 #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;
--- a/gui/win32/dialogs.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/win32/dialogs.c	Thu Aug 11 13:54:24 2011 +0000
@@ -819,17 +819,17 @@
                                  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 @@
                     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);
--- a/gui/win32/interface.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/gui/win32/interface.c	Thu Aug 11 13:54:24 2011 +0000
@@ -114,9 +114,9 @@
         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 @@
 #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 @@
     {
 #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 @@
     {
 #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 @@
                 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 @@
 #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 @@
           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))
--- a/mplayer.c	Wed Aug 10 20:17:20 2011 +0000
+++ b/mplayer.c	Thu Aug 11 13:54:24 2011 +0000
@@ -4006,7 +4006,7 @@
 #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
             }