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
80b220a3
Commit
80b220a3
authored
Nov 11, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: keep track of current frame number
We need this for more exact end-of-subsong detection for CUE files.
parent
5cc3c4f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
0 deletions
+12
-0
_flac_common.c
src/decoder/_flac_common.c
+3
-0
_flac_common.h
src/decoder/_flac_common.h
+5
-0
flac_plugin.c
src/decoder/flac_plugin.c
+3
-0
oggflac_plugin.c
src/decoder/oggflac_plugin.c
+1
-0
No files found.
src/decoder/_flac_common.c
View file @
80b220a3
...
...
@@ -35,6 +35,8 @@ flac_data_init(struct flac_data *data, struct decoder * decoder,
{
pcm_buffer_init
(
&
data
->
buffer
);
data
->
next_frame
=
0
;
data
->
time
=
0
;
data
->
position
=
0
;
data
->
bit_rate
=
0
;
...
...
@@ -122,6 +124,7 @@ flac_common_write(struct flac_data *data, const FLAC__Frame * frame,
buffer
,
buffer_size
,
data
->
time
,
data
->
bit_rate
,
data
->
replay_gain_info
);
data
->
next_frame
+=
frame
->
header
.
blocksize
;
switch
(
cmd
)
{
case
DECODE_COMMAND_NONE
:
case
DECODE_COMMAND_START
:
...
...
src/decoder/_flac_common.h
View file @
80b220a3
...
...
@@ -148,6 +148,11 @@ typedef size_t flac_read_status_size_t;
struct
flac_data
{
struct
pcm_buffer
buffer
;
/**
* The number of the next frame which is going to be decoded.
*/
FLAC__uint64
next_frame
;
float
time
;
unsigned
int
bit_rate
;
struct
audio_format
audio_format
;
...
...
src/decoder/flac_plugin.c
View file @
80b220a3
...
...
@@ -460,6 +460,7 @@ flac_decode_internal(struct decoder * decoder,
FLAC__uint64
seek_sample
=
decoder_seek_where
(
decoder
)
*
data
.
audio_format
.
sample_rate
+
0
.
5
;
if
(
flac_seek_absolute
(
flac_dec
,
seek_sample
))
{
data
.
next_frame
=
seek_sample
;
data
.
time
=
((
float
)
seek_sample
)
/
data
.
audio_format
.
sample_rate
;
data
.
position
=
0
;
...
...
@@ -634,6 +635,7 @@ flac_container_decode(struct decoder* decoder,
if
(
seek_sample
>=
t_start
&&
seek_sample
<=
t_end
&&
flac_seek_absolute
(
flac_dec
,
(
FLAC__uint64
)
seek_sample
))
{
data
.
next_frame
=
seek_sample
;
data
.
time
=
(
float
)(
seek_sample
-
t_start
)
/
data
.
audio_format
.
sample_rate
;
data
.
position
=
0
;
...
...
@@ -756,6 +758,7 @@ flac_filedecode_internal(struct decoder* decoder,
data
.
audio_format
.
sample_rate
+
0
.
5
;
if
(
flac_seek_absolute
(
flac_dec
,
seek_sample
))
{
data
.
next_frame
=
seek_sample
;
data
.
time
=
((
float
)
seek_sample
)
/
data
.
audio_format
.
sample_rate
;
data
.
position
=
0
;
...
...
src/decoder/oggflac_plugin.c
View file @
80b220a3
...
...
@@ -328,6 +328,7 @@ oggflac_decode(struct decoder * mpd_decoder, struct input_stream *input_stream)
data
.
audio_format
.
sample_rate
+
0
.
5
;
if
(
OggFLAC__seekable_stream_decoder_seek_absolute
(
decoder
,
seek_sample
))
{
data
.
next_frame
=
seek_sample
;
data
.
time
=
((
float
)
seek_sample
)
/
data
.
audio_format
.
sample_rate
;
data
.
position
=
0
;
...
...
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