#include #include #include "bcmplayer.h" int main(int argc, char **argv) { if (argc < 4) { printf("Usage: ./indexfrompts_test INDEXFILE HEXPTS DECIMAL_SEARCH_WINDOW\n"); exit(1); } const char *indexfile = argv[1]; unsigned long gotopts = strtoul(argv[2], NULL, 16); unsigned long searchwindow = atoi(argv[3]); unsigned long pts; printf("Params:\n"); printf(" bcmindex file: %s\n", indexfile); printf(" goto pts: %#x\n", gotopts); printf(" search window: %d\n", searchwindow); FILE *f = fopen(argv[1], "rw"); BNAV_Player_Handle bcmp; BNAV_Player_Settings settings; BNAV_Player_GetDefaultSettings(&settings); settings.readCb = (BP_READ_CB)fread; settings.seekCb = (BP_SEEK_CB)fseek; settings.tellCb = (BP_TELL_CB)ftell; settings.filePointer = f; settings.videoPid = 1; // doesn't matter if (BNAV_Player_Open(&bcmp, &settings)) exit(1); long index = BNAV_Player_FindIndexFromPts(bcmp, gotopts, searchwindow); if (index != -1) { BNAV_Player_Position pos; BNAV_Player_GetPosition(bcmp, &pos); printf("Found: %d, pts %#x\n", index, pos.pts); } else printf("Failed.\n"); BNAV_Player_Close(bcmp); return 0; }