[vlc-commits] npapi: add attribute 'volume'

Daniel Amm git at videolan.org
Mon Dec 7 16:50:42 CET 2015


npapi-vlc | branch: master | Daniel Amm <da2424 at t-online.de> | Fri May 29 15:27:35 2015 +0200| [cb313ae17583e4eedfd09ae58c3f6cb95daad4a6] | committer: Jean-Baptiste Kempf

npapi: add attribute 'volume'

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/npapi-vlc/commit/cb313ae17583e4eedfd09ae58c3f6cb95daad4a6
---

 npapi/vlcplugin_base.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index bfefdbf..6e5bd9f 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -124,6 +124,7 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
 
     bool b_autoloop = false;
     bool b_mute = false;
+    int i_volume = -1;
 
     /* parse plugin arguments */
     for( int i = 0; (i < argc) && (ppsz_argc < MAX_PARAMS); i++ )
@@ -156,6 +157,10 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
         {
             b_mute = boolValue( argv[i] );
         }
+        else if( !strcmp( argn[i], "volume" ) )
+        {
+            i_volume = atoi( argv[i] );
+        }
         else if( !strcmp( argn[i], "loop")
               || !strcmp( argn[i], "autoloop") )
         {
@@ -190,6 +195,9 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
     if( b_mute )
         m_player.get_mp().setMute( true );
 
+    if( i_volume >= 0 && i_volume <= 200 )
+        m_player.get_mp().setVolume( i_volume );
+
     /*
     ** fetch plugin base URL, which is the URL of the page containing the plugin
     ** this URL is used for making absolute URL from relative URL that may be



More information about the vlc-commits mailing list