00001 #include <iostream>
00002 #include <string>
00003 #include <map>
00004
00005 #include "streamer.h"
00006
00007 using namespace std;
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 string usage = "Usage: str [options]
00027 Options:
00028 -f --fps xx.xx - use fixed xx.xx FPS for stream
00029 -u --ucast - send stream over unicast (used by default)
00030 in unicast mode supported only one active RTSP client
00031 -m --mcast [IP][:PORT] - send stream over multicast with IP and PORT as multicast destination
00032 -s --silent - \"silent\" mode for multicast - wait client over RTSP for streaming
00033 (w/o this option - send multicast stream all time - by default)
00034 -a [SSSSS][/C] - send audio stream (if present) with a sample SSSSS Hz and channels C
00035 (by default, 44100Hz, stereo, i.e. \'-a 44100/2\')
00036 -t --ttl xx - TTL (Time-To-Live for multicast, default 2)
00037 ";
00038
00039 int main(int argc, char *argv[]) {
00040 string opt;
00041 map<string, string> args;
00042 for(int i = 1; i < argc; i++) {
00043 if(argv[i][0] == '-' && argv[i][1] != '\0') {
00044 if(opt != "")
00045 args[opt] = "";
00046 opt = &argv[i][1];
00047 continue;
00048 } else {
00049 if(opt != "") {
00050 args[opt] = argv[i];
00051 opt = "";
00052 }
00053 }
00054 }
00055 if(opt != "")
00056 args[opt] = "";
00057 for(map<string, string>::iterator it = args.begin(); it != args.end(); it++) {
00058 cerr << "|" << (*it).first << "| == |" << (*it).second << "|" << endl;
00059 }
00060
00061 if(args.find("h") != args.end()) {
00062 cout << usage << endl;
00063 return 0;
00064 }
00065
00066 Streamer *streamer = new Streamer(args);
00067 streamer->Main();
00068 return 0;
00069 }