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
2c2d5073
Commit
2c2d5073
authored
Jul 23, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decomp: remove peek callback
parent
88a3f058
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
73 deletions
+9
-73
modules/stream_filter/decomp.c
modules/stream_filter/decomp.c
+9
-73
No files found.
modules/stream_filter/decomp.c
View file @
2c2d5073
...
@@ -87,7 +87,6 @@ struct stream_sys_t
...
@@ -87,7 +87,6 @@ struct stream_sys_t
pid_t
pid
;
pid_t
pid
;
uint64_t
offset
;
uint64_t
offset
;
block_t
*
peeked
;
int
read_fd
;
int
read_fd
;
bool
can_pace
;
bool
can_pace
;
...
@@ -186,8 +185,6 @@ static void *Thread (void *data)
...
@@ -186,8 +185,6 @@ static void *Thread (void *data)
}
}
static
int
Peek
(
stream_t
*
,
const
uint8_t
**
,
unsigned
int
);
#define MIN_BLOCK (1 << 10)
#define MIN_BLOCK (1 << 10)
#define MAX_BLOCK (1 << 20)
#define MAX_BLOCK (1 << 20)
/**
/**
...
@@ -197,36 +194,19 @@ static int Peek (stream_t *, const uint8_t **, unsigned int);
...
@@ -197,36 +194,19 @@ static int Peek (stream_t *, const uint8_t **, unsigned int);
static
int
Read
(
stream_t
*
stream
,
void
*
buf
,
unsigned
int
buflen
)
static
int
Read
(
stream_t
*
stream
,
void
*
buf
,
unsigned
int
buflen
)
{
{
stream_sys_t
*
sys
=
stream
->
p_sys
;
stream_sys_t
*
sys
=
stream
->
p_sys
;
unsigned
ret
=
0
;
ssize_t
ret
=
0
;
if
(
buf
==
NULL
)
/* caller skips data, get big enough peek buffer */
if
(
buf
==
NULL
)
/* caller skips data, get big enough peek buffer */
buflen
=
Peek
(
stream
,
&
(
const
uint8_t
*
){
NULL
},
buflen
);
block_t
*
peeked
=
sys
->
peeked
;
if
(
peeked
!=
NULL
)
{
/* dequeue peeked data */
size_t
length
=
peeked
->
i_buffer
;
if
(
length
>
buflen
)
length
=
buflen
;
if
(
buf
!=
NULL
)
{
{
memcpy
(
buf
,
peeked
->
p_buffer
,
length
);
buf
=
malloc
(
buflen
);
buf
=
((
char
*
)
buf
)
+
length
;
if
(
unlikely
(
buf
==
NULL
))
}
return
-
1
;
buflen
-=
length
;
peeked
->
p_buffer
+=
length
;
peeked
->
i_buffer
-=
length
;
if
(
peeked
->
i_buffer
==
0
)
ret
=
Read
(
stream
,
buf
,
buflen
);
{
free
(
buf
);
block_Release
(
peeked
);
return
ret
;
sys
->
peeked
=
NULL
;
}
}
sys
->
offset
+=
length
;
ret
+=
length
;
}
assert
((
buf
!=
NULL
)
||
(
buflen
==
0
));
assert
((
buf
!=
NULL
)
||
(
buflen
==
0
));
ssize_t
val
=
vlc_read_i11e
(
sys
->
read_fd
,
buf
,
buflen
);
ssize_t
val
=
vlc_read_i11e
(
sys
->
read_fd
,
buf
,
buflen
);
...
@@ -238,46 +218,6 @@ static int Read (stream_t *stream, void *buf, unsigned int buflen)
...
@@ -238,46 +218,6 @@ static int Read (stream_t *stream, void *buf, unsigned int buflen)
return
ret
;
return
ret
;
}
}
/**
*
*/
static
int
Peek
(
stream_t
*
stream
,
const
uint8_t
**
pbuf
,
unsigned
int
len
)
{
stream_sys_t
*
sys
=
stream
->
p_sys
;
block_t
*
peeked
=
sys
->
peeked
;
size_t
curlen
;
if
(
peeked
!=
NULL
)
{
curlen
=
peeked
->
i_buffer
;
if
(
curlen
<
len
)
peeked
=
block_Realloc
(
peeked
,
0
,
len
);
}
else
{
curlen
=
0
;
peeked
=
block_Alloc
(
len
);
}
sys
->
peeked
=
peeked
;
if
(
unlikely
(
peeked
==
NULL
))
return
0
;
while
(
curlen
<
len
)
{
ssize_t
val
;
val
=
vlc_read_i11e
(
sys
->
read_fd
,
peeked
->
p_buffer
+
curlen
,
len
-
curlen
);
if
(
val
<=
0
)
break
;
curlen
+=
val
;
peeked
->
i_buffer
=
curlen
;
}
*
pbuf
=
peeked
->
p_buffer
;
return
curlen
;
}
/**
/**
*
*
*/
*/
...
@@ -335,7 +275,6 @@ static int Open (stream_t *stream, const char *path)
...
@@ -335,7 +275,6 @@ static int Open (stream_t *stream, const char *path)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
stream
->
pf_read
=
Read
;
stream
->
pf_read
=
Read
;
stream
->
pf_peek
=
Peek
;
stream
->
pf_control
=
Control
;
stream
->
pf_control
=
Control
;
vlc_cond_init
(
&
p_sys
->
wait
);
vlc_cond_init
(
&
p_sys
->
wait
);
...
@@ -343,7 +282,6 @@ static int Open (stream_t *stream, const char *path)
...
@@ -343,7 +282,6 @@ static int Open (stream_t *stream, const char *path)
p_sys
->
paused
=
false
;
p_sys
->
paused
=
false
;
p_sys
->
pid
=
-
1
;
p_sys
->
pid
=
-
1
;
p_sys
->
offset
=
0
;
p_sys
->
offset
=
0
;
p_sys
->
peeked
=
NULL
;
stream_Control
(
stream
->
p_source
,
STREAM_CAN_PAUSE
,
&
p_sys
->
can_pause
);
stream_Control
(
stream
->
p_source
,
STREAM_CAN_PAUSE
,
&
p_sys
->
can_pause
);
stream_Control
(
stream
->
p_source
,
STREAM_CAN_CONTROL_PACE
,
stream_Control
(
stream
->
p_source
,
STREAM_CAN_CONTROL_PACE
,
&
p_sys
->
can_pace
);
&
p_sys
->
can_pace
);
...
@@ -445,8 +383,6 @@ static void Close (vlc_object_t *obj)
...
@@ -445,8 +383,6 @@ static void Close (vlc_object_t *obj)
while
(
waitpid
(
p_sys
->
pid
,
&
status
,
0
)
==
-
1
);
while
(
waitpid
(
p_sys
->
pid
,
&
status
,
0
)
==
-
1
);
msg_Dbg
(
obj
,
"exit status %d"
,
status
);
msg_Dbg
(
obj
,
"exit status %d"
,
status
);
if
(
p_sys
->
peeked
)
block_Release
(
p_sys
->
peeked
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_cond_destroy
(
&
p_sys
->
wait
);
vlc_cond_destroy
(
&
p_sys
->
wait
);
free
(
p_sys
);
free
(
p_sys
);
...
...
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