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
2c5ee170
Commit
2c5ee170
authored
Nov 08, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: correct and uniformize audio/video track IDs (fixes #7645)
parent
0b1cc788
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
65 deletions
+18
-65
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+4
-4
lib/audio.c
lib/audio.c
+11
-39
lib/video.c
lib/video.c
+3
-22
No files found.
include/vlc/libvlc_media_player.h
View file @
2c5ee170
...
@@ -1154,7 +1154,7 @@ LIBVLC_API libvlc_track_description_t *
...
@@ -1154,7 +1154,7 @@ LIBVLC_API libvlc_track_description_t *
* Get current video track.
* Get current video track.
*
*
* \param p_mi media player
* \param p_mi media player
* \return the video track
(int) or -1 if none
* \return the video track
ID (int) or -1 if no active input
*/
*/
LIBVLC_API
int
libvlc_video_get_track
(
libvlc_media_player_t
*
p_mi
);
LIBVLC_API
int
libvlc_video_get_track
(
libvlc_media_player_t
*
p_mi
);
...
@@ -1162,7 +1162,7 @@ LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
...
@@ -1162,7 +1162,7 @@ LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
* Set video track.
* Set video track.
*
*
* \param p_mi media player
* \param p_mi media player
* \param i_track the track
(int
)
* \param i_track the track
ID (i_id field from track description
)
* \return 0 on success, -1 if out of range
* \return 0 on success, -1 if out of range
*/
*/
LIBVLC_API
LIBVLC_API
...
@@ -1577,7 +1577,7 @@ LIBVLC_API libvlc_track_description_t *
...
@@ -1577,7 +1577,7 @@ LIBVLC_API libvlc_track_description_t *
* Get current audio track.
* Get current audio track.
*
*
* \param p_mi media player
* \param p_mi media player
* \return the audio track
(int), or -1 if none
.
* \return the audio track
ID or -1 if no active input
.
*/
*/
LIBVLC_API
int
libvlc_audio_get_track
(
libvlc_media_player_t
*
p_mi
);
LIBVLC_API
int
libvlc_audio_get_track
(
libvlc_media_player_t
*
p_mi
);
...
@@ -1585,7 +1585,7 @@ LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
...
@@ -1585,7 +1585,7 @@ LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
* Set current audio track.
* Set current audio track.
*
*
* \param p_mi media player
* \param p_mi media player
* \param i_track the track
(int
)
* \param i_track the track
ID (i_id field from track description
)
* \return 0 on success, -1 on error
* \return 0 on success, -1 on error
*/
*/
LIBVLC_API
int
libvlc_audio_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
);
LIBVLC_API
int
libvlc_audio_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
);
...
...
lib/audio.c
View file @
2c5ee170
...
@@ -341,33 +341,12 @@ libvlc_track_description_t *
...
@@ -341,33 +341,12 @@ libvlc_track_description_t *
int
libvlc_audio_get_track
(
libvlc_media_player_t
*
p_mi
)
int
libvlc_audio_get_track
(
libvlc_media_player_t
*
p_mi
)
{
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
val
;
int
i_track
=
-
1
;
int
i
;
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
-
1
;
return
-
1
;
if
(
var_Get
(
p_input_thread
,
"audio-es"
,
&
val
)
<
0
)
int
id
=
var_GetInteger
(
p_input_thread
,
"audio-es"
);
{
vlc_object_release
(
p_input_thread
);
libvlc_printerr
(
"Audio track information not found"
);
return
-
1
;
}
var_Change
(
p_input_thread
,
"audio-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
for
(
i
=
0
;
i
<
val_list
.
p_list
->
i_count
;
i
++
)
{
if
(
val_list
.
p_list
->
p_values
[
i
].
i_int
==
val
.
i_int
)
{
i_track
=
i
;
break
;
}
}
var_FreeList
(
&
val_list
,
NULL
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
i
_track
;
return
i
d
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -377,30 +356,23 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
...
@@ -377,30 +356,23 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
{
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
val_list
;
vlc_value_t
newval
;
int
i_ret
;
int
i_ret
;
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
-
1
;
return
-
1
;
var_Change
(
p_input_thread
,
"audio-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
var_Change
(
p_input_thread
,
"audio-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
if
(
(
i_track
<
0
)
||
(
i_track
>
val_list
.
p_list
->
i_count
)
)
for
(
int
i
=
0
;
i
<
val_list
.
p_list
->
i_count
;
i
++
)
{
{
libvlc_printerr
(
"Audio track out of range"
);
if
(
i_track
==
val_list
.
p_list
->
p_values
[
i
].
i_int
)
i_ret
=
-
1
;
goto
end
;
}
newval
=
val_list
.
p_list
->
p_values
[
i_track
];
i_ret
=
var_Set
(
p_input_thread
,
"audio-es"
,
newval
);
if
(
i_ret
<
0
)
{
{
libvlc_printerr
(
"Audio track out of range"
);
/* Race... */
if
(
var_SetInteger
(
p_input_thread
,
"audio-es"
,
i_track
)
<
0
)
i_ret
=
-
1
;
break
;
i_ret
=
0
;
goto
end
;
goto
end
;
}
}
i_ret
=
0
;
}
libvlc_printerr
(
"Track identifier not found"
);
end:
end:
var_FreeList
(
&
val_list
,
NULL
);
var_FreeList
(
&
val_list
,
NULL
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
...
lib/video.c
View file @
2c5ee170
...
@@ -549,32 +549,13 @@ libvlc_track_description_t *
...
@@ -549,32 +549,13 @@ libvlc_track_description_t *
int
libvlc_video_get_track
(
libvlc_media_player_t
*
p_mi
)
int
libvlc_video_get_track
(
libvlc_media_player_t
*
p_mi
)
{
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
val
;
int
i_track
=
-
1
;
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
-
1
;
return
-
1
;
if
(
var_Get
(
p_input_thread
,
"video-es"
,
&
val
)
<
0
)
int
id
=
var_GetInteger
(
p_input_thread
,
"video-es"
);
{
libvlc_printerr
(
"Video track information not found"
);
vlc_object_release
(
p_input_thread
);
return
-
1
;
}
var_Change
(
p_input_thread
,
"video-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
for
(
int
i
=
0
;
i
<
val_list
.
p_list
->
i_count
;
i
++
)
{
if
(
val_list
.
p_list
->
p_values
[
i
].
i_int
==
val
.
i_int
)
{
i_track
=
i
;
break
;
}
}
var_FreeList
(
&
val_list
,
NULL
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
i
_track
;
return
i
d
;
}
}
int
libvlc_video_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
)
int
libvlc_video_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
)
...
@@ -597,7 +578,7 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
...
@@ -597,7 +578,7 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
goto
end
;
goto
end
;
}
}
}
}
libvlc_printerr
(
"
Video track number out of range
"
);
libvlc_printerr
(
"
Track identifier not found
"
);
end:
end:
var_FreeList
(
&
val_list
,
NULL
);
var_FreeList
(
&
val_list
,
NULL
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
...
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