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
44de0248
Commit
44de0248
authored
Aug 01, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/control: a bit of cleanup here and there
parent
5d09f600
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
174 deletions
+106
-174
include/libvlc_internal.h
include/libvlc_internal.h
+3
-0
include/vlc/libvlc.h
include/vlc/libvlc.h
+20
-23
src/control/audio.c
src/control/audio.c
+10
-20
src/control/core.c
src/control/core.c
+9
-22
src/control/input.c
src/control/input.c
+32
-62
src/control/playlist.c
src/control/playlist.c
+32
-47
No files found.
include/libvlc_internal.h
View file @
44de0248
...
@@ -50,6 +50,9 @@ struct libvlc_input_t
...
@@ -50,6 +50,9 @@ struct libvlc_input_t
struct
libvlc_instance_t
*
p_instance
;
///< Parent instance
struct
libvlc_instance_t
*
p_instance
;
///< Parent instance
};
};
#define RAISENULL( psz ) { libvlc_exception_raise( p_e, psz ); return NULL; }
#define RAISEVOID( psz ) { libvlc_exception_raise( p_e, psz ); return; }
#define RAISEZERO( psz ) { libvlc_exception_raise( p_e, psz ); return 0; }
# ifdef __cplusplus
# ifdef __cplusplus
}
}
...
...
include/vlc/libvlc.h
View file @
44de0248
...
@@ -114,8 +114,10 @@ typedef struct libvlc_instance_t libvlc_instance_t;
...
@@ -114,8 +114,10 @@ typedef struct libvlc_instance_t libvlc_instance_t;
libvlc_instance_t
*
libvlc_new
(
int
,
char
**
,
libvlc_exception_t
*
);
libvlc_instance_t
*
libvlc_new
(
int
,
char
**
,
libvlc_exception_t
*
);
/**
/**
* returns a libvlc instance identifier for legacy APIs
* Returns a libvlc instance identifier for legacy APIs. Use of this
* \param p_instance the instance to destroy
* function is discouraged, you should convert your program to use the
* new API.
* \param p_instance the instance
*/
*/
int
libvlc_get_vlc_id
(
libvlc_instance_t
*
p_instance
);
int
libvlc_get_vlc_id
(
libvlc_instance_t
*
p_instance
);
...
@@ -200,20 +202,6 @@ void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
...
@@ -200,20 +202,6 @@ void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
*/
*/
void
libvlc_playlist_clear
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
void
libvlc_playlist_clear
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
/**
* Go to next playlist item
* \param p_instance the instance
* \param p_exception an initialized exception
*/
void
libvlc_playlist_next
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
/**
* Go to Previous playlist item
* \param p_instance the instance
* \param p_exception an initialized exception
*/
void
libvlc_playlist_prev
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
/**
/**
* Add an item at the end of the playlist
* Add an item at the end of the playlist
* If you need more advanced options, \see libvlc_playlist_add_extended
* If you need more advanced options, \see libvlc_playlist_add_extended
...
@@ -232,13 +220,20 @@ int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
...
@@ -232,13 +220,20 @@ int libvlc_playlist_add( libvlc_instance_t *, const char *, const char *,
* \param psz_name a name that you might want to give or NULL
* \param psz_name a name that you might want to give or NULL
* \param i_options the number of options to add
* \param i_options the number of options to add
* \param ppsz_options strings representing the options to add
* \param ppsz_options strings representing the options to add
* \param p_exception an initialized exception
* \return the identifier of the new item
* \return the identifier of the new item
*/
*/
int
libvlc_playlist_add_extended
(
libvlc_instance_t
*
,
const
char
*
,
int
libvlc_playlist_add_extended
(
libvlc_instance_t
*
,
const
char
*
,
const
char
*
,
int
,
const
char
**
,
const
char
*
,
int
,
const
char
**
,
libvlc_exception_t
*
);
libvlc_exception_t
*
);
/**
* Delete the playlist item with the given ID.
* \param p_instance the instance
* \param i_id the id to remove
* \param p_exception an initialized exception
* \return
*/
int
libvlc_playlist_delete_item
(
libvlc_instance_t
*
,
int
,
int
libvlc_playlist_delete_item
(
libvlc_instance_t
*
,
int
,
libvlc_exception_t
*
);
libvlc_exception_t
*
);
...
@@ -252,8 +247,6 @@ typedef struct libvlc_input_t libvlc_input_t;
...
@@ -252,8 +247,6 @@ typedef struct libvlc_input_t libvlc_input_t;
libvlc_input_t
*
libvlc_playlist_get_input
(
libvlc_instance_t
*
,
libvlc_input_t
*
libvlc_playlist_get_input
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
libvlc_exception_t
*
);
/** @}*/
/** @}*/
/*****************************************************************************
/*****************************************************************************
...
@@ -277,8 +270,6 @@ void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_
...
@@ -277,8 +270,6 @@ void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_
float
libvlc_input_get_position
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
float
libvlc_input_get_position
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
void
libvlc_input_set_position
(
libvlc_input_t
*
,
float
,
libvlc_exception_t
*
);
void
libvlc_input_set_position
(
libvlc_input_t
*
,
float
,
libvlc_exception_t
*
);
vlc_bool_t
libvlc_input_will_play
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
vlc_bool_t
libvlc_input_will_play
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
vlc_bool_t
libvlc_input_has_vout
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
float
libvlc_input_get_fps
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
/** @} */
/** @} */
...
@@ -288,6 +279,14 @@ float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *
...
@@ -288,6 +279,14 @@ float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *
* @{
* @{
*/
*/
/**
* Does this input have a video output ?
* \param p_input the input
* \param p_exception an initialized exception
*/
vlc_bool_t
libvlc_input_has_vout
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
float
libvlc_input_get_fps
(
libvlc_input_t
*
,
libvlc_exception_t
*
);
/**
/**
* Toggle fullscreen status on video output
* Toggle fullscreen status on video output
* \param p_input the input
* \param p_input the input
...
@@ -474,8 +473,6 @@ void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
...
@@ -474,8 +473,6 @@ void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
void
libvlc_vlm_set_input
(
libvlc_instance_t
*
,
char
*
,
char
*
,
void
libvlc_vlm_set_input
(
libvlc_instance_t
*
,
char
*
,
char
*
,
libvlc_exception_t
*
);
libvlc_exception_t
*
);
/**
/**
* Set output for a media
* Set output for a media
* \param p_instance the instance
* \param p_instance the instance
...
...
src/control/audio.c
View file @
44de0248
...
@@ -31,59 +31,49 @@
...
@@ -31,59 +31,49 @@
* libvlc_audio_get_mute : Get the volume state, true if muted
* libvlc_audio_get_mute : Get the volume state, true if muted
*****************************************************************************/
*****************************************************************************/
void
libvlc_audio_toggle_mute
(
libvlc_instance_t
*
p_instance
,
void
libvlc_audio_toggle_mute
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
}
}
vlc_bool_t
libvlc_audio_get_mute
(
libvlc_instance_t
*
p_instance
,
vlc_bool_t
libvlc_audio_get_mute
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
/*
/*
* If the volume level is 0, then the channel is muted
* If the volume level is 0, then the channel is muted
*/
*/
audio_volume_t
i_volume
;
audio_volume_t
i_volume
;
i_volume
=
libvlc_audio_get_volume
(
p_instance
,
p_e
xception
);
i_volume
=
libvlc_audio_get_volume
(
p_instance
,
p_e
);
if
(
i_volume
==
0
)
if
(
i_volume
==
0
)
return
VLC_TRUE
;
return
VLC_TRUE
;
return
VLC_FALSE
;
return
VLC_FALSE
;
}
}
void
libvlc_audio_set_mute
(
libvlc_instance_t
*
p_instance
,
vlc_bool_t
status
,
void
libvlc_audio_set_mute
(
libvlc_instance_t
*
p_instance
,
vlc_bool_t
status
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
if
(
status
)
if
(
status
)
{
{
/*
/* Check if the volume is already muted */
* Check if the volume is already muted
if
(
!
libvlc_audio_get_volume
(
p_instance
,
p_e
)
)
*/
if
(
!
libvlc_audio_get_volume
(
p_instance
,
p_exception
)
)
{
{
return
;
return
;
}
}
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
return
;
}
}
else
else
{
{
/*
/* the aout_VolumeMute is a toggle function, so this is enough. */
* the aout_VolumeMute is a toggle function, so this is enough.
*/
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
aout_VolumeMute
(
p_instance
->
p_vlc
,
NULL
);
return
;
}
}
}
}
/*****************************************************************************
/*****************************************************************************
* libvlc_audio_get_volume : Get the current volume (range 0-200 %)
* libvlc_audio_get_volume : Get the current volume (range 0-200 %)
*****************************************************************************/
*****************************************************************************/
int
libvlc_audio_get_volume
(
libvlc_instance_t
*
p_instance
,
int
libvlc_audio_get_volume
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
audio_volume_t
i_volume
;
audio_volume_t
i_volume
;
...
@@ -97,7 +87,7 @@ int libvlc_audio_get_volume( libvlc_instance_t *p_instance,
...
@@ -97,7 +87,7 @@ int libvlc_audio_get_volume( libvlc_instance_t *p_instance,
* libvlc_audio_set_volume : Set the current volume
* libvlc_audio_set_volume : Set the current volume
*****************************************************************************/
*****************************************************************************/
void
libvlc_audio_set_volume
(
libvlc_instance_t
*
p_instance
,
int
i_volume
,
void
libvlc_audio_set_volume
(
libvlc_instance_t
*
p_instance
,
int
i_volume
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
if
(
i_volume
>=
0
&&
i_volume
<=
200
)
if
(
i_volume
>=
0
&&
i_volume
<=
200
)
{
{
...
@@ -106,7 +96,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
...
@@ -106,7 +96,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
}
}
else
else
{
{
libvlc_exception_raise
(
p_e
xception
,
"Volume out of range"
);
libvlc_exception_raise
(
p_e
,
"Volume out of range"
);
}
}
}
}
src/control/core.c
View file @
44de0248
...
@@ -63,8 +63,7 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
...
@@ -63,8 +63,7 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
va_list
args
;
va_list
args
;
/* does caller care about exceptions ? */
/* does caller care about exceptions ? */
if
(
p_exception
==
NULL
)
if
(
p_exception
==
NULL
)
return
;
return
;
/* remove previous exception if it wasn't cleared */
/* remove previous exception if it wasn't cleared */
if
(
p_exception
->
b_raised
&&
p_exception
->
psz_message
)
if
(
p_exception
->
b_raised
&&
p_exception
->
psz_message
)
...
@@ -81,7 +80,7 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
...
@@ -81,7 +80,7 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
}
}
libvlc_instance_t
*
libvlc_new
(
int
argc
,
char
**
argv
,
libvlc_instance_t
*
libvlc_new
(
int
argc
,
char
**
argv
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
int
i_vlc_id
;
int
i_vlc_id
;
libvlc_instance_t
*
p_new
;
libvlc_instance_t
*
p_new
;
...
@@ -90,21 +89,14 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
...
@@ -90,21 +89,14 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
i_vlc_id
=
VLC_Create
();
i_vlc_id
=
VLC_Create
();
p_vlc
=
(
vlc_t
*
)
vlc_current_object
(
i_vlc_id
);
p_vlc
=
(
vlc_t
*
)
vlc_current_object
(
i_vlc_id
);
if
(
!
p_vlc
)
if
(
!
p_vlc
)
RAISENULL
(
"VLC initialization failed"
);
{
libvlc_exception_raise
(
p_exception
,
"VLC initialization failed"
);
return
NULL
;
}
p_new
=
(
libvlc_instance_t
*
)
malloc
(
sizeof
(
libvlc_instance_t
)
);
p_new
=
(
libvlc_instance_t
*
)
malloc
(
sizeof
(
libvlc_instance_t
)
);
if
(
!
p_new
)
RAISENULL
(
"Out of memory"
);
/** \todo Look for interface settings. If we don't have any, add -I dummy */
/** \todo Look for interface settings. If we don't have any, add -I dummy */
/* Because we probably don't want a GUI by default */
/* Because we probably don't want a GUI by default */
if
(
!
p_new
)
{
libvlc_exception_raise
(
p_exception
,
"Out of memory"
);
return
NULL
;
}
VLC_Init
(
i_vlc_id
,
argc
,
argv
);
VLC_Init
(
i_vlc_id
,
argc
,
argv
);
...
@@ -113,13 +105,9 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
...
@@ -113,13 +105,9 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
VLC_OBJECT_PLAYLIST
,
FIND_CHILD
);
VLC_OBJECT_PLAYLIST
,
FIND_CHILD
);
p_new
->
p_vlm
=
NULL
;
p_new
->
p_vlm
=
NULL
;
if
(
!
p_new
->
p_playlist
)
if
(
!
p_new
->
p_playlist
)
RAISENULL
(
"Playlist creation failed"
);
{
libvlc_exception_raise
(
p_exception
,
"Playlist creation failed"
);
return
NULL
;
}
p_new
->
i_vlc_id
=
i_vlc_id
;
p_new
->
i_vlc_id
=
i_vlc_id
;
return
p_new
;
return
p_new
;
}
}
...
@@ -136,4 +124,3 @@ int libvlc_get_vlc_id( libvlc_instance_t *p_instance )
...
@@ -136,4 +124,3 @@ int libvlc_get_vlc_id( libvlc_instance_t *p_instance )
{
{
return
p_instance
->
i_vlc_id
;
return
p_instance
->
i_vlc_id
;
}
}
src/control/input.c
View file @
44de0248
...
@@ -29,8 +29,7 @@
...
@@ -29,8 +29,7 @@
void
libvlc_input_free
(
libvlc_input_t
*
p_input
)
void
libvlc_input_free
(
libvlc_input_t
*
p_input
)
{
{
if
(
p_input
)
if
(
p_input
)
free
(
p_input
);
free
(
p_input
);
}
}
/*
/*
...
@@ -42,20 +41,12 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
...
@@ -42,20 +41,12 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
if
(
!
p_input
)
if
(
!
p_input
)
RAISENULL
(
"Input is NULL"
);
{
libvlc_exception_raise
(
p_e
,
"Input is NULL"
);
return
NULL
;
}
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_input_thread
=
(
input_thread_t
*
)
vlc_object_get
(
p_input
->
p_instance
->
p_vlc
,
p_input
->
p_instance
->
p_vlc
,
p_input
->
i_input_id
);
p_input
->
i_input_id
);
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
RAISENULL
(
"Input does not exist"
);
{
libvlc_exception_raise
(
p_e
,
"Input does not exist"
);
return
NULL
;
}
return
p_input_thread
;
return
p_input_thread
;
}
}
...
@@ -66,15 +57,13 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
...
@@ -66,15 +57,13 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
* Getters for stream information
* Getters for stream information
**************************************************************************/
**************************************************************************/
vlc_int64_t
libvlc_input_get_length
(
libvlc_input_t
*
p_input
,
vlc_int64_t
libvlc_input_get_length
(
libvlc_input_t
*
p_input
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
-
1
.
0
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
-
1
.
0
;
var_Get
(
p_input_thread
,
"length"
,
&
val
);
var_Get
(
p_input_thread
,
"length"
,
&
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
@@ -83,72 +72,55 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
...
@@ -83,72 +72,55 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
}
}
vlc_int64_t
libvlc_input_get_time
(
libvlc_input_t
*
p_input
,
vlc_int64_t
libvlc_input_get_time
(
libvlc_input_t
*
p_input
,
libvlc_exception_t
*
p_exception
)
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
-
1
.
0
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
-
1
.
0
;
var_Get
(
p_input_thread
,
"time"
,
&
val
);
var_Get
(
p_input_thread
,
"time"
,
&
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
val
.
i_time
/
1000
;
return
val
.
i_time
/
1000
;
}
}
void
libvlc_input_set_time
(
libvlc_input_t
*
p_input
,
vlc_int64_t
time
,
libvlc_exception_t
*
p_exception
)
void
libvlc_input_set_time
(
libvlc_input_t
*
p_input
,
vlc_int64_t
time
,
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
value
;
vlc_value_t
value
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
;
value
.
i_time
=
time
;
value
.
i_time
=
time
;
var_Set
(
p_input_thread
,
"time"
,
value
);
var_Set
(
p_input_thread
,
"time"
,
value
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
;
}
}
void
libvlc_input_set_position
(
libvlc_input_t
*
p_input
,
float
position
,
libvlc_exception_t
*
p_exception
)
void
libvlc_input_set_position
(
libvlc_input_t
*
p_input
,
float
position
,
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
val
.
f_float
=
position
;
val
.
f_float
=
position
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
;
var_Set
(
p_input_thread
,
"position"
,
val
);
var_Set
(
p_input_thread
,
"position"
,
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
;
}
}
float
libvlc_input_get_position
(
libvlc_input_t
*
p_input
,
float
libvlc_input_get_position
(
libvlc_input_t
*
p_input
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
-
1
.
0
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
-
1
.
0
;
var_Get
(
p_input_thread
,
"position"
,
&
val
);
var_Get
(
p_input_thread
,
"position"
,
&
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
@@ -157,17 +129,19 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
...
@@ -157,17 +129,19 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
}
}
float
libvlc_input_get_fps
(
libvlc_input_t
*
p_input
,
float
libvlc_input_get_fps
(
libvlc_input_t
*
p_input
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
double
f_fps
;
double
f_fps
;
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
0
.
0
;
if
(
demux2_Control
(
p_input_thread
->
input
.
p_demux
,
DEMUX_GET_FPS
,
&
f_fps
)
||
f_fps
<
0
.
1
)
if
(
demux2_Control
(
p_input_thread
->
input
.
p_demux
,
DEMUX_GET_FPS
,
&
f_fps
)
||
f_fps
<
0
.
1
)
{
{
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
0
;
return
0
.
0
;
}
}
else
else
{
{
...
@@ -177,21 +151,17 @@ float libvlc_input_get_fps( libvlc_input_t *p_input,
...
@@ -177,21 +151,17 @@ float libvlc_input_get_fps( libvlc_input_t *p_input,
}
}
vlc_bool_t
libvlc_input_will_play
(
libvlc_input_t
*
p_input
,
vlc_bool_t
libvlc_input_will_play
(
libvlc_input_t
*
p_input
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_exception
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
VLC_FALSE
;
if
(
libvlc_exception_raised
(
p_exception
)
)
return
VLC_FALSE
;
if
(
!
p_input_thread
->
b_die
&&
!
p_input_thread
->
b_dead
)
if
(
!
p_input_thread
->
b_die
&&
!
p_input_thread
->
b_dead
)
{
{
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
VLC_TRUE
;
return
VLC_TRUE
;
}
}
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
VLC_FALSE
;
return
VLC_FALSE
;
}
}
src/control/playlist.c
View file @
44de0248
...
@@ -28,24 +28,18 @@
...
@@ -28,24 +28,18 @@
void
libvlc_playlist_play
(
libvlc_instance_t
*
p_instance
,
int
i_id
,
void
libvlc_playlist_play
(
libvlc_instance_t
*
p_instance
,
int
i_id
,
int
i_options
,
char
**
ppsz_options
,
int
i_options
,
char
**
ppsz_options
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
///\todo Handle additionnal options
///\todo Handle additionnal options
if
(
p_instance
->
p_playlist
->
i_size
==
0
)
if
(
p_instance
->
p_playlist
->
i_size
==
0
)
RAISEVOID
(
"Empty playlist"
);
{
libvlc_exception_raise
(
p_exception
,
"Empty playlist"
);
return
;
}
if
(
i_id
>
0
)
if
(
i_id
>
0
)
{
{
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_instance
->
p_playlist
,
i_id
);
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_instance
->
p_playlist
,
i_id
);
if
(
!
p_item
)
RAISEVOID
(
"Unable to find item"
);
if
(
!
p_item
)
{
libvlc_exception_raise
(
p_exception
,
"Unable to find item "
);
return
;
}
playlist_LockControl
(
p_instance
->
p_playlist
,
PLAYLIST_VIEWPLAY
,
playlist_LockControl
(
p_instance
->
p_playlist
,
PLAYLIST_VIEWPLAY
,
p_instance
->
p_playlist
->
status
.
p_node
,
p_item
);
p_instance
->
p_playlist
->
status
.
p_node
,
p_item
);
}
}
...
@@ -56,103 +50,94 @@ void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
...
@@ -56,103 +50,94 @@ void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
}
}
void
libvlc_playlist_pause
(
libvlc_instance_t
*
p_instance
,
void
libvlc_playlist_pause
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
if
(
playlist_Pause
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
if
(
playlist_Pause
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
{
RAISEVOID
(
"Empty playlist"
);
libvlc_exception_raise
(
p_exception
,
"Empty playlist"
);
}
}
}
void
libvlc_playlist_stop
(
libvlc_instance_t
*
p_instance
,
void
libvlc_playlist_stop
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
if
(
playlist_Stop
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
if
(
playlist_Stop
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
{
RAISEVOID
(
"Empty playlist"
);
libvlc_exception_raise
(
p_exception
,
"Empty playlist"
);
}
}
}
void
libvlc_playlist_clear
(
libvlc_instance_t
*
p_instance
,
void
libvlc_playlist_clear
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
playlist_Clear
(
p_instance
->
p_playlist
);
playlist_Clear
(
p_instance
->
p_playlist
);
}
}
void
libvlc_playlist_next
(
libvlc_instance_t
*
p_instance
,
void
libvlc_playlist_next
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
if
(
playlist_Next
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
if
(
playlist_Next
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
{
RAISEVOID
(
"Empty playlist"
);
libvlc_exception_raise
(
p_exception
,
"Empty playlist"
);
}
}
}
void
libvlc_playlist_prev
(
libvlc_instance_t
*
p_instance
,
void
libvlc_playlist_prev
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
if
(
playlist_Prev
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
if
(
playlist_Prev
(
p_instance
->
p_playlist
)
!=
VLC_SUCCESS
)
{
RAISEVOID
(
"Empty playlist"
);
libvlc_exception_raise
(
p_exception
,
"Empty playlist"
);
}
}
}
int
libvlc_playlist_add
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_uri
,
int
libvlc_playlist_add
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_uri
,
const
char
*
psz_name
,
libvlc_exception_t
*
p_e
xception
)
const
char
*
psz_name
,
libvlc_exception_t
*
p_e
)
{
{
return
libvlc_playlist_add_extended
(
p_instance
,
psz_uri
,
psz_name
,
return
libvlc_playlist_add_extended
(
p_instance
,
psz_uri
,
psz_name
,
0
,
NULL
,
p_e
xception
);
0
,
NULL
,
p_e
);
}
}
int
libvlc_playlist_add_extended
(
libvlc_instance_t
*
p_instance
,
int
libvlc_playlist_add_extended
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_uri
,
const
char
*
psz_name
,
const
char
*
psz_uri
,
const
char
*
psz_name
,
int
i_options
,
const
char
**
ppsz_options
,
int
i_options
,
const
char
**
ppsz_options
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
return
playlist_PlaylistAddExt
(
p_instance
->
p_playlist
,
psz_uri
,
psz_name
,
return
playlist_PlaylistAddExt
(
p_instance
->
p_playlist
,
psz_uri
,
psz_name
,
PLAYLIST_INSERT
,
PLAYLIST_END
,
-
1
,
ppsz_options
,
PLAYLIST_INSERT
,
PLAYLIST_END
,
-
1
,
ppsz_options
,
i_options
);
i_options
);
}
}
int
libvlc_playlist_delete_item
(
libvlc_instance_t
*
p_instance
,
int
i_id
,
int
libvlc_playlist_delete_item
(
libvlc_instance_t
*
p_instance
,
int
i_id
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
assert
(
p_instance
->
p_playlist
);
return
playlist_DeleteFromItemId
(
p_instance
->
p_playlist
,
i_id
);
return
playlist_DeleteFromItemId
(
p_instance
->
p_playlist
,
i_id
);
}
}
int
libvlc_playlist_isplaying
(
libvlc_instance_t
*
p_instance
,
int
libvlc_playlist_isplaying
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
if
(
!
p_instance
->
p_playlist
)
assert
(
p_instance
->
p_playlist
);
{
libvlc_exception_raise
(
p_exception
,
"No playlist"
);
return
0
;
}
return
playlist_IsPlaying
(
p_instance
->
p_playlist
);
return
playlist_IsPlaying
(
p_instance
->
p_playlist
);
}
}
int
libvlc_playlist_items_count
(
libvlc_instance_t
*
p_instance
,
int
libvlc_playlist_items_count
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
if
(
!
p_instance
->
p_playlist
)
assert
(
p_instance
->
p_playlist
);
{
libvlc_exception_raise
(
p_exception
,
"No playlist"
);
return
0
;
}
return
p_instance
->
p_playlist
->
i_size
;
return
p_instance
->
p_playlist
->
i_size
;
}
}
libvlc_input_t
*
libvlc_playlist_get_input
(
libvlc_instance_t
*
p_instance
,
libvlc_input_t
*
libvlc_playlist_get_input
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
xception
)
libvlc_exception_t
*
p_e
)
{
{
libvlc_input_t
*
p_input
;
libvlc_input_t
*
p_input
;
assert
(
p_instance
->
p_playlist
);
vlc_mutex_lock
(
&
p_instance
->
p_playlist
->
object_lock
);
vlc_mutex_lock
(
&
p_instance
->
p_playlist
->
object_lock
);
if
(
p_instance
->
p_playlist
->
p_input
==
NULL
)
if
(
p_instance
->
p_playlist
->
p_input
==
NULL
)
{
{
libvlc_exception_raise
(
p_e
xception
,
"No active input"
);
libvlc_exception_raise
(
p_e
,
"No active input"
);
vlc_mutex_unlock
(
&
p_instance
->
p_playlist
->
object_lock
);
vlc_mutex_unlock
(
&
p_instance
->
p_playlist
->
object_lock
);
return
NULL
;
return
NULL
;
}
}
...
...
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