void Tool::packetdump(char **argv) { PacketStream packetfile; const char *path = *argv; Encoded buffer; Info info; ssize_t count; packetfile.open(argv); if(!packetfile.isOpen()) { cerr << "audiotool: " << path << ": unable to access" << endl; exit(-1); } if(!packetfile.isStreamable()) { cerr << "audiotool: " << path << ": missing needed codec" << endl; exit(-1); } packetfile.getInfo(&info); buffer = new unsigned char[maxFramesize(info)]; while((count = packetfile.getPacket(buffer)) > 0) cout << "-- " << count << endl; delete[] buffer; packetfile.close(); exit(0); }
bool StreamManager::closeStream(const std::string& name, bool whiny) { assert(!name.empty()); DebugL << "Close stream: " << name << endl; PacketStream* stream = get(name, whiny); if (stream) { stream->close(); return true; } return false; }