From kde-multimedia Thu Sep 27 14:53:35 2012 From: Felix Tiede Date: Thu, 27 Sep 2012 14:53:35 +0000 To: kde-multimedia Subject: Patch to re-enable vorbis-support in audiocd-kio Message-Id: <24530315.jpzSXN9cx7 () pip> X-MARC-Message: https://marc.info/?l=kde-multimedia&m=134903246822765 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart89924624.2gGAAsHMEW" This is a multi-part message in MIME format. --nextPart89924624.2gGAAsHMEW Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Hello, as per mpyne's request from https://bugs.kde.org/show_bug.cgi?id=307343#c4 I propose my patch to audiocd-kio for review. This patch relies on libvorbisenc version 2 or newer to build the vorbis encoder plugin. libvorbisenc is, according to xiph.org's repository, itself about 10 years old. The version is still checked by cmake and if it is too old, the vorbis encoder plugin is not built. I have removed all conditional compiling from the plugin in favor of this configure-time check as I doubt there is still an installation of libvorbisenc older than those ten years. I am not sure which is the minimum version of cmake to create HAVE_LIBVORBISENC2 variable, my cmake is v2.8.9 and does so. Kind regards, Felix Tiede --nextPart89924624.2gGAAsHMEW Content-Disposition: attachment; filename="audiocd-kio-4.9.1-fix_vorbis-plugin.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="audiocd-kio-4.9.1-fix_vorbis-plugin.patch" diff -purN audiocd-kio-4.9.1.orig/plugins/CMakeLists.txt audiocd-kio-4.9.1/plugins/CMakeLists.txt --- audiocd-kio-4.9.1.orig/plugins/CMakeLists.txt 2012-09-27 07:50:28.292899194 +0200 +++ audiocd-kio-4.9.1/plugins/CMakeLists.txt 2012-09-27 07:53:56.346233263 +0200 @@ -9,9 +9,9 @@ endif(FLAC_FOUND) macro_optional_find_package(OggVorbis) macro_log_feature(OGGVORBIS_FOUND "OggVorbis" "Libraries for Ogg Vorbis general audio compression codec" "http://www.xiph.org" FALSE "" "Required for the AudioCD Ogg Vorbis plugin.") -if (OGGVORBIS_FOUND) +if (OGGVORBIS_FOUND AND HAVE_LIBVORBISENC2) add_subdirectory( vorbis ) -endif(OGGVORBIS_FOUND) +endif(OGGVORBIS_FOUND AND HAVE_LIBVORBISENC2) add_subdirectory( wav ) add_subdirectory( lame ) diff -purN audiocd-kio-4.9.1.orig/plugins/vorbis/encodervorbis.cpp audiocd-kio-4.9.1/plugins/vorbis/encodervorbis.cpp --- audiocd-kio-4.9.1.orig/plugins/vorbis/encodervorbis.cpp 2012-08-13 11:38:48.000000000 +0200 +++ audiocd-kio-4.9.1/plugins/vorbis/encodervorbis.cpp 2012-09-27 07:55:37.649566952 +0200 @@ -25,8 +25,6 @@ #include "encodervorbis.h" #include "audiocd_vorbis_encoder.h" -#ifdef HAVE_VORBIS - #include #include #include @@ -139,11 +137,8 @@ void EncoderVorbis::loadSettings(){ // Now that we have read in the settings apply them to the encoder lib switch (d->vorbis_encode_method) { case 0: -/* Support very old libvorbis by simply falling through. */ -#if HAVE_VORBIS >= 2 vorbis_encode_init_vbr(&d->vi, 2, 44100, d->vorbis_quality/10.0); break; -#endif case 1: vorbis_encode_init(&d->vi, 2, 44100, d->vorbis_bitrate_upper, d->vorbis_bitrate_nominal, d->vorbis_bitrate_lower); break; @@ -155,18 +150,11 @@ long EncoderVorbis::flush_vorbis(void) { long processed(0); while(vorbis_analysis_blockout(&d->vd,&d->vb)==1) { - /* Support ancient libvorbis (< RC3). */ -#if HAVE_VORBIS >= 2 vorbis_analysis(&d->vb,NULL); /* Non-ancient case. */ vorbis_bitrate_addblock(&d->vb); while(vorbis_bitrate_flushpacket(&d->vd, &d->op)) { -#else - vorbis_analysis(&d->vb,&d->op); - /* Make a lexical block to place the #ifdef's nearby. */ - if (1) { -#endif ogg_stream_packetin(&d->os,&d->op); while(int result=ogg_stream_pageout(&d->os,&d->og)) { if (!result) break; @@ -193,9 +181,6 @@ unsigned long EncoderVorbis::size(long t switch (d->vorbis_encode_method) { case 0: // quality based encoding - -#if HAVE_VORBIS >= 2 // If really old Vorbis is being used, skip this nicely. - { // Estimated numbers based on the Vorbis FAQ: // http://www.xiph.org/archives/vorbis-faq/200203/0030.html @@ -209,9 +194,6 @@ unsigned long EncoderVorbis::size(long t break; } - -#endif // HAVE_VORBIS >= 2 - default: // bitrate based encoding vorbis_size = (time_secs * d->vorbis_bitrate/8); break; @@ -321,5 +303,3 @@ void EncoderVorbis::fillSongInfo( KCDDB: } } -#endif // HAVE_VORBIS - diff -purN audiocd-kio-4.9.1.orig/plugins/vorbis/encodervorbis.h audiocd-kio-4.9.1/plugins/vorbis/encodervorbis.h --- audiocd-kio-4.9.1.orig/plugins/vorbis/encodervorbis.h 2012-08-13 11:38:48.000000000 +0200 +++ audiocd-kio-4.9.1/plugins/vorbis/encodervorbis.h 2012-09-27 07:54:18.442900007 +0200 @@ -26,7 +26,6 @@ #define ENCODER_VORBIS_H #include "ui_encodervorbisconfig.h" -#ifdef HAVE_VORBIS #include @@ -70,7 +69,5 @@ private: }; -#endif // HAVE_VORBIS - #endif // ENCODER_VORBIS_H --nextPart89924624.2gGAAsHMEW Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kde-multimedia mailing list kde-multimedia@kde.org https://mail.kde.org/mailman/listinfo/kde-multimedia --nextPart89924624.2gGAAsHMEW--