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
f937ec9a
Commit
f937ec9a
authored
Nov 11, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: merge code into flac_decoder_initialize()
Wrapper for FLAC__stream_decoder_process_until_end_of_metadata(), decoder_initialized().
parent
a3f5284d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
50 deletions
+39
-50
flac_plugin.c
src/decoder/flac_plugin.c
+39
-50
No files found.
src/decoder/flac_plugin.c
View file @
f937ec9a
...
...
@@ -391,6 +391,32 @@ flac_decoder_new(void)
return
sd
;
}
static
bool
flac_decoder_initialize
(
struct
flac_data
*
data
,
FLAC__StreamDecoder
*
sd
,
bool
seekable
,
FLAC__uint64
duration
)
{
if
(
!
FLAC__stream_decoder_process_until_end_of_metadata
(
sd
))
{
g_warning
(
"problem reading metadata"
);
return
false
;
}
if
(
!
audio_format_valid
(
&
data
->
audio_format
))
{
g_warning
(
"Invalid audio format: %u:%u:%u
\n
"
,
data
->
audio_format
.
sample_rate
,
data
->
audio_format
.
bits
,
data
->
audio_format
.
channels
);
return
false
;
}
if
(
duration
!=
0
)
data
->
total_time
=
(
float
)
duration
/
(
float
)
data
->
audio_format
.
sample_rate
;
decoder_initialized
(
data
->
decoder
,
&
data
->
audio_format
,
seekable
,
data
->
total_time
);
return
true
;
}
static
void
flac_decoder_loop
(
struct
flac_data
*
data
,
FLAC__StreamDecoder
*
flac_dec
,
FLAC__uint64
t_start
,
FLAC__uint64
t_end
)
...
...
@@ -496,22 +522,13 @@ flac_decode_internal(struct decoder * decoder,
}
}
if
(
!
FLAC__stream_decoder_process_until_end_of_metadata
(
flac_dec
))
{
err
=
"problem reading metadata"
;
goto
fail
;
}
if
(
!
audio_format_valid
(
&
data
.
audio_format
))
{
g_warning
(
"Invalid audio format: %u:%u:%u
\n
"
,
data
.
audio_format
.
sample_rate
,
data
.
audio_format
.
bits
,
data
.
audio_format
.
channels
);
goto
fail
;
if
(
!
flac_decoder_initialize
(
&
data
,
flac_dec
,
input_stream
->
seekable
,
0
))
{
flac_data_deinit
(
&
data
);
FLAC__stream_decoder_delete
(
flac_dec
);
return
;
}
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
input_stream
->
seekable
,
data
.
total_time
);
flac_decoder_loop
(
&
data
,
flac_dec
,
0
,
0
);
fail:
...
...
@@ -601,28 +618,12 @@ flac_container_decode(struct decoder* decoder,
goto
fail
;
}
if
(
!
FLAC__stream_decoder_process_until_end_of_metadata
(
flac_dec
))
{
err
=
"problem reading metadata"
;
goto
fail
;
}
if
(
!
audio_format_valid
(
&
data
.
audio_format
))
{
g_warning
(
"Invalid audio format: %u:%u:%u
\n
"
,
data
.
audio_format
.
sample_rate
,
data
.
audio_format
.
bits
,
data
.
audio_format
.
channels
);
goto
fail
;
if
(
!
flac_decoder_initialize
(
&
data
,
flac_dec
,
true
,
track_time
))
{
flac_data_deinit
(
&
data
);
FLAC__stream_decoder_delete
(
flac_dec
);
return
;
}
// set track time (order is important: after stream init)
data
.
total_time
=
((
float
)
track_time
/
(
float
)
data
.
audio_format
.
sample_rate
);
data
.
position
=
0
;
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
true
,
data
.
total_time
);
// seek to song start (order is important: after decoder init)
FLAC__stream_decoder_seek_absolute
(
flac_dec
,
(
FLAC__uint64
)
t_start
);
data
.
next_frame
=
t_start
;
...
...
@@ -694,24 +695,12 @@ flac_filedecode_internal(struct decoder* decoder,
}
}
if
(
!
FLAC__stream_decoder_process_until_end_of_metadata
(
flac_dec
))
{
err
=
"problem reading metadata"
;
goto
fail
;
}
if
(
!
audio_format_valid
(
&
data
.
audio_format
))
{
g_warning
(
"Invalid audio format: %u:%u:%u
\n
"
,
data
.
audio_format
.
sample_rate
,
data
.
audio_format
.
bits
,
data
.
audio_format
.
channels
);
goto
fail
;
if
(
!
flac_decoder_initialize
(
&
data
,
flac_dec
,
true
,
0
))
{
flac_data_deinit
(
&
data
);
FLAC__stream_decoder_delete
(
flac_dec
);
return
;
}
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
true
,
data
.
total_time
);
flac_decoder_loop
(
&
data
,
flac_dec
,
0
,
0
);
fail:
...
...
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