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
a4cbaafd
Commit
a4cbaafd
authored
Feb 11, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: use error messages from libFLAC
parent
c5f2cdb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
44 deletions
+10
-44
_flac_common.c
src/decoder/_flac_common.c
+2
-15
_flac_common.h
src/decoder/_flac_common.h
+1
-2
flac_decoder_plugin.c
src/decoder/flac_decoder_plugin.c
+7
-27
No files found.
src/decoder/_flac_common.c
View file @
a4cbaafd
...
...
@@ -139,26 +139,13 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
}
}
void
flac_error_common_cb
(
const
char
*
plugin
,
const
FLAC__StreamDecoderErrorStatus
status
,
void
flac_error_common_cb
(
const
FLAC__StreamDecoderErrorStatus
status
,
struct
flac_data
*
data
)
{
if
(
decoder_get_command
(
data
->
decoder
)
==
DECODE_COMMAND_STOP
)
return
;
switch
(
status
)
{
case
FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
:
g_warning
(
"%s lost sync
\n
"
,
plugin
);
break
;
case
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
:
g_warning
(
"bad %s header
\n
"
,
plugin
);
break
;
case
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
:
g_warning
(
"%s crc mismatch
\n
"
,
plugin
);
break
;
default:
g_warning
(
"unknown %s error
\n
"
,
plugin
);
}
g_warning
(
"%s"
,
FLAC__StreamDecoderErrorStatusString
[
status
]);
}
/**
...
...
src/decoder/_flac_common.h
View file @
a4cbaafd
...
...
@@ -94,8 +94,7 @@ flac_data_deinit(struct flac_data *data);
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
struct
flac_data
*
data
);
void
flac_error_common_cb
(
const
char
*
plugin
,
FLAC__StreamDecoderErrorStatus
status
,
void
flac_error_common_cb
(
FLAC__StreamDecoderErrorStatus
status
,
struct
flac_data
*
data
);
FLAC__StreamDecoderWriteStatus
...
...
src/decoder/flac_decoder_plugin.c
View file @
a4cbaafd
...
...
@@ -117,46 +117,33 @@ static void
flac_error_cb
(
G_GNUC_UNUSED
const
FLAC__StreamDecoder
*
fd
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
fdata
)
{
flac_error_common_cb
(
"flac"
,
status
,
(
struct
flac_data
*
)
fdata
);
flac_error_common_cb
(
status
,
(
struct
flac_data
*
)
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"
;
break
;
}
g_warning
(
"%s
\n
"
,
str
);
g_warning
(
"%s
\n
"
,
FLAC__SeekableStreamDecoderStateString
[
state
]
);
}
#else
/* FLAC_API_VERSION_CURRENT >= 7 */
static
void
flacPrintErroredState
(
FLAC__StreamDecoderState
state
)
{
const
char
*
str
=
""
;
/* "" to silence compiler warning */
switch
(
state
)
{
case
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
:
case
FLAC__STREAM_DECODER_READ_METADATA
:
...
...
@@ -164,23 +151,16 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
case
FLAC__STREAM_DECODER_READ_FRAME
:
case
FLAC__STREAM_DECODER_END_OF_STREAM
:
return
;
case
FLAC__STREAM_DECODER_OGG_ERROR
:
str
=
"error in the Ogg layer"
;
break
;
case
FLAC__STREAM_DECODER_SEEK_ERROR
:
str
=
"seek error"
;
break
;
case
FLAC__STREAM_DECODER_ABORTED
:
str
=
"decoder aborted by read"
;
break
;
case
FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR
:
str
=
"allocation error"
;
break
;
case
FLAC__STREAM_DECODER_UNINITIALIZED
:
str
=
"decoder uninitialized"
;
break
;
}
g_warning
(
"%s
\n
"
,
str
);
g_warning
(
"%s
\n
"
,
FLAC__StreamDecoderStateString
[
state
]
);
}
#endif
/* FLAC_API_VERSION_CURRENT >= 7 */
...
...
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