[vlc-devel] [PATCH] support for rate of playing speed in http interface

sunil kumar skstronghold at gmail.com
Thu Apr 7 02:28:09 CEST 2011


adding support for speed of playing added in http interface

diff --git a/share/http/dialogs/main b/share/http/dialogs/main
index 244c4d9..96773a3 100644
--- a/share/http/dialogs/main
+++ b/share/http/dialogs/main
@@ -98,6 +98,14 @@ sout and playlist .
       <img src="images/volume_mute.png" alt="Mute Volume" />
       <span class="btn_text">Mute Volume</span>
     </button>
+    <button id="btn_speed_down" onclick="rate_down();"
onmouseover="button_over(this);" onmouseout="button_out(this);"
title="Decrease Speed" >
+      <img src="images/slow.png" alt="Decrease Speed" />
+      <span class="btn_text">Decrease Speed</span>
+    </button>
+    <button id="btn_speed_up" onclick="rate_up();"
onmouseover="button_over(this);" onmouseout="button_out(this);"
title="Increase Speed" >
+      <img src="images/fast.png" alt="Increase Speed" />
+      <span class="btn_text">Increase Speed</span>
+    </button>
   </div>
   <div id="status">
     <span id="state">(?)</span>
@@ -105,6 +113,8 @@ sout and playlist .
     Time : <span id="time">(?)</span>/<span id="length">(?)</span>
     -
     Volume : <span id="volume">(?)</span>
+    -
+    Speed : <span id="rate">(?)</span>
     <br/>
     <!-- progress bar -->
     <img src="images/slider_left.png" alt="slider left" /><span
id="progressbar" style="background-image: url( 'images/slider_bar.png' );
width: 408px; height:16px; position:absolute;" onclick="slider_seek( event,
this );" onmousemove="slider_move( event, this );"><img
src="images/slider_point.png" alt="slider point" style="position:relative;
left:0px;" id="main_slider_point" onmousedown="slider_down( event, this );"
onmouseup="slider_up( event, this.parentNode );" onmouseout="slider_up(
event, this.parentNode );"/></span><img src="images/slider_right.png"
alt="slider right" style="position:relative;left:408px;" />
diff --git a/share/http/js/functions.js b/share/http/js/functions.js
index c09222c..3d6c1bb 100644
--- a/share/http/js/functions.js
+++ b/share/http/js/functions.js
@@ -383,6 +383,14 @@ function volume_mute()
 {
     loadXMLDoc( 'requests/status.xml?command=volume&val=0', parse_status );
 }
+function rate_up()
+{
+    loadXMLDoc( 'requests/status.xml?command=rate&val=150', parse_status );
+}
+function rate_down()
+{
+    loadXMLDoc( 'requests/status.xml?command=rate&val=-150', parse_status
);
+}
 function seek( pos )
 {
     loadXMLDoc( 'requests/status.xml?command=seek&val='+pos, parse_status
);
@@ -471,6 +479,8 @@ function parse_status()
             set_text( 'length', format_time( length ) );
             if( status.getElementsByTagName( 'volume' ).length != 0 )
                 set_text( 'volume', Math.floor(status.getElementsByTagName(
'volume' )[0].firstChild.data/5.12)+'%' );
+    if( status.getElementsByTagName( 'rate' ).length != 0 )
+                set_text( 'rate', (status.getElementsByTagName( 'rate'
)[0].firstChild.data)+'%' );
             var statetag = status.getElementsByTagName( 'state' );
             if( statetag.length > 0 )
             {
diff --git a/share/http/requests/README.txt b/share/http/requests/README.txt
index cfd5a09..6e437b1 100644
--- a/share/http/requests/README.txt
+++ b/share/http/requests/README.txt
@@ -100,6 +100,12 @@ status.xml:
     +1H:2M -> seek 1 hour and 2 minutes forward
     -10% -> seek 10% back

+> change playing speed(rate)
+  ?command=rate&val=<val>
+  Allowed values are of the form:
+   <int> To increase speed
+  -<int> To decrease speed
+
 playlist.xml:
 =============
 < get the full playlist tree
diff --git a/share/http/requests/status.xml b/share/http/requests/status.xml
index da6d3ca..7088df6 100644
--- a/share/http/requests/status.xml
+++ b/share/http/requests/status.xml
@@ -116,6 +116,9 @@
   <vlc id="if" param1="command value 'volume' strcmp 0 =" />
     <vlc id="rpn" param1="val value vlc_volume_set" />
   <vlc id="end"/>
+  <vlc id="if" param1="command value 'rate' strcmp 0 =" />
+    <vlc id="rpn" param1="'rate' 'VLC_OBJECT_INPUT' vlc_var_get val +
'rate' 'VLC_OBJECT_INPUT' vlc_var_set" />
+  <vlc id="end"/>
   <vlc id="if" param1="command value 'seek' strcmp 0 =" />
     <vlc id="rpn" param1="val value vlc_seek" />
   <vlc id="end"/>
@@ -126,6 +129,7 @@
 <vlc id="end" />
 <root>
   <volume><vlc id="value" param1="volume" /></volume>
+  <rate><vlc id="value" param1="100000 'rate' 'VLC_OBJECT_INPUT'
vlc_var_get /"/></rate>
   <length><vlc id="value" param1="stream_length" /></length>
   <time><vlc id="value" param1="stream_time" /></time>
   <state><vlc id="value" param1="stream_state" /></state>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110407/da92b442/attachment.html>


More information about the vlc-devel mailing list