]> git.sesse.net Git - vlc/commitdiff
* http.c,index.html: add seek function in http interface. Also added "stream_positio...
authorSimon Latapie <garf@videolan.org>
Mon, 3 Nov 2003 03:21:38 +0000 (03:21 +0000)
committerSimon Latapie <garf@videolan.org>
Mon, 3 Nov 2003 03:21:38 +0000 (03:21 +0000)
 * changed http interface more "neutral" colors

modules/control/http.c
share/http/admin/index.html
share/http/index.html
share/http/style.css

index d238f84cd383e59c314b795184f7c25ec9d2143b..81cef3388ecf1ad25b741f0e0adad8abc4ca794d 100644 (file)
@@ -2,7 +2,7 @@
  * http.c :  http mini-server ;)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.26 2003/11/02 22:51:56 gbazin Exp $
+ * $Id: http.c,v 1.27 2003/11/03 03:21:37 garf Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -1322,6 +1322,7 @@ enum macroType
         MVLC_ADD,
         MVLC_DEL,
         MVLC_EMPTY,
+        MVLC_SEEK,
 
         MVLC_CLOSE,
         MVLC_SHUTDOWN,
@@ -1353,6 +1354,7 @@ StrToMacroTypeTab [] =
         { "pause",          MVLC_PAUSE },
         { "next",           MVLC_NEXT },
         { "previous",       MVLC_PREVIOUS },
+        { "seek",           MVLC_SEEK },
 
         /* playlist management */
         { "add",            MVLC_ADD },
@@ -1478,6 +1480,22 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
                                       p_sys->p_playlist->i_index - 1 );
                     msg_Dbg( p_intf, "requested playlist next" );
                     break;
+                case MVLC_SEEK:
+                {
+                    vlc_value_t val;
+                    char percent[3];
+
+                    if( p_sys->p_input )
+                    {
+                        uri_extract_value( p_request, "percent", percent, 3 );
+                        val.f_float = ((float)atoi( percent )) / 100.0;
+                        var_Set( p_sys->p_input, "position", val );
+                        msg_Dbg( p_intf, "requested seek percent: %i", atoi( percent ) );
+                    }
+                    break;
+                }
+
+              
 
                 /* playlist management */
                 case MVLC_ADD:
@@ -1946,12 +1964,36 @@ static int  http_get( httpd_file_callback_args_t *p_args,
         int  i_buffer;
         uint8_t *p_buffer;
         uint8_t *dst;
+        vlc_value_t val;
+        char position[3]; /* percentage */
+        char time[12]; /* in seconds */
+        char length[12]; /* in seconds */
+#define p_sys p_args->p_intf->p_sys
+        if( p_sys->p_input )
+        {
+            var_Get( p_sys->p_input, "position", &val);
+            sprintf( position, "%d" , (int)((val.f_float) * 100.0));
+            var_Get( p_sys->p_input, "time", &val);
+            sprintf( time, "%d" , (int)(val.i_time / 1000) );
+            var_Get( p_sys->p_input, "length", &val);
+            sprintf( length, "%d" , (int)(val.i_time / 1000) );
+        } else
+        {
+            sprintf( position, "%d", 0 );
+            sprintf( time, "%d", 0 );
+            sprintf( length, "%d", 0 );
+        }
+#undef p_sys
 
         p_args->vars = mvar_New( "variables", "" );
         mvar_AppendNewVar( p_args->vars, "url_param", i_request > 0 ? "1" : "0" );
         mvar_AppendNewVar( p_args->vars, "url_value", p_request );
         mvar_AppendNewVar( p_args->vars, "version",   VERSION_MESSAGE );
         mvar_AppendNewVar( p_args->vars, "copyright", COPYRIGHT_MESSAGE );
+        mvar_AppendNewVar( p_args->vars, "stream_position", position );
+        mvar_AppendNewVar( p_args->vars, "stream_time", time );
+        mvar_AppendNewVar( p_args->vars, "stream_length", length );
 
         SSInit( &p_args->stack );
 
index c0ac0b9dc5d1424babe795a3e04ebbc9e9f906c7..9af1336c87e56866310ae1c994193337c651d416 100644 (file)
@@ -8,24 +8,24 @@
         h2 { text-align:center; }
        td {border:1pt black solid;margin:0em; }
         table.border {border:1pt black solid;}
-        div.section {background-color:#FFFFCC;
+        div.section {background-color:#DDDDFF;
              border:1pt black solid;
              margin-bottom:2em;
             padding:0.5em; }
-       div.section-ctr {background-color:#FFFFCC;
+       div.section-ctr {background-color:#CCCCFF;
              border:1pt black solid;
              margin-bottom:2em;
              padding:0.5em;
             font-size:1.2em;
             text-align:center; }
 
-        div.sectitle {  background-color:#FFFF99;
-                        color:#019;
+        div.sectitle {  background-color:#5A5ABB;
+                        color:#FFFFFF;
                         border:1pt black solid;
                         width:20%;
                         font-weight:bold;}
-        tr.ligne1 { background-color:#FFFFEE; }
-        tr.ligne2 { background-color:#FFFFAA; }
+        tr.ligne1 { background-color:#EEFFFF; }
+        tr.ligne2 { background-color:#CCCCFF; }
     </style>
     <vlc id="if" param1="url_param"/>
         <meta http-equiv="refresh" content="0;URL=/admin/" />
index 8d5be941788cf62cdc3a7da3241ef6aceb740e98..dacbabe306c127b35e70df845d769b8015650321 100644 (file)
@@ -10,7 +10,7 @@
         <meta http-equiv="refresh" content="0;URL=/" />
     <vlc id="end" />
 
-    <vlc id="control" param1="stop,pause,previous,next,add,sout,play,delete,empty" />
+    <vlc id="control" param1="stop,pause,previous,next,add,sout,play,delete,empty,seek" />
     <vlc id="set" param1="sout" param2="string" />
  </head>
  <body>
         <td><input type="submit" name="control" value="pause" /></td>
         <td><input type="submit" name="control" value="previous" /></td>
         <td><input type="submit" name="control" value="next" /></td>
+        <td><input type="submit" name="control" value="empty" /></td>
         <td><a href="info.html">Informations</a></td>
         <td><a href="admin/">Administration</a></td>
        </tr>
       </table>
      </form>
+     <form>
+      <table>
+       <tr>
+        <td>Seek (in percentage): <input type="text" name="percent" size="3">%<input type="submit" name="control" value="seek"></td>
+       </tr>
+      </table>
+     </form>
     </div>
     <div class="sectitle">Add</div>
     <div class="section">
index 945e2084c7f25f5b934e559d259782a9b8311fba..7f532835e1044f140ea8100755f709594009fb4f 100644 (file)
@@ -1,17 +1,18 @@
 body {font-family:Verdana, Arial, Sans Serif; }
 h2 { text-align:center; }
+h3 { text-align:left; }
 table {width:100%;}
 table.add {width:70%;}
-div.section {background-color:#FFFFCC;
+div.section {background-color:#DDDDFF;
      border:1pt black solid;
      margin-bottom:2em; 
      padding:0.5em;}
-div.sectitle { background-color:#FFFF99
-        color:#019;
+div.sectitle { background-color:#5A5ABB
+        color:#FFFFFF;
         border:1pt black solid;
         width:20%;
         font-weight:bold;}
-tr.ligne1 { background-color:#FFFFEE; }
-tr.ligne2 { background-color:#FFFFAA; }
+tr.ligne1 { background-color:#EEEEFF; }
+tr.ligne2 { background-color:#CCCCFF; }