1 /* 2 * glob.h 3 * 4 * Global state definitions for the FXTV video app. 5 * 6 * (C) 1997 Randall Hopper 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 2. 12 * Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29 30 #ifndef __GLOB_H 31 #define __GLOB_H 32 33 #include <stdio.h> 34 #include <X11/Intrinsic.h> 35 #include <X11/extensions/XShm.h> 36 #include "tvtypes.h" 37 #include "tvscreen.h" 38 #include "tvcapture.h" 39 #include "tvaudio.h" 40 #include "station.h" 41 #include "annot.h" 42 #include "audiocnvt.h" 43 #include "app_rsrc.h" 44 #include "tvdebug.h" 45 #include "videolib.h" 46 47 typedef enum { 48 TV_ICAP_FMT_RGB16, 49 TV_ICAP_LAST_RGB = TV_ICAP_FMT_RGB16, 50 TV_ICAP_FMT_IYUV, 51 TV_ICAP_FMT_YUY2, 52 TV_ICAP_FMT_YUY2L 53 } TV_ICAP_FMT; 54 55 typedef enum { 56 TV_STILL_FMT_TIFF, 57 TV_STILL_FMT_PPM, 58 TV_STILL_FMT_YUV, 59 TV_NUM_STILL_FMTS 60 } TV_STILL_FMT; 61 62 typedef enum { 63 TV_VIDEO_TARGET_RAW, 64 TV_VIDEO_TARGET_IMAGES, 65 TV_VIDEO_TARGET_MPEG_READY, 66 TV_VIDEO_TARGET_MPEG, 67 } TV_VIDEO_TARGET; 68 69 typedef enum { 70 TV_TUNER_MODE_ANTENNA, 71 TV_TUNER_MODE_CABLE, 72 TV_NUM_TUNER_MODES 73 } TV_TUNER_MODE; 74 75 typedef struct { 76 XImage *ximg; 77 TV_GEOM geom; 78 XVisualInfo *visual; 79 TV_BOOL is_shm; 80 XShmSegmentInfo shm_info; 81 } TV_XIMAGE; 82 83 typedef struct { 84 TV_BOOL enabled; 85 TV_BOOL zoom_on; 86 TV_BOOL freeze_on; 87 TV_BOOL aspect_lock; 88 TV_CAPTURE_MODE cap_mode; 89 TV_GEOM geom; /* Video win geom (root rel) */ 90 TV_GEOM refresh_geom; /* Refresh geom (root rel) */ 91 struct { 92 TV_GEOM geom; 93 int mode; 94 int viewp_x; 95 int viewp_y; 96 } unzoomed; 97 98 TV_PIXEL_GEOM pix_geom; 99 100 TV_IMAGE image; /* Last frozen image */ 101 102 VL_COLORMAP *colormap; 103 104 XtAppContext app_context; 105 Widget shell_wgt; 106 107 Widget video_wgt; 108 Window win; 109 TV_BOOL win_visibility; /* X Visibility state */ 110 111 TV_XIMAGE ximage; 112 TV_BOOL ximage_use_for_expose; 113 GC gc; /* GC for video display */ 114 TV_BOOL waiting_for_resize; 115 116 TV_ANNOT annot; 117 118 TV_BOOL cursor_dozeoff_enabled; 119 XtIntervalId cursor_timer; 120 TV_BOOL cursor_timer_set; 121 122 } TV_DISPLAY; 123 124 typedef struct { 125 TV_STATION *cable_station; 126 TV_STATION *ant_station; 127 TV_INT32 cable_num_stations; 128 TV_INT32 ant_num_stations; 129 130 TV_FREQ_SET ant_freq_set; 131 TV_FREQ_SET cable_freq_set; 132 133 TV_TUNER_MODE tuner_mode; 134 TV_BOOL afc_mode; 135 136 TV_BOOL last_station_is_chan; 137 TV_INT32 last_chan; 138 double last_freq; 139 140 } TV_PREFS; 141 142 typedef struct { 143 TV_BOOL contin_save; 144 char fn_freeze_base[ MAXPATHLEN ]; 145 char fn_video_base[ MAXPATHLEN ]; 146 char fn_audio_base[ MAXPATHLEN ]; 147 TV_STILL_FMT freeze_fmt; 148 TV_BOOL freeze_use_suffix; 149 TV_INT32 freeze_next_suffix; 150 struct { 151 TV_AUDIO_FILE_FMT file_fmt; 152 TV_AUDIO_SAMPLE_FMT sample_fmt; 153 TV_BOOL stereo; 154 TV_UINT32 sample_rate; 155 } audio; 156 struct { 157 TV_BOOL capture_on; 158 TV_ICAP_FMT icap_fmt; 159 TV_VIDEO_TARGET target; 160 TV_GEOM geom; 161 TV_UINT32 fps; 162 TV_BOOL cleanup_temp; 163 TV_BOOL cap_audio; 164 } video; 165 } TV_DISK; 166 167 168 typedef struct { 169 170 TV_CAPTURE capture; 171 TV_XSCREEN x; 172 TV_DISPLAY display; 173 TV_PREFS prefs; 174 TV_DISK disk; 175 TV_AUDIO audio; 176 177 struct { 178 char queue_name[ 80 ]; 179 } printer; 180 181 } TV_GLOB; 182 183 extern TV_GLOB G_glob; 184 extern TV_BOOL G_in_x_error; 185 186 #define TVDISPLAY G_glob.x.display 187 #define TVSCREEN G_glob.x.screen 188 #define TVAPPCTX G_glob.display.app_context 189 #define TVTOPLEVEL G_glob.display.shell_wgt 190 191 #ifdef __cplusplus 192 extern "C" { 193 #endif 194 195 void TVGLOBInit( Display *display, int screen, Widget shell ); 196 197 void TVSetWorkProcTimeout( TV_INT32 delay_ms ); 198 199 #ifdef __cplusplus 200 } /* Close 'extern "C"' */ 201 #endif 202 203 #endif 204