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
a942384f
Commit
a942384f
authored
Jan 06, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: support streams without STREAMINFO block
parent
de0cdee4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
1 deletion
+53
-1
NEWS
NEWS
+1
-0
_flac_common.c
src/decoder/_flac_common.c
+40
-1
flac_decoder_plugin.c
src/decoder/flac_decoder_plugin.c
+12
-0
No files found.
NEWS
View file @
a942384f
...
...
@@ -23,6 +23,7 @@ ver 0.16 (20??/??/??)
- ffmpeg: convert metadata to generic format
- sndfile: new decoder plugin based on libsndfile
- flac: moved CUE sheet support to a playlist plugin
- flac: support streams without STREAMINFO block
- mikmod: sample rate is configurable
- mpg123: new decoder plugin based on libmpg123
- sidplay: support sub-tunes
...
...
src/decoder/_flac_common.c
View file @
a942384f
...
...
@@ -161,16 +161,55 @@ void flac_error_common_cb(const char *plugin,
}
}
/**
* This function attempts to call decoder_initialized() in case there
* was no STREAMINFO block. This is allowed for nonseekable streams,
* where the server sends us only a part of the file, without
* providing the STREAMINFO block from the beginning of the file
* (e.g. when seeking with SqueezeBox Server).
*/
static
bool
flac_got_first_frame
(
struct
flac_data
*
data
,
const
FLAC__FrameHeader
*
header
)
{
if
(
data
->
unsupported
)
return
false
;
GError
*
error
=
NULL
;
if
(
!
audio_format_init_checked
(
&
data
->
audio_format
,
header
->
sample_rate
,
flac_sample_format
(
header
->
bits_per_sample
),
header
->
channels
,
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
data
->
unsupported
=
true
;
return
false
;
}
data
->
frame_size
=
audio_format_frame_size
(
&
data
->
audio_format
);
decoder_initialized
(
data
->
decoder
,
&
data
->
audio_format
,
data
->
input_stream
->
seekable
,
(
float
)
data
->
total_frames
/
(
float
)
data
->
audio_format
.
sample_rate
);
data
->
initialized
=
true
;
return
true
;
}
FLAC__StreamDecoderWriteStatus
flac_common_write
(
struct
flac_data
*
data
,
const
FLAC__Frame
*
frame
,
const
FLAC__int32
*
const
buf
[],
FLAC__uint64
nbytes
)
{
enum
decoder_command
cmd
;
size_t
buffer_size
=
frame
->
header
.
blocksize
*
data
->
frame_size
;
void
*
buffer
;
unsigned
bit_rate
;
if
(
!
data
->
initialized
&&
!
flac_got_first_frame
(
data
,
&
frame
->
header
))
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
;
size_t
buffer_size
=
frame
->
header
.
blocksize
*
data
->
frame_size
;
buffer
=
pcm_buffer_get
(
&
data
->
buffer
,
buffer_size
);
flac_convert
(
buffer
,
frame
->
header
.
channels
,
...
...
src/decoder/flac_decoder_plugin.c
View file @
a942384f
...
...
@@ -247,6 +247,18 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd,
return
false
;
}
if
(
data
->
initialized
)
/* done */
return
true
;
if
(
data
->
input_stream
->
seekable
)
/* allow the workaround below only for nonseekable
streams*/
return
false
;
/* no stream_info packet found; try to initialize the decoder
from the first frame header */
FLAC__stream_decoder_process_single
(
sd
);
return
data
->
initialized
;
}
...
...
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