View | Details | Raw Unified | Return to bug 10938
Collapse All | Expand All

(-)k3b-0.12.17.orig/configure.in (-1 / +1 lines)
Lines 313-319 Link Here
313
have_flac=no
313
have_flac=no
314
if test "$ac_cv_use_flac" = "yes"; then
314
if test "$ac_cv_use_flac" = "yes"; then
315
  KDE_CHECK_HEADERS(FLAC++/decoder.h, [
315
  KDE_CHECK_HEADERS(FLAC++/decoder.h, [
316
     AC_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single,
316
     AC_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single,
317
	        have_flac=yes,[],$all_libraries)])
317
	        have_flac=yes,[],$all_libraries)])
318
318
319
  # Hack to get the flac version since I was not able to handle the code from
319
  # Hack to get the flac version since I was not able to handle the code from
(-)k3b-0.12.17.orig/configure.in.in (-1 / +1 lines)
Lines 248-254 Link Here
248
have_flac=no
248
have_flac=no
249
if test "$ac_cv_use_flac" = "yes"; then
249
if test "$ac_cv_use_flac" = "yes"; then
250
  KDE_CHECK_HEADERS(FLAC++/decoder.h, [
250
  KDE_CHECK_HEADERS(FLAC++/decoder.h, [
251
     AC_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single,
251
     AC_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single,
252
	        have_flac=yes,[],$all_libraries)])
252
	        have_flac=yes,[],$all_libraries)])
253
253
254
  # Hack to get the flac version since I was not able to handle the code from
254
  # Hack to get the flac version since I was not able to handle the code from
(-)k3b-0.12.17.orig/plugins/decoder/flac/k3bflacdecoder.cpp (+57 lines)
Lines 29-34 Link Here
29
#include <FLAC++/metadata.h>
29
#include <FLAC++/metadata.h>
30
#include <FLAC++/decoder.h>
30
#include <FLAC++/decoder.h>
31
31
32
#if !defined FLACPP_API_VERSION_CURRENT || FLACPP_API_VERSION_CURRENT < 6
33
#define LEGACY_FLAC
34
#else
35
#undef LEGACY_FLAC
36
#endif
37
32
#include <config.h>
38
#include <config.h>
33
39
34
#ifdef HAVE_TAGLIB
40
#ifdef HAVE_TAGLIB
Lines 40-46 Link Here
40
46
41
47
42
class K3bFLACDecoder::Private
48
class K3bFLACDecoder::Private
49
#ifdef LEGACY_FLAC
43
  : public FLAC::Decoder::SeekableStream
50
  : public FLAC::Decoder::SeekableStream
51
#else
52
  : public FLAC::Decoder::Stream
53
#endif
44
{
54
{
45
public:
55
public:
46
  void open(QFile* f) {
56
  void open(QFile* f) {
Lines 64-70 Link Here
64
  }
74
  }
65
75
66
  Private(QFile* f)
76
  Private(QFile* f)
77
#ifdef LEGACY_FLAC
67
    : FLAC::Decoder::SeekableStream(),
78
    : FLAC::Decoder::SeekableStream(),
79
#else
80
    : FLAC::Decoder::Stream(),
81
#endif
68
      comments(0) {
82
      comments(0) {
69
    internalBuffer = new QBuffer();
83
    internalBuffer = new QBuffer();
70
    internalBuffer->open(IO_ReadWrite);
84
    internalBuffer->open(IO_ReadWrite);
Lines 93-102 Link Here
93
  FLAC__uint64 samples;
107
  FLAC__uint64 samples;
94
  
108
  
95
protected:
109
protected:
110
#ifdef LEGACY_FLAC
96
  virtual FLAC__SeekableStreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
111
  virtual FLAC__SeekableStreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
97
  virtual FLAC__SeekableStreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
112
  virtual FLAC__SeekableStreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
98
  virtual FLAC__SeekableStreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
113
  virtual FLAC__SeekableStreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
99
  virtual FLAC__SeekableStreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length);
114
  virtual FLAC__SeekableStreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length);
115
#else
116
  virtual FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
117
  virtual FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
118
  virtual FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
119
  virtual FLAC__StreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length);
120
#endif
100
  virtual bool eof_callback();
121
  virtual bool eof_callback();
101
  virtual void error_callback(FLAC__StreamDecoderErrorStatus){};
122
  virtual void error_callback(FLAC__StreamDecoderErrorStatus){};
102
  virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
123
  virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
Lines 112-117 Link Here
112
  return file->atEnd();
133
  return file->atEnd();
113
}
134
}
114
135
136
#ifdef LEGACY_FLAC
115
FLAC__SeekableStreamDecoderReadStatus K3bFLACDecoder::Private::read_callback(FLAC__byte buffer[],                                                                             unsigned *bytes) {
137
FLAC__SeekableStreamDecoderReadStatus K3bFLACDecoder::Private::read_callback(FLAC__byte buffer[],                                                                             unsigned *bytes) {
116
  long retval =  file->readBlock((char *)buffer, (*bytes));
138
  long retval =  file->readBlock((char *)buffer, (*bytes));
117
  if(-1 == retval) {
139
  if(-1 == retval) {
Lines 119-145 Link Here
119
  } else {
141
  } else {
120
    (*bytes) = retval;
142
    (*bytes) = retval;
121
    return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
143
    return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
144
#else
145
FLAC__StreamDecoderReadStatus K3bFLACDecoder::Private::read_callback(FLAC__byte buffer[], size_t *bytes) {
146
  long retval =  file->readBlock((char *)buffer, (*bytes));
147
  if(-1 == retval) return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
148
  else {
149
    (*bytes) = retval;
150
    return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
151
#endif
122
  }
152
  }
123
}
153
}
124
154
155
#ifdef LEGACY_FLAC
125
FLAC__SeekableStreamDecoderSeekStatus 
156
FLAC__SeekableStreamDecoderSeekStatus 
126
K3bFLACDecoder::Private::seek_callback(FLAC__uint64 absolute_byte_offset) {
157
K3bFLACDecoder::Private::seek_callback(FLAC__uint64 absolute_byte_offset) {
127
  if(file->at(absolute_byte_offset) == FALSE)
158
  if(file->at(absolute_byte_offset) == FALSE)
128
    return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
159
    return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
129
  else
160
  else
130
    return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
161
    return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
162
#else
163
FLAC__StreamDecoderSeekStatus K3bFLACDecoder::Private::seek_callback(FLAC__uint64 absolute_byte_offset) {
164
  if(file->at(absolute_byte_offset) == FALSE) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
165
  else return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
166
#endif
131
}
167
}
132
168
169
#ifdef LEGACY_FLAC
133
FLAC__SeekableStreamDecoderTellStatus 
170
FLAC__SeekableStreamDecoderTellStatus 
134
K3bFLACDecoder::Private::tell_callback(FLAC__uint64 *absolute_byte_offset) {
171
K3bFLACDecoder::Private::tell_callback(FLAC__uint64 *absolute_byte_offset) {
135
  (*absolute_byte_offset) = file->at();
172
  (*absolute_byte_offset) = file->at();
136
  return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
173
  return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
174
#else
175
FLAC__StreamDecoderTellStatus K3bFLACDecoder::Private::tell_callback(FLAC__uint64 *absolute_byte_offset) {
176
  (*absolute_byte_offset) = file->at();
177
  return FLAC__STREAM_DECODER_TELL_STATUS_OK;
178
#endif
137
}
179
}
138
180
181
#ifdef LEGACY_FLAC
139
FLAC__SeekableStreamDecoderLengthStatus 
182
FLAC__SeekableStreamDecoderLengthStatus 
140
K3bFLACDecoder::Private::length_callback(FLAC__uint64 *stream_length) {
183
K3bFLACDecoder::Private::length_callback(FLAC__uint64 *stream_length) {
141
  (*stream_length) = file->size();
184
  (*stream_length) = file->size();
142
  return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
185
  return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
186
#else
187
FLAC__StreamDecoderLengthStatus K3bFLACDecoder::Private::length_callback(FLAC__uint64 *stream_length) {
188
  (*stream_length) = file->size();
189
  return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
190
#endif
143
}
191
}
144
192
145
193
Lines 262-267 Link Here
262
310
263
  if(d->internalBuffer->size() == 0) {
311
  if(d->internalBuffer->size() == 0) {
264
    // want more data
312
    // want more data
313
#ifdef LEGACY_FLAC
265
    switch(d->get_state()) {
314
    switch(d->get_state()) {
266
    case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:
315
    case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:
267
      d->finish();
316
      d->finish();
Lines 273-278 Link Here
273
    default:
322
    default:
274
      return -1;
323
      return -1;
275
    }
324
    }
325
#else
326
    if(d->get_state() == FLAC__STREAM_DECODER_END_OF_STREAM) d->finish();
327
    else if(d->get_state() < FLAC__STREAM_DECODER_END_OF_STREAM) {
328
      if(! d->process_single())
329
        return -1;
330
    }
331
    else return -1;
332
#endif
276
  }
333
  }
277
  
334
  
278
  bytesAvailable = d->internalBuffer->size() - d->internalBuffer->at();
335
  bytesAvailable = d->internalBuffer->size() - d->internalBuffer->at();

Return to bug 10938