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
0246082b
Commit
0246082b
authored
Jul 10, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: move position code to FlacDecoder::GetDeltaPosition()
parent
3b031c6b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
FlacCommon.cxx
src/decoder/plugins/FlacCommon.cxx
+18
-0
FlacCommon.hxx
src/decoder/plugins/FlacCommon.hxx
+6
-0
FlacDecoderPlugin.cxx
src/decoder/plugins/FlacDecoderPlugin.cxx
+2
-13
No files found.
src/decoder/plugins/FlacCommon.cxx
View file @
0246082b
...
...
@@ -151,6 +151,24 @@ flac_got_first_frame(FlacDecoder *data, const FLAC__FrameHeader *header)
0
);
}
FLAC__uint64
FlacDecoder
::
GetDeltaPosition
(
const
FLAC__StreamDecoder
&
sd
)
{
FLAC__uint64
nbytes
;
if
(
!
FLAC__stream_decoder_get_decode_position
(
&
sd
,
&
nbytes
))
return
0
;
if
(
position
>
0
&&
nbytes
>
position
)
{
nbytes
-=
position
;
position
+=
nbytes
;
}
else
{
position
=
nbytes
;
nbytes
=
0
;
}
return
nbytes
;
}
FLAC__StreamDecoderWriteStatus
flac_common_write
(
FlacDecoder
*
data
,
const
FLAC__Frame
*
frame
,
const
FLAC__int32
*
const
buf
[],
...
...
src/decoder/plugins/FlacCommon.hxx
View file @
0246082b
...
...
@@ -69,6 +69,12 @@ struct FlacDecoder : public FlacInput {
*/
bool
Initialize
(
unsigned
sample_rate
,
unsigned
bits_per_sample
,
unsigned
channels
,
FLAC__uint64
total_frames
);
/**
* Calculate the delta (in bytes) between the last frame and
* the current frame.
*/
FLAC__uint64
GetDeltaPosition
(
const
FLAC__StreamDecoder
&
sd
);
};
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
...
...
src/decoder/plugins/FlacDecoderPlugin.cxx
View file @
0246082b
...
...
@@ -65,20 +65,9 @@ flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame,
const
FLAC__int32
*
const
buf
[],
void
*
vdata
)
{
FlacDecoder
*
data
=
(
FlacDecoder
*
)
vdata
;
FLAC__uint64
nbytes
=
0
;
if
(
FLAC__stream_decoder_get_decode_position
(
dec
,
&
nbytes
))
{
if
(
data
->
position
>
0
&&
nbytes
>
data
->
position
)
{
nbytes
-=
data
->
position
;
data
->
position
+=
nbytes
;
}
else
{
data
->
position
=
nbytes
;
nbytes
=
0
;
}
}
else
nbytes
=
0
;
return
flac_common_write
(
data
,
frame
,
buf
,
nbytes
);
return
flac_common_write
(
data
,
frame
,
buf
,
data
->
GetDeltaPosition
(
*
dec
));
}
static
bool
...
...
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