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]
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         // check default settings, if needed
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 }

Generated on Thu Aug 7 16:18:58 2008 for elphel by  doxygen 1.5.1