[xiph-commits] r14460 - trunk/vorbis-tools/oggenc

ivo at svn.xiph.org ivo at svn.xiph.org
Wed Feb 6 14:35:34 PST 2008


Author: ivo
Date: 2008-02-06 14:35:32 -0800 (Wed, 06 Feb 2008)
New Revision: 14460

Modified:
   trunk/vorbis-tools/oggenc/encode.c
   trunk/vorbis-tools/oggenc/oggenc.c
   trunk/vorbis-tools/oggenc/skeleton.c
Log:
Cleaned up useless whitespace.

Modified: trunk/vorbis-tools/oggenc/encode.c
===================================================================
--- trunk/vorbis-tools/oggenc/encode.c	2008-02-06 22:31:35 UTC (rev 14459)
+++ trunk/vorbis-tools/oggenc/encode.c	2008-02-06 22:35:32 UTC (rev 14460)
@@ -48,7 +48,7 @@
             toset = lval;\
     } while(0)
 
-static void set_advanced_encoder_options(adv_opt *opts, int count, 
+static void set_advanced_encoder_options(adv_opt *opts, int count,
         vorbis_info *vi)
 {
     int manage = 0;
@@ -100,7 +100,7 @@
             fprintf(stderr, _("Changed lowpass frequency from %f kHz to %f kHz\n"), prev, new);
         }
         else {
-            fprintf(stderr, _("Unrecognised advanced option \"%s\"\n"), 
+            fprintf(stderr, _("Unrecognised advanced option \"%s\"\n"),
                     opts[i].arg);
         }
     }
@@ -113,25 +113,25 @@
 }
 
 void add_fishead_packet (ogg_stream_state *os) {
- 
-   fishead_packet fp; 
- 
-   memset(&fp, 0, sizeof(fp)); 
-   fp.ptime_n = 0; 
-   fp.ptime_d = 1000; 
-   fp.btime_n = 0; 
-   fp.btime_d = 1000; 
- 
-   add_fishead_to_stream(os, &fp); 
-} 
- 
-/* 
- * Adds the fishead packets in the skeleton output stream along with the e_o_s packet 
- */ 
+
+   fishead_packet fp;
+
+   memset(&fp, 0, sizeof(fp));
+   fp.ptime_n = 0;
+   fp.ptime_d = 1000;
+   fp.btime_n = 0;
+   fp.btime_d = 1000;
+
+   add_fishead_to_stream(os, &fp);
+}
+
+/*
+ * Adds the fishead packets in the skeleton output stream along with the e_o_s packet
+ */
 void add_fisbone_packet (ogg_stream_state *os, oe_enc_opt *opt) {
- 
+
    fisbone_packet fp;
- 
+
    memset(&fp, 0, sizeof(fp));
    fp.serial_no = opt->serialno;
    fp.nr_header_packet = 3;
@@ -140,9 +140,9 @@
    fp.start_granule = 0;
    fp.preroll = 2;
    fp.granule_shift = 0;
- 
+
    add_message_header_field(&fp, "Content-Type", "audio/vorbis");
- 
+
    add_fisbone_to_stream(os, &fp);
 }
 
@@ -187,10 +187,10 @@
 
     opt->start_encode(opt->infilename, opt->filename, opt->bitrate, opt->quality, 
               opt->quality_set, opt->managed, opt->min_bitrate, opt->max_bitrate);
-    
+
     /* Have vorbisenc choose a mode for us */
     vorbis_info_init(&vi);
- 
+
     if(opt->quality_set > 0){
         if(vorbis_encode_setup_vbr(&vi, opt->channels, opt->rate, opt->quality)){
             fprintf(stderr, _("Mode initialisation failed: invalid parameters for quality\n"));
@@ -212,7 +212,7 @@
                bitrate-oriented setup functions. Unfortunately, some of those
                values are dependent on the bitrate, and libvorbis has no way to
                get a nominal bitrate from a quality value. Well, except by doing
-               a full setup... So, we do that. 
+               a full setup... So, we do that.
                Also, note that this won't work correctly unless you have 
            version 1.1.1 or later of libvorbis.
              */
@@ -230,7 +230,7 @@
             ai.bitrate_average_damping = 1.5;
             ai.bitrate_limit_reservoir_bits = bitrate * 2;
             ai.bitrate_limit_reservoir_bias = .1;
- 
+
             /* And now the ones we actually wanted to set */
             ai.bitrate_limit_min_kbps=opt->min_bitrate;
             ai.bitrate_limit_max_kbps=opt->max_bitrate;
@@ -256,7 +256,7 @@
             return 1;
         }
     }
- 
+
     if(opt->managed && opt->bitrate < 0)
     {
       struct ovectl_ratemanage2_arg ai;
@@ -269,9 +269,9 @@
         /* Turn off management entirely (if it was turned on). */
         vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, NULL);
     }
- 
+
     set_advanced_encoder_options(opt->advopt, opt->advopt_count, &vi);
- 
+
     vorbis_encode_setup_init(&vi);
 
 
@@ -285,7 +285,7 @@
     ogg_stream_init(&os, opt->serialno);
     if (opt->with_skeleton) 
         ogg_stream_init(&so, opt->skeleton_serialno);
- 
+
     /* create the skeleton fishead packet and output it */ 
     if (opt->with_skeleton) { 
         add_fishead_packet(&so); 
@@ -310,25 +310,25 @@
         /* And stream them out */
         /* output the vorbis bos first, then the fisbone packets */
         ogg_stream_packetin(&os,&header_main);
-	while((result = ogg_stream_flush(&os, &og))) 
-        { 
-            if(!result) break; 
-            ret = oe_write_page(&og, opt->out); 
-            if(ret != og.header_len + og.body_len) 
-            { 
-                opt->error(_("Failed writing header to output stream\n")); 
-                ret = 1; 
-                goto cleanup; /* Bail and try to clean up stuff */ 
-            } 
-        } 
- 
-        if (opt->with_skeleton) { 
-            add_fisbone_packet(&so, opt); 
-            if ((ret = flush_ogg_stream_to_file(&so, opt->out))) { 
-                opt->error("Failed writing fisbone header packet to output stream\n"); 
+	while((result = ogg_stream_flush(&os, &og)))
+        {
+            if(!result) break;
+            ret = oe_write_page(&og, opt->out);
+            if(ret != og.header_len + og.body_len)
+            {
+                opt->error(_("Failed writing header to output stream\n"));
+                ret = 1;
+                goto cleanup; /* Bail and try to clean up stuff */
+            }
+        }
+
+        if (opt->with_skeleton) {
+            add_fisbone_packet(&so, opt);
+            if ((ret = flush_ogg_stream_to_file(&so, opt->out))) {
+                opt->error("Failed writing fisbone header packet to output stream\n");
                 goto cleanup; 
-           } 
-        } 
+           }
+        }
         ogg_stream_packetin(&os,&header_comments);
         ogg_stream_packetin(&os,&header_codebooks);
 
@@ -418,7 +418,7 @@
                     }
                     else
                         bytes_written += ret; 
- 
+
                     if(ogg_page_eos(&og))
                         eos = 1;
                 }
@@ -452,7 +452,7 @@
     static int spinpoint = 0;
     double remain_time;
     int minutes=0,seconds=0;
- 
+
     remain_time = time/((double)done/(double)total) - time;
     minutes = ((int)remain_time)/60;
     seconds = (int)(remain_time - (double)((int)remain_time/60)*60);
@@ -579,5 +579,3 @@
         int managed, int min, int max)
 {
 }
-
-

Modified: trunk/vorbis-tools/oggenc/oggenc.c
===================================================================
--- trunk/vorbis-tools/oggenc/oggenc.c	2008-02-06 22:31:35 UTC (rev 14459)
+++ trunk/vorbis-tools/oggenc/oggenc.c	2008-02-06 22:35:32 UTC (rev 14460)
@@ -69,11 +69,11 @@
     {NULL,0,0,0}
 };
 
-static char *generate_name_string(char *format, char *remove_list, 
-        char *replace_list, char *artist, char *title, char *album, 
+static char *generate_name_string(char *format, char *remove_list,
+        char *replace_list, char *artist, char *title, char *album,
         char *track, char *date, char *genre);
 static void parse_options(int argc, char **argv, oe_options *opt);
-static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum, 
+static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum,
         char **artist,char **album, char **title, char **tracknum, char **date,
         char **genre);
 static void usage(void);
@@ -81,10 +81,10 @@
 int main(int argc, char **argv)
 {
     /* Default values */
-    oe_options opt = {NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
+    oe_options opt = {NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL,
               0, NULL, 0, NULL, 0, NULL, 0, 1, 0, 0, 0,16,44100,2, 0, NULL,
-              DEFAULT_NAMEFMT_REMOVE, DEFAULT_NAMEFMT_REPLACE, 
-              NULL, 0, -1,-1,-1,.3,-1,0, 0,0.f, 0, 0}; 
+              DEFAULT_NAMEFMT_REMOVE, DEFAULT_NAMEFMT_REPLACE,
+              NULL, 0, -1,-1,-1,.3,-1,0, 0,0.f, 0, 0};
 
     int i;
 
@@ -161,7 +161,7 @@
         enc_opts.with_skeleton = opt.with_skeleton;
 
         /* OK, let's build the vorbis_comments structure */
-        build_comments(&vc, &opt, i, &artist, &album, &title, &track, 
+        build_comments(&vc, &opt, i, &artist, &album, &title, &track,
                 &date, &genre);
 
         if(!strcmp(infiles[i], "-"))
@@ -203,7 +203,7 @@
             enc_opts.channels=opt.raw_channels;
             enc_opts.samplesize=opt.raw_samplesize;
             enc_opts.endianness=opt.raw_endianness;
-            
+
             format = &raw_format;
             format->open_func(in, &enc_opts, NULL, 0);
             foundformat=1;
@@ -214,7 +214,7 @@
             if(format)
             {
                 if(!opt.quiet)
-                    fprintf(stderr, _("Opening with %s module: %s\n"), 
+                    fprintf(stderr, _("Opening with %s module: %s\n"),
                             format->format, format->description);
                 foundformat=1;
             }
@@ -260,7 +260,7 @@
             */
             else if(infiles[i])
             {
-                /* Create a filename from existing filename, replacing extension with .ogg */
+                /* Create a filename from existing filename, replacing extension with .ogg or .oga */
                 char *start, *end;
 
                 start = infiles[i];
@@ -304,7 +304,7 @@
                 errors++;
                 free(out_fn);
                 continue;
-            }    
+            }
             closeout = 1;
         }
 
@@ -399,7 +399,7 @@
         " -Q, --quiet          Produce no output to stderr\n"
         " -h, --help           Print this help text\n"
         " -v, --version        Print the version number\n"
-        " -k, --skeleton       Outputs ogg skeleton metadata\n"
+        " -k, --skeleton       Adds an Ogg Skeleton bitstream\n"
         " -r, --raw            Raw mode. Input files are read directly as PCM data\n"
         " -B, --raw-bits=n     Set bits/sample for raw input. Default is 16\n"
         " -C, --raw-chan=n     Set number of channels for raw input. Default is 2\n"
@@ -489,7 +489,7 @@
         "\n"), VERSION_STRING, COPYRIGHT);
 }
 
-static int strncpy_filtered(char *dst, char *src, int len, char *remove_list, 
+static int strncpy_filtered(char *dst, char *src, int len, char *remove_list,
         char *replace_list)
 {
     char *hit, *drop_margin;
@@ -597,7 +597,7 @@
     int ret;
     int option_index = 1;
 
-    while((ret = getopt_long(argc, argv, "A:a:b:B:c:C:d:G:hkl:m:M:n:N:o:P:q:QrR:s:t:vX:", 
+    while((ret = getopt_long(argc, argv, "A:a:b:B:c:C:d:G:hkl:m:M:n:N:o:P:q:QrR:s:t:vX:",
                     long_options, &option_index)) != -1)
     {
         switch(ret)
@@ -911,7 +911,7 @@
             i = opt->artist_count-1;
         else
             i = filenum;
-    
+
         *artist = opt->artist[i];
         add_tag(vc, opt, "artist", opt->artist[i]);
     }
@@ -933,11 +933,11 @@
             i = opt->date_count-1;
         else
             i = filenum;
-    
+
         *date = opt->dates[i];
         add_tag(vc, opt, "date", opt->dates[i]);
     }
-    
+
     if(opt->album_count)
     {
         if(filenum >= opt->album_count)
@@ -958,4 +958,3 @@
         add_tag(vc, opt, "tracknumber", opt->tracknum[i]);
     }
 }
-

Modified: trunk/vorbis-tools/oggenc/skeleton.c
===================================================================
--- trunk/vorbis-tools/oggenc/skeleton.c	2008-02-06 22:31:35 UTC (rev 14459)
+++ trunk/vorbis-tools/oggenc/skeleton.c	2008-02-06 22:35:32 UTC (rev 14460)
@@ -21,9 +21,9 @@
 
 #include "skeleton.h"
 
-#ifdef WIN32                                                                   
+#ifdef WIN32
 #define snprintf _snprintf
-#endif 
+#endif
 
 extern int oe_write_page(ogg_page *page, FILE *fp);
 
@@ -131,7 +131,7 @@
  * by calling add_message_header_field method.
  */
 ogg_packet ogg_from_fisbone(fisbone_packet *fp) {
-    
+
     ogg_packet op;
     int packet_size = FISBONE_SIZE + fp->current_header_size;
 



More information about the commits mailing list