apps/astreamer/main.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <string>
00003 #include <map>
00004 
00005 #include "streamer.h"
00006 
00007 using namespace std;
00008 
00009 /*
00010 string usage = "Usage: str [options]
00011 Options:
00012         -f --fps xx.xx - use fixed xx.xx FPS for stream
00013         -u --ucast   - send stream over unicast (used by default)
00014                        in unicast mode supported only one active RTSP client
00015         -m --mcast [IP][:PORT]  - send stream over multicast with IP and PORT as multicast destination
00016         -s --silent  - \"silent\" mode for multicast - wait client over RTSP for streaming
00017                        (w/o this option - send multicast stream all time - by default)
00018         -a --addr xx.xx.xx.xx - multicast destination address
00019                        by default == 232.1.1.1
00020                        (must be from 224.0.0.0 to 239.255.255.255)
00021         -p --port xx - port, destination for multicast, and source for unicast/multicast
00022                        by default == 20020
00023         -t --ttl  xx - TTL (Time-To-Live for multicast, default 2)
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         // check default settings, if needed
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 }

Generated on Fri Nov 28 00:06:21 2008 for elphel by  doxygen 1.5.1