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
7b880895
Commit
7b880895
authored
Sep 16, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_api: move code to decoder_check_cancel_read()
parent
b5139438
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
12 deletions
+28
-12
decoder_api.c
src/decoder_api.c
+28
-12
No files found.
src/decoder_api.c
View file @
7b880895
...
...
@@ -142,18 +142,41 @@ void decoder_seek_error(struct decoder * decoder)
decoder_command_finished
(
decoder
);
}
/**
* Should be read operation be cancelled? That is the case when the
* player thread has sent a command such as "STOP".
*/
G_GNUC_PURE
static
inline
bool
decoder_check_cancel_read
(
const
struct
decoder
*
decoder
)
{
if
(
decoder
==
NULL
)
return
false
;
const
struct
decoder_control
*
dc
=
decoder
->
dc
;
if
(
dc
->
command
==
DECODE_COMMAND_NONE
)
return
false
;
/* ignore the SEEK command during initialization, the plugin
should handle that after it has initialized successfully */
if
(
dc
->
command
==
DECODE_COMMAND_SEEK
&&
(
dc
->
state
==
DECODE_STATE_START
||
decoder
->
seeking
))
return
false
;
return
true
;
}
size_t
decoder_read
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
void
*
buffer
,
size_t
length
)
{
const
struct
decoder_control
*
dc
=
decoder
!=
NULL
?
decoder
->
dc
:
NULL
;
/* XXX don't allow decoder==NULL */
GError
*
error
=
NULL
;
size_t
nbytes
;
assert
(
decoder
==
NULL
||
dc
->
state
==
DECODE_STATE_START
||
dc
->
state
==
DECODE_STATE_DECODE
);
d
ecoder
->
d
c
->
state
==
DECODE_STATE_START
||
d
ecoder
->
d
c
->
state
==
DECODE_STATE_DECODE
);
assert
(
is
!=
NULL
);
assert
(
buffer
!=
NULL
);
...
...
@@ -161,14 +184,7 @@ size_t decoder_read(struct decoder *decoder,
return
0
;
while
(
true
)
{
/* XXX don't allow decoder==NULL */
if
(
decoder
!=
NULL
&&
/* ignore the SEEK command during initialization,
the plugin should handle that after it has
initialized successfully */
(
dc
->
command
!=
DECODE_COMMAND_SEEK
||
(
dc
->
state
!=
DECODE_STATE_START
&&
!
decoder
->
seeking
))
&&
dc
->
command
!=
DECODE_COMMAND_NONE
)
if
(
decoder_check_cancel_read
(
decoder
))
return
0
;
nbytes
=
input_stream_read
(
is
,
buffer
,
length
,
&
error
);
...
...
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