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
0c8cfc1a
Commit
0c8cfc1a
authored
Jun 12, 2007
by
Dennis van Amerongen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/osd/osd.c osd_parser.c: backport [20352], Fix memleaks.
parent
b7b09037
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
35 deletions
+53
-35
src/osd/osd.c
src/osd/osd.c
+49
-35
src/osd/osd_parser.c
src/osd/osd_parser.c
+4
-0
No files found.
src/osd/osd.c
View file @
0c8cfc1a
...
@@ -65,7 +65,8 @@ osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
...
@@ -65,7 +65,8 @@ osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
var_Get
(
p_this
->
p_libvlc
,
"osd_mutex"
,
&
lockval
);
var_Get
(
p_this
->
p_libvlc
,
"osd_mutex"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_lock
(
lockval
.
p_address
);
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
...
@@ -88,11 +89,14 @@ osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
...
@@ -88,11 +89,14 @@ osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
p_osd
->
i_width
=
p_osd
->
p_state
->
p_visible
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
;
p_osd
->
i_width
=
p_osd
->
p_state
->
p_visible
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
;
p_osd
->
i_height
=
p_osd
->
p_state
->
p_visible
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
;
p_osd
->
i_height
=
p_osd
->
p_state
->
p_visible
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
;
/* Update the volume state images to match the current volume */
if
(
p_osd
->
p_state
->
p_volume
)
i_volume
=
config_GetInt
(
p_this
,
"volume"
);
{
i_steps
=
osd_VolumeStep
(
p_this
,
i_volume
,
p_osd
->
p_state
->
p_volume
->
i_ranges
);
/* Update the volume state images to match the current volume */
p_osd
->
p_state
->
p_volume
->
p_current_state
=
osd_VolumeStateChange
(
p_osd
->
p_state
->
p_volume
->
p_states
,
i_steps
);
i_volume
=
config_GetInt
(
p_this
,
"volume"
);
i_steps
=
osd_VolumeStep
(
p_this
,
i_volume
,
p_osd
->
p_state
->
p_volume
->
i_ranges
);
p_osd
->
p_state
->
p_volume
->
p_current_state
=
osd_VolumeStateChange
(
p_osd
->
p_state
->
p_volume
->
p_states
,
i_steps
);
}
/* Initialize OSD state */
/* Initialize OSD state */
osd_UpdateState
(
p_osd
->
p_state
,
p_osd
->
i_x
,
p_osd
->
i_y
,
osd_UpdateState
(
p_osd
->
p_state
,
p_osd
->
i_x
,
p_osd
->
i_y
,
p_osd
->
i_width
,
p_osd
->
i_height
,
NULL
);
p_osd
->
i_width
,
p_osd
->
i_height
,
NULL
);
...
@@ -198,7 +202,8 @@ void __osd_MenuShow( vlc_object_t *p_this )
...
@@ -198,7 +202,8 @@ void __osd_MenuShow( vlc_object_t *p_this )
osd_button_t
*
p_button
=
NULL
;
osd_button_t
*
p_button
=
NULL
;
vlc_value_t
lockval
;
vlc_value_t
lockval
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
return
;
return
;
...
@@ -239,7 +244,8 @@ void __osd_MenuHide( vlc_object_t *p_this )
...
@@ -239,7 +244,8 @@ void __osd_MenuHide( vlc_object_t *p_this )
osd_menu_t
*
p_osd
=
NULL
;
osd_menu_t
*
p_osd
=
NULL
;
vlc_value_t
lockval
;
vlc_value_t
lockval
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
return
;
return
;
...
@@ -266,7 +272,8 @@ void __osd_MenuActivate( vlc_object_t *p_this )
...
@@ -266,7 +272,8 @@ void __osd_MenuActivate( vlc_object_t *p_this )
osd_button_t
*
p_button
=
NULL
;
osd_button_t
*
p_button
=
NULL
;
vlc_value_t
lockval
;
vlc_value_t
lockval
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
return
;
return
;
...
@@ -328,7 +335,8 @@ void __osd_MenuNext( vlc_object_t *p_this )
...
@@ -328,7 +335,8 @@ void __osd_MenuNext( vlc_object_t *p_this )
osd_button_t
*
p_button
=
NULL
;
osd_button_t
*
p_button
=
NULL
;
vlc_value_t
lockval
;
vlc_value_t
lockval
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
msg_Err
(
p_this
,
"osd_MenuNext failed"
);
return
;
return
;
...
@@ -378,7 +386,8 @@ void __osd_MenuPrev( vlc_object_t *p_this )
...
@@ -378,7 +386,8 @@ void __osd_MenuPrev( vlc_object_t *p_this )
osd_button_t
*
p_button
=
NULL
;
osd_button_t
*
p_button
=
NULL
;
vlc_value_t
lockval
;
vlc_value_t
lockval
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuPrev failed"
);
msg_Err
(
p_this
,
"osd_MenuPrev failed"
);
return
;
return
;
...
@@ -430,8 +439,8 @@ void __osd_MenuUp( vlc_object_t *p_this )
...
@@ -430,8 +439,8 @@ void __osd_MenuUp( vlc_object_t *p_this )
#if defined(OSD_MENU_DEBUG)
#if defined(OSD_MENU_DEBUG)
vlc_value_t
val
;
vlc_value_t
val
;
#endif
#endif
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuDown failed"
);
msg_Err
(
p_this
,
"osd_MenuDown failed"
);
return
;
return
;
...
@@ -502,7 +511,8 @@ void __osd_MenuDown( vlc_object_t *p_this )
...
@@ -502,7 +511,8 @@ void __osd_MenuDown( vlc_object_t *p_this )
vlc_value_t
val
;
vlc_value_t
val
;
#endif
#endif
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"osd_MenuDown failed"
);
msg_Err
(
p_this
,
"osd_MenuDown failed"
);
return
;
return
;
...
@@ -586,33 +596,37 @@ void __osd_Volume( vlc_object_t *p_this )
...
@@ -586,33 +596,37 @@ void __osd_Volume( vlc_object_t *p_this )
int
i_volume
=
0
;
int
i_volume
=
0
;
int
i_steps
=
0
;
int
i_steps
=
0
;
if
(
(
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
)
)
==
NULL
)
p_osd
=
vlc_object_find
(
p_this
,
VLC_OBJECT_OSDMENU
,
FIND_ANYWHERE
);
if
(
p_osd
==
NULL
)
{
{
msg_Err
(
p_this
,
"OSD menu volume update failed"
);
msg_Err
(
p_this
,
"OSD menu volume update failed"
);
return
;
return
;
}
}
var_Get
(
p_this
->
p_libvlc
,
"osd_mutex"
,
&
lockval
);
if
(
p_osd
->
p_state
&&
p_osd
->
p_state
->
p_volume
)
vlc_mutex_lock
(
lockval
.
p_address
);
p_button
=
p_osd
->
p_state
->
p_volume
;
if
(
p_osd
->
p_state
->
p_volume
)
p_osd
->
p_state
->
p_visible
=
p_osd
->
p_state
->
p_volume
;
if
(
p_button
&&
p_button
->
b_range
)
{
{
/* Update the volume state images to match the current volume */
var_Get
(
p_this
->
p_libvlc
,
"osd_mutex"
,
&
lockval
);
i_volume
=
config_GetInt
(
p_this
,
"volume"
);
vlc_mutex_lock
(
lockval
.
p_address
);
i_steps
=
osd_VolumeStep
(
p_this
,
i_volume
,
p_button
->
i_ranges
);
p_button
->
p_current_state
=
osd_VolumeStateChange
(
p_button
->
p_states
,
i_steps
);
osd_UpdateState
(
p_osd
->
p_state
,
p_button
=
p_osd
->
p_state
->
p_volume
;
p_button
->
i_x
,
p_button
->
i_y
,
if
(
p_osd
->
p_state
->
p_volume
)
p_button
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
,
p_osd
->
p_state
->
p_visible
=
p_osd
->
p_state
->
p_volume
;
p_button
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
,
if
(
p_button
&&
p_button
->
b_range
)
p_button
->
p_current_state
->
p_pic
);
{
osd_SetMenuUpdate
(
p_osd
,
VLC_TRUE
);
/* Update the volume state images to match the current volume */
osd_SetMenuVisible
(
p_osd
,
VLC_TRUE
);
i_volume
=
config_GetInt
(
p_this
,
"volume"
);
i_steps
=
osd_VolumeStep
(
p_this
,
i_volume
,
p_button
->
i_ranges
);
p_button
->
p_current_state
=
osd_VolumeStateChange
(
p_button
->
p_states
,
i_steps
);
osd_UpdateState
(
p_osd
->
p_state
,
p_button
->
i_x
,
p_button
->
i_y
,
p_button
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
,
p_button
->
p_current_state
->
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
,
p_button
->
p_current_state
->
p_pic
);
osd_SetMenuUpdate
(
p_osd
,
VLC_TRUE
);
osd_SetMenuVisible
(
p_osd
,
VLC_TRUE
);
}
vlc_object_release
(
(
vlc_object_t
*
)
p_osd
);
vlc_mutex_unlock
(
lockval
.
p_address
);
}
}
vlc_object_release
(
(
vlc_object_t
*
)
p_osd
);
vlc_mutex_unlock
(
lockval
.
p_address
);
}
}
src/osd/osd_parser.c
View file @
0c8cfc1a
...
@@ -91,8 +91,12 @@ static osd_menu_t *osd_MenuNew( osd_menu_t *p_menu, const char *psz_path, int i_
...
@@ -91,8 +91,12 @@ static osd_menu_t *osd_MenuNew( osd_menu_t *p_menu, const char *psz_path, int i_
p_menu
->
p_state
=
(
osd_menu_state_t
*
)
malloc
(
sizeof
(
osd_menu_state_t
)
);
p_menu
->
p_state
=
(
osd_menu_state_t
*
)
malloc
(
sizeof
(
osd_menu_state_t
)
);
if
(
!
p_menu
->
p_state
)
if
(
!
p_menu
->
p_state
)
{
msg_Err
(
p_menu
,
"Memory allocation for OSD Menu state failed"
);
msg_Err
(
p_menu
,
"Memory allocation for OSD Menu state failed"
);
return
NULL
;
}
memset
(
p_menu
->
p_state
,
0
,
sizeof
(
osd_menu_state_t
));
if
(
psz_path
!=
NULL
)
if
(
psz_path
!=
NULL
)
p_menu
->
psz_path
=
strdup
(
psz_path
);
p_menu
->
psz_path
=
strdup
(
psz_path
);
else
else
...
...
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