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
55c59361
Commit
55c59361
authored
May 17, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted remoteosd to vlc_clone().
parent
f83e0c96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
39 deletions
+43
-39
modules/video_filter/remoteosd.c
modules/video_filter/remoteosd.c
+43
-39
No files found.
modules/video_filter/remoteosd.c
View file @
55c59361
...
...
@@ -162,9 +162,9 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
static
void
stop_osdvnc
(
filter_t
*
p_filter
);
static
void
*
vnc_worker_thread
(
v
lc_object_t
*
p_thread_obj
);
static
void
*
vnc_worker_thread
(
v
oid
*
);
static
void
*
update_request_thread
(
v
lc_object_t
*
p_thread_obj
);
static
void
*
update_request_thread
(
v
oid
*
);
static
bool
open_vnc_connection
(
filter_t
*
p_filter
);
...
...
@@ -234,7 +234,7 @@ struct filter_sys_t
bool
b_continue
;
vlc_
object_t
*
p_
worker_thread
;
vlc_
thread_t
worker_thread
;
uint8_t
ar_color_table_yuv
[
256
][
4
];
};
...
...
@@ -315,13 +315,9 @@ static int CreateFilter ( vlc_object_t *p_this )
vlc_gcrypt_init
();
/* create the vnc worker thread */
p_sys
->
p_worker_thread
=
vlc_object_create
(
p_this
,
sizeof
(
vlc_object_t
)
);
vlc_object_attach
(
p_sys
->
p_worker_thread
,
p_this
);
if
(
vlc_thread_create
(
p_sys
->
p_worker_thread
,
vnc_worker_thread
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_clone
(
&
p_sys
->
worker_thread
,
vnc_worker_thread
,
p_filter
,
VLC_THREAD_PRIORITY_LOW
)
)
{
vlc_object_release
(
p_sys
->
p_worker_thread
);
msg_Err
(
p_filter
,
"cannot spawn vnc message reader thread"
);
goto
error
;
}
...
...
@@ -380,14 +376,10 @@ static void stop_osdvnc ( filter_t *p_filter )
vlc_object_kill
(
p_filter
);
/* */
if
(
p_sys
->
p_worker_thread
)
{
msg_Dbg
(
p_filter
,
"joining worker_thread"
);
vlc_object_kill
(
p_sys
->
p_worker_thread
);
vlc_thread_join
(
p_sys
->
p_worker_thread
);
vlc_object_release
(
p_sys
->
p_worker_thread
);
vlc_cancel
(
p_sys
->
worker_thread
);
vlc_join
(
p_sys
->
worker_thread
,
NULL
);
msg_Dbg
(
p_filter
,
"released worker_thread"
);
}
msg_Dbg
(
p_filter
,
"osdvnc stopped"
);
}
...
...
@@ -645,11 +637,11 @@ static bool handshaking ( filter_t *p_filter )
}
static
void
*
vnc_worker_thread
(
v
lc_object_t
*
p_thread_
obj
)
static
void
*
vnc_worker_thread
(
v
oid
*
obj
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
(
p_thread_obj
->
p_parent
)
;
filter_t
*
p_filter
=
(
filter_t
*
)
obj
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
vlc_
object_t
*
p_update_request_thread
;
vlc_
thread_t
update_request_thread_handle
;
int
canc
=
vlc_savecancel
();
msg_Dbg
(
p_filter
,
"VNC worker thread started"
);
...
...
@@ -683,19 +675,17 @@ static void* vnc_worker_thread( vlc_object_t *p_thread_obj )
vlc_mutex_unlock
(
&
p_sys
->
lock
);
/* create the update request thread */
p_update_request_thread
=
vlc_object_create
(
p_filter
,
sizeof
(
vlc_object_t
)
);
vlc_object_attach
(
p_update_request_thread
,
p_filter
);
if
(
vlc_thread_create
(
p_update_request_thread
,
update_request_thread
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_clone
(
&
update_request_thread_handle
,
update_request_thread
,
p_filter
,
VLC_THREAD_PRIORITY_LOW
)
)
{
vlc_object_release
(
p_update_request_thread
);
msg_Err
(
p_filter
,
"cannot spawn vnc update request thread"
);
goto
exit
;
}
/* connection is initialized, now read and handle server messages */
while
(
vlc_object_alive
(
p_thread_obj
)
)
vlc_restorecancel
(
canc
);
for
(
;;
)
{
rfbServerToClientMsg
msg
;
int
i_msgSize
;
...
...
@@ -743,13 +733,16 @@ static void* vnc_worker_thread( vlc_object_t *p_thread_obj )
break
;
}
}
canc
=
vlc_savecancel
();
process_server_message
(
p_filter
,
&
msg
);
vlc_restorecancel
(
canc
);
}
canc
=
vlc_savecancel
();
msg_Dbg
(
p_filter
,
"joining update_request_thread"
);
vlc_object_kill
(
p_update_request_thread
);
vlc_thread_join
(
p_update_request_thread
);
vlc_object_release
(
p_update_request_thread
);
vlc_cancel
(
update_request_thread_handle
);
vlc_join
(
update_request_thread_handle
,
NULL
);
msg_Dbg
(
p_filter
,
"released update_request_thread"
);
exit:
...
...
@@ -773,11 +766,17 @@ exit:
return
NULL
;
}
static
void
*
update_request_thread
(
vlc_object_t
*
p_thread_
obj
)
static
void
update_request_thread_cleanup
(
void
*
obj
)
{
filter_t
*
p_filter
=
(
filter_t
*
)(
p_thread_obj
->
p_parent
);
filter_t
*
p_filter
=
(
filter_t
*
)
obj
;
p_filter
->
p_sys
->
b_continue
=
false
;
}
static
void
*
update_request_thread
(
void
*
obj
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
obj
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
int
canc
=
vlc_savecancel
();
msg_Dbg
(
p_filter
,
"VNC update request thread started"
);
...
...
@@ -789,11 +788,16 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
udr
.
w
=
htons
(
p_sys
->
i_vnc_width
);
udr
.
h
=
htons
(
p_sys
->
i_vnc_height
);
if
(
!
write_exact
(
p_filter
,
p_sys
->
i_socket
,
(
char
*
)
&
udr
,
sz_rfbFramebufferUpdateRequestMsg
)
)
int
w
;
vlc_cleanup_push
(
update_request_thread_cleanup
,
p_filter
);
w
=
write_exact
(
p_filter
,
p_sys
->
i_socket
,
(
char
*
)
&
udr
,
sz_rfbFramebufferUpdateRequestMsg
);
vlc_cleanup_pop
();
if
(
!
w
)
{
msg_Err
(
p_filter
,
"Could not write rfbFramebufferUpdateRequestMsg."
);
p_sys
->
b_continue
=
false
;
update_request_thread_cleanup
(
p_filter
)
;
return
NULL
;
}
...
...
@@ -802,7 +806,8 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
if
(
p_sys
->
b_vnc_poll
)
{
while
(
vlc_object_alive
(
p_thread_obj
)
)
vlc_cleanup_push
(
update_request_thread_cleanup
,
p_filter
);
for
(
;;
)
{
msleep
(
i_poll_interval_microsec
);
if
(
!
write_exact
(
p_filter
,
p_sys
->
i_socket
,
(
char
*
)
&
udr
,
...
...
@@ -812,7 +817,7 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
break
;
}
}
p_sys
->
b_continue
=
false
;
vlc_cleanup_run
()
;
}
else
{
...
...
@@ -820,7 +825,6 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
}
msg_Dbg
(
p_filter
,
"VNC update request thread ended"
);
vlc_restorecancel
(
canc
);
return
NULL
;
}
...
...
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