static size_t read_test(const stdString &index_name, const stdString &channel_name, double delta, const epicsTime *start = 0, const epicsTime *end = 0) { stdString text; size_t num = 0; try { IndexFile index; index.open(index_name); PlotReader reader(index, delta); const RawValue::Data *value = reader.find(channel_name, start); while (value && (end==0 || RawValue::getTime(value) < *end)) { ++num; LOG_ASSERT(value == reader.get()); reader.toString(text); printf(" %s\n", text.c_str()); value = reader.next(); } } catch (GenericException &e) { printf("Exception:\n%s\n", e.what()); return 0; } return num; }
IndexFile* IndexFileFactory::openWith(const char* format_name, const char* filename, AVFormatContext* input, const char* stream_filename) { const RegEntry* entry = getEntry(format_name); if(!entry) { fprintf(stderr, "Index file format '%s' is not supported\n", format_name); return NULL; } IndexFile* f = entry->creator(input); if(!f->open(filename, stream_filename)) { delete f; return NULL; } return f; }
IndexFile* IndexFileFactory::detectIndexFile( AVFormatContext* input, const char* filename) { if(!g_entryList) return NULL; for(int i = 0; i < g_entryList->size(); ++i) { const RegEntry& entry = g_entryList->at(i); if(!entry.detector(input, filename)) continue; IndexFile* f = entry.creator(input); if(f->open(NULL, filename)) return f; delete f; } return NULL; }