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
2718f4c3
Commit
2718f4c3
authored
Nov 21, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/API: move part of decoder_check_cancel_read() into class DecoderBridge
parent
8c342a76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
Bridge.cxx
src/decoder/Bridge.cxx
+20
-0
Bridge.hxx
src/decoder/Bridge.hxx
+9
-0
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+1
-19
No files found.
src/decoder/Bridge.cxx
View file @
2718f4c3
...
...
@@ -43,6 +43,26 @@ DecoderBridge::~DecoderBridge()
delete
decoder_tag
;
}
bool
DecoderBridge
::
CheckCancelRead
()
const
{
if
(
error
)
/* this translates to DecoderCommand::STOP */
return
true
;
if
(
dc
.
command
==
DecoderCommand
::
NONE
)
return
false
;
/* ignore the SEEK command during initialization, the plugin
should handle that after it has initialized successfully */
if
(
dc
.
command
==
DecoderCommand
::
SEEK
&&
(
dc
.
state
==
DecoderState
::
START
||
seeking
||
initial_seek_running
))
return
false
;
return
true
;
}
/**
* All chunks are full of decoded data; wait for the player to free
* one.
...
...
src/decoder/Bridge.hxx
View file @
2718f4c3
...
...
@@ -108,6 +108,15 @@ public:
~
DecoderBridge
();
/**
* Should be read operation be cancelled? That is the case when the
* player thread has sent a command such as "STOP".
*
* Caller must lock the #DecoderControl object.
*/
gcc_pure
bool
CheckCancelRead
()
const
;
/**
* Returns the current chunk the decoder writes to, or allocates a new
* chunk if there is none.
*
...
...
src/decoder/DecoderAPI.cxx
View file @
2718f4c3
...
...
@@ -264,25 +264,7 @@ gcc_pure
static
inline
bool
decoder_check_cancel_read
(
const
DecoderBridge
*
bridge
)
{
if
(
bridge
==
nullptr
)
return
false
;
if
(
bridge
->
error
)
/* this translates to DecoderCommand::STOP */
return
true
;
const
DecoderControl
&
dc
=
bridge
->
dc
;
if
(
dc
.
command
==
DecoderCommand
::
NONE
)
return
false
;
/* ignore the SEEK command during initialization, the plugin
should handle that after it has initialized successfully */
if
(
dc
.
command
==
DecoderCommand
::
SEEK
&&
(
dc
.
state
==
DecoderState
::
START
||
bridge
->
seeking
||
bridge
->
initial_seek_running
))
return
false
;
return
true
;
return
bridge
!=
nullptr
&&
bridge
->
CheckCancelRead
();
}
size_t
...
...
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