]> git.sesse.net Git - vlc/commitdiff
* Added new functions to the Mozilla plugin
authorClément Stenac <zorglub@videolan.org>
Sat, 12 Jun 2004 00:19:59 +0000 (00:19 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 12 Jun 2004 00:19:59 +0000 (00:19 +0000)
- 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

include/vlc/vlc.h
mozilla/vlcintf.idl
mozilla/vlcpeer.cpp
src/libvlc.c

index ee7a47d47ef6aae6546772bc51ccbbfb34b16d6e..411791a41b8f075f83365ba89de387fcd4e1de16 100644 (file)
@@ -307,13 +307,13 @@ int     VLC_Pause( int );
 int             VLC_Stop( int );
 
 /**
- * Stop the playlist
+ * Tell if VLC is playing
  *
- * If an item is currently playing then stop it.
- * Set the playlist to a stopped state.
+ * If an item is currently playing, it returns
+ * VLC_TRUE, else VLC_FALSE
  *
  * \param i_object a vlc object id
- * \return VLC_SUCCESS on success
+ * \return VLC_TRUE or VLC_FALSE
  */
 vlc_bool_t      VLC_IsPlaying( int );
 
index 8241041bfbc6705805332f6afd58747fbd2d6aa6..30c451d6cadd4526fc7b57cd658afa6175af2e5b 100644 (file)
@@ -5,10 +5,29 @@
 
 interface VlcIntf : nsISupports
 {
+    /* Basic playback control */
     void play();
     void pause();
     void stop();
-
+    /* Audio/Video control */
     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);
 };
 
index 292f21743476ff201d3b86d9d53461523b31e499..924a96483df7ad48e11d91397a7ab805ae4e6b26 100644 (file)
@@ -110,7 +110,7 @@ NS_IMETHODIMP VlcPeer::Stop()
 {
     if( p_plugin )
     {
-        VLC_CleanUp( p_plugin->i_vlc );
+        VLC_Stop( p_plugin->i_vlc );
         p_plugin->b_stream = 0;
     }
     return NS_OK;
@@ -128,3 +128,114 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
     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;
+}
index e54dad2d2e46e3865007bd222f14c0e96b89d79d..82e38e0a888bd3d12a35f38cec4c650b4641e146 100644 (file)
@@ -1556,7 +1556,7 @@ int VLC_PlaylistClear( int i_object )
  */
 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 );
 
     /* Check that the handle is valid */
@@ -1565,7 +1565,7 @@ int VLC_VolumeSet( int i_object, int i_volume )
         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;
         aout_VolumeSet( p_vlc, i_vol );