Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 391898468971e472527e8fe7bc09c181 > files > 6

audacity-1.3.3-1.2mdv2008.0.src.rpm

--- audacity-src-1.3.3-beta/src/export/ExportFLAC.cpp.flac	2007-05-18 06:55:50.000000000 +0200
+++ audacity-src-1.3.3-beta/src/export/ExportFLAC.cpp	2007-05-18 12:28:22.000000000 +0200
@@ -145,6 +145,13 @@
 
 #define SAMPLES_PER_RUN 8192
 
+/* FLACPP_API_VERSION_CURRENT is 6 for libFLAC++ from flac-1.1.3 (see <FLAC++/export.h>) */
+#if !defined FLACPP_API_VERSION_CURRENT || FLACPP_API_VERSION_CURRENT < 6
+#define LEGACY_FLAC
+#else
+#undef LEGACY_FLAC
+#endif
+
 static struct
 {
    bool        do_exhaustive_model_search;
@@ -229,7 +236,9 @@
       gPrefs->Read(wxT("/FileFormats/FLACBitDepth"), wxT("16"));
 
    FLAC::Encoder::File *encoder= new FLAC::Encoder::File();
+#ifdef LEGACY_FLAC
    encoder->set_filename(OSFILENAME(fName));
+#endif
    encoder->set_channels(numChannels);
    encoder->set_sample_rate(int(rate + 0.5));
 
@@ -264,7 +273,12 @@
    encoder->set_rice_parameter_search_dist(flacLevels[levelPref].rice_parameter_search_dist);
    encoder->set_max_lpc_order(flacLevels[levelPref].max_lpc_order);
 
-   encoder->init();
+#ifdef LEGACY_FLAC
+   encoder->init(); // really should check the return value here...
+#else
+   encoder->init(OSFILENAME(fName)); // really should check the return value here...
+#endif
+
 
    int numWaveTracks;
    WaveTrack **waveTracks;
@@ -343,7 +357,7 @@
    return new ExportFLAC();
 }
 
-#endif // USE_LIBVORBIS
+#endif // USE_LIBFLAC
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
 // version control system. Please do not modify past this point.
--- audacity-src-1.3.3-beta/src/import/ImportFLAC.cpp.flac	2007-05-18 06:55:53.000000000 +0200
+++ audacity-src-1.3.3-beta/src/import/ImportFLAC.cpp	2007-05-18 12:20:46.000000000 +0200
@@ -63,6 +63,13 @@
 #include "../WaveTrack.h"
 #include "ImportPlugin.h"
 
+/* FLACPP_API_VERSION_CURRENT is 6 for libFLAC++ from flac-1.1.3 (see <FLAC++/export.h>) */
+#if !defined FLACPP_API_VERSION_CURRENT || FLACPP_API_VERSION_CURRENT < 6
+#define LEGACY_FLAC
+#else
+#undef LEGACY_FLAC
+#endif
+
 class FLACImportFileHandle;
 
 class MyFLACFile : public FLAC::Decoder::File
@@ -273,6 +280,7 @@
 
 bool FLACImportFileHandle::Init()
 {
+#ifdef LEGACY_FLAC
    bool success = mFile->set_filename(OSFILENAME(mName));
    if (!success) {
       return false;
@@ -281,11 +289,23 @@
    if (state != FLAC__FILE_DECODER_OK) {
       return false;
    }
+#else
+   if (mFile->init(OSFILENAME(mName)) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
+      return false;
+   }
+#endif
    mFile->process_until_end_of_metadata();
+#ifdef LEGACY_FLAC
    state = mFile->get_state();
    if (state != FLAC__FILE_DECODER_OK) {
       return false;
    }
+#else
+   // not necessary to check state, error callback will catch errors, but here's how:
+   if (mFile->get_state() > FLAC__STREAM_DECODER_READ_FRAME) {
+      return false;
+   }
+#endif
    if (!mFile->is_valid() || mFile->get_was_error())
    {
       // This probably is not a FLAC file at all
@@ -349,7 +369,11 @@
       mChannels[1]->SetTeamed(true);
    }
 
+#ifdef LEGACY_FLAC
    mFile->process_until_end_of_file();
+#else
+   mFile->process_until_end_of_stream();
+#endif
    
    *outTracks = new Track *[*outNumTracks];
    for(c = 0; c < *outNumTracks; c++) {
--- audacity-src-1.3.3-beta/acinclude.m4.flac	2007-05-18 06:56:02.000000000 +0200
+++ audacity-src-1.3.3-beta/acinclude.m4	2007-05-18 12:20:46.000000000 +0200
@@ -479,10 +479,10 @@
    dnl See if FLAC is installed in the system
 
    AC_CHECK_LIB(FLAC,
-                FLAC__file_decoder_new,
+                FLAC__stream_decoder_new,
                 lib_found="yes",
                 lib_found="no",
-                -lFLAC++ -lFLAC)
+                -lFLAC++ -lFLAC -logg)
 
    AC_CHECK_HEADER(FLAC/format.h,
                    header_found="yes",
@@ -490,7 +490,7 @@
 
    if test "x$lib_found" = "xyes" && test "x$header_found" = "xyes" ; then
       LIBFLAC_SYSTEM_AVAILABLE="yes"
-      LIBFLAC_SYSTEM_LIBS="-lFLAC++ -lFLAC"
+      LIBFLAC_SYSTEM_LIBS="-lFLAC++ -lFLAC -logg"
       LIBFLAC_SYSTEM_CPPSYMBOLS="USE_LIBFLAC"
       AC_MSG_NOTICE([FLAC libraries are available as system libraries])
    else