00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/examples/BitstreamExample.cpp $ 00003 // $Id: BitstreamExample.cpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Example program to open a device bitstream and display its packets. 00018 00019 #include "torc/Bitstream.hpp" 00020 #include "torc/Common.hpp" 00021 #include <fstream> 00022 #include <iostream> 00023 00024 using namespace torc::common; 00025 using namespace torc::bitstream; 00026 00027 int main(int argc, char* argv[]) { 00028 00029 // we need an input bitstream 00030 if(argc != 2) { 00031 std::cout << "Usage: " << argv[0] << " bitstream.bit" << std::endl; 00032 exit(-1); 00033 } 00034 00035 // read the bitstream 00036 boost::filesystem::path bitstreamPath = argv[1]; 00037 BitstreamSharedPtr bitstreamPtr = Factory::newBitstreamPtr(bitstreamPath); 00038 // write the bitstream digest to the console 00039 std::cout << *bitstreamPtr << std::endl; 00040 00041 return 0; 00042 }