Commit 053a3a7c authored by Clément Stenac's avatar Clément Stenac

* Added new functions to the Mozilla plugin

	- set_volume
   	- get_volume
	- mute
	- clear_playlist
	- add_item
	- next
	- previous
	- isplaying
	- ge_length
	- get_position
	- get_time
	- seek

* Fixed VLC_VolumeSet and a description
parent 115834f3
...@@ -307,13 +307,13 @@ int VLC_Pause( int ); ...@@ -307,13 +307,13 @@ int VLC_Pause( int );
int VLC_Stop( int ); int VLC_Stop( int );
/** /**
* Stop the playlist * Tell if VLC is playing
* *
* If an item is currently playing then stop it. * If an item is currently playing, it returns
* Set the playlist to a stopped state. * VLC_TRUE, else VLC_FALSE
* *
* \param i_object a vlc object id * \param i_object a vlc object id
* \return VLC_SUCCESS on success * \return VLC_TRUE or VLC_FALSE
*/ */
vlc_bool_t VLC_IsPlaying( int ); vlc_bool_t VLC_IsPlaying( int );
......
...@@ -5,10 +5,29 @@ ...@@ -5,10 +5,29 @@
interface VlcIntf : nsISupports interface VlcIntf : nsISupports
{ {
/* Basic playback control */
void play(); void play();
void pause(); void pause();
void stop(); void stop();
/* Audio/Video control */
void fullscreen(); void fullscreen();
void set_volume( in PRInt64 i_volume );
PRInt64 get_volume();
void mute();
/* Playlist management */
void clear_playlist();
void add_item( in string psz_name);
void next();
void previous();
/* Status accessors */
PRBool isplaying();
PRInt64 get_length();
PRInt64 get_position();
PRInt64 get_time();
void seek( in PRInt64 i_secs, in PRInt64 b_relative);
}; };
...@@ -110,7 +110,7 @@ NS_IMETHODIMP VlcPeer::Stop() ...@@ -110,7 +110,7 @@ NS_IMETHODIMP VlcPeer::Stop()
{ {
if( p_plugin ) if( p_plugin )
{ {
VLC_CleanUp( p_plugin->i_vlc ); VLC_Stop( p_plugin->i_vlc );
p_plugin->b_stream = 0; p_plugin->b_stream = 0;
} }
return NS_OK; return NS_OK;
...@@ -128,3 +128,114 @@ NS_IMETHODIMP VlcPeer::Fullscreen() ...@@ -128,3 +128,114 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
return NS_OK; return NS_OK;
} }
/* Playlist control */
NS_IMETHODIMP VlcPeer::Clear_playlist()
{
if( p_plugin )
{
VLC_PlaylistClear( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Add_item( const char *psz_item )
{
if( p_plugin )
{
VLC_AddTarget( p_plugin->i_vlc, psz_item, NULL, 0,
PLAYLIST_APPEND, PLAYLIST_END);
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Isplaying( PRBool *b_playing )
{
if( p_plugin->i_vlc )
{
*b_playing = VLC_IsPlaying( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_position( PRInt64 *i_position )
{
if( p_plugin->i_vlc )
{
*i_position = VLC_PositionGet( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_time( PRInt64 *i_time )
{
if( p_plugin->i_vlc )
{
*i_time = VLC_TimeGet( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_length( PRInt64 *i_length )
{
if( p_plugin->i_vlc )
{
*i_length = VLC_LengthGet( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Seek( PRInt64 i_secs, PRInt64 b_relative )
{
if( p_plugin->i_vlc )
{
VLC_TimeSet( p_plugin->i_vlc, i_secs, b_relative );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Next()
{
if( p_plugin->i_vlc )
{
VLC_PlaylistNext( p_plugin->i_vlc);
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Previous()
{
if( p_plugin->i_vlc )
{
VLC_PlaylistPrev( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Set_volume( PRInt64 i_volume )
{
if( p_plugin->i_vlc )
{
VLC_VolumeSet( p_plugin->i_vlc, i_volume );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_volume( PRInt64 *i_volume )
{
if( p_plugin->i_vlc )
{
*i_volume = VLC_VolumeGet( p_plugin->i_vlc );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Mute()
{
if( p_plugin->i_vlc )
{
VLC_VolumeMute( p_plugin->i_vlc );
}
return NS_OK;
}
...@@ -1556,7 +1556,7 @@ int VLC_PlaylistClear( int i_object ) ...@@ -1556,7 +1556,7 @@ int VLC_PlaylistClear( int i_object )
*/ */
int VLC_VolumeSet( int i_object, int i_volume ) int VLC_VolumeSet( int i_object, int i_volume )
{ {
audio_volume_t i_vol; audio_volume_t i_vol = 0;
vlc_t *p_vlc = vlc_current_object( i_object ); vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */ /* Check that the handle is valid */
...@@ -1565,7 +1565,7 @@ int VLC_VolumeSet( int i_object, int i_volume ) ...@@ -1565,7 +1565,7 @@ int VLC_VolumeSet( int i_object, int i_volume )
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
if( 0 >= i_volume && i_volume <= 200 ) if( i_volume >= 0 && i_volume <= 200 )
{ {
i_vol = i_volume * AOUT_VOLUME_MAX / 200; i_vol = i_volume * AOUT_VOLUME_MAX / 200;
aout_VolumeSet( p_vlc, i_vol ); aout_VolumeSet( p_vlc, i_vol );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment