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
9f85beee
Commit
9f85beee
authored
May 23, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix title N variable formatting
Do not assume the title number is small; allocate large enough buffer.
parent
3e48cead
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
22 deletions
+17
-22
lib/media_player.c
lib/media_player.c
+4
-8
lib/video.c
lib/video.c
+2
-2
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+4
-4
src/input/event.c
src/input/event.c
+3
-3
src/input/var.c
src/input/var.c
+4
-5
No files found.
lib/media_player.c
View file @
9f85beee
...
...
@@ -1266,19 +1266,15 @@ int libvlc_media_player_get_chapter_count_for_title(
libvlc_media_player_t
*
p_mi
,
int
i_title
)
{
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
char
*
psz_name
;
if
(
asprintf
(
&
psz_name
,
"title %2i"
,
i_title
)
==
-
1
)
{
vlc_object_release
(
p_input_thread
);
return
-
1
;
}
char
psz_name
[
sizeof
(
"title "
)
+
3
*
sizeof
(
int
)];
sprintf
(
psz_name
,
"title %2u"
,
i_title
);
int
i_ret
=
var_Change
(
p_input_thread
,
psz_name
,
VLC_VAR_CHOICESCOUNT
,
&
val
,
NULL
);
vlc_object_release
(
p_input_thread
);
free
(
psz_name
);
...
...
lib/video.c
View file @
9f85beee
...
...
@@ -405,8 +405,8 @@ libvlc_track_description_t *
libvlc_video_get_chapter_description
(
libvlc_media_player_t
*
p_mi
,
int
i_title
)
{
char
psz_title
[
12
];
sprintf
(
psz_title
,
"title %2
i
"
,
i_title
);
char
psz_title
[
sizeof
(
"title "
)
+
3
*
sizeof
(
int
)
];
sprintf
(
psz_title
,
"title %2
u
"
,
i_title
);
return
libvlc_get_track_description
(
p_mi
,
psz_title
);
}
...
...
modules/gui/qt4/menus.cpp
View file @
9f85beee
...
...
@@ -1354,15 +1354,15 @@ void VLCMenuBar::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
#undef TEXT_OR_VAR
/** HACK for the navigation submenu:
* "title %2
i
" variables take the value 0 if not set
* "title %2
u
" variables take the value 0 if not set
*/
static
bool
CheckTitle
(
vlc_object_t
*
p_object
,
const
char
*
psz_var
)
{
int
i_title
=
0
;
if
(
sscanf
(
psz_var
,
"title %2
i
"
,
&
i_title
)
<=
0
)
unsigned
i_title
=
0
;
if
(
sscanf
(
psz_var
,
"title %2
u
"
,
&
i_title
)
<=
0
)
return
true
;
int
i_current_title
=
var_GetInteger
(
p_object
,
"title"
);
unsigned
i_current_title
=
var_GetInteger
(
p_object
,
"title"
);
return
(
i_title
==
i_current_title
);
}
...
...
src/input/event.c
View file @
9f85beee
...
...
@@ -149,9 +149,9 @@ void input_SendEventSeekpoint( input_thread_t *p_input, int i_title, int i_seekp
val
.
i_int
=
i_seekpoint
;
var_Change
(
p_input
,
"chapter"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
/* "title %2
i
" */
char
psz_title
[
10
];
s
nprintf
(
psz_title
,
sizeof
(
psz_title
),
"title %2i
"
,
i_title
);
/* "title %2
u
" */
char
psz_title
[
sizeof
(
"title "
)
+
3
*
sizeof
(
int
)
];
s
printf
(
psz_title
,
"title %2u
"
,
i_title
);
var_Change
(
p_input
,
psz_title
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
/* */
...
...
src/input/var.c
View file @
9f85beee
...
...
@@ -235,15 +235,14 @@ void input_ControlVarStop( input_thread_t *p_input )
if
(
p_input
->
p
->
i_title
>
0
)
{
char
name
[
sizeof
(
"title "
)
+
5
];
int
i
;
InputDelCallbacks
(
p_input
,
p_input_navigation_callbacks
);
InputDelCallbacks
(
p_input
,
p_input_title_callbacks
);
for
(
i
=
0
;
i
<
p_input
->
p
->
i_title
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
p_input
->
p
->
i_title
;
i
++
)
{
snprintf
(
name
,
sizeof
(
name
),
"title %2i"
,
i
);
char
name
[
sizeof
(
"title "
)
+
3
*
sizeof
(
int
)];
sprintf
(
name
,
"title %2u"
,
i
);
var_DelCallback
(
p_input
,
name
,
NavigationCallback
,
(
void
*
)(
intptr_t
)
i
);
}
}
...
...
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