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
a3f5284d
Commit
a3f5284d
authored
Nov 11, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: merged code into flac_decoder_new()
Convenience wrapper for FLAC__stream_decoder_new() and FLAC__stream_decoder_set_metadata_respond().
parent
4a8cc87b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
28 deletions
+27
-28
flac_plugin.c
src/decoder/flac_plugin.c
+27
-28
No files found.
src/decoder/flac_plugin.c
View file @
a3f5284d
...
...
@@ -371,6 +371,26 @@ flac_tag_dup(const char *file)
return
flac_tag_load
(
file
,
NULL
);
}
/**
* Some glue code around FLAC__stream_decoder_new().
*/
static
FLAC__StreamDecoder
*
flac_decoder_new
(
void
)
{
FLAC__StreamDecoder
*
sd
=
FLAC__stream_decoder_new
();
if
(
sd
==
NULL
)
{
g_warning
(
"FLAC__stream_decoder_new() failed"
);
return
NULL
;
}
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
if
(
!
FLAC__stream_decoder_set_metadata_respond
(
sd
,
FLAC__METADATA_TYPE_VORBIS_COMMENT
))
g_debug
(
"FLAC__stream_decoder_set_metadata_respond() has failed"
);
#endif
return
sd
;
}
static
void
flac_decoder_loop
(
struct
flac_data
*
data
,
FLAC__StreamDecoder
*
flac_dec
,
FLAC__uint64
t_start
,
FLAC__uint64
t_end
)
...
...
@@ -431,18 +451,13 @@ flac_decode_internal(struct decoder * decoder,
struct
flac_data
data
;
const
char
*
err
=
NULL
;
if
(
!
(
flac_dec
=
FLAC__stream_decoder_new
()))
flac_dec
=
flac_decoder_new
();
if
(
flac_dec
==
NULL
)
return
;
flac_data_init
(
&
data
,
decoder
,
input_stream
);
data
.
tag
=
tag_new
();
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
if
(
!
FLAC__stream_decoder_set_metadata_respond
(
flac_dec
,
FLAC__METADATA_TYPE_VORBIS_COMMENT
))
{
g_debug
(
"Failed to set metadata respond
\n
"
);
}
#endif
if
(
is_ogg
)
{
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
FLAC__StreamDecoderInitStatus
status
=
...
...
@@ -564,21 +579,12 @@ flac_container_decode(struct decoder* decoder,
return
;
}
if
(
!
(
flac_dec
=
FLAC__stream_decoder_new
()))
{
g_free
(
pathname
);
flac_dec
=
flac_decoder_new
();
if
(
flac_dec
==
NULL
)
return
;
}
flac_data_init
(
&
data
,
decoder
,
NULL
);
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
if
(
!
FLAC__stream_decoder_set_metadata_respond
(
flac_dec
,
FLAC__METADATA_TYPE_VORBIS_COMMENT
))
{
g_debug
(
"Failed to set metadata respond
\n
"
);
}
#endif
init_status
=
is_ogg
?
FLAC__stream_decoder_init_ogg_file
(
flac_dec
,
pathname
,
flac_write_cb
,
...
...
@@ -645,19 +651,12 @@ flac_filedecode_internal(struct decoder* decoder,
const
char
*
err
=
NULL
;
unsigned
int
flac_err_state
=
0
;
if
(
!
(
flac_dec
=
FLAC__stream_decoder_new
()))
flac_dec
=
flac_decoder_new
();
if
(
flac_dec
==
NULL
)
return
;
flac_data_init
(
&
data
,
decoder
,
NULL
);
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
if
(
!
FLAC__stream_decoder_set_metadata_respond
(
flac_dec
,
FLAC__METADATA_TYPE_VORBIS_COMMENT
))
{
g_debug
(
"Failed to set metadata respond
\n
"
);
}
#endif
if
(
is_ogg
)
{
if
(
(
flac_err_state
=
FLAC__stream_decoder_init_ogg_file
(
flac_dec
,
...
...
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