diff --git a/src/main.cpp b/src/main.cpp index d553d80..5b88e11 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,11 +173,11 @@ int main(int argc, char** argv) bool repeatConfig = true; int timeout = 65; bool muxTS = false; - unsigned int hlsSegment = -1; + unsigned int hlsSegment = 0; // decode parameters int c = 0; - while ((c = getopt (argc, argv, "v::Q:O:" "I:P:p:m:u:M:ct:TS:" "rwsf::F:W:H:" "h")) != -1) + while ((c = getopt (argc, argv, "v::Q:O:" "I:P:p:m:u:M:ct:TS::" "rwsf::F:W:H:" "h")) != -1) { switch (c) { @@ -194,7 +194,7 @@ int main(int argc, char** argv) case 'c': repeatConfig = false; break; case 't': timeout = atoi(optarg); break; case 'T': muxTS = true; break; - case 'S': hlsSegment = atoi(optarg); muxTS=true; break; + case 'S': hlsSegment = optarg ? atoi(optarg) : 5; muxTS=true; break; // V4L2 case 'r': ioTypeIn = V4l2DeviceFactory::IOTYPE_READ; break; case 'w': ioTypeOut = V4l2DeviceFactory::IOTYPE_READ; break; @@ -209,12 +209,12 @@ int main(int argc, char** argv) { std::cout << argv[0] << " [-v[v]] [-Q queueSize] [-O file]" << std::endl; std::cout << "\t [-I interface] [-P RTSP port] [-T RTSP/HTTP port] [-m multicast url] [-u unicast url] [-M multicast addr] [-c] [-t timeout]" << std::endl; - std::cout << "\t [-r] [-w] [-s] [-W width] [-H height] [-F fps] [device] [device]" << std::endl; + std::cout << "\t [-r] [-w] [-s] [-W width] [-H height] [-F fps] [device] [device]" << std::endl; std::cout << "\t -v : verbose" << std::endl; std::cout << "\t -vv : very verbose" << std::endl; std::cout << "\t -Q length : Number of frame queue (default "<< queueSize << ")" << std::endl; std::cout << "\t -O output : Copy captured frame to a file or a V4L2 device" << std::endl; - std::cout << "\t RTSP/RTP options :" << std::endl; + std::cout << "\t RTSP/RTP options :" << std::endl; std::cout << "\t -I addr : RTSP interface (default autodetect)" << std::endl; std::cout << "\t -P port : RTSP port (default "<< rtspPort << ")" << std::endl; std::cout << "\t -p port : RTSP over HTTP port (default "<< rtspOverHTTPPort << ")" << std::endl; @@ -224,8 +224,8 @@ int main(int argc, char** argv) std::cout << "\t -c : don't repeat config (default repeat config before IDR frame)" << std::endl; std::cout << "\t -t secs : RTCP expiration timeout (default " << timeout << ")" << std::endl; std::cout << "\t -T : send Transport Stream instead of elementary Stream" << std::endl; - std::cout << "\t -S secs : HTTP segment duration (enable HLS & MPEG-DASH)" << std::endl; - std::cout << "\t V4L2 options :" << std::endl; + std::cout << "\t -S[secs] : enable HLS & MPEG-DASH with segment duration of secs (default 5)" << std::endl; + std::cout << "\t V4L2 options :" << std::endl; std::cout << "\t -r : V4L2 capture using read interface (default use memory mapped buffers)" << std::endl; std::cout << "\t -w : V4L2 capture using write interface (default use memory mapped buffers)"<< std::endl; std::cout << "\t -s : V4L2 capture using live555 mainloop (default use a reader thread)" << std::endl; @@ -234,7 +234,7 @@ int main(int argc, char** argv) std::cout << "\t -W width : V4L2 capture width (default "<< width << ")" << std::endl; std::cout << "\t -H height : V4L2 capture height (default "<< height << ")" << std::endl; std::cout << "\t -F fps : V4L2 capture framerate (default "<< fps << ")" << std::endl; - std::cout << "\t device : V4L2 capture device (default "<< dev_name << ")" << std::endl; + std::cout << "\t device : V4L2 capture device (default "<< dev_name << ")" << std::endl; exit(0); } } @@ -356,8 +356,8 @@ int main(int argc, char** argv) addSession(rtspServer, baseUrl+url, HLSServerMediaSubsession::createNew(*env,replicator,rtpFormat, hlsSegment)); struct in_addr ip; ip.s_addr = ourIPAddress(*env); - LOG(NOTICE) << "HLS http://" << inet_ntoa(ip) << ":" << rtspPort << baseUrl+url << ".m3u8"; - LOG(NOTICE) << "MPEG-DASH http://" << inet_ntoa(ip) << ":" << rtspPort << baseUrl+url << ".mpd"; + LOG(NOTICE) << "HLS http://" << inet_ntoa(ip) << ":" << rtspPort << "/" << baseUrl+url << ".m3u8"; + LOG(NOTICE) << "MPEG-DASH http://" << inet_ntoa(ip) << ":" << rtspPort << "/" << baseUrl+url << ".mpd"; } else {