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
a80b5cf1
Commit
a80b5cf1
authored
Nov 13, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderInternal: move functions into the class
parent
44ac8476
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
35 deletions
+28
-35
DecoderAPI.cxx
src/DecoderAPI.cxx
+6
-6
DecoderInternal.cxx
src/DecoderInternal.cxx
+16
-21
DecoderInternal.hxx
src/DecoderInternal.hxx
+5
-7
DecoderThread.cxx
src/DecoderThread.cxx
+1
-1
No files found.
src/DecoderAPI.cxx
View file @
a80b5cf1
...
...
@@ -312,12 +312,12 @@ do_send_tag(Decoder &decoder, const Tag &tag)
if
(
decoder
.
chunk
!=
nullptr
)
{
/* there is a partial chunk - flush it, we want the
tag in a new chunk */
decoder
_flush_chunk
(
decoder
);
decoder
.
FlushChunk
(
);
}
assert
(
decoder
.
chunk
==
nullptr
);
chunk
=
decoder
_get_chunk
(
decoder
);
chunk
=
decoder
.
GetChunk
(
);
if
(
chunk
==
nullptr
)
{
assert
(
decoder
.
dc
.
command
!=
DecoderCommand
::
NONE
);
return
decoder
.
dc
.
command
;
...
...
@@ -408,7 +408,7 @@ decoder_data(Decoder &decoder,
struct
music_chunk
*
chunk
;
bool
full
;
chunk
=
decoder
_get_chunk
(
decoder
);
chunk
=
decoder
.
GetChunk
(
);
if
(
chunk
==
nullptr
)
{
assert
(
dc
.
command
!=
DecoderCommand
::
NONE
);
return
dc
.
command
;
...
...
@@ -421,7 +421,7 @@ decoder_data(Decoder &decoder,
kbit_rate
);
if
(
dest
.
IsNull
())
{
/* the chunk is full, flush it */
decoder
_flush_chunk
(
decoder
);
decoder
.
FlushChunk
(
);
continue
;
}
...
...
@@ -440,7 +440,7 @@ decoder_data(Decoder &decoder,
full
=
chunk
->
Expand
(
dc
.
out_audio_format
,
nbytes
);
if
(
full
)
{
/* the chunk is full, flush it */
decoder
_flush_chunk
(
decoder
);
decoder
.
FlushChunk
(
);
}
data
=
(
const
uint8_t
*
)
data
+
nbytes
;
...
...
@@ -532,7 +532,7 @@ decoder_replay_gain(Decoder &decoder,
/* flush the current chunk because the new
replay gain values affect the following
samples */
decoder
_flush_chunk
(
decoder
);
decoder
.
FlushChunk
(
);
}
}
else
decoder
.
replay_gain_serial
=
0
;
...
...
src/DecoderInternal.cxx
View file @
a80b5cf1
...
...
@@ -51,24 +51,21 @@ need_chunks(DecoderControl &dc)
}
struct
music_chunk
*
decoder_get_chunk
(
Decoder
&
decoder
)
Decoder
::
GetChunk
(
)
{
DecoderControl
&
dc
=
decoder
.
dc
;
DecoderCommand
cmd
;
if
(
decoder
.
chunk
!=
nullptr
)
return
decoder
.
chunk
;
if
(
chunk
!=
nullptr
)
return
chunk
;
do
{
decoder
.
chunk
=
dc
.
buffer
->
Allocate
();
if
(
decoder
.
chunk
!=
nullptr
)
{
decoder
.
chunk
->
replay_gain_serial
=
decoder
.
replay_gain_serial
;
if
(
decoder
.
replay_gain_serial
!=
0
)
decoder
.
chunk
->
replay_gain_info
=
decoder
.
replay_gain_info
;
return
decoder
.
chunk
;
chunk
=
dc
.
buffer
->
Allocate
();
if
(
chunk
!=
nullptr
)
{
chunk
->
replay_gain_serial
=
replay_gain_serial
;
if
(
replay_gain_serial
!=
0
)
chunk
->
replay_gain_info
=
replay_gain_info
;
return
chunk
;
}
dc
.
Lock
();
...
...
@@ -80,18 +77,16 @@ decoder_get_chunk(Decoder &decoder)
}
void
decoder_flush_chunk
(
Decoder
&
decoder
)
Decoder
::
FlushChunk
(
)
{
DecoderControl
&
dc
=
decoder
.
dc
;
assert
(
decoder
.
chunk
!=
nullptr
);
assert
(
chunk
!=
nullptr
);
if
(
decoder
.
chunk
->
IsEmpty
())
dc
.
buffer
->
Return
(
decoder
.
chunk
);
if
(
chunk
->
IsEmpty
())
dc
.
buffer
->
Return
(
chunk
);
else
dc
.
pipe
->
Push
(
decoder
.
chunk
);
dc
.
pipe
->
Push
(
chunk
);
decoder
.
chunk
=
nullptr
;
chunk
=
nullptr
;
dc
.
Lock
();
if
(
dc
.
client_is_waiting
)
...
...
src/DecoderInternal.hxx
View file @
a80b5cf1
...
...
@@ -95,23 +95,21 @@ struct Decoder {
}
~
Decoder
();
};
/**
/**
* Returns the current chunk the decoder writes to, or allocates a new
* chunk if there is none.
*
* @return the chunk, or NULL if we have received a decoder command
*/
struct
music_chunk
*
decoder_get_chunk
(
Decoder
&
decoder
);
music_chunk
*
GetChunk
();
/**
/**
* Flushes the current chunk.
*
* Caller must not lock the #DecoderControl object.
*/
void
decoder_flush_chunk
(
Decoder
&
decoder
)
;
void
FlushChunk
();
}
;
#endif
src/DecoderThread.cxx
View file @
a80b5cf1
...
...
@@ -356,7 +356,7 @@ decoder_run_song(DecoderControl &dc,
/* flush the last chunk */
if
(
decoder
.
chunk
!=
nullptr
)
decoder
_flush_chunk
(
decoder
);
decoder
.
FlushChunk
(
);
dc
.
Lock
();
...
...
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