52 lines
2.1 KiB
C++
52 lines
2.1 KiB
C++
#include <pangolin/pangolin.h>
|
|
#include <pangolin/tools/video_viewer.h>
|
|
|
|
int main( int argc, char* argv[] )
|
|
{
|
|
const std::string dflt_output_uri = "pango:[unique_filename]//video.pango";
|
|
|
|
if( argc > 1 ) {
|
|
const std::string input_uri = std::string(argv[1]);
|
|
const std::string output_uri = (argc > 2) ? std::string(argv[2]) : dflt_output_uri;
|
|
try{
|
|
pangolin::RunVideoViewerUI(input_uri, output_uri);
|
|
} catch (const pangolin::VideoException& e) {
|
|
std::cout << e.what() << std::endl;
|
|
}
|
|
}else{
|
|
const std::string input_uris[] = {
|
|
"dc1394:[fps=30,dma=10,size=640x480,iso=400]//0",
|
|
"convert:[fmt=RGB24]//v4l:///dev/video0",
|
|
"convert:[fmt=RGB24]//v4l:///dev/video1",
|
|
"openni:[img1=rgb]//",
|
|
"test:[size=160x120,n=1,fmt=RGB24]//"
|
|
""
|
|
};
|
|
|
|
std::cout << "Usage : VideoViewer [video-uri]" << std::endl << std::endl;
|
|
std::cout << "Where video-uri describes a stream or file resource, e.g." << std::endl;
|
|
std::cout << "\tfile:[realtime=1]///home/user/video/movie.pvn" << std::endl;
|
|
std::cout << "\tfile:///home/user/video/movie.avi" << std::endl;
|
|
std::cout << "\tfiles:///home/user/seqiemce/foo*.jpeg" << std::endl;
|
|
std::cout << "\tdc1394:[fmt=RGB24,size=640x480,fps=30,iso=400,dma=10]//0" << std::endl;
|
|
std::cout << "\tdc1394:[fmt=FORMAT7_1,size=640x480,pos=2+2,iso=400,dma=10]//0" << std::endl;
|
|
std::cout << "\tv4l:///dev/video0" << std::endl;
|
|
std::cout << "\tconvert:[fmt=RGB24]//v4l:///dev/video0" << std::endl;
|
|
std::cout << "\tmjpeg://http://127.0.0.1/?action=stream" << std::endl;
|
|
std::cout << "\topenni:[img1=rgb]//" << std::endl;
|
|
std::cout << std::endl;
|
|
|
|
// Try to open some video device
|
|
for(int i=0; !input_uris[i].empty(); ++i )
|
|
{
|
|
try{
|
|
pango_print_info("Trying: %s\n", input_uris[i].c_str());
|
|
pangolin::RunVideoViewerUI(input_uris[i], dflt_output_uri);
|
|
return 0;
|
|
}catch(const pangolin::VideoException&) { }
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|