[xiph-cvs] cvs commit: win32-tools/oggdrop Script.rc audio.c encode.c main.c oggdrop.dsp oggdrop.opt

Chris Wolf cwolf at xiph.org
Sun Jan 6 11:17:02 PST 2002



cwolf       02/01/06 11:17:02

  Modified:    oggdrop  Script.rc audio.c encode.c main.c oggdrop.dsp
                        oggdrop.opt
  Log:
  Restored progress bars to original height by resizing main window, per
  request.  Show average bitrate when nominal bitrate is unavailable --
  show birate in both quality and bitrate encode modes.

Revision  Changes    Path
1.13      +1 -1      win32-tools/oggdrop/Script.rc

Index: Script.rc
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/Script.rc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Script.rc	2002/01/05 18:55:27	1.12
+++ Script.rc	2002/01/06 19:17:00	1.13
@@ -76,7 +76,7 @@
     BEGIN
         MENUITEM "&Encode Parameters",          IDM_SAVEQUALITY
         MENUITEM "&Errors to log file",         IDM_LOGERR
-        MENUITEM "&Show Nominal Bitrate",       IDM_SHOWNBR
+        MENUITEM "&Show Bitrate",               IDM_SHOWNBR
         MENUITEM "Always on &Top",              IDM_ONTOP
         MENUITEM SEPARATOR
         MENUITEM "E&xit\tAlt+F4",               IDM_QUIT

1.3       +1 -1      win32-tools/oggdrop/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/audio.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- audio.c	2001/08/12 20:08:38	1.2
+++ audio.c	2002/01/06 19:17:00	1.3
@@ -98,7 +98,7 @@
         if(!find_chunk(in, "fmt ", &len))
                 return 0; /* EOF */
 
-	/* dunamic allocation, since "fmt" chunk can be any length */
+	/* dynamic allocation, since "fmt" chunk can be any length */
         buf = malloc(len);
 
         if(len<16) 

1.6       +22 -5     win32-tools/oggdrop/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/encode.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- encode.c	2002/01/05 18:52:34	1.5
+++ encode.c	2002/01/06 19:17:00	1.6
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include <string.h>
 
 #include <vorbis/vorbisenc.h>
 #include "encode.h"
@@ -19,7 +20,8 @@
 
 #define READSIZE 1024
 
-extern int nominalBitrate;
+extern float nominalBitrate;
+extern char  approxBRCaption[];
 
 int oe_write_page(ogg_page *page, FILE *fp);
 
@@ -58,6 +60,11 @@
       vorbis_info_clear(&vi);
       return 1;
     }
+    else
+    {
+      (void) strcpy(approxBRCaption, "Bitrate");
+      nominalBitrate = (float)opt->bitrate*1000;
+    }
   }
         else
   {
@@ -69,7 +76,10 @@
       return 1;
     }
     else
-      nominalBitrate = vi.bitrate_nominal;
+    {
+      (void) strcpy(approxBRCaption, "Nominal Bitrate");
+      nominalBitrate = (float)vi.bitrate_nominal;
+    }
   }
 
         /* Now, set up the analysis engine, stream encoder, and other
@@ -130,12 +140,11 @@
                 {
                         samplesdone += samples_read;
 
-			/* Call progress update every 10 pages */
-			if(packetsdone>=10)
+			/* Call progress update every 10 samples */			
+      if (samplesdone % 10 == 0)
                         {
                                 double time;
 
-				packetsdone = 0;
                                 time = timer_time(timer);
 
                                 opt->progress_update(opt->filename, opt->total_samples_per_channel, 
@@ -187,6 +196,14 @@
                         }
                 }
         }
+
+  if (nominalBitrate <= 0.0)
+  {
+    nominalBitrate = (float)(8.0*((double)bytes_written
+    / ((double)samplesdone/(double)opt->rate)));
+
+    (void) strcpy(approxBRCaption, "Average Bitrate");
+  }
 
         /* Cleanup time */
 cleanup:

1.12      +29 -14    win32-tools/oggdrop/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/main.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- main.c	2002/01/05 19:19:42	1.11
+++ main.c	2002/01/06 19:17:00	1.12
@@ -20,7 +20,7 @@
               VARIABLE_PITCH | FF_SWISS, "")
    
 HANDLE event = NULL;
-int width = 120, height = 120;
+int width = 130, height = 130;
 RECT bar1, bar2, vbrBR;
 int prog1 = 0, prog2 = 0;
 int moving = 0;
@@ -40,8 +40,9 @@
 int bitRate;
 char *fileName;
 OE_MODE oe_mode;
-int nominalBitrate;
+float nominalBitrate;
 int showNBR;
+char approxBRCaption[80];
 
 
 static const char *bitRateCaption[] =
@@ -88,7 +89,7 @@
                 int value;
                 DWORD cb_value = sizeof(int);
                 if (ERROR_SUCCESS == RegQueryValueEx(base_key, name, NULL, NULL, 
-                                         (byte*)&value, &cb_value))
+                                         (BYTE*)&value, &cb_value))
                         return value;
         }
         return default_value;
@@ -98,7 +99,7 @@
 {
         HKEY base_key;
         if (!get_base_key(&base_key))
-		RegSetValueEx(base_key, name, 0, REG_DWORD, (byte*)&value, sizeof(int));
+		RegSetValueEx(base_key, name, 0, REG_DWORD, (BYTE*)&value, sizeof(int));
 }
 
 void set_quality_coefficient(int v)
@@ -140,8 +141,8 @@
         HWND hwnd;
         MSG msg;
         WNDCLASS wndclass;
-  const int width = 120;
-	const int height = 120;
+  const int width = 130;
+	const int height = 130;
         int x;
         int y;
 
@@ -180,6 +181,7 @@
         set_always_on_top(hwnd, read_setting("always_on_top", 1));
         set_logerr(hwnd, read_setting("logerr", 0));
   set_showNBR(hwnd, read_setting("shownbr", 1));
+  (void) strcpy(approxBRCaption, "Nominal Bitrate");
         
         for (frame = 0; frame < 12; frame++)
                 hbm[frame] = LoadImage(hinst, MAKEINTRESOURCE(IDB_TF01 + frame), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
@@ -274,27 +276,33 @@
                 percomp = ((double)(totalfiles - numfiles) + 1 - (1 - file_complete)) / (double)totalfiles;
 
     //SetRect(&vbrBR, 0, height - (height-14), width, height - (height-26));
-    SetRect(&vbrBR, 0, height - 29, width, height - 19);
+    SetRect(&vbrBR, 0, height - 35, width, height - 19);
 
     dfltBGMode = SetBkMode(offscreen, TRANSPARENT);
     dfltFont = SelectObject(offscreen, font2);
 
-    if (oe_mode == OE_MODE_QUALITY && showNBR)
+    if (showNBR)
     {
       char nbrCaption[80];
 
-      (void) sprintf(nbrCaption, "%d NBR", nominalBitrate);
+      (void) sprintf(nbrCaption, "%s: %.1f kbit/s ", 
+        approxBRCaption, nominalBitrate/1000);
 
+      if (oe_mode != OE_MODE_QUALITY)
+        (void) strcpy(approxBRCaption, "Bitrate");
+
       DrawText(offscreen, nbrCaption, -1, 
              &vbrBR, DT_SINGLELINE | DT_CENTER);
     }
 
 
-		SetRect(&bar1, 0, height - 19, (int)(file_complete * width), height - 9);
-		SetRect(&bar2, 0, height - 8, (int)(percomp * width), height - 2);
+		SetRect(&bar1, 0, height - 23, (int)(file_complete * width), height - 13);
+		SetRect(&bar2, 0, height - 12, (int)(percomp * width), height - 2);
+//		SetRect(&bar1, 0, height - 19, (int)(file_complete * width), height - 9);
+//		SetRect(&bar2, 0, height - 8, (int)(percomp * width), height - 2);
 
                 FillRect(offscreen, &bar1, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
-		FillRect(offscreen, &bar2, (HBRUSH)GetStockObject(GRAY_BRUSH));
+		FillRect(offscreen, &bar2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));
 
     if (fileName)
     {
@@ -520,6 +528,7 @@
     (void) CheckRadioButton(hwndDlg, IDC_USEQUALITY,
                                      IDC_USEBITRATE,
                                      IDC_USEQUALITY);
+    (void) strcpy(approxBRCaption, "Nominal Bitrate");
     
     break;
 
@@ -535,12 +544,15 @@
           {
             write_setting("mode", IDC_USEQUALITY);
             oe_mode = OE_MODE_QUALITY;
+            nominalBitrate = 0;
+            (void) strcpy(approxBRCaption, "Nominal Bitrate");
             EndDialog(hwndDlg, qcValue);
           }
           else
           {
             write_setting("mode", IDC_USEBITRATE);
             oe_mode = OE_MODE_BITRATE;
+            nominalBitrate = (float)(bitRate*1000);
             EndDialog(hwndDlg, -2); // use bitrate
           }
           return TRUE;
@@ -557,6 +569,9 @@
                    (WPARAM) br, (LPARAM) 0);
           }
 
+          (void) strcpy(approxBRCaption, "Bitrate");
+          nominalBitrate = (float)(bitRate*1000);
+
           break;
 
         case IDC_EDIT1:
@@ -597,7 +612,7 @@
             (void) CheckRadioButton(hwndDlg, IDC_USEQUALITY,
                                              IDC_USEBITRATE,
                                              IDC_USEQUALITY);
-
+            (void) strcpy(approxBRCaption, "Nominal Bitrate");
           }
             
             break;
@@ -643,4 +658,4 @@
   return FALSE; 
 } 
  
-        
\ No newline at end of file
+        

1.11      +1 -1      win32-tools/oggdrop/oggdrop.dsp

Index: oggdrop.dsp
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/oggdrop.dsp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- oggdrop.dsp	2002/01/01 03:26:13	1.10
+++ oggdrop.dsp	2002/01/06 19:17:00	1.11
@@ -43,7 +43,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\ogg\include" /I "..\..\vorbis\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\ogg\include" /I "..\..\vorbis\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32

1.9       +174 -54   win32-tools/oggdrop/oggdrop.opt

Index: oggdrop.opt
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/oggdrop.opt,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
Binary files /tmp/cvsOvQh7E and /tmp/cvscHRQ0f differ

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list