Put the following in testfdms.c:
/* * Copyright (c) 2006,2007,2008 Jon Siddle <jon@trapdoor.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "fdms.h" void usage() { printf("SYNTAX: fdms-test <image.dd>\n"); } int main(int argc, char **argv) { fdms_vol *vol; fdms_prg *prg; int prg_cap; int prg_count; struct fdms_prg_info info; if(argc!=2) { usage(); exit(1); } if( -1 == fdms_open(argv[1], &vol) ) { perror("open"); exit(1); } prg_cap = fdms_get_prg_capacity(vol); prg_count = fdms_get_prg_count(vol); printf("**Programs** Capacity: %d, Present: %d\n", prg_cap, prg_count); if( -1 == fdms_open_prg(vol, 0, &prg) ) { perror("open_prg"); exit(1); } fdms_get_prg_info(prg, &info); printf("Program %d\n" "offset: 0x%x\n" "preroll: %d\n" "metronome: %s\n" "midi_sync_out: %s\n" "mtc_frame_rate: %d\n" "mtc offset: %02d:%02d:%02d:%02d:%02d\n" "offset mode: %s\n" "record protect: %s\n", 0, info.offset, info.preroll, info.metronome ? "on" : "off", (info.midi_sync_out==fdms_sync_mtc) ? "mtc" : (info.midi_sync_out==fdms_sync_clk) ? "clk" : "off", info.mtc_frame_rate, info.mtc_off_h, info.mtc_off_m, info.mtc_off_s, info.mtc_off_f, info.mtc_off_u, info.offset_mode ? "bar" : "abs", info.record_protect ? "on" : "off" ); return 0; }
Compile with:
gcc -o testfdms -L. -lfdms testfdms.c
run with:
LD_LIBRARY_PATH=. ./fdms-test image.dd
You should get something like this:
**Programs** Capacity: 128, Present: 98 Program 0 offset: 0xbfd55a88 preroll: 0 metronome: on midi_sync_out: clk mtc_frame_rate: 25 mtc offset: 00:59:57:00:00 offset mode: bar record protect: off