mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-01-30 17:11:10 -05:00
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@853 e3e1d417-86f3-4887-817a-d78f3d33393f
94 lines
2.3 KiB
C++
94 lines
2.3 KiB
C++
//
|
|
// ZoneMinder Streaming Server, $Date$, $Revision$
|
|
// Copyright (C) 2003 Philip Coombes
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU General Public License
|
|
// as published by the Free Software Foundation; either version 2
|
|
// of the License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
//
|
|
|
|
#include "zm.h"
|
|
#include "zm_db.h"
|
|
#include "zm_monitor.h"
|
|
|
|
int main(void )
|
|
{
|
|
int id = 1;
|
|
unsigned long idle = 5000;
|
|
unsigned long refresh = 50;
|
|
unsigned int rate = 100;
|
|
unsigned int scale = 100;
|
|
int event = 0;
|
|
unsigned int ttl = 0;
|
|
|
|
//setbuf( fd, 0 );
|
|
//char streambuf[0x40000];
|
|
//setbuffer( stdout, streambuf, sizeof(streambuf) );
|
|
|
|
const char *query = getenv( "QUERY_STRING" );
|
|
if ( query )
|
|
{
|
|
char temp_query[256];
|
|
strcpy( temp_query, query );
|
|
char *q_ptr = temp_query;
|
|
char *parms[8]; // Shouldn't be more than this
|
|
int parm_no = 0;
|
|
while( (parms[parm_no] = strtok( q_ptr, "&" )) )
|
|
{
|
|
parm_no++;
|
|
q_ptr = NULL;
|
|
}
|
|
|
|
for ( int p = 0; p < parm_no; p++ )
|
|
{
|
|
char *name = strtok( parms[p], "=" );
|
|
char *value = strtok( NULL, "=" );
|
|
if ( !strcmp( name, "rate" ) )
|
|
rate = atoi( value );
|
|
else if ( !strcmp( name, "scale" ) )
|
|
scale = atoi( value );
|
|
else if ( !strcmp( name, "refresh" ) )
|
|
refresh = atol( value );
|
|
else if ( !strcmp( name, "idle" ) )
|
|
idle = atol( value );
|
|
else if ( !strcmp( name, "monitor" ) )
|
|
id = atoi( value );
|
|
else if ( !strcmp( name, "event" ) )
|
|
event = strtoull( value, (char **)NULL, 10 );
|
|
else if ( !strcmp( name, "ttl" ) )
|
|
ttl = atoi(value);
|
|
}
|
|
}
|
|
|
|
zm_dbg_name = "zms";
|
|
|
|
zmDbgInit();
|
|
|
|
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
|
|
|
if ( !event )
|
|
{
|
|
Monitor *monitor = Monitor::Load( id );
|
|
|
|
if ( monitor )
|
|
{
|
|
monitor->StreamImages( idle, refresh, ttl, scale, stdout );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Event::StreamEvent( event, rate, scale, stdout );
|
|
}
|
|
return( 0 );
|
|
}
|