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]\n"
00027 "Options:\n"
00028 " -f --fps xx.xx - use fixed xx.xx FPS for stream\n"
00029 " -u --ucast - send stream over unicast (used by default)\n"
00030 " in unicast mode supported only one active RTSP client\n"
00031 " -m --mcast [IP][:PORT] - send stream over multicast with IP and PORT as multicast destination\n"
00032 " -s --silent - \"silent\" mode for multicast - wait client over RTSP for streaming\n"
00033 " (w/o this option - send multicast stream all time - by default)\n"
00034 " -a [SSSSS][/C] - send audio stream (if present) with a sample SSSSS Hz and channels C\n"
00035 " (by default, 44100Hz, stereo, i.e. \'-a 44100/2\')\n"
00036 " -t --ttl xx - TTL (Time-To-Live for multicast, default 2)\n";
00037
00038 int main(int argc, char *argv[]) {
00039 string opt;
00040 map<string, string> args;
00041 for(int i = 1; i < argc; i++) {
00042 if(argv[i][0] == '-' && argv[i][1] != '\0') {
00043 if(opt != "")
00044 args[opt] = "";
00045 opt = &argv[i][1];
00046 continue;
00047 } else {
00048 if(opt != "") {
00049 args[opt] = argv[i];
00050 opt = "";
00051 }
00052 }
00053 }
00054 if(opt != "")
00055 args[opt] = "";
00056 for(map<string, string>::iterator it = args.begin(); it != args.end(); it++) {
00057 cerr << "|" << (*it).first << "| == |" << (*it).second << "|" << endl;
00058 }
00059
00060 if(args.find("h") != args.end()) {
00061 cout << usage << endl;
00062 return 0;
00063 }
00064
00065 Streamer *streamer = new Streamer(args);
00066 streamer->Main();
00067 return 0;
00068 }