[xiph-cvs] cvs commit: vorbis-tools/oggenc audio.c encode.c encode.h oggenc.c

Michael Smith msmith at xiph.org
Sat Sep 15 04:56:11 PDT 2001



msmith      01/09/15 04:56:11

  Modified:    oggenc   audio.c encode.c encode.h oggenc.c
  Log:
  Fix problems concerning console output (writing too long lines, and writing
  stuff when in quiet mode).

Revision  Changes    Path
1.16      +1 -3      vorbis-tools/oggenc/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/audio.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- audio.c	2001/08/28 21:40:48	1.15
+++ audio.c	2001/09/15 11:56:10	1.16
@@ -366,9 +366,7 @@
         if(len!=16)
                 fprintf(stderr, 
                                 "Warning: INVALID format chunk in wav header.\n"
-				" Trying to read anyway (may not work)...\n"
-				" The program that created this wav file is broken.\n"
-				" Don't use it, or report a bug.\n");
+				" Trying to read anyway (may not work)...\n");
 
         if(fread(buf,1,16,in) < 16)
         {

1.10      +23 -4     vorbis-tools/oggenc/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/encode.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- encode.c	2001/08/13 09:36:25	1.9
+++ encode.c	2001/09/15 11:56:10	1.10
@@ -45,6 +45,8 @@
 
         /* get start time. */
         timer = timer_start();
+    opt->start_encode(opt->infilename, opt->filename, opt->bitrate, 
+            opt->quality);
 
         /* Have vorbisenc choose a mode for us */
         vorbis_info_init(&vi);
@@ -211,8 +213,7 @@
         minutes = ((int)remain_time)/60;
         seconds = (int)(remain_time - (double)((int)remain_time/60)*60);
 
-	fprintf(stderr, "\rEncoding %s%s%s [%5.1f%%] [%2dm%.2ds remaining] %c", 
-			fn?"\"":"", fn?fn:"standard input", fn?"\"":"",
+	fprintf(stderr, "\r\t[%5.1f%%] [%2dm%.2ds remaining] %c", 
                         done*100.0/total, minutes, seconds, spinner[spinpoint++%4]);
 }
 
@@ -221,8 +222,8 @@
         static char *spinner="|/-\\";
         static int spinpoint =0;
         
-	fprintf(stderr, "\rEncoding %s%s%s %c", 
-			fn?"\"":"", fn?fn:"standard input", fn?"\"":"",
+	fprintf(stderr, "\r\tEncoding [%2dm%.2ds so far] %c", 
+            ((int)time)/60, (int)(time - (double)((int)time/60)*60),
                         spinner[spinpoint++%4]);
 }
 
@@ -273,5 +274,23 @@
         fprintf(stderr, "\n%s\n", errmsg);
 }
 
+void start_encode_full(char *fn, char *outfn, int bitrate, float quality)
+{
+    if(quality >= 0.0f)
+        fprintf(stderr, "Encoding %s%s%s to \n         %s%s%s at quality %f\n",
+			    fn?"\"":"", fn?fn:"standard input", fn?"\"":"",
+                outfn?"\"":"", outfn?outfn:"standard output", outfn?"\"":"",
+                quality);
+    else
+        fprintf(stderr, "Encoding %s%s%s to \n         "
+                "%s%s%s at bitrate %d kbps\n",
+			    fn?"\"":"", fn?fn:"standard input", fn?"\"":"",
+                outfn?"\"":"", outfn?outfn:"standard output", outfn?"\"":"",
+                bitrate);
+}
+
+void start_encode_null(char *fn, char *outfn, int bitrate, float quality)
+{
+}
 
 

1.10      +6 -0      vorbis-tools/oggenc/encode.h

Index: encode.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/encode.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- encode.h	2001/08/13 04:45:21	1.9
+++ encode.h	2001/09/15 11:56:10	1.10
@@ -11,6 +11,8 @@
                 long samples, double time);
 typedef void (*enc_end_func)(char *fn, double time, int rate, 
                 long samples, long bytes);
+typedef void (*enc_start_func)(char *fn, char *outfn, int bitrate, 
+        float quality);
 typedef void (*error_func)(char *errormessage);
 
 
@@ -21,6 +23,8 @@
 void update_statistics_full(char *fn, long total, long done, double time);
 void update_statistics_notime(char *fn, long total, long done, double time);
 void update_statistics_null(char *fn, long total, long done, double time);
+void start_encode_full(char *fn, char *outfn, int bitrate, float quality);
+void start_encode_null(char *fn, char *outfn, int bitrate, float quality);
 void final_statistics(char *fn, double time, int rate, long total_samples,
                 long bytes);
 void final_statistics_null(char *fn, double time, int rate, long total_samples,
@@ -70,6 +74,7 @@
         audio_read_func read_samples;
         progress_func progress_update;
         enc_end_func end_encode;
+	enc_start_func start_encode;
         error_func error;
         
         void *readdata;
@@ -85,6 +90,7 @@
 
         FILE *out;
         char *filename;
+	char *infilename;
 } oe_enc_opt;
 
 

1.28      +7 -2      vorbis-tools/oggenc/oggenc.c

Index: oggenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/oggenc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- oggenc.c	2001/08/13 09:36:25	1.27
+++ oggenc.c	2001/09/15 11:56:10	1.28
@@ -122,6 +122,7 @@
 
                 enc_opts.serialno = opt.serial++;
                 enc_opts.progress_update = update_statistics_full;
+        enc_opts.start_encode = start_encode_full;
                 enc_opts.end_encode = final_statistics;
                 enc_opts.error = encode_error;
                 
@@ -132,6 +133,7 @@
                 {
                         setbinmode(stdin);
                         in = stdin;
+            infiles[i] = NULL;
                         if(!opt.outfile)
                         {
                                 setbinmode(stdout);
@@ -170,8 +172,9 @@
                         format = open_audio_file(in, &enc_opts);
                         if(format)
                         {
-				fprintf(stderr, "Opening with %s module: %s\n", 
-						format->format, format->description);
+                if(!opt.quiet)
+				    fprintf(stderr, "Opening with %s module: %s\n", 
+					    	format->format, format->description);
                                 foundformat=1;
                         }
 
@@ -240,6 +243,7 @@
                 enc_opts.out = out;
                 enc_opts.comments = &vc;
                 enc_opts.filename = out_fn;
+		enc_opts.infilename = infiles[i];
                 enc_opts.bitrate = opt.nominal_bitrate; 
                 enc_opts.min_bitrate = opt.min_bitrate;
                 enc_opts.max_bitrate = opt.max_bitrate;
@@ -250,6 +254,7 @@
 
                 if(opt.quiet)
                 {
+            enc_opts.start_encode = start_encode_null;
                         enc_opts.progress_update = update_statistics_null;
                         enc_opts.end_encode = final_statistics_null;
                 }

--- >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