streamer.h 1.72 KB
Newer Older
1
/**
2 3 4
 * @file streamer.h
 * @brief Streamer implementation
 * @copyright Copyright (C) 2017 Elphel Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * @author AUTHOR <EMAIL>
 *
 * @par License:
 *  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 3 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, see <http://www.gnu.org/licenses/>.
*/

22 23 24 25 26 27 28 29 30 31 32 33 34 35
#ifndef __H_STREAMER__
#define __H_STREAMER__

#include <string>
#include <map>

#include "video.h"
#include "audio.h"
#include "rtsp.h"

using namespace std;

class Streamer {
public:
36
	Streamer(const map<string, string> &args, int port_num, bool audio_en = false);
37 38 39 40 41 42 43
	~Streamer();
	void Main(void);
	bool opt_present(string name) {
		if(args.find(name) != args.end())
			return true;
		return false;
	}
44
	Streamer *instance(void) {
45 46
		return _streamer;
	}
47 48
	static void *pthread_f(void *_this);

49
protected:
50
	Streamer *_streamer;
51 52 53 54 55 56 57 58
	static int f_handler(void *ptr, RTSP_Server *rtsp_server, RTSP_Server::event event);
	int handler(RTSP_Server *rtsp_server, RTSP_Server::event event);

	int update_settings(bool apply = false);

	map<string, string> args;
	RTSP_Server *rtsp_server;
	Session *session;
59
	int sensor_port;
60 61 62

	Audio *audio;
	Video *video;
63
	Parameters *params;
64 65 66 67 68 69
	bool running;
	int connected_count;
	void audio_init(void);
};

#endif // __H_STREAMER__