Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
d3472830
Commit
d3472830
authored
Jan 31, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC media player: remove exceptions
parent
8d875234
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
103 additions
and
142 deletions
+103
-142
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+2
-2
src/control/audio.c
src/control/audio.c
+4
-4
src/control/media_list_player.c
src/control/media_list_player.c
+5
-5
src/control/media_player.c
src/control/media_player.c
+28
-37
src/control/media_player_internal.h
src/control/media_player_internal.h
+2
-3
src/control/mediacontrol_audio_video.c
src/control/mediacontrol_audio_video.c
+5
-13
src/control/mediacontrol_core.c
src/control/mediacontrol_core.c
+7
-36
src/control/mediacontrol_util.c
src/control/mediacontrol_util.c
+5
-13
src/control/video.c
src/control/video.c
+36
-17
test/libvlc/events.c
test/libvlc/events.c
+2
-2
test/libvlc/media_player.c
test/libvlc/media_player.c
+7
-10
No files found.
include/vlc/libvlc_media_player.h
View file @
d3472830
...
...
@@ -720,7 +720,7 @@ VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *, libvlc_exce
* \param p_mi media player
* \return the number of available video tracks (int)
*/
VLC_PUBLIC_API
int
libvlc_video_get_track_count
(
libvlc_media_player_t
*
,
libvlc_exceptio_t
*
);
VLC_PUBLIC_API
int
libvlc_video_get_track_count
(
libvlc_media_player_t
*
,
libvlc_exceptio
n
_t
*
);
/**
* Get the description of available video tracks.
...
...
@@ -730,7 +730,7 @@ VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *, libvlc
* \return list with description of available video tracks, or NULL on error
*/
VLC_PUBLIC_API
libvlc_track_description_t
*
libvlc_video_get_track_description
(
libvlc_media_player_t
*
);
libvlc_video_get_track_description
(
libvlc_media_player_t
*
,
libvlc_exception_t
*
);
/**
* Get current video track.
...
...
src/control/audio.c
View file @
d3472830
...
...
@@ -367,7 +367,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
int
libvlc_audio_get_track_count
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
int
i_track_count
;
if
(
!
p_input_thread
)
...
...
@@ -386,7 +386,7 @@ libvlc_track_description_t *
libvlc_audio_get_track_description
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
return
libvlc_get_track_description
(
p_mi
,
"audio-es"
,
p_e
);
return
libvlc_get_track_description
(
p_mi
,
"audio-es"
);
}
/*****************************************************************************
...
...
@@ -395,7 +395,7 @@ libvlc_track_description_t *
int
libvlc_audio_get_track
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
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
;
...
...
@@ -432,7 +432,7 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
void
libvlc_audio_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
newval
;
int
i_ret
=
-
1
;
...
...
src/control/media_list_player.c
View file @
d3472830
...
...
@@ -587,7 +587,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex
unlock
(
p_mlp
);
return
;
/* Will set to play */
}
libvlc_media_player_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_play
(
p_mlp
->
p_mi
);
unlock
(
p_mlp
);
}
...
...
@@ -603,7 +603,7 @@ void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp, libvlc_e
unlock
(
p_mlp
);
return
;
}
libvlc_media_player_pause
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_pause
(
p_mlp
->
p_mi
);
unlock
(
p_mlp
);
}
...
...
@@ -636,7 +636,7 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
{
lock
(
p_mlp
);
set_current_playing_item
(
p_mlp
,
libvlc_media_list_path_with_root_index
(
i_index
));
libvlc_media_player_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_play
(
p_mlp
->
p_mi
);
unlock
(
p_mlp
);
/* Send the next item event */
...
...
@@ -661,7 +661,7 @@ void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libv
}
set_current_playing_item
(
p_mlp
,
path
);
libvlc_media_player_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_play
(
p_mlp
->
p_mi
);
unlock
(
p_mlp
);
}
...
...
@@ -762,7 +762,7 @@ static void set_relative_playlist_position_and_play(
return
;
}
libvlc_media_player_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_play
(
p_mlp
->
p_mi
);
libvlc_media_list_unlock
(
p_mlp
->
p_mlist
);
...
...
src/control/media_player.c
View file @
d3472830
...
...
@@ -122,24 +122,16 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
*
* Function will lock the object.
*/
input_thread_t
*
libvlc_get_input_thread
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
input_thread_t
*
libvlc_get_input_thread
(
libvlc_media_player_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
;
if
(
!
p_mi
)
RAISENULL
(
"Media Instance is NULL"
);
assert
(
p_mi
);
lock
(
p_mi
);
if
(
!
p_mi
->
p_input_thread
)
{
unlock
(
p_mi
);
RAISENULL
(
"Input is NULL"
);
}
p_input_thread
=
p_mi
->
p_input_thread
;
vlc_object_hold
(
p_input_thread
);
if
(
p_input_thread
)
vlc_object_hold
(
p_input_thread
);
unlock
(
p_mi
);
return
p_input_thread
;
...
...
@@ -572,7 +564,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
{
input_thread_t
*
p_input_thread
;
if
(
(
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
))
)
if
(
(
p_input_thread
=
libvlc_get_input_thread
(
p_mi
))
)
{
/* A thread already exists, send it a play message */
input_Control
(
p_input_thread
,
INPUT_SET_STATE
,
PLAYING_S
);
...
...
@@ -622,7 +614,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
**************************************************************************/
void
libvlc_media_player_pause
(
libvlc_media_player_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -782,7 +774,7 @@ libvlc_time_t libvlc_media_player_get_length(
input_thread_t
*
p_input_thread
;
libvlc_time_t
i_time
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -797,7 +789,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
libvlc_time_t
i_time
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -811,7 +803,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -824,7 +816,7 @@ void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -837,7 +829,7 @@ float libvlc_media_player_get_position( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
float
f_position
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
.
0
;
...
...
@@ -852,7 +844,7 @@ void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi,
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -865,7 +857,7 @@ int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
int
i_chapter
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -880,7 +872,7 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -897,7 +889,7 @@ int libvlc_media_player_get_chapter_count_for_title(
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -919,7 +911,7 @@ void libvlc_media_player_set_title( libvlc_media_player_t *p_mi,
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -938,7 +930,7 @@ int libvlc_media_player_get_title( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
int
i_title
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -953,7 +945,7 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -967,7 +959,7 @@ void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi )
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -982,7 +974,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
...
...
@@ -995,7 +987,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
float
libvlc_media_player_get_fps
(
libvlc_media_player_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
double
f_fps
=
0
.
0
;
if
(
p_input_thread
)
...
...
@@ -1011,7 +1003,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
{
bool
b_will_play
;
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
false
;
...
...
@@ -1026,7 +1018,7 @@ int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
input_thread_t
*
p_input_thread
;
bool
b_can_rewind
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
-
1
;
...
...
@@ -1049,7 +1041,7 @@ float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi )
float
f_rate
;
bool
b_can_rewind
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
0
.
0
;
/* rate < 0 indicates rewind */
...
...
@@ -1079,7 +1071,7 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
bool
b_seekable
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
false
;
b_seekable
=
var_GetBool
(
p_input_thread
,
"can-seek"
);
...
...
@@ -1093,7 +1085,7 @@ libvlc_track_description_t *
libvlc_get_track_description
(
libvlc_media_player_t
*
p_mi
,
const
char
*
psz_variable
)
{
input_thread_t
*
p_input
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
input_thread_t
*
p_input
=
libvlc_get_input_thread
(
p_mi
);
libvlc_track_description_t
*
p_track_description
=
NULL
,
*
p_actual
,
*
p_previous
;
...
...
@@ -1125,7 +1117,6 @@ libvlc_track_description_t *
if
(
!
p_actual
)
{
libvlc_track_description_release
(
p_track_description
);
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
goto
end
;
}
...
...
@@ -1165,7 +1156,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi )
input_thread_t
*
p_input_thread
;
bool
b_can_pause
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
false
;
b_can_pause
=
var_GetBool
(
p_input_thread
,
"can-pause"
);
...
...
@@ -1176,7 +1167,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi )
void
libvlc_media_player_next_frame
(
libvlc_media_player_t
*
p_mi
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
NULL
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
p_input_thread
!=
NULL
)
{
var_TriggerCallback
(
p_input_thread
,
"frame-next"
);
...
...
src/control/media_player_internal.h
View file @
d3472830
...
...
@@ -49,12 +49,11 @@ struct libvlc_media_player_t
};
/* Media player - audio, video */
input_thread_t
*
libvlc_get_input_thread
(
libvlc_media_player_t
*
,
libvlc_exception_t
*
);
input_thread_t
*
libvlc_get_input_thread
(
libvlc_media_player_t
*
);
libvlc_track_description_t
*
libvlc_get_track_description
(
libvlc_media_player_t
*
p_mi
,
const
char
*
psz_variable
,
libvlc_exception_t
*
p_e
);
const
char
*
psz_variable
);
#endif
src/control/mediacontrol_audio_video.c
View file @
d3472830
...
...
@@ -60,7 +60,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
libvlc_exception_init
(
&
ex
);
mediacontrol_exception_init
(
exception
);
p_input
=
libvlc_get_input_thread
(
self
->
p_media_player
,
&
ex
);
p_input
=
libvlc_get_input_thread
(
self
->
p_media_player
);
if
(
!
p_input
)
{
RAISE_NULL
(
mediacontrol_InternalException
,
"No input"
);
...
...
@@ -140,7 +140,7 @@ mediacontrol_display_text( mediacontrol_Instance *self,
RAISE_VOID
(
mediacontrol_InternalException
,
"Empty text"
);
}
p_input
=
libvlc_get_input_thread
(
self
->
p_media_player
,
&
ex
);
p_input
=
libvlc_get_input_thread
(
self
->
p_media_player
);
if
(
!
p_input
)
{
RAISE_VOID
(
mediacontrol_InternalException
,
"No input"
);
...
...
@@ -240,16 +240,12 @@ int
mediacontrol_get_rate
(
mediacontrol_Instance
*
self
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
int
i_ret
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
i_ret
=
libvlc_media_player_get_rate
(
self
->
p_media_player
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_ZERO
(
&
ex
);
i_ret
=
libvlc_media_player_get_rate
(
self
->
p_media_player
);
return
i_ret
/
10
;
return
(
i_ret
>=
0
)
?
(
i_ret
/
10
)
:
-
1
;
}
void
...
...
@@ -257,13 +253,9 @@ mediacontrol_set_rate( mediacontrol_Instance *self,
const
int
rate
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_set_rate
(
self
->
p_media_player
,
rate
*
10
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_VOID
(
&
ex
);
libvlc_media_player_set_rate
(
self
->
p_media_player
,
rate
*
10
);
}
int
...
...
src/control/mediacontrol_core.c
View file @
d3472830
...
...
@@ -114,11 +114,9 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
mediacontrol_Exception
*
exception
)
{
mediacontrol_Position
*
retval
=
NULL
;
libvlc_exception_t
ex
;
int64_t
pos
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
retval
=
(
mediacontrol_Position
*
)
malloc
(
sizeof
(
mediacontrol_Position
)
);
retval
->
origin
=
an_origin
;
...
...
@@ -133,7 +131,7 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
}
/* We are asked for an AbsolutePosition. */
pos
=
libvlc_media_player_get_time
(
self
->
p_media_player
,
&
ex
);
pos
=
libvlc_media_player_get_time
(
self
->
p_media_player
);
if
(
a_key
==
mediacontrol_MediaTime
)
{
...
...
@@ -155,15 +153,12 @@ mediacontrol_set_media_position( mediacontrol_Instance *self,
const
mediacontrol_Position
*
a_position
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
int64_t
i_pos
;
libvlc_exception_init
(
&
ex
);
mediacontrol_exception_init
(
exception
);
i_pos
=
private_mediacontrol_position2microsecond
(
self
->
p_media_player
,
a_position
);
libvlc_media_player_set_time
(
self
->
p_media_player
,
i_pos
/
1000
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_VOID
(
&
ex
);
libvlc_media_player_set_time
(
self
->
p_media_player
,
i_pos
/
1000
);
}
/* Starts playing a stream */
...
...
@@ -221,8 +216,7 @@ mediacontrol_start( mediacontrol_Instance *self,
libvlc_media_player_set_media
(
self
->
p_media_player
,
p_media
);
libvlc_media_player_play
(
self
->
p_media_player
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_VOID
(
&
ex
);
libvlc_media_player_play
(
self
->
p_media_player
);
}
}
...
...
@@ -230,34 +224,23 @@ void
mediacontrol_pause
(
mediacontrol_Instance
*
self
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_pause
(
self
->
p_media_player
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_VOID
(
&
ex
);
libvlc_media_player_pause
(
self
->
p_media_player
);
}
void
mediacontrol_resume
(
mediacontrol_Instance
*
self
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_pause
(
self
->
p_media_player
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_VOID
(
&
ex
);
libvlc_media_player_pause
(
self
->
p_media_player
);
}
void
mediacontrol_stop
(
mediacontrol_Instance
*
self
,
mediacontrol_Exception
*
exception
)
{
libvlc_exception_t
ex
;
mediacontrol_exception_init
(
exception
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_stop
(
self
->
p_media_player
);
}
...
...
@@ -379,20 +362,8 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
retval
->
url
=
libvlc_media_get_mrl
(
p_media
);
retval
->
position
=
libvlc_media_player_get_time
(
self
->
p_media_player
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
libvlc_exception_clear
(
&
ex
);
retval
->
position
=
0
;
}
retval
->
length
=
libvlc_media_player_get_length
(
self
->
p_media_player
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
libvlc_exception_clear
(
&
ex
);
retval
->
length
=
0
;
}
retval
->
position
=
libvlc_media_player_get_time
(
self
->
p_media_player
);
retval
->
length
=
libvlc_media_player_get_length
(
self
->
p_media_player
);
}
return
retval
;
}
src/control/mediacontrol_util.c
View file @
d3472830
...
...
@@ -66,10 +66,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
if
(
to
==
mediacontrol_SampleCount
)
{
double
f_fps
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
f_fps
=
libvlc_media_player_get_rate
(
p_media_player
,
&
ex
);
f_fps
=
libvlc_media_player_get_rate
(
p_media_player
);
if
(
f_fps
<
0
)
return
0
;
else
...
...
@@ -82,10 +80,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
case
mediacontrol_SampleCount
:
{
double
f_fps
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
f_fps
=
libvlc_media_player_get_rate
(
p_media_player
,
&
ex
);
f_fps
=
libvlc_media_player_get_rate
(
p_media_player
);
if
(
f_fps
<
0
)
return
0
;
...
...
@@ -129,10 +125,8 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
{
libvlc_time_t
l_time
=
0
;
libvlc_time_t
l_pos
=
0
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
l_time
=
libvlc_media_player_get_time
(
p_media_player
,
&
ex
);
l_time
=
libvlc_media_player_get_time
(
p_media_player
);
/* Ignore exception, we will assume a 0 time value */
l_pos
=
private_mediacontrol_unit_convert
(
p_media_player
,
...
...
@@ -147,14 +141,12 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
libvlc_time_t
l_time
=
0
;
libvlc_time_t
l_length
=
0
;
libvlc_time_t
l_pos
=
0
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
l_length
=
libvlc_media_player_get_length
(
p_media_player
,
&
ex
);
l_length
=
libvlc_media_player_get_length
(
p_media_player
);
if
(
l_length
<=
0
)
return
0
;
l_time
=
libvlc_media_player_get_time
(
p_media_player
,
&
ex
);
l_time
=
libvlc_media_player_get_time
(
p_media_player
);
/* Ignore exception, we will assume a 0 time value */
l_pos
=
private_mediacontrol_unit_convert
(
p_media_player
,
...
...
src/control/video.c
View file @
d3472830
...
...
@@ -47,7 +47,7 @@
static
vout_thread_t
*
GetVout
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_exception
)
{
input_thread_t
*
p_input
=
libvlc_get_input_thread
(
p_mi
,
p_exception
);
input_thread_t
*
p_input
=
libvlc_get_input_thread
(
p_mi
);
vout_thread_t
*
p_vout
=
NULL
;
if
(
p_input
)
...
...
@@ -60,6 +60,11 @@ static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
}
vlc_object_release
(
p_input
);
}
else
{
libvlc_exception_raise
(
p_exception
);
libvlc_printerr
(
"No active input"
);
}
return
p_vout
;
}
...
...
@@ -185,7 +190,7 @@ int libvlc_video_get_width( libvlc_media_player_t *p_mi,
int
libvlc_media_player_has_vout
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
bool
has_vout
=
false
;
if
(
p_input_thread
)
...
...
@@ -263,14 +268,19 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
int
libvlc_video_get_spu
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
val
;
int
i_spu
=
-
1
;
int
i_ret
=
-
1
;
int
i
;
if
(
!
p_input_thread
)
return
-
1
;
if
(
!
p_input_thread
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"No active input"
);
return
-
1
;
}
i_ret
=
var_Get
(
p_input_thread
,
"spu-es"
,
&
val
);
if
(
i_ret
<
0
)
...
...
@@ -298,11 +308,15 @@ int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
int
libvlc_video_get_spu_count
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
int
i_spu_count
;
if
(
!
p_input_thread
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"No active input"
);
return
-
1
;
}
i_spu_count
=
var_CountChoices
(
p_input_thread
,
"spu-es"
);
...
...
@@ -314,18 +328,23 @@ libvlc_track_description_t *
libvlc_video_get_spu_description
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
return
libvlc_get_track_description
(
p_mi
,
"spu-es"
,
p_e
);
return
libvlc_get_track_description
(
p_mi
,
"spu-es"
);
}
void
libvlc_video_set_spu
(
libvlc_media_player_t
*
p_mi
,
int
i_spu
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
vlc_value_t
newval
;
int
i_ret
=
-
1
;
if
(
!
p_input_thread
)
return
;
if
(
!
p_input_thread
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"No active input"
);
return
;
}
var_Change
(
p_input_thread
,
"spu-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
...
...
@@ -354,7 +373,7 @@ int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
const
char
*
psz_subtitle
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
bool
b_ret
=
false
;
if
(
p_input_thread
)
...
...
@@ -370,7 +389,7 @@ libvlc_track_description_t *
libvlc_video_get_title_description
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
return
libvlc_get_track_description
(
p_mi
,
"title"
,
p_e
);
return
libvlc_get_track_description
(
p_mi
,
"title"
);
}
libvlc_track_description_t
*
...
...
@@ -380,7 +399,7 @@ libvlc_track_description_t *
{
char
psz_title
[
12
];
sprintf
(
psz_title
,
"title %2i"
,
i_title
);
return
libvlc_get_track_description
(
p_mi
,
psz_title
,
p_e
);
return
libvlc_get_track_description
(
p_mi
,
psz_title
);
}
char
*
libvlc_video_get_crop_geometry
(
libvlc_media_player_t
*
p_mi
,
...
...
@@ -419,7 +438,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
{
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
if
(
!
p_input_thread
)
return
;
if
(
var_CountChoices
(
p_input_thread
,
"teletext-es"
)
<=
0
)
...
...
@@ -449,7 +468,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
int
libvlc_video_get_track_count
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
int
i_track_count
;
if
(
!
p_input_thread
)
...
...
@@ -465,13 +484,13 @@ libvlc_track_description_t *
libvlc_video_get_track_description
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
return
libvlc_get_track_description
(
p_mi
,
"video-es"
,
p_e
);
return
libvlc_get_track_description
(
p_mi
,
"video-es"
);
}
int
libvlc_video_get_track
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
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
;
...
...
@@ -487,7 +506,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Video track information not found"
);
vlc_object_release
(
p_input_thread
);
return
i_ret
;
return
-
1
;
}
var_Change
(
p_input_thread
,
"video-es"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
NULL
);
...
...
@@ -507,7 +526,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
void
libvlc_video_set_track
(
libvlc_media_player_t
*
p_mi
,
int
i_track
,
libvlc_exception_t
*
p_e
)
{
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_mi
);
vlc_value_t
val_list
;
int
i_ret
=
-
1
;
int
i
;
...
...
test/libvlc/events.c
View file @
d3472830
...
...
@@ -78,8 +78,8 @@ static void test_events (const char ** argv, int argc)
vlc
=
libvlc_new
(
argc
,
argv
,
&
ex
);
catch
();
mi
=
libvlc_media_player_new
(
vlc
,
&
ex
);
catch
(
);
mi
=
libvlc_media_player_new
(
vlc
);
assert
(
mi
!=
NULL
);
em
=
libvlc_media_player_event_manager
(
mi
);
...
...
test/libvlc/media_player.c
View file @
d3472830
...
...
@@ -39,13 +39,12 @@ static void test_media_player_play_stop(const char** argv, int argc)
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
mi
=
libvlc_media_player_new_from_media
(
md
,
&
ex
);
catch
(
);
mi
=
libvlc_media_player_new_from_media
(
md
);
assert
(
mi
!=
NULL
);
libvlc_media_release
(
md
);
libvlc_media_player_play
(
mi
,
&
ex
);
catch
();
libvlc_media_player_play
(
mi
);
/* Wait a correct state */
libvlc_state_t
state
;
...
...
@@ -78,13 +77,12 @@ static void test_media_player_pause_stop(const char** argv, int argc)
md
=
libvlc_media_new
(
vlc
,
file
,
&
ex
);
catch
();
mi
=
libvlc_media_player_new_from_media
(
md
,
&
ex
);
catch
(
);
mi
=
libvlc_media_player_new_from_media
(
md
);
assert
(
mi
!=
NULL
);
libvlc_media_release
(
md
);
libvlc_media_player_play
(
mi
,
&
ex
);
catch
();
libvlc_media_player_play
(
mi
);
log
(
"Waiting for playing
\n
"
);
...
...
@@ -102,8 +100,7 @@ static void test_media_player_pause_stop(const char** argv, int argc)
#if 0
/* This can't work because under some condition (short file, this is the case) this will be
* equivalent to a play() */
libvlc_media_player_pause (mi, &ex);
catch();
libvlc_media_player_pause (mi);
log ("Waiting for pause\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