8 void write_pbm(uint8_t *tp, int w, int h, const char *fmt, ...)
10 va_list ap; va_start(ap, fmt);
11 char fn[256]; vsnprintf(fn, sizeof(fn), fmt, ap);
13 FILE *fp = !strcmp(fn,"-") ? stdout : fopen(fn,"w");
15 fprintf(fp,"P5\n%d %d\n255\n",w,h);
21 int del_clip_set(theDb *db, int clip_id)
23 printf("del clip %d\n",clip_id);
24 if( db->clip_set.FindId(clip_id) ) return 1;
25 db->clip_set.Destruct();
26 db->clip_set.Deallocate();
28 if( Clip_viewsLoc::ikey_Clip_access(db->clip_views,clip_id).Find() ) return 1;
29 db->clip_views.Destruct();
30 db->clip_views.Deallocate();
32 while( !TimelineLoc::ikey_Sequences(db->timeline,clip_id,0).Locate() ) {
33 if( clip_id != (int)db->timeline.Clip_id() ) break;
34 int frame_id = db->timeline.Frame_id();
35 db->timeline.Destruct();
36 db->timeline.Deallocate();
37 if( !TimelineLoc::ikey_Timelines(db->timeline, frame_id).Locate() &&
38 frame_id == (int)db->timeline.Frame_id() ) continue;
39 if( db->video_frame.FindId(frame_id) ) continue;
40 db->video_frame.Destruct();
41 db->video_frame.Deallocate();
46 int main(int ac, char **av)
48 int ret; setbuf(stdout,0);
51 //db.access(av[1], 34543, 0);
52 if( !db.opened() || db.error() ) exit(1);
54 while( !(ret=db.clip_set.FirstId()) ) {
55 printf("clip %d %f %d\n", db.clip_set.id(), db.clip_set.Position(), db.clip_set.Frames());
56 del_clip_set(&db, db.clip_set.id());
58 if( !(ret=db.video_frame.FirstId()) ) do {
59 printf("frame %d\n", db.video_frame.id());
61 uint8_t *dat = db.video_frame._Frame_data();
62 write_pbm(dat,80,45,"%s/f%05d.pbm",av[2],db.video_frame.id());
64 } while( !(ret=db.video_frame.NextId()) );