2
// ZoneMinder Remote Camera Class Implementation, $Date: 2009-02-16 18:21:50 +0000 (Mon, 16 Feb 2009) $, $Revision: 2765 $
2
// ZoneMinder Remote Camera Class Implementation, $Date: 2009-06-03 09:10:28 +0100 (Wed, 03 Jun 2009) $, $Revision: 2907 $
3
3
// Copyright (C) 2001-2008 Philip Coombes
5
5
// This program is free software; you can redistribute it and/or
28
28
#include <sys/types.h>
29
29
#include <sys/socket.h>
31
RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, const std::string &p_subpath, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
32
RemoteCamera( p_id, "rtsp", p_host, p_port, p_path, p_subpath, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ),
31
RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
32
RemoteCamera( p_id, "rtsp", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ),
35
35
if ( p_method == "rtpUni" )
89
89
int RemoteCameraRtsp::Connect()
91
rtspThread = new RtspThread( id, method, protocol, host, port, path, subpath, auth );
91
rtspThread = new RtspThread( id, method, protocol, host, port, path, auth );
93
93
rtspThread->start();
110
110
int RemoteCameraRtsp::PrimeCapture()
112
112
Debug( 2, "Waiting for sources" );
113
for ( int i = 0; i < 50 && !rtspThread->hasSources(); i++ )
113
for ( int i = 0; i < 100 && !rtspThread->hasSources(); i++ )
115
115
usleep( 100000 );
152
152
int RemoteCameraRtsp::PreCapture()
154
if ( !rtspThread->isRunning() )
154
156
if ( !rtspThread->hasSources() )
156
158
Error( "Cannot precapture, no RTP sources" );
167
if ( rtspThread->stopped() )
169
if ( !rtspThread->isRunning() )
171
//if ( rtspThread->stopped() )
169
173
if ( rtspThread->getFrame( buffer ) )
171
175
Debug( 3, "Read frame %d bytes", buffer.size() );
212
216
Error( "Error while decoding frame %d", frameCount );
213
Hexdump( ZM_DBG_ERR, buffer.head(), buffer.size() );
217
Hexdump( ZM_DBG_ERR, buffer.head(), buffer.size()>256?256:buffer.size() );
216
Debug( 2, "Frame: %d: %d/%d", frameCount, len, buffer.size() );
222
Debug( 2, "Frame: %d - %d/%d", frameCount, len, buffer.size() );
217
223
//if ( buffer.size() < 400 )
218
224
//Hexdump( 0, buffer.head(), buffer.size() );