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
8f21af10
Commit
8f21af10
authored
Apr 16, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decomp: implement pause/resume
parent
ddece1c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
modules/stream_filter/decomp.c
modules/stream_filter/decomp.c
+33
-1
No files found.
modules/stream_filter/decomp.c
View file @
8f21af10
...
@@ -74,6 +74,11 @@ struct stream_sys_t
...
@@ -74,6 +74,11 @@ struct stream_sys_t
/* Thread data */
/* Thread data */
int
write_fd
;
int
write_fd
;
/* Shared data */
vlc_cond_t
wait
;
vlc_mutex_t
lock
;
bool
paused
;
/* Caller data */
/* Caller data */
vlc_thread_t
thread
;
vlc_thread_t
thread
;
pid_t
pid
;
pid_t
pid
;
...
@@ -83,6 +88,7 @@ struct stream_sys_t
...
@@ -83,6 +88,7 @@ struct stream_sys_t
int
read_fd
;
int
read_fd
;
bool
can_pace
;
bool
can_pace
;
bool
can_pause
;
};
};
extern
char
**
environ
;
extern
char
**
environ
;
...
@@ -122,7 +128,12 @@ static void *Thread (void *data)
...
@@ -122,7 +128,12 @@ static void *Thread (void *data)
vlc_cleanup_push
(
free
,
buf
);
vlc_cleanup_push
(
free
,
buf
);
#endif
#endif
vlc_mutex_lock
(
&
p_sys
->
lock
);
while
(
p_sys
->
paused
)
/* practically always false, but... */
vlc_cond_wait
(
&
p_sys
->
wait
,
&
p_sys
->
lock
);
len
=
stream_Read
(
stream
->
p_source
,
buf
,
bufsize
);
len
=
stream_Read
(
stream
->
p_source
,
buf
,
bufsize
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
error
=
len
<=
0
;
error
=
len
<=
0
;
...
@@ -251,9 +262,11 @@ static int Control (stream_t *stream, int query, va_list args)
...
@@ -251,9 +262,11 @@ static int Control (stream_t *stream, int query, va_list args)
{
{
case
STREAM_CAN_SEEK
:
case
STREAM_CAN_SEEK
:
case
STREAM_CAN_FASTSEEK
:
case
STREAM_CAN_FASTSEEK
:
case
STREAM_CAN_PAUSE
:
/* TODO: support pause */
*
(
va_arg
(
args
,
bool
*
))
=
false
;
*
(
va_arg
(
args
,
bool
*
))
=
false
;
break
;
break
;
case
STREAM_CAN_PAUSE
:
*
(
va_arg
(
args
,
bool
*
))
=
p_sys
->
can_pause
;
break
;
case
STREAM_CAN_CONTROL_PACE
:
case
STREAM_CAN_CONTROL_PACE
:
*
(
va_arg
(
args
,
bool
*
))
=
p_sys
->
can_pace
;
*
(
va_arg
(
args
,
bool
*
))
=
p_sys
->
can_pace
;
break
;
break
;
...
@@ -263,6 +276,17 @@ static int Control (stream_t *stream, int query, va_list args)
...
@@ -263,6 +276,17 @@ static int Control (stream_t *stream, int query, va_list args)
case
STREAM_GET_SIZE
:
case
STREAM_GET_SIZE
:
*
(
va_arg
(
args
,
uint64_t
*
))
=
0
;
*
(
va_arg
(
args
,
uint64_t
*
))
=
0
;
break
;
break
;
case
STREAM_SET_PAUSE_STATE
:
{
bool
paused
=
va_arg
(
args
,
unsigned
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
stream_Control
(
stream
->
p_source
,
STREAM_SET_PAUSE_STATE
,
paused
);
p_sys
->
paused
=
paused
;
vlc_cond_signal
(
&
p_sys
->
wait
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
break
;
}
default:
default:
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -284,9 +308,13 @@ static int Open (stream_t *stream, const char *path)
...
@@ -284,9 +308,13 @@ static int Open (stream_t *stream, const char *path)
stream
->
pf_peek
=
Peek
;
stream
->
pf_peek
=
Peek
;
stream
->
pf_control
=
Control
;
stream
->
pf_control
=
Control
;
vlc_cond_init
(
&
p_sys
->
wait
);
vlc_mutex_init
(
&
p_sys
->
lock
);
p_sys
->
paused
=
false
;
p_sys
->
pid
=
-
1
;
p_sys
->
pid
=
-
1
;
p_sys
->
offset
=
0
;
p_sys
->
offset
=
0
;
p_sys
->
peeked
=
NULL
;
p_sys
->
peeked
=
NULL
;
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
);
...
@@ -359,6 +387,8 @@ static int Open (stream_t *stream, const char *path)
...
@@ -359,6 +387,8 @@ static int Open (stream_t *stream, const char *path)
if
(
p_sys
->
pid
!=
-
1
)
if
(
p_sys
->
pid
!=
-
1
)
while
(
waitpid
(
p_sys
->
pid
,
&
(
int
){
0
},
0
)
==
-
1
);
while
(
waitpid
(
p_sys
->
pid
,
&
(
int
){
0
},
0
)
==
-
1
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_cond_destroy
(
&
p_sys
->
wait
);
free
(
p_sys
);
free
(
p_sys
);
return
ret
;
return
ret
;
}
}
...
@@ -386,6 +416,8 @@ static void Close (vlc_object_t *obj)
...
@@ -386,6 +416,8 @@ static void Close (vlc_object_t *obj)
if
(
p_sys
->
peeked
)
if
(
p_sys
->
peeked
)
block_Release
(
p_sys
->
peeked
);
block_Release
(
p_sys
->
peeked
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
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