Commit 80646cc9 authored by Simon Latapie's avatar Simon Latapie

* http.c,index.html: add seek function in http interface. Also added...

 * http.c,index.html: add seek function in http interface. Also added "stream_position", "stream_length", and "stream_time" which could be usefull later (for a slider, for example :) )
 * changed http interface more "neutral" colors
parent 6edaeb5f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c : http mini-server ;) * http.c : http mini-server ;)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -1322,6 +1322,7 @@ enum macroType ...@@ -1322,6 +1322,7 @@ enum macroType
MVLC_ADD, MVLC_ADD,
MVLC_DEL, MVLC_DEL,
MVLC_EMPTY, MVLC_EMPTY,
MVLC_SEEK,
MVLC_CLOSE, MVLC_CLOSE,
MVLC_SHUTDOWN, MVLC_SHUTDOWN,
...@@ -1353,6 +1354,7 @@ StrToMacroTypeTab [] = ...@@ -1353,6 +1354,7 @@ StrToMacroTypeTab [] =
{ "pause", MVLC_PAUSE }, { "pause", MVLC_PAUSE },
{ "next", MVLC_NEXT }, { "next", MVLC_NEXT },
{ "previous", MVLC_PREVIOUS }, { "previous", MVLC_PREVIOUS },
{ "seek", MVLC_SEEK },
/* playlist management */ /* playlist management */
{ "add", MVLC_ADD }, { "add", MVLC_ADD },
...@@ -1478,6 +1480,22 @@ static void MacroDo( httpd_file_callback_args_t *p_args, ...@@ -1478,6 +1480,22 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
p_sys->p_playlist->i_index - 1 ); p_sys->p_playlist->i_index - 1 );
msg_Dbg( p_intf, "requested playlist next" ); msg_Dbg( p_intf, "requested playlist next" );
break; 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 */ /* playlist management */
case MVLC_ADD: case MVLC_ADD:
...@@ -1946,12 +1964,36 @@ static int http_get( httpd_file_callback_args_t *p_args, ...@@ -1946,12 +1964,36 @@ static int http_get( httpd_file_callback_args_t *p_args,
int i_buffer; int i_buffer;
uint8_t *p_buffer; uint8_t *p_buffer;
uint8_t *dst; 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", "" ); p_args->vars = mvar_New( "variables", "" );
mvar_AppendNewVar( p_args->vars, "url_param", i_request > 0 ? "1" : "0" ); 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, "url_value", p_request );
mvar_AppendNewVar( p_args->vars, "version", VERSION_MESSAGE ); mvar_AppendNewVar( p_args->vars, "version", VERSION_MESSAGE );
mvar_AppendNewVar( p_args->vars, "copyright", COPYRIGHT_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 ); SSInit( &p_args->stack );
......
...@@ -8,24 +8,24 @@ ...@@ -8,24 +8,24 @@
h2 { text-align:center; } h2 { text-align:center; }
td {border:1pt black solid;margin:0em; } td {border:1pt black solid;margin:0em; }
table.border {border:1pt black solid;} table.border {border:1pt black solid;}
div.section {background-color:#FFFFCC; div.section {background-color:#DDDDFF;
border:1pt black solid; border:1pt black solid;
margin-bottom:2em; margin-bottom:2em;
padding:0.5em; } padding:0.5em; }
div.section-ctr {background-color:#FFFFCC; div.section-ctr {background-color:#CCCCFF;
border:1pt black solid; border:1pt black solid;
margin-bottom:2em; margin-bottom:2em;
padding:0.5em; padding:0.5em;
font-size:1.2em; font-size:1.2em;
text-align:center; } text-align:center; }
div.sectitle { background-color:#FFFF99; div.sectitle { background-color:#5A5ABB;
color:#019; color:#FFFFFF;
border:1pt black solid; border:1pt black solid;
width:20%; width:20%;
font-weight:bold;} font-weight:bold;}
tr.ligne1 { background-color:#FFFFEE; } tr.ligne1 { background-color:#EEFFFF; }
tr.ligne2 { background-color:#FFFFAA; } tr.ligne2 { background-color:#CCCCFF; }
</style> </style>
<vlc id="if" param1="url_param"/> <vlc id="if" param1="url_param"/>
<meta http-equiv="refresh" content="0;URL=/admin/" /> <meta http-equiv="refresh" content="0;URL=/admin/" />
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<meta http-equiv="refresh" content="0;URL=/" /> <meta http-equiv="refresh" content="0;URL=/" />
<vlc id="end" /> <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" /> <vlc id="set" param1="sout" param2="string" />
</head> </head>
<body> <body>
...@@ -25,11 +25,19 @@ ...@@ -25,11 +25,19 @@
<td><input type="submit" name="control" value="pause" /></td> <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="previous" /></td>
<td><input type="submit" name="control" value="next" /></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="info.html">Informations</a></td>
<td><a href="admin/">Administration</a></td> <td><a href="admin/">Administration</a></td>
</tr> </tr>
</table> </table>
</form> </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>
<div class="sectitle">Add</div> <div class="sectitle">Add</div>
<div class="section"> <div class="section">
......
body {font-family:Verdana, Arial, Sans Serif; } body {font-family:Verdana, Arial, Sans Serif; }
h2 { text-align:center; } h2 { text-align:center; }
h3 { text-align:left; }
table {width:100%;} table {width:100%;}
table.add {width:70%;} table.add {width:70%;}
div.section {background-color:#FFFFCC; div.section {background-color:#DDDDFF;
border:1pt black solid; border:1pt black solid;
margin-bottom:2em; margin-bottom:2em;
padding:0.5em;} padding:0.5em;}
div.sectitle { background-color:#FFFF99; div.sectitle { background-color:#5A5ABB;
color:#019; color:#FFFFFF;
border:1pt black solid; border:1pt black solid;
width:20%; width:20%;
font-weight:bold;} font-weight:bold;}
tr.ligne1 { background-color:#FFFFEE; } tr.ligne1 { background-color:#EEEEFF; }
tr.ligne2 { background-color:#FFFFAA; } tr.ligne2 { background-color:#CCCCFF; }
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