int main(int argc, char* argv[]) { if(argc < 2) { cout << "Usage: transPlus <filename>"; exit(255); } BasicConfigurator::doConfigure(); avcodec_register_all(); av_register_all(); string filename(argv[1]); Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("Main")); LOG4CPLUS_INFO(logger, avcodec_configuration()); CodecList codecs = StreamFactory::getCodecList(); ContainerList containers = FFmpegEncodingContainer::getContainerList(); LOG4CPLUS_INFO(logger, "Configured with " << codecs.getCodecNames().size() << " codecs and " << containers.getContainers().size() << " containers"); LOG4CPLUS_INFO(logger, "Using file name " << filename); ifstream src; src.open(filename.c_str(), ios::binary); StreamReader reader(src); FFmpegDecodingContainer decoder(reader); map<string, string> m = decoder.getFormat(); LOG4CPLUS_INFO(logger, "Format of content stream is " << (*m.begin()).second); ptr_vector<FFmpegStream> streams = decoder.getStreams(); ptr_vector<FFmpegStream>::iterator it; for (it = streams.begin(); it < streams.end(); it++) { LOG4CPLUS_INFO(logger, "Found stream " << it->getType() << " of codec " << it->getCodec()); } decoder.runDecodeLoop(); }
//---------- map<string, Codec> getCodecList(bool returnOnlyValid) { ofxSquash::initialize(); CodecList codecs; squash_foreach_codec(populateCodecListCallback, &codecs); if (returnOnlyValid) { //erase invalid codecs for (auto it = codecs.begin(); it != codecs.end(); ) { if (it->second.isValid()) { it++; } else { it = codecs.erase(it); } } } return codecs; }
bool CodecList::operator== (const CodecList & c) const { CodecList::const_iterator it2 = c.begin (); if (codecs.size () != c.codecs.size ()) return false; for (const_iterator it = begin (); it != end (); it++) { if ((*it) != (*it2)) return false; it2++; } return true; }
void CodecList::append (CodecList& other) { codecs.insert (end (), other.begin (), other.end ()); }