summaryrefslogtreecommitdiffstats
path: root/kioslave/audiocd
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-07 21:36:08 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-07 21:36:08 +0000
commite903257c4609f3de9e6c59ef1c7dfa557f6877ac (patch)
tree46b6eeff9a6694f6d5fb841a197ebc7557767002 /kioslave/audiocd
parent636eef5bea9dd243a08d77c9c537fb36ee30f838 (diff)
downloadtdemultimedia-e903257c4609f3de9e6c59ef1c7dfa557f6877ac.tar.gz
tdemultimedia-e903257c4609f3de9e6c59ef1c7dfa557f6877ac.zip
* Merged in all kdemultimedia bugfix patches from the Chakra project
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1172702 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/audiocd')
-rw-r--r--kioslave/audiocd/configure.in.in2
-rw-r--r--kioslave/audiocd/plugins/flac/encoderflac.cpp19
2 files changed, 19 insertions, 2 deletions
diff --git a/kioslave/audiocd/configure.in.in b/kioslave/audiocd/configure.in.in
index 073d0f96..99bacf59 100644
--- a/kioslave/audiocd/configure.in.in
+++ b/kioslave/audiocd/configure.in.in
@@ -5,7 +5,7 @@ AC_DEFUN([AC_CHECK_LIBFLAC],
have_libFLAC=no
KDE_CHECK_HEADER(FLAC/metadata.h,
[
- KDE_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single,
+ KDE_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single,
have_libFLAC=yes)
])
diff --git a/kioslave/audiocd/plugins/flac/encoderflac.cpp b/kioslave/audiocd/plugins/flac/encoderflac.cpp
index 86d30a89..4be1aeb3 100644
--- a/kioslave/audiocd/plugins/flac/encoderflac.cpp
+++ b/kioslave/audiocd/plugins/flac/encoderflac.cpp
@@ -29,6 +29,11 @@
#include <kconfig.h>
#include <kdebug.h>
+#if !defined FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT < 8
+#define LEGACY_FLAC
+#else
+#undef LEGACY_FLAC
+#endif
extern "C"
{
@@ -47,7 +52,11 @@ public:
unsigned long data;
};
+#ifdef LEGACY_FLAC
static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
+#else
+static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
+#endif
{
EncoderFLAC::Private *d = (EncoderFLAC::Private*)client_data;
@@ -109,9 +118,11 @@ unsigned long EncoderFLAC::size(long time_secs) const {
long EncoderFLAC::readInit(long size) {
kdDebug(7117) << "EncoderFLAC::readInit() called"<< endl;
d->data = 0;
+#ifdef LEGACY_FLAC
FLAC__stream_encoder_set_write_callback(d->encoder, WriteCallback);
FLAC__stream_encoder_set_metadata_callback(d->encoder, MetadataCallback);
FLAC__stream_encoder_set_client_data(d->encoder, d);
+#endif
// The options match approximely those of flac compression-level-3
FLAC__stream_encoder_set_do_mid_side_stereo(d->encoder, true);
@@ -124,7 +135,13 @@ long EncoderFLAC::readInit(long size) {
if (size > 0)
FLAC__stream_encoder_set_total_samples_estimate(d->encoder, size/4);
- FLAC__stream_encoder_init(d->encoder);
+#ifdef LEGACY_FLAC
+ if(FLAC__stream_encoder_init(d->encoder) != FLAC__STREAM_ENCODER_OK)
+ ; // really should handle an init failure
+#else
+ if(FLAC__stream_encoder_init_stream(d->encoder, WriteCallback, NULL, NULL, MetadataCallback, d) != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
+ ; // really should handle an init failure
+#endif
return d->data;
}