Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
3af03657
Commit
3af03657
authored
Jul 21, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert highlight to global mutex
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
e4b0862f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
88 deletions
+75
-88
include/vlc_threads.h
include/vlc_threads.h
+1
-0
modules/access/dvdnav.c
modules/access/dvdnav.c
+43
-52
modules/demux/mkv/demux.cpp
modules/demux/mkv/demux.cpp
+30
-36
src/misc/threads.c
src/misc/threads.c
+1
-0
No files found.
include/vlc_threads.h
View file @
3af03657
...
...
@@ -481,6 +481,7 @@ enum {
VLC_GCRYPT_MUTEX
,
VLC_XLIB_MUTEX
,
VLC_MOSAIC_MUTEX
,
VLC_HIGHLIGHT_MUTEX
,
/* Insert new entry HERE */
VLC_MAX_MUTEX
};
...
...
modules/access/dvdnav.c
View file @
3af03657
...
...
@@ -368,7 +368,6 @@ static int Open( vlc_object_t *p_this )
var_Create
(
p_sys
->
p_input
,
"color"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_sys
->
p_input
,
"menu-palette"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_sys
->
p_input
,
"highlight"
,
VLC_VAR_BOOL
);
var_Create
(
p_sys
->
p_input
,
"highlight-mutex"
,
VLC_VAR_MUTEX
);
/* catch all key event */
var_AddCallback
(
p_demux
->
p_libvlc
,
"key-action"
,
EventKey
,
p_demux
);
...
...
@@ -408,7 +407,6 @@ static void Close( vlc_object_t *p_this )
vlc_timer_destroy
(
p_sys
->
still
.
timer
);
vlc_mutex_destroy
(
&
p_sys
->
still
.
lock
);
var_Destroy
(
p_sys
->
p_input
,
"highlight-mutex"
);
var_Destroy
(
p_sys
->
p_input
,
"highlight"
);
var_Destroy
(
p_sys
->
p_input
,
"x-start"
);
var_Destroy
(
p_sys
->
p_input
,
"x-end"
);
...
...
@@ -1050,67 +1048,60 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
dvdnav_current_title_info
(
p_sys
->
dvdnav
,
&
i_title
,
&
i_part
);
if
(
var_Get
(
p_sys
->
p_input
,
"highlight-mutex"
,
&
val
)
==
VLC_SUCCESS
)
{
vlc_mutex_t
*
p_mutex
=
val
.
p_address
;
dvdnav_highlight_area_t
hl
;
int32_t
i_button
;
bool
b_button_ok
;
dvdnav_highlight_area_t
hl
;
int32_t
i_button
;
bool
b_button_ok
;
if
(
dvdnav_get_current_highlight
(
p_sys
->
dvdnav
,
&
i_button
)
!=
DVDNAV_STATUS_OK
)
{
msg_Err
(
p_demux
,
"dvdnav_get_current_highlight failed"
);
return
;
}
if
(
dvdnav_get_current_highlight
(
p_sys
->
dvdnav
,
&
i_button
)
!=
DVDNAV_STATUS_OK
)
{
msg_Err
(
p_demux
,
"dvdnav_get_current_highlight failed"
);
return
;
}
b_button_ok
=
false
;
if
(
i_button
>
0
&&
i_title
==
0
)
{
pci_t
*
pci
=
dvdnav_get_current_nav_pci
(
p_sys
->
dvdnav
);
b_button_ok
=
false
;
if
(
i_button
>
0
&&
i_title
==
0
)
{
pci_t
*
pci
=
dvdnav_get_current_nav_pci
(
p_sys
->
dvdnav
);
b_button_ok
=
DVDNAV_STATUS_OK
==
dvdnav_get_highlight_area
(
pci
,
i_button
,
b_mode
,
&
hl
);
}
b_button_ok
=
DVDNAV_STATUS_OK
==
dvdnav_get_highlight_area
(
pci
,
i_button
,
b_mode
,
&
hl
);
}
if
(
b_button_ok
)
if
(
b_button_ok
)
{
for
(
unsigned
i
=
0
;
i
<
4
;
i
++
)
{
int
i
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
uint32_t
i_yuv
=
p_sys
->
clut
[(
hl
.
palette
>>
(
16
+
i
*
4
))
&
0x0f
];
uint8_t
i_alpha
=
(
(
hl
.
palette
>>
(
i
*
4
))
&
0x0f
)
*
0xff
/
0xf
;
p_sys
->
palette
[
i
][
0
]
=
(
i_yuv
>>
16
)
&
0xff
;
p_sys
->
palette
[
i
][
1
]
=
(
i_yuv
>>
0
)
&
0xff
;
p_sys
->
palette
[
i
][
2
]
=
(
i_yuv
>>
8
)
&
0xff
;
p_sys
->
palette
[
i
][
3
]
=
i_alpha
;
}
uint32_t
i_yuv
=
p_sys
->
clut
[(
hl
.
palette
>>
(
16
+
i
*
4
))
&
0x0f
];
uint8_t
i_alpha
=
(
(
hl
.
palette
>>
(
i
*
4
))
&
0x0f
)
*
0xff
/
0xf
;
vlc_mutex_lock
(
p_mutex
)
;
var_SetInteger
(
p_sys
->
p_input
,
"x-start"
,
hl
.
sx
)
;
var_SetInteger
(
p_sys
->
p_input
,
"x-end"
,
hl
.
ex
)
;
var_SetInteger
(
p_sys
->
p_input
,
"y-start"
,
hl
.
sy
)
;
var_SetInteger
(
p_sys
->
p_input
,
"y-end"
,
hl
.
ey
);
p_sys
->
palette
[
i
][
0
]
=
(
i_yuv
>>
16
)
&
0xff
;
p_sys
->
palette
[
i
][
1
]
=
(
i_yuv
>>
0
)
&
0xff
;
p_sys
->
palette
[
i
][
2
]
=
(
i_yuv
>>
8
)
&
0xff
;
p_sys
->
palette
[
i
][
3
]
=
i_alpha
;
}
var_SetAddress
(
p_sys
->
p_input
,
"menu-palette"
,
p_sys
->
palette
);
vlc_global_lock
(
VLC_HIGHLIGHT_MUTEX
);
var_SetInteger
(
p_sys
->
p_input
,
"x-start"
,
hl
.
sx
);
var_SetInteger
(
p_sys
->
p_input
,
"x-end"
,
hl
.
ex
);
var_SetInteger
(
p_sys
->
p_input
,
"y-start"
,
hl
.
sy
);
var_SetInteger
(
p_sys
->
p_input
,
"y-end"
,
hl
.
ey
);
var_SetBool
(
p_sys
->
p_input
,
"highlight"
,
tru
e
);
vlc_mutex_unlock
(
p_mutex
);
var_SetAddress
(
p_sys
->
p_input
,
"menu-palette"
,
p_sys
->
palett
e
);
var_SetBool
(
p_sys
->
p_input
,
"highlight"
,
true
);
msg_Dbg
(
p_demux
,
"buttonUpdate %d"
,
i_button
);
}
else
{
msg_Dbg
(
p_demux
,
"buttonUpdate not done b=%d t=%d"
,
i_button
,
i_title
);
msg_Dbg
(
p_demux
,
"buttonUpdate %d"
,
i_button
);
}
else
{
msg_Dbg
(
p_demux
,
"buttonUpdate not done b=%d t=%d"
,
i_button
,
i_title
);
/* Show all */
vlc_mutex_lock
(
p_mutex
);
var_SetBool
(
p_sys
->
p_input
,
"highlight"
,
false
);
vlc_mutex_unlock
(
p_mutex
);
}
/* Show all */
vlc_global_lock
(
VLC_HIGHLIGHT_MUTEX
);
var_SetBool
(
p_sys
->
p_input
,
"highlight"
,
false
);
}
vlc_global_unlock
(
VLC_HIGHLIGHT_MUTEX
);
}
static
void
ESSubtitleUpdate
(
demux_t
*
p_demux
)
...
...
modules/demux/mkv/demux.cpp
View file @
3af03657
...
...
@@ -345,43 +345,39 @@ void event_thread_t::EventThread()
// select new button
if
(
best
!=
i_curr_button
)
{
vlc_value_t
val
;
uint32_t
i_palette
;
if
(
var_Get
(
p_sys
->
p_input
,
"highlight-mutex"
,
&
val
)
==
VLC_SUCCESS
)
if
(
button_ptr
.
btn_coln
!=
0
)
{
i_palette
=
pci
->
hli
.
btn_colit
.
btn_coli
[
button_ptr
.
btn_coln
-
1
][
1
];
}
else
{
i_palette
=
0
;
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
vlc_mutex_t
*
p_mutex
=
(
vlc_mutex_t
*
)
val
.
p_address
;
uint32_t
i_palette
;
if
(
button_ptr
.
btn_coln
!=
0
)
{
i_palette
=
pci
->
hli
.
btn_colit
.
btn_coli
[
button_ptr
.
btn_coln
-
1
][
1
];
}
else
{
i_palette
=
0
;
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
uint32_t
i_yuv
=
0xFF
;
//p_sys->clut[(hl.palette>>(16+i*4))&0x0f];
uint8_t
i_alpha
=
(
i_palette
>>
(
i
*
4
))
&
0x0f
;
i_alpha
=
i_alpha
==
0xf
?
0xff
:
i_alpha
<<
4
;
p_sys
->
palette
[
i
][
0
]
=
(
i_yuv
>>
16
)
&
0xff
;
p_sys
->
palette
[
i
][
1
]
=
(
i_yuv
>>
0
)
&
0xff
;
p_sys
->
palette
[
i
][
2
]
=
(
i_yuv
>>
8
)
&
0xff
;
p_sys
->
palette
[
i
][
3
]
=
i_alpha
;
}
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_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_end
;
var_Set
(
p_sys
->
p_input
,
"y-end"
,
val
);
val
.
p_address
=
(
void
*
)
p_sys
->
palette
;
var_Set
(
p_sys
->
p_input
,
"menu-palette"
,
val
);
val
.
b_bool
=
true
;
var_Set
(
p_sys
->
p_input
,
"highlight"
,
val
);
vlc_mutex_unlock
(
p_mutex
);
uint32_t
i_yuv
=
0xFF
;
//p_sys->clut[(hl.palette>>(16+i*4))&0x0f];
uint8_t
i_alpha
=
(
i_palette
>>
(
i
*
4
))
&
0x0f
;
i_alpha
=
i_alpha
==
0xf
?
0xff
:
i_alpha
<<
4
;
p_sys
->
palette
[
i
][
0
]
=
(
i_yuv
>>
16
)
&
0xff
;
p_sys
->
palette
[
i
][
1
]
=
(
i_yuv
>>
0
)
&
0xff
;
p_sys
->
palette
[
i
][
2
]
=
(
i_yuv
>>
8
)
&
0xff
;
p_sys
->
palette
[
i
][
3
]
=
i_alpha
;
}
vlc_global_lock
(
VLC_HIGHLIGHT_MUTEX
);
var_SetInteger
(
p_sys
->
p_input
,
"x-start"
,
button_ptr
.
x_start
);
var_SetInteger
(
p_sys
->
p_input
,
"x-end"
,
button_ptr
.
x_end
);
var_SetInteger
(
p_sys
->
p_input
,
"y-start"
,
button_ptr
.
y_start
);
var_SetInteger
(
p_sys
->
p_input
,
"y-end"
,
button_ptr
.
y_end
);
var_SetAddress
(
p_sys
->
p_input
,
"menu-palette"
,
p_sys
->
palette
);
var_SetBool
(
p_sys
->
p_input
,
"highlight"
,
true
);
vlc_global_unlock
(
VLC_HIGHLIGHT_MUTEX
);
}
vlc_mutex_unlock
(
&
p_sys
->
lock_demuxer
);
vlc_mutex_lock
(
&
lock
);
...
...
@@ -601,7 +597,6 @@ void demux_sys_t::InitUi()
var_Create
(
p_input
,
"color"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_input
,
"menu-palette"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_input
,
"highlight"
,
VLC_VAR_BOOL
);
var_Create
(
p_input
,
"highlight-mutex"
,
VLC_VAR_MUTEX
);
}
/* Now create our event thread catcher */
...
...
@@ -615,7 +610,6 @@ void demux_sys_t::CleanUi()
if
(
p_input
)
{
var_Destroy
(
p_input
,
"highlight-mutex"
);
var_Destroy
(
p_input
,
"highlight"
);
var_Destroy
(
p_input
,
"x-start"
);
var_Destroy
(
p_input
,
"x-end"
);
...
...
src/misc/threads.c
View file @
3af03657
...
...
@@ -41,6 +41,7 @@ void vlc_global_mutex (unsigned n, bool acquire)
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
};
assert
(
n
<
(
sizeof
(
locks
)
/
sizeof
(
locks
[
0
])));
vlc_mutex_t
*
lock
=
locks
+
n
;
...
...
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