[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Necessary audiocd ioslave fixes for Vorbis RC3 support
From:       Jonathan Ingram <jonathan_ingram () yahoo ! com>
Date:       2002-01-23 17:16:52
[Download RAW message or body]

A while back, I posted a bug about the audiocd ioslave not supporting Vorbis
RC3.
See
	http://bugs.kde.org/db/36/36860.html
for details. I also posted a small patch with the minimum necessary code to get
it working again - together with the reason why just applying this patch would
not be ideal.

In brief -- up to the last version of Vorbis, you specified a bitrate to encode
at. From RC3 on, you either specify a bitrate or a quality, with bitrate being
deprecated (it will give much worse quality than specifying a quality). So,
something like the patch below should be applied. 

Together with this patch, changes need to be made to the audiocd configuration
panel, as this patch adds some new configuration options. This would be
necessary even if you only wanted to support bitrate, as the bitrate options in
the configuration panel were outdated even with RC2 (they date from beta4). 

I'll quite happily modify the configuration panel once this patch is accepted.
No new strings will need to be used, as the changed would only be to bring the
Vorbis config up to the level of the LAME config, and I can use the strings
from there.

I'm posting this to the mailing list because the hard freeze is coming up soon,
and I've had absolutely no response to my bug reports. If you don't apply
either of the patches I've sent, then Vorbis encoding in KDE 3.0 will be
utterly broken.

diff -bBU3 kdebase/kioslave/audiocd/audiocd.cpp audiocd.cpp
--- kdebase/kioslave/audiocd/audiocd.cpp        Wed Jan 23 17:07:13 2002
+++ audiocd.cpp Wed Jan 16 16:48:01 2002
@@ -322,6 +322,8 @@
   long vorbis_bitrate_lower;
   long vorbis_bitrate_upper;
   long vorbis_bitrate_nominal;
+  int  vorbis_encode_method;
+  double vorbis_quality;
   int vorbis_bitrate;
 #endif

@@ -551,7 +553,14 @@

 #ifdef HAVE_VORBIS

+ switch (d->vorbis_encode_method) {
+       case 0:
+       vorbis_encode_init_vbr(&d->vi, 2, 44100, d->vorbis_quality/10.0);
+       break;
+       case 1:
  vorbis_encode_init(&d->vi, 2, 44100, d->vorbis_bitrate_upper,
d->vorbis_bitrate_nominal, d->vorbis_bitrate_lower);
+       break;
+  }

 #endif

@@ -1368,6 +1377,9 @@

         while(vorbis_analysis_blockout(&d->vd,&d->vb)==1) {
           vorbis_analysis(&d->vb,&d->op);
+          vorbis_bitrate_addblock(&d->vb);
+
+          while(vorbis_bitrate_flushpacket(&d->vd, &d->op)) {
           ogg_stream_packetin(&d->os,&d->op);

           while(int result=ogg_stream_pageout(&d->os,&d->og)) {
@@ -1390,6 +1402,7 @@
           }
         }
       }
+      }
 #endif

       if (filetype == "wav" || filetype == "cda") {
@@ -1585,6 +1598,9 @@

   config->setGroup("Vorbis");

+  d->vorbis_encode_method = config->readNumEntry("encmethod", 0); // 0 for
quality, 1 for managed bitrate
+  d->vorbis_quality = config->readDoubleNumEntry("quality",3.0); // default
quality level of 3, to match oggenc
+
   if ( config->readBoolEntry("set_vorbis_min_bitrate",false) ) {
     d->vorbis_bitrate_lower = config->readNumEntry("vorbis_min_bitrate",40) *
1000;
   } else {
@@ -1597,6 +1613,7 @@
     d->vorbis_bitrate_upper = -1;
   }

+  // this is such a hack!
   if ( d->vorbis_bitrate_upper != -1 && d->vorbis_bitrate_lower != -1 ) {
     d->vorbis_bitrate = 104000; // empirically determined ...?!



__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic