Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
bbb02213
Commit
bbb02213
authored
Aug 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_demux: simplify pf_read()
parent
776959f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
30 deletions
+29
-30
src/input/stream_demux.c
src/input/stream_demux.c
+29
-30
No files found.
src/input/stream_demux.c
View file @
bbb02213
...
...
@@ -173,46 +173,45 @@ static void DStreamDelete( stream_t *s )
}
static
ssize_t
DStreamRead
(
stream_t
*
s
,
void
*
p_read
,
size_t
i_read
)
static
ssize_t
DStreamRead
(
stream_t
*
s
,
void
*
buf
,
size_t
len
)
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
uint8_t
*
p_out
=
p_read
;
size_t
i_out
=
0
;
stream_sys_t
*
sys
=
s
->
p_sys
;
if
(
!
atomic_load
(
&
sys
->
active
)
)
return
-
1
;
if
(
s
->
b_error
)
return
-
1
;
if
(
len
==
0
)
return
0
;
//msg_Dbg( s, "DStreamRead: wanted %d bytes", i_read );
while
(
atomic_load
(
&
p_sys
->
active
)
&&
!
s
->
b_error
&&
i_read
)
block_t
*
block
=
sys
->
p_block
;
if
(
block
==
NULL
)
{
block_t
*
p_block
=
p_sys
->
p_block
;
size_t
i_copy
;
if
(
!
p_block
)
block
=
block_FifoGet
(
sys
->
p_fifo
);
if
(
block
==
NULL
)
{
p_block
=
block_FifoGet
(
p_sys
->
p_fifo
);
if
(
!
p_block
)
s
->
b_error
=
1
;
p_sys
->
p_block
=
p_block
;
s
->
b_error
=
true
;
return
-
1
;
}
sys
->
p_block
=
block
;
}
if
(
p_block
&&
i_read
)
{
i_copy
=
__MIN
(
i_read
,
p_block
->
i_buffer
);
if
(
p_out
&&
i_copy
)
memcpy
(
p_out
,
p_block
->
p_buffer
,
i_copy
);
i_read
-=
i_copy
;
if
(
p_out
)
p_out
+=
i_copy
;
i_out
+=
i_copy
;
p_block
->
i_buffer
-=
i_copy
;
p_block
->
p_buffer
+=
i_copy
;
if
(
!
p_block
->
i_buffer
)
size_t
copy
=
__MIN
(
len
,
block
->
i_buffer
);
if
(
buf
!=
NULL
&&
copy
>
0
)
memcpy
(
buf
,
block
->
p_buffer
,
copy
);
block
->
p_buffer
+=
copy
;
block
->
i_buffer
-=
copy
;
if
(
block
->
i_buffer
==
0
)
{
block_Release
(
p_block
);
p_sys
->
p_block
=
NULL
;
}
}
block_Release
(
block
);
sys
->
p_block
=
NULL
;
}
p_sys
->
i_pos
+=
i_out
;
return
i_out
;
sys
->
i_pos
+=
copy
;
return
copy
;
}
static
int
DStreamControl
(
stream_t
*
s
,
int
i_query
,
va_list
args
)
...
...
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