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

Michael Smith msmith at xiph.org
Mon Aug 13 02:36:26 PDT 2001



msmith      01/08/13 02:36:26

  Modified:    oggenc   encode.c oggenc.c
  Log:
  Default encoding parameters working properly, and check for success in
  vorbis_encode_init()/vorbis_encode_init_vbr().

Revision  Changes    Path
1.9       +18 -5     vorbis-tools/oggenc/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/encode.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- encode.c	2001/08/13 04:45:21	1.8
+++ encode.c	2001/08/13 09:36:25	1.9
@@ -49,12 +49,25 @@
         /* Have vorbisenc choose a mode for us */
         vorbis_info_init(&vi);
 
-	if(opt->bitrate >= 0 || opt->min_bitrate >= 0 || opt->max_bitrate >=0)
-		vorbis_encode_init(&vi, opt->channels, opt->rate, opt->min_bitrate*1000,
-				opt->bitrate*1000, opt->max_bitrate*1000);
+	if(opt->quality >= 0.0f)
+	{
+		if(vorbis_encode_init_vbr(&vi, opt->channels, opt->rate, opt->quality))
+		{
+			fprintf(stderr, "Mode initialisation failed: invalid parameters for quality\n");
+			vorbis_info_clear(&vi);
+			return 1;
+		}
+	}
         else
-		vorbis_encode_init_vbr(&vi, opt->channels, opt->rate, opt->quality);
-
+	{
+		if(vorbis_encode_init(&vi, opt->channels, opt->rate, opt->min_bitrate*1000,
+				opt->bitrate*1000, opt->max_bitrate*1000))
+		{
+			fprintf(stderr, "Mode initialisation failed: invalid parameters for bitrate\n");
+			vorbis_info_clear(&vi);
+			return 1;
+		}
+	}
 
         /* Now, set up the analysis engine, stream encoder, and other
            preparation before the encoding begins.

1.27      +2 -1      vorbis-tools/oggenc/oggenc.c

Index: oggenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/oggenc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- oggenc.c	2001/08/13 09:24:50	1.26
+++ oggenc.c	2001/08/13 09:36:25	1.27
@@ -61,7 +61,7 @@
 {
         /* Default values */
         oe_options opt = {"ISO-8859-1", NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
-		0, NULL, 0, 0, 0,16,44100,2, NULL,NULL, -1,128,-1, 0.5f,0}; 
+		0, NULL, 0, 0, 0,16,44100,2, NULL,NULL, -1,128,-1, -1.0f,0}; 
         int i;
 
         char **infiles;
@@ -243,6 +243,7 @@
                 enc_opts.bitrate = opt.nominal_bitrate; 
                 enc_opts.min_bitrate = opt.min_bitrate;
                 enc_opts.max_bitrate = opt.max_bitrate;
+		enc_opts.quality = opt.quality;
 
                 if(!enc_opts.total_samples_per_channel)
                         enc_opts.progress_update = update_statistics_notime;

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