Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b152086a
Commit
b152086a
authored
Dec 04, 2006
by
Eric Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce backwards compatibility with pre-1.1.3 FLAC
git-svn-id:
https://svn.musicpd.org/mpd/trunk@5111
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
ccf971a3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
52 deletions
+196
-52
_flac_common.h
src/inputPlugins/_flac_common.h
+98
-1
flac_plugin.c
src/inputPlugins/flac_plugin.c
+97
-47
oggflac_plugin.c
src/inputPlugins/oggflac_plugin.c
+1
-4
No files found.
src/inputPlugins/_flac_common.h
View file @
b152086a
...
@@ -30,7 +30,104 @@
...
@@ -30,7 +30,104 @@
#include "../inputStream.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../outputBuffer.h"
#include "../decode.h"
#include "../decode.h"
#include <FLAC/seekable_stream_decoder.h>
#include <FLAC/export.h>
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
# include <FLAC/seekable_stream_decoder.h>
# define flac_decoder FLAC__SeekableStreamDecoder
# define flac_new(x) FLAC__seekable_stream_decoder_new(x)
# define flac_get_decode_position(x,y) \
FLAC__seekable_stream_decoder_get_decode_position(x,y)
# define flac_get_state(x) FLAC__seekable_stream_decoder_get_state(x)
# define flac_process_single(x) FLAC__seekable_stream_decoder_process_single(x)
# define flac_process_metadata(x) \
FLAC__seekable_stream_decoder_process_until_end_of_metadata(x)
# define flac_seek_absolute(x,y) \
FLAC__seekable_stream_decoder_seek_absolute(x,y)
# define flac_finish(x) FLAC__seekable_stream_decoder_finish(x)
# define flac_delete(x) FLAC__seekable_stream_decoder_delete(x)
# define flac_decoder_eof FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM
# define flac_read_status FLAC__SeekableStreamDecoderReadStatus
# define flac_read_status_continue \
FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK
# define flac_read_status_eof FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK
# define flac_read_status_abort \
FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR
# define flac_seek_status FLAC__SeekableStreamDecoderSeekStatus
# define flac_seek_status_ok FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK
# define flac_seek_status_error FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR
# define flac_tell_status FLAC__SeekableStreamDecoderTellStatus
# define flac_tell_status_ok FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK
# define flac_tell_status_error \
FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR
# define flac_tell_status_unsupported \
FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR
# define flac_length_status FLAC__SeekableStreamDecoderLengthStatus
# define flac_length_status_ok FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK
# define flac_length_status_error \
FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR
# define flac_length_status_unsupported \
FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR
# ifdef HAVE_OGGFLAC
# include <OggFLAC/seekable_stream_decoder.h>
# endif
#else
/* FLAC_API_VERSION_CURRENT >= 7 */
/* OggFLAC support is handled by our flac_plugin already */
# ifdef HAVE_OGGFLAC
# undef HAVE_OGGFLAC
# endif
# include <FLAC/stream_decoder.h>
# include "_ogg_common.h"
# define flac_decoder FLAC__StreamDecoder
# define flac_new(x) FLAC__stream_decoder_new(x)
# define flac_init(a,b,c,d,e,f,g,h,i,j) \
(FLAC__stream_decoder_init_stream(a,b,c,d,e,f,g,h,i,j) \
== FLAC__STREAM_DECODER_INIT_STATUS_OK)
# define flac_get_decode_position(x,y) \
FLAC__stream_decoder_get_decode_position(x,y)
# define flac_get_state(x) FLAC__stream_decoder_get_state(x)
# define flac_process_single(x) FLAC__stream_decoder_process_single(x)
# define flac_process_metadata(x) \
FLAC__stream_decoder_process_until_end_of_metadata(x)
# define flac_seek_absolute(x,y) FLAC__stream_decoder_seek_absolute(x,y)
# define flac_finish(x) FLAC__stream_decoder_finish(x)
# define flac_delete(x) FLAC__stream_decoder_delete(x)
# define flac_decoder_eof FLAC__STREAM_DECODER_END_OF_STREAM
# define flac_read_status FLAC__StreamDecoderReadStatus
# define flac_read_status_continue \
FLAC__STREAM_DECODER_READ_STATUS_CONTINUE
# define flac_read_status_eof FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
# define flac_read_status_abort FLAC__STREAM_DECODER_READ_STATUS_ABORT
# define flac_seek_status FLAC__StreamDecoderSeekStatus
# define flac_seek_status_ok FLAC__STREAM_DECODER_SEEK_STATUS_OK
# define flac_seek_status_error FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
# define flac_seek_status_unsupported \
FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
# define flac_tell_status FLAC__StreamDecoderTellStatus
# define flac_tell_status_ok FLAC__STREAM_DECODER_TELL_STATUS_OK
# define flac_tell_status_error FLAC__STREAM_DECODER_TELL_STATUS_ERROR
# define flac_tell_status_unsupported \
FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
# define flac_length_status FLAC__StreamDecoderLengthStatus
# define flac_length_status_ok FLAC__STREAM_DECODER_LENGTH_STATUS_OK
# define flac_length_status_error FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR
# define flac_length_status_unsupported \
FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
#endif
/* FLAC_API_VERSION_CURRENT >= 7 */
#include <FLAC/metadata.h>
#include <FLAC/metadata.h>
#define FLAC_CHUNK_SIZE 4080
#define FLAC_CHUNK_SIZE 4080
...
...
src/inputPlugins/flac_plugin.c
View file @
b152086a
...
@@ -16,12 +16,10 @@
...
@@ -16,12 +16,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
#include "
../inputPlugi
n.h"
#include "
_flac_commo
n.h"
#ifdef HAVE_FLAC
#ifdef HAVE_FLAC
#include "_flac_common.h"
#include "../utils.h"
#include "../utils.h"
#include "../log.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../pcm_utils.h"
...
@@ -33,13 +31,10 @@
...
@@ -33,13 +31,10 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include <FLAC/stream_decoder.h>
#include <FLAC/metadata.h>
/* this code
i
s based on flac123, from flac-tools */
/* this code
wa
s based on flac123, from flac-tools */
static
FLAC__StreamDecoderReadStatus
flacRead
(
const
FLAC__StreamDecoder
static
flac_read_status
flacRead
(
const
flac_decoder
*
flacDec
,
*
flacDec
,
FLAC__byte
buf
[],
FLAC__byte
buf
[],
unsigned
*
bytes
,
unsigned
*
bytes
,
void
*
fdata
)
void
*
fdata
)
...
@@ -59,29 +54,27 @@ static FLAC__StreamDecoderReadStatus flacRead(const FLAC__StreamDecoder
...
@@ -59,29 +54,27 @@ static FLAC__StreamDecoderReadStatus flacRead(const FLAC__StreamDecoder
if
(
r
==
0
&&
!
data
->
dc
->
stop
)
{
if
(
r
==
0
&&
!
data
->
dc
->
stop
)
{
if
(
inputStreamAtEOF
(
data
->
inStream
))
if
(
inputStreamAtEOF
(
data
->
inStream
))
return
FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
;
return
flac_read_status_eof
;
else
else
return
FLAC__STREAM_DECODER_READ_STATUS_ABORT
;
return
flac_read_status_abort
;
}
}
return
FLAC__STREAM_DECODER_READ_STATUS_CONTINUE
;
return
flac_read_status_continue
;
}
}
static
FLAC__StreamDecoderSeekStatus
flacSeek
(
const
FLAC__StreamDecoder
static
flac_seek_status
flacSeek
(
const
flac_decoder
*
flacDec
,
*
flacDec
,
FLAC__uint64
offset
,
FLAC__uint64
offset
,
void
*
fdata
)
void
*
fdata
)
{
{
FlacData
*
data
=
(
FlacData
*
)
fdata
;
FlacData
*
data
=
(
FlacData
*
)
fdata
;
if
(
seekInputStream
(
data
->
inStream
,
offset
,
SEEK_SET
)
<
0
)
{
if
(
seekInputStream
(
data
->
inStream
,
offset
,
SEEK_SET
)
<
0
)
{
return
FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
;
return
flac_seek_status_error
;
}
}
return
FLAC__STREAM_DECODER_SEEK_STATUS_OK
;
return
flac_tell_status_ok
;
}
}
static
FLAC__StreamDecoderTellStatus
flacTell
(
const
FLAC__StreamDecoder
static
flac_tell_status
flacTell
(
const
flac_decoder
*
flacDec
,
*
flacDec
,
FLAC__uint64
*
offset
,
FLAC__uint64
*
offset
,
void
*
fdata
)
void
*
fdata
)
{
{
...
@@ -89,11 +82,10 @@ static FLAC__StreamDecoderTellStatus flacTell(const FLAC__StreamDecoder
...
@@ -89,11 +82,10 @@ static FLAC__StreamDecoderTellStatus flacTell(const FLAC__StreamDecoder
*
offset
=
(
long
)(
data
->
inStream
->
offset
);
*
offset
=
(
long
)(
data
->
inStream
->
offset
);
return
FLAC__STREAM_DECODER_TELL_STATUS_OK
;
return
flac_tell_status_ok
;
}
}
static
FLAC__StreamDecoderLengthStatus
flacLength
(
const
FLAC__StreamDecoder
static
flac_length_status
flacLength
(
const
flac_decoder
*
flacDec
,
*
flacDec
,
FLAC__uint64
*
length
,
FLAC__uint64
*
length
,
void
*
fdata
)
void
*
fdata
)
{
{
...
@@ -101,10 +93,10 @@ static FLAC__StreamDecoderLengthStatus flacLength(const FLAC__StreamDecoder
...
@@ -101,10 +93,10 @@ static FLAC__StreamDecoderLengthStatus flacLength(const FLAC__StreamDecoder
*
length
=
(
size_t
)
(
data
->
inStream
->
size
);
*
length
=
(
size_t
)
(
data
->
inStream
->
size
);
return
FLAC__STREAM_DECODER_LENGTH_STATUS_OK
;
return
flac_length_status_ok
;
}
}
static
FLAC__bool
flacEOF
(
const
FLAC__StreamD
ecoder
*
flacDec
,
void
*
fdata
)
static
FLAC__bool
flacEOF
(
const
flac_d
ecoder
*
flacDec
,
void
*
fdata
)
{
{
FlacData
*
data
=
(
FlacData
*
)
fdata
;
FlacData
*
data
=
(
FlacData
*
)
fdata
;
...
@@ -113,12 +105,75 @@ static FLAC__bool flacEOF(const FLAC__StreamDecoder * flacDec, void *fdata)
...
@@ -113,12 +105,75 @@ static FLAC__bool flacEOF(const FLAC__StreamDecoder * flacDec, void *fdata)
return
false
;
return
false
;
}
}
static
void
flacError
(
const
FLAC__StreamDecoder
*
dec
,
static
void
flacError
(
const
flac_decoder
*
dec
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
fdata
)
FLAC__StreamDecoderErrorStatus
status
,
void
*
fdata
)
{
{
flac_error_common_cb
(
"flac"
,
status
,
(
FlacData
*
)
fdata
);
flac_error_common_cb
(
"flac"
,
status
,
(
FlacData
*
)
fdata
);
}
}
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
static
void
flacPrintErroredState
(
FLAC__SeekableStreamDecoderState
state
)
{
const
char
*
str
=
""
;
/* "" to silence compiler warning */
switch
(
state
)
{
case
FLAC__SEEKABLE_STREAM_DECODER_OK
:
case
FLAC__SEEKABLE_STREAM_DECODER_SEEKING
:
case
FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM
:
return
;
case
FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR
:
str
=
"allocation error"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR
:
str
=
"read error"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR
:
str
=
"seek error"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR
:
str
=
"seekable stream error"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED
:
str
=
"decoder already initialized"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK
:
str
=
"invalid callback"
;
break
;
case
FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED
:
str
=
"decoder uninitialized"
;
}
ERROR
(
"flac %s
\n
"
,
str
);
}
static
int
flac_init
(
FLAC__SeekableStreamDecoder
*
dec
,
FLAC__SeekableStreamDecoderReadCallback
read_cb
,
FLAC__SeekableStreamDecoderSeekCallback
seek_cb
,
FLAC__SeekableStreamDecoderTellCallback
tell_cb
,
FLAC__SeekableStreamDecoderLengthCallback
length_cb
,
FLAC__SeekableStreamDecoderEofCallback
eof_cb
,
FLAC__SeekableStreamDecoderWriteCallback
write_cb
,
FLAC__SeekableStreamDecoderMetadataCallback
metadata_cb
,
FLAC__SeekableStreamDecoderErrorCallback
error_cb
,
void
*
data
)
{
int
s
=
1
;
s
&=
FLAC__seekable_stream_decoder_set_read_callback
(
dec
,
read_cb
);
s
&=
FLAC__seekable_stream_decoder_set_seek_callback
(
dec
,
seek_cb
);
s
&=
FLAC__seekable_stream_decoder_set_tell_callback
(
dec
,
tell_cb
);
s
&=
FLAC__seekable_stream_decoder_set_length_callback
(
dec
,
length_cb
);
s
&=
FLAC__seekable_stream_decoder_set_eof_callback
(
dec
,
eof_cb
);
s
&=
FLAC__seekable_stream_decoder_set_write_callback
(
dec
,
write_cb
);
s
&=
FLAC__seekable_stream_decoder_set_metadata_callback
(
dec
,
metadata_cb
);
s
&=
FLAC__seekable_stream_decoder_set_metadata_respond
(
dec
,
FLAC__METADATA_TYPE_VORBIS_COMMENT
);
s
&=
FLAC__seekable_stream_decoder_set_error_callback
(
dec
,
error_cb
);
s
&=
FLAC__seekable_stream_decoder_set_client_data
(
dec
,
data
);
if
(
!
s
||
(
FLAC__seekable_stream_decoder_init
(
dec
)
!=
FLAC__SEEKABLE_STREAM_DECODER_OK
))
return
0
;
return
1
;
}
#else
/* FLAC_API_VERSION_CURRENT >= 7 */
static
void
flacPrintErroredState
(
FLAC__StreamDecoderState
state
)
static
void
flacPrintErroredState
(
FLAC__StreamDecoderState
state
)
{
{
const
char
*
str
=
""
;
/* "" to silence compiler warning */
const
char
*
str
=
""
;
/* "" to silence compiler warning */
...
@@ -143,19 +198,19 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
...
@@ -143,19 +198,19 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
break
;
break
;
case
FLAC__STREAM_DECODER_UNINITIALIZED
:
case
FLAC__STREAM_DECODER_UNINITIALIZED
:
str
=
"decoder uninitialized"
;
str
=
"decoder uninitialized"
;
break
;
}
}
ERROR
(
"flac %s
\n
"
,
str
);
ERROR
(
"flac %s
\n
"
,
str
);
}
}
#endif
/* FLAC_API_VERSION_CURRENT >= 7 */
static
void
flacMetadata
(
const
FLAC__StreamD
ecoder
*
dec
,
static
void
flacMetadata
(
const
flac_d
ecoder
*
dec
,
const
FLAC__StreamMetadata
*
block
,
void
*
vdata
)
const
FLAC__StreamMetadata
*
block
,
void
*
vdata
)
{
{
flac_metadata_common_cb
(
block
,
(
FlacData
*
)
vdata
);
flac_metadata_common_cb
(
block
,
(
FlacData
*
)
vdata
);
}
}
static
FLAC__StreamDecoderWriteStatus
flacWrite
(
const
FLAC__StreamDecoder
*
static
FLAC__StreamDecoderWriteStatus
flacWrite
(
const
flac_decoder
*
dec
,
dec
,
const
FLAC__Frame
*
frame
,
const
FLAC__Frame
*
frame
,
const
FLAC__int32
*
const
buf
[],
const
FLAC__int32
*
const
buf
[],
void
*
vdata
)
void
*
vdata
)
{
{
...
@@ -171,7 +226,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__StreamDecoder *
...
@@ -171,7 +226,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__StreamDecoder *
timeChange
=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
timeChange
=
((
float
)
samples
)
/
frame
->
header
.
sample_rate
;
data
->
time
+=
timeChange
;
data
->
time
+=
timeChange
;
FLAC__stream_decoder
_get_decode_position
(
dec
,
&
newPosition
);
flac
_get_decode_position
(
dec
,
&
newPosition
);
if
(
data
->
position
)
{
if
(
data
->
position
)
{
data
->
bitRate
=
data
->
bitRate
=
((
newPosition
-
data
->
position
)
*
8
.
0
/
timeChange
)
((
newPosition
-
data
->
position
)
*
8
.
0
/
timeChange
)
...
@@ -287,27 +342,25 @@ static MpdTag *flacTagDup(char *file)
...
@@ -287,27 +342,25 @@ static MpdTag *flacTagDup(char *file)
static
int
flac_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
,
static
int
flac_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
,
InputStream
*
inStream
)
InputStream
*
inStream
)
{
{
FLAC__StreamD
ecoder
*
flacDec
;
flac_d
ecoder
*
flacDec
;
FlacData
data
;
FlacData
data
;
int
ret
=
0
;
int
ret
=
0
;
if
(
!
(
flacDec
=
FLAC__stream_decoder
_new
()))
if
(
!
(
flacDec
=
flac
_new
()))
return
-
1
;
return
-
1
;
init_FlacData
(
&
data
,
cb
,
dc
,
inStream
);
init_FlacData
(
&
data
,
cb
,
dc
,
inStream
);
if
(
FLAC__stream_decoder_init_stream
(
flacDec
,
flacRead
,
flacSeek
,
if
(
!
flac_init
(
flacDec
,
flacRead
,
flacSeek
,
flacTell
,
flacLength
,
flacTell
,
flacLength
,
flacEOF
,
flacEOF
,
flacWrite
,
flacMetadata
,
flacError
,
flacWrite
,
flacMetadata
,
(
void
*
)
&
data
))
{
flacError
,
(
void
*
)
&
data
)
!=
FLAC__STREAM_DECODER_INIT_STATUS_OK
)
{
ERROR
(
"flac problem doing init()
\n
"
);
ERROR
(
"flac problem doing init()
\n
"
);
flacPrintErroredState
(
FLAC__stream_decoder
_get_state
(
flacDec
));
flacPrintErroredState
(
flac
_get_state
(
flacDec
));
ret
=
-
1
;
ret
=
-
1
;
goto
fail
;
goto
fail
;
}
}
if
(
!
FLAC__stream_decoder_process_until_end_of
_metadata
(
flacDec
))
{
if
(
!
flac_process
_metadata
(
flacDec
))
{
ERROR
(
"flac problem reading metadata
\n
"
);
ERROR
(
"flac problem reading metadata
\n
"
);
flacPrintErroredState
(
FLAC__stream_decoder
_get_state
(
flacDec
));
flacPrintErroredState
(
flac
_get_state
(
flacDec
));
ret
=
-
1
;
ret
=
-
1
;
goto
fail
;
goto
fail
;
}
}
...
@@ -315,17 +368,14 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
...
@@ -315,17 +368,14 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
dc
->
state
=
DECODE_STATE_DECODE
;
dc
->
state
=
DECODE_STATE_DECODE
;
while
(
1
)
{
while
(
1
)
{
if
(
!
FLAC__stream_decoder
_process_single
(
flacDec
))
if
(
!
flac
_process_single
(
flacDec
))
break
;
break
;
if
(
FLAC__stream_decoder_get_state
(
flacDec
)
==
if
(
flac_get_state
(
flacDec
)
==
flac_decoder_eof
)
FLAC__STREAM_DECODER_END_OF_STREAM
)
break
;
break
;
if
(
dc
->
seek
)
{
if
(
dc
->
seek
)
{
FLAC__uint64
sampleToSeek
=
dc
->
seekWhere
*
FLAC__uint64
sampleToSeek
=
dc
->
seekWhere
*
dc
->
audioFormat
.
sampleRate
+
0
.
5
;
dc
->
audioFormat
.
sampleRate
+
0
.
5
;
if
(
FLAC__stream_decoder_seek_absolute
(
flacDec
,
if
(
flac_seek_absolute
(
flacDec
,
sampleToSeek
))
{
sampleToSeek
))
{
clearOutputBuffer
(
cb
);
clearOutputBuffer
(
cb
);
data
.
time
=
((
float
)
sampleToSeek
)
/
data
.
time
=
((
float
)
sampleToSeek
)
/
dc
->
audioFormat
.
sampleRate
;
dc
->
audioFormat
.
sampleRate
;
...
@@ -336,8 +386,8 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
...
@@ -336,8 +386,8 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
}
}
}
}
if
(
!
dc
->
stop
)
{
if
(
!
dc
->
stop
)
{
flacPrintErroredState
(
FLAC__stream_decoder
_get_state
(
flacDec
));
flacPrintErroredState
(
flac
_get_state
(
flacDec
));
FLAC__stream_decoder
_finish
(
flacDec
);
flac
_finish
(
flacDec
);
}
}
/* send last little bit */
/* send last little bit */
if
(
data
.
chunk_length
>
0
&&
!
dc
->
stop
)
{
if
(
data
.
chunk_length
>
0
&&
!
dc
->
stop
)
{
...
@@ -358,7 +408,7 @@ fail:
...
@@ -358,7 +408,7 @@ fail:
freeReplayGainInfo
(
data
.
replayGainInfo
);
freeReplayGainInfo
(
data
.
replayGainInfo
);
if
(
flacDec
)
if
(
flacDec
)
FLAC__stream_decoder
_delete
(
flacDec
);
flac
_delete
(
flacDec
);
closeInputStream
(
inStream
);
closeInputStream
(
inStream
);
...
...
src/inputPlugins/oggflac_plugin.c
View file @
b152086a
...
@@ -19,11 +19,10 @@
...
@@ -19,11 +19,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
#include "
../inputPlugi
n.h"
#include "
_flac_commo
n.h"
#ifdef HAVE_OGGFLAC
#ifdef HAVE_OGGFLAC
#include "_flac_common.h"
#include "_ogg_common.h"
#include "_ogg_common.h"
#include "../utils.h"
#include "../utils.h"
...
@@ -37,8 +36,6 @@
...
@@ -37,8 +36,6 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include <OggFLAC/seekable_stream_decoder.h>
#include <FLAC/metadata.h>
static
void
oggflac_cleanup
(
InputStream
*
inStream
,
static
void
oggflac_cleanup
(
InputStream
*
inStream
,
FlacData
*
data
,
FlacData
*
data
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment