Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
482c287c
Commit
482c287c
authored
May 13, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: add a mutex to lock demuxing from another thread
parent
65bd5906
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+28
-17
No files found.
modules/demux/mkv.cpp
View file @
482c287c
...
@@ -1226,7 +1226,9 @@ public:
...
@@ -1226,7 +1226,9 @@ public:
,
p_input
(
NULL
)
,
p_input
(
NULL
)
,
i_curr_button
(
0
)
,
i_curr_button
(
0
)
,
p_ev
(
NULL
)
,
p_ev
(
NULL
)
{}
{
vlc_mutex_init
(
&
demuxer
,
&
lock_demuxer
);
}
virtual
~
demux_sys_t
()
virtual
~
demux_sys_t
()
{
{
...
@@ -1238,6 +1240,7 @@ public:
...
@@ -1238,6 +1240,7 @@ public:
delete
opened_segments
[
i
];
delete
opened_segments
[
i
];
for
(
i
=
0
;
i
<
used_segments
.
size
();
i
++
)
for
(
i
=
0
;
i
<
used_segments
.
size
();
i
++
)
delete
used_segments
[
i
];
delete
used_segments
[
i
];
vlc_mutex_destroy
(
&
lock_demuxer
);
}
}
/* current data */
/* current data */
...
@@ -1285,6 +1288,7 @@ public:
...
@@ -1285,6 +1288,7 @@ public:
pci_t
pci_packet
;
pci_t
pci_packet
;
int16
i_curr_button
;
int16
i_curr_button
;
uint8_t
alpha
[
4
];
uint8_t
alpha
[
4
];
vlc_mutex_t
lock_demuxer
;
/* event */
/* event */
event_thread_t
*
p_ev
;
event_thread_t
*
p_ev
;
...
@@ -2257,7 +2261,7 @@ void demux_sys_t::StartUiThread()
...
@@ -2257,7 +2261,7 @@ void demux_sys_t::StartUiThread()
/* Now create our event thread catcher */
/* Now create our event thread catcher */
p_ev
=
(
event_thread_t
*
)
vlc_object_create
(
&
demuxer
,
sizeof
(
event_thread_t
)
);
p_ev
=
(
event_thread_t
*
)
vlc_object_create
(
&
demuxer
,
sizeof
(
event_thread_t
)
);
p_ev
->
p_demux
=
&
demuxer
;
p_ev
->
p_demux
=
&
demuxer
;
p_ev
->
b_die
=
VLC_FALSE
;
p_ev
->
b_die
=
VLC_FALSE
;
vlc_mutex_init
(
p_ev
,
&
p_ev
->
lock
);
vlc_mutex_init
(
p_ev
,
&
p_ev
->
lock
);
vlc_thread_create
(
p_ev
,
"mkv event thread handler"
,
EventThread
,
vlc_thread_create
(
p_ev
,
"mkv event thread handler"
,
EventThread
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
...
@@ -2377,7 +2381,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2377,7 +2381,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
vlc_mutex_unlock
(
&
p_ev
->
lock
);
vlc_mutex_unlock
(
&
p_ev
->
lock
);
}
}
/*
VOUT
part */
/*
MOUSE
part */
if
(
p_vout
&&
(
p_ev
->
b_moved
||
p_ev
->
b_clicked
)
)
if
(
p_vout
&&
(
p_ev
->
b_moved
||
p_ev
->
b_clicked
)
)
{
{
vlc_value_t
valx
,
valy
;
vlc_value_t
valx
,
valy
;
...
@@ -2387,11 +2391,6 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2387,11 +2391,6 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
var_Get
(
p_vout
,
"mouse-x"
,
&
valx
);
var_Get
(
p_vout
,
"mouse-x"
,
&
valx
);
var_Get
(
p_vout
,
"mouse-y"
,
&
valy
);
var_Get
(
p_vout
,
"mouse-y"
,
&
valy
);
if
(
p_ev
->
b_moved
)
{
// dvdnav_mouse_select( NULL, pci, valx.i_int, valy.i_int );
p_ev
->
b_moved
=
0
;
}
if
(
p_ev
->
b_clicked
)
if
(
p_ev
->
b_clicked
)
{
{
int32_t
button
;
int32_t
button
;
...
@@ -2425,13 +2424,15 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2425,13 +2424,15 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
if
(
best
!=
0
)
if
(
best
!=
0
)
{
{
btni_t
*
button_ptr
=
&
(
pci
->
hli
.
btnit
[
best
-
1
])
;
btni_t
button_ptr
=
pci
->
hli
.
btnit
[
best
-
1
]
;
msg_Dbg
(
&
p_sys
->
demuxer
,
"Clicked button %d"
,
best
);
msg_Dbg
(
&
p_sys
->
demuxer
,
"Clicked button %d"
,
best
);
vlc_mutex_unlock
(
&
p_ev
->
lock
);
vlc_mutex_lock
(
&
p_sys
->
lock_demuxer
);
// process the button action
// process the button action
p_sys
->
dvd_interpretor
.
SetSPRM
(
0x88
,
best
);
p_sys
->
dvd_interpretor
.
SetSPRM
(
0x88
,
best
);
p_sys
->
dvd_interpretor
.
Interpret
(
button_ptr
->
cmd
.
bytes
,
8
);
p_sys
->
dvd_interpretor
.
Interpret
(
button_ptr
.
cmd
.
bytes
,
8
);
// select new button
// select new button
if
(
best
!=
p_sys
->
i_curr_button
)
if
(
best
!=
p_sys
->
i_curr_button
)
...
@@ -2441,11 +2442,10 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2441,11 +2442,10 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
if
(
var_Get
(
p_sys
->
p_input
,
"highlight-mutex"
,
&
val
)
==
VLC_SUCCESS
)
if
(
var_Get
(
p_sys
->
p_input
,
"highlight-mutex"
,
&
val
)
==
VLC_SUCCESS
)
{
{
vlc_mutex_t
*
p_mutex
=
(
vlc_mutex_t
*
)
val
.
p_address
;
vlc_mutex_t
*
p_mutex
=
(
vlc_mutex_t
*
)
val
.
p_address
;
btni_t
*
button_ptr
=
&
(
pci
->
hli
.
btnit
[
best
-
1
]);
uint32_t
i_palette
;
uint32_t
i_palette
;
if
(
button_ptr
->
btn_coln
!=
0
)
{
if
(
button_ptr
.
btn_coln
!=
0
)
{
i_palette
=
pci
->
hli
.
btn_colit
.
btn_coli
[
button_ptr
->
btn_coln
-
1
][
1
];
i_palette
=
pci
->
hli
.
btn_colit
.
btn_coli
[
button_ptr
.
btn_coln
-
1
][
1
];
}
else
{
}
else
{
i_palette
=
0
;
i_palette
=
0
;
}
}
...
@@ -2455,10 +2455,10 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2455,10 +2455,10 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
p_sys
->
alpha
[
3
]
=
(
i_palette
>>
12
)
&
0x0f
;
p_sys
->
alpha
[
3
]
=
(
i_palette
>>
12
)
&
0x0f
;
vlc_mutex_lock
(
p_mutex
);
vlc_mutex_lock
(
p_mutex
);
val
.
i_int
=
button_ptr
->
x_start
;
var_Set
(
p_sys
->
p_input
,
"x-start"
,
val
);
val
.
i_int
=
button_ptr
.
x_start
;
var_Set
(
p_sys
->
p_input
,
"x-start"
,
val
);
val
.
i_int
=
button_ptr
->
x_end
;
var_Set
(
p_sys
->
p_input
,
"x-end"
,
val
);
val
.
i_int
=
button_ptr
.
x_end
;
var_Set
(
p_sys
->
p_input
,
"x-end"
,
val
);
val
.
i_int
=
button_ptr
->
y_start
;
var_Set
(
p_sys
->
p_input
,
"y-start"
,
val
);
val
.
i_int
=
button_ptr
.
y_start
;
var_Set
(
p_sys
->
p_input
,
"y-start"
,
val
);
val
.
i_int
=
button_ptr
->
y_end
;
var_Set
(
p_sys
->
p_input
,
"y-end"
,
val
);
val
.
i_int
=
button_ptr
.
y_end
;
var_Set
(
p_sys
->
p_input
,
"y-end"
,
val
);
val
.
p_address
=
(
void
*
)
p_sys
->
alpha
;
val
.
p_address
=
(
void
*
)
p_sys
->
alpha
;
var_Set
(
p_sys
->
p_input
,
"menu-contrast"
,
val
);
var_Set
(
p_sys
->
p_input
,
"menu-contrast"
,
val
);
...
@@ -2469,14 +2469,21 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
...
@@ -2469,14 +2469,21 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
p_sys
->
i_curr_button
=
best
;
p_sys
->
i_curr_button
=
best
;
}
}
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock_demuxer
);
vlc_mutex_lock
(
&
p_ev
->
lock
);
}
}
}
}
else
if
(
p_ev
->
b_moved
)
{
// dvdnav_mouse_select( NULL, pci, valx.i_int, valy.i_int );
}
p_ev
->
b_moved
=
VLC_FALSE
;
p_ev
->
b_moved
=
VLC_FALSE
;
p_ev
->
b_clicked
=
VLC_FALSE
;
p_ev
->
b_clicked
=
VLC_FALSE
;
vlc_mutex_unlock
(
&
p_ev
->
lock
);
vlc_mutex_unlock
(
&
p_ev
->
lock
);
}
}
/* VOUT part */
if
(
p_vout
&&
p_vout
->
b_die
)
if
(
p_vout
&&
p_vout
->
b_die
)
{
{
var_DelCallback
(
p_vout
,
"mouse-moved"
,
EventMouse
,
p_ev
);
var_DelCallback
(
p_vout
,
"mouse-moved"
,
EventMouse
,
p_ev
);
...
@@ -2905,6 +2912,8 @@ static int Demux( demux_t *p_demux)
...
@@ -2905,6 +2912,8 @@ static int Demux( demux_t *p_demux)
int64_t
i_block_ref1
;
int64_t
i_block_ref1
;
int64_t
i_block_ref2
;
int64_t
i_block_ref2
;
vlc_mutex_lock
(
&
p_sys
->
lock_demuxer
);
for
(
;;
)
for
(
;;
)
{
{
if
(
p_sys
->
demuxer
.
b_die
)
if
(
p_sys
->
demuxer
.
b_die
)
...
@@ -2996,6 +3005,8 @@ static int Demux( demux_t *p_demux)
...
@@ -2996,6 +3005,8 @@ static int Demux( demux_t *p_demux)
}
}
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock_demuxer
);
return
i_return
;
return
i_return
;
}
}
...
...
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