1 /* 2 * 3 * Quick and dirty synchronization data overlay 4 * Copyright 2014-2016, Björn Ståhl 5 * License: 3-Clause BSD, see COPYING file in arcan source repository. 6 * Reference: http://arcan-fe.com 7 */ 8 9 #ifndef _HAVE_SYNC_PLOT 10 #define _HAVE_SYNC_PLOT 11 12 /* 13 * Note that these functions, internally, assume RGBA32- at the moment, 14 * slated for refactor when we clean-up shmif support formats. 15 */ 16 17 typedef uint64_t timestamp_t; 18 19 /* 20 * plot key-events against a sliding window 21 */ 22 struct synch_graphing { 23 enum synch_state { 24 SYNCH_NONE, 25 SYNCH_OVERLAY, 26 SYNCH_INDEPENDENT 27 } state; 28 29 /* sync transfer, will poll event-loop and _drop segment on fail */ 30 bool (*update)(struct synch_graphing*, float period, const char* msg); 31 32 /* signal whenever parent provides non-periodic input */ 33 void (*mark_input)(struct synch_graphing*, timestamp_t); 34 35 /* signal when heuristics decide that it's not worth transferring */ 36 void (*mark_drop)(struct synch_graphing*, timestamp_t); 37 38 /* signal the audio buffer size before sending */ 39 void (*mark_abuf_size)(struct synch_graphing*, unsigned); 40 41 /* mark the beginning of frame creation */ 42 void (*mark_start)(struct synch_graphing*, timestamp_t); 43 44 /* mark the end of frame creation */ 45 void (*mark_stop)(struct synch_graphing*, timestamp_t); 46 47 /* register the cost of the specific frame (stop-start) */ 48 void (*mark_cost)(struct synch_graphing*, unsigned); 49 50 /* register the transfer- completion point and the cost */ 51 void (*mark_transfer)(struct synch_graphing*, timestamp_t, unsigned); 52 53 /* deallocate private resources, will also set the calling pointer 54 * to NULL, if state is INDEPENDENT, the associated contest will 55 * be terminated */ 56 void (*free)(struct synch_graphing**); 57 58 /* dimensions have changed or similar */ 59 void (*cont_switch)(struct synch_graphing*, struct arcan_shmif_cont*); 60 61 void* priv; 62 }; 63 64 /* 65 * populate a synch_graphing structure with the apropriate callbacks etc. 66 * if overlay is set to false, the context will manage itself (as long 67 * as update is called periodically), otherwise resize() member must 68 * be called to reflect changes in the shmcont. 69 */ 70 struct synch_graphing* setup_synch_graph( 71 struct arcan_shmif_cont* cont, bool overlay); 72 73 #endif 74