Commit a788783f authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

WIP: compile RTSP server class without errors

parent 6f34e998
Loading
Loading
Loading
Loading
+55 −55
Original line number Diff line number Diff line
/**
 * @file FILENAME
 * @brief BRIEF DESCRIPTION
 * @copyright Copyright (C) YEAR Elphel Inc.
 * @file rtsp.cpp
 * @brief RTSP server implementation
 * @copyright Copyright (C) 2017 Elphel Inc.
 * @author AUTHOR <EMAIL>
 *
 * @par License:
@@ -21,17 +21,16 @@

#include "rtsp.h"
#include "helpers.h"
#include "parameters.h"

#include <string.h>
#include <vector>

using namespace std;

#undef RTSP_DEBUG
#undef RTSP_DEBUG_2
//#define RTSP_DEBUG
//#define RTSP_DEBUG_2
//#undef RTSP_DEBUG
//#undef RTSP_DEBUG_2
#define RTSP_DEBUG
#define RTSP_DEBUG_2

#ifdef RTSP_DEBUG
	#define D(a) a
@@ -126,13 +125,14 @@ string _Responce::serialize() {
	return rez;
}

RTSP_Server::RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), void *handler_data, Session *_session) {
RTSP_Server::RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), void *handler_data, Parameters *pars, Session *_session) {
	socket_main_1 = NULL;
	socket_main_2 = NULL;
//	socket_main_3 = NULL;
	handler_f = h;
	this->handler_data = handler_data;
	session = _session;
	params = pars;
//	_busy = NULL;
}

@@ -210,7 +210,7 @@ D2(cerr << endl << "something happen on the socket!" << endl;)
					if (in) {
						in->set_so_keepalive(1);
						D2(cerr << "processed - s.push_back(in)" << endl;)
D2(fprintf(stderr, "added : 0x%08X\n", in);)
						D2(fprintf(stderr, "added : 0x%p\n", in);)
						s.push_back(in);
					}
				} else {
@@ -218,7 +218,7 @@ D2(fprintf(stderr, "added : 0x%08X\n", in);)
					D2(cerr << "was with non-main socket" << endl;)
					if (!process(*it)) {
						D2(cerr << "process failed - remove it!" << endl;)
D2(fprintf(stderr, "delete: 0x%08X\n", *it);)
						D2(fprintf(stderr, "delete: 0x%p\n", *it);)
						delete *it;
						s.remove(*it);
						// check about counters etc...
@@ -233,7 +233,7 @@ D2(fprintf(stderr, "delete: 0x%08X\n", *it);)
	for (list<Socket *>::iterator it = s.begin(); it != s.end(); it++) {
		// keep the 'main' i.e. server socket
		if (*it != socket_main_1 && *it != socket_main_2) {			// && *it != socket_main_3) {
D2(fprintf(stderr, "delete: 0x%08X\n", *it);)
			D2(fprintf(stderr, "delete: 0x%p\n", *it);)
			delete *it;
		}
	}
@@ -307,7 +307,7 @@ D(cerr << __FILE__<< ":"<< __FUNCTION__ << ":" <<__LINE__ << " part_REQUEST: " <
	// process...
	request = new _Request(req);

	Parameters *params = Parameters::instance();
//	Parameters *params = Parameters::instance();
	responce = new _Responce();
//	responce->add_field("CSeq", (*request->get_fields().find("CSeq")).second);
	responce->add_field("CSeq", (request->get_fields())["CSeq"]);
+8 −4
Original line number Diff line number Diff line
/**
 * @file FILENAME
 * @brief BRIEF DESCRIPTION
 * @copyright Copyright (C) YEAR Elphel Inc.
 * @file rtsp.h
 * @brief RTSP server implementation
 * @copyright Copyright (C) 2017 Elphel Inc.
 * @author AUTHOR <EMAIL>
 *
 * @par License:
@@ -25,11 +25,14 @@
//#include "types.h"
#include "session.h"
#include "socket.h"
#include "parameters.h"

#include <map>
#include <list>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

@@ -81,7 +84,7 @@ public:
	};
	// if transport == NULL - wait for set_transport(), when client connected and ask DESCRIBE

	RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), void *handler_data, Session *_session = NULL);
	RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), void *handler_data, Parameters *pars, Session *_session = NULL);
	~RTSP_Server();
	
	// deprecated
@@ -111,6 +114,7 @@ protected:
	Socket *socket_main_1;
	Socket *socket_main_2;
//	Socket *socket_main_3;
	Parameters *params;
};

#endif // _RTSP_H_