diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-04-01 11:24:39 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2010-04-01 11:24:39 +0200 |
commit | 9ee950dde5943ee4083c2a0176ad4a1da4b49220 (patch) | |
tree | 2c5de44cea4582a75ba172617eb7526985346de2 | |
parent | bc7f101b0c874e21473aca15d9b08de8bd164392 (diff) |
v3.76
66 files changed, 6980 insertions, 2889 deletions
@@ -1,4 +1,25 @@ +3.75 => 3.76 +============ + + * reorganized screen blitting code (used for grabdisplay), moved that + to another file. + * Added OpenGL support (for hw-scaled RGB-images through gl-textures). + * libng got support for reading movie files. Added libquicktime + interface and AVI file parser. + * started writing a playback utility (debug/play.c for now ...), should + be able to playback all AVI/QuickTime movies recorded by + xawtv/streamer. Other QuickTime files should work too as long as the + codec is supported by libquicktime. + * Added Australian Optus cable TV channels (contributor wishes to remain + anonymous). + * Added icons (by Pedro Romão <pedro.romao@netvisao.pt>, they are in + contrib/) + * some A/V sync tweaks for the recording code. + * Correction of lens distortion for webcam (Frederic Helin + <Frederic.Helin@inrialpes.fr>). + + 3.74 => 3.75 ============ @@ -14,6 +35,7 @@ instead (http://zapping.ft.net, version 0.2.1 or newer). * unbundled the fonts, there is another tarball with all the fonts now. + * some more Makefile tweaks. 3.73 => 3.74 diff --git a/Makefile.in b/Makefile.in index 22581cf..b66bbb2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,7 +30,7 @@ LFS_FLAGS := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 X11_FLAGS := @X_CFLAGS@ -I/usr/X11R6/include/X11/fonts LIB_FLAGS := -I. -I./vbistuff -I./x11 \ -I$(srcdir)/jwz -I$(srcdir)/common -I$(srcdir)/console \ - -I$(srcdir)/libng -Llibng + -I$(srcdir)/x11 -I$(srcdir)/libng -Llibng # various libraries ATHENA_LIBS := @X_LIBS@ @LIBS@ @ATHENA@ @@ -44,6 +44,7 @@ ALSA_LIBS := @LIBALSA@ AA_LIBS := @AALIBS@ QT_LIBS := @QTLIBS@ VBI_LIBS := @LIBZVBI@ -lm +GL_LIBS := @LIBGL@ FS_LIBS := -L@x_libraries@ @FSLIB@ DLFLAGS := @DLFLAGS@ @@ -70,6 +71,9 @@ CFLAGS += -DVERSION='"$(VERSION)"' # shared objects need -fPIC %.so : CFLAGS += -fPIC +# libraries +LDLIBS := @LDLIBS@ + ######################################################### # targets @@ -7,6 +7,9 @@ /* libzvbi */ #undef HAVE_ZVBI +/* opengl */ +#undef HAVE_GL + /* alsa */ #undef HAVE_ALSA @@ -53,6 +53,10 @@ make distclean ./configure --disable-zvbi && make || exit 1 make distclean +# no opengl +./configure --disable-gl && make || exit 1 +make distclean + # no X11 ./configure --without-x && make || exit 1 make distclean diff --git a/common/Subdir.mk b/common/Subdir.mk index 58aba3d..4888899 100644 --- a/common/Subdir.mk +++ b/common/Subdir.mk @@ -1,4 +1,5 @@ + OBJS-common-capture := \ common/sound.o \ common/webcam.o \ @@ -14,6 +15,9 @@ OBJS-common-input := \ common/joystick.o \ common/midictrl.o +# RegEdit.c is good old K&R ... +common/RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes + common/channel-no-x11.o:: common/channel.c $(CC) $(CFLAGS) -DNO_X11=1 -Wp,-MD,$*.dep -c -o $@ $< @sed -e "s|.*\.o:|$@::|" < $*.dep > $*.d && rm -f $*.dep diff --git a/common/capture.c b/common/capture.c index 5bca96e..97e272f 100644 --- a/common/capture.c +++ b/common/capture.c @@ -1,3 +1,5 @@ +#include "config.h" + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -18,8 +20,8 @@ #include "capture.h" #include "webcam.h" -#define MAX_THREADS 4 -#define REORDER_SIZE 8 +#define MAX_THREADS 4 +#define REORDER_SIZE 32 /*-------------------------------------------------------------------------*/ /* data fifos (audio/video) */ @@ -114,172 +116,39 @@ flushit(void *arg) } /*-------------------------------------------------------------------------*/ -/* color space conversion / compression functions + thread */ +/* color space conversion / compression thread */ -struct ng_convert_handle { +struct ng_convthread_handle { /* converter data / state */ - struct ng_video_fmt ifmt; - struct ng_video_fmt ofmt; - int isize; - int osize; - struct ng_video_conv *conv; - void *chandle; + struct ng_convert_handle *c; /* thread data */ - struct FIFO *in; - struct FIFO *out; + struct FIFO *in; + struct FIFO *out; }; -struct ng_convert_handle* -ng_convert_alloc(struct ng_video_conv *conv, - struct ng_video_fmt *i, - struct ng_video_fmt *o) -{ - struct ng_convert_handle *h; - - h = malloc(sizeof(*h)); - if (NULL == h) - return 0; - memset(h,0,sizeof(*h)); - - /* fixup output image size to match incoming */ - o->width = i->width; - o->height = i->height; - if (0 == o->bytesperline) - o->bytesperline = o->width * ng_vfmt_to_depth[o->fmtid] / 8; - - h->ifmt = *i; - h->ofmt = *o; - if (conv) - h->conv = conv; - return h; -} - -void -ng_convert_init(struct ng_convert_handle *h) -{ - if (0 == h->ifmt.bytesperline) - h->ifmt.bytesperline = h->ifmt.width * - ng_vfmt_to_depth[h->ifmt.fmtid] / 8; - if (0 == h->ofmt.bytesperline) - h->ofmt.bytesperline = h->ofmt.width * - ng_vfmt_to_depth[h->ofmt.fmtid] / 8; - - h->isize = h->ifmt.height * h->ifmt.bytesperline; - if (0 == h->isize) - h->isize = h->ifmt.width * h->ifmt.height * 3; - h->osize = h->ofmt.height * h->ofmt.bytesperline; - if (0 == h->osize) - h->osize = h->ofmt.width * h->ofmt.height * 3; - - if (h->conv) - h->chandle = h->conv->init(&h->ofmt,h->conv->priv); - - if (debug) { - fprintf(stderr,"convert-in : %dx%d %s (size=%d)\n", - h->ifmt.width, h->ifmt.height, - ng_vfmt_to_desc[h->ifmt.fmtid], h->isize); - fprintf(stderr,"convert-out: %dx%d %s (size=%d)\n", - h->ofmt.width, h->ofmt.height, - ng_vfmt_to_desc[h->ofmt.fmtid], h->osize); - } -} - -static void -ng_convert_copyframe(struct ng_video_buf *dest, - struct ng_video_buf *src) -{ - int i,sw,dw; - unsigned char *sp,*dp; - - dw = dest->fmt.width * ng_vfmt_to_depth[dest->fmt.fmtid] / 8; - sw = src->fmt.width * ng_vfmt_to_depth[src->fmt.fmtid] / 8; - if (src->fmt.bytesperline == sw && dest->fmt.bytesperline == dw) { - /* can copy in one go */ - memcpy(dest->data, src->data, - src->fmt.bytesperline * src->fmt.height); - } else { - /* copy line by line */ - dp = dest->data; - sp = src->data; - for (i = 0; i < src->fmt.height; i++) { - memcpy(dp,sp,dw); - dp += dest->fmt.bytesperline; - sp += src->fmt.bytesperline; - } - } -} - -struct ng_video_buf* -ng_convert_frame(struct ng_convert_handle *h, - struct ng_video_buf *dest, - struct ng_video_buf *buf) -{ - if (NULL == buf) - return NULL; - - if (NULL == dest && NULL != h->conv) - dest = ng_malloc_video_buf(&h->ofmt,h->osize); - - if (NULL != dest) { - dest->fmt = h->ofmt; - dest->size = h->osize; - if (NULL != h->conv) { - h->conv->frame(h->chandle,dest,buf); - } else { - ng_convert_copyframe(dest,buf); - } - dest->info = buf->info; - ng_release_video_buf(buf); - buf = dest; - } - -#if 1 /* FIXME */ - if (NULL != webcam && 0 == webcam_put(webcam,buf)) { - free(webcam); - webcam = NULL; - } -#endif - return buf; -} - -void -ng_convert_fini(struct ng_convert_handle *h) -{ - if (h->conv) - h->conv->fini(h->chandle); - free(h); -} - -struct ng_video_buf* -ng_convert_single(struct ng_convert_handle *h, struct ng_video_buf *in) -{ - struct ng_video_buf *out; - - ng_convert_init(h); - out = ng_convert_frame(h,NULL,in); - ng_convert_fini(h); - return out; -} - void* ng_convert_thread(void *arg) { - struct ng_convert_handle *h = arg; + struct ng_convthread_handle *h = arg; struct ng_video_buf *in, *out; if (debug) fprintf(stderr,"convert_thread start [pid=%d]\n",getpid()); - ng_convert_init(h); + ng_convert_init(h->c); for (;;) { in = fifo_get(h->in); if (NULL == in) break; - out = ng_convert_frame(h,NULL,in); + out = ng_convert_frame(h->c,NULL,in); + if (NULL != webcam && 0 == webcam_put(webcam,out)) { + free(webcam); + webcam = NULL; + } fifo_put(h->out,out); } fifo_put(h->out,NULL); - ng_convert_fini(h); + ng_convert_fini(h->c); if (debug) fprintf(stderr,"convert_thread done [pid=%d]\n",getpid()); return NULL; @@ -335,7 +204,7 @@ ng_grabber_findconv(struct ng_video_fmt *fmt, /* check all available conversion functions */ for (i = 0;;) { - conv = ng_conv_find(fmt->fmtid, &i); + conv = ng_conv_find_to(fmt->fmtid, &i); if (NULL == conv) break; gfmt = *fmt; @@ -403,7 +272,7 @@ struct movie_handle { /* video converter thread */ struct FIFO cfifo; int cthreads; - struct ng_convert_handle *hconv[MAX_THREADS]; + struct ng_convthread_handle *hconv[MAX_THREADS]; pthread_t tconv[MAX_THREADS]; /* audio */ @@ -416,6 +285,9 @@ struct movie_handle { pthread_t taudio; pthread_t raudio; long long ats; + + long long rdrift; + long long vdrift; }; static void* @@ -508,7 +380,10 @@ record_audio_thread(void *arg) break; if (0 == buf->size) continue; - h->ats = buf->info.ts; + h->ats = buf->info.ts; + h->rts = ng_get_timestamp() - h->start; + h->rdrift = h->rts - h->ats; + h->vdrift = h->vts - h->ats; if (0 != fifo_put(&h->afifo,buf)) free(buf); } @@ -542,7 +417,7 @@ movie_writer_init(char *moviename, char *audioname, /* audio */ if (audio->fmtid != AUDIO_NONE) { - h->dsp = ng_dsp_open(dsp,audio,&h->hdsp); + h->dsp = ng_dsp_open(dsp,audio,1,&h->hdsp); if (NULL == h->dsp) { free(h); return NULL; @@ -578,7 +453,9 @@ movie_writer_init(char *moviename, char *audioname, fifo_init(&h->cfifo,"conv",slots,1); pthread_create(&h->tvideo,NULL,writer_video_thread,h); for (i = 0; i < h->cthreads; i++) { - h->hconv[i] = ng_convert_alloc(conv,&gfmt,video); + h->hconv[i] = malloc(sizeof(struct ng_convthread_handle)); + memset(h->hconv[i],0,sizeof(struct ng_convthread_handle)); + h->hconv[i]->c = ng_convert_alloc(conv,&gfmt,video); h->hconv[i]->in = &h->cfifo; h->hconv[i]->out = &h->vfifo; pthread_create(&h->tconv[i],NULL,ng_convert_thread, @@ -704,33 +581,23 @@ movie_writer_stop(struct movie_handle *h) static void movie_print_timestamps(struct movie_handle *h) { - long long adiff,vdiff; char line[128]; if (NULL == rec_status) return; - h->rts = ng_get_timestamp() - h->start; - adiff = h->ats - h->rts; - vdiff = h->vts - h->rts; -#if 0 - sprintf(line,"real: %d.%03ds audio: %d.%03ds video: %d.%03ds", - (int)((h->rts / 1000000000)), - (int)((h->rts % 1000000000) / 1000000), - (int)((h->ats / 1000000000)), - (int)((h->ats % 1000000000) / 1000000), - (int)((h->vts / 1000000000)), - (int)((h->vts % 1000000000) / 1000000)); -#else - sprintf(line,"real: %d.%03ds audio: %c%d.%03ds video: %c%d.%03ds", - (int)((h->rts / 1000000000)), - (int)((h->rts % 1000000000) / 1000000), - (adiff > 0) ? '+' : '-', - (int)((abs(adiff) / 1000000000)), - (int)((abs(adiff) % 1000000000) / 1000000), - (vdiff > 0) ? '+' : '-', - (int)((abs(vdiff) / 1000000000)), - (int)((abs(vdiff) % 1000000000) / 1000000)); -#endif + + sprintf(line,"rec %d:%02d.%02d - a/r: %c%d.%02ds [%d], a/v: %c%d.%02ds [%d]", + (int)(h->rts / 1000000000 / 60), + (int)(h->rts / 1000000000 % 60), + (int)((h->rts % 1000000000) / 10000000), + (h->rdrift > 0) ? '+' : '-', + (int)((abs(h->rdrift) / 1000000000)), + (int)((abs(h->rdrift) % 1000000000) / 10000000), + (int)(h->rdrift * h->fps / 1000000000000), + (h->vdrift > 0) ? '+' : '-', + (int)((abs(h->vdrift) / 1000000000)), + (int)((abs(h->vdrift) % 1000000000) / 10000000), + (int)(h->vdrift * h->fps / 1000000000000)); rec_status(line); } @@ -745,21 +612,25 @@ movie_grab_put_video(struct movie_handle *h, struct ng_video_buf **ret) /* fetch next frame */ buf = ng_grabber_grab_image(0); - if (NULL == buf) + if (NULL == buf) { + if (debug) + fprintf(stderr,"grab_put_video: grab image failed\n"); return -1; + } #if 0 /* FIXME */ buf = ng_filter_single(cur_filter,buf); #endif /* rate control */ - expected = buf->info.ts * h->fps / 1000000000000; - if (expected < h->frames) { + expected = (buf->info.ts - h->vdrift) * h->fps / 1000000000000; + if (expected < h->frames-1) { if (debug > 1) - fprintf(stderr,"rate: ignoring frame\n"); + fprintf(stderr,"rate: ignoring frame [%d %d]\n", + expected, h->frames); ng_release_video_buf(buf); return 0; } - if (expected > h->frames) { + if (expected > h->frames+1) { fprintf(stderr,"rate: queueing frame twice (%d)\n", expected-h->frames); buf->info.twice++; diff --git a/common/capture.h b/common/capture.h index 55eba30..118483e 100644 --- a/common/capture.h +++ b/common/capture.h @@ -15,19 +15,6 @@ void fifo_init(struct FIFO *fifo, char *name, int slots, int writers); int fifo_put(struct FIFO *fifo, void *data); void* fifo_get(struct FIFO *fifo); - -struct ng_convert_handle; -struct ng_convert_handle* ng_convert_alloc(struct ng_video_conv *conv, - struct ng_video_fmt *i, - struct ng_video_fmt *o); - -void ng_convert_init(struct ng_convert_handle *h); -struct ng_video_buf* ng_convert_frame(struct ng_convert_handle *h, - struct ng_video_buf *dest, - struct ng_video_buf *buf); -void ng_convert_fini(struct ng_convert_handle *h); -struct ng_video_buf* ng_convert_single(struct ng_convert_handle *h, - struct ng_video_buf *in); void* ng_convert_thread(void *arg); int ng_grabber_setformat(struct ng_video_fmt *fmt, int fix_ratio); diff --git a/common/commands.c b/common/commands.c index 6f1c577..0587861 100644 --- a/common/commands.c +++ b/common/commands.c @@ -61,7 +61,7 @@ int do_overlay; char *snapbase = "snap"; int have_shmem; -struct ng_video_fmt x11_fmt; +int cur_tv_width,cur_tv_height; int cur_movie,cur_attrs[256]; /* current hardware driver */ @@ -1007,8 +1007,8 @@ static int snap_handler(char *hname, int argc, char **argv) if (0 == strcasecmp(argv[1],"full")) { /* nothing */ } else if (0 == strcasecmp(argv[1],"win")) { - fmt.width = x11_fmt.width; - fmt.height = x11_fmt.height; + fmt.width = cur_tv_width; + fmt.height = cur_tv_height; } else if (2 == sscanf(argv[1],"%dx%d",&fmt.width,&fmt.height)) { /* nothing */ } else { @@ -1096,8 +1096,10 @@ static int webcam_handler(char *hname, int argc, char **argv) the webcam happy */ if (capture_get_hook) capture_get_hook(); - fmt = x11_fmt; - fmt.fmtid = VIDEO_RGB24; + memset(&fmt,0,sizeof(fmt)); + fmt.fmtid = VIDEO_RGB24; + fmt.width = cur_tv_width; + fmt.height = cur_tv_height; buf = ng_grabber_get_image(&fmt); if (buf) ng_release_video_buf(buf); diff --git a/common/commands.h b/common/commands.h index 8ee1531..f3ac2b4 100644 --- a/common/commands.h +++ b/common/commands.h @@ -52,7 +52,7 @@ extern int debug; extern int do_overlay; extern char *snapbase; extern int have_shmem; -extern struct ng_video_fmt x11_fmt; +extern int cur_tv_width,cur_tv_height; extern int cur_movie,cur_attrs[256]; extern struct movie_parm m_parm; diff --git a/common/frequencies.c b/common/frequencies.c index 4863736..c41555d 100644 --- a/common/frequencies.c +++ b/common/frequencies.c @@ -694,6 +694,57 @@ static struct CHANLIST pal_australia[] = { { "69", 814250 }, }; +static struct CHANLIST pal_australia_optus[] = { + { "1", 138250 }, + { "2", 147250 }, + { "3", 154250 }, + { "4", 161250 }, + { "5", 168250 }, + { "6", 175250 }, + { "7", 182250 }, + { "8", 189250 }, + { "9", 196250 }, + { "10", 209250 }, + { "11", 216250 }, + { "12", 224250 }, + { "13", 231250 }, + { "14", 238250 }, + { "15", 245250 }, + { "16", 252250 }, + { "17", 259250 }, + { "18", 266250 }, + { "19", 273250 }, + { "20", 280250 }, + { "21", 287250 }, + { "22", 294250 }, + { "23", 303250 }, + { "24", 310250 }, + { "25", 317250 }, + { "26", 324250 }, + { "27", 338250 }, + { "28", 345250 }, + { "29", 352250 }, + { "30", 359250 }, + { "31", 366250 }, + { "32", 373250 }, + { "33", 380250 }, + { "34", 387250 }, + { "35", 394250 }, + { "36", 401250 }, + { "37", 408250 }, + { "38", 415250 }, + { "39", 422250 }, + { "40", 429250 }, + { "41", 436250 }, + { "42", 443250 }, + { "43", 450250 }, + { "44", 457250 }, + { "45", 464250 }, + { "46", 471250 }, + { "47", 478250 }, + { "48", 485250 }, + }; + /* --------------------------------------------------------------------- */ /* europe */ @@ -1221,6 +1272,7 @@ struct CHANLISTS chanlists[] = { { "southafrica", pal_bcast_za, CHAN_COUNT(pal_bcast_za) }, { "argentina", argentina, CHAN_COUNT(argentina) }, { "canada-cable", ntsc_cable_ca, CHAN_COUNT(ntsc_cable_ca) }, + { "australia-optus", pal_australia_optus, CHAN_COUNT(pal_australia_optus) }, { NULL, NULL, 0 } /* EOF */ }; @@ -1241,6 +1293,7 @@ struct STRTAB chanlist_names[] = { { 13, "southafrica" }, { 14, "argentina" }, { 15, "canada-cable" }, + { 16, "australia-optus" }, { -1, NULL } }; diff --git a/config.h.in b/config.h.in index 3d5f4a4..a6b0643 100644 --- a/config.h.in +++ b/config.h.in @@ -8,6 +8,9 @@ /* libzvbi */ #undef HAVE_ZVBI +/* opengl */ +#undef HAVE_GL + /* alsa */ #undef HAVE_ALSA @@ -639,6 +639,7 @@ Optional Features: --enable-aa enable aalib support --enable-alsa enable alsa support --enable-zvbi enable vbi support (via libzvbi) + --enable-gl enable opengl support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -837,7 +838,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:840: loading site script $ac_site_file" >&5 + { echo "$as_me:841: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -848,7 +849,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:851: loading cache $cache_file" >&5 + { echo "$as_me:852: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -856,7 +857,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:859: creating cache $cache_file" >&5 + { echo "$as_me:860: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -872,21 +873,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:875: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:876: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:879: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:880: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:885: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:886: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:887: former value: $ac_old_val" >&5 + { echo "$as_me:888: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:889: current value: $ac_new_val" >&5 + { echo "$as_me:890: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -905,9 +906,9 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:908: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:909: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:910: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:911: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -927,10 +928,10 @@ esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:930: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:931: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:933: \$? = $ac_status" >&5 + echo "$as_me:934: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -981,6 +982,11 @@ if test "${enable_zvbi+set}" = set; then enableval="$enable_zvbi" fi; +# Check whether --enable-zvbi or --disable-zvbi was given. +if test "${enable_zvbi+set}" = set; then + enableval="$enable_zvbi" + +fi; ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -990,7 +996,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:993: checking for $ac_word" >&5 +echo "$as_me:999: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1005,7 +1011,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1008: found $ac_dir/$ac_word" >&5 +echo "$as_me:1014: found $ac_dir/$ac_word" >&5 break done @@ -1013,10 +1019,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1016: result: $CC" >&5 + echo "$as_me:1022: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1019: result: no" >&5 + echo "$as_me:1025: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1025,7 +1031,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1028: checking for $ac_word" >&5 +echo "$as_me:1034: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1040,7 +1046,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1043: found $ac_dir/$ac_word" >&5 +echo "$as_me:1049: found $ac_dir/$ac_word" >&5 break done @@ -1048,10 +1054,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1051: result: $ac_ct_CC" >&5 + echo "$as_me:1057: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1054: result: no" >&5 + echo "$as_me:1060: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1064,7 +1070,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1067: checking for $ac_word" >&5 +echo "$as_me:1073: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1079,7 +1085,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1082: found $ac_dir/$ac_word" >&5 +echo "$as_me:1088: found $ac_dir/$ac_word" >&5 break done @@ -1087,10 +1093,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1090: result: $CC" >&5 + echo "$as_me:1096: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1093: result: no" >&5 + echo "$as_me:1099: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1099,7 +1105,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1102: checking for $ac_word" >&5 +echo "$as_me:1108: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1114,7 +1120,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1117: found $ac_dir/$ac_word" >&5 +echo "$as_me:1123: found $ac_dir/$ac_word" >&5 break done @@ -1122,10 +1128,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1125: result: $ac_ct_CC" >&5 + echo "$as_me:1131: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1128: result: no" >&5 + echo "$as_me:1134: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1138,7 +1144,7 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1141: checking for $ac_word" >&5 +echo "$as_me:1147: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1158,7 +1164,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then continue fi ac_cv_prog_CC="cc" -echo "$as_me:1161: found $ac_dir/$ac_word" >&5 +echo "$as_me:1167: found $ac_dir/$ac_word" >&5 break done @@ -1180,10 +1186,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1183: result: $CC" >&5 + echo "$as_me:1189: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1186: result: no" >&5 + echo "$as_me:1192: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1194,7 +1200,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1197: checking for $ac_word" >&5 +echo "$as_me:1203: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1209,7 +1215,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1212: found $ac_dir/$ac_word" >&5 +echo "$as_me:1218: found $ac_dir/$ac_word" >&5 break done @@ -1217,10 +1223,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1220: result: $CC" >&5 + echo "$as_me:1226: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1223: result: no" >&5 + echo "$as_me:1229: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1233,7 +1239,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1236: checking for $ac_word" >&5 +echo "$as_me:1242: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1248,7 +1254,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1251: found $ac_dir/$ac_word" >&5 +echo "$as_me:1257: found $ac_dir/$ac_word" >&5 break done @@ -1256,10 +1262,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1259: result: $ac_ct_CC" >&5 + echo "$as_me:1265: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1262: result: no" >&5 + echo "$as_me:1268: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1271,32 +1277,32 @@ fi fi -test -z "$CC" && { { echo "$as_me:1274: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1280: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1279:" \ +echo "$as_me:1285:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1282: \"$ac_compiler --version </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1288: \"$ac_compiler --version </dev/null >&5\"") >&5 (eval $ac_compiler --version </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1285: \$? = $ac_status" >&5 + echo "$as_me:1291: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1287: \"$ac_compiler -v </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1293: \"$ac_compiler -v </dev/null >&5\"") >&5 (eval $ac_compiler -v </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1290: \$? = $ac_status" >&5 + echo "$as_me:1296: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1292: \"$ac_compiler -V </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1298: \"$ac_compiler -V </dev/null >&5\"") >&5 (eval $ac_compiler -V </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1295: \$? = $ac_status" >&5 + echo "$as_me:1301: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1299 "configure" +#line 1305 "configure" #include "confdefs.h" int @@ -1312,13 +1318,13 @@ ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1315: checking for C compiler default output" >&5 +echo "$as_me:1321: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1318: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:1324: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1321: \$? = $ac_status" >&5 + echo "$as_me:1327: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1341,34 +1347,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1344: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:1350: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1350: result: $ac_file" >&5 +echo "$as_me:1356: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1355: checking whether the C compiler works" >&5 +echo "$as_me:1361: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1361: \"$ac_try\"") >&5 + { (eval echo "$as_me:1367: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1364: \$? = $ac_status" >&5 + echo "$as_me:1370: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1371: error: cannot run C compiled programs. + { { echo "$as_me:1377: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1376,24 +1382,24 @@ If you meant to cross compile, use \`--host'." >&2;} fi fi fi -echo "$as_me:1379: result: yes" >&5 +echo "$as_me:1385: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1386: checking whether we are cross compiling" >&5 +echo "$as_me:1392: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1388: result: $cross_compiling" >&5 +echo "$as_me:1394: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1391: checking for executable suffix" >&5 +echo "$as_me:1397: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1393: \"$ac_link\"") >&5 +if { (eval echo "$as_me:1399: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1396: \$? = $ac_status" >&5 + echo "$as_me:1402: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1409,25 +1415,25 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:1412: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:1418: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1418: result: $ac_cv_exeext" >&5 +echo "$as_me:1424: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:1424: checking for object suffix" >&5 +echo "$as_me:1430: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1430 "configure" +#line 1436 "configure" #include "confdefs.h" int @@ -1439,10 +1445,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1442: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1448: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1445: \$? = $ac_status" >&5 + echo "$as_me:1451: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -1454,24 +1460,24 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1457: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:1463: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:1464: result: $ac_cv_objext" >&5 +echo "$as_me:1470: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:1468: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:1474: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1474 "configure" +#line 1480 "configure" #include "confdefs.h" int @@ -1486,16 +1492,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1489: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1495: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1492: \$? = $ac_status" >&5 + echo "$as_me:1498: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1495: \"$ac_try\"") >&5 + { (eval echo "$as_me:1501: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1498: \$? = $ac_status" >&5 + echo "$as_me:1504: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -1507,19 +1513,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:1510: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:1516: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:1516: checking whether $CC accepts -g" >&5 +echo "$as_me:1522: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1522 "configure" +#line 1528 "configure" #include "confdefs.h" int @@ -1531,16 +1537,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1534: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1540: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1537: \$? = $ac_status" >&5 + echo "$as_me:1543: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1540: \"$ac_try\"") >&5 + { (eval echo "$as_me:1546: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1543: \$? = $ac_status" >&5 + echo "$as_me:1549: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -1550,7 +1556,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:1553: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:1559: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -1577,16 +1583,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1580: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1586: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1583: \$? = $ac_status" >&5 + echo "$as_me:1589: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1586: \"$ac_try\"") >&5 + { (eval echo "$as_me:1592: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1589: \$? = $ac_status" >&5 + echo "$as_me:1595: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -1598,7 +1604,7 @@ if { (eval echo "$as_me:1580: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 1601 "configure" +#line 1607 "configure" #include "confdefs.h" #include <stdlib.h> $ac_declaration @@ -1611,16 +1617,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1614: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1620: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1617: \$? = $ac_status" >&5 + echo "$as_me:1623: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1620: \"$ac_try\"") >&5 + { (eval echo "$as_me:1626: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1623: \$? = $ac_status" >&5 + echo "$as_me:1629: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -1630,7 +1636,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 1633 "configure" +#line 1639 "configure" #include "confdefs.h" $ac_declaration int @@ -1642,16 +1648,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1645: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1651: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1648: \$? = $ac_status" >&5 + echo "$as_me:1654: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1651: \"$ac_try\"") >&5 + { (eval echo "$as_me:1657: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1654: \$? = $ac_status" >&5 + echo "$as_me:1660: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -1683,7 +1689,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:1686: checking how to run the C preprocessor" >&5 +echo "$as_me:1692: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -1704,18 +1710,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 1707 "configure" +#line 1713 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:1712: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:1718: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:1718: \$? = $ac_status" >&5 + echo "$as_me:1724: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -1738,17 +1744,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 1741 "configure" +#line 1747 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:1745: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:1751: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:1751: \$? = $ac_status" >&5 + echo "$as_me:1757: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -1785,7 +1791,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:1788: result: $CPP" >&5 +echo "$as_me:1794: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -1795,18 +1801,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 1798 "configure" +#line 1804 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:1803: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:1809: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:1809: \$? = $ac_status" >&5 + echo "$as_me:1815: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -1829,17 +1835,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 1832 "configure" +#line 1838 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:1836: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:1842: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:1842: \$? = $ac_status" >&5 + echo "$as_me:1848: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -1867,7 +1873,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:1870: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:1876: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -1895,7 +1901,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:1898: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:1904: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi @@ -1915,7 +1921,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:1918: checking for a BSD compatible install" >&5 +echo "$as_me:1924: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -1964,7 +1970,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:1967: result: $INSTALL" >&5 +echo "$as_me:1973: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -1979,7 +1985,7 @@ for ac_prog in gccmakedep makedepend do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1982: checking for $ac_word" >&5 +echo "$as_me:1988: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_DEPEND+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1994,7 +2000,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_DEPEND="$ac_prog" -echo "$as_me:1997: found $ac_dir/$ac_word" >&5 +echo "$as_me:2003: found $ac_dir/$ac_word" >&5 break done @@ -2002,10 +2008,10 @@ fi fi DEPEND=$ac_cv_prog_DEPEND if test -n "$DEPEND"; then - echo "$as_me:2005: result: $DEPEND" >&5 + echo "$as_me:2011: result: $DEPEND" >&5 echo "${ECHO_T}$DEPEND" >&6 else - echo "$as_me:2008: result: no" >&5 + echo "$as_me:2014: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2019,6 +2025,7 @@ FOUND_LQT="no" FOUND_MOTIF="no" FOUND_OS="unknown" FOUND_X11="no" +FOUND_GL="no" FOUND_ZVBI="no" case "`uname -s`" in @@ -2029,18 +2036,19 @@ case "`uname -s`" in # *BSD has important stuff (from ports) # in /usr/local ... CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib" + LDLIBS="$LDLIBS -L/usr/local/lib" FOUND_OS="bsd" ;; *) - echo "$as_me:2035: checking if xawtv will build on \`uname -s\`" >&5 + echo "$as_me:2043: checking if xawtv will build on \`uname -s\`" >&5 echo $ECHO_N "checking if xawtv will build on \`uname -s\`... $ECHO_C" >&6 - echo "$as_me:2037: result: maybe" >&5 + echo "$as_me:2045: result: maybe" >&5 echo "${ECHO_T}maybe" >&6 ;; esac cat >conftest.$ac_ext <<_ACEOF -#line 2043 "configure" +#line 2051 "configure" #include "confdefs.h" #include <sys/socket.h> @@ -2057,23 +2065,23 @@ rm -f conftest* for ac_header in getopt.h soundcard.h unistd.h sys/select.h sys/soundcard.h alsa/asoundlib.h linux/joystick.h dev/ic/bt8xx.h machine/ioctl_bt848.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:2060: checking for $ac_header" >&5 +echo "$as_me:2068: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2066 "configure" +#line 2074 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:2070: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2078: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2076: \$? = $ac_status" >&5 + echo "$as_me:2084: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2092,7 +2100,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:2095: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:2103: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<EOF @@ -2105,13 +2113,13 @@ done for ac_func in ftello fseeko getpt getnameinfo getopt_long strcasestr dlopen do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:2108: checking for $ac_func" >&5 +echo "$as_me:2116: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2114 "configure" +#line 2122 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -2142,16 +2150,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2145: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2153: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2148: \$? = $ac_status" >&5 + echo "$as_me:2156: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2151: \"$ac_try\"") >&5 + { (eval echo "$as_me:2159: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2154: \$? = $ac_status" >&5 + echo "$as_me:2162: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -2161,7 +2169,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:2164: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:2172: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<EOF @@ -2173,7 +2181,7 @@ done DLFLAGS="" if test "$ac_cv_func_dlopen" = "no"; then - echo "$as_me:2176: checking for dlopen in -ldl" >&5 + echo "$as_me:2184: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2181,7 +2189,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2184 "configure" +#line 2192 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2200,16 +2208,16 @@ dlopen (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2203: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2211: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2206: \$? = $ac_status" >&5 + echo "$as_me:2214: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2209: \"$ac_try\"") >&5 + { (eval echo "$as_me:2217: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2212: \$? = $ac_status" >&5 + echo "$as_me:2220: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else @@ -2220,25 +2228,25 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2223: result: $ac_cv_lib_dl_dlopen" >&5 +echo "$as_me:2231: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then DLFLAGS="-ldl" fi fi -echo "$as_me:2230: checking for ELF" >&5 +echo "$as_me:2238: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then - echo "$as_me:2233: result: yes" >&5 + echo "$as_me:2241: result: yes" >&5 echo "${ECHO_T}yes" >&6 DLFLAGS="$DLFLAGS -Wl,-E" else - echo "$as_me:2237: result: no" >&5 + echo "$as_me:2245: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:2241: checking for pthread_create in -lpthread" >&5 +echo "$as_me:2249: checking for pthread_create in -lpthread" >&5 echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2246,7 +2254,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2249 "configure" +#line 2257 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2265,16 +2273,16 @@ pthread_create (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2268: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2276: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2271: \$? = $ac_status" >&5 + echo "$as_me:2279: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2274: \"$ac_try\"") >&5 + { (eval echo "$as_me:2282: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2277: \$? = $ac_status" >&5 + echo "$as_me:2285: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_create=yes else @@ -2285,14 +2293,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2288: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "$as_me:2296: result: $ac_cv_lib_pthread_pthread_create" >&5 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 if test $ac_cv_lib_pthread_pthread_create = yes; then LIBPTHREAD="-lpthread" fi if test "$LIBPTHREAD" = ""; then - echo "$as_me:2295: checking for pthread_create in -lc_r" >&5 + echo "$as_me:2303: checking for pthread_create in -lc_r" >&5 echo $ECHO_N "checking for pthread_create in -lc_r... $ECHO_C" >&6 if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2300,7 +2308,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2303 "configure" +#line 2311 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2319,16 +2327,16 @@ pthread_create (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2322: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2330: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2325: \$? = $ac_status" >&5 + echo "$as_me:2333: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2328: \"$ac_try\"") >&5 + { (eval echo "$as_me:2336: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2331: \$? = $ac_status" >&5 + echo "$as_me:2339: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_c_r_pthread_create=yes else @@ -2339,14 +2347,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2342: result: $ac_cv_lib_c_r_pthread_create" >&5 +echo "$as_me:2350: result: $ac_cv_lib_c_r_pthread_create" >&5 echo "${ECHO_T}$ac_cv_lib_c_r_pthread_create" >&6 if test $ac_cv_lib_c_r_pthread_create = yes; then LIBPTHREAD="-lc_r" fi fi -echo "$as_me:2349: checking for main in -lossaudio" >&5 +echo "$as_me:2357: checking for main in -lossaudio" >&5 echo $ECHO_N "checking for main in -lossaudio... $ECHO_C" >&6 if test "${ac_cv_lib_ossaudio_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2354,7 +2362,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lossaudio $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2357 "configure" +#line 2365 "configure" #include "confdefs.h" int @@ -2366,16 +2374,16 @@ main (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2369: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2377: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2372: \$? = $ac_status" >&5 + echo "$as_me:2380: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2375: \"$ac_try\"") >&5 + { (eval echo "$as_me:2383: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2378: \$? = $ac_status" >&5 + echo "$as_me:2386: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ossaudio_main=yes else @@ -2386,13 +2394,13 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2389: result: $ac_cv_lib_ossaudio_main" >&5 +echo "$as_me:2397: result: $ac_cv_lib_ossaudio_main" >&5 echo "${ECHO_T}$ac_cv_lib_ossaudio_main" >&6 if test $ac_cv_lib_ossaudio_main = yes; then LIBOSS="-lossaudio" fi -echo "$as_me:2395: checking for initscr in -lncurses" >&5 +echo "$as_me:2403: checking for initscr in -lncurses" >&5 echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2400,7 +2408,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2403 "configure" +#line 2411 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2419,16 +2427,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2422: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2430: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2425: \$? = $ac_status" >&5 + echo "$as_me:2433: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2428: \"$ac_try\"") >&5 + { (eval echo "$as_me:2436: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2431: \$? = $ac_status" >&5 + echo "$as_me:2439: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_initscr=yes else @@ -2439,14 +2447,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2442: result: $ac_cv_lib_ncurses_initscr" >&5 +echo "$as_me:2450: result: $ac_cv_lib_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 if test $ac_cv_lib_ncurses_initscr = yes; then LIBCURSES="-lncurses" fi if test "$LIBCURSES" = ""; then - echo "$as_me:2449: checking for initscr in -lcurses" >&5 + echo "$as_me:2457: checking for initscr in -lcurses" >&5 echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2454,7 +2462,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2457 "configure" +#line 2465 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2473,16 +2481,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2476: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2484: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2479: \$? = $ac_status" >&5 + echo "$as_me:2487: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2482: \"$ac_try\"") >&5 + { (eval echo "$as_me:2490: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2485: \$? = $ac_status" >&5 + echo "$as_me:2493: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_initscr=yes else @@ -2493,7 +2501,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2496: result: $ac_cv_lib_curses_initscr" >&5 +echo "$as_me:2504: result: $ac_cv_lib_curses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6 if test $ac_cv_lib_curses_initscr = yes; then LIBCURSES="-lcurses" @@ -2507,7 +2515,7 @@ if test "$LIBCURSES" = ""; then exit 1 fi -echo "$as_me:2510: checking for X" >&5 +echo "$as_me:2518: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. @@ -2604,17 +2612,17 @@ if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF -#line 2607 "configure" +#line 2615 "configure" #include "confdefs.h" #include <X11/Intrinsic.h> _ACEOF -if { (eval echo "$as_me:2611: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2619: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2617: \$? = $ac_status" >&5 + echo "$as_me:2625: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2647,7 +2655,7 @@ if test "$ac_x_libraries" = no; then ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2650 "configure" +#line 2658 "configure" #include "confdefs.h" #include <X11/Intrinsic.h> int @@ -2659,16 +2667,16 @@ XtMalloc (0) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2662: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2670: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2665: \$? = $ac_status" >&5 + echo "$as_me:2673: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2668: \"$ac_try\"") >&5 + { (eval echo "$as_me:2676: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2671: \$? = $ac_status" >&5 + echo "$as_me:2679: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. @@ -2706,7 +2714,7 @@ fi fi # $with_x != no if test "$have_x" != yes; then - echo "$as_me:2709: result: $have_x" >&5 + echo "$as_me:2717: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else @@ -2716,7 +2724,7 @@ else # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - echo "$as_me:2719: result: libraries $x_libraries, headers $x_includes" >&5 + echo "$as_me:2727: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi @@ -2740,11 +2748,11 @@ else # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) - echo "$as_me:2743: checking whether -R must be followed by a space" >&5 + echo "$as_me:2751: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF -#line 2747 "configure" +#line 2755 "configure" #include "confdefs.h" int @@ -2756,16 +2764,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2759: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2767: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2762: \$? = $ac_status" >&5 + echo "$as_me:2770: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2765: \"$ac_try\"") >&5 + { (eval echo "$as_me:2773: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2768: \$? = $ac_status" >&5 + echo "$as_me:2776: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else @@ -2775,13 +2783,13 @@ ac_R_nospace=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then - echo "$as_me:2778: result: no" >&5 + echo "$as_me:2786: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF -#line 2784 "configure" +#line 2792 "configure" #include "confdefs.h" int @@ -2793,16 +2801,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2796: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2804: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2799: \$? = $ac_status" >&5 + echo "$as_me:2807: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2802: \"$ac_try\"") >&5 + { (eval echo "$as_me:2810: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2805: \$? = $ac_status" >&5 + echo "$as_me:2813: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else @@ -2812,11 +2820,11 @@ ac_R_space=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then - echo "$as_me:2815: result: yes" >&5 + echo "$as_me:2823: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else - echo "$as_me:2819: result: neither works" >&5 + echo "$as_me:2827: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi @@ -2836,7 +2844,7 @@ echo "${ECHO_T}neither works" >&6 # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF -#line 2839 "configure" +#line 2847 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2855,22 +2863,22 @@ XOpenDisplay (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2858: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2866: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2861: \$? = $ac_status" >&5 + echo "$as_me:2869: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2864: \"$ac_try\"") >&5 + { (eval echo "$as_me:2872: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2867: \$? = $ac_status" >&5 + echo "$as_me:2875: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:2873: checking for dnet_ntoa in -ldnet" >&5 +echo "$as_me:2881: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2878,7 +2886,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2881 "configure" +#line 2889 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2897,16 +2905,16 @@ dnet_ntoa (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2900: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2908: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2903: \$? = $ac_status" >&5 + echo "$as_me:2911: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2906: \"$ac_try\"") >&5 + { (eval echo "$as_me:2914: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2909: \$? = $ac_status" >&5 + echo "$as_me:2917: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else @@ -2917,14 +2925,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2920: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +echo "$as_me:2928: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then - echo "$as_me:2927: checking for dnet_ntoa in -ldnet_stub" >&5 + echo "$as_me:2935: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2932,7 +2940,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 2935 "configure" +#line 2943 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -2951,16 +2959,16 @@ dnet_ntoa (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:2954: \"$ac_link\"") >&5 +if { (eval echo "$as_me:2962: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:2957: \$? = $ac_status" >&5 + echo "$as_me:2965: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:2960: \"$ac_try\"") >&5 + { (eval echo "$as_me:2968: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2963: \$? = $ac_status" >&5 + echo "$as_me:2971: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else @@ -2971,7 +2979,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:2974: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +echo "$as_me:2982: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" @@ -2990,13 +2998,13 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. - echo "$as_me:2993: checking for gethostbyname" >&5 + echo "$as_me:3001: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2999 "configure" +#line 3007 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. */ @@ -3027,16 +3035,16 @@ f = gethostbyname; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3030: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3038: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3033: \$? = $ac_status" >&5 + echo "$as_me:3041: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3036: \"$ac_try\"") >&5 + { (eval echo "$as_me:3044: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3039: \$? = $ac_status" >&5 + echo "$as_me:3047: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else @@ -3046,11 +3054,11 @@ ac_cv_func_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3049: result: $ac_cv_func_gethostbyname" >&5 +echo "$as_me:3057: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then - echo "$as_me:3053: checking for gethostbyname in -lnsl" >&5 + echo "$as_me:3061: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3058,7 +3066,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3061 "configure" +#line 3069 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3077,16 +3085,16 @@ gethostbyname (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3080: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3088: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3083: \$? = $ac_status" >&5 + echo "$as_me:3091: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3086: \"$ac_try\"") >&5 + { (eval echo "$as_me:3094: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3089: \$? = $ac_status" >&5 + echo "$as_me:3097: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else @@ -3097,14 +3105,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3100: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "$as_me:3108: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then - echo "$as_me:3107: checking for gethostbyname in -lbsd" >&5 + echo "$as_me:3115: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3112,7 +3120,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3115 "configure" +#line 3123 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3131,16 +3139,16 @@ gethostbyname (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3134: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3142: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3137: \$? = $ac_status" >&5 + echo "$as_me:3145: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3140: \"$ac_try\"") >&5 + { (eval echo "$as_me:3148: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3143: \$? = $ac_status" >&5 + echo "$as_me:3151: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else @@ -3151,7 +3159,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3154: result: $ac_cv_lib_bsd_gethostbyname" >&5 +echo "$as_me:3162: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" @@ -3167,13 +3175,13 @@ fi # variants that don't use the nameserver (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. - echo "$as_me:3170: checking for connect" >&5 + echo "$as_me:3178: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3176 "configure" +#line 3184 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. */ @@ -3204,16 +3212,16 @@ f = connect; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3207: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3215: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3210: \$? = $ac_status" >&5 + echo "$as_me:3218: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3213: \"$ac_try\"") >&5 + { (eval echo "$as_me:3221: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3216: \$? = $ac_status" >&5 + echo "$as_me:3224: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else @@ -3223,11 +3231,11 @@ ac_cv_func_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3226: result: $ac_cv_func_connect" >&5 +echo "$as_me:3234: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then - echo "$as_me:3230: checking for connect in -lsocket" >&5 + echo "$as_me:3238: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3235,7 +3243,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3238 "configure" +#line 3246 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3254,16 +3262,16 @@ connect (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3257: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3265: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3260: \$? = $ac_status" >&5 + echo "$as_me:3268: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3263: \"$ac_try\"") >&5 + { (eval echo "$as_me:3271: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3266: \$? = $ac_status" >&5 + echo "$as_me:3274: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else @@ -3274,7 +3282,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3277: result: $ac_cv_lib_socket_connect" >&5 +echo "$as_me:3285: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" @@ -3283,13 +3291,13 @@ fi fi # Guillermo Gomez says -lposix is necessary on A/UX. - echo "$as_me:3286: checking for remove" >&5 + echo "$as_me:3294: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3292 "configure" +#line 3300 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. */ @@ -3320,16 +3328,16 @@ f = remove; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3323: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3331: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3326: \$? = $ac_status" >&5 + echo "$as_me:3334: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3329: \"$ac_try\"") >&5 + { (eval echo "$as_me:3337: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3332: \$? = $ac_status" >&5 + echo "$as_me:3340: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else @@ -3339,11 +3347,11 @@ ac_cv_func_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3342: result: $ac_cv_func_remove" >&5 +echo "$as_me:3350: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then - echo "$as_me:3346: checking for remove in -lposix" >&5 + echo "$as_me:3354: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3351,7 +3359,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3354 "configure" +#line 3362 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3370,16 +3378,16 @@ remove (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3373: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3381: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3376: \$? = $ac_status" >&5 + echo "$as_me:3384: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3379: \"$ac_try\"") >&5 + { (eval echo "$as_me:3387: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3382: \$? = $ac_status" >&5 + echo "$as_me:3390: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else @@ -3390,7 +3398,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3393: result: $ac_cv_lib_posix_remove" >&5 +echo "$as_me:3401: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" @@ -3399,13 +3407,13 @@ fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - echo "$as_me:3402: checking for shmat" >&5 + echo "$as_me:3410: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3408 "configure" +#line 3416 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. */ @@ -3436,16 +3444,16 @@ f = shmat; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3439: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3447: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3442: \$? = $ac_status" >&5 + echo "$as_me:3450: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3445: \"$ac_try\"") >&5 + { (eval echo "$as_me:3453: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3448: \$? = $ac_status" >&5 + echo "$as_me:3456: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else @@ -3455,11 +3463,11 @@ ac_cv_func_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3458: result: $ac_cv_func_shmat" >&5 +echo "$as_me:3466: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then - echo "$as_me:3462: checking for shmat in -lipc" >&5 + echo "$as_me:3470: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3467,7 +3475,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3470 "configure" +#line 3478 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3486,16 +3494,16 @@ shmat (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3489: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3497: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3492: \$? = $ac_status" >&5 + echo "$as_me:3500: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3495: \"$ac_try\"") >&5 + { (eval echo "$as_me:3503: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3498: \$? = $ac_status" >&5 + echo "$as_me:3506: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else @@ -3506,7 +3514,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3509: result: $ac_cv_lib_ipc_shmat" >&5 +echo "$as_me:3517: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" @@ -3524,7 +3532,7 @@ fi # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry - echo "$as_me:3527: checking for IceConnectionNumber in -lICE" >&5 + echo "$as_me:3535: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3532,7 +3540,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3535 "configure" +#line 3543 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3551,16 +3559,16 @@ IceConnectionNumber (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3554: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3562: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3557: \$? = $ac_status" >&5 + echo "$as_me:3565: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3560: \"$ac_try\"") >&5 + { (eval echo "$as_me:3568: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3563: \$? = $ac_status" >&5 + echo "$as_me:3571: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else @@ -3571,7 +3579,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3574: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +echo "$as_me:3582: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" @@ -3590,7 +3598,7 @@ else FSLIB="" fi -echo "$as_me:3593: checking for jpeg_start_compress in -ljpeg" >&5 +echo "$as_me:3601: checking for jpeg_start_compress in -ljpeg" >&5 echo $ECHO_N "checking for jpeg_start_compress in -ljpeg... $ECHO_C" >&6 if test "${ac_cv_lib_jpeg_jpeg_start_compress+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3598,7 +3606,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ljpeg $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3601 "configure" +#line 3609 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3617,16 +3625,16 @@ jpeg_start_compress (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3620: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3628: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3623: \$? = $ac_status" >&5 + echo "$as_me:3631: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3626: \"$ac_try\"") >&5 + { (eval echo "$as_me:3634: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3629: \$? = $ac_status" >&5 + echo "$as_me:3637: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_jpeg_jpeg_start_compress=yes else @@ -3637,7 +3645,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3640: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5 +echo "$as_me:3648: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5 echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_start_compress" >&6 if test $ac_cv_lib_jpeg_jpeg_start_compress = yes; then JPEG="found" @@ -3652,7 +3660,7 @@ fi LIBALSA="" if test "$enable_alsa" != "no"; then - echo "$as_me:3655: checking for snd_seq_open in -lasound" >&5 + echo "$as_me:3663: checking for snd_seq_open in -lasound" >&5 echo $ECHO_N "checking for snd_seq_open in -lasound... $ECHO_C" >&6 if test "${ac_cv_lib_asound_snd_seq_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3660,7 +3668,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3663 "configure" +#line 3671 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3679,16 +3687,16 @@ snd_seq_open (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3682: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3690: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3685: \$? = $ac_status" >&5 + echo "$as_me:3693: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3688: \"$ac_try\"") >&5 + { (eval echo "$as_me:3696: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3691: \$? = $ac_status" >&5 + echo "$as_me:3699: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_asound_snd_seq_open=yes else @@ -3699,7 +3707,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3702: result: $ac_cv_lib_asound_snd_seq_open" >&5 +echo "$as_me:3710: result: $ac_cv_lib_asound_snd_seq_open" >&5 echo "${ECHO_T}$ac_cv_lib_asound_snd_seq_open" >&6 if test $ac_cv_lib_asound_snd_seq_open = yes; then cat >>confdefs.h <<\EOF @@ -3714,7 +3722,7 @@ fi LIRC="" if test "$enable_lirc" != "no"; then - echo "$as_me:3717: checking for lirc_init in -llirc_client" >&5 + echo "$as_me:3725: checking for lirc_init in -llirc_client" >&5 echo $ECHO_N "checking for lirc_init in -llirc_client... $ECHO_C" >&6 if test "${ac_cv_lib_lirc_client_lirc_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3722,7 +3730,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-llirc_client $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3725 "configure" +#line 3733 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3741,16 +3749,16 @@ lirc_init (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3744: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3752: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3747: \$? = $ac_status" >&5 + echo "$as_me:3755: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3750: \"$ac_try\"") >&5 + { (eval echo "$as_me:3758: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3753: \$? = $ac_status" >&5 + echo "$as_me:3761: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_lirc_client_lirc_init=yes else @@ -3761,7 +3769,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3764: result: $ac_cv_lib_lirc_client_lirc_init" >&5 +echo "$as_me:3772: result: $ac_cv_lib_lirc_client_lirc_init" >&5 echo "${ECHO_T}$ac_cv_lib_lirc_client_lirc_init" >&6 if test $ac_cv_lib_lirc_client_lirc_init = yes; then cat >>confdefs.h <<\EOF @@ -3776,7 +3784,7 @@ fi LIBZVBI="" if test "$enable_zvbi" != "no"; then - echo "$as_me:3779: checking for vbi_capture_fd in -lzvbi" >&5 + echo "$as_me:3787: checking for vbi_capture_fd in -lzvbi" >&5 echo $ECHO_N "checking for vbi_capture_fd in -lzvbi... $ECHO_C" >&6 if test "${ac_cv_lib_zvbi_vbi_capture_fd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3784,7 +3792,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lzvbi $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3787 "configure" +#line 3795 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3803,16 +3811,16 @@ vbi_capture_fd (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3806: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3814: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3809: \$? = $ac_status" >&5 + echo "$as_me:3817: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3812: \"$ac_try\"") >&5 + { (eval echo "$as_me:3820: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3815: \$? = $ac_status" >&5 + echo "$as_me:3823: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_zvbi_vbi_capture_fd=yes else @@ -3823,7 +3831,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3826: result: $ac_cv_lib_zvbi_vbi_capture_fd" >&5 +echo "$as_me:3834: result: $ac_cv_lib_zvbi_vbi_capture_fd" >&5 echo "${ECHO_T}$ac_cv_lib_zvbi_vbi_capture_fd" >&6 if test $ac_cv_lib_zvbi_vbi_capture_fd = yes; then cat >>confdefs.h <<\EOF @@ -3838,7 +3846,7 @@ fi AALIBS="" if test "$enable_aa" != "no"; then - echo "$as_me:3841: checking for aa_autoinit in -laa" >&5 + echo "$as_me:3849: checking for aa_autoinit in -laa" >&5 echo $ECHO_N "checking for aa_autoinit in -laa... $ECHO_C" >&6 if test "${ac_cv_lib_aa_aa_autoinit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3846,7 +3854,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-laa $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3849 "configure" +#line 3857 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3865,16 +3873,16 @@ aa_autoinit (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3868: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3876: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3871: \$? = $ac_status" >&5 + echo "$as_me:3879: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3874: \"$ac_try\"") >&5 + { (eval echo "$as_me:3882: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3877: \$? = $ac_status" >&5 + echo "$as_me:3885: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_aa_aa_autoinit=yes else @@ -3885,7 +3893,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3888: result: $ac_cv_lib_aa_aa_autoinit" >&5 +echo "$as_me:3896: result: $ac_cv_lib_aa_aa_autoinit" >&5 echo "${ECHO_T}$ac_cv_lib_aa_aa_autoinit" >&6 if test $ac_cv_lib_aa_aa_autoinit = yes; then FOUND_AALIB="yes" @@ -3902,7 +3910,7 @@ else fi if test "$enable_quicktime" != "no"; then - echo "$as_me:3905: checking for lqt_query_registry in -lquicktime" >&5 + echo "$as_me:3913: checking for lqt_query_registry in -lquicktime" >&5 echo $ECHO_N "checking for lqt_query_registry in -lquicktime... $ECHO_C" >&6 if test "${ac_cv_lib_quicktime_lqt_query_registry+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3910,7 +3918,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lquicktime -ldl -lglib $LIBPTHREAD $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3913 "configure" +#line 3921 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3929,16 +3937,16 @@ lqt_query_registry (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3932: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3940: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3935: \$? = $ac_status" >&5 + echo "$as_me:3943: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3938: \"$ac_try\"") >&5 + { (eval echo "$as_me:3946: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3941: \$? = $ac_status" >&5 + echo "$as_me:3949: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_quicktime_lqt_query_registry=yes else @@ -3949,7 +3957,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:3952: result: $ac_cv_lib_quicktime_lqt_query_registry" >&5 +echo "$as_me:3960: result: $ac_cv_lib_quicktime_lqt_query_registry" >&5 echo "${ECHO_T}$ac_cv_lib_quicktime_lqt_query_registry" >&6 if test $ac_cv_lib_quicktime_lqt_query_registry = yes; then FOUND_LQT="yes"; cat >>confdefs.h <<\EOF @@ -3968,7 +3976,7 @@ fi if test "$enable_xfree_ext" != "no"; then -echo "$as_me:3971: checking for XF86DGAQueryExtension in -lXxf86dga" >&5 +echo "$as_me:3979: checking for XF86DGAQueryExtension in -lXxf86dga" >&5 echo $ECHO_N "checking for XF86DGAQueryExtension in -lXxf86dga... $ECHO_C" >&6 if test "${ac_cv_lib_Xxf86dga_XF86DGAQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3976,7 +3984,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXxf86dga $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 3979 "configure" +#line 3987 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -3995,16 +4003,16 @@ XF86DGAQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3998: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4006: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4001: \$? = $ac_status" >&5 + echo "$as_me:4009: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4004: \"$ac_try\"") >&5 + { (eval echo "$as_me:4012: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4007: \$? = $ac_status" >&5 + echo "$as_me:4015: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xxf86dga_XF86DGAQueryExtension=yes else @@ -4015,7 +4023,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4018: result: $ac_cv_lib_Xxf86dga_XF86DGAQueryExtension" >&5 +echo "$as_me:4026: result: $ac_cv_lib_Xxf86dga_XF86DGAQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xxf86dga_XF86DGAQueryExtension" >&6 if test $ac_cv_lib_Xxf86dga_XF86DGAQueryExtension = yes; then cat >>confdefs.h <<EOF @@ -4026,7 +4034,7 @@ EOF fi -echo "$as_me:4029: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5 +echo "$as_me:4037: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5 echo $ECHO_N "checking for XF86VidModeQueryExtension in -lXxf86vm... $ECHO_C" >&6 if test "${ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4034,7 +4042,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXxf86vm $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4037 "configure" +#line 4045 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4053,16 +4061,16 @@ XF86VidModeQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4056: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4064: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4059: \$? = $ac_status" >&5 + echo "$as_me:4067: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4062: \"$ac_try\"") >&5 + { (eval echo "$as_me:4070: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4065: \$? = $ac_status" >&5 + echo "$as_me:4073: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension=yes else @@ -4073,7 +4081,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4076: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&5 +echo "$as_me:4084: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&6 if test $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension = yes; then cat >>confdefs.h <<EOF @@ -4084,7 +4092,7 @@ EOF fi -echo "$as_me:4087: checking for DPMSQueryExtension in -lXdpms" >&5 +echo "$as_me:4095: checking for DPMSQueryExtension in -lXdpms" >&5 echo $ECHO_N "checking for DPMSQueryExtension in -lXdpms... $ECHO_C" >&6 if test "${ac_cv_lib_Xdpms_DPMSQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4092,7 +4100,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXdpms $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4095 "configure" +#line 4103 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4111,16 +4119,16 @@ DPMSQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4114: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4122: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4117: \$? = $ac_status" >&5 + echo "$as_me:4125: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4120: \"$ac_try\"") >&5 + { (eval echo "$as_me:4128: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4123: \$? = $ac_status" >&5 + echo "$as_me:4131: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xdpms_DPMSQueryExtension=yes else @@ -4131,7 +4139,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4134: result: $ac_cv_lib_Xdpms_DPMSQueryExtension" >&5 +echo "$as_me:4142: result: $ac_cv_lib_Xdpms_DPMSQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xdpms_DPMSQueryExtension" >&6 if test $ac_cv_lib_Xdpms_DPMSQueryExtension = yes; then cat >>confdefs.h <<EOF @@ -4143,7 +4151,7 @@ EOF fi if test "$ac_cv_lib_Xdpms_DPMSQueryExtension" = "no"; then - echo "$as_me:4146: checking for DPMSQueryExtension in -lXext" >&5 + echo "$as_me:4154: checking for DPMSQueryExtension in -lXext" >&5 echo $ECHO_N "checking for DPMSQueryExtension in -lXext... $ECHO_C" >&6 if test "${ac_cv_lib_Xext_DPMSQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4151,7 +4159,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXext $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4154 "configure" +#line 4162 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4170,16 +4178,16 @@ DPMSQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4173: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4181: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4176: \$? = $ac_status" >&5 + echo "$as_me:4184: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4179: \"$ac_try\"") >&5 + { (eval echo "$as_me:4187: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4182: \$? = $ac_status" >&5 + echo "$as_me:4190: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xext_DPMSQueryExtension=yes else @@ -4190,7 +4198,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4193: result: $ac_cv_lib_Xext_DPMSQueryExtension" >&5 +echo "$as_me:4201: result: $ac_cv_lib_Xext_DPMSQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xext_DPMSQueryExtension" >&6 if test $ac_cv_lib_Xext_DPMSQueryExtension = yes; then cat >>confdefs.h <<\EOF @@ -4201,7 +4209,7 @@ fi fi -echo "$as_me:4204: checking for XineramaQueryExtension in -lXinerama" >&5 +echo "$as_me:4212: checking for XineramaQueryExtension in -lXinerama" >&5 echo $ECHO_N "checking for XineramaQueryExtension in -lXinerama... $ECHO_C" >&6 if test "${ac_cv_lib_Xinerama_XineramaQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4209,7 +4217,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXinerama $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4212 "configure" +#line 4220 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4228,16 +4236,16 @@ XineramaQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4231: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4239: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4234: \$? = $ac_status" >&5 + echo "$as_me:4242: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4237: \"$ac_try\"") >&5 + { (eval echo "$as_me:4245: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4240: \$? = $ac_status" >&5 + echo "$as_me:4248: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xinerama_XineramaQueryExtension=yes else @@ -4248,7 +4256,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4251: result: $ac_cv_lib_Xinerama_XineramaQueryExtension" >&5 +echo "$as_me:4259: result: $ac_cv_lib_Xinerama_XineramaQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xinerama_XineramaQueryExtension" >&6 if test $ac_cv_lib_Xinerama_XineramaQueryExtension = yes; then cat >>confdefs.h <<EOF @@ -4265,7 +4273,7 @@ fi if test "$enable_xvideo" != "no"; then -echo "$as_me:4268: checking for XvQueryExtension in -lXv" >&5 +echo "$as_me:4276: checking for XvQueryExtension in -lXv" >&5 echo $ECHO_N "checking for XvQueryExtension in -lXv... $ECHO_C" >&6 if test "${ac_cv_lib_Xv_XvQueryExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4273,7 +4281,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXv $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4276 "configure" +#line 4284 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4292,16 +4300,16 @@ XvQueryExtension (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4295: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4303: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4298: \$? = $ac_status" >&5 + echo "$as_me:4306: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4301: \"$ac_try\"") >&5 + { (eval echo "$as_me:4309: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4304: \$? = $ac_status" >&5 + echo "$as_me:4312: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xv_XvQueryExtension=yes else @@ -4312,7 +4320,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4315: result: $ac_cv_lib_Xv_XvQueryExtension" >&5 +echo "$as_me:4323: result: $ac_cv_lib_Xv_XvQueryExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xv_XvQueryExtension" >&6 if test $ac_cv_lib_Xv_XvQueryExtension = yes; then cat >>confdefs.h <<EOF @@ -4328,7 +4336,7 @@ else fi if test "$enable_motif" != "no"; then - echo "$as_me:4331: checking for XmStringGenerate in -lXm" >&5 + echo "$as_me:4339: checking for XmStringGenerate in -lXm" >&5 echo $ECHO_N "checking for XmStringGenerate in -lXm... $ECHO_C" >&6 if test "${ac_cv_lib_Xm_XmStringGenerate+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4336,7 +4344,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lXm $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4339 "configure" +#line 4347 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4355,16 +4363,16 @@ XmStringGenerate (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4358: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4366: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4361: \$? = $ac_status" >&5 + echo "$as_me:4369: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4364: \"$ac_try\"") >&5 + { (eval echo "$as_me:4372: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4367: \$? = $ac_status" >&5 + echo "$as_me:4375: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xm_XmStringGenerate=yes else @@ -4375,7 +4383,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4378: result: $ac_cv_lib_Xm_XmStringGenerate" >&5 +echo "$as_me:4386: result: $ac_cv_lib_Xm_XmStringGenerate" >&5 echo "${ECHO_T}$ac_cv_lib_Xm_XmStringGenerate" >&6 if test $ac_cv_lib_Xm_XmStringGenerate = yes; then FOUND_MOTIF="yes" @@ -4385,15 +4393,17 @@ else echo "*** motif support disabled" fi -echo "$as_me:4388: checking for glXChooseVisual in -lGL" >&5 +LIBGL="" +if test "$enable_gl" != "no"; then + echo "$as_me:4398: checking for glXChooseVisual in -lGL" >&5 echo $ECHO_N "checking for glXChooseVisual in -lGL... $ECHO_C" >&6 if test "${ac_cv_lib_GL_glXChooseVisual+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lGL $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" +LIBS="-lGL $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4396 "configure" +#line 4406 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4412,16 +4422,16 @@ glXChooseVisual (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4415: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4425: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4418: \$? = $ac_status" >&5 + echo "$as_me:4428: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4421: \"$ac_try\"") >&5 + { (eval echo "$as_me:4431: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4424: \$? = $ac_status" >&5 + echo "$as_me:4434: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_GL_glXChooseVisual=yes else @@ -4432,30 +4442,37 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4435: result: $ac_cv_lib_GL_glXChooseVisual" >&5 +echo "$as_me:4445: result: $ac_cv_lib_GL_glXChooseVisual" >&5 echo "${ECHO_T}$ac_cv_lib_GL_glXChooseVisual" >&6 if test $ac_cv_lib_GL_glXChooseVisual = yes; then - FOUND_GL="yes" + cat >>confdefs.h <<\EOF +#define HAVE_GL 1 +EOF + FOUND_GL="yes"; LIBGL="-lGLU -lGL -lm" +fi + +else + echo "*** OpenGL disabled" fi VERSION="`(cd $srcdir; pwd) | sed -e 's/.*-//'`" -echo "$as_me:4443: checking for X11 config directory" >&5 +echo "$as_me:4460: checking for X11 config directory" >&5 echo $ECHO_N "checking for X11 config directory... $ECHO_C" >&6 x11conf=/usr/X11R6/lib/X11 if test -d /etc/X11; then x11conf=/etc/X11 fi -echo "$as_me:4449: result: $x11conf" >&5 +echo "$as_me:4466: result: $x11conf" >&5 echo "${ECHO_T}$x11conf" >&6 -echo "$as_me:4452: checking for X11 app-defaults directory" >&5 +echo "$as_me:4469: checking for X11 app-defaults directory" >&5 echo $ECHO_N "checking for X11 app-defaults directory... $ECHO_C" >&6 resdir=/usr/X11R6/lib/X11 if test -d /etc/X11/app-defaults; then resdir=/etc/X11 fi -echo "$as_me:4458: result: $resdir/app-defaults" >&5 +echo "$as_me:4475: result: $resdir/app-defaults" >&5 echo "${ECHO_T}$resdir/app-defaults" >&6 cat >>confdefs.h <<\EOF @@ -4542,7 +4559,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:4545: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:4562: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -4715,7 +4732,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:4718: error: ambiguous option: $1 + { { echo "$as_me:4735: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -4734,7 +4751,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:4737: error: unrecognized option: $1 + -*) { { echo "$as_me:4754: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -4772,7 +4789,7 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "xawtv.spec" ) CONFIG_FILES="$CONFIG_FILES xawtv.spec" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:4775: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:4792: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -4887,11 +4904,13 @@ s,@ATHENA@,$ATHENA,;t t s,@FSLIB@,$FSLIB,;t t s,@SUBS@,$SUBS,;t t s,@TOOLS@,$TOOLS,;t t +s,@LDLIBS@,$LDLIBS,;t t s,@LIBALSA@,$LIBALSA,;t t s,@LIRC@,$LIRC,;t t s,@LIBZVBI@,$LIBZVBI,;t t s,@AALIBS@,$AALIBS,;t t s,@QTLIBS@,$QTLIBS,;t t +s,@LIBGL@,$LIBGL,;t t s,@VERSION@,$VERSION,;t t s,@x11conf@,$x11conf,;t t s,@resdir@,$resdir,;t t @@ -5009,7 +5028,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:5012: creating $ac_file" >&5 + { echo "$as_me:5031: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -5027,7 +5046,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:5030: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5049: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5040,7 +5059,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5043: error: cannot find input file: $f" >&5 + { { echo "$as_me:5062: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5101,7 +5120,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:5104: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:5123: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -5112,7 +5131,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:5115: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5134: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5125,7 +5144,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5128: error: cannot find input file: $f" >&5 + { { echo "$as_me:5147: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5242,7 +5261,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:5245: $ac_file is unchanged" >&5 + { echo "$as_me:5264: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/configure.ac b/configure.ac index 55f7c2e..30d7732 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,8 @@ AC_ARG_ENABLE(alsa, [ --enable-alsa enable alsa support]) AC_ARG_ENABLE(zvbi, [ --enable-zvbi enable vbi support (via libzvbi)]) +AC_ARG_ENABLE(zvbi, + [ --enable-gl enable opengl support]) dnl --------------------------------------------------------------------- @@ -52,6 +54,7 @@ FOUND_LQT="no" FOUND_MOTIF="no" FOUND_OS="unknown" FOUND_X11="no" +FOUND_GL="no" FOUND_ZVBI="no" case "`uname -s`" in @@ -62,6 +65,7 @@ case "`uname -s`" in # *BSD has important stuff (from ports) # in /usr/local ... CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib" + LDLIBS="$LDLIBS -L/usr/local/lib" FOUND_OS="bsd" ;; *) @@ -133,6 +137,7 @@ AC_SUBST(ATHENA) AC_SUBST(FSLIB) AC_SUBST(SUBS) AC_SUBST(TOOLS) +AC_SUBST(LDLIBS) AC_CHECK_LIB(jpeg, jpeg_start_compress, JPEG="found",,) if test "$JPEG" != "found"; then @@ -227,8 +232,15 @@ else echo "*** motif support disabled" fi -AC_CHECK_LIB(GL, glXChooseVisual, [ FOUND_GL="yes" ],, - $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS) +AC_SUBST(LIBGL) +LIBGL="" +if test "$enable_gl" != "no"; then + AC_CHECK_LIB(GL, glXChooseVisual, + AC_DEFINE(HAVE_GL) FOUND_GL="yes"; LIBGL="-lGLU -lGL -lm",, + $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm) +else + echo "*** OpenGL disabled" +fi VERSION="`(cd $srcdir; pwd) | sed -e 's/.*-//'`" AC_SUBST(VERSION) diff --git a/console/Subdir.mk b/console/Subdir.mk index 8f166d4..b44b8c3 100644 --- a/console/Subdir.mk +++ b/console/Subdir.mk @@ -63,16 +63,16 @@ console/record: console/record.o console/v4l-conf: console/v4l-conf.o # libraries to link -console/fbtv : LDLIBS := \ +console/fbtv : LDLIBS += \ $(THREAD_LIBS) $(CURSES_LIBS) $(LIRC_LIBS) $(ALSA_LIBS) \ $(FS_LIBS) -ljpeg -lm -console/ttv : LDLIBS := $(THREAD_LIBS) $(AA_LIBS) -ljpeg -lm -console/scantv : LDLIBS := $(THREAD_LIBS) $(VBI_LIBS) -ljpeg -console/streamer : LDLIBS := $(THREAD_LIBS) -ljpeg -lm -console/webcam : LDLIBS := $(THREAD_LIBS) -ljpeg -console/radio : LDLIBS := $(CURSES_LIBS) -console/record : LDLIBS := $(CURSES_LIBS) -console/v4l-conf : LDLIBS := $(ATHENA_LIBS) +console/ttv : LDLIBS += $(THREAD_LIBS) $(AA_LIBS) -ljpeg -lm +console/scantv : LDLIBS += $(THREAD_LIBS) $(VBI_LIBS) -ljpeg +console/streamer : LDLIBS += $(THREAD_LIBS) -ljpeg -lm +console/webcam : LDLIBS += $(THREAD_LIBS) -ljpeg -lm +console/radio : LDLIBS += $(CURSES_LIBS) +console/record : LDLIBS += $(CURSES_LIBS) +console/v4l-conf : LDLIBS += $(ATHENA_LIBS) # linker flags console/fbtv : LDFLAGS := $(DLFLAGS) diff --git a/console/fbtools.c b/console/fbtools.c index b094aa5..bc13a1f 100644 --- a/console/fbtools.c +++ b/console/fbtools.c @@ -74,6 +74,17 @@ struct DEVS devs_devfs = { }; struct DEVS *devices; +static void dev_init(void) +{ + struct stat dummy; + + if (NULL != devices) + return; + if (0 == stat("/dev/.devfsd",&dummy)) + devices = &devs_devfs; + else + devices = &devs_default; +} /* -------------------------------------------------------------------- */ /* console switching */ @@ -288,6 +299,29 @@ fb_setvt(int vtno) } } +int fb_probe(void) +{ + struct fb_con2fbmap c2m; + struct stat st; + int fb; + + dev_init(); + fstat(0,&st); + if (((st.st_rdev >> 8) & 0xff) != TTY_MAJOR) + /* not a linux console */ + return -1; + if (-1 == (fb = open(devices->fb0,O_WRONLY,0))) + /* can't open /dev/fb0 */ + return -1; + + c2m.console = st.st_rdev & 0xff; + if (-1 == ioctl(fb, FBIOGET_CON2FBMAP, &c2m)) + /* ??? */ + return -1; + close(fb); + return 0; +} + int fb_init(char *device, char *mode, int vt) { @@ -299,6 +333,7 @@ fb_init(char *device, char *mode, int vt) fb_setvt(vt); /* FIXME: where are MAJOR() / MINOR() ??? */ + dev_init(); fstat(tty,&st); if (((st.st_rdev >> 8) & 0xff) != TTY_MAJOR) { /* catch that here, give a more user friendly error message that just @@ -308,13 +343,6 @@ fb_init(char *device, char *mode, int vt) " tool from a pseudo tty (xterm/ssh/screen/...).\n"); exit(1); } - if (NULL == devices) { - struct stat dummy; - if (0 == stat("/dev/.devfsd",&dummy)) - devices = &devs_devfs; - else - devices = &devs_default; - } if (NULL == device) { device = getenv("FRAMEBUFFER"); diff --git a/console/fbtools.h b/console/fbtools.h index a501c2f..469675c 100644 --- a/console/fbtools.h +++ b/console/fbtools.h @@ -11,6 +11,7 @@ extern int fb_mem_offset; extern int fb_switch_state; /* init + cleanup */ +int fb_probe(void); int fb_init(char *device, char *mode, int vt); void fb_cleanup(void); void fb_catch_exit_signals(void); diff --git a/console/fbtv.c b/console/fbtv.c index 5eb9c7c..5104246 100644 --- a/console/fbtv.c +++ b/console/fbtv.c @@ -648,7 +648,7 @@ main(int argc, char *argv[]) if (optarg) vt = strtoul(optarg, 0, 0); else - vt = -1; + vt = 0; break; case 'j': joydev = optarg; diff --git a/console/showriff.c b/console/showriff.c index e069fd8..c2240b9 100644 --- a/console/showriff.c +++ b/console/showriff.c @@ -72,6 +72,10 @@ typedef unsigned char boolean; #define audstag MAKEFOURCC('a','u','d','s') #define dmlhtag MAKEFOURCC('d','m','l','h') +#define avi_tag MAKEFOURCC('A','V','I',' ') +#define wavetag MAKEFOURCC('W','A','V','E') +#define fmt_tag MAKEFOURCC('f','m','t',' ') + #define MJPGtag MAKEFOURCC('M','J','P','G') #define _00dbtag MAKEFOURCC('0','0','d','b') #define _00dctag MAKEFOURCC('0','0','d','c') @@ -96,6 +100,7 @@ static void FOURCC2Str(FOURCC fcc, char* s) } static DWORD fcc_type; +static DWORD riff_type; static int stop_on_errors = 1; static int print_mjpeg = 0; @@ -429,10 +434,11 @@ static boolean ProcessChunk(FILE* f, off_t filepos, off_t filesize, FOURCC2Str(formtype,formstr); /* make it printable */ /* print out the indented form of the chunk: */ - if (chunkid==RIFFtag) + if (chunkid==RIFFtag) { printf("%12c %*c Form Type = <%s>\n", ' ',(RekDepth+1)*4,' ',formstr); - else + riff_type = formtype; + } else printf("%12c %*c List Type = <%s>\n", ' ',(RekDepth+1)*4,' ',formstr); @@ -483,6 +489,10 @@ static boolean ProcessChunk(FILE* f, off_t filepos, off_t filesize, break; } break; + case fmt_tag: + if (riff_type == wavetag) + dump_vals(f,sizeof(names_strf_auds)/sizeof(char*),names_strf_auds); + break; case dmlhtag: dump_vals(f,sizeof(names_dmlh)/sizeof(struct VAL),names_dmlh); break; diff --git a/console/vbi-tty.c b/console/vbi-tty.c index ae28bd0..07b09c4 100644 --- a/console/vbi-tty.c +++ b/console/vbi-tty.c @@ -19,8 +19,11 @@ #include <sys/types.h> #include <sys/ioctl.h> +#include <linux/fb.h> + #include "vbi-data.h" #include "vbi-tty.h" +#include "fbtools.h" /* --------------------------------------------------------------------- */ @@ -48,6 +51,30 @@ static void tty_restore(void) tcsetattr (0, TCSANOW, &saved_attributes); } +/* FIXME: Yes, I know, hardcoding ANSI sequences is bad. ncurses + * can't handle multibyte locales like UTF-8 not yet, that's why that + * dirty hack for now ... */ +static void tty_clear(void) +{ + fprintf(stderr,"\033[H\033[2J"); +} + +static void tty_goto(int x, int y) +{ + fprintf(stderr,"\033[%d;%dH",y,x); +} + +/* --------------------------------------------------------------------- */ + +static int have_fb = 0; +static int fb_fmt = VBI_PIXFMT_RGBA32_LE; +static int switch_last; + +static void fb_clear(void) +{ + fb_memset(fb_mem+fb_mem_offset,0,fb_fix.smem_len); +} + /* --------------------------------------------------------------------- */ struct vbi_tty { @@ -106,12 +133,22 @@ vbi_render_page(struct vbi_tty *tty) vbi_fetch_vt_page(tty->vbi->dec,&tty->pg,tty->pgno,tty->subno, VBI_WST_LEVEL_1p5,25,1); vbi_fix_head(tty,tty->pg.text); - len = vbi_export_txt(data,nl_langinfo(CODESET),25*41*8, - &tty->pg,&vbi_fullrect,VBI_ANSICOLOR); - fprintf(stderr,"\033[H"); - fwrite(data,len,1,stderr); - fprintf(stderr,"\033[0;42H"); - free(data); + if (have_fb) { + vbi_draw_vt_page_region(&tty->pg, fb_fmt, + fb_mem + fb_mem_offset, + fb_fix.line_length, + 0,0, + tty->pg.columns, tty->pg.rows, + 0,1); + + } else { + len = vbi_export_txt(data,nl_langinfo(CODESET),25*41*8, + &tty->pg,&vbi_fullrect,VBI_ANSICOLOR); + tty_goto(0,0); + fwrite(data,len,1,stderr); + tty_goto(42,0); + free(data); + } } static void @@ -129,12 +166,22 @@ vbi_render_head(struct vbi_tty *tty, int pgno, int subno) vbi_fetch_vt_page(tty->vbi->dec,&pg,pgno,subno, VBI_WST_LEVEL_1p5,1,1); vbi_fix_head(tty,pg.text); - len = vbi_export_txt(data,nl_langinfo(CODESET),41*8, - &pg,&head,VBI_ANSICOLOR); - fprintf(stderr,"\033[H"); - fwrite(data,len,1,stderr); - fprintf(stderr,"\033[0;42H"); - free(data); + if (have_fb) { + vbi_draw_vt_page_region(&pg, fb_fmt, + fb_mem + fb_mem_offset, + fb_fix.line_length, + 0,0, + pg.columns, 1, + 0,1); + + } else { + len = vbi_export_txt(data,nl_langinfo(CODESET),41*8, + &pg,&head,VBI_ANSICOLOR); + tty_goto(0,0); + fwrite(data,len,1,stderr); + tty_goto(42,0); + free(data); + } } static void @@ -186,13 +233,21 @@ void vbi_tty(char *device, int debug, int sim) if (NULL == vbi) exit(1); - if (-1 != ioctl(0,TIOCGWINSZ,&win) && win.ws_row < 26) { - fprintf(stderr,"terminal too small (need 26 rows, have %d)\n", - win.ws_row); - exit(1); + if (0 /* 0 == fb_probe() */ ) { + have_fb = 1; + fb_init(NULL,NULL,0); + fb_catch_exit_signals(); + fb_switch_init(); + switch_last = fb_switch_state; + } else { + if (-1 != ioctl(0,TIOCGWINSZ,&win) && win.ws_row < 26) { + fprintf(stderr,"Terminal too small (need 26 rows, have %d)\n", + win.ws_row); + exit(1); + } } tty_raw(); - fprintf(stderr,"\033[H\033[2J"); + have_fb ? fb_clear() : tty_clear(); tty = malloc(sizeof(*tty)); memset(tty,0,sizeof(*tty)); @@ -209,10 +264,14 @@ void vbi_tty(char *device, int debug, int sim) rc = select(vbi->fd+1,&set,NULL,NULL,&tv); if (-1 == rc) { tty_restore(); + if (have_fb) + fb_cleanup(); perror("select"); exit(1); } if (0 == rc) { + if (have_fb) + fb_cleanup(); tty_restore(); fprintf(stderr,"oops: timeout\n"); exit(1); @@ -230,7 +289,7 @@ void vbi_tty(char *device, int debug, int sim) break; case 'L' & 0x1f: /* refresh */ - fprintf(stderr,"\033[H\033[2J"); + have_fb ? fb_clear() : tty_clear(); vbi_render_page(tty); break; case 'i': @@ -280,6 +339,8 @@ void vbi_tty(char *device, int debug, int sim) vbi_hasdata(vbi); } } - fprintf(stderr,"\033[H"); + if (have_fb) + fb_cleanup(); + tty_goto(0,0); tty_restore(); } diff --git a/console/webcam.c b/console/webcam.c index 5dbc88e..2d8b3a6 100644 --- a/console/webcam.c +++ b/console/webcam.c @@ -14,6 +14,7 @@ #include <fcntl.h> #include <limits.h> #include <pthread.h> +#include <math.h> #include <sys/time.h> #include <sys/mman.h> #include <sys/ioctl.h> @@ -24,6 +25,7 @@ #include "parseconfig.h" #include "list.h" + /* ---------------------------------------------------------------------- */ /* configuration */ @@ -333,7 +335,7 @@ grab_init(void) /* check all available conversion functions */ fmt.bytesperline = fmt.width*ng_vfmt_to_depth[fmt.fmtid]/8; for (i = 0;;) { - conv = ng_conv_find(fmt.fmtid, &i); + conv = ng_conv_find_to(fmt.fmtid, &i); if (NULL == conv) break; gfmt = fmt; @@ -440,6 +442,98 @@ add_text(char *image, int width, int height) } } +/* ---------------------------------------------------------------------- */ +/* Frederic Helin <Frederic.Helin@inrialpes.fr> - 15/07/2002 */ +/* Correction fonction of stereographic radial distortion */ + +int grab_dist_on = 0; +int grab_dist_k = 700; +int grab_dist_cx = -1; +int grab_dist_cy = -1; +int grab_dist_zoom = 50; +int grab_dist_sensorw = 640; +int grab_dist_sensorh = 480; + +static unsigned char * +correct_distor(unsigned char * in, int width, int height, + int grab_zoom, int grap_k, int cx, int cy, + int grab_sensorw, int grab_sensorh) +{ + static unsigned char * corrimg = NULL; + + int i, j, di, dj; + float dr, cr,ca, sensor_w, sensor_h, sx, zoom, k; + + sensor_w = grab_dist_sensorw/100.0; + sensor_h = grab_dist_sensorh/100.0; + zoom = grab_zoom / 100.0; + k = grap_k / 100.0; + + if (corrimg == NULL && (corrimg = malloc(width*height*3)) == NULL ) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + + sensor_w = 6.4; + sensor_h = 4.8; + + // calc ratio x/y + sx = width * sensor_h / (height * sensor_w); + + // calc new value of k in the coordonates systeme of computer + k = k * height / sensor_h; + + // Clear image + for (i = 0; i < height*width*3; i++) corrimg[i] = 255; + + for (j = 0; j < height ; j++) { + for (i = 0; i < width ; i++) { + + // compute radial distortion / parameters of center of image + cr = sqrt((i-cx)/sx*(i-cx)/sx+(j-cy)*(j-cy)); + ca = atan(cr/k/zoom); + dr = k * tan(ca/2); + + if (i == cx && j == cy) {di = cx; dj = cy;} + else { + di = (i-cx) * dr / cr + cx; + dj = (j-cy) * dr / cr + cy; + } + + if (dj<height && di < width && di >= 0 && dj >= 0 && + j<height && i < width && i >= 0 && j >= 0 ) { + corrimg[3*(j*width + i) ] = in[3*(dj*width + di) ]; + corrimg[3*(j*width + i)+1] = in[3*(dj*width + di)+1]; + corrimg[3*(j*width + i)+2] = in[3*(dj*width + di)+2]; + } + } + } + return corrimg; +} + +/* ---------------------------------------------------------------------- */ + +static unsigned int +compare_images(unsigned char *last, unsigned char *current, + int width, int height) +{ + unsigned char *p1 = last; + unsigned char *p2 = current; + int avg, diff, max, i = width*height*3; + + for (max = 0, avg = 0; --i; p1++,p2++) { + diff = (*p1 < *p2) ? (*p2 - *p1) : (*p1 - *p2); + avg += diff; + if (diff > max) + max = diff; + } + avg = avg / width / height; + fprintf(stderr,"compare: max=%d,avg=%d\n",max,avg); + /* return avg */ + return max; +} + + static unsigned char * rotate_image(unsigned char * in, int *wp, int *hp, int rot, int top, int left, int bottom, int right) @@ -456,7 +550,7 @@ rotate_image(unsigned char * in, int *wp, int *hp, int rot, fprintf(stderr, "out of memory\n"); exit(1); } - switch ( rot ) { + switch (rot) { default: case 0: for (j = 0; j < oh; j++) { @@ -514,25 +608,6 @@ rotate_image(unsigned char * in, int *wp, int *hp, int rot, return rotimg; } -static unsigned int -compare_images(unsigned char *last, unsigned char *current, - int width, int height) -{ - unsigned char *p1 = last; - unsigned char *p2 = current; - int avg, diff, max, i = width*height*3; - - for (max = 0, avg = 0; --i; p1++,p2++) { - diff = (*p1 < *p2) ? (*p2 - *p1) : (*p1 - *p2); - avg += diff; - if (diff > max) - max = diff; - } - avg = avg / width / height; - fprintf(stderr,"compare: max=%d,avg=%d\n",max,avg); - /* return avg */ - return max; -} /* ---------------------------------------------------------------------- */ @@ -609,7 +684,22 @@ main(int argc, char *argv[]) if (-1 != (i = cfg_get_int("grab","bg_blue"))) if (i >= 0 && i <= 255) grab_bg_b = i; - + + if (-1 != (i = cfg_get_int("grab","distor"))) + grab_dist_on = i; + if (-1 != (i = cfg_get_int("grab","distor_k"))) + grab_dist_k = i; + if (-1 != (i = cfg_get_int("grab","distor_cx"))) + grab_dist_cx = i; + if (-1 != (i = cfg_get_int("grab","distor_cy"))) + grab_dist_cy = i; + if (-1 != (i = cfg_get_int("grab","distor_zoom"))) + grab_dist_zoom =i; + if (-1 != (i = cfg_get_int("grab","distor_sensorw"))) + grab_dist_sensorw = i; + if (-1 != (i = cfg_get_int("grab","distor_sensorh"))) + grab_dist_sensorh = i; + if ( grab_top < 0 ) grab_top = 0; if ( grab_left < 0 ) grab_left = 0; if ( grab_bottom > grab_height ) grab_bottom = grab_height; @@ -619,6 +709,19 @@ main(int argc, char *argv[]) if ( grab_top >= grab_bottom ) grab_top = 0; if ( grab_left >= grab_right ) grab_left = 0; + if (grab_dist_k < 1 || grab_dist_k > 10000) + grab_dist_k = 700; + if (grab_dist_cx < 0 || grab_dist_cx > grab_width) + grab_dist_cx = grab_width / 2; + if (grab_dist_cy < 0 || grab_dist_cy > grab_height) + grab_dist_cy = grab_height / 2; + if (grab_dist_zoom < 1 || grab_dist_zoom > 1000) + grab_dist_zoom = 100; + if (grab_dist_sensorw < 1 || grab_dist_sensorw >9999) + grab_dist_sensorw = 640; + if (grab_dist_sensorh < 1 || grab_dist_sensorh >9999) + grab_dist_sensorh = 480; + INIT_LIST_HEAD(&connections); for (sections = cfg_list_sections(); *sections != NULL; sections++) { if (0 == strcasecmp(*sections,"grab")) @@ -708,6 +811,13 @@ main(int argc, char *argv[]) for (;;) { /* grab a new one */ gimg = grab_one(&width,&height); + + if (grab_dist_on) + gimg = correct_distor(gimg, width, height, + grab_dist_zoom, grab_dist_k, + grab_dist_cx, grab_dist_cy, + grab_dist_sensorw, grab_dist_sensorh); + image = rotate_image(gimg, &width, &height, grab_rotate, grab_top, grab_left, grab_bottom, grab_right); diff --git a/contrib/xawtv16x16.xpm b/contrib/xawtv16x16.xpm new file mode 100644 index 0000000..01d8c7a --- /dev/null +++ b/contrib/xawtv16x16.xpm @@ -0,0 +1,200 @@ +/* XPM */ +static char * xawtv16x16[] = { +"16 16 181 2", +" c None", +". c #8F8E91", +"+ c #969397", +"@ c #979499", +"# c #979497", +"$ c #918E92", +"% c #949196", +"& c #949195", +"* c #939094", +"= c #979498", +"- c #979599", +"; c #959296", +"> c #928F91", +", c #8F8C8F", +"' c #858487", +") c #818184", +"! c #878789", +"~ c #8A898C", +"{ c #232228", +"] c #16161A", +"^ c #151519", +"/ c #16151A", +"( c #161519", +"_ c #15141A", +": c #14141A", +"< c #14131A", +"[ c #141319", +"} c #24242D", +"| c #767478", +"1 c #8D8B90", +"2 c #0E0D10", +"3 c #000000", +"4 c #000101", +"5 c #020204", +"6 c #101011", +"7 c #19181C", +"8 c #7A777B", +"9 c #8F8E93", +"0 c #0C0C10", +"a c #1F1F20", +"b c #252526", +"c c #282829", +"d c #000001", +"e c #1A1A1C", +"f c #7B797C", +"g c #88878C", +"h c #0C0C0F", +"i c #3B331F", +"j c #B09830", +"k c #554D2D", +"l c #19181A", +"m c #7B787B", +"n c #848287", +"o c #0B0B0E", +"p c #4D4228", +"q c #CAA734", +"r c #867A5C", +"s c #0A0A0B", +"t c #171619", +"u c #767476", +"v c #7B7A80", +"w c #0A0A0D", +"x c #ACACAC", +"y c #EEEDEC", +"z c #E6E6E5", +"A c #060608", +"B c #141416", +"C c #6E6C70", +"D c #77767C", +"E c #1B1B1C", +"F c #EFEFED", +"G c #FCFCFA", +"H c #F5F5F4", +"I c #676767", +"J c #040405", +"K c #121214", +"L c #6A6A6E", +"M c #76767A", +"N c #0A0A0C", +"O c #707070", +"P c #FAFAF8", +"Q c #FDFDFB", +"R c #9A9A9A", +"S c #070708", +"T c #101113", +"U c #66666A", +"V c #747377", +"W c #020100", +"X c #3D2D04", +"Y c #A08E58", +"Z c #F7F7F6", +"` c #9A8D64", +" . c #1E1A0B", +".. c #151413", +"+. c #626266", +"@. c #727177", +"#. c #0C0B0E", +"$. c #362703", +"%. c #F2B90C", +"&. c #E1AE0C", +"*. c #817E72", +"=. c #F4F4F3", +"-. c #C8981D", +";. c #CC9A0A", +">. c #5F4C15", +",. c #605F63", +"'. c #6E6E72", +"). c #433003", +"!. c #EFB60C", +"~. c #F5BC0C", +"{. c #BFA24C", +"]. c #A4A4A3", +"^. c #4A494A", +"/. c #D29E0A", +"(. c #EAB30C", +"_. c #7A6016", +":. c #5E5D62", +"<. c #55AC4D", +"[. c #1A5919", +"}. c #1A8410", +"|. c #204222", +"1. c #1A1A20", +"2. c #18181F", +"3. c #121419", +"4. c #342819", +"5. c #6E541A", +"6. c #4A391A", +"7. c #23761C", +"8. c #24CE12", +"9. c #44C118", +"0. c #3C571C", +"a. c #1D461F", +"b. c #479C40", +"c. c #6A6E6B", +"d. c #30C620", +"e. c #38AA2C", +"f. c #4F684C", +"g. c #31C621", +"h. c #32C422", +"i. c #149914", +"j. c #0F7812", +"k. c #18B410", +"l. c #117E0C", +"m. c #435B3F", +"n. c #35B826", +"o. c #4C6648", +"p. c #3BA22E", +"q. c #3AA42E", +"r. c #50684F", +"s. c #5B5E5C", +"t. c #2AC01A", +"u. c #2FA023", +"v. c #34822C", +"w. c #427A3C", +"x. c #487D43", +"y. c #428E3A", +"z. c #30C61F", +"A. c #2FCB1E", +"B. c #32BB24", +"C. c #514F52", +"D. c #30B421", +"E. c #3E3C3E", +"F. c #2DAA1F", +"G. c #2DAB1F", +"H. c #494849", +"I. c #41C033", +"J. c #3C7A35", +"K. c #3DA831", +"L. c #41793A", +"M. c #32C521", +"N. c #33C124", +"O. c #408439", +"P. c #34A028", +"Q. c #3F6D3A", +"R. c #37942D", +"S. c #4A494B", +"T. c #35AC27", +"U. c #464445", +"V. c #409036", +"W. c #409038", +"X. c #565555", +". + @ # $ % & * = - ; > , ' ) ! ", +"~ { ] ] ] ] ] ^ / ( _ : < [ } | ", +"1 2 3 3 3 3 3 3 3 4 5 6 3 3 7 8 ", +"9 0 3 3 3 3 3 3 3 a b c d 3 e f ", +"g h 3 3 3 3 3 3 3 i j k d 3 l m ", +"n o 3 3 3 3 3 3 3 p q r s 3 t u ", +"v w 3 3 3 3 3 3 3 x y z A 3 B C ", +"D w 3 3 3 3 3 3 E F G H I J K L ", +"M N 3 3 3 3 3 3 O P G Q R S T U ", +"V w 3 3 3 3 W X Y Z G Q ` ...+.", +"@.#.3 3 3 3 $.%.&.*.Q =.-.;.>.,.", +"'.N 3 3 3 3 ).!.~.{.].^./.(._.:.", +"<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.", +"c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.", +"s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.", +"I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X."}; diff --git a/contrib/xawtv32x32.xpm b/contrib/xawtv32x32.xpm new file mode 100644 index 0000000..6b83836 --- /dev/null +++ b/contrib/xawtv32x32.xpm @@ -0,0 +1,626 @@ +/* XPM */ +static char * xawtv32x32[] = { +"32 32 591 2", +" c None", +". c #A4A4A6", +"+ c #9D9C9E", +"@ c #A09EA1", +"# c #9F9D9F", +"$ c #9A999C", +"% c #9C9A9D", +"& c #939194", +"* c #969597", +"= c #989798", +"- c #9A999A", +"; c #979598", +"> c #9E9D9F", +", c #A1A0A1", +"' c #A1A0A2", +") c #9F9EA0", +"! c #9C9B9D", +"~ c #A09FA2", +"{ c #A09EA0", +"] c #9E9D9E", +"^ c #9C9B9C", +"/ c #9A999B", +"( c #969497", +"_ c #8F8F91", +": c #969698", +"< c #959597", +"[ c #979798", +"} c #878789", +"| c #828084", +"1 c #8F8A90", +"2 c #918C92", +"3 c #928D94", +"4 c #908C92", +"5 c #938E93", +"6 c #928E92", +"7 c #918C91", +"8 c #8E8A8F", +"9 c #8E8A90", +"0 c #8F8A91", +"a c #8F8B91", +"b c #8F8A8F", +"c c #8D888D", +"d c #8E898F", +"e c #8B878C", +"f c #878386", +"g c #878385", +"h c #858184", +"i c #837F83", +"j c #7E7B7F", +"k c #77777A", +"l c #737376", +"m c #727176", +"n c #727276", +"o c #838384", +"p c #878689", +"q c #888689", +"r c #42414B", +"s c #2D2C33", +"t c #2D2C34", +"u c #2D2C35", +"v c #2D2B35", +"w c #2C2B34", +"x c #2C2B32", +"y c #2B2B31", +"z c #2A2A30", +"A c #2B2A31", +"B c #2B2A30", +"C c #2A2932", +"D c #292831", +"E c #282730", +"F c #282630", +"G c #26252E", +"H c #25242D", +"I c #3E3E4B", +"J c #78757B", +"K c #706E74", +"L c #909092", +"M c #8A898B", +"N c #1E1D23", +"O c #000000", +"P c #000001", +"Q c #000002", +"R c #000003", +"S c #000103", +"T c #2E2F38", +"U c #7B7A7B", +"V c #757377", +"W c #8A898C", +"X c #8C8A90", +"Y c #1C1C23", +"Z c #000101", +"` c #020204", +" . c #0B0B0C", +".. c #030304", +"+. c #323138", +"@. c #817D82", +"#. c #706F72", +"$. c #8E8D90", +"%. c #8E8C92", +"&. c #1A191F", +"*. c #020203", +"=. c #262626", +"-. c #0D0D0E", +";. c #333137", +">. c #848086", +",. c #717072", +"'. c #929194", +"). c #908E94", +"!. c #19181F", +"~. c #010101", +"{. c #0A0A0B", +"]. c #050506", +"^. c #08080A", +"/. c #131315", +"(. c #040406", +"_. c #010102", +":. c #343338", +"<. c #868287", +"[. c #717071", +"}. c #8D8D8F", +"|. c #8E8C93", +"1. c #19181E", +"2. c #0B0B0B", +"3. c #676767", +"4. c #2A2A2A", +"5. c #5D5D5E", +"6. c #747474", +"7. c #151516", +"8. c #343337", +"9. c #706F70", +"0. c #18181D", +"a. c #1A1A1B", +"b. c #43403A", +"c. c #817240", +"d. c #81774D", +"e. c #54524C", +"f. c #303031", +"g. c #323136", +"h. c #868286", +"i. c #868689", +"j. c #88868D", +"k. c #17161C", +"l. c #100E09", +"m. c #80631E", +"n. c #E0B613", +"o. c #E0C122", +"p. c #A68E23", +"q. c #2B2514", +"r. c #010103", +"s. c #312F34", +"t. c #848085", +"u. c #706F71", +"v. c #868588", +"w. c #85838A", +"x. c #16161C", +"y. c #0D0A03", +"z. c #8F6E1B", +"A. c #E0B711", +"B. c #D8AE11", +"C. c #B18D31", +"D. c #373020", +"E. c #2F2E33", +"F. c #6F6F70", +"G. c #838285", +"H. c #807E85", +"I. c #16151B", +"J. c #0D0D0D", +"K. c #8A8377", +"L. c #B6974D", +"M. c #BC9F63", +"N. c #D7D2C6", +"O. c #5A5959", +"P. c #131314", +"Q. c #2C2C30", +"R. c #79767A", +"S. c #6F6D6E", +"T. c #808083", +"U. c #78777E", +"V. c #14141A", +"W. c #4E4D4E", +"X. c #E4E4E3", +"Y. c #D8D7D6", +"Z. c #EDECEB", +"`. c #FEFEFC", +" + c #C7C7C5", +".+ c #29292D", +"++ c #716F73", +"@+ c #6D6B6C", +"#+ c #74737A", +"$+ c #131319", +"%+ c #858585", +"&+ c #F9F9F8", +"*+ c #F5F5F4", +"=+ c #FCFCFA", +"-+ c #F3F3F2", +";+ c #E2E2E1", +">+ c #121213", +",+ c #28282D", +"'+ c #706E73", +")+ c #6C6A6D", +"!+ c #807F82", +"~+ c #706F76", +"{+ c #0F0F10", +"]+ c #C8C8C7", +"^+ c #FBFBF9", +"/+ c #FAFAF8", +"(+ c #FDFDFB", +"_+ c #F6F6F4", +":+ c #E5E5E4", +"<+ c #848484", +"[+ c #171718", +"}+ c #030305", +"|+ c #010000", +"1+ c #242429", +"2+ c #6D6D71", +"3+ c #6A696D", +"4+ c #7F7F82", +"5+ c #6E6D74", +"6+ c #060607", +"7+ c #555555", +"8+ c #C9C9C8", +"9+ c #383838", +"0+ c #0B0B0D", +"a+ c #222227", +"b+ c #68686C", +"c+ c #69686C", +"d+ c #7E7E80", +"e+ c #6E6D73", +"f+ c #131318", +"g+ c #161617", +"h+ c #B0B0AF", +"i+ c #F9F9F7", +"j+ c #EAEAE8", +"k+ c #434344", +"l+ c #202226", +"m+ c #65666B", +"n+ c #68676B", +"o+ c #818183", +"p+ c #6D6C72", +"q+ c #333333", +"r+ c #F7F7F5", +"s+ c #F2F2F0", +"t+ c #4B4B4B", +"u+ c #0A0A0C", +"v+ c #202225", +"w+ c #626368", +"x+ c #67666A", +"y+ c #6B6A70", +"z+ c #241B04", +"A+ c #5D522E", +"B+ c #CCCBC8", +"C+ c #F6F6F5", +"D+ c #FBFBFA", +"E+ c #EDE8D6", +"F+ c #4B4942", +"G+ c #0C0C0D", +"H+ c #0C0B0B", +"I+ c #202125", +"J+ c #606165", +"K+ c #666569", +"L+ c #6B6A6F", +"M+ c #141319", +"N+ c #060400", +"O+ c #2F2103", +"P+ c #A07709", +"Q+ c #CEA011", +"R+ c #877C5A", +"S+ c #F2F2F1", +"T+ c #F8F8F6", +"U+ c #E6C767", +"V+ c #493D12", +"W+ c #060507", +"X+ c #5A4B0D", +"Y+ c #141001", +"Z+ c #5E5F63", +"`+ c #656468", +" @ c #7D7D80", +".@ c #6A6970", +"+@ c #705107", +"@@ c #EDB30C", +"#@ c #F2BA0C", +"$@ c #F5BD0C", +"%@ c #AD870A", +"&@ c #494846", +"*@ c #D8D8D6", +"=@ c #F0F0EF", +"-@ c #D7AC3C", +";@ c #A07308", +">@ c #7D5A07", +",@ c #D7A40A", +"'@ c #4C3A05", +")@ c #1D1D21", +"!@ c #5D5C61", +"~@ c #646367", +"{@ c #7C7B7F", +"]@ c #69676F", +"^@ c #17171C", +"/@ c #6A4C06", +"(@ c #F4BB0C", +"_@ c #EDB90C", +":@ c #43370C", +"<@ c #9F9F9E", +"[@ c #E8E8E6", +"}@ c #C09525", +"|@ c #E7AE0A", +"1@ c #E8B00B", +"2@ c #C0930A", +"3@ c #534523", +"4@ c #5C5A5F", +"5@ c #636266", +"6@ c #7A7A7D", +"7@ c #65646B", +"8@ c #010100", +"9@ c #755405", +"0@ c #DDB531", +"a@ c #DCD5C3", +"b@ c #F1F1EF", +"c@ c #BDBDBC", +"d@ c #454546", +"e@ c #AE8009", +"f@ c #F3BB0C", +"g@ c #E4AE0C", +"h@ c #8A6E25", +"i@ c #5B585E", +"j@ c #636265", +"k@ c #7A7A7C", +"l@ c #636268", +"m@ c #090601", +"n@ c #8D6406", +"o@ c #E6AD0B", +"p@ c #EEB50C", +"q@ c #F5BC0C", +"r@ c #D8A30D", +"s@ c #6C5931", +"t@ c #585859", +"u@ c #4D4D4E", +"v@ c #1E1E20", +"w@ c #060505", +"x@ c #B58208", +"y@ c #F2B90C", +"z@ c #F1B80C", +"A@ c #CF9B0A", +"B@ c #513C05", +"C@ c #2A2623", +"D@ c #5A585F", +"E@ c #626165", +"F@ c #6E9C6A", +"G@ c #34C925", +"H@ c #10530D", +"I@ c #020408", +"J@ c #051805", +"K@ c #169608", +"L@ c #12720A", +"M@ c #030806", +"N@ c #020206", +"O@ c #090707", +"P@ c #332308", +"Q@ c #5F410A", +"R@ c #91660B", +"S@ c #B8850A", +"T@ c #966708", +"U@ c #2B1D08", +"V@ c #0A3608", +"W@ c #1BB50A", +"X@ c #1CC30A", +"Y@ c #1DC30A", +"Z@ c #49CA0B", +"`@ c #54D90B", +" # c #727E0A", +".# c #1E1507", +"+# c #030307", +"@# c #124313", +"## c #34C326", +"$# c #5A7959", +"%# c #818C82", +"&# c #3AB72D", +"*# c #23C215", +"=# c #324B3A", +"-# c #277D25", +";# c #24E30F", +"># c #385B3C", +",# c #34343E", +"'# c #32323C", +")# c #303339", +"!# c #2F3139", +"~# c #2D2C37", +"{# c #20222B", +"]# c #1F232C", +"^# c #1F1F28", +"/# c #201F29", +"(# c #2D2829", +"_# c #443F2C", +":# c #40382A", +"<# c #27282E", +"[# c #2B482F", +"}# c #3BA331", +"|# c #25EE0F", +"1# c #33C623", +"2# c #429832", +"3# c #31C91A", +"4# c #2E9521", +"5# c #34353E", +"6# c #373840", +"7# c #299821", +"8# c #32C822", +"9# c #5D6A5D", +"0# c #848486", +"a# c #566557", +"b# c #2ADF16", +"c# c #36BA28", +"d# c #28E414", +"e# c #419E36", +"f# c #595858", +"g# c #556153", +"h# c #37BA28", +"i# c #27E712", +"j# c #2BDC17", +"k# c #32C122", +"l# c #16A913", +"m# c #129C18", +"n# c #169F0D", +"o# c #02200F", +"p# c #159A0A", +"q# c #11961A", +"r# c #032C0E", +"s# c #18B812", +"t# c #347E2A", +"u# c #595456", +"v# c #28E513", +"w# c #458E3C", +"x# c #575455", +"y# c #429637", +"z# c #2FCF1D", +"A# c #52654D", +"B# c #51664D", +"C# c #2ED11C", +"D# c #42923B", +"E# c #5D5D60", +"F# c #828284", +"G# c #525154", +"H# c #3B9332", +"I# c #25EC0F", +"J# c #2DC91C", +"K# c #4B5F49", +"L# c #504E51", +"M# c #3F9736", +"N# c #29E014", +"O# c #3E9635", +"P# c #419638", +"Q# c #19B20E", +"R# c #0D6D17", +"S# c #1DD513", +"T# c #074E1B", +"U# c #1FDE0D", +"V# c #1AC00E", +"W# c #093B06", +"X# c #1FDB0C", +"Y# c #2A4728", +"Z# c #545255", +"`# c #27E513", +" $ c #408A38", +".$ c #4F4D4F", +"+$ c #485F46", +"@$ c #28E113", +"#$ c #43753D", +"$$ c #41773B", +"%$ c #27E313", +"&$ c #485A45", +"*$ c #59595B", +"=$ c #7D7D7F", +"-$ c #434244", +";$ c #34872B", +">$ c #24EB0F", +",$ c #2BC41A", +"'$ c #3C4F3A", +")$ c #3E473E", +"!$ c #2BBF1B", +"~$ c #36A72A", +"{$ c #565457", +"]$ c #3CA830", +"^$ c #32C222", +"/$ c #515D51", +"($ c #29DE15", +"_$ c #38A12D", +":$ c #29DF15", +"<$ c #2ADC16", +"[$ c #39A12E", +"}$ c #2CCC1B", +"|$ c #4D4C4E", +"1$ c #535254", +"2$ c #27E512", +"3$ c #3A8431", +"4$ c #403E41", +"5$ c #3D3B3E", +"6$ c #2ABB1B", +"7$ c #309C23", +"8$ c #2FA021", +"9$ c #2BB81C", +"0$ c #414041", +"a$ c #545455", +"b$ c #7B7B7D", +"c$ c #3F4B3F", +"d$ c #27DA13", +"e$ c #2BB31C", +"f$ c #25E310", +"g$ c #318C28", +"h$ c #3C443B", +"i$ c #2BBE1B", +"j$ c #35A728", +"k$ c #4C4B4D", +"l$ c #545256", +"m$ c #3AA72F", +"n$ c #31C222", +"o$ c #525753", +"p$ c #35BA26", +"q$ c #29E114", +"r$ c #37B12A", +"s$ c #32C123", +"t$ c #28E014", +"u$ c #3C9F31", +"v$ c #514F52", +"w$ c #525052", +"x$ c #38822F", +"y$ c #3E3C3E", +"z$ c #3B393B", +"A$ c #318328", +"B$ c #28CD16", +"C$ c #27D115", +"D$ c #328229", +"E$ c #3F3D3E", +"F$ c #505051", +"G$ c #34B127", +"H$ c #29C818", +"I$ c #374F34", +"J$ c #318927", +"K$ c #26E310", +"L$ c #375833", +"M$ c #34862A", +"N$ c #27E212", +"O$ c #359A2A", +"P$ c #3A9931", +"Q$ c #28DF14", +"R$ c #30C121", +"S$ c #4C514C", +"T$ c #3F8138", +"U$ c #43763D", +"V$ c #3B9232", +"W$ c #27E113", +"X$ c #43703F", +"Y$ c #4C4A4D", +"Z$ c #27E412", +"`$ c #36802C", +" % c #3D3B3C", +".% c #3C3A3B", +"+% c #385733", +"@% c #28D414", +"#% c #28D315", +"$% c #3A5836", +"%% c #434142", +"&% c #535353", +"*% c #36EB22", +"=% c #43863C", +"-% c #4D4D4D", +";% c #5A6C57", +">% c #44C635", +",% c #46A73B", +"'% c #52604F", +")% c #3DB330", +"!% c #2DE418", +"~% c #31D51F", +"{% c #39B72B", +"]% c #39AE2D", +"^% c #4A4E49", +"/% c #405C3D", +"(% c #2DB71E", +"_% c #414B41", +":% c #3D6039", +"<% c #2EAE20", +"[% c #435242", +"}% c #484648", +"|% c #4A494A", +"1% c #33CD23", +"2% c #437E3B", +"3% c #4E4C4D", +"4% c #504F50", +"5% c #585D56", +"6% c #47B73A", +"7% c #4AB93E", +"8% c #565B55", +"9% c #545353", +"0% c #757575", +". + @ + # # $ % & & * # = - % ; > , ' ) ! ~ { ] ^ / ( _ : < [ ", +"} | 1 2 3 4 5 6 7 8 9 0 a 1 b c d 1 a a b e f g h i j k l m n o ", +"p q r s t u u u v w x x x y z z A A A B C C D E F E E G H I J K ", +"L M N O O O O O O P Q Q Q Q Q Q Q Q Q Q Q R R R R R S R R T U V ", +"W X Y O O O O O O O O O O O O O O O O Z ` ` ...O O O O P +.@.#.", +"$.%.&.O O O O O O O O O O O O O O O P *.` ` =.-.O O O O O ;.>.,.", +"'.).!.O O O O O O O O O O O O O O O ~.{.].^./.(._.O O O O :.<.[.", +"}.|.1.P O O O O O O O O O O O O O O 2.3.4.5.6.7._.O O O P 8.<.9.", +"p X 0.P O O O O O O O O O O O O O O a.b.c.d.e.f._.O O O O g.h.[.", +"i.j.k.P O O O O O O O O O O O O O O l.m.n.o.p.q.r.O O O O s.t.u.", +"v.w.x.P O O O O O O O O O O O O O O y.z.A.B.C.D.7.P O O O E.@.F.", +"G.H.I.P O O O O O O O O O O O O O O J.K.L.M.N.O.P._.O O O Q.R.S.", +"T.U.V.P O O O O O O O O O O O O O O W.X.Y.Z.`. +` ` O O O .+++@+", +"T.#+$+P O O O O O O O O O O O O O _.%+&+*+=+-+;+>+` _.O O ,+'+)+", +"!+~+$+P O O O O O O O O O O O O *.{+]+^+/+(+_+:+<+[+}+P |+1+2+3+", +"4+5+$+P O O O O O O O O O O O O 6+7+^+(+=+(+(+(+8+9+0+_.O a+b+c+", +"d+e+f+P O O O O O O O O O O O O g+h+(+i+/+(+(+(+j+k+-.` P l+m+n+", +"o+p+f+P O O O O O O O O O O O Q q+8+(+r+/+(+(+(+s+t+u+` O v+w+x+", +"d+y+$+P O O O O O O O O O O O z+A+B+(+C+D+(+(+(+E+F+G+H+O I+J+K+", +"d+L+M+P O O O O O O O O O N+O+P+Q+R+S+T+=+(+(+(+U+V+W+X+Y+I+Z+`+", +" @.@k.P O O O O O O O O O +@@@#@$@%@&@*@(+(+(+=@-@;@>@,@'@)@!@~@", +"{@]@^@P O O O O O O O O O /@(@$@$@_@:@<@(+(+(+[@}@|@1@(@2@3@4@5@", +"6@7@f+P O O O O O O O O 8@9@(@$@$@$@0@a@T+b@c@d@e@f@$@$@g@h@i@j@", +"k@l@f+P O O O O O O O O m@n@o@p@(@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@", +"F@G@H@I@J@K@L@M@N@N@N@N@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.#+#@###$#", +"%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#8#9#", +"0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#z#A#B#C#D#E#", +"F#G#H#I#J#K#L#M#N#O#P#b#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$", +"=$-$;$>$,$'$)$!$~$L#{$]$^$/$($_$:$<$[$}$|$1$2$3$4$5$6$7$8$9$0$a$", +"b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$u$v$w$2$x$y$z$A$B$C$D$E$F$", +" G$H$I$J$K$L$M$N$O$P$Q$R$S$T$I#U$V$W$X$Y$k$Z$`$ %.%+%@%#%$%%%&%", +" *%=%-%;%>%,%'%)%!%~%{%]%^%/%(%_%:%<%[%}%|%1%2%3%4%5%6%7%8%9%0%"}; diff --git a/contrib/xawtv48x48.xpm b/contrib/xawtv48x48.xpm new file mode 100644 index 0000000..2a9dae6 --- /dev/null +++ b/contrib/xawtv48x48.xpm @@ -0,0 +1,1045 @@ +/* XPM */ +static char * xawtv48x48[] = { +"48 48 994 2", +" c None", +". c #B9B9BB", +"+ c #B8B7B8", +"@ c #B7B6B7", +"# c #AAAAAA", +"$ c #ACABAC", +"% c #ACACAC", +"& c #ACABAD", +"* c #A0A0A2", +"= c #A7A7A9", +"- c #A2A1A4", +"; c #959496", +"> c #9D9C9E", +", c #969597", +"' c #989798", +") c #A4A3A4", +"! c #AAA9AA", +"~ c #A0A0A0", +"{ c #999999", +"] c #A5A5A5", +"^ c #A5A4A6", +"/ c #A3A2A4", +"( c #9B9A9C", +"_ c #A7A7A7", +": c #ABABAB", +"< c #A7A7A8", +"[ c #A1A1A2", +"} c #AEAEB0", +"| c #B0B0B2", +"1 c #B1B0B2", +"2 c #B0B0B0", +"3 c #AFAFAF", +"4 c #ADADAD", +"5 c #ADADAF", +"6 c #ACABAE", +"7 c #A8A8AA", +"8 c #A4A4A6", +"9 c #B7B7B9", +"0 c #B7B7B8", +"a c #B9B9B9", +"b c #B8B8B9", +"c c #98989A", +"d c #7C7C7E", +"e c #807E81", +"f c #858286", +"g c #888589", +"h c #89868A", +"i c #8B888C", +"j c #8A878B", +"k c #898689", +"l c #8C898D", +"m c #8C898C", +"n c #8B888B", +"o c #8D8A8E", +"p c #8E8B8F", +"q c #8C8A8D", +"r c #8E8B8E", +"s c #8D8A8D", +"t c #8B898C", +"u c #868386", +"v c #848182", +"w c #827F80", +"x c #7E7B7E", +"y c #7B787B", +"z c #777478", +"A c #737274", +"B c #717173", +"C c #707072", +"D c #6F6F72", +"E c #787879", +"F c #BABABA", +"G c #88888A", +"H c #7F7F81", +"I c #878288", +"J c #938D94", +"K c #948E95", +"L c #959097", +"M c #969098", +"N c #948F97", +"O c #948F95", +"P c #969196", +"Q c #969096", +"R c #959095", +"S c #948E94", +"T c #918C91", +"U c #908A90", +"V c #8F8A91", +"W c #908A92", +"X c #908B92", +"Y c #918B93", +"Z c #908B90", +"` c #8D888D", +" . c #8E888D", +".. c #908A91", +"+. c #8F8991", +"@. c #8F8A8F", +"#. c #8B868B", +"$. c #878287", +"%. c #898487", +"&. c #898486", +"*. c #888486", +"=. c #868186", +"-. c #858085", +";. c #7D7C80", +">. c #79797C", +",. c #767579", +"'. c #747378", +"). c #737278", +"!. c #717076", +"~. c #767679", +"{. c #7E7E7E", +"]. c #858587", +"^. c #817E81", +"/. c #8A888C", +"(. c #5C5A69", +"_. c #434249", +":. c #44424E", +"<. c #44414E", +"[. c #43414E", +"}. c #43414F", +"|. c #434150", +"1. c #43404F", +"2. c #423F4D", +"3. c #42404B", +"4. c #413F4A", +"5. c #41404A", +"6. c #3F3E48", +"7. c #403E49", +"8. c #3F3D4A", +"9. c #3F3D4B", +"0. c #3E3C4A", +"a. c #3D3B49", +"b. c #3D3B4A", +"c. c #3C3948", +"d. c #3C3A48", +"e. c #3C3A49", +"f. c #3A3846", +"g. c #393745", +"h. c #373644", +"i. c #373640", +"j. c #4F4F61", +"k. c #76747B", +"l. c #7A767F", +"m. c #68676B", +"n. c #949496", +"o. c #827F83", +"p. c #8D8D8D", +"q. c #2D2C35", +"r. c #010101", +"s. c #010100", +"t. c #000100", +"u. c #010200", +"v. c #010203", +"w. c #434450", +"x. c #777775", +"y. c #7B777D", +"z. c #727175", +"A. c #99999B", +"B. c #838184", +"C. c #8E8D90", +"D. c #2C2B35", +"E. c #000000", +"F. c #000002", +"G. c #000003", +"H. c #000004", +"I. c #464753", +"J. c #7D7C7B", +"K. c #7D797F", +"L. c #706F73", +"M. c #909092", +"N. c #858386", +"O. c #8E8C94", +"P. c #2C2B36", +"Q. c #000101", +"R. c #020203", +"S. c #020204", +"T. c #010103", +"U. c #4A4954", +"V. c #807D82", +"W. c #7F7C80", +"X. c #68686B", +"Y. c #868688", +"Z. c #868487", +"`. c #918F97", +" + c #282730", +".+ c #000001", +"++ c #212122", +"@+ c #1B1B1C", +"#+ c #4C4A52", +"$+ c #847F86", +"%+ c #817F81", +"&+ c #68686A", +"*+ c #979799", +"=+ c #888588", +"-+ c #929098", +";+ c #26242E", +">+ c #2B2B2B", +",+ c #262626", +"'+ c #030305", +")+ c #4C4A51", +"!+ c #868188", +"~+ c #838183", +"{+ c #89878A", +"]+ c #94929A", +"^+ c #26252F", +"/+ c #040406", +"(+ c #010102", +"_+ c #4E4C53", +":+ c #878389", +"<+ c #848284", +"[+ c #686869", +"}+ c #919294", +"|+ c #888689", +"1+ c #939199", +"2+ c #242425", +"3+ c #0E0E0F", +"4+ c #1C1C1E", +"5+ c #424243", +"6+ c #131314", +"7+ c #4D4C53", +"8+ c #88838A", +"9+ c #838081", +"0+ c #666666", +"a+ c #878588", +"b+ c #25242D", +"c+ c #303031", +"d+ c #BDBDBC", +"e+ c #505050", +"f+ c #0C0C0E", +"g+ c #B8B8B8", +"h+ c #4D4D4D", +"i+ c #4D4B52", +"j+ c #878289", +"k+ c #838182", +"l+ c #676767", +"m+ c #878789", +"n+ c #8F8D95", +"o+ c #545455", +"p+ c #2C2B2C", +"q+ c #787773", +"r+ c #2A2721", +"s+ c #858585", +"t+ c #282828", +"u+ c #939393", +"v+ c #868288", +"w+ c #858283", +"x+ c #686868", +"y+ c #868387", +"z+ c #8D8B93", +"A+ c #22212A", +"B+ c #414142", +"C+ c #615439", +"D+ c #C69913", +"E+ c #CBA40D", +"F+ c #AD9329", +"G+ c #574F35", +"H+ c #7F7F7E", +"I+ c #4B4950", +"J+ c #848283", +"K+ c #666668", +"L+ c #88898B", +"M+ c #838084", +"N+ c #898890", +"O+ c #281D09", +"P+ c #CB9611", +"Q+ c #EBBB0B", +"R+ c #F0D124", +"S+ c #F6D822", +"T+ c #EBC70E", +"U+ c #7E630E", +"V+ c #48464D", +"W+ c #858087", +"X+ c #827F81", +"Y+ c #676769", +"Z+ c #838083", +"`+ c #87868E", +" @ c #322305", +".@ c #D19C0A", +"+@ c #EDC410", +"@@ c #F1D21D", +"#@ c #DBB60D", +"$@ c #CF9909", +"%@ c #75560D", +"&@ c #141415", +"*@ c #09090B", +"=@ c #47464D", +"-@ c #837F85", +";@ c #817E80", +">@ c #7F7D80", +",@ c #86848C", +"'@ c #21212A", +")@ c #151515", +"!@ c #A48A54", +"~@ c #C2960B", +"{@ c #C48E09", +"]@ c #C18A12", +"^@ c #C3AD7B", +"/@ c #8C8A88", +"(@ c #4B4B4C", +"_@ c #45434A", +":@ c #7E7A81", +"<@ c #7B797A", +"[@ c #69696B", +"}@ c #79787E", +"|@ c #807E87", +"1@ c #201F28", +"2@ c #2C2C2D", +"3@ c #C9C7C6", +"4@ c #AF9C76", +"5@ c #AF925F", +"6@ c #BFB5A4", +"7@ c #E6E6E5", +"8@ c #F3F3F1", +"9@ c #232324", +"0@ c #020202", +"a@ c #414147", +"b@ c #76747A", +"c@ c #777475", +"d@ c #6A6869", +"e@ c #76757A", +"f@ c #7C7A83", +"g@ c #1F1E27", +"h@ c #070607", +"i@ c #A6A6A6", +"j@ c #F0F0EF", +"k@ c #C4C3C2", +"l@ c #CCCBCA", +"m@ c #FEFEFC", +"n@ c #919190", +"o@ c #3D3D44", +"p@ c #706E74", +"q@ c #757273", +"r@ c #76757D", +"s@ c #1D1C26", +"t@ c #2D2D2E", +"u@ c #F9F9F7", +"v@ c #F9F9F8", +"w@ c #FDFDFB", +"x@ c #DFDFDE", +"y@ c #040405", +"z@ c #3D3C43", +"A@ c #6F6D73", +"B@ c #737072", +"C@ c #696768", +"D@ c #74727B", +"E@ c #1D1C25", +"F@ c #5E5E5E", +"G@ c #FBFBFA", +"H@ c #F8F8F7", +"I@ c #FCFCFA", +"J@ c #F1F1F0", +"K@ c #DBDBDA", +"L@ c #262526", +"M@ c #010001", +"N@ c #3A3B42", +"O@ c #6E6E73", +"P@ c #737074", +"Q@ c #69686B", +"R@ c #706F75", +"S@ c #716F78", +"T@ c #060607", +"U@ c #8F8F8F", +"V@ c #F2F2F1", +"W@ c #F6F6F5", +"X@ c #F8F8F6", +"Y@ c #E8E8E7", +"Z@ c #D2D2D2", +"`@ c #111112", +" # c #0F0F10", +".# c #020001", +"+# c #36383E", +"@# c #6D6E73", +"## c #706E72", +"$# c #89898A", +"%# c #706F74", +"&# c #6F6E76", +"*# c #0F0F11", +"=# c #2E2E2F", +"-# c #F5F5F4", +";# c #E2E2E2", +"># c #3B3B3C", +",# c #1B1A1B", +"'# c #080809", +")# c #33343B", +"!# c #69696E", +"~# c #6D6B6F", +"{# c #6E6D72", +"]# c #6E6D75", +"^# c #9B9B9A", +"/# c #FBFBF9", +"(# c #1A1A1A", +"_# c #141315", +":# c #313339", +"<# c #65666A", +"[# c #6B696D", +"}# c #67676B", +"|# c #6E6E70", +"1# c #6D6B73", +"2# c #1C1B24", +"3# c #09090A", +"4# c #EEEEEC", +"5# c #FDFDFC", +"6# c #BBBBBA", +"7# c #2F3238", +"8# c #64666B", +"9# c #69686C", +"0# c #6F6F71", +"a# c #121213", +"b# c #4B4B4B", +"c# c #F5F5F3", +"d# c #D6D6D5", +"e# c #101011", +"f# c #303338", +"g# c #626469", +"h# c #67666A", +"i# c #8C8C8E", +"j# c #6B6A71", +"k# c #202020", +"l# c #6D6D6E", +"m# c #F3F3F2", +"n# c #DFDFDD", +"o# c #2F3237", +"p# c #5F6266", +"q# c #656468", +"r# c #696870", +"s# c #030204", +"t# c #141413", +"u# c #818181", +"v# c #FAFAF9", +"w# c #D5D5D4", +"x# c #0A0A0C", +"y# c #101010", +"z# c #0A090B", +"A# c #646266", +"B# c #68686C", +"C# c #020200", +"D# c #9A7309", +"E# c #CC9D0B", +"F# c #5A523E", +"G# c #EEEEED", +"H# c #F8ECC4", +"I# c #C4B069", +"J# c #1E1C15", +"K# c #5D6064", +"L# c #636165", +"M# c #68676E", +"N# c #1E1D26", +"O# c #0E0A01", +"P# c #372704", +"Q# c #634606", +"R# c #E8AE0C", +"S# c #F5BD0C", +"T# c #BB910A", +"U# c #454340", +"V# c #E5E5E4", +"W# c #EECA66", +"X# c #D4A90B", +"Y# c #050505", +"Z# c #090807", +"`# c #B3920B", +" $ c #2C2402", +".$ c #5B5E62", +"+$ c #626064", +"@$ c #6F6E72", +"#$ c #68666F", +"$$ c #201E28", +"%$ c #A17409", +"&$ c #EBB20C", +"*$ c #F4BC0C", +"=$ c #F3BD0C", +"-$ c #634E07", +";$ c #29292A", +">$ c #D6D6D4", +",$ c #ECECEB", +"'$ c #D8B456", +")$ c #DAA109", +"!$ c #573C06", +"~$ c #342405", +"{$ c #845F07", +"]$ c #EDB60B", +"^$ c #493804", +"/$ c #292B31", +"($ c #5C5C61", +"_$ c #5F5E62", +":$ c #6D6C72", +"<$ c #68676F", +"[$ c #B5840C", +"}$ c #F4BB0C", +"|$ c #D7AA0B", +"1$ c #110D05", +"2$ c #1C1C1D", +"3$ c #CBA753", +"4$ c #E6AC0A", +"5$ c #D39808", +"6$ c #D19708", +"7$ c #EAB10B", +"8$ c #BD900A", +"9$ c #0A0802", +"0$ c #29282F", +"a$ c #5C5A60", +"b$ c #5F5D61", +"c$ c #666669", +"d$ c #6C6B70", +"e$ c #66646D", +"f$ c #936A07", +"g$ c #F3BA0D", +"h$ c #F3BE0C", +"i$ c #7F6508", +"j$ c #121214", +"k$ c #D9D9D7", +"l$ c #9B7622", +"m$ c #EDB40B", +"n$ c #EFB60B", +"o$ c #EEB60B", +"p$ c #B78B0A", +"q$ c #484032", +"r$ c #5A585E", +"s$ c #68676C", +"t$ c #64636B", +"u$ c #9C6F07", +"v$ c #F3B90C", +"w$ c #E5B60B", +"x$ c #D3C8AB", +"y$ c #D7D7D6", +"z$ c #2B2A2C", +"A$ c #8B6307", +"B$ c #F2B90C", +"C$ c #856D32", +"D$ c #58565C", +"E$ c #636169", +"F$ c #0D0901", +"G$ c #D09709", +"H$ c #EFB90B", +"I$ c #AD8524", +"J$ c #BCBBBA", +"K$ c #EDEDEC", +"L$ c #EDEDEB", +"M$ c #D1D0CF", +"N$ c #7C7C7C", +"O$ c #0D0D0F", +"P$ c #040304", +"Q$ c #946808", +"R$ c #F0B60B", +"S$ c #E4AC0C", +"T$ c #856009", +"U$ c #2F2E32", +"V$ c #595760", +"W$ c #605C60", +"X$ c #646467", +"Y$ c #656567", +"Z$ c #615F67", +"`$ c #211702", +" % c #C18808", +".% c #DCA20A", +"+% c #E6AB0C", +"@% c #EDB30C", +"#% c #F5BC0C", +"$% c #EEB50B", +"%% c #AC7707", +"&% c #140E05", +"*% c #080604", +"=% c #9C6B06", +"-% c #EBB20B", +";% c #F3BA0C", +">% c #E6AC0C", +",% c #A77908", +"'% c #221803", +")% c #262732", +"!% c #58565F", +"~% c #5E5A5E", +"{% c #646468", +"]% c #878C88", +"^% c #3BBD2E", +"/% c #35C627", +"(% c #144D13", +"_% c #031701", +":% c #18A508", +"<% c #18A608", +"[% c #041B01", +"}% c #0F0A01", +"|% c #382602", +"1% c #6C4904", +"2% c #9B6906", +"3% c #B88007", +"4% c #D49A0A", +"5% c #E1A70B", +"6% c #CB9108", +"7% c #825505", +"8% c #100B03", +"9% c #148708", +"0% c #19AA09", +"a% c #1BAB09", +"b% c #47C20A", +"c% c #6FCB0B", +"d% c #61E10C", +"e% c #ADA609", +"f% c #704D05", +"g% c #060400", +"h% c #1A4A1D", +"i% c #32C324", +"j% c #43A939", +"k% c #939395", +"l% c #489940", +"m% c #23F40C", +"n% c #1ED30B", +"o% c #081313", +"p% c #070715", +"q% c #060612", +"r% c #179B0B", +"s% c #189611", +"t% c #060611", +"u% c #070712", +"v% c #070713", +"w% c #080712", +"x% c #1F1613", +"y% c #523710", +"z% c #7C5107", +"A% c #714905", +"B% c #322211", +"C% c #1DC20D", +"D% c #26ED0C", +"E% c #4FA209", +"F% c #319B0E", +"G% c #080812", +"H% c #060712", +"I% c #080814", +"J% c #090917", +"K% c #179310", +"L% c #43973B", +"M% c #A1A1A3", +"N% c #5C5F5E", +"O% c #30CC20", +"P% c #37A431", +"Q% c #504F5B", +"R% c #3E7641", +"S% c #23F20C", +"T% c #28E414", +"U% c #4A5A50", +"V% c #4B4B54", +"W% c #4A4A53", +"X% c #494952", +"Y% c #474850", +"Z% c #444B4C", +"`% c #43484C", +" & c #44434D", +".& c #3E3E47", +"+& c #2C3138", +"@& c #2D2E36", +"#& c #2B3239", +"$& c #2A2A33", +"%& c #2C2C34", +"&& c #2C2B34", +"*& c #2C2A34", +"=& c #2B2F37", +"-& c #303F3F", +";& c #32383A", +">& c #30343C", +",& c #30353C", +"'& c #33313B", +")& c #487945", +"!& c #488743", +"~& c #28E713", +"{& c #24F10D", +"]& c #468E40", +"^& c #488544", +"/& c #4A6349", +"(& c #24F00E", +"_& c #27DA15", +":& c #4A4C52", +"<& c #4C4B55", +"[& c #4F4E57", +"}& c #4E5253", +"|& c #27E213", +"1& c #546552", +"2& c #636365", +"3& c #9E9EA0", +"4& c #5B5B5D", +"5& c #50714F", +"6& c #25EF0F", +"7& c #25EF0E", +"8& c #4C7848", +"9& c #2BDD18", +"0& c #468D3D", +"a& c #595957", +"b& c #595857", +"c& c #585856", +"d& c #4A8342", +"e& c #2FD31D", +"f& c #26EA11", +"g& c #3AAF2C", +"h& c #38A72B", +"i& c #1DCF0F", +"j& c #04431B", +"k& c #1BD016", +"l& c #1CC20A", +"m& c #021707", +"n& c #000906", +"o& c #0D5D05", +"p& c #1DD10F", +"q& c #076525", +"r& c #00130D", +"s& c #07591C", +"t& c #1DD310", +"u& c #25A316", +"v& c #595354", +"w& c #5B5555", +"x& c #2AE015", +"y& c #575E52", +"z& c #595554", +"A& c #595555", +"B& c #31CA1F", +"C& c #23F30C", +"D& c #4D7445", +"E& c #585454", +"F& c #497A43", +"G& c #57565B", +"H& c #616163", +"I& c #5C5A5D", +"J& c #3EA433", +"K& c #26EC10", +"L& c #33C424", +"M& c #5A575B", +"N& c #59565A", +"O& c #59565B", +"P& c #4A8144", +"Q& c #29E314", +"R& c #29E215", +"S& c #25EE0F", +"T& c #23F10C", +"U& c #044F24", +"V& c #17B313", +"W& c #0A7725", +"X& c #002D1E", +"Y& c #18B20E", +"Z& c #108F18", +"`& c #118F14", +" * c #1E7714", +".* c #555156", +"+* c #575558", +"@* c #29E016", +"#* c #535D54", +"$* c #545356", +"%* c #555357", +"&* c #42913B", +"** c #3BA730", +"=* c #39AE2D", +"-* c #448A3B", +";* c #575657", +">* c #606062", +",* c #4F4F51", +"'* c #4D4B4E", +")* c #494F49", +"!* c #28D814", +"~* c #25EB0F", +"{* c #445E42", +"]* c #4C4A4D", +"^* c #4B494C", +"/* c #4E4D4F", +"(* c #2CD719", +"_* c #3BA030", +":* c #515452", +"<* c #565756", +"[* c #3F9B36", +"}* c #062509", +"|* c #0E751C", +"1* c #14A81E", +"2* c #032716", +"3* c #20E40E", +"4* c #19B10A", +"5* c #1BBE0A", +"6* c #132A11", +"7* c #504E51", +"8* c #545355", +"9* c #29E015", +"0* c #4B5449", +"a* c #4D4B4C", +"b* c #465345", +"c* c #24EB0E", +"d* c #2AD816", +"e* c #484947", +"f* c #464745", +"g* c #28DF14", +"h* c #25E90F", +"i* c #454D42", +"j* c #49484A", +"k* c #5F5F61", +"l* c #48484A", +"m* c #413F42", +"n* c #3F423F", +"o* c #28D116", +"p* c #25E810", +"q* c #3D523B", +"r* c #3F3D40", +"s* c #403E41", +"t* c #3C543A", +"u* c #23F20D", +"v* c #28DC14", +"w* c #4E4E4E", +"x* c #525053", +"y* c #565457", +"z* c #595759", +"A* c #2CD919", +"B* c #24F20D", +"C* c #50654F", +"D* c #535E53", +"E* c #25EC0F", +"F* c #2AD518", +"G* c #456E41", +"H* c #2CD419", +"I* c #26E910", +"J* c #4B6149", +"K* c #24EF0E", +"L* c #2CCD1B", +"M* c #4B4A4C", +"N* c #535154", +"O* c #24F00D", +"P* c #454F43", +"Q* c #434143", +"R* c #3E3C3F", +"S* c #3D3B3E", +"T* c #2BB61C", +"U* c #395C34", +"V* c #376331", +"W* c #2DB11E", +"X* c #403E3F", +"Y* c #464546", +"Z* c #5C5C5E", +"`* c #9F9FA1", +" = c #474749", +".= c #403F41", +"+= c #329228", +"@= c #24ED0E", +"#= c #2CB91C", +"$= c #3D3C3E", +"%= c #396135", +"&= c #2EC31E", +"*= c #4F4D50", +"== c #555356", +"-= c #32C123", +";= c #4A5E48", +">= c #33C023", +",= c #38AD2B", +"'= c #43853C", +")= c #37A82B", +"!= c #38932F", +"~= c #4A484B", +"{= c #535153", +"]= c #444D42", +"^= c #3F3D3F", +"/= c #3C3A3D", +"(= c #34722E", +"_= c #309724", +":= c #2F9F22", +"<= c #356E2E", +"[= c #3E3C3D", +"}= c #454445", +"|= c #5A5A5C", +"1= c #A9A9AB", +"2= c #434345", +"3= c #3A5538", +"4= c #24EC0E", +"5= c #23EF0D", +"6= c #34672E", +"7= c #26DC12", +"8= c #34762D", +"9= c #3D3B3D", +"0= c #3A4F37", +"a= c #23F10D", +"b= c #28DD14", +"c= c #494B49", +"d= c #525055", +"e= c #545256", +"f= c #2ADA17", +"g= c #4E624E", +"h= c #555258", +"i= c #438C3B", +"j= c #25ED0F", +"k= c #30CA1F", +"l= c #525A52", +"m= c #26EB10", +"n= c #50674E", +"o= c #545255", +"p= c #514F52", +"q= c #515052", +"r= c #424B40", +"s= c #3F3D3E", +"t= c #3B393B", +"u= c #3A383A", +"v= c #3A4038", +"w= c #25E310", +"x= c #27D314", +"y= c #26D912", +"z= c #25E111", +"A= c #3B3F39", +"B= c #3B393A", +"C= c #434343", +"D= c #555556", +"E= c #4B4D4D", +"F= c #29BF18", +"G= c #2E9C22", +"H= c #353334", +"I= c #316E2A", +"J= c #26DF11", +"K= c #374435", +"L= c #3A3839", +"M= c #28CC15", +"N= c #31A923", +"O= c #455143", +"P= c #4C544D", +"Q= c #38A22E", +"R= c #4C614C", +"S= c #504E52", +"T= c #4C594C", +"U= c #3B9C30", +"V= c #2FC61F", +"W= c #2DCD1B", +"X= c #4E4C4F", +"Y= c #24EF0D", +"Z= c #3D463A", +"`= c #383637", +" - c #373536", +".- c #363435", +"+- c #2CA71D", +"@- c #2EA421", +"#- c #454444", +"$- c #515151", +"%- c #5FBC56", +"&- c #27DD13", +"*- c #3D463D", +"=- c #403E40", +"-- c #424041", +";- c #2EB51F", +">- c #2FAC21", +",- c #434242", +"'- c #3D6A37", +")- c #24EE0E", +"!- c #26E710", +"~- c #435841", +"{- c #474547", +"]- c #474548", +"^- c #2EBE1E", +"/- c #41693D", +"(- c #49474A", +"_- c #36952C", +":- c #36932D", +"<- c #484649", +"[- c #434142", +"}- c #454344", +"|- c #3D6D36", +"1- c #3B6835", +"2- c #464445", +"3- c #474546", +"4- c #4A4949", +"5- c #6C6C6C", +"6- c #3EED2B", +"7- c #4F8A49", +"8- c #484749", +"9- c #5A595A", +"0- c #6B696A", +"a- c #667A63", +"b- c #48D938", +"c- c #47D836", +"d- c #5D735A", +"e- c #5A5959", +"f- c #517A4C", +"g- c #3CCC2C", +"h- c #2CE817", +"i- c #31DF1E", +"j- c #459A3C", +"k- c #439F38", +"l- c #38CB28", +"m- c #4E5C4B", +"n- c #4B494A", +"o- c #444345", +"p- c #387532", +"q- c #2CB71D", +"r- c #404340", +"s- c #3B5C38", +"t- c #29BE19", +"u- c #3E553C", +"v- c #474648", +"w- c #484648", +"x- c #3ABC2C", +"y- c #39CA29", +"z- c #50564E", +"A- c #525051", +"B- c #555354", +"C- c #626061", +"D- c #666764", +"E- c #4CD23D", +"F- c #51D642", +"G- c #6C6E6B", +"H- c #525151", +"I- c #696969", +" . + @ @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( _ : : : : < [ } | 1 2 3 4 5 5 6 7 8 9 0 0 a b ", +"c d e f g h i j k l m l m n j l o o o p q r s l i t p p p p r m g u v v w x y z A B C D D D E F ", +"G H I J K L M N O P Q R S T U V W X X Y V Z ` ...+.W W X W ..@.#.$.%.&.*.$.=.-.;.>.,.'.).!.~.{.", +"].^./.(._.:.<.[.}.|.|.|.|.1.2.3.3.3.3.4.5.6.6.6.7.7.7.4.4.6.8.9.0.a.b.c.c.c.d.e.f.g.h.i.j.k.l.m.", +"n.o.p.q.r.r.r.r.s.s.s.s.s.t.s.s.s.s.s.s.t.s.s.s.s.s.s.t.s.s.s.s.s.s.t.s.t.t.s.u.t.t.t.v.w.x.y.z.", +"A.B.C.D.E.E.E.E.E.E.E.E.E.E.F.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.H.H.H.H.H.H.H.H.H.H.H.H.G.I.J.K.L.", +"M.N.O.P.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.Q.R.S.S.T.r.E.E.E.E.E.E.E.E.F.U.V.W.X.", +"Y.Z.`. +E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E..+S.S.S.S.++@+T.E.E.E.E.E.E.E..+#+$+%+&+", +"*+=+-+;+E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.T.S.S.S.S.>+,+'+.+E.E.E.E.E.E..+)+!+~+&+", +"A.{+]+^+E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.S.S.S.S.S./+S.S.(+E.E.E.E.E.E.r._+:+<+[+", +"}+|+1+;+E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.'+2+3+S.4+5+6+S.T.E.E.E.E.E.E.r.7+8+9+0+", +"M.a+`.b+t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.c+d+e+f+d+g+h+S.R.E.E.E.E.E.E.(+i+j+k+l+", +"m+=+n+b+t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E..+o+p+q+r+s+t+u+S.R.E.E.E.E.E.E..+)+v+w+x+", +"m+y+z+A+t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.B+C+D+E+F+G+H+S.S.E.E.E.E.E.E..+I+!+J+K+", +"L+M+N+A+t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.O+P+Q+R+S+T+U+S.S.E.E.E.E.E.E..+V+W+X+Y+", +"L+Z+`+A+t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E. @.@+@@@#@$@%@&@*@.+E.E.E.E.E.r.=@-@;@Y+", +"m+>@,@'@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.)@!@~@{@]@^@/@&@(@T.E.E.E.E.E..+_@:@<@[@", +"Y.}@|@1@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.r.2@3@4@5@6@7@8@9@'+S.0@E.E.E.E.Q.a@b@c@d@", +"Y.e@f@g@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.h@i@j@k@l@j@m@m@n@S.S.R.E.E.E.E.Q.o@p@q@d@", +"Y.'.r@s@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.(+t@u@m@v@w@m@m@m@x@y@S.S.(+E.E.E.Q.z@A@B@C@", +"m+'.D@E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.r.S.F@j@G@j@H@I@J@7@K@L@S.S.S..+E.E.M@N@O@P@Q@", +"m+R@S@E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.S.T@U@V@w@W@w@w@X@Y@Z@~ `@ #S.T.E.E..#+#@###m.", +"$#%#&#E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.*#=#-#w@w@w@w@w@w@w@I@;#>#,#'#S..+E..#)#!#~#m.", +"m+{#]#E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.(+6+^#w@w@w@/#w@w@w@w@w@w@U@(#_#S.(+E.M@:#<#[#}#", +"Y.|#1#2#t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.3#@+4#5#w@H@u@w@w@w@w@w@w@6#S.&@S.T.E.(+7#8#9#m.", +"m+0#]#E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E..+a#b#w@w@w@c#H@w@w@w@w@w@w@d#S.e#S.S.E.M@f#g#h#m.", +"i#0#j#2#t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.T.k#l#w@w@w@m#u@w@w@w@w@w@w@n#S.3+S.S.E.M@o#p#q#m.", +"G 0#r#E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.s#t#u#w@w@w@8@v#w@w@w@w@w@w@w#x#y#z#S.E.M@o#p#A#B#", +"G 0#r#E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.C#D#E#F#G#w@w@m#G@w@w@w@w@w@H#I#'#S.&@J#E.M@o#K#L#h#", +"m+0#M#N#t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.O#P#Q#R#S#T#U#V#w@W@/#w@w@w@w@w@W#X#Y#S.Z#`# $M@7#.$+$h#", +"m+@$#$$$t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.%$R#&$*$S#=$-$;$>$w@w@w@w@w@w@,$'$)$!$~${$]$^$(+/$($_$h#", +"Y.:$<$ +t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.[$}$S#S#S#S#|$1$2$,$w@w@w@w@w@7@3$4$5$6$7$S#8$9$0$a$b$c$", +"].d$e$1@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.f$g$S#S#S#S#h$i$j$n#w@w@w@w@w@k$l$m$n$o$}$S#*$p$q$r$b$q#", +"Y.s$t$E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.E.u$v$S#S#S#S#S#w$x$w@w@w@w@w@y$z$A$n$S#S#S#S#S#B$C$D$b$q#", +"Y.Y+E$2#t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.F$G$}$S#S#S#S#S#H$I$J$K$L$M$N$O$P$Q$R$S#S#S#}$S$T$U$V$W$X$", +"G Y$Z$E@t.F.E.E.E.E.E.E.E.E.E.E.E.E.E.`$ %.%+%@%B$#%#%$%%%&%O$O$'+S.S.*%=%-%#%;%>%,%'%(+)%!%~%{%", +"]%^%/%(%t.F.E._%:%<%[%E.E.E.E.E.E.E.E.E.}%|%1%2%3%4%5%6%7%8%(+9%0%0%0%a%b%c%d%e%f%g%E.(+h%i%j%q#", +"k%l%m%n%o%p%q%r%m%s%q%q%q%q%t%q%t%q%u%q%v%u%q%w%x%y%z%A%B%u%u%C%m%m%m%m%D%E%m%F%G%H%I%J%K%m%L%K+", +"M%N%O%m%P%Q%R%S%T%U%V%W%X%Y%Z%`% &.&+&@&#&$&%&&&*&=&-&;&>&,&'&)&!&~&{&]&^&/&(&_&:&<&[&}&|&(&1&2&", +"3&4&5&6&7&8&9&m%0&a&b&c&d&e&(&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&(&y&z&A&B&C&D&z&E&F&m%i%G&H&", +"* 4&I&J&m%K&m%L&M&N&O&P&(&m%Q&R&m%S&T&U&V&m%W&X&Y&m%Z&Q.`&m% *.*+*@*(&#*$*%*&*m%**%*%*=*m%-*;*>*", +"* ,*'*)*!*m%~*{*]*^*/*(*m%_*:*<*[*m%T&}*|*m%1*2*3*m%4*0@5*T&6*7*8*9*(&0*a*^*b*c*d*e*f*g*h*i*j*k*", +"* l*m*n*o*m%p*q*r*s*t*u*v*w*x*y*z*A*B*C*D*E*F*G*m%H*I*J*K*L*M*N*8*9*O*P*Q*R*S*T*C&U*V*C&W*X*Y*Z*", +"`* =.=+=m%@=m%#=$=r*%=m%&='**===y*-=u*;=N*>={&,=E*'=m%)=m%!=~=N*{=9*O*]=^=R*/=(=m%_=:=m%<=[=}=|=", +"1=2=3=4=5=6=7=C&8=9=0=a=b=c=]*d=e=f=u*g=h=i=m%j=k=l=m=j=u*n=o=p=q=9*O*r=s=t=u=v=w=x=y=z=A=B=C=D=", +" E=F=m%G=H=I=C&J=K=L=M=m%N=O=P=Q=m%B*R=S=T=j=m%U=7*V=m%W=7*X=X=/*g*Y=Z=L=`= -.-+-m%m%@-L=[=#-$-", +" %-m%&-*-=---;-m%>-,-'-E*m%)-j=C&!-u*~-{-]-^-m%/-(-_-m%:-]-<-<-j*g*O*r=[-[-}-}-|-m%m%1-2-3-4-5-", +" m%6-7-8-9-0-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-.=s-t-u-v-v-w-(@x-y-z-A-B-;*C-D-E-F-G-9-H-I- "}; diff --git a/debug/Subdir.mk b/debug/Subdir.mk index f44730e..25b675f 100644 --- a/debug/Subdir.mk +++ b/debug/Subdir.mk @@ -1,32 +1,23 @@ # variables -TARGETS-debug := \ - debug/xvideo +TARGETS-debug := ifeq ($(FOUND_ALSA),yes) TARGETS-debug += \ debug/hwscan endif -ifeq ($(FOUND_MOTIF)$(FOUND_GL),yesyes) +ifeq ($(FOUND_X11),yes) TARGETS-debug += \ - debug/gl + debug/xvideo endif -debug/gl: \ - debug/gl.o \ - common/RegEdit.o \ - libng/libng.a - debug/hwscan: \ debug/hwscan.o \ libng/libng.a debug/xvideo: debug/xvideo.o -debug/gl : LDLIBS := $(THREADLIB) $(MOTIF_LIBS) -lGLU -lGL -ljpeg -lm -debug/hwscan : LDLIBS := $(ALSA_LIBS) -ljpeg -debug/xvideo : LDLIBS := $(ATHENA_LIBS) - -debug/gl : LDFLAGS := $(DLFLAGS) +debug/hwscan : LDLIBS += $(ALSA_LIBS) -ljpeg +debug/xvideo : LDLIBS += $(ATHENA_LIBS) # global targets all:: $(TARGETS-debug) diff --git a/debug/gl.ad b/debug/gl.ad deleted file mode 100644 index 738641e..0000000 --- a/debug/gl.ad +++ /dev/null @@ -1,20 +0,0 @@ -! general -gl.title: OpenGL TV test utility - -! arrange widgets -gl.form.*.leftAttachment: ATTACH_FORM -gl.form.*.rightAttachment: ATTACH_FORM -gl.form.view.topAttachment: ATTACH_WIDGET -gl.form.view.topWidget: bar -gl.form.view.bottomAttachment: ATTACH_FORM -gl.form.view.background: black -gl.form.view.foreground: white - -! menu -gl*bar.file.labelString: File -gl*bar.file.mnemonic: F -gl*bar*quit.labelString: Quit -gl*bar*quit.mnemonic: Q -gl*bar*quit.acceleratorText: Q -gl*bar*quit.accelerator: <Key>Q - diff --git a/debug/gl.c b/debug/gl.c deleted file mode 100644 index 82733b2..0000000 --- a/debug/gl.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * gl.c -- try using OpenGL to blit video frames to the screen - * - * (c) 2002 Gerd Knorr <kraxel@bytesex.org> - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <pthread.h> -#include <sys/time.h> - -#include <X11/Xlib.h> -#include <X11/Intrinsic.h> -#include <Xm/Xm.h> -#include <Xm/Form.h> -#include <Xm/RowColumn.h> -#include <Xm/CascadeB.h> -#include <Xm/PushB.h> -#include <Xm/DrawingA.h> -#include <Xm/Protocols.h> - -#include <GL/gl.h> -#include <GL/glu.h> -#include <GL/glx.h> - -#include "RegEdit.h" -#include "grab-ng.h" - -/* --------------------------------------------------------------------- */ - -XtAppContext app_context; -Widget app_shell,view; -Display *dpy; - -static String fallback_ressources[] = { -#include "gl.h" - NULL -}; - -struct ARGS { - char *device; - int width; - int height; - int help; - int tex; -} args; - -XtResource args_desc[] = { - /* name, class, type, size, offset, default_type, default_addr */ - { - /* Strings */ - "device", - XtCString, XtRString, sizeof(char*), - XtOffset(struct ARGS*,device), - XtRString, NULL, - },{ - /* Integer */ - "gw", - XtCValue, XtRInt, sizeof(int), - XtOffset(struct ARGS*,width), - XtRString, "0" - },{ - "gh", - XtCValue, XtRInt, sizeof(int), - XtOffset(struct ARGS*,height), - XtRString, "0" - },{ - "tex", - XtCValue, XtRInt, sizeof(int), - XtOffset(struct ARGS*,tex), - XtRString, "1" - },{ - "help", - XtCValue, XtRInt, sizeof(int), - XtOffset(struct ARGS*,help), - XtRString, "0" - } -}; -const int args_count = XtNumber(args_desc); - -XrmOptionDescRec opt_desc[] = { - { "-c", "device", XrmoptionSepArg, NULL }, - { "-device", "device", XrmoptionSepArg, NULL }, - { "-x", "gw", XrmoptionSepArg, NULL }, - { "-width", "gw", XrmoptionSepArg, NULL }, - { "-y", "gh", XrmoptionSepArg, NULL }, - { "-height", "gh", XrmoptionSepArg, NULL }, - - { "-img", "tex", XrmoptionNoArg, "0" }, - { "-tex", "tex", XrmoptionNoArg, "1" }, - - { "-h", "help", XrmoptionNoArg, "1" }, - { "-help", "help", XrmoptionNoArg, "1" }, - { "--help", "help", XrmoptionNoArg, "1" }, -}; -const int opt_count = (sizeof(opt_desc)/sizeof(XrmOptionDescRec)); - -/* --------------------------------------------------------------------- */ - -static inline int fix_width(int width) { return width & ~0x03; } -static inline int fix_height(int height) { return height; } - -/* --------------------------------------------------------------------- */ - -const struct ng_vid_driver *drv; -void *h_drv; -struct ng_video_fmt fmt,gfmt; -struct ng_video_conv *conv; -void *hconv; -int cap_on; - -static void -grab_init(char *dev) -{ - ng_debug=1; - drv = ng_vid_open(dev ? dev : ng_dev.video,NULL,0,&h_drv); - if (NULL == drv) { - fprintf(stderr,"grab: no grabber device available\n"); - exit(1); - } - if (!(drv->capabilities(h_drv) & CAN_CAPTURE)) { - fprintf(stderr,"grab: device does'nt support capture\n"); - exit(1); - } -} - -static int -grab_size(int format, int width, int height, int allow_convert) -{ - int i; - - /* cleanup */ - if (conv) { - conv->fini(hconv); - conv = NULL; - hconv = NULL; - } - if (cap_on) { - drv->stopvideo(h_drv); - cap_on = 0; - } - - /* try native format */ - memset(&fmt,0,sizeof(fmt)); - fmt.fmtid = format; - fmt.width = fix_width(width); - fmt.height = fix_height(height); - if (0 == drv->setformat(h_drv,&fmt)) { - drv->startvideo(h_drv,-1,4); - cap_on = 1; - fprintf(stderr,"grab: native [%s]\n",ng_vfmt_to_desc[fmt.fmtid]); - return 0; - } - if (!allow_convert) - return -1; - - /* check all available conversion functions */ - fmt.bytesperline = fmt.width*ng_vfmt_to_depth[fmt.fmtid]/8; - for (i = 0;;) { - conv = ng_conv_find(fmt.fmtid, &i); - if (NULL == conv) - break; - gfmt = fmt; - gfmt.fmtid = conv->fmtid_in; - gfmt.bytesperline = 0; - if (0 == drv->setformat(h_drv,&gfmt)) { - fmt.width = gfmt.width; - fmt.height = gfmt.height; - hconv = conv->init(&fmt,conv->priv); - drv->startvideo(h_drv,-1,4); - cap_on = 1; - fprintf(stderr,"grab: convert [%s => %s]\n", - ng_vfmt_to_desc[gfmt.fmtid], - ng_vfmt_to_desc[fmt.fmtid]); - return 0; - } - } - return -1; -} - -static struct ng_video_buf* -grab_one(void) -{ - struct ng_video_buf *cap,*buf; - int size; - - if (NULL == (cap = drv->nextframe(h_drv))) { - fprintf(stderr,"capturing image failed\n"); - exit(1); - } - - if (NULL != conv) { - size = (fmt.width * fmt.height * ng_vfmt_to_depth[fmt.fmtid]) >> 3; - buf = ng_malloc_video_buf(&fmt,size); - conv->frame(hconv,buf,cap); - buf->info = cap->info; - ng_release_video_buf(cap); - } else { - buf = cap; - } - return buf; -} - -static void grab_mute(int state) -{ - struct ng_attribute *attr,*attrs; - - if (NULL == (attrs = drv->list_attrs(h_drv))) - return; - if (NULL == (attr = ng_attr_byid(attrs,ATTR_ID_MUTE))) - return; - attr->write(attr,state); -} - -/* --------------------------------------------------------------------- */ - -static struct { - int fmtid; - int glfmt; - int gltype; - char *glext; -} fmttab[] = { - { -#ifdef GL_EXT_bgra - fmtid: VIDEO_BGR24, - glfmt: GL_BGR_EXT, - gltype: GL_UNSIGNED_BYTE, - glext: "GL_EXT_bgra", - },{ - fmtid: VIDEO_BGR32, - glfmt: GL_BGRA_EXT, - gltype: GL_UNSIGNED_BYTE, - glext: "GL_EXT_bgra", - },{ -#endif - fmtid: VIDEO_RGB24, - glfmt: GL_RGB, - gltype: GL_UNSIGNED_BYTE, - },{ - /* end of list */ - } -}; - -static int gl_attrib[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; -static Dimension wwidth,wheight; -static int wfmt; - -static void gl_resize(Widget widget) -{ - int w,h,i; - - XtVaGetValues(widget,XmNwidth,&wwidth,XmNheight,&wheight,NULL); - fprintf(stderr,"gl: resize %dx%d\n",wwidth,wheight); - - wwidth = fix_width(wwidth); - wheight = fix_height(wheight); - - glViewport(0, 0, wwidth, wheight); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluOrtho2D(0.0, wwidth, 0.0, wheight); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - w = wwidth; - h = wheight; - if (args.width) - w = args.width; - if (args.height) - h = args.height; - - if (args.tex) { - fprintf(stderr,"gl: texture size in: %dx%d\n",w,h); - /* check against max size */ - glGetIntegerv(GL_MAX_TEXTURE_SIZE,&i); - fprintf(stderr,"gl: texture size max: %d\n",i); - if (w > i) - w = i; - if (h > i) - h = i; - /* textures have power-of-two x,y dimensions */ - for (i = 0; w >= (1 << i); i++) - ; - w = (1 << (i-1)); - for (i = 0; h >= (1 << i); i++) - ; - h = (1 << (i-1)); - fprintf(stderr,"gl: texture size out: %dx%d\n",w,h); - } - grab_size(fmttab[wfmt].fmtid,w,h,1); -} - -static void gl_redraw(Widget widget) -{ - fprintf(stderr,"gl: redraw\n"); - glClear(GL_COLOR_BUFFER_BIT); - glXSwapBuffers(XtDisplay(widget), XtWindow(widget)); -} - -static void gl_blit_img(Widget widget, struct ng_video_buf *buf) -{ - float xs = (float)wwidth / buf->fmt.width; - float ys = (float)wheight / buf->fmt.height; - - glRasterPos2i(0, wheight); - glPixelZoom(xs,-ys); - glDrawPixels(buf->fmt.width, buf->fmt.height, - fmttab[wfmt].glfmt,fmttab[wfmt].gltype, - buf->data); - glXSwapBuffers(XtDisplay(widget), XtWindow(widget)); -} - -static void gl_blit_tex(Widget widget, struct ng_video_buf *buf) -{ - static GLint tex; - static int width,height; - - if (0 == tex) { - glGenTextures(1,&tex); - glBindTexture(GL_TEXTURE_2D,tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } - if (width != buf->fmt.width || height != buf->fmt.height) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - buf->fmt.width,buf->fmt.height,0, - fmttab[wfmt].glfmt,fmttab[wfmt].gltype, - buf->data); - width = buf->fmt.width; - height = buf->fmt.height; - } else { - glTexSubImage2D(GL_TEXTURE_2D, 0, - 0,0,buf->fmt.width,buf->fmt.height, - fmttab[wfmt].glfmt,fmttab[wfmt].gltype, - buf->data); - } - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glBegin(GL_QUADS); - glTexCoord2f(0,1); glVertex3f(0,0,0); - glTexCoord2f(0,0); glVertex3f(0,wheight,0); - glTexCoord2f(1,0); glVertex3f(wwidth,wheight,0); - glTexCoord2f(1,1); glVertex3f(wwidth,0,0); - glEnd(); - glXSwapBuffers(XtDisplay(widget), XtWindow(widget)); - glDisable(GL_TEXTURE_2D); -} - -static void gl_blit(Widget widget, struct ng_video_buf *buf) -{ - if (args.tex) - gl_blit_tex(view,buf); - else - gl_blit_img(view,buf); -} - -static int gl_ext(GLubyte *find) -{ - int len = strlen(find); - const GLubyte *ext; - GLubyte *pos; - - ext = glGetString(GL_EXTENSIONS); - if (NULL == (pos = strstr(ext,find))) - return 0; - if (pos != ext && pos[-1] != ' ') - return 0; - if (pos[len] != ' ' && pos[len] != '\0') - return 0; - fprintf(stderr,"gl: extention %s available\n",find); - return 1; -} - -static void gl_init(Widget widget) -{ - XVisualInfo *visinfo; - GLXContext ctx; - int i; - - fprintf(stderr,"gl: init\n"); - visinfo = glXChooseVisual(XtDisplay(widget), - DefaultScreen(XtDisplay(widget)), - gl_attrib); - if (!visinfo) { - fprintf(stderr,"gl: can't get visual (rgb,db)\n"); - exit(1); - } - ctx = glXCreateContext( dpy, visinfo, NULL, True ); - glXMakeCurrent(XtDisplay(widget),XtWindow(widget),ctx); - fprintf(stderr, "gl: DRI: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); - - glClearColor (0.0, 0.0, 0.0, 0.0); - glShadeModel(GL_FLAT); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - /* try without converting first ... */ - for (i = 0; fmttab[i].fmtid != 0; i++) { - if (fmttab[i].glext) - if (!gl_ext(fmttab[i].glext)) - continue; - if (0 == grab_size(fmttab[i].fmtid,320,240,0)) { - wfmt = i; - return; - } - } - /* ... failing that with converting */ - for (i = 0; fmttab[i].fmtid != 0; i++) { - if (fmttab[i].glext) - if (!gl_ext(fmttab[i].glext)) - continue; - if (0 == grab_size(fmttab[i].fmtid,320,240,1)) { - wfmt = i; - return; - } - } - fprintf(stderr,"sorry, no way to display images\n"); - exit(1); -} - -/* --------------------------------------------------------------------- */ - -static void event(Widget widget, XtPointer client_data, - XEvent *event, Boolean *d) -{ - switch (event->type) { - case Expose: - if (0 != event->xexpose.count) - return; - fprintf(stderr,"ev: expose\n"); - gl_redraw(widget); - break; - case ConfigureNotify: - fprintf(stderr,"ev: configure\n"); - XClearArea(XtDisplay(widget),XtWindow(widget),0,0,0,0,True); - gl_resize(widget); - break; - case MapNotify: - fprintf(stderr,"ev: map\n"); - gl_resize(widget); - break; - case UnmapNotify: - fprintf(stderr,"ev: unmap\n"); - break; - default: - fprintf(stderr,"ev: unknown\n"); - break; - } -} - -static void -quit_cb(Widget widget, XtPointer clientdata, XtPointer call_data) -{ - grab_mute(1); - exit(0); -} - -static Boolean -idle(XtPointer client_data) -{ - static const char progress[] = "|/-\\"; - static int count,lastcount; - static struct timeval t,lastt; - struct ng_video_buf *buf; - - gettimeofday(&t,NULL); - if (t.tv_sec != lastt.tv_sec) { - fprintf(stderr,"%5d fps\r",count-lastcount); - lastt = t; - lastcount = count; - } - - buf = grab_one(); - gl_blit(view,buf); - ng_release_video_buf(buf); - fprintf(stderr,"%c\r",progress[(count++)%4]); - return False; -} - -static void create_widgets(Widget parent) -{ - Widget form,menubar,menu,push; - - /* form container */ - form = XtVaCreateManagedWidget("form", xmFormWidgetClass, parent, - NULL); - - /* menu bar */ - menubar = XmCreateMenuBar(form,"bar",NULL,0); - XtManageChild(menubar); - - /* file menu */ - menu = XmCreatePulldownMenu(menubar,"fileM",NULL,0); - XtVaCreateManagedWidget("file",xmCascadeButtonWidgetClass,menubar, - XmNsubMenuId,menu,NULL); - push = XtVaCreateManagedWidget("quit",xmPushButtonWidgetClass,menu,NULL); - XtAddCallback(push,XmNactivateCallback,quit_cb,NULL); - - /* main view */ - view = XtVaCreateManagedWidget("view", xmDrawingAreaWidgetClass,form, - XmNwidth,320, - XmNheight,240, - NULL); - XtAddEventHandler(view, StructureNotifyMask | ExposureMask, - True, event, NULL); -} - -static void usage(void) -{ - fprintf(stderr, - "\n" - "gl - OpenGL TV test application\n" - "\n" - "use some other TV application to initialize the hardware first,\n" - "this is *really* a test utility only -- without controls\n" - "\n" - "known options:\n" - " -h,-help this text\n" - " -c,-device dev capture device [default: %s]\n" - " -x,-width n capture width [default: window size]\n" - " -y,-height n capture height [default: window size]\n" - " -tex blit frames using texture mapping [default]\n" - " -img blit frames using glDrawPixels\n" - "\n", - ng_dev.video); -} - -int -main(int argc, char *argv[]) -{ - Atom del; - - ng_init(); - XtSetLanguageProc(NULL,NULL,NULL); - app_shell = XtVaAppInitialize(&app_context, "gl", - opt_desc, opt_count, - &argc, argv, - fallback_ressources, - NULL); - XtGetApplicationResources(app_shell,&args, - args_desc,args_count, - NULL,0); - if (args.help) { - usage(); - exit(1); - } - - dpy = XtDisplay(app_shell); - XmdRegisterEditres(app_shell); - del = XInternAtom(dpy,"WM_DELETE_WINDOW",False); - XmAddWMProtocolCallback(app_shell,del,quit_cb,NULL); - create_widgets(app_shell); - - XtRealizeWidget(app_shell); - grab_init(args.device); - grab_mute(0); - gl_init(view); - - XtAppAddWorkProc(app_context,idle,NULL); - XtAppAddWorkProc(app_context,idle,NULL); - XtAppMainLoop(app_context); - return 0; -} diff --git a/debug/gl.h b/debug/gl.h deleted file mode 100644 index fb5ba97..0000000 --- a/debug/gl.h +++ /dev/null @@ -1,17 +0,0 @@ -"gl.title: OpenGL TV test utility", -"", -"gl.form.*.leftAttachment: ATTACH_FORM", -"gl.form.*.rightAttachment: ATTACH_FORM", -"gl.form.view.topAttachment: ATTACH_WIDGET", -"gl.form.view.topWidget: bar", -"gl.form.view.bottomAttachment: ATTACH_FORM", -"gl.form.view.background: black", -"gl.form.view.foreground: white", -"", -"gl*bar.file.labelString: File", -"gl*bar.file.mnemonic: F", -"gl*bar*quit.labelString: Quit", -"gl*bar*quit.mnemonic: Q", -"gl*bar*quit.acceleratorText: Q", -"gl*bar*quit.accelerator: <Key>Q", -"", diff --git a/fb/config.log b/fb/config.log deleted file mode 100644 index 1d626d9..0000000 --- a/fb/config.log +++ /dev/null @@ -1,481 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by configure, which was -generated by GNU Autoconf 2.52. Invocation command line was - - $ ../configure - -## ---------- ## -## Platform. ## -## ---------- ## - -hostname = vmware.masq.in-berlin.de -uname -m = i386 -uname -r = 4.2-RELEASE -uname -s = FreeBSD -uname -v = FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000 jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC - -/usr/bin/uname -p = i386 -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/kraxel/bin - -## ------------ ## -## Core tests. ## -## ------------ ## - -configure:929: PATH=".;."; conftest.sh -conftest.sh: not found -configure:932: $? = 127 -configure:1022: checking for gcc -configure:1037: found /usr/bin/gcc -configure:1045: result: gcc -configure:1273: checking for C compiler version -configure:1276: gcc --version </dev/null >&5 -2.95.3 -configure:1279: $? = 0 -configure:1281: gcc -v </dev/null >&5 -Using builtin specs. -gcc version 2.95.3 20010315 (release) [FreeBSD] -configure:1284: $? = 0 -configure:1286: gcc -V </dev/null >&5 -gcc: argument to `-V' is missing -configure:1289: $? = 1 -configure:1309: checking for C compiler default output -configure:1312: gcc conftest.c >&5 -configure:1315: $? = 0 -configure:1344: result: a.out -configure:1349: checking whether the C compiler works -configure:1355: ./a.out -configure:1358: $? = 0 -configure:1373: result: yes -configure:1380: checking whether we are cross compiling -configure:1382: result: no -configure:1385: checking for executable suffix -configure:1387: gcc -o conftest conftest.c >&5 -configure:1390: $? = 0 -configure:1412: result: -configure:1418: checking for object suffix -configure:1436: gcc -c conftest.c >&5 -configure:1439: $? = 0 -configure:1458: result: o -configure:1462: checking whether we are using the GNU C compiler -configure:1483: gcc -c conftest.c >&5 -configure:1486: $? = 0 -configure:1489: test -s conftest.o -configure:1492: $? = 0 -configure:1504: result: yes -configure:1510: checking whether gcc accepts -g -configure:1528: gcc -c -g conftest.c >&5 -configure:1531: $? = 0 -configure:1534: test -s conftest.o -configure:1537: $? = 0 -configure:1547: result: yes -configure:1574: gcc -c -g -O2 conftest.c >&5 -conftest.c:2: syntax error before `me' -configure:1577: $? = 1 -configure: failed program was: -#ifndef __cplusplus - choke me -#endif -configure:1680: checking how to run the C preprocessor -configure:1706: gcc -E conftest.c -configure:1712: $? = 0 -configure:1739: gcc -E conftest.c -configure:1736: ac_nonexistent.h: No such file or directory -configure:1745: $? = 1 -configure: failed program was: -#line 1735 "configure" -#include "confdefs.h" -#include <ac_nonexistent.h> -configure:1782: result: gcc -E -configure:1797: gcc -E conftest.c -configure:1803: $? = 0 -configure:1830: gcc -E conftest.c -configure:1827: ac_nonexistent.h: No such file or directory -configure:1836: $? = 1 -configure: failed program was: -#line 1826 "configure" -#include "confdefs.h" -#include <ac_nonexistent.h> -configure:1912: checking for a BSD compatible install -configure:1961: result: /usr/bin/install -c -configure:1976: checking for gccmakedep -configure:2002: result: no -configure:1976: checking for makedepend -configure:2002: result: no -configure:2053: checking for endian.h -configure:2063: gcc -E conftest.c -configure:2060: endian.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <endian.h> -configure:2088: result: no -configure:2053: checking for getopt.h -configure:2063: gcc -E conftest.c -configure:2060: getopt.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <getopt.h> -configure:2088: result: no -configure:2053: checking for soundcard.h -configure:2063: gcc -E conftest.c -configure:2060: soundcard.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <soundcard.h> -configure:2088: result: no -configure:2053: checking for sys/soundcard.h -configure:2063: gcc -E conftest.c -configure:2069: $? = 0 -configure:2088: result: yes -configure:2053: checking for alsa/asoundlib.h -configure:2063: gcc -E conftest.c -configure:2060: alsa/asoundlib.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <alsa/asoundlib.h> -configure:2088: result: no -configure:2053: checking for linux/joystick.h -configure:2063: gcc -E conftest.c -configure:2060: linux/joystick.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <linux/joystick.h> -configure:2088: result: no -configure:2053: checking for dev/ic/bt8xx.h -configure:2063: gcc -E conftest.c -configure:2060: dev/ic/bt8xx.h: No such file or directory -configure:2069: $? = 1 -configure: failed program was: -#line 2059 "configure" -#include "confdefs.h" -#include <dev/ic/bt8xx.h> -configure:2088: result: no -configure:2053: checking for machine/ioctl_bt848.h -configure:2063: gcc -E conftest.c -configure:2069: $? = 0 -configure:2088: result: yes -configure:2101: checking for ftello -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -configure:2141: $? = 0 -configure:2144: test -s conftest -configure:2147: $? = 0 -configure:2157: result: yes -configure:2101: checking for fseeko -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -configure:2141: $? = 0 -configure:2144: test -s conftest -configure:2147: $? = 0 -configure:2157: result: yes -configure:2101: checking for getpt -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -/tmp/ccrOzzhZ.o: In function `main': -/home/kraxel/debian/xawtv-3.74/fb/configure(.text+0x9): undefined reference to `getpt' -configure:2141: $? = 1 -configure: failed program was: -#line 2107 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getpt (); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char getpt (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_getpt) || defined (__stub___getpt) -choke me -#else -f = getpt; -#endif - - ; - return 0; -} -configure:2157: result: no -configure:2101: checking for getnameinfo -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -configure:2141: $? = 0 -configure:2144: test -s conftest -configure:2147: $? = 0 -configure:2157: result: yes -configure:2101: checking for getopt_long -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -/tmp/ccM4iIme.o: In function `main': -/home/kraxel/debian/xawtv-3.74/fb/configure(.text+0x9): undefined reference to `getopt_long' -configure:2141: $? = 1 -configure: failed program was: -#line 2107 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getopt_long (); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char getopt_long (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_getopt_long) || defined (__stub___getopt_long) -choke me -#else -f = getopt_long; -#endif - - ; - return 0; -} -configure:2157: result: no -configure:2101: checking for strcasestr -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -/tmp/ccVGr2Sj.o: In function `main': -/home/kraxel/debian/xawtv-3.74/fb/configure(.text+0x9): undefined reference to `strcasestr' -configure:2141: $? = 1 -configure: failed program was: -#line 2107 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strcasestr (); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strcasestr (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_strcasestr) || defined (__stub___strcasestr) -choke me -#else -f = strcasestr; -#endif - - ; - return 0; -} -configure:2157: result: no -configure:2101: checking for dlopen -configure:2138: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c >&5 -configure:2141: $? = 0 -configure:2144: test -s conftest -configure:2147: $? = 0 -configure:2157: result: yes -configure:2223: checking for ELF -configure:2226: result: yes -configure:2234: checking for pthread_create in -lpthread -configure:2261: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -lpthread >&5 -/usr/libexec/elf/ld: cannot find -lpthread -configure:2264: $? = 1 -configure: failed program was: -#line 2242 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char pthread_create (); -int -main () -{ -pthread_create (); - ; - return 0; -} -configure:2281: result: no -configure:2288: checking for pthread_create in -lc_r -configure:2315: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -lc_r >&5 -/usr/lib/libc.so: WARNING! setkey(3) not present in the system! -/usr/lib/libc.so: warning: this program uses gets(), which is unsafe. -/usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() -/usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! -/usr/lib/libc.so: WARNING! encrypt(3) not present in the system! -/usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() -/usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended. -/usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! -/usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp() -configure:2318: $? = 0 -configure:2321: test -s conftest -configure:2324: $? = 0 -configure:2335: result: yes -configure:2342: checking for main in -lossaudio -configure:2362: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -lossaudio >&5 -/usr/libexec/elf/ld: cannot find -lossaudio -configure:2365: $? = 1 -configure: failed program was: -#line 2350 "configure" -#include "confdefs.h" - -int -main () -{ -main (); - ; - return 0; -} -configure:2382: result: no -configure:2388: checking for initscr in -lncurses -configure:2415: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -lncurses >&5 -configure:2418: $? = 0 -configure:2421: test -s conftest -configure:2424: $? = 0 -configure:2435: result: yes -configure:2503: checking for X -configure:2604: gcc -E conftest.c -configure:2601: X11/Intrinsic.h: No such file or directory -configure:2610: $? = 1 -configure: failed program was: -#line 2600 "configure" -#include "confdefs.h" -#include <X11/Intrinsic.h> -configure:2655: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -lXt >&5 -configure:2644: X11/Intrinsic.h: No such file or directory -configure:2658: $? = 1 -configure: failed program was: -#line 2643 "configure" -#include "confdefs.h" -#include <X11/Intrinsic.h> -int -main () -{ -XtMalloc (0) - ; - return 0; -} -configure:2702: result: no -configure:3586: checking for jpeg_start_compress in -ljpeg -configure:3613: gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib conftest.c -ljpeg >&5 -/usr/libexec/elf/ld: cannot find -ljpeg -configure:3616: $? = 1 -configure: failed program was: -#line 3594 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char jpeg_start_compress (); -int -main () -{ -jpeg_start_compress (); - ; - return 0; -} -configure:3633: result: no - -## ----------------- ## -## Cache variables. ## -## ----------------- ## - -ac_cv_func_fseeko='yes' -ac_cv_func_getopt_long='no' -ac_cv_func_dlopen='yes' -ac_cv_prog_cc_g='yes' -ac_cv_env_LDFLAGS_set='' -ac_cv_path_install='/usr/bin/install -c' -ac_cv_c_compiler_gnu='yes' -ac_cv_env_CFLAGS_set='' -ac_cv_lib_ossaudio_main='no' -ac_cv_func_ftello='yes' -ac_cv_env_CPP_value='' -ac_cv_env_CPPFLAGS_set='' -ac_cv_header_soundcard_h='no' -ac_cv_env_host_alias_set='' -ac_cv_lib_jpeg_jpeg_start_compress='no' -ac_cv_header_alsa_asoundlib_h='no' -ac_cv_env_build_alias_set='' -ac_cv_lib_ncurses_initscr='yes' -ac_cv_env_LDFLAGS_value='' -ac_cv_env_target_alias_set='' -ac_cv_header_getopt_h='no' -ac_cv_env_CFLAGS_value='' -ac_cv_env_CC_set='' -ac_cv_have_x='have_x=no' -ac_cv_func_getnameinfo='yes' -ac_cv_header_machine_ioctl_bt848_h='yes' -ac_cv_header_endian_h='no' -ac_cv_lib_c_r_pthread_create='yes' -ac_cv_env_CPPFLAGS_value='' -ac_cv_env_host_alias_value='' -ac_cv_func_getpt='no' -ac_cv_header_sys_soundcard_h='yes' -ac_cv_lib_pthread_pthread_create='no' -ac_cv_prog_CPP='gcc -E' -ac_cv_env_build_alias_value='' -ac_cv_prog_ac_ct_CC='gcc' -ac_cv_env_target_alias_value='' -ac_cv_env_CC_value='' -ac_cv_env_CPP_set='' -ac_cv_func_strcasestr='no' -ac_cv_header_dev_ic_bt8xx_h='no' -ac_cv_header_linux_joystick_h='no' -ac_cv_objext='o' - -## ------------ ## -## confdefs.h. ## -## ------------ ## - -#define HAVE_SOCKADDR_STORAGE 1 -#define HAVE_SYS_SOUNDCARD_H 1 -#define HAVE_MACHINE_IOCTL_BT848_H 1 -#define HAVE_FTELLO 1 -#define HAVE_FSEEKO 1 -#define HAVE_GETNAMEINFO 1 -#define HAVE_DLOPEN 1 -#define X_DISPLAY_MISSING 1 - - -configure: exit 1 diff --git a/jwz/remote.diff b/jwz/remote.diff new file mode 100644 index 0000000..a611b81 --- /dev/null +++ b/jwz/remote.diff @@ -0,0 +1,89 @@ +--- xscreensaver-4.00/driver/remote.h Sun Nov 14 01:15:07 1999 ++++ remote.h Tue Mar 26 11:01:34 2002 +@@ -21,4 +21,6 @@ + char **user_ret, + char **host_ret); + ++extern void xscreensaver_init(Display *dpy); ++ + #endif /* _XSCREENSAVER_REMOTE_H_ */ +--- xscreensaver-4.00/driver/remote.c Mon Dec 20 12:24:19 1999 ++++ remote.c Tue Mar 26 11:31:14 2002 +@@ -33,16 +33,20 @@ + #include <X11/Xutil.h> /* for XGetClassHint() */ + #include <X11/Xos.h> + ++/* for xawtv */ ++#include <X11/Intrinsic.h> ++extern XtAppContext app_context; ++ + #include "remote.h" + + #ifdef _VROOT_H_ + ERROR! you must not include vroot.h in this file + #endif + +-extern char *progname; +-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE; +-extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT; +-extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK; ++static char *progname = "fixme"; ++static Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE; ++static Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT; ++static Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK; + + + static XErrorHandler old_handler = 0; +@@ -261,13 +265,13 @@ + } + + if (any && nhacks == 1) +- fprintf (stdout, " (hack #%d)\n", data[2]); ++ fprintf (stdout, " (hack #%ld)\n", data[2]); + else if (any) + { + fprintf (stdout, " (hacks: "); + for (i = 0; i < nhacks; i++) + { +- fprintf (stdout, "#%d", data[2 + i]); ++ fprintf (stdout, "#%ld", data[2 + i]); + if (i != nhacks-1) + fputs (", ", stdout); + } +@@ -380,7 +384,7 @@ + else + { + XEvent event; +- XNextEvent (dpy, &event); ++ XtAppNextEvent(app_context,&event); + if (event.xany.type == PropertyNotify && + event.xproperty.state == PropertyNewValue && + event.xproperty.atom == XA_SCREENSAVER_RESPONSE) +@@ -459,6 +463,8 @@ + return ret; + } + } ++ } else { ++ XtDispatchEvent(&event); + } + } + } +@@ -568,3 +574,18 @@ + XFree (id); + } + } ++ ++void xscreensaver_init(Display *dpy) ++{ ++ XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False); ++ XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False); ++ XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False); ++ XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False); ++ XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False); ++ XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False); ++ XA_SELECT = XInternAtom (dpy, "SELECT", False); ++ XA_EXIT = XInternAtom (dpy, "EXIT", False); ++ XA_DEMO = XInternAtom (dpy, "DEMO", False); ++ XA_LOCK = XInternAtom (dpy, "LOCK", False); ++ XA_BLANK = XInternAtom (dpy, "BLANK", False); ++} diff --git a/libng/Subdir.mk b/libng/Subdir.mk index c39de91..d9dbf79 100644 --- a/libng/Subdir.mk +++ b/libng/Subdir.mk @@ -5,7 +5,8 @@ OBJS-libng := \ libng/color_common.o \ libng/color_packed.o \ libng/color_lut.o \ - libng/color_yuv2rgb.o + libng/color_yuv2rgb.o \ + libng/convert.o libng/libng.a: $(OBJS-libng) rm -f $@ diff --git a/libng/color_lut.c b/libng/color_lut.c index ce4856b..b9f857e 100644 --- a/libng/color_lut.c +++ b/libng/color_lut.c @@ -13,6 +13,7 @@ #include <stdlib.h> #include <unistd.h> #include <pthread.h> +#include <inttypes.h> #include <sys/time.h> #include <sys/types.h> @@ -25,10 +26,10 @@ unsigned long ng_lut_blue[256]; /* ------------------------------------------------------------------- */ -static void -rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p) +void +ng_rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p) { - unsigned short *d = (unsigned short*)dest; + uint16_t *d = (uint16_t*)dest; while (p-- > 0) { *(d++) = ng_lut_red[src[0]] | ng_lut_green[src[1]] | @@ -40,7 +41,7 @@ rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p) static void bgr24_to_lut2(unsigned char *dest, unsigned char *src, int p) { - unsigned short *d = (unsigned short*)dest; + uint16_t *d = (uint16_t*)dest; while (p-- > 0) { *(d++) = ng_lut_red[src[2]] | ng_lut_green[src[1]] | @@ -52,7 +53,7 @@ bgr24_to_lut2(unsigned char *dest, unsigned char *src, int p) static void rgb32_to_lut2(unsigned char *dest, unsigned char *src, int p) { - unsigned short *d = (unsigned short*)dest; + uint16_t *d = (uint16_t*)dest; while (p-- > 0) { *(d++) = ng_lut_red[src[1]] | ng_lut_green[src[2]] | @@ -64,7 +65,7 @@ rgb32_to_lut2(unsigned char *dest, unsigned char *src, int p) static void bgr32_to_lut2(unsigned char *dest, unsigned char *src, int p) { - unsigned short *d = (unsigned short*)dest; + uint16_t *d = (uint16_t*)dest; while (p-- > 0) { *(d++) = ng_lut_red[src[2]] | ng_lut_green[src[1]] | @@ -76,7 +77,7 @@ bgr32_to_lut2(unsigned char *dest, unsigned char *src, int p) static void gray_to_lut2(unsigned char *dest, unsigned char *src, int p) { - unsigned short *d = (unsigned short*)dest; + uint16_t *d = (uint16_t*)dest; while (p-- > 0) { *(d++) = ng_lut_red[*src] | ng_lut_green[*src] | ng_lut_blue[*src]; @@ -86,8 +87,8 @@ gray_to_lut2(unsigned char *dest, unsigned char *src, int p) /* ------------------------------------------------------------------- */ -static void -rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p) +void +ng_rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p) { unsigned int *d = (unsigned int*)dest; @@ -151,7 +152,7 @@ static struct ng_video_conv lut2_list[] = { { NG_GENERIC_PACKED, fmtid_in: VIDEO_RGB24, - priv: rgb24_to_lut2, + priv: ng_rgb24_to_lut2, }, { NG_GENERIC_PACKED, fmtid_in: VIDEO_BGR24, @@ -189,7 +190,7 @@ static struct ng_video_conv lut4_list[] = { { NG_GENERIC_PACKED, fmtid_in: VIDEO_RGB24, - priv: rgb24_to_lut4, + priv: ng_rgb24_to_lut4, }, { NG_GENERIC_PACKED, fmtid_in: VIDEO_BGR24, diff --git a/libng/convert.c b/libng/convert.c new file mode 100644 index 0000000..bd17600 --- /dev/null +++ b/libng/convert.c @@ -0,0 +1,137 @@ +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +#include "grab-ng.h" + +/*-------------------------------------------------------------------------*/ +/* color space conversion / compression helper functions */ + +struct ng_convert_handle* +ng_convert_alloc(struct ng_video_conv *conv, + struct ng_video_fmt *i, + struct ng_video_fmt *o) +{ + struct ng_convert_handle *h; + + h = malloc(sizeof(*h)); + if (NULL == h) + return 0; + memset(h,0,sizeof(*h)); + + /* fixup output image size to match incoming */ + o->width = i->width; + o->height = i->height; + if (0 == o->bytesperline) + o->bytesperline = o->width * ng_vfmt_to_depth[o->fmtid] / 8; + + h->ifmt = *i; + h->ofmt = *o; + if (conv) + h->conv = conv; + return h; +} + +void +ng_convert_init(struct ng_convert_handle *h) +{ + if (0 == h->ifmt.bytesperline) + h->ifmt.bytesperline = h->ifmt.width * + ng_vfmt_to_depth[h->ifmt.fmtid] / 8; + if (0 == h->ofmt.bytesperline) + h->ofmt.bytesperline = h->ofmt.width * + ng_vfmt_to_depth[h->ofmt.fmtid] / 8; + + h->isize = h->ifmt.height * h->ifmt.bytesperline; + if (0 == h->isize) + h->isize = h->ifmt.width * h->ifmt.height * 3; + h->osize = h->ofmt.height * h->ofmt.bytesperline; + if (0 == h->osize) + h->osize = h->ofmt.width * h->ofmt.height * 3; + + if (h->conv) + h->chandle = h->conv->init(&h->ofmt,h->conv->priv); + + if (ng_debug) { + fprintf(stderr,"convert-in : %dx%d %s (size=%d)\n", + h->ifmt.width, h->ifmt.height, + ng_vfmt_to_desc[h->ifmt.fmtid], h->isize); + fprintf(stderr,"convert-out: %dx%d %s (size=%d)\n", + h->ofmt.width, h->ofmt.height, + ng_vfmt_to_desc[h->ofmt.fmtid], h->osize); + } +} + +static void +ng_convert_copyframe(struct ng_video_buf *dest, + struct ng_video_buf *src) +{ + int i,sw,dw; + unsigned char *sp,*dp; + + dw = dest->fmt.width * ng_vfmt_to_depth[dest->fmt.fmtid] / 8; + sw = src->fmt.width * ng_vfmt_to_depth[src->fmt.fmtid] / 8; + if (src->fmt.bytesperline == sw && dest->fmt.bytesperline == dw) { + /* can copy in one go */ + memcpy(dest->data, src->data, + src->fmt.bytesperline * src->fmt.height); + } else { + /* copy line by line */ + dp = dest->data; + sp = src->data; + for (i = 0; i < src->fmt.height; i++) { + memcpy(dp,sp,dw); + dp += dest->fmt.bytesperline; + sp += src->fmt.bytesperline; + } + } +} + +struct ng_video_buf* +ng_convert_frame(struct ng_convert_handle *h, + struct ng_video_buf *dest, + struct ng_video_buf *buf) +{ + if (NULL == buf) + return NULL; + + if (NULL == dest && NULL != h->conv) + dest = ng_malloc_video_buf(&h->ofmt,h->osize); + + if (NULL != dest) { + dest->fmt = h->ofmt; + dest->size = h->osize; + if (NULL != h->conv) { + h->conv->frame(h->chandle,dest,buf); + } else { + ng_convert_copyframe(dest,buf); + } + dest->info = buf->info; + ng_release_video_buf(buf); + buf = dest; + } + return buf; +} + +void +ng_convert_fini(struct ng_convert_handle *h) +{ + if (h->conv) + h->conv->fini(h->chandle); + free(h); +} + +struct ng_video_buf* +ng_convert_single(struct ng_convert_handle *h, struct ng_video_buf *in) +{ + struct ng_video_buf *out; + + ng_convert_init(h); + out = ng_convert_frame(h,NULL,in); + ng_convert_fini(h); + return out; +} + diff --git a/libng/grab-ng.c b/libng/grab-ng.c index 48ce8c3..1b95ab5 100644 --- a/libng/grab-ng.c +++ b/libng/grab-ng.c @@ -175,6 +175,21 @@ ng_malloc_video_buf(struct ng_video_fmt *fmt, int size) /* --------------------------------------------------------------------- */ +struct ng_audio_buf* +ng_malloc_audio_buf(struct ng_audio_fmt *fmt, int size) +{ + struct ng_audio_buf *buf; + + buf = malloc(sizeof(*buf)+size); + memset(buf,0,sizeof(*buf)); + buf->fmt = *fmt; + buf->size = size; + buf->data = (char*)buf + sizeof(*buf); + return buf; +} + +/* --------------------------------------------------------------------- */ + struct ng_attribute* ng_attr_byid(struct ng_attribute *attrs, int id) { @@ -347,6 +362,7 @@ ng_ratio_fixup2(int *width, int *height, int *xoff, int *yoff, struct ng_video_conv **ng_conv; struct ng_filter **ng_filters; struct ng_writer **ng_writers; +struct ng_reader **ng_readers; struct ng_vid_driver **ng_vid_drivers; struct ng_dsp_driver **ng_dsp_drivers; struct ng_mix_driver **ng_mix_drivers; @@ -409,6 +425,15 @@ ng_writer_register(int magic, char *plugname, struct ng_writer *writer) } int +ng_reader_register(int magic, char *plugname, struct ng_reader *reader) +{ + if (0 != ng_check_magic(magic,plugname,"reader")) + return -1; + ng_register_listadd((void***)(&ng_readers),reader); + return 0; +} + +int ng_vid_driver_register(int magic, char *plugname, struct ng_vid_driver *driver) { if (0 != ng_check_magic(magic,plugname,"video drv")) @@ -436,13 +461,13 @@ ng_mix_driver_register(int magic, char *plugname, struct ng_mix_driver *driver) } struct ng_video_conv* -ng_conv_find(int out, int *i) +ng_conv_find_to(int out, int *i) { struct ng_video_conv *ret = NULL; for (; ng_conv[*i] != NULL; (*i)++) { #if 0 - fprintf(stderr,"\tconv: %-28s => %s\n", + fprintf(stderr,"\tconv to: %-28s => %s\n", ng_vfmt_to_desc[ng_conv[*i]->fmtid_in], ng_vfmt_to_desc[ng_conv[*i]->fmtid_out]); #endif @@ -455,6 +480,37 @@ ng_conv_find(int out, int *i) return ret; } +struct ng_video_conv* +ng_conv_find_from(int in, int *i) +{ + struct ng_video_conv *ret = NULL; + + for (; ng_conv[*i] != NULL; (*i)++) { +#if 0 + fprintf(stderr,"\tconv from: %-28s => %s\n", + ng_vfmt_to_desc[ng_conv[*i]->fmtid_in], + ng_vfmt_to_desc[ng_conv[*i]->fmtid_out]); +#endif + if (ng_conv[*i]->fmtid_in == in) { + ret = ng_conv[*i]; + (*i)++; + break; + } + } + return ret; +} + +struct ng_video_conv* +ng_conv_find_match(int in, int out) +{ + int i; + + for (i = 0; ng_conv[i] != NULL; i++) + if (ng_conv[i]->fmtid_in == in && ng_conv[i]->fmtid_out == out) + return ng_conv[i]; + return NULL; +} + /* --------------------------------------------------------------------- */ const struct ng_vid_driver* @@ -503,7 +559,7 @@ ng_vid_open(char *device, struct ng_video_fmt *screen, void *base, } const struct ng_dsp_driver* -ng_dsp_open(char *device, struct ng_audio_fmt *fmt, void **handle) +ng_dsp_open(char *device, struct ng_audio_fmt *fmt, int record, void **handle) { int i; @@ -513,10 +569,14 @@ ng_dsp_open(char *device, struct ng_audio_fmt *fmt, void **handle) for (i = 0; NULL != ng_dsp_drivers[i]; i++) { if (NULL == ng_dsp_drivers[i]->name) continue; + if (record && NULL == ng_dsp_drivers[i]->read) + continue; + if (!record && NULL == ng_dsp_drivers[i]->write) + continue; if (ng_debug) fprintf(stderr,"dsp-open: trying: %s... \n", ng_dsp_drivers[i]->name); - if (NULL != (*handle = ng_dsp_drivers[i]->open(device,fmt))) + if (NULL != (*handle = ng_dsp_drivers[i]->open(device,fmt,record))) break; if (ng_debug) fprintf(stderr,"dsp-open: failed: %s\n",ng_dsp_drivers[i]->name); @@ -557,6 +617,40 @@ ng_mix_init(char *device, char *channel) return attrs; } +struct ng_reader* ng_find_reader(char *filename) +{ + struct ng_reader *reader; + char blk[512]; + FILE *fp; + int i,m; + + if (NULL == ng_readers) + return NULL; + + if (NULL == (fp = fopen(filename, "r"))) { + fprintf(stderr,"open %s: %s\n",filename,strerror(errno)); + return NULL; + } + memset(blk,0,sizeof(blk)); + fread(blk,1,sizeof(blk),fp); + fclose(fp); + + for (i = 0;; i++) { + reader = ng_readers[i]; + if (NULL == reader) { + if (ng_debug) + fprintf(stderr,"%s: no reader found\n",filename); + return NULL; + } + for (m = 0; m < 4 && reader->mlen[m] > 0; m++) { + if (0 == memcmp(blk+reader->moff[m],reader->magic[m], + reader->mlen[m])) + return reader; + } + } + return NULL; +} + long long ng_get_timestamp() { @@ -700,20 +794,19 @@ void ng_check_clipping(int width, int height, int xadjust, int yadjust, static int ng_plugins(char *dirname) { - struct dirent *ent; + struct dirent **list; char filename[1024]; void *plugin; void (*initcall)(void); - DIR *dir; - int n = 0; + int i,n = 0,l = 0; - dir = opendir(dirname); - if (NULL == dir) - return n; - while (NULL != (ent = readdir(dir))) { - if (0 != fnmatch("*.so",ent->d_name,0)) + n = scandir(dirname,&list,NULL,alphasort); + if (n <= 0) + return 0; + for (i = 0; i < n; i++) { + if (0 != fnmatch("*.so",list[i]->d_name,0)) continue; - sprintf(filename,"%s/%s",dirname,ent->d_name); + sprintf(filename,"%s/%s",dirname,list[i]->d_name); if (NULL == (plugin = dlopen(filename,RTLD_NOW))) { fprintf(stderr,"dlopen: %s\n",dlerror()); continue; @@ -725,10 +818,12 @@ static int ng_plugins(char *dirname) } } initcall(); - n++; + l--; } - closedir(dir); - return n; + for (i = 0; i < n; i++) + free(list[i]); + free(list); + return l; } void diff --git a/libng/grab-ng.h b/libng/grab-ng.h index 1bf4b7c..22bdd9a 100644 --- a/libng/grab-ng.h +++ b/libng/grab-ng.h @@ -158,6 +158,7 @@ struct ng_audio_fmt { struct ng_audio_buf { struct ng_audio_fmt fmt; int size; + int written; /* for partial writes */ char *data; struct { @@ -165,6 +166,8 @@ struct ng_audio_buf { } info; }; +struct ng_audio_buf* ng_malloc_audio_buf(struct ng_audio_fmt *fmt, + int size); /* --------------------------------------------------------------------- */ /* someone who receives video and/or audio data (writeavi, ...) */ @@ -193,6 +196,23 @@ struct ng_writer { int (*wr_close)(void *handle); }; +struct ng_reader { + const char *name; + const char *desc; + + char *magic[4]; + int moff[4]; + int mlen[4]; + + void* (*rd_open)(char *moviename, int *vfmt, int vn); + struct ng_video_fmt* (*rd_vfmt)(void *handle); + struct ng_audio_fmt* (*rd_afmt)(void *handle); + struct ng_video_buf* (*rd_vdata)(void *handle, int drop); + struct ng_audio_buf* (*rd_adata)(void *handle); + long long (*frame_time)(void *handle); + int (*rd_close)(void *handle); +}; + /* --------------------------------------------------------------------- */ /* attributes */ @@ -274,11 +294,14 @@ struct ng_vid_driver { struct ng_dsp_driver { const char *name; - void* (*open)(char *device, struct ng_audio_fmt *fmt); + void* (*open)(char *device, struct ng_audio_fmt *fmt, + int record); void (*close)(void *handle); int (*fd)(void *handle); int (*startrec)(void *handle); struct ng_audio_buf* (*read)(void *handle, long long stopby); + struct ng_audio_buf* (*write)(void *handle, struct ng_audio_buf *buf); + long long (*latency)(void *handle); }; struct ng_mix_driver { @@ -306,6 +329,26 @@ struct ng_video_conv { void *priv; }; +struct ng_convert_handle { + struct ng_video_fmt ifmt; + struct ng_video_fmt ofmt; + int isize; + int osize; + struct ng_video_conv *conv; + void *chandle; +}; + +struct ng_convert_handle* ng_convert_alloc(struct ng_video_conv *conv, + struct ng_video_fmt *i, + struct ng_video_fmt *o); +void ng_convert_init(struct ng_convert_handle *h); +struct ng_video_buf* ng_convert_frame(struct ng_convert_handle *h, + struct ng_video_buf *dest, + struct ng_video_buf *buf); +void ng_convert_fini(struct ng_convert_handle *h); +struct ng_video_buf* ng_convert_single(struct ng_convert_handle *h, + struct ng_video_buf *in); + /* --------------------------------------------------------------------- */ /* filters */ @@ -322,11 +365,12 @@ struct ng_filter { /* --------------------------------------------------------------------- */ /* must be changed if we break compatibility */ -#define NG_PLUGIN_MAGIC 0x20020322 +#define NG_PLUGIN_MAGIC 0x20020701 extern struct ng_video_conv **ng_conv; extern struct ng_filter **ng_filters; extern struct ng_writer **ng_writers; +extern struct ng_reader **ng_readers; extern struct ng_vid_driver **ng_vid_drivers; extern struct ng_dsp_driver **ng_dsp_drivers; extern struct ng_mix_driver **ng_mix_drivers; @@ -337,6 +381,8 @@ int ng_filter_register(int magic, char *plugname, struct ng_filter *filter); int ng_writer_register(int magic, char *plugname, struct ng_writer *writer); +int ng_reader_register(int magic, char *plugname, + struct ng_reader *reader); int ng_vid_driver_register(int magic, char *plugname, struct ng_vid_driver *driver); int ng_dsp_driver_register(int magic, char *plugname, @@ -344,21 +390,23 @@ int ng_dsp_driver_register(int magic, char *plugname, int ng_mix_driver_register(int magic, char *plugname, struct ng_mix_driver *driver); -struct ng_video_conv* ng_conv_find(int out, int *i); +struct ng_video_conv* ng_conv_find_to(int out, int *i); +struct ng_video_conv* ng_conv_find_from(int out, int *i); +struct ng_video_conv* ng_conv_find_match(int in, int out); -const struct ng_vid_driver* -ng_vid_open(char *device, struct ng_video_fmt *screen, - void *base, void **handle); -const struct ng_dsp_driver* -ng_dsp_open(char *device, struct ng_audio_fmt *fmt, void **handle); -struct ng_attribute* -ng_mix_init(char *device, char *channel); +const struct ng_vid_driver* ng_vid_open(char *device, + struct ng_video_fmt *screen, + void *base, void **handle); +const struct ng_dsp_driver* ng_dsp_open(char *device, struct ng_audio_fmt *fmt, + int record, void **handle); +struct ng_attribute* ng_mix_init(char *device, char *channel); +struct ng_reader* ng_find_reader(char *filename); long long ng_get_timestamp(void); void ng_check_clipping(int width, int height, int xadjust, int yadjust, struct OVERLAY_CLIP *oc, int *count); -struct ng_video_buf* -ng_filter_single(struct ng_filter *filter, struct ng_video_buf *in); +struct ng_video_buf* ng_filter_single(struct ng_filter *filter, + struct ng_video_buf *in); /* --------------------------------------------------------------------- */ @@ -366,6 +414,9 @@ void ng_init(void); void ng_lut_init(unsigned long red_mask, unsigned long green_mask, unsigned long blue_mask, int fmtid, int swap); +void ng_rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p); +void ng_rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p); + /* --------------------------------------------------------------------- */ /* internal stuff starts here */ diff --git a/libng/plugins/Subdir.mk b/libng/plugins/Subdir.mk index d988f95..3d285a5 100644 --- a/libng/plugins/Subdir.mk +++ b/libng/plugins/Subdir.mk @@ -1,12 +1,16 @@ # targets to build TARGETS-plugins := \ - libng/plugins/flt-invert.so \ libng/plugins/flt-gamma.so \ + libng/plugins/flt-invert.so \ + libng/plugins/flt-smooth.so \ + libng/plugins/flt-disor.so \ libng/plugins/conv-mjpeg.so \ + libng/plugins/read-avi.so \ libng/plugins/write-avi.so ifeq ($(FOUND_LQT),yes) TARGETS-plugins += \ + libng/plugins/read-qt.so \ libng/plugins/write-qt.so endif ifeq ($(FOUND_OS),linux) @@ -27,6 +31,7 @@ GONE-plugins := \ $(libdir)/flt-nop.so # libraries to link +libng/plugins/read-qt.so : LDLIBS := $(QT_LIBS) libng/plugins/write-qt.so : LDLIBS := $(QT_LIBS) # global targets diff --git a/libng/plugins/conv-mjpeg.c b/libng/plugins/conv-mjpeg.c index 34cee64..5a17afe 100644 --- a/libng/plugins/conv-mjpeg.c +++ b/libng/plugins/conv-mjpeg.c @@ -11,7 +11,7 @@ /* ---------------------------------------------------------------------- */ -struct mjpeg_handle { +struct mjpeg_compress { struct jpeg_destination_mgr mjpg_dest; /* must be first */ struct jpeg_compress_struct mjpg_cinfo; struct jpeg_error_mgr mjpg_jerr; @@ -27,6 +27,18 @@ struct mjpeg_handle { unsigned char **mjpg_ptrs[3]; }; +struct mjpeg_decompress { + struct jpeg_source_mgr mjpg_src; /* must be first */ + struct jpeg_decompress_struct mjpg_cinfo; + struct jpeg_error_mgr mjpg_jerr; + + struct ng_video_fmt fmt; + struct ng_video_buf *buf; + + /* yuv */ + unsigned char **mjpg_ptrs[3]; +}; + struct mjpeg_yuv_priv { int luma_h; int luma_v; @@ -46,10 +58,11 @@ swap_rgb24(char *mem, int n) } /* ---------------------------------------------------------------------- */ +/* I/O manager */ static void mjpg_dest_init(struct jpeg_compress_struct *cinfo) { - struct mjpeg_handle *h = (struct mjpeg_handle*)cinfo->dest; + struct mjpeg_compress *h = (struct mjpeg_compress*)cinfo->dest; cinfo->dest->next_output_byte = h->mjpg_buffer; cinfo->dest->free_in_buffer = h->mjpg_bufsize; } @@ -62,16 +75,41 @@ static boolean mjpg_dest_flush(struct jpeg_compress_struct *cinfo) static void mjpg_dest_term(struct jpeg_compress_struct *cinfo) { - struct mjpeg_handle *h = (struct mjpeg_handle*)cinfo->dest; + struct mjpeg_compress *h = (struct mjpeg_compress*)cinfo->dest; h->mjpg_bufused = h->mjpg_bufsize - cinfo->dest->free_in_buffer; } +static void mjpg_src_init(struct jpeg_decompress_struct *cinfo) +{ + struct mjpeg_decompress *h = (struct mjpeg_decompress*)cinfo->src; + cinfo->src->next_input_byte = h->buf->data; + cinfo->src->bytes_in_buffer = h->buf->size; +} + +static int mjpg_src_fill(struct jpeg_decompress_struct *cinfo) +{ + fprintf(stderr,"mjpg: panic: no more input data\n"); + exit(1); +} + +static void mjpg_src_skip(struct jpeg_decompress_struct *cinfo, + long num_bytes) +{ + cinfo->src->next_input_byte += num_bytes; +} + +static void mjpg_src_term(struct jpeg_decompress_struct *cinfo) +{ + /* nothing */ +} + /* ---------------------------------------------------------------------- */ +/* compress */ -static struct mjpeg_handle* +static struct mjpeg_compress* mjpg_init(struct ng_video_fmt *fmt) { - struct mjpeg_handle *h; + struct mjpeg_compress *h; h = malloc(sizeof(*h)); if (NULL == h) @@ -100,7 +138,7 @@ mjpg_init(struct ng_video_fmt *fmt) static void mjpg_cleanup(void *handle) { - struct mjpeg_handle *h = handle; + struct mjpeg_compress *h = handle; int i; if (ng_debug > 1) @@ -118,7 +156,7 @@ mjpg_cleanup(void *handle) static void* mjpg_rgb_init(struct ng_video_fmt *out, void *priv) { - struct mjpeg_handle *h; + struct mjpeg_compress *h; if (ng_debug > 1) fprintf(stderr,"mjpg_rgb_init\n"); @@ -142,7 +180,7 @@ static void mjpg_rgb_compress(void *handle, struct ng_video_buf *out, struct ng_video_buf *in) { - struct mjpeg_handle *h = handle; + struct mjpeg_compress *h = handle; unsigned char *line; int i; @@ -173,7 +211,7 @@ mjpg_bgr_compress(void *handle, struct ng_video_buf *out, static void* mjpg_yuv_init(struct ng_video_fmt *out, void *priv) { - struct mjpeg_handle *h; + struct mjpeg_compress *h; struct mjpeg_yuv_priv *c = priv; if (ng_debug > 1) @@ -209,7 +247,7 @@ mjpg_yuv_init(struct ng_video_fmt *out, void *priv) } static void -mjpg_420_compress(struct mjpeg_handle *h) +mjpg_420_compress(struct mjpeg_compress *h) { unsigned char **mjpg_run[3]; int y; @@ -229,7 +267,7 @@ mjpg_420_compress(struct mjpeg_handle *h) } static void -mjpg_422_compress(struct mjpeg_handle *h) +mjpg_422_compress(struct mjpeg_compress *h) { unsigned char **mjpg_run[3]; int y; @@ -256,7 +294,7 @@ static void mjpg_422_420_compress(void *handle, struct ng_video_buf *out, struct ng_video_buf *in) { - struct mjpeg_handle *h = handle; + struct mjpeg_compress *h = handle; unsigned char *line; int i; @@ -286,7 +324,7 @@ static void mjpg_420_420_compress(void *handle, struct ng_video_buf *out, struct ng_video_buf *in) { - struct mjpeg_handle *h = handle; + struct mjpeg_compress *h = handle; unsigned char *line; int i; @@ -318,7 +356,7 @@ static void mjpg_422_422_compress(void *handle, struct ng_video_buf *out, struct ng_video_buf *in) { - struct mjpeg_handle *h = handle; + struct mjpeg_compress *h = handle; unsigned char *line; int i; @@ -345,6 +383,159 @@ mjpg_422_422_compress(void *handle, struct ng_video_buf *out, } /* ---------------------------------------------------------------------- */ +/* decompress */ + +static void* +mjpg_de_init(struct ng_video_fmt *fmt, void *priv) +{ + struct mjpeg_decompress *h; + + h = malloc(sizeof(*h)); + if (NULL == h) + return NULL; + memset(h,0,sizeof(*h)); + h->fmt = *fmt; + + h->mjpg_cinfo.err = jpeg_std_error(&h->mjpg_jerr); + jpeg_create_decompress(&h->mjpg_cinfo); + + h->mjpg_src.init_source = mjpg_src_init; + h->mjpg_src.fill_input_buffer = mjpg_src_fill; + h->mjpg_src.skip_input_data = mjpg_src_skip; + h->mjpg_src.resync_to_restart = jpeg_resync_to_restart; + h->mjpg_src.term_source = mjpg_src_term; + h->mjpg_cinfo.src = &h->mjpg_src; + + switch (h->fmt.fmtid) { + case VIDEO_YUV420P: + h->mjpg_ptrs[0] = malloc(h->fmt.height*sizeof(char*)); + h->mjpg_ptrs[1] = malloc(h->fmt.height*sizeof(char*)); + h->mjpg_ptrs[2] = malloc(h->fmt.height*sizeof(char*)); + break; + } + return h; +} + +static void +mjpg_rgb_decompress(void *handle, struct ng_video_buf *out, + struct ng_video_buf *in) +{ + struct mjpeg_decompress *h = handle; + unsigned char *line; + int i; + + if (ng_debug > 1) + fprintf(stderr,"mjpg_rgb_decompress\n"); + + h->buf = in; + jpeg_read_header(&h->mjpg_cinfo,1); + h->mjpg_cinfo.out_color_space = JCS_RGB; + jpeg_start_decompress(&h->mjpg_cinfo); + for (i = 0, line = out->data; i < out->fmt.height; + i++, line += out->fmt.bytesperline) { + jpeg_read_scanlines(&h->mjpg_cinfo, &line, 1); + } + jpeg_finish_decompress(&h->mjpg_cinfo); +} + +static void +mjpg_yuv420_decompress(void *handle, struct ng_video_buf *out, + struct ng_video_buf *in) +{ + struct mjpeg_decompress *h = handle; + unsigned char **mjpg_run[3]; + unsigned char *line; + int i,y; + + if (ng_debug > 1) + fprintf(stderr,"mjpg_yuv_decompress\n"); + + h->buf = in; + jpeg_read_header(&h->mjpg_cinfo,1); + h->mjpg_cinfo.raw_data_out = 1; + + if (ng_debug > 1) + fprintf(stderr,"yuv: %dx%d - %d %d / %d %d / %d %d\n", + h->mjpg_cinfo.image_width, + h->mjpg_cinfo.image_height, + h->mjpg_cinfo.comp_info[0].h_samp_factor, + h->mjpg_cinfo.comp_info[0].v_samp_factor, + h->mjpg_cinfo.comp_info[1].h_samp_factor, + h->mjpg_cinfo.comp_info[1].v_samp_factor, + h->mjpg_cinfo.comp_info[2].h_samp_factor, + h->mjpg_cinfo.comp_info[2].v_samp_factor); + + jpeg_start_decompress(&h->mjpg_cinfo); + mjpg_run[0] = h->mjpg_ptrs[0]; + mjpg_run[1] = h->mjpg_ptrs[1]; + mjpg_run[2] = h->mjpg_ptrs[2]; + + line = out->data; + for (i = 0; i < h->mjpg_cinfo.image_height; i++, line += out->fmt.width) + h->mjpg_ptrs[0][i] = line; + + if (2 == h->mjpg_cinfo.comp_info[0].v_samp_factor) { + /* file has 420 -- all fine */ + line = out->data + out->fmt.width*out->fmt.height; + for (i = 0; i < out->fmt.height; i+=2, line += out->fmt.width/2) + h->mjpg_ptrs[1][i/2] = line; + + line = out->data + out->fmt.width*out->fmt.height*5/4; + for (i = 0; i < out->fmt.height; i+=2, line += out->fmt.width/2) + h->mjpg_ptrs[2][i/2] = line; + + for (y = 0; y < out->fmt.height; y += 2*DCTSIZE) { + jpeg_read_raw_data(&h->mjpg_cinfo, mjpg_run,2*DCTSIZE); + mjpg_run[0] += 2*DCTSIZE; + mjpg_run[1] += DCTSIZE; + mjpg_run[2] += DCTSIZE; + } + + } else { + /* file has 422 -- drop lines */ + line = out->data + out->fmt.width*out->fmt.height; + for (i = 0; i < out->fmt.height; i+=2, line += out->fmt.width/2) { + h->mjpg_ptrs[1][i+0] = line; + h->mjpg_ptrs[1][i+1] = line; + } + + line = out->data + out->fmt.width*out->fmt.height*5/4; + for (i = 0; i < out->fmt.height; i+=2, line += out->fmt.width/2) { + h->mjpg_ptrs[2][i+0] = line; + h->mjpg_ptrs[2][i+1] = line; + } + + for (y = 0; y < h->mjpg_cinfo.image_height; y += DCTSIZE) { + jpeg_read_raw_data(&h->mjpg_cinfo, mjpg_run,DCTSIZE); + mjpg_run[0] += DCTSIZE; + mjpg_run[1] += DCTSIZE; + mjpg_run[2] += DCTSIZE; + } + } + + jpeg_finish_decompress(&h->mjpg_cinfo); +} + +static void +mjpg_de_cleanup(void *handle) +{ + struct mjpeg_decompress *h = handle; + + if (ng_debug > 1) + fprintf(stderr,"mjpg_de_cleanup\n"); + + jpeg_destroy_decompress(&h->mjpg_cinfo); + if (h->mjpg_ptrs[0]) + free(h->mjpg_ptrs[0]); + if (h->mjpg_ptrs[1]) + free(h->mjpg_ptrs[1]); + if (h->mjpg_ptrs[2]) + free(h->mjpg_ptrs[2]); + free(h); +} + +/* ---------------------------------------------------------------------- */ +/* static data + register */ static struct mjpeg_yuv_priv priv_420 = { luma_h: 2, @@ -357,6 +548,7 @@ static struct mjpeg_yuv_priv priv_422 = { static struct ng_video_conv mjpg_list[] = { { + /* --- compress --- */ init: mjpg_yuv_init, frame: mjpg_420_420_compress, fini: mjpg_cleanup, @@ -376,14 +568,12 @@ static struct ng_video_conv mjpg_list[] = { fini: mjpg_cleanup, fmtid_in: VIDEO_RGB24, fmtid_out: VIDEO_JPEG, - priv: NULL, },{ init: mjpg_rgb_init, frame: mjpg_bgr_compress, fini: mjpg_cleanup, fmtid_in: VIDEO_BGR24, fmtid_out: VIDEO_JPEG, - priv: NULL, },{ init: mjpg_yuv_init, frame: mjpg_422_422_compress, @@ -391,6 +581,31 @@ static struct ng_video_conv mjpg_list[] = { fmtid_in: VIDEO_YUV422P, fmtid_out: VIDEO_MJPEG, priv: &priv_422, + },{ + /* --- uncompress --- */ + init: mjpg_de_init, + frame: mjpg_rgb_decompress, + fini: mjpg_de_cleanup, + fmtid_in: VIDEO_MJPEG, + fmtid_out: VIDEO_RGB24, + },{ + init: mjpg_de_init, + frame: mjpg_rgb_decompress, + fini: mjpg_de_cleanup, + fmtid_in: VIDEO_JPEG, + fmtid_out: VIDEO_RGB24, + },{ + init: mjpg_de_init, + frame: mjpg_yuv420_decompress, + fini: mjpg_de_cleanup, + fmtid_in: VIDEO_MJPEG, + fmtid_out: VIDEO_YUV420P, + },{ + init: mjpg_de_init, + frame: mjpg_yuv420_decompress, + fini: mjpg_de_cleanup, + fmtid_in: VIDEO_JPEG, + fmtid_out: VIDEO_YUV420P, } }; static const int nconv = sizeof(mjpg_list)/sizeof(struct ng_video_conv); diff --git a/libng/plugins/flt-disor.c b/libng/plugins/flt-disor.c new file mode 100644 index 0000000..9a5d22a --- /dev/null +++ b/libng/plugins/flt-disor.c @@ -0,0 +1,209 @@ +/* + * libng filter -- Correction of lens distortion + * + * (c) 2002 Frederic Helin <Frederic.Helin@inrialpes.fr>, + * Gerd Knorr <kraxel@bytesex.org> + * + */ + +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <inttypes.h> +#include <pthread.h> + +#include "grab-ng.h" + +/* ------------------------------------------------------------------- */ + +int parm_k = 700; +int parm_cx = 50; +int parm_cy = 50; +int parm_zoom = 50; + +/* ------------------------------------------------------------------- */ + +static void *init(struct ng_video_fmt *out) +{ + /* don't have to carry around status info */ + static int dummy; + return &dummy; +} + +static struct ng_video_buf* +frame(void *handle, struct ng_video_buf *in) +{ + struct ng_video_buf *out; + uint8_t *dst8; + uint8_t *src8; + uint16_t *dst16; + uint16_t *src16; + + int i, j, di, dj, cx, cy; + float dr, cr,ca, sx, zoom, k; + + out = ng_malloc_video_buf(&in->fmt, in->fmt.height * in->fmt.bytesperline); + out->info = in->info; + + dst8 = out->data; + src8 = in->data; + dst16 = (uint16_t*) out->data; + src16 = (uint16_t*) in->data; + + zoom = parm_zoom / 100.0; + k = parm_k / 100.0; + cx = in->fmt.width * parm_cx / 100; + cy = in->fmt.height * parm_cy / 100; + +#if 0 + sensor_w = parm_sensorw/100.0; + sensor_h = parm_sensorh/100.0; + + /* calc ratio x/y */ + sx = in->fmt.width * sensor_h / (in->fmt.height * sensor_w); + + /* calc new value of k in the coordonates systeme of computer */ + k = k * in->fmt.height / sensor_h; +#else + sx = 1; + k = k * 100.0; +#endif + + for (j = 0; j < in->fmt.height ; j++) { + for (i = 0; i < in->fmt.width ; i++) { + + // compute radial distortion / parameters of center of image + cr = sqrt((i-cx)/sx*(i-cx)/sx+(j-cy)*(j-cy)); + ca = atan(cr/k/zoom); + dr = k * tan(ca/2); + + if (i == cx && j == cy) { + di = cx; + dj = cy; + } else { + di = (i-cx) * dr / cr + cx; + dj = (j-cy) * dr / cr + cy; + } + + if (dj >= in->fmt.height || dj < 0 || + di >= in->fmt.width || di < 0) + continue; + + switch (in->fmt.fmtid) { + case VIDEO_BGR24: + case VIDEO_RGB24: + dst8[3*i ] = src8[3*(dj*in->fmt.width + di) ]; + dst8[3*i+1] = src8[3*(dj*in->fmt.width + di)+1]; + dst8[3*i+2] = src8[3*(dj*in->fmt.width + di)+2]; + } + } + dst8 += out->fmt.bytesperline; + dst16 += out->fmt.bytesperline/2; + } + + ng_release_video_buf(in); + return out; +} + +static void fini(void *handle) +{ + /* nothing to clean up */ +} + +/* ------------------------------------------------------------------- */ + +static int read_attr(struct ng_attribute *attr) +{ + switch (attr->id) { + case 1000: + return parm_k; + case 1001: + return parm_zoom; + case 1002: + return parm_cx; + case 1003: + return parm_cy; + } + return 0; +} + +static void write_attr(struct ng_attribute *attr, int value) +{ + switch (attr->id) { + case 1000: + parm_k = value; + break; + case 1001: + parm_zoom = value; + break; + case 1002: + parm_cx = value; + break; + case 1003: + parm_cy = value; + break; + } +} + +/* ------------------------------------------------------------------- */ + +static struct ng_attribute attrs[] = { + { + id: 1000, + name: "k", + type: ATTR_TYPE_INTEGER, + defval: 700, + min: 1, + max: 1000, + read: read_attr, + write: write_attr, + },{ + id: 1001, + name: "zoom", + type: ATTR_TYPE_INTEGER, + defval: 50, + min: 10, + max: 100, + read: read_attr, + write: write_attr, + },{ + id: 1002, + name: "center x", + type: ATTR_TYPE_INTEGER, + defval: 50, + min: 0, + max: 100, + read: read_attr, + write: write_attr, + },{ + id: 1003, + name: "center y", + type: ATTR_TYPE_INTEGER, + defval: 50, + min: 0, + max: 100, + read: read_attr, + write: write_attr, + },{ + /* end of list */ + } +}; + +static struct ng_filter filter = { + name: "disortion correction", + attrs: attrs, + fmts: + (1 << VIDEO_BGR24) | + (1 << VIDEO_RGB24), + init: init, + frame: frame, + fini: fini, +}; + +extern void ng_plugin_init(void); +void ng_plugin_init(void) +{ + ng_filter_register(NG_PLUGIN_MAGIC,__FILE__,&filter); +} diff --git a/libng/plugins/flt-gamma.c b/libng/plugins/flt-gamma.c index 35090ef..d4575cf 100644 --- a/libng/plugins/flt-gamma.c +++ b/libng/plugins/flt-gamma.c @@ -117,7 +117,7 @@ static void calc_lut(void) int i,val; for (i = 0; i < 256; i++) { - val = 255 * pow((float)i/255, 10000.0/g); + val = 255 * pow((float)i/255, 100.0/g); if (val < 0) val = 0; if (val > 255) val = 255; lut[i] = val; @@ -144,7 +144,7 @@ static struct ng_attribute attrs[] = { type: ATTR_TYPE_INTEGER, defval: 100, min: 1, - max: 999, + max: 500, points: 2, read: read_attr, write: write_attr, diff --git a/libng/plugins/flt-smooth.c b/libng/plugins/flt-smooth.c new file mode 100644 index 0000000..1b3d9aa --- /dev/null +++ b/libng/plugins/flt-smooth.c @@ -0,0 +1,602 @@ +/* + * libng filter -- Smooth the image to reduce snow at bad TV receiption + * + * + * Filter options + * -------------- + * + * There are 2 options available that can be turned on and off separately. + * + * Smooth over time: Calculate average of previous and current frame. + * Longer filter lengths could improve static + * images but would be unusable for movies and + * require high CPU power. I found averaging of + * 2 frames the most useful filter. + * + * Smooth horizontally: For every pixel, the average of the actual colour + * and the colour of the pixel to the left is displayed. + * + * + * (c) 2002 Klaus Peichl <pei@freenet.de> (smoothing filter), + * Gerd Knorr <kraxel@bytesex.org> (framework) + * + */ + +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> + +#include "grab-ng.h" + +/* ------------------------------------------------------------------- */ + +typedef struct { + struct ng_video_buf * pLastFrame; +} +SMOOTH_BUFFER; + + +static int smoothTime = 1; +static int smoothHorizontal = 1; + + +static void inline +invert_bytes(unsigned char *dst, unsigned char *src, int bytes) +{ + while (bytes--) + *(dst++) = 0xff - *(src++); +} + + +#if 1 + +/* + Fast 32-bit smoothing +*/ +static void inline +smooth_native_32bit(unsigned int *last, + unsigned int *dst, + unsigned int *src, + int pixels) +{ + unsigned int old,new, old2,new2; + + if (smoothTime && smoothHorizontal) { + + /* Smoothing in time and horizontally */ + + old2 = *last; + new2 = *src; + + while (pixels--) { + + old = *last; + new = *src++; + *last++ = new; + + /* + Fast averaging: + All 4 bytes (of which only 3 are used) can be averaged in one 32bit-word. + The lowest 2 bits of every colour are thrown away to avoid influences + between the colours. + */ + + *dst++ = + ((new >> 2) & 0x3F3F3F3F) + + ((new2 >> 2) & 0x3F3F3F3F) + + ((old >> 2) & 0x3F3F3F3F) + + ((old2 >> 2) & 0x3F3F3F3F); + + old2 = old; + new2 = new; + } + } + else if (smoothTime) { + + /* Smoothing in time only */ + + while (pixels--) { + + old = *last; + new = *src++; + *last++ = new; + + /* + Fast averaging: + All 4 bytes (of which only 3 are used) can be averaged in one 32bit-word. + The lowest bit of every colour is thrown away to avoid influences + between the colours. + */ + + *dst++ = + ((new >> 1) & 0x7F7F7F7F) + + ((old >> 1) & 0x7F7F7F7F); + } + } + else if (smoothHorizontal) { + + /* Smooth horizontally only */ + + new2 = *src; + + while (pixels--) { + + new = *src++; + *last++ = new; + + /* + Fast averaging: + All 4 bytes (of which only 3 are used) can be averaged in one 32bit-word. + The lowest bit of every colour is thrown away to avoid influences + between the colours. + */ + + *dst++ = + ((new >> 1) & 0x7F7F7F7F) + + ((new2 >> 1) & 0x7F7F7F7F); + + new2 = new; + } + } + else { + + /* No smoothing at all */ + + while (pixels--) { + new = *src++; + *last++ = new; + *dst++ = new; + } + } +} + +#else + +/* + This is an alternative implementation of the above function + which does not throw away the lowest bits before addition. + It is derived from the byte-based 24-bit-function below but + processes 4 bytes for every pixel instead of 3. +*/ + +static void inline +smooth_native_32bit(unsigned char *last, + unsigned char *dst, + unsigned char *src, + int pixels) +{ + unsigned char oldR,newR, oldR2,newR2; + unsigned char oldG,newG, oldG2,newG2; + unsigned char oldB,newB, oldB2,newB2; + unsigned char oldP,newP, oldP2,newP2; + + if (smoothTime && smoothHorizontal) { + + /* Smoothing in time and horizontally */ + + oldR2 = last[0]; + oldG2 = last[1]; + oldB2 = last[2]; + oldP2 = last[3]; + newR2 = src[0]; + newG2 = src[1]; + newB2 = src[2]; + newP2 = src[3]; + + while (pixels--) { + + oldR = *last; newR = *src++; *last++ = newR; + oldG = *last; newG = *src++; *last++ = newG; + oldB = *last; newB = *src++; *last++ = newB; + oldP = *last; newP = *src++; *last++ = newP; + + *dst++ = (newR + oldR + newR2 + oldR2) / 4; + *dst++ = (newG + oldG + newG2 + oldG2) / 4; + *dst++ = (newB + oldB + newB2 + oldB2) / 4; + *dst++ = (newP + oldP + newP2 + oldP2) / 4; + + oldR2 = oldR; + oldG2 = oldG; + oldB2 = oldB; + oldP2 = oldP; + + newR2 = newR; + newG2 = newG; + newB2 = newB; + newP2 = newP; + } + } + else if (smoothTime) { + + /* Smoothing in time only */ + + while (pixels--) { + + oldR = *last; newR = *src++; *last++ = newR; + oldG = *last; newG = *src++; *last++ = newG; + oldB = *last; newB = *src++; *last++ = newB; + oldP = *last; newP = *src++; *last++ = newP; + + *dst++ = (newR + oldR) / 2; + *dst++ = (newG + oldG) / 2; + *dst++ = (newB + oldB) / 2; + *dst++ = (newP + oldP) / 2; + } + } + else if (smoothHorizontal) { + + /* Smooth horizontally only */ + + newR2 = src[0]; + newG2 = src[1]; + newB2 = src[2]; + newP2 = src[3]; + + while (pixels--) { + + newR = *src++; *last++ = newR; + newG = *src++; *last++ = newG; + newB = *src++; *last++ = newB; + newP = *src++; *last++ = newP; + + *dst++ = (newR + newR2) / 2; + *dst++ = (newG + newG2) / 2; + *dst++ = (newB + newB2) / 2; + *dst++ = (newP + newP2) / 2; + + newR2 = newR; + newG2 = newG; + newB2 = newB; + newP2 = newP; + } + } + else { + + /* No smoothing at all */ + + while (pixels--) { + newR = *src++; *last++ = newR; *dst++ = newR; + newG = *src++; *last++ = newG; *dst++ = newG; + newB = *src++; *last++ = newB; *dst++ = newB; + newP = *src++; *last++ = newP; *dst++ = newP; + + } + } +} +#endif + + +static void inline +smooth_native_24bit(unsigned char *last, + unsigned char *dst, + unsigned char *src, + int pixels) +{ + unsigned char oldR,newR, oldR2,newR2; + unsigned char oldG,newG, oldG2,newG2; + unsigned char oldB,newB, oldB2,newB2; + + if (smoothTime && smoothHorizontal) { + + /* Smoothing in time and horizontally */ + + oldR2 = last[0]; + oldG2 = last[1]; + oldB2 = last[2]; + newR2 = src[0]; + newG2 = src[1]; + newB2 = src[2]; + + while (pixels--) { + + oldR = *last; newR = *src++; *last++ = newR; + oldG = *last; newG = *src++; *last++ = newG; + oldB = *last; newB = *src++; *last++ = newB; + + *dst++ = (newR + oldR + newR2 + oldR2) / 4; + *dst++ = (newG + oldG + newG2 + oldG2) / 4; + *dst++ = (newB + oldB + newB2 + oldB2) / 4; + + oldR2 = oldR; + oldG2 = oldG; + oldB2 = oldB; + + newR2 = newR; + newG2 = newG; + newB2 = newB; + } + } + else if (smoothTime) { + + /* Smoothing in time only */ + + while (pixels--) { + + oldR = *last; newR = *src++; *last++ = newR; + oldG = *last; newG = *src++; *last++ = newG; + oldB = *last; newB = *src++; *last++ = newB; + + *dst++ = (newR + oldR) / 2; + *dst++ = (newG + oldG) / 2; + *dst++ = (newB + oldB) / 2; + } + } + else if (smoothHorizontal) { + + /* Smooth horizontally only */ + + newR2 = src[0]; + newG2 = src[1]; + newB2 = src[2]; + + while (pixels--) { + + newR = *src++; *last++ = newR; + newG = *src++; *last++ = newG; + newB = *src++; *last++ = newB; + + *dst++ = (newR + newR2) / 2; + *dst++ = (newG + newG2) / 2; + *dst++ = (newB + newB2) / 2; + + newR2 = newR; + newG2 = newG; + newB2 = newB; + } + } + else { + + /* No smoothing at all */ + + while (pixels--) { + newR = *src++; *last++ = newR; *dst++ = newR; + newG = *src++; *last++ = newG; *dst++ = newG; + newB = *src++; *last++ = newB; *dst++ = newB; + + } + } +} + + +static void inline +smooth_native_16bit(unsigned short *last, + unsigned short *dst, + unsigned short *src, + unsigned short maskR, + unsigned short maskG, + unsigned short maskB, + int pixels) +{ + unsigned short old,new, old2,new2; + unsigned short red,green,blue; + + if (smoothTime && smoothHorizontal) { + + /* Smoothing in time and horizontally */ + + old2 = *last; + new2 = *src; + + while (pixels--) { + + old = *last; + new = *src++; + *last++ = new; + + red = ( ((new & maskR) + (old & maskR) + (new2 & maskR) + (old2 & maskR))/4 ) & maskR; + green = ( ((new & maskG) + (old & maskG) + (new2 & maskG) + (old2 & maskG))/4 ) & maskG; + blue = ( ((new & maskB) + (old & maskB) + (new2 & maskB) + (old2 & maskB))/4 ) & maskB; + *dst++ = red | green | blue; + + old2 = old; + new2 = new; + } + } + else if (smoothTime) { + + /* Smoothing in time only */ + + while (pixels--) { + + old = *last; + new = *src++; + *last++ = new; + + red = ( ((new & maskR) + (old & maskR))/2 ) & maskR; + green = ( ((new & maskG) + (old & maskG))/2 ) & maskG; + blue = ( ((new & maskB) + (old & maskB))/2 ) & maskB; + *dst++ = red | green | blue; + } + } + else if (smoothHorizontal) { + + /* Smooth horizontally only */ + + new2 = *src; + + while (pixels--) { + + new = *src++; + *last++ = new; + + red = ( ((new & maskR) + (new2 & maskR))/2 ) & maskR; + green = ( ((new & maskG) + (new2 & maskG))/2 ) & maskG; + blue = ( ((new & maskB) + (new2 & maskB))/2 ) & maskB; + *dst++ = red | green | blue; + + new2 = new; + } + } + else { + + /* No smoothing at all */ + + while (pixels--) { + new = *src++; + *last++ = new; + *dst++ = new; + } + } +} + + +/* ------------------------------------------------------------------- */ + +static void *init(struct ng_video_fmt *out) +{ + /* don't have to carry around status info */ + static SMOOTH_BUFFER smooth_buffer; + + smooth_buffer.pLastFrame = ng_malloc_video_buf(out, out->height * out->bytesperline); + + return &smooth_buffer; +} + +static struct ng_video_buf* +frame(void *h, struct ng_video_buf *in) +{ + SMOOTH_BUFFER *handle = h; + struct ng_video_buf *out; + unsigned char *dst; + unsigned char *src; + unsigned char *last; + int y,cnt; + + out = ng_malloc_video_buf(&in->fmt, in->fmt.height * in->fmt.bytesperline); + out->info = in->info; + + dst = out->data; + src = in->data; + last = handle->pLastFrame->data; + cnt = in->fmt.width * ng_vfmt_to_depth[in->fmt.fmtid] / 8; + + for (y = 0; y < in->fmt.height; y++) { + switch (in->fmt.fmtid) { + case VIDEO_GRAY: + case VIDEO_BGR24: + case VIDEO_RGB24: + smooth_native_24bit((unsigned char*)last, + (unsigned char*)dst, + (unsigned char*)src, + in->fmt.width); + break; + case VIDEO_BGR32: + case VIDEO_RGB32: + case VIDEO_YUV422: + smooth_native_32bit((unsigned int*)last, + (unsigned int*)dst, + (unsigned int*)src, + in->fmt.width); + break; + case VIDEO_RGB15_NATIVE: + smooth_native_16bit((unsigned short*)last, + (unsigned short*)dst, + (unsigned short*)src, + 0x7C00, /* mask for red */ + 0x03E0, /* mask for green */ + 0x001F, /* mask for blue */ + in->fmt.width); + break; + case VIDEO_RGB16_NATIVE: + smooth_native_16bit((unsigned short*)last, + (unsigned short*)dst, + (unsigned short*)src, + 0xF800, /* mask for red */ + 0x07E0, /* mask for green */ + 0x001F, /* mask for blue */ + in->fmt.width); + break; + } + dst += out->fmt.bytesperline; + src += in->fmt.bytesperline; + last += in->fmt.bytesperline; + } + + ng_release_video_buf(in); + return out; +} + +static void fini(void *handle) +{ + ng_release_video_buf(handle); +} + + +static int read_attr(struct ng_attribute *attr) +{ + int value; + + switch (attr->id) { + case 0: + value = smoothTime; + break; + case 1: + value = smoothHorizontal; + break; + default: + value = 0; + } + + return value; +} + +static void write_attr(struct ng_attribute *attr, int value) +{ + switch (attr->id) { + case 0: + smoothTime = value; + break; + case 1: + smoothHorizontal = value; + break; + } +} + + +/* ------------------------------------------------------------------- */ + +static struct ng_attribute attrs[] = { + { + id: 0, + name: "Smooth over time", + type: ATTR_TYPE_BOOL, + defval: 1, + read: read_attr, + write: write_attr, + }, + { id: 1, + name: "Smooth horizontally", + type: ATTR_TYPE_BOOL, + defval: 1, + read: read_attr, + write: write_attr, + },{ + /* end of list */ + } +}; + + +static struct ng_filter filter = { + name: "Smooth", + attrs: attrs, + fmts: + (1 << VIDEO_GRAY) | + (1 << VIDEO_RGB15_NATIVE) | + (1 << VIDEO_RGB16_NATIVE) | + (1 << VIDEO_BGR24) | + (1 << VIDEO_RGB24) | + (1 << VIDEO_BGR32) | + (1 << VIDEO_RGB32) | + (1 << VIDEO_YUV422), + init: init, + frame: frame, + fini: fini, +}; + +extern void ng_plugin_init(void); +void ng_plugin_init(void) +{ + ng_filter_register(NG_PLUGIN_MAGIC,__FILE__,&filter); +} diff --git a/libng/plugins/read-avi.c b/libng/plugins/read-avi.c new file mode 100644 index 0000000..34641b0 --- /dev/null +++ b/libng/plugins/read-avi.c @@ -0,0 +1,420 @@ +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/uio.h> + +#include "riff.h" +#include "list.h" +#include "grab-ng.h" + +/* ----------------------------------------------------------------------- */ + +struct movi_range { + off_t start; + off_t size; +}; + +struct avi_handle { + int fd; + struct iovec *vec; + + /* avi header */ + unsigned char riff_type[4]; + unsigned char fcc_type[4]; + struct RIFF_avih avih; + struct RIFF_strh v_strh; + struct RIFF_strh a_strh; + struct RIFF_strf_vids vids; + struct RIFF_strf_auds auds; + int32_t dml_frames; + struct movi_range *movi; + int movi_cnt; + struct movi_range wave; + + /* libng stuff */ + struct ng_video_fmt vfmt; + struct ng_audio_fmt afmt; + + /* status data */ + off_t a_pos; + off_t v_pos; + int frames; + off_t a_bytes; +}; + +/* ----------------------------------------------------------------------- */ + +#define FCC(a,b,c,d) (((int32_t)a << 24) |\ + ((int32_t)b << 16) |\ + ((int32_t)c << 8) |\ + (int32_t)d) +#define FCCS(str) FCC(str[0],str[1],str[2],str[3]) + +static void avi_add_movi(struct avi_handle *h, int level, + off_t start, off_t size) +{ + if (0 == h->movi_cnt % 16) + h->movi = realloc(h->movi,sizeof(struct movi_range)*(h->movi_cnt+16)); + h->movi[h->movi_cnt].start = start; + h->movi[h->movi_cnt].size = size; + h->movi_cnt++; + if (ng_debug) + fprintf(stderr,"%*s[movie data list: 0x%llx+0x%llx]\n", + level, "", start, size); +} + +static void avi_swap_strh(struct RIFF_strh *strh) +{ + strh->flags = AVI_SWAP4(strh->flags); + strh->priority = AVI_SWAP4(strh->priority); + strh->init_frames = AVI_SWAP4(strh->init_frames); + strh->scale = AVI_SWAP4(strh->scale); + strh->rate = AVI_SWAP4(strh->rate); + strh->start = AVI_SWAP4(strh->start); + strh->length = AVI_SWAP4(strh->length); + strh->bufsize = AVI_SWAP4(strh->bufsize); + strh->quality = AVI_SWAP4(strh->quality); + strh->samplesize = AVI_SWAP4(strh->samplesize); +} + +static void avi_swap_vids(struct RIFF_strf_vids *fmt) +{ + fmt->size = AVI_SWAP4(fmt->size); + fmt->width = AVI_SWAP4(fmt->width); + fmt->height = AVI_SWAP4(fmt->height); + fmt->planes = AVI_SWAP2(fmt->planes); + fmt->bit_cnt = AVI_SWAP2(fmt->bit_cnt); + fmt->image_size = AVI_SWAP4(fmt->image_size); + fmt->xpels_meter = AVI_SWAP4(fmt->xpels_meter); + fmt->ypels_meter = AVI_SWAP4(fmt->ypels_meter); + fmt->num_colors = AVI_SWAP4(fmt->num_colors); + fmt->imp_colors = AVI_SWAP4(fmt->imp_colors); +} + +static void avi_swap_auds(struct RIFF_strf_auds *fmt) +{ + fmt->format = AVI_SWAP2(fmt->format); + fmt->channels = AVI_SWAP2(fmt->channels); + fmt->rate = AVI_SWAP4(fmt->rate); + fmt->av_bps = AVI_SWAP4(fmt->av_bps); + fmt->blockalign = AVI_SWAP2(fmt->blockalign); + fmt->size = AVI_SWAP2(fmt->size); +} + +static int avi_parse_header(struct avi_handle *h, off_t offset, int level) +{ + struct CHUNK_HDR chunk; + struct RIFF_strh strh; + unsigned char id[4]; + off_t pos = offset; + + lseek(h->fd,offset,SEEK_SET); + pos += read(h->fd,&chunk,sizeof(chunk)); + chunk.size = AVI_SWAP4(chunk.size); + if (ng_debug) + fprintf(stderr,"%*s%4.4s <0x%x>\n",level,"",chunk.id,chunk.size); + switch (FCCS(chunk.id)) { + case FCC('R','I','F','F'): + case FCC('L','I','S','T'): + pos += read(h->fd,&id,sizeof(id)); + if (FCCS(chunk.id) == FCC('R','I','F','F')) + memcpy(h->riff_type,id,4); + if (ng_debug) + fprintf(stderr,"%*s[list type is %4.4s]\n",level,"",id); + if (FCCS(id) == FCC('m','o','v','i')) { + avi_add_movi(h,level,pos,chunk.size-4); + } else { + while (pos < offset + chunk.size) + pos += avi_parse_header(h,pos,level+3); + } + break; + case FCC('a','v','i','h'): + read(h->fd,&h->avih,sizeof(h->avih)); + break; + case FCC('s','t','r','h'): + read(h->fd,&strh,sizeof(strh)); + memcpy(h->fcc_type,strh.type,sizeof(h->fcc_type)); + if (ng_debug) + fprintf(stderr,"%*s[header type is %4.4s]\n",level,"",h->fcc_type); + avi_swap_strh(&strh); + if (FCCS(h->fcc_type) == FCC('a','u','d','s')) + h->a_strh = strh; + if (FCCS(h->fcc_type) == FCC('v','i','d','s')) + h->v_strh = strh; + break; + case FCC('s','t','r','f'): + if (FCCS(h->fcc_type) == FCC('a','u','d','s')) { + read(h->fd,&h->auds,sizeof(h->auds)); + avi_swap_auds(&h->auds); + } + if (FCCS(h->fcc_type) == FCC('v','i','d','s')) { + read(h->fd,&h->vids,sizeof(h->vids)); + avi_swap_vids(&h->vids); + } + break; + case FCC('d','m','l','h'): + read(h->fd,&h->dml_frames,sizeof(h->dml_frames)); + h->dml_frames = AVI_SWAP4(h->dml_frames); + break; + case FCC('f','m','t',' '): + if (FCCS(h->riff_type) == FCC('W','A','V','E')) { + read(h->fd,&h->auds,sizeof(h->auds)); + avi_swap_auds(&h->auds); + } + break; + case FCC('d','a','t','a'): + if (FCCS(h->riff_type) == FCC('W','A','V','E')) { + h->wave.start = pos; + h->wave.size = chunk.size-4; + } + break; + } + return chunk.size+8; +} + +static uint32_t avi_find_chunk(struct avi_handle *h, uint32_t id, off_t *pos) +{ + struct CHUNK_HDR chunk; + int n = 0, bytes; + + if (NULL == h->movi) { + /* WAVE */ + if (*pos >= h->wave.start + h->wave.size) + return 0; + lseek(h->fd,*pos,SEEK_SET); + bytes = h->wave.start + h->wave.size - *pos; + if (bytes > 64*1024) + bytes = 64*1024; + *pos += bytes; + return bytes; + } + + /* AVI + AVIX */ + while (*pos >= h->movi[n].start + h->movi[n].size) { + n++; + if (n >= h->movi_cnt) + return 0; + } + for (;;) { + if (*pos >= h->movi[n].start + h->movi[n].size) { + n++; + if (n >= h->movi_cnt) + return 0; + *pos = h->movi[n].start; + } + lseek(h->fd,*pos,SEEK_SET); + *pos += read(h->fd,&chunk,sizeof(chunk)); + chunk.size = AVI_SWAP4(chunk.size); + *pos += (chunk.size + 3) & ~0x03; /* 32-bit align */ + if (FCCS(chunk.id) == id) { + if (ng_debug) + fprintf(stderr,"avi: chunk %4.4s: 0x%llx+0x%x\n", + chunk.id,*pos,chunk.size); + return chunk.size; + } + } +} + +/* ----------------------------------------------------------------------- */ + +static void* avi_open(char *moviename, int *vfmt, int vn) +{ + struct avi_handle *h; + off_t pos, size; + + h = malloc(sizeof(*h)); + memset(h,0,sizeof(*h)); + h->fd = -1; + + h->fd = open(moviename,O_RDONLY); + if (-1 == h->fd) { + fprintf(stderr,"open %s: %s\n",moviename,strerror(errno)); + goto fail; + } + + size = lseek(h->fd,0,SEEK_END); + for (pos = 0; pos < size;) + pos += avi_parse_header(h,pos,0); + + if (h->movi) { + h->a_pos = h->movi[0].start; + h->v_pos = h->movi[0].start; + } else if (h->wave.start) { + h->a_pos = h->wave.start; + } + + /* audio stream ?? */ + if (FCCS(h->a_strh.type) == FCC('a','u','d','s') || + FCCS(h->riff_type) == FCC('W','A','V','E')) { + switch (h->auds.format) { + case WAVE_FORMAT_PCM: + if (h->auds.size == 8) + h->afmt.fmtid = AUDIO_U8_MONO; + if (h->auds.size == 16) + h->afmt.fmtid = AUDIO_S16_LE_MONO; + if (h->afmt.fmtid) { + if (h->auds.channels > 1) + h->afmt.fmtid++; /* mono => stereo */ + h->afmt.rate = h->auds.rate; + } + break; + } + if (h->afmt.fmtid != AUDIO_NONE && ng_debug) + fprintf(stderr,"avi: audio is %s @ %d Hz\n", + ng_afmt_to_desc[h->afmt.fmtid],h->afmt.rate); + } + + /* video stream ?? */ + if (FCCS(h->v_strh.type) == FCC('v','i','d','s')) { + switch (FCCS(h->v_strh.handler)) { + case 0: + if (h->vids.bit_cnt == 15) + h->vfmt.fmtid = VIDEO_RGB15_LE; + if (h->vids.bit_cnt == 24) + h->vfmt.fmtid = VIDEO_BGR24; + break; + case FCC('M','J','P','G'): + h->vfmt.fmtid = VIDEO_MJPEG; + break; + } + if (VIDEO_NONE != h->vfmt.fmtid) { + h->vfmt.width = h->vids.width; + h->vfmt.height = h->vids.height; + h->vfmt.bytesperline = (h->vfmt.width*ng_vfmt_to_depth[h->vfmt.fmtid]) >> 3; + h->vec = malloc(sizeof(struct iovec) * h->vfmt.height); + if (ng_debug) + fprintf(stderr,"avi: video is %s, %dx%d @ %d fps\n", + ng_vfmt_to_desc[h->vfmt.fmtid], + h->vfmt.width, h->vfmt.height, + (int)((long long) 1000000 / h->avih.us_frame)); + } + } + return h; + + fail: + if (-1 != h->fd) + close(h->fd); + free(h); + return NULL; +} + +static struct ng_video_fmt* avi_vfmt(void *handle) +{ + struct avi_handle *h = handle; + + return VIDEO_NONE != h->vfmt.fmtid ? &h->vfmt : NULL; +} + +static struct ng_audio_fmt* avi_afmt(void *handle) +{ + struct avi_handle *h = handle; + + return AUDIO_NONE != h->afmt.fmtid ? &h->afmt : NULL; +} + +static struct ng_video_buf* avi_vdata(void *handle, int drop) +{ + struct avi_handle *h = handle; + struct ng_video_buf *buf; + struct iovec *line; + uint32_t size; + int i,y; + + /* drop frames */ + for (i = 0; i < drop; i++) { + if (0 == avi_find_chunk(h,FCC('0','0','d','b'),&h->v_pos)) + return NULL; + h->frames++; + } + + size = avi_find_chunk(h,FCC('0','0','d','b'),&h->v_pos); + if (0 == size) + return NULL; + buf = ng_malloc_video_buf(&h->vfmt,size); + switch (h->vfmt.fmtid) { + case VIDEO_RGB15_LE: + case VIDEO_BGR24: + for (line = h->vec, y = h->vfmt.height-1; y >= 0; line++, y--) { + line->iov_base = ((unsigned char*)buf->data) + + y * h->vfmt.bytesperline; + line->iov_len = h->vfmt.bytesperline; + } + readv(h->fd,h->vec,h->vfmt.height); + break; + case VIDEO_MJPEG: + case VIDEO_JPEG: + read(h->fd,buf->data,size); + break; + } + buf->info.seq = h->frames; + buf->info.ts = (long long)h->frames * h->avih.us_frame * 1000; + h->frames++; + return buf; +} + +static struct ng_audio_buf* avi_adata(void *handle) +{ + struct avi_handle *h = handle; + struct ng_audio_buf *buf; + uint32_t size, samples; + + size = avi_find_chunk(h,FCC('0','1','w','b'),&h->a_pos); + if (0 == size) + return NULL; + buf = ng_malloc_audio_buf(&h->afmt,size); + read(h->fd,buf->data,size); + samples = h->a_bytes * 8 + / ng_afmt_to_channels[h->afmt.fmtid] + / ng_afmt_to_bits[h->afmt.fmtid]; + buf->info.ts = (long long)samples * 1000000000 / h->afmt.rate; + h->a_bytes += size; + return buf; +} + +static long long avi_frame_time(void *handle) +{ + struct avi_handle *h = handle; + + return h->avih.us_frame * 1000; +} + +static int avi_close(void *handle) +{ + struct avi_handle *h = handle; + + if (h->vec) + free(h->vec); + close(h->fd); + free(h); + return 0; +} + +/* ----------------------------------------------------------------------- */ + +struct ng_reader avi_reader = { + name: "avi", + desc: "Microsoft AVI (RIFF) format", + + magic: { "RIFF" }, + moff: { 0 }, + mlen: { 4 }, + + rd_open: avi_open, + rd_vfmt: avi_vfmt, + rd_afmt: avi_afmt, + rd_vdata: avi_vdata, + rd_adata: avi_adata, + frame_time: avi_frame_time, + rd_close: avi_close, +}; + +extern void ng_plugin_init(void); +void ng_plugin_init(void) +{ + ng_reader_register(NG_PLUGIN_MAGIC,__FILE__,&avi_reader); +} diff --git a/libng/plugins/read-qt.c b/libng/plugins/read-qt.c new file mode 100644 index 0000000..244f9f6 --- /dev/null +++ b/libng/plugins/read-qt.c @@ -0,0 +1,292 @@ +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <pthread.h> +#include <quicktime/quicktime.h> +#include <quicktime/colormodels.h> +#include <quicktime/lqt.h> + +#include "grab-ng.h" + +#define AUDIO_SIZE (64*1024) + +/* ----------------------------------------------------------------------- */ + +static int fmtid_to_cmodel[VIDEO_FMT_COUNT] = { + [ VIDEO_RGB24 ] = BC_RGB888, + [ VIDEO_BGR24 ] = BC_BGR888, + [ VIDEO_YUV422 ] = BC_YUV422, + [ VIDEO_YUV420P ] = BC_YUV420P, +}; + +/* ----------------------------------------------------------------------- */ + +struct qt_handle { + /* libquicktime handle */ + quicktime_t *qt; + + /* format */ + struct ng_video_fmt vfmt; + struct ng_audio_fmt afmt; + + /* misc video */ + unsigned char **rows; + int rate; + + /* misc audio */ + int channels; + int16_t *left,*right; + long long bps; +}; + +static void* qt_open(char *moviename, int *vfmt, int vn) +{ + struct qt_handle *h; + char *str; + int i; + + if (NULL == (h = malloc(sizeof(*h)))) + return NULL; + memset(h,0,sizeof(*h)); + + /* open file */ + h->qt = quicktime_open(moviename,1,0); + if (NULL == h->qt) { + fprintf(stderr,"ERROR: can't open file: %s\n",moviename); + free(h); + return NULL; + } + + if (ng_debug) { + /* print misc info */ + fprintf(stderr,"quicktime movie %s:\n",moviename); + str = quicktime_get_copyright(h->qt); + if (str) + fprintf(stderr," copyright: %s\n",str); + str = quicktime_get_name(h->qt); + if (str) + fprintf(stderr," name: %s\n",str); + str = quicktime_get_info(h->qt); + if (str) + fprintf(stderr," info: %s\n",str); + + /* print video info */ + if (quicktime_has_video(h->qt)) { + fprintf(stderr," video: %d track(s)\n",quicktime_video_tracks(h->qt)); + for (i = 0; i < quicktime_video_tracks(h->qt); i++) { + fprintf(stderr, + " track #%d\n" + " width : %d\n" + " height: %d\n" + " depth : %d bit\n" + " rate : %.2f fps\n" + " codec : %s\n", + i+1, + quicktime_video_width(h->qt,i), + quicktime_video_height(h->qt,i), + quicktime_video_depth(h->qt,i), + quicktime_frame_rate(h->qt,i), + quicktime_video_compressor(h->qt,i)); + } + } + + /* print audio info */ + if (quicktime_has_audio(h->qt)) { + fprintf(stderr," audio: %d track(s)\n",quicktime_audio_tracks(h->qt)); + for (i = 0; i < quicktime_audio_tracks(h->qt); i++) { + fprintf(stderr, + " track #%d\n" + " rate : %ld Hz\n" + " bits : %d\n" + " chans : %d\n" + " codec : %s\n", + i+1, + quicktime_sample_rate(h->qt,i), + quicktime_audio_bits(h->qt,i), + quicktime_track_channels(h->qt,i), + quicktime_audio_compressor(h->qt,i)); + } + } + } + + /* video format */ + if (!quicktime_has_video(h->qt)) { + if (ng_debug) + fprintf(stderr,"qt: no video stream\n"); + } else if (!quicktime_supported_video(h->qt,0)) { + if (ng_debug) + fprintf(stderr,"qt: unsupported video codec\n"); + } else { + for (i = 0; i < vn; i++) { + if (ng_debug) + fprintf(stderr,"qt: trying: %d [%s]\n", + vfmt[i],ng_vfmt_to_desc[vfmt[i]]); + if (0 == fmtid_to_cmodel[vfmt[i]]) + continue; + if (!quicktime_reads_cmodel(h->qt,fmtid_to_cmodel[vfmt[i]],0)) + continue; + quicktime_set_cmodel(h->qt, fmtid_to_cmodel[vfmt[i]]); + h->vfmt.fmtid = vfmt[i]; + break; + } + h->vfmt.width = quicktime_video_width(h->qt,0); + h->vfmt.height = quicktime_video_height(h->qt,0); + h->vfmt.bytesperline = (h->vfmt.width*ng_vfmt_to_depth[h->vfmt.fmtid]) >> 3; + h->rate = quicktime_frame_rate(h->qt,0); + } + + /* audio format */ + if (!quicktime_has_audio(h->qt)) { + if (ng_debug) + fprintf(stderr,"qt: no audio stream\n"); + } else if (!quicktime_supported_audio(h->qt,0)) { + if (ng_debug) + fprintf(stderr,"qt: unsupported audio codec\n"); + } else { + h->channels = quicktime_track_channels(h->qt,0); + h->afmt.fmtid = (h->channels > 1) ? + AUDIO_S16_NATIVE_STEREO : AUDIO_S16_NATIVE_MONO; + h->afmt.rate = quicktime_sample_rate(h->qt,0); + } + + return h; +} + +static struct ng_video_fmt* qt_vfmt(void *handle) +{ + struct qt_handle *h = handle; + + return h->vfmt.fmtid ? &h->vfmt : NULL; +} + +static struct ng_audio_fmt* qt_afmt(void *handle) +{ + struct qt_handle *h = handle; + + return h->afmt.fmtid ? &h->afmt : NULL; +} + +static struct ng_video_buf* qt_vdata(void *handle, int drop) +{ + struct qt_handle *h = handle; + struct ng_video_buf *buf; + int i; + + if (quicktime_video_position(h->qt,0) >= quicktime_video_length(h->qt,0)) + return NULL; + + buf = ng_malloc_video_buf(&h->vfmt,h->vfmt.bytesperline*h->vfmt.height); + if (!h->rows) + h->rows = malloc(h->vfmt.height * sizeof(char*)); + switch (fmtid_to_cmodel[h->vfmt.fmtid]) { + case BC_RGB888: + case BC_BGR888: + for (i = 0; i < h->vfmt.height; i++) + h->rows[i] = buf->data + h->vfmt.width * 3 * i; + break; + case BC_YUV422: + for (i = 0; i < h->vfmt.height; i++) + h->rows[i] = buf->data+ h->vfmt.width * 2 * i; + break; + case BC_YUV420P: + h->rows[0] = buf->data; + h->rows[1] = buf->data + h->vfmt.width*h->vfmt.height; + h->rows[2] = buf->data + h->vfmt.width*h->vfmt.height*5/4; + break; + default: + fprintf(stderr,"internal error at %s:%d\n", + __FILE__,__LINE__); + exit(1); + } + + /* drop frames */ + for (i = 0; i < drop; i++) + quicktime_read_frame(h->qt,buf->data,0); + + buf->info.seq = quicktime_video_position(h->qt,0); + buf->info.ts = (long long) buf->info.seq * 1000000000 / h->rate; + lqt_decode_video(h->qt, h->rows, 0); + return buf; +} + +static struct ng_audio_buf* qt_adata(void *handle) +{ + struct qt_handle *h = handle; + struct ng_audio_buf *buf; + int16_t *dest; + long pos; + int i; + + if (quicktime_audio_position(h->qt,0) >= quicktime_audio_length(h->qt,0)) + return NULL; + + buf = ng_malloc_audio_buf(&h->afmt,AUDIO_SIZE); + dest = (int16_t*)buf->data; + + pos = quicktime_audio_position(h->qt,0); + buf->info.ts = (long long) pos * 1000000000 / h->afmt.rate; + if (h->channels > 1) { + /* stereo: two channels => interlaved samples */ + if (!h->left) + h->left = malloc(AUDIO_SIZE/2); + if (!h->right) + h->right = malloc(AUDIO_SIZE/2); + quicktime_set_audio_position(h->qt,pos,0); + quicktime_decode_audio(h->qt,h->left,NULL,AUDIO_SIZE/4,0); + quicktime_set_audio_position(h->qt,pos,1); + quicktime_decode_audio(h->qt,h->right,NULL,AUDIO_SIZE/4,1); + for (i = 0; i < AUDIO_SIZE/4; i++) { + dest[2*i+0] = h->left[i]; + dest[2*i+1] = h->right[i]; + } + } else { + /* mono */ + quicktime_decode_audio(h->qt,dest,NULL,AUDIO_SIZE/2,0); + } + return buf; +} + +static long long qt_frame_time(void *handle) +{ + struct qt_handle *h = handle; + + return 1000000000 / h->rate; +} + +static int qt_close(void *handle) +{ + struct qt_handle *h = handle; + + quicktime_close(h->qt); + if (h->rows) + free(h->rows); + free(h); + return 0; +} + +/* ----------------------------------------------------------------------- */ + +struct ng_reader qt_reader = { + name: "qt", + desc: "Apple QuickTime format", + + magic: { "moov", "mdat" }, + moff: { 4, 4 }, + mlen: { 4, 4 }, + + rd_open: qt_open, + rd_vfmt: qt_vfmt, + rd_afmt: qt_afmt, + rd_vdata: qt_vdata, + rd_adata: qt_adata, + frame_time: qt_frame_time, + rd_close: qt_close, +}; + +extern void ng_plugin_init(void); +void ng_plugin_init(void) +{ + ng_reader_register(NG_PLUGIN_MAGIC,__FILE__,&qt_reader); +} diff --git a/libng/plugins/riff.h b/libng/plugins/riff.h new file mode 100644 index 0000000..a1b3c99 --- /dev/null +++ b/libng/plugins/riff.h @@ -0,0 +1,157 @@ +#include <inttypes.h> +#include "byteswap.h" + +#if BYTE_ORDER == BIG_ENDIAN +# define AVI_SWAP2(a) SWAP2((a)) +# define AVI_SWAP4(a) SWAP4((a)) +#else +# define AVI_SWAP2(a) (a) +# define AVI_SWAP4(a) (a) +#endif + +#define WAVE_FORMAT_PCM (0x0001) +#define WAVE_FORMAT_ALAW (0x0006) +#define WAVE_FORMAT_MULAW (0x0007) + +#define AVIF_HASINDEX 0x10 + +struct RIFF_avih { + uint32_t us_frame; /* microsec per frame */ + uint32_t bps; /* byte/s overall */ + uint32_t unknown1; /* pad_gran (???) */ + uint32_t flags; + uint32_t frames; /* # of frames (all) */ + uint32_t init_frames; /* initial frames (???) */ + uint32_t streams; + uint32_t bufsize; /* suggested buffer size */ + uint32_t width; + uint32_t height; + uint32_t scale; + uint32_t rate; + uint32_t start; + uint32_t length; +}; + +struct RIFF_strh { + unsigned char type[4]; /* stream type */ + unsigned char handler[4]; + uint32_t flags; + uint32_t priority; + uint32_t init_frames; /* initial frames (???) */ + uint32_t scale; + uint32_t rate; + uint32_t start; + uint32_t length; + uint32_t bufsize; /* suggested buffer size */ + uint32_t quality; + uint32_t samplesize; + /* XXX 16 bytes ? */ +}; + +struct RIFF_strf_vids { /* == BitMapInfoHeader */ + uint32_t size; + uint32_t width; + uint32_t height; + uint16_t planes; + uint16_t bit_cnt; + unsigned char compression[4]; + uint32_t image_size; + uint32_t xpels_meter; + uint32_t ypels_meter; + uint32_t num_colors; /* used colors */ + uint32_t imp_colors; /* important colors */ + /* may be more for some codecs */ +}; + +struct RIFF_strf_auds { /* == WaveHeader (?) */ + uint16_t format; + uint16_t channels; + uint32_t rate; + uint32_t av_bps; + uint16_t blockalign; + uint16_t size; +}; + +struct AVI_HDR { + unsigned char riff_id[4]; + uint32_t riff_size; + unsigned char riff_type[4]; + + unsigned char hdrl_list_id[4]; + uint32_t hdrl_size; + unsigned char hdrl_type[4]; + + unsigned char avih_id[4]; + uint32_t avih_size; + struct RIFF_avih avih; +}; + +struct AVIX_HDR { + unsigned char riff_id[4]; + uint32_t riff_size; + unsigned char riff_type[4]; + + unsigned char data_list_id[4]; + uint32_t data_size; + unsigned char data_type[4]; +}; + +struct AVI_HDR_VIDEO { + unsigned char strl_list_id[4]; + uint32_t strl_size; + unsigned char strl_type[4]; + + unsigned char strh_id[4]; + uint32_t strh_size; + struct RIFF_strh strh; + + unsigned char strf_id[4]; + uint32_t strf_size; + struct RIFF_strf_vids strf; +}; + +struct AVI_HDR_AUDIO { + unsigned char strl_list_id[4]; + uint32_t strl_size; + unsigned char strl_type[4]; + + unsigned char strh_id[4]; + uint32_t strh_size; + struct RIFF_strh strh; + + unsigned char strf_id[4]; + uint32_t strf_size; + struct RIFF_strf_auds strf; +}; + +struct AVI_HDR_ODML { + unsigned char strl_list_id[4]; + uint32_t strl_size; + unsigned char strl_type[4]; + + unsigned char strh_id[4]; + uint32_t strh_size; + uint32_t total_frames; +}; + +struct AVI_DATA { + unsigned char data_list_id[4]; + uint32_t data_size; + unsigned char data_type[4]; + + /* audio+video data follows */ + +}; + +struct CHUNK_HDR { + unsigned char id[4]; + uint32_t size; +}; + +struct IDX_RECORD { + unsigned char id[4]; + uint32_t flags; + uint32_t offset; + uint32_t size; +}; + diff --git a/libng/plugins/snd-oss.c b/libng/plugins/snd-oss.c index 0e3e277..78b187a 100644 --- a/libng/plugins/snd-oss.c +++ b/libng/plugins/snd-oss.c @@ -331,7 +331,7 @@ oss_setformat(struct oss_handle *h, struct ng_audio_fmt *fmt) } static void* -oss_open(char *device, struct ng_audio_fmt *fmt) +oss_open(char *device, struct ng_audio_fmt *fmt, int record) { struct oss_handle *h; struct ng_audio_fmt ifmt; @@ -341,7 +341,8 @@ oss_open(char *device, struct ng_audio_fmt *fmt) return NULL; memset(h,0,sizeof(*h)); - if (-1 == (h->fd = open(device ? device : ng_dev.dsp, O_RDONLY))) { + if (-1 == (h->fd = open(device ? device : ng_dev.dsp, + record ? O_RDONLY : O_WRONLY | O_NONBLOCK))) { fprintf(stderr,"oss: open %s: %s\n", device ? device : ng_dev.dsp, strerror(errno)); @@ -380,7 +381,7 @@ oss_open(char *device, struct ng_audio_fmt *fmt) return h; } - fprintf(stderr,"oss: can't record %s\n", + fprintf(stderr,"oss: can't use format %s\n", ng_afmt_to_desc[fmt->fmtid]); err: @@ -431,19 +432,6 @@ oss_startrec(void *handle) return 0; } -static struct ng_audio_buf* -oss_bufalloc(struct ng_audio_fmt *fmt, int size) -{ - struct ng_audio_buf *buf; - - buf = malloc(sizeof(*buf)+size); - memset(buf,0,sizeof(*buf)); - buf->fmt = *fmt; - buf->size = size; - buf->data = (char*)buf + sizeof(*buf); - return buf; -} - static void oss_bufread(int fd,char *buffer,int blocksize) { @@ -496,7 +484,7 @@ oss_read(void *handle, long long stopby) } else { bytes = h->blocksize; } - buf = oss_bufalloc(&h->ofmt,bytes); + buf = ng_malloc_audio_buf(&h->ofmt,bytes); oss_bufread(h->fd,buf->data,bytes); if (h->byteswap) oss_bufswap(buf->data,bytes); @@ -505,6 +493,50 @@ oss_read(void *handle, long long stopby) return buf; } +static struct ng_audio_buf* +oss_write(void *handle, struct ng_audio_buf *buf) +{ + struct oss_handle *h = handle; + int rc; + + if (0 == buf->written && h->byteswap) + oss_bufswap(buf->data,buf->size); + rc = write(h->fd, buf->data+buf->written, buf->size-buf->written); + switch (rc) { + case -1: + perror("write dsp"); + free(buf); + buf = NULL; + case 0: + fprintf(stderr,"write dsp: Huh? no data written?\n"); + free(buf); + buf = NULL; + default: + buf->written += rc; + if (buf->written == buf->size) { + free(buf); + buf = NULL; + } + } + return buf; +} + +static long long +oss_latency(void *handle) +{ + struct oss_handle *h = handle; + audio_buf_info info; + int bytes,samples; + long long latency; + + if (-1 == ioctl(h->fd, SNDCTL_DSP_GETOSPACE, &info)) + return 0; + bytes = info.fragsize * info.fragstotal; + samples = bytes * 8 / ng_afmt_to_bits[h->ifmt.fmtid] * h->channels; + latency = (long long)samples * 1000000000 / h->rate; + return latency; +} + static int oss_fd(void *handle) { @@ -530,6 +562,8 @@ static struct ng_dsp_driver oss_dsp = { fd: oss_fd, startrec: oss_startrec, read: oss_read, + write: oss_write, + latency: oss_latency, }; extern void ng_plugin_init(void); diff --git a/libng/plugins/write-avi.c b/libng/plugins/write-avi.c index 21a9969..1f23975 100644 --- a/libng/plugins/write-avi.c +++ b/libng/plugins/write-avi.c @@ -9,15 +9,13 @@ #include <sys/param.h> #include <sys/uio.h> -#include "byteswap.h" +#include "riff.h" #include "grab-ng.h" -#if BYTE_ORDER == BIG_ENDIAN -# define AVI_SWAP2(a) SWAP2((a)) -# define AVI_SWAP4(a) SWAP4((a)) +#if 0 /* debugging */ +# define LIMIT_OPENDML (1024*1024) #else -# define AVI_SWAP2(a) (a) -# define AVI_SWAP4(a) (a) +# define LIMIT_OPENDML (2000*1024*1024) #endif /* @@ -49,72 +47,6 @@ #define TRAP(txt) fprintf(stderr,"%s:%d:%s\n",__FILE__,__LINE__,txt);exit(1); -#define WAVE_FORMAT_PCM (0x0001) -#define WAVE_FORMAT_ALAW (0x0006) -#define WAVE_FORMAT_MULAW (0x0007) - -#define AVIF_HASINDEX 0x10 - -typedef unsigned int uint32; -typedef unsigned short uint16; - -struct RIFF_avih { - uint32 us_frame; /* microsec per frame */ - uint32 bps; /* byte/s overall */ - uint32 unknown1; /* pad_gran (???) */ - uint32 flags; - uint32 frames; /* # of frames (all) */ - uint32 init_frames; /* initial frames (???) */ - uint32 streams; - uint32 bufsize; /* suggested buffer size */ - uint32 width; - uint32 height; - uint32 scale; - uint32 rate; - uint32 start; - uint32 length; -}; - -struct RIFF_strh { - char type[4]; /* stream type */ - char handler[4]; - uint32 flags; - uint32 priority; - uint32 init_frames; /* initial frames (???) */ - uint32 scale; - uint32 rate; - uint32 start; - uint32 length; - uint32 bufsize; /* suggested buffer size */ - uint32 quality; - uint32 samplesize; - /* XXX 16 bytes ? */ -}; - -struct RIFF_strf_vids { /* == BitMapInfoHeader */ - uint32 size; - uint32 width; - uint32 height; - uint16 planes; - uint16 bit_cnt; - char compression[4]; - uint32 image_size; - uint32 xpels_meter; - uint32 ypels_meter; - uint32 num_colors; /* used colors */ - uint32 imp_colors; /* important colors */ - /* may be more for some codecs */ -}; - -struct RIFF_strf_auds { /* == WaveHeader (?) */ - uint16 format; - uint16 channels; - uint32 rate; - uint32 av_bps; - uint16 blockalign; - uint16 size; -}; - #define size_strl_vids (sizeof(struct RIFF_strh) + \ sizeof(struct RIFF_strf_vids) + \ 4*5) @@ -122,102 +54,38 @@ struct RIFF_strf_auds { /* == WaveHeader (?) */ sizeof(struct RIFF_strf_auds) + \ 4*5) -static const struct AVI_HDR { - char riff_id[4]; - uint32 riff_size; - char riff_type[4]; - - char hdrl_list_id[4]; - uint32 hdrl_size; - char hdrl_type[4]; - - char avih_id[4]; - uint32 avih_size; - struct RIFF_avih avih; -} avi_hdr = { +static const struct AVI_HDR avi_hdr = { {'R','I','F','F'}, 0, {'A','V','I',' '}, {'L','I','S','T'}, 0, {'h','d','r','l'}, {'a','v','i','h'}, AVI_SWAP4(sizeof(struct RIFF_avih)), {} }; -static const struct AVIX_HDR { - char riff_id[4]; - uint32 riff_size; - char riff_type[4]; - - char data_list_id[4]; - uint32 data_size; - char data_type[4]; -} avix_hdr = { +static const struct AVIX_HDR avix_hdr = { {'R','I','F','F'}, 0, {'A','V','I','X'}, {'L','I','S','T'}, 0, {'m','o','v','i'}, }; -static const struct AVI_HDR_VIDEO { - char strl_list_id[4]; - uint32 strl_size; - char strl_type[4]; - - char strh_id[4]; - uint32 strh_size; - struct RIFF_strh strh; - - char strf_id[4]; - uint32 strf_size; - struct RIFF_strf_vids strf; -} avi_hdr_video = { +static const struct AVI_HDR_VIDEO avi_hdr_video = { {'L','I','S','T'}, AVI_SWAP4(size_strl_vids), {'s','t','r','l'}, {'s','t','r','h'}, AVI_SWAP4(sizeof(struct RIFF_strh)), {{'v','i','d','s'}}, {'s','t','r','f'}, AVI_SWAP4(sizeof(struct RIFF_strf_vids)), {} }; -static const struct AVI_HDR_AUDIO { - char strl_list_id[4]; - uint32 strl_size; - char strl_type[4]; - - char strh_id[4]; - uint32 strh_size; - struct RIFF_strh strh; - - char strf_id[4]; - uint32 strf_size; - struct RIFF_strf_auds strf; -} avi_hdr_audio = { +static const struct AVI_HDR_AUDIO avi_hdr_audio = { {'L','I','S','T'}, AVI_SWAP4(size_strl_auds), {'s','t','r','l'}, {'s','t','r','h'}, AVI_SWAP4(sizeof(struct RIFF_strh)), {{'a','u','d','s'}}, {'s','t','r','f'}, AVI_SWAP4(sizeof(struct RIFF_strf_auds)), {} }; -static const struct AVI_HDR_ODML { - char strl_list_id[4]; - uint32 strl_size; - char strl_type[4]; - - char strh_id[4]; - uint32 strh_size; - uint32 total_frames; -} avi_hdr_odml = { - {'L','I','S','T'}, AVI_SWAP4(sizeof(uint32) + 4*3), {'o','d','m','l'}, - {'d','m','l','h'}, AVI_SWAP4(sizeof(uint32)), +static const struct AVI_HDR_ODML avi_hdr_odml = { + {'L','I','S','T'}, AVI_SWAP4(sizeof(uint32_t) + 4*3), {'o','d','m','l'}, + {'d','m','l','h'}, AVI_SWAP4(sizeof(uint32_t)), }; -static const struct AVI_DATA { - char data_list_id[4]; - uint32 data_size; - char data_type[4]; - - /* audio+video data follows */ - -} avi_data = { +static const struct AVI_DATA avi_data = { {'L','I','S','T'}, 0, {'m','o','v','i'}, }; -struct CHUNK_HDR { - char id[4]; - uint32 size; -}; - static const struct CHUNK_HDR frame_hdr = { {'0','0','d','b'}, 0 }; @@ -228,13 +96,6 @@ static const struct CHUNK_HDR idx_hdr = { {'i','d','x','1'}, 0 }; -struct IDX_RECORD { - char id[4]; - uint32 flags; - uint32 offset; - uint32 size; -}; - /* ----------------------------------------------------------------------- */ struct avi_video_priv { @@ -548,7 +409,7 @@ avi_video(void *handle, struct ng_video_buf *buf) h->datax_size += size + sizeof(struct CHUNK_HDR); h->framesx += 1; } - if ((h->bigfile ? h->datax_size : h->data_size) > 1024*1024*2000) + if ((h->bigfile ? h->datax_size : h->data_size) > LIMIT_OPENDML) avi_bigfile(h,0); return 0; } diff --git a/man/dump-mixers.1 b/man/dump-mixers.1 index 310472b..fc8e1fe 100644 --- a/man/dump-mixers.1 +++ b/man/dump-mixers.1 @@ -1,6 +1,6 @@ .TH dump-mixers 1 "(c) Gerd Knorr" .SH NAME -dump-mixers +dump-mixers - dump OSS mixer settings to standard output .SH SYNOPSIS .B dump-mixers .SH DESCRIPTION @@ -216,7 +216,7 @@ motv depends on a correct driver configuration. If you can't tune TV stations even if the settings in the options window are correct it is very likely a driver issue. .SH SEE ALSO -xawtvrc(5), xawtv(1), fbtv(1), v4l-conf(8) +xawtvrc(5), xawtv(1), fbtv(1), v4l-conf(8), mtt(1) .br http://bytesex.org/xawtv/ (homepage) .SH AUTHOR diff --git a/man/mtt.1 b/man/mtt.1 new file mode 100644 index 0000000..1881c99 --- /dev/null +++ b/man/mtt.1 @@ -0,0 +1,48 @@ +.TH mtt 1 "(c) 2002 Gerd Knorr" +.SH NAME +mtt - teletext browser for X11 and console. +.SH SYNOPSIS +.B mtt [ options ] +.SH DESCRIPTION +.B mtt +is a browser for teletext pages. If the DISPLAY environment variable +is set +.B mtt +will come up with the X11 GUI (motif), otherwise it will use the +tty it was started from. +.SH OPTIONS +.B mtt +understands the usual toolkit options (-geometry + friends). +Additional options are: +.TP +.B -help +print help text. +.TP +.B -debug +enable debug messages. +.TP +.B -device <dev> +vbi device (default is /dev/vbi). +.TP +.B -tty +force using the console mode. +.SH SEE ALSO +motv(1) +.SH AUTHOR +Gerd Knorr <kraxel@bytesex.org> +.SH COPYRIGHT +Copyright (C) 2000 Gerd Knorr <kraxel@bytesex.org> +.P +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. +.P +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. +.P +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., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/man/pia.1 b/man/pia.1 new file mode 100644 index 0000000..d5059fb --- /dev/null +++ b/man/pia.1 @@ -0,0 +1,66 @@ +.TH pia 1 "(c) 2002 Gerd Knorr" +.SH NAME +pia - play media files +.SH SYNOPSIS +.B pia [ options ] movie +.SH DESCRIPTION +.B pia +is a small X11 tool which playes movie files. +.SH OPTIONS +.B pia +understands the usual toolkit options (-geometry + friends). +Additional options are: +.TP +.B -h +display help text +.TP +.B -v +be verbose. +.TP +.B -debug +enable debug messages. +.TP +.B -dsp <dev> +Use OSS device <dev> for sound. +.TP +.B -noxv +Disable Xvideo extention. +.TP +.B -nogl +Disable OpenGL. +.SH SUPPORTED MOVIE FORMATS +Main purpose of this utility is to playback movie files recorded by +xawtv, motv and streamer. It should be able to playback every AVI or +QuickTime movie written by one of the mentioned utilites. Feel free +to submit a bug report if this doesn't work for some file. +.SS QuickTime +.B pia +uses libquicktime to decode quicktime movies, thus it should be able +to decode and playback all movies with codecs supported by +libquicktime. +.SS AVI +AVI support is very limited. Video: uncompressed RGB data (15 and 24 +bpp) and mjpeg is supported. Audio: only uncompressed PCM data works. +.SS WAV +WAV files are playable too, with the same limitation like AVI audio: +only uncompressed PCM data. +.SH AUTHOR +Gerd Knorr <kraxel@bytesex.org> +.SH COPYRIGHT +2002 Gerd Knorr +.P +Copyright (C) 2002 Gerd Knorr <kraxel@bytesex.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., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/man/webcam.1 b/man/webcam.1 index e2a2850..01f0ecd 100644 --- a/man/webcam.1 +++ b/man/webcam.1 @@ -138,6 +138,37 @@ and parameters) rather than ftped. .B ssh set to non-zero makes webcam use ssh instead of ftp. +.SH CORRECTION OF DISTORTION +contributed by Frederic Helin, the parameters belong into the [grab] +section of the config file too. +.TP +.B distor = 1 +If distor param is set to 1, the correction of distortion works. +.TP +.B distor_k = 700 +This is the coefficient of distortion. This algorithm is based on the +paper "Correcting Distortion of Image by Image Registration" of Toru +Tamaki, Tsuyoshi Yamamura and Noboru Ahnishi. More your lens has an +important distortion, more 'distor_k' must be neared of 0. 700 is the +défault value. Coefficient k of program is x100 than article. +.TP +.B distor_cx = 192 +.TP +.B distor_cy = 144 +Coordinates of the lens optical axis: width/2 and height/2 are the +default values. The axis doesn't go through the image center. So, you +can change its coordinates around the center of image to affine +correction. +.TP +.B distor_zoom = 30 +Zoom parameter is used to cache the distorted borders of image, if you +don't like this. Default value is 100. +.TP +.B distor_sensorw = 320 +.TP +.B distor_sensorh = 240 +Dimensions of camera sensor. Default values are for 1/4p sensor. This +parameters used to have the same k coefficient than article. .SH AUTHOR Gerd Knorr <kraxel@bytesex.org> .SH COPYRIGHT diff --git a/vbistuff/Subdir.mk b/vbistuff/Subdir.mk index da3a9a7..8dfb8c1 100644 --- a/vbistuff/Subdir.mk +++ b/vbistuff/Subdir.mk @@ -25,8 +25,8 @@ vbistuff/alevtd: \ vbistuff/ntsc-cc: vbistuff/ntsc-cc.o # libraries to link -vbistuff/alevtd : LDLIBS := $(VBI_LIBS) -vbistuff/ntsc-cc : LDLIBS := $(ATHENA_LIBS) +vbistuff/alevtd : LDLIBS += $(VBI_LIBS) +vbistuff/ntsc-cc : LDLIBS += $(ATHENA_LIBS) # global targets all:: $(TARGETS-vbistuff) diff --git a/x11/Subdir.mk b/x11/Subdir.mk index 53e7bd7..ed61631 100644 --- a/x11/Subdir.mk +++ b/x11/Subdir.mk @@ -8,7 +8,8 @@ TARGETS-x11 += \ x11/v4lctl \ x11/xawtv-remote \ x11/rootv \ - x11/xawtv + x11/xawtv \ + x11/pia endif ifeq ($(FOUND_MOTIF),yes) TARGETS-x11 += \ @@ -25,6 +26,7 @@ x11/xawtv: \ x11/wmhooks.o \ x11/atoms.o \ x11/x11.o \ + x11/blit.o \ x11/xt.o \ x11/xv.o \ x11/toolbox.o \ @@ -44,6 +46,7 @@ x11/motv: \ x11/wmhooks.o \ x11/atoms.o \ x11/x11.o \ + x11/blit.o \ x11/xt.o \ x11/xv.o \ x11/complete-motif.o \ @@ -62,6 +65,7 @@ x11/mtt: \ x11/vbi-x11.o \ x11/vbi-gui.o \ console/vbi-tty.o \ + console/fbtools.o \ common/vbi-data.o \ common/RegEdit.o @@ -77,26 +81,33 @@ x11/rootv: \ x11/atoms.o \ common/parseconfig.o +x11/pia: \ + x11/pia.o \ + x11/blit.o \ + libng/libng.a + x11/xawtv-remote: x11/xawtv-remote.o x11/propwatch: x11/propwatch.o # libraries to link -x11/xawtv : LDLIBS := \ +x11/xawtv : LDLIBS += \ $(THREAD_LIBS) $(CURSES_LIBS) $(LIRC_LIBS) $(ALSA_LIBS) \ - $(ATHENA_LIBS) $(VBI_LIBS) -ljpeg -lm -x11/motv : LDLIBS := \ + $(ATHENA_LIBS) $(VBI_LIBS) $(GL_LIBS) -ljpeg -lm +x11/motv : LDLIBS += \ $(THREAD_LIBS) $(CURSES_LIBS) $(LIRC_LIBS) $(ALSA_LIBS) \ - $(MOTIF_LIBS) $(VBI_LIBS) -ljpeg -lm -x11/mtt : LDLIBS := $(THREAD_LIBS) $(MOTIF_LIBS) $(VBI_LIBS) -x11/v4lctl : LDLIBS := $(THREAD_LIBS) $(ATHENA_LIBS) -ljpeg -lm -x11/rootv : LDLIBS := $(ATHENA_LIBS) -x11/xawtv-remote : LDLIBS := $(ATHENA_LIBS) -x11/propwatch : LDLIBS := $(ATHENA_LIBS) + $(MOTIF_LIBS) $(VBI_LIBS) $(GL_LIBS) -ljpeg -lm +x11/mtt : LDLIBS += $(THREAD_LIBS) $(MOTIF_LIBS) $(VBI_LIBS) +x11/v4lctl : LDLIBS += $(THREAD_LIBS) $(ATHENA_LIBS) -ljpeg -lm +x11/pia : LDLIBS += $(ATHENA_LIBS) $(GL_LIBS) $(QT_LIBS) -ljpeg -lm +x11/rootv : LDLIBS += $(ATHENA_LIBS) +x11/xawtv-remote : LDLIBS += $(ATHENA_LIBS) +x11/propwatch : LDLIBS += $(ATHENA_LIBS) # linker flags x11/xawtv : LDFLAGS := $(DLFLAGS) x11/motv : LDFLAGS := $(DLFLAGS) x11/v4lctl : LDFLAGS := $(DLFLAGS) +x11/pia : LDFLAGS := $(DLFLAGS) # i18n LANGUAGES := de it fr @@ -126,6 +137,7 @@ install:: endif ifeq ($(FOUND_MOTIF),yes) install:: + $(INSTALL_DATA) x11/mtt.ad $(resdir)/app-defaults/mtt $(INSTALL_DATA) x11/MoTV.ad $(resdir)/app-defaults/MoTV for lang in $(LANGUAGES); do \ $(INSTALL_DIR) $(resdir)/$$lang/app-defaults; \ diff --git a/x11/Xawtv.ad b/x11/Xawtv.ad index 009687f..2a596fc 100644 --- a/x11/Xawtv.ad +++ b/x11/Xawtv.ad @@ -83,7 +83,7 @@ Streamer.title: record a movies Streamer*vlabel.label: movie/images filename Streamer*alabel.label: *.wav filename Streamer*streamer.label: start/stop recording -Streamer*xanim.label: playback (start xanim) +Streamer*xanim.label: playback (start pia) ! ---------------------------------------------------------------------------- diff --git a/x11/blit.c b/x11/blit.c new file mode 100644 index 0000000..66dee10 --- /dev/null +++ b/x11/blit.c @@ -0,0 +1,933 @@ +/* + * x11 helper functions -- blit frames to the screen + * + */ + +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <strings.h> +#include <errno.h> +#include <assert.h> +#include <pthread.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +#include <X11/Xlib.h> +#include <X11/Intrinsic.h> +#include <X11/extensions/XShm.h> +#ifdef HAVE_LIBXV +# include <X11/extensions/Xv.h> +# include <X11/extensions/Xvlib.h> +#endif + +#if HAVE_GL +# include <GL/gl.h> +# include <GL/glu.h> +# include <GL/glx.h> +#endif + +#include "grab-ng.h" +#include "blit.h" + +/* ------------------------------------------------------------------------ */ + +extern XtAppContext app_context; +extern int debug; + +int x11_dpy_fmtid; + +static int display_bits = 0; +static int display_bytes = 0; +static int pixmap_bytes = 0; +static int x11_byteswap = 0; +static int no_mitshm = 0; + +#if HAVE_LIBXV +static int ver, rel, req, ev, err; +static int formats; +static int adaptors; +static XvImageFormatValues *fo; +static XvAdaptorInfo *ai; +#endif + +static int im_adaptor,im_port = -1; +static unsigned int im_formats[VIDEO_FMT_COUNT]; + +static struct SEARCHFORMAT { + int depth; + unsigned long order; + unsigned long red; + unsigned long green; + unsigned long blue; + int format; +} fmt[] = { + { 2, MSBFirst, 0x7c00, 0x03e0, 0x001f, VIDEO_RGB15_BE }, + { 2, MSBFirst, 0xf800, 0x07e0, 0x001f, VIDEO_RGB16_BE }, + { 2, LSBFirst, 0x7c00, 0x03e0, 0x001f, VIDEO_RGB15_LE }, + { 2, LSBFirst, 0xf800, 0x07e0, 0x001f, VIDEO_RGB16_LE }, + + { 3, LSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_BGR24 }, + { 3, LSBFirst, 0x000000ff, 0x0000ff00, 0x00ff0000, VIDEO_RGB24 }, + { 3, MSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_RGB24 }, + { 3, MSBFirst, 0x000000ff, 0x0000ff00, 0x00ff0000, VIDEO_BGR24 }, + + { 4, LSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_BGR32 }, + { 4, LSBFirst, 0x0000ff00, 0x00ff0000, 0xff000000, VIDEO_RGB32 }, + { 4, MSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_RGB32 }, + { 4, MSBFirst, 0x0000ff00, 0x00ff0000, 0xff000000, VIDEO_BGR32 }, + + { 2, -1, 0, 0, 0, VIDEO_LUT2 }, + { 4, -1, 0, 0, 0, VIDEO_LUT4 }, + { 0 /* END OF LIST */ }, +}; + +static int +catch_no_mitshm(Display * dpy, XErrorEvent * event) +{ + no_mitshm++; + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* plain X11 stuff */ + +Visual* +x11_find_visual(Display *dpy) +{ + XVisualInfo *info, template; + Visual* vi = CopyFromParent; + int found,i; + char *class; + + template.screen = XDefaultScreen(dpy); + info = XGetVisualInfo(dpy, VisualScreenMask,&template,&found); + for (i = 0; i < found; i++) { + switch (info[i].class) { + case StaticGray: class = "StaticGray"; break; + case GrayScale: class = "GrayScale"; break; + case StaticColor: class = "StaticColor"; break; + case PseudoColor: class = "PseudoColor"; break; + case TrueColor: class = "TrueColor"; break; + case DirectColor: class = "DirectColor"; break; + default: class = "UNKNOWN"; break; + } + if (debug) + fprintf(stderr,"visual: id=0x%lx class=%d (%s), depth=%d\n", + info[i].visualid,info[i].class,class,info[i].depth); + } + for (i = 0; vi == CopyFromParent && i < found; i++) + if (info[i].class == TrueColor && info[i].depth >= 15) + vi = info[i].visual; + for (i = 0; vi == CopyFromParent && i < found; i++) + if (info[i].class == StaticGray && info[i].depth == 8) + vi = info[i].visual; + return vi; +} + +void +x11_init_visual(Display *dpy, XVisualInfo *vinfo) +{ + XPixmapFormatValues *pf; + int i,n; + int format = 0; + + if (!XShmQueryExtension(dpy)) + no_mitshm = 1; + + display_bits = vinfo->depth; + display_bytes = (display_bits+7)/8; + + pf = XListPixmapFormats(dpy,&n); + for (i = 0; i < n; i++) + if (pf[i].depth == display_bits) + pixmap_bytes = pf[i].bits_per_pixel/8; + + if (debug) { + fprintf(stderr,"x11: color depth: " + "%d bits, %d bytes - pixmap: %d bytes\n", + display_bits,display_bytes,pixmap_bytes); + if (vinfo->class == TrueColor || vinfo->class == DirectColor) + fprintf(stderr, "x11: color masks: " + "red=0x%08lx green=0x%08lx blue=0x%08lx\n", + vinfo->red_mask, vinfo->green_mask, vinfo->blue_mask); + fprintf(stderr,"x11: server byte order: %s\n", + ImageByteOrder(dpy)==LSBFirst ? "little endian":"big endian"); + fprintf(stderr,"x11: client byte order: %s\n", + BYTE_ORDER==LITTLE_ENDIAN ? "little endian":"big endian"); + } + if (ImageByteOrder(dpy)==LSBFirst && BYTE_ORDER!=LITTLE_ENDIAN) + x11_byteswap=1; + if (ImageByteOrder(dpy)==MSBFirst && BYTE_ORDER!=BIG_ENDIAN) + x11_byteswap=1; + if (vinfo->class == TrueColor /* || vinfo->class == DirectColor */) { + /* pixmap format */ + for (i = 0; fmt[i].depth > 0; i++) { + if (fmt[i].depth == pixmap_bytes && + (fmt[i].order == ImageByteOrder(dpy) || fmt[i].order == -1) && + (fmt[i].red == vinfo->red_mask || fmt[i].red == 0) && + (fmt[i].green == vinfo->green_mask || fmt[i].green == 0) && + (fmt[i].blue == vinfo->blue_mask || fmt[i].blue == 0)) { + x11_dpy_fmtid = fmt[i].format; + break; + } + } + if (fmt[i].depth == 0) { + fprintf(stderr, "Huh?\n"); + exit(1); + } + ng_lut_init(vinfo->red_mask, vinfo->green_mask, vinfo->blue_mask, + x11_dpy_fmtid,x11_byteswap); + /* guess physical screen format */ + if (ImageByteOrder(dpy) == MSBFirst) { + switch (pixmap_bytes) { + case 2: format = (display_bits==15) ? + VIDEO_RGB15_BE : VIDEO_RGB16_BE; break; + case 3: format = VIDEO_RGB24; break; + case 4: format = VIDEO_RGB32; break; + } + } else { + switch (pixmap_bytes) { + case 2: format = (display_bits==15) ? + VIDEO_RGB15_LE : VIDEO_RGB16_LE; break; + case 3: format = VIDEO_BGR24; break; + case 4: format = VIDEO_BGR32; break; + } + } + } + if (vinfo->class == StaticGray && vinfo->depth == 8) { + format = VIDEO_GRAY; + } + if (0 == format) { + if (vinfo->class == PseudoColor && vinfo->depth == 8) { + fprintf(stderr, +"\n" +"8-bit Pseudocolor Visual (256 colors) is *not* supported.\n" +"You can startup X11 either with 15 bpp (or more)...\n" +" xinit -- -bpp 16\n" +"... or with StaticGray visual:\n" +" xinit -- -cc StaticGray\n" + ); + } else { + fprintf(stderr, "Sorry, I can't handle your strange display\n"); + } + exit(1); + } + x11_dpy_fmtid = format; +} + +XImage* +x11_create_ximage(Display *dpy, XVisualInfo *vinfo, + int width, int height, XShmSegmentInfo **shm) +{ + XImage *ximage = NULL; + unsigned char *ximage_data; + XShmSegmentInfo *shminfo = NULL; + void *old_handler; + + if (no_mitshm) + goto no_mitshm; + + assert(width > 0 && height > 0); + + old_handler = XSetErrorHandler(catch_no_mitshm); + shminfo = malloc(sizeof(XShmSegmentInfo)); + memset(shminfo, 0, sizeof(XShmSegmentInfo)); + ximage = XShmCreateImage(dpy,vinfo->visual,vinfo->depth, + ZPixmap, NULL, + shminfo, width, height); + if (NULL == ximage) + goto shm_error; + shminfo->shmid = shmget(IPC_PRIVATE, + ximage->bytes_per_line * ximage->height, + IPC_CREAT | 0777); + if (-1 == shminfo->shmid) { + perror("shmget [x11]"); + goto shm_error; + } + shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); + if ((void *)-1 == shminfo->shmaddr) { + perror("shmat"); + goto shm_error; + } + ximage->data = shminfo->shmaddr; + shminfo->readOnly = False; + + XShmAttach(dpy, shminfo); + XSync(dpy, False); + if (no_mitshm) + goto shm_error; + shmctl(shminfo->shmid, IPC_RMID, 0); + XSetErrorHandler(old_handler); + *shm = shminfo; + return ximage; + + shm_error: + if (ximage) { + XDestroyImage(ximage); + ximage = NULL; + } + if ((void *)-1 != shminfo->shmaddr && NULL != shminfo->shmaddr) + shmdt(shminfo->shmaddr); + free(shminfo); + XSetErrorHandler(old_handler); + no_mitshm = 1; + + no_mitshm: + if (NULL == (ximage_data = malloc(width * height * pixmap_bytes))) { + fprintf(stderr,"out of memory\n"); + exit(1); + } + ximage = XCreateImage(dpy, vinfo->visual, vinfo->depth, + ZPixmap, 0, ximage_data, + width, height, + 8, 0); + memset(ximage->data, 0, ximage->bytes_per_line * ximage->height); + return ximage; +} + +void +x11_destroy_ximage(Display *dpy, XImage *ximage, XShmSegmentInfo *shm) +{ + if (shm) { + XShmDetach(dpy, shm); + XDestroyImage(ximage); + shmdt(shm->shmaddr); + free(shm); + } else + XDestroyImage(ximage); +} + +void x11_blit(Display *dpy, Drawable dr, GC gc, XImage *xi, + int a, int b, int c, int d, int w, int h) +{ + if (no_mitshm) + XShmPutImage(dpy,dr,gc,xi,a,b,c,d,w,h,True); + else + XPutImage(dpy,dr,gc,xi,a,b,c,d,w,h); +} + +Pixmap +x11_create_pixmap(Display *dpy, XVisualInfo *vinfo, struct ng_video_buf *buf) +{ + Pixmap pixmap; + XImage *ximage; + GC gc; + XShmSegmentInfo *shm; + Screen *scr = DefaultScreenOfDisplay(dpy); + + pixmap = XCreatePixmap(dpy,RootWindowOfScreen(scr), + buf->fmt.width, buf->fmt.height, vinfo->depth); + + gc = XCreateGC(dpy, pixmap, 0, NULL); + + if (NULL == (ximage = x11_create_ximage(dpy, vinfo, buf->fmt.width, + buf->fmt.height, &shm))) { + XFreePixmap(dpy, pixmap); + XFreeGC(dpy, gc); + return 0; + } + memcpy(ximage->data,buf->data,buf->size); + x11_blit(dpy, pixmap, gc, ximage, 0, 0, 0, 0, + buf->fmt.width, buf->fmt.height); + x11_destroy_ximage(dpy, ximage, shm); + XFreeGC(dpy, gc); + return pixmap; +} + +/* ------------------------------------------------------------------------ */ +/* XVideo extention code */ + +#ifdef HAVE_LIBXV +void xv_image_init(Display *dpy) +{ + int i; + + if (Success != XvQueryExtension(dpy,&ver,&rel,&req,&ev,&err)) { + if (debug) + fprintf(stderr,"Xvideo: Server has no Xvideo extention support\n"); + return; + } + if (Success != XvQueryAdaptors(dpy,DefaultRootWindow(dpy),&adaptors,&ai)) { + fprintf(stderr,"Xvideo: XvQueryAdaptors failed"); + return; + } + for (i = 0; i < adaptors; i++) { + if ((ai[i].type & XvInputMask) && + (ai[i].type & XvImageMask) && + (im_port == -1)) { + im_port = ai[i].base_id; + im_adaptor = i; + } + } + if (-1 == im_port) + return; + + fo = XvListImageFormats(dpy, im_port, &formats); + if (debug) + fprintf(stderr," image format list for port %d\n",im_port); + for(i = 0; i < formats; i++) { + if (debug) + fprintf(stderr, " 0x%x (%c%c%c%c) %s", + fo[i].id, + (fo[i].id) & 0xff, + (fo[i].id >> 8) & 0xff, + (fo[i].id >> 16) & 0xff, + (fo[i].id >> 24) & 0xff, + (fo[i].format == XvPacked) ? "packed" : "planar"); + if (0x32595559 == fo[i].id) { + im_formats[VIDEO_YUV422] = fo[i].id; + if (debug) + fprintf(stderr," [ok: %s]",ng_vfmt_to_desc[VIDEO_YUV422]); + } + if (0x30323449 == fo[i].id) { + im_formats[VIDEO_YUV420P] = fo[i].id; + if (debug) + fprintf(stderr," [ok: %s]",ng_vfmt_to_desc[VIDEO_YUV420P]); + } + if (debug) + fprintf(stderr,"\n"); + } +} + +XvImage* +xv_create_ximage(Display *dpy, int width, int height, int format, + XShmSegmentInfo **shm) +{ + XvImage *xvimage = NULL; + unsigned char *ximage_data; + XShmSegmentInfo *shminfo = NULL; + void *old_handler; + + if (no_mitshm) + goto no_mitshm; + + old_handler = XSetErrorHandler(catch_no_mitshm); + shminfo = malloc(sizeof(XShmSegmentInfo)); + memset(shminfo, 0, sizeof(XShmSegmentInfo)); + xvimage = XvShmCreateImage(dpy, im_port, format, 0, + width, height, shminfo); + if (NULL == xvimage) + goto shm_error; + shminfo->shmid = shmget(IPC_PRIVATE, xvimage->data_size, + IPC_CREAT | 0777); + if (-1 == shminfo->shmid) { + perror("shmget [xv]"); + goto shm_error; + } + shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); + if ((void *)-1 == shminfo->shmaddr) { + perror("shmat"); + goto shm_error; + } + xvimage->data = shminfo->shmaddr; + shminfo->readOnly = False; + + XShmAttach(dpy, shminfo); + XSync(dpy, False); + if (no_mitshm) + goto shm_error; + shmctl(shminfo->shmid, IPC_RMID, 0); + XSetErrorHandler(old_handler); + *shm = shminfo; + return xvimage; + +shm_error: + if (xvimage) { + XFree(xvimage); + xvimage = NULL; + } + if ((void *)-1 != shminfo->shmaddr && NULL != shminfo->shmaddr) + shmdt(shminfo->shmaddr); + free(shminfo); + XSetErrorHandler(old_handler); + no_mitshm = 1; + + no_mitshm: + if (NULL == (ximage_data = malloc(width * height * 2))) { + fprintf(stderr,"out of memory\n"); + exit(1); + } + xvimage = XvCreateImage(dpy, im_port, format, ximage_data, + width, height); + return xvimage; +} + +void +xv_destroy_ximage(Display *dpy, XvImage * xvimage, XShmSegmentInfo *shm) +{ + if (shm) { + XShmDetach(dpy, shm); + XFree(xvimage); + shmdt(shm->shmaddr); + free(shm); + } else + XFree(xvimage); +} + +void xv_blit(Display *dpy, Drawable dr, GC gc, XvImage *xi, + int a, int b, int c, int d, int x, int y, int w, int h) +{ + if (no_mitshm) + XvShmPutImage(dpy,im_port,dr,gc,xi,a,b,c,d,x,y,w,h,True); + else + XvPutImage(dpy,im_port,dr,gc,xi,a,b,c,d,x,y,w,h); +} +#endif + +/* ------------------------------------------------------------------------ */ +/* OpenGL code */ + +#if HAVE_GL +static int have_gl,max_gl; +static int gl_attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + +struct { + int fmt; + int type; + char *ext; +} gl_formats[VIDEO_FMT_COUNT] = { + [ VIDEO_RGB24 ] = { + fmt: GL_RGB, + type: GL_UNSIGNED_BYTE, + }, +#ifdef GL_EXT_bgra + [ VIDEO_BGR24 ] = { + fmt: GL_BGR_EXT, + type: GL_UNSIGNED_BYTE, + ext: "GL_EXT_bgra", + }, + [ VIDEO_BGR32 ] = { + fmt: GL_BGRA_EXT, + type: GL_UNSIGNED_BYTE, + ext: "GL_EXT_bgra", + } +#endif +}; + +static int gl_init(Widget widget) +{ + XVisualInfo *visinfo; + GLXContext ctx; + + visinfo = glXChooseVisual(XtDisplay(widget), + DefaultScreen(XtDisplay(widget)), + gl_attrib); + if (!visinfo) { + if (debug) + fprintf(stderr,"blit: gl: can't get visual (rgb,db)\n"); + return -1; + } + ctx = glXCreateContext(XtDisplay(widget), visinfo, NULL, True); + glXMakeCurrent(XtDisplay(widget),XtWindow(widget),ctx); + if (debug) + fprintf(stderr, "blit: gl: DRI=%s\n", + glXIsDirect(XtDisplay(widget), ctx) ? "Yes" : "No"); + + /* there is no point in using OpenGL for image scaling if it + * isn't hardware accelerated ... */ + if (!glXIsDirect(XtDisplay(widget), ctx)) + return -1; + + have_gl = 1; + glGetIntegerv(GL_MAX_TEXTURE_SIZE,&max_gl); + if (debug) + fprintf(stderr,"blit: gl: texture max size: %d\n",max_gl); + return 0; +} + +static int gl_ext(GLubyte *find) +{ + int len = strlen(find); + const GLubyte *ext; + GLubyte *pos; + + ext = glGetString(GL_EXTENSIONS); + if (NULL == (pos = strstr(ext,find))) + return 0; + if (pos != ext && pos[-1] != ' ') + return 0; + if (pos[len] != ' ' && pos[len] != '\0') + return 0; + if (debug) + fprintf(stderr,"blit: gl: extention %s available\n",find); + return 1; +} + +static int gl_resize(int iw, int ih, int ww, int wh, + GLint *tex, int *tw, int *th, int fmt, int type) +{ + char *dummy; + int i; + + /* check against max size */ + if (iw > max_gl) + return -1; + if (ih > max_gl) + return -1; + + /* textures have power-of-two x,y dimensions */ + for (i = 0; iw >= (1 << i); i++) + ; + *tw = (1 << i); + for (i = 0; ih >= (1 << i); i++) + ; + *th = (1 << i); + if (debug) + fprintf(stderr,"blit: gl: frame=%dx%d, texture=%dx%d\n", + iw,ih,*tw,*th); + + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_FLAT); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glViewport(0, 0, ww, wh); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(0.0, ww, 0.0, wh); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glGenTextures(1,tex); + glBindTexture(GL_TEXTURE_2D,*tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + dummy = malloc((*tw)*(*th)*3); + memset(dummy,128,(*tw)*(*th)*3); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,*tw,*th,0, + fmt,type,dummy); + free(dummy); + + return 0; +} + +static void gl_cleanup(GLint tex) +{ + /* FIXME: del texture */ +} + +static void gl_blit(Widget widget, char *rgbbuf, + int iw, int ih, int ww, int wh, + GLint tex, int tw, int th, int fmt, int type) +{ + float x,y; + + glTexSubImage2D(GL_TEXTURE_2D, 0, 0,0,iw,ih, fmt,type,rgbbuf); + x = (float)iw/tw; + y = (float)ih/th; + + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glBegin(GL_QUADS); + glTexCoord2f(0,y); glVertex3f(0,0,0); + glTexCoord2f(0,0); glVertex3f(0,wh,0); + glTexCoord2f(x,0); glVertex3f(ww,wh,0); + glTexCoord2f(x,y); glVertex3f(ww,0,0); + glEnd(); + glXSwapBuffers(XtDisplay(widget), XtWindow(widget)); + glDisable(GL_TEXTURE_2D); +} +#endif + +/* ------------------------------------------------------------------------ */ +/* video frame blitter */ + +enum blit_status { + STATUS_UNKNOWN = 0, + STATUS_BROKEN = 1, + STATUS_CONVERT = 2, + STATUS_XVIDEO = 3, + STATUS_OPENGL = 4, +}; + +struct blit_state { + enum blit_status status; + Widget widget; + Dimension win_width, win_height; + GC gc; + XVisualInfo *vinfo; + struct ng_video_fmt fmt; + struct ng_video_buf buf; + struct ng_video_conv *conv; + struct ng_convert_handle *chandle; + XShmSegmentInfo *shm; + XImage *ximage; +#ifdef HAVE_LIBXV + XvImage *xvimage; +#endif +#if HAVE_GL + int gl; + GLint tex; + int tw,th; +#endif +}; + +void blit_get_formats(int *fmtids, int max) +{ + struct ng_video_conv *conv; + int i, n=0; + + /* Xvideo extention */ +#ifdef HAVE_LIBXV + for (i = 0; i < VIDEO_FMT_COUNT; i++) { + if (0 != im_formats[i]) + fmtids[n++] = i; + if (n == max) + return; + } +#endif + +#if HAVE_GL + /* OpenGL */ + if (have_gl) { + for (i = 0; i < VIDEO_FMT_COUNT; i++) { + if (0 != gl_formats[i].fmt && + (NULL == gl_formats[i].ext || gl_ext(gl_formats[i].ext))) + fmtids[n++] = i; + if (n == max) + return; + } + } +#endif + + /* plain X11 */ + fmtids[n++] = x11_dpy_fmtid; + if (n == max) + return; + for (i = 0;;) { + conv = ng_conv_find_to(x11_dpy_fmtid, &i); + if (NULL == conv) + break; + fmtids[n++] = conv->fmtid_in; + if (n == max) + return; + } + for (; n < max; n++) + fmtids[n] = 0; +} + +struct blit_state* +blit_init(Widget widget, XVisualInfo *vinfo, int enable_gl) +{ + struct blit_state *st; + + if (debug) + fprintf(stderr,"blit: init\n"); + st = malloc(sizeof(*st)); + memset(st,0,sizeof(*st)); + + st->widget = widget; + st->vinfo = vinfo; +#ifdef HAVE_GL + st->gl = enable_gl; +#endif + return st; +} + +void blit_resize(struct blit_state *st, Dimension width, Dimension height) +{ + if (debug) + fprintf(stderr,"blit: resize %dx%d\n",width,height); + st->win_width = width; + st->win_height = height; + blit_fini_frame(st); +} + +void blit_init_frame(struct blit_state *st, struct ng_video_fmt *fmt) +{ + struct ng_video_conv *conv; + int i; + + /* delayed initialization stuff (needs mapped window) */ + if (!st->gc) { + st->gc = XCreateGC(XtDisplay(st->widget),XtWindow(st->widget),0,NULL); +#ifdef HAVE_GL + if (st->gl) + gl_init(st->widget); +#endif + } + + /* Xvideo extention */ +#ifdef HAVE_LIBXV + if (0 != im_formats[fmt->fmtid]) { + st->xvimage = xv_create_ximage(XtDisplay(st->widget), + fmt->width, fmt->height, + im_formats[fmt->fmtid], + &st->shm); + st->buf.fmt = *fmt; + st->status = STATUS_XVIDEO; + if (debug) + fprintf(stderr,"blit: %dx%d/[%s] => Xvideo\n", + fmt->width, fmt->height, ng_vfmt_to_desc[fmt->fmtid]); + return; + } +#endif + +#if HAVE_GL + /* OpenGL */ + if (have_gl && 0 != gl_formats[fmt->fmtid].fmt && + (NULL == gl_formats[fmt->fmtid].ext || + gl_ext(gl_formats[fmt->fmtid].ext)) && + 0 == gl_resize(fmt->width,fmt->height, + st->win_width,st->win_height, + &st->tex,&st->tw,&st->th, + gl_formats[fmt->fmtid].fmt, + gl_formats[fmt->fmtid].type)) { + st->buf.fmt = *fmt; + st->status = STATUS_OPENGL; + if (debug) + fprintf(stderr,"blit: %dx%d/[%s] => OpenGL\n", + fmt->width, fmt->height, ng_vfmt_to_desc[fmt->fmtid]); + return; + } +#endif + + /* plain X11 */ + st->ximage = x11_create_ximage(XtDisplay(st->widget), st->vinfo, + fmt->width, fmt->height, + &st->shm); + st->buf.data = st->ximage->data; + if (x11_dpy_fmtid == fmt->fmtid) { + st->buf.fmt = *fmt; + st->status = STATUS_CONVERT; + if (debug) + fprintf(stderr,"blit: %dx%d/[%s] => X11 direct\n", + fmt->width, fmt->height, ng_vfmt_to_desc[fmt->fmtid]); + return; + } + for (i = 0;;) { + conv = ng_conv_find_to(x11_dpy_fmtid, &i); + if (NULL == conv) { + st->status = STATUS_BROKEN; + if (debug) + fprintf(stderr,"blit: %dx%d/[%s] => can't display\n", + fmt->width, fmt->height, ng_vfmt_to_desc[fmt->fmtid]); + return; + } + if (debug) + fprintf(stderr,"blit test: %s\n",ng_vfmt_to_desc[conv->fmtid_in]); + if (conv->fmtid_in != fmt->fmtid) + continue; + break; + } + st->buf.fmt = *fmt; + st->status = STATUS_CONVERT; + st->conv = conv; + st->buf.fmt.fmtid = x11_dpy_fmtid; + st->buf.fmt.bytesperline = 0; + st->chandle = ng_convert_alloc(st->conv,fmt,&st->buf.fmt); + ng_convert_init(st->chandle); + if (debug) + fprintf(stderr,"blit: %dx%d/[%s] => X11 via [%s]\n", + fmt->width, fmt->height, ng_vfmt_to_desc[fmt->fmtid], + ng_vfmt_to_desc[st->buf.fmt.fmtid]); + return; +} + +void blit_fini_frame(struct blit_state *st) +{ + switch (st->status) { + case STATUS_CONVERT: + if (st->chandle) { + ng_convert_fini(st->chandle); + st->chandle = NULL; + } + if (st->ximage) { + x11_destroy_ximage(XtDisplay(st->widget),st->ximage,st->shm); + st->ximage = NULL; + } + break; + +#if HAVE_LIBXV + case STATUS_XVIDEO: + if (st->xvimage) { + xv_destroy_ximage(XtDisplay(st->widget),st->xvimage,st->shm); + st->xvimage = NULL; + } + XvStopVideo(XtDisplay(st->widget), im_port, XtWindow(st->widget)); + break; +#endif + +#if HAVE_GL + case STATUS_OPENGL: + gl_cleanup(st->tex); + break; +#endif + + case STATUS_UNKNOWN: + case STATUS_BROKEN: + break; + } + memset(&st->fmt,0,sizeof(st->fmt)); + memset(&st->buf,0,sizeof(st->buf)); + st->status = STATUS_UNKNOWN; +} + +void blit_fini(struct blit_state *st) +{ + free(st); +} + +void blit_putframe(struct blit_state *st, struct ng_video_buf *buf) +{ + if (st->fmt.fmtid != buf->fmt.fmtid && + st->fmt.width != buf->fmt.width && + st->fmt.height != buf->fmt.height) { + blit_fini_frame(st); + blit_init_frame(st,&buf->fmt); + st->fmt = buf->fmt; + } + + if (debug > 1) + fprintf(stderr,"blit: putframe\n"); + switch (st->status) { + case STATUS_CONVERT: + if (NULL == st->chandle) { + memcpy(st->ximage->data,buf->data,buf->size); + ng_release_video_buf(buf); + } else { + buf = ng_convert_frame(st->chandle,&st->buf,buf); + } + x11_blit(XtDisplay(st->widget), XtWindow(st->widget), + st->gc,st->ximage,0,0, + (st->win_width - st->buf.fmt.width) >> 1, + (st->win_height - st->buf.fmt.height) >> 1, + st->buf.fmt.width, st->buf.fmt.height); + break; + +#ifdef HAVE_LIBXV + case STATUS_XVIDEO: + memcpy(st->xvimage->data,buf->data,buf->size); + ng_release_video_buf(buf); + xv_blit(XtDisplay(st->widget), XtWindow(st->widget), + st->gc, st->xvimage, + 0, 0, st->buf.fmt.width, st->buf.fmt.height, + 0, 0, st->win_width, st->win_height); + break; +#endif + +#if HAVE_GL + case STATUS_OPENGL: + gl_blit(st->widget,buf->data, + st->buf.fmt.width, st->buf.fmt.height, + st->win_width, st->win_height, + st->tex, st->tw, st->th, + gl_formats[buf->fmt.fmtid].fmt, + gl_formats[buf->fmt.fmtid].type); + ng_release_video_buf(buf); + break; +#endif + + case STATUS_UNKNOWN: + case STATUS_BROKEN: + if (debug > 1) + fprintf(stderr,"blit: putframe: oops: status = %d\n",st->status); + break; + } +} diff --git a/x11/blit.h b/x11/blit.h new file mode 100644 index 0000000..87888a7 --- /dev/null +++ b/x11/blit.h @@ -0,0 +1,33 @@ +/* plain X11 */ +extern int x11_dpy_fmtid; + +Visual* x11_find_visual(Display *dpy); +void x11_init_visual(Display *dpy, XVisualInfo *vinfo); + +XImage *x11_create_ximage(Display *dpy, XVisualInfo *vinfo, + int width, int height, XShmSegmentInfo **shm); +void x11_destroy_ximage(Display *dpy, XImage * ximage, XShmSegmentInfo *shm); +Pixmap x11_create_pixmap(Display *dpy, XVisualInfo *vinfo, + struct ng_video_buf *buf); +void x11_blit(Display *dpy, Drawable dr, GC gc, XImage *xi, + int a, int b, int c, int d, int w, int h); + +/* xvideo extention */ +#ifdef HAVE_LIBXV +void xv_image_init(Display *dpy); +XvImage* xv_create_ximage(Display *dpy, int width, int height, + int format, XShmSegmentInfo **shm); +void xv_destroy_ximage(Display *dpy, XvImage * xvimage, XShmSegmentInfo *shm); +void xv_blit(Display *dpy, Drawable dr, GC gc, XvImage *xi, + int a, int b, int c, int d, int x, int y, int w, int h); +#endif + +/* video frame blitter */ +struct blit_state; +void blit_get_formats(int *fmtids, int max); +struct blit_state* blit_init(Widget widget, XVisualInfo *vinfo, int enable_gl); +void blit_resize(struct blit_state *st, Dimension width, Dimension height); +void blit_init_frame(struct blit_state *st, struct ng_video_fmt *fmt); +void blit_fini_frame(struct blit_state *st); +void blit_fini(struct blit_state *st); +void blit_putframe(struct blit_state *st, struct ng_video_buf *buf); @@ -21,6 +21,7 @@ #include <X11/Xlib.h> #include <X11/Intrinsic.h> #include <Xm/Xm.h> +#include <Xm/XmStrDefs.h> #include <Xm/Primitive.h> #include <Xm/Form.h> #include <Xm/Label.h> @@ -42,6 +43,7 @@ #include <Xm/TransferP.h> #include <Xm/DragIcon.h> +#include <X11/extensions/XShm.h> #ifdef HAVE_LIBXXF86VM # include <X11/extensions/xf86vmode.h> # include <X11/extensions/xf86vmstr.h> @@ -73,6 +75,7 @@ #include "list.h" #include "vbi-data.h" #include "vbi-x11.h" +#include "blit.h" /*----------------------------------------------------------------------*/ @@ -329,7 +332,7 @@ resize_event(Widget widget, XtPointer client_data, XEvent *event, Boolean *d) height != event->xconfigure.height) { width = event->xconfigure.width; height = event->xconfigure.height; - video_gd_configure(width, height); + video_gd_configure(width, height, args.gl); XClearWindow(XtDisplay(tv),XtWindow(tv)); } break; @@ -1630,24 +1633,27 @@ pixit(void) return; video_gd_suspend(); - fmt = x11_fmt; + memset(&fmt,0,sizeof(fmt)); + fmt.fmtid = x11_dpy_fmtid; fmt.width = pix_width; fmt.height = pix_height; - if (NULL != (buf = ng_grabber_get_image(&fmt))) { - buf = ng_filter_single(cur_filter,buf); - if (0 != (pix = x11_create_pixmap(dpy,&vinfo,colormap,buf->data, - fmt.width,fmt.height, - channels[cur_sender]->name))) { - XtVaSetValues(channels[cur_sender]->button, - XmNlabelPixmap,pix, - XmNlabelType,XmPIXMAP, - NULL); - if (channels[cur_sender]->pixmap) - XFreePixmap(dpy,channels[cur_sender]->pixmap); - channels[cur_sender]->pixmap = pix; - } - ng_release_video_buf(buf); - } + if (NULL == (buf = ng_grabber_get_image(&fmt))) + goto done1; + buf = ng_filter_single(cur_filter,buf); + if (0 == (pix = x11_create_pixmap(dpy,&vinfo,buf))) + goto done2; + x11_label_pixmap(dpy,colormap,pix,buf->fmt.height, + channels[cur_sender]->name); + XtVaSetValues(channels[cur_sender]->button, + XmNlabelPixmap,pix, + XmNlabelType,XmPIXMAP, + NULL); + if (channels[cur_sender]->pixmap) + XFreePixmap(dpy,channels[cur_sender]->pixmap); + channels[cur_sender]->pixmap = pix; + done2: + ng_release_video_buf(buf); + done1: video_gd_restart(); } @@ -2046,8 +2052,8 @@ do_movie_record(int argc, char **argv) wr = ng_writers[movie_driver]; video.fmtid = wr->video[movie_video].fmtid; - video.width = x11_fmt.width; - video.height = x11_fmt.height; + video.width = cur_tv_width; + video.height = cur_tv_height; audio.fmtid = wr->audio[movie_audio].fmtid; audio.rate = rate; @@ -2527,7 +2533,7 @@ convert_buffer(struct ng_video_buf *in, int out_fmt) /* find converter */ for (i = 0;;) { - conv = ng_conv_find(out_fmt,&i); + conv = ng_conv_find_to(out_fmt,&i); if (NULL == conv) break; if (conv->fmtid_in == in->fmt.fmtid) @@ -2603,11 +2609,9 @@ ipc_iconify(Widget widget, struct ipc_data *ipc) /* scale down & create pixmap */ small = scale_rgb_buffer(ipc->buf,scale); - small = convert_buffer(small, x11_fmt.fmtid); - ipc->icon_pixmap = x11_create_pixmap(dpy,&vinfo,colormap,small->data, - small->fmt.width,small->fmt.height, - NULL); - + small = convert_buffer(small, x11_dpy_fmtid); + ipc->icon_pixmap = x11_create_pixmap(dpy,&vinfo,small); + /* build DnD icon */ n = 0; depth = DefaultDepthOfScreen(XtScreen(widget)); @@ -2643,8 +2647,10 @@ ipc_init(Atom selection) /* capture a frame and save a copy */ video_gd_suspend(); - fmt = x11_fmt; - fmt.fmtid = VIDEO_RGB24; + memset(&fmt,0,sizeof(fmt)); + fmt.fmtid = VIDEO_RGB24; + fmt.width = cur_tv_width; + fmt.height = cur_tv_height; buf = ng_grabber_get_image(&fmt); buf = ng_filter_single(cur_filter,buf); ipc = malloc(sizeof(*ipc)); @@ -2693,9 +2699,8 @@ ipc_pixmap(struct ipc_data *ipc) return; ipc->buf->refcount++; - buf = convert_buffer(ipc->buf, x11_fmt.fmtid); - ipc->pix = x11_create_pixmap(dpy,&vinfo,colormap,buf->data, - buf->fmt.width,buf->fmt.height,NULL); + buf = convert_buffer(ipc->buf, x11_dpy_fmtid); + ipc->pix = x11_create_pixmap(dpy,&vinfo,buf); ng_release_video_buf(buf); return; } @@ -3007,7 +3012,7 @@ levels_toggle_cb(Widget widget, XtPointer clientdata, XtPointer call_data) /* enable */ a.fmtid = AUDIO_U8_STEREO; a.rate = 44100; - levels_dsp = ng_dsp_open(args.dspdev,&a,&levels_hdsp); + levels_dsp = ng_dsp_open(args.dspdev,&a,1,&levels_hdsp); if (levels_dsp) { levels_dsp->startrec(levels_hdsp); levels_id = XtAppAddInput(app_context,levels_dsp->fd(levels_hdsp), @@ -3166,7 +3171,9 @@ main(int argc, char *argv[]) /* device scan */ if (args.hwscan) { fprintf(stderr,"looking for available devices\n"); - xv_init(1,1,-1,1); +#ifdef HAVE_LIBXV + xv_video_init(-1,1); +#endif grabber_scan(); } @@ -3190,9 +3197,16 @@ main(int argc, char *argv[]) if (debug) fprintf(stderr,"main: xinerama extention...\n"); xfree_xinerama_init(); +#ifdef HAVE_LIBXV if (debug) - fprintf(stderr,"main: xvideo extention...\n"); - xv_init(args.xv_video,args.xv_image,args.xv_port,0); + fprintf(stderr,"main: xvideo extention [video]...\n"); + if (args.xv_video) + xv_video_init(args.xv_port,0); + if (debug) + fprintf(stderr,"main: xvideo extention [image]...\n"); + if (args.xv_image) + xv_image_init(dpy); +#endif /* set hooks (command.c) */ update_title = new_title; @@ -3218,32 +3232,9 @@ main(int argc, char *argv[]) if (debug) fprintf(stderr,"main: init main window...\n"); - tv = video_init(app_shell,&vinfo,xmPrimitiveWidgetClass); + tv = video_init(app_shell,&vinfo,xmPrimitiveWidgetClass,args.bpp); XtAddEventHandler(XtParent(tv),StructureNotifyMask, True, resize_event, NULL); - if (ImageByteOrder(dpy) == MSBFirst) { - /* X-Server is BE */ - switch(args.bpp) { - case 8: x11_native_format = VIDEO_RGB08; break; - case 15: x11_native_format = VIDEO_RGB15_BE; break; - case 16: x11_native_format = VIDEO_RGB16_BE; break; - case 24: x11_native_format = VIDEO_BGR24; break; - case 32: x11_native_format = VIDEO_BGR32; break; - default: - args.bpp = 0; - } - } else { - /* X-Server is LE */ - switch(args.bpp) { - case 8: x11_native_format = VIDEO_RGB08; break; - case 15: x11_native_format = VIDEO_RGB15_LE; break; - case 16: x11_native_format = VIDEO_RGB16_LE; break; - case 24: x11_native_format = VIDEO_BGR24; break; - case 32: x11_native_format = VIDEO_BGR32; break; - default: - args.bpp = 0; - } - } if (debug) fprintf(stderr,"main: install signal handlers...\n"); xt_siginit(); @@ -46,6 +46,7 @@ XtAppContext app_context; Widget app_shell; Display *dpy; +int debug; static String fallback_ressources[] = { #include "mtt.h" diff --git a/x11/pia.c b/x11/pia.c new file mode 100644 index 0000000..7aec466 --- /dev/null +++ b/x11/pia.c @@ -0,0 +1,459 @@ +/* + * simple movie player + * + * (c) 2002 Gerd Knorr <kraxel@bytesex.org> + * + */ + +#include "config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <strings.h> +#include <errno.h> +#include <fcntl.h> + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/ioctl.h> +#include <sys/soundcard.h> + +#include <X11/Xlib.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xaw/Simple.h> +#include <X11/extensions/XShm.h> +#ifdef HAVE_LIBXV +# include <X11/extensions/Xv.h> +# include <X11/extensions/Xvlib.h> +#endif + +#include "grab-ng.h" +#include "blit.h" + +/* ------------------------------------------------------------------------ */ + +int debug = 0; + +/* X11 */ +static XtAppContext app_context; +static Widget app_shell; +static Display *dpy; +static Colormap colormap; +static Visual *visual; +static XVisualInfo vinfo,*vinfo_list; + +static Widget simple; +static Dimension swidth,sheight; + +static struct blit_state *blit; + +/* libng */ +static const struct ng_reader *reader; +static void *rhandle; +static const struct ng_dsp_driver *snd; +static void *shandle; +static int snd_fd; + +static struct ng_video_fmt cfmt; +static struct ng_video_conv *conv; +static void *chandle; + +static struct ng_video_fmt *vfmt; +static struct ng_audio_fmt *afmt; +static struct ng_video_buf *vbuf; +static struct ng_audio_buf *abuf; + +/* ------------------------------------------------------------------------ */ + +struct ARGS { + char *dsp; + int help; + int verbose; + int debug; + int xv; + int gl; + int max; +} args; + +XtResource args_desc[] = { + /* name, class, type, size, offset, default_type, default_addr */ + { + /* Strings */ + "dsp", + XtCString, XtRString, sizeof(char*), + XtOffset(struct ARGS*,dsp), + XtRString, NULL, + },{ + /* Integer */ + "verbose", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,verbose), + XtRString, "0" + },{ + "debug", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,debug), + XtRString, "0" + },{ + "help", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,help), + XtRString, "0" + },{ + "xv", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,xv), + XtRString, "1" + },{ + "gl", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,gl), + XtRString, "1" + },{ + "max", + XtCValue, XtRInt, sizeof(int), + XtOffset(struct ARGS*,max), + XtRString, "0" + } +}; +const int args_count = XtNumber(args_desc); + +XrmOptionDescRec opt_desc[] = { + { "-dsp", "dsp", XrmoptionSepArg, NULL }, + + { "-h", "help", XrmoptionNoArg, "1" }, + { "-help", "help", XrmoptionNoArg, "1" }, + { "--help", "help", XrmoptionNoArg, "1" }, + + { "-v", "verbose", XrmoptionNoArg, "1" }, + { "-verbose", "verbose", XrmoptionNoArg, "1" }, + { "-debug", "debug", XrmoptionNoArg, "1" }, + { "-max", "max", XrmoptionNoArg, "1" }, + + { "-xv", "xv", XrmoptionNoArg, "1" }, + { "-noxv", "xv", XrmoptionNoArg, "0" }, + { "-gl", "gl", XrmoptionNoArg, "1" }, + { "-nogl", "gl", XrmoptionNoArg, "0" }, +}; +const int opt_count = (sizeof(opt_desc)/sizeof(XrmOptionDescRec)); + +/* ------------------------------------------------------------------------ */ + +static void quit_ac(Widget widget, XEvent *event, + String *params, Cardinal *num_params) +{ + exit(0); +} + +static void resize_ev(Widget widget, XtPointer client_data, + XEvent *event, Boolean *d) +{ + switch(event->type) { + case MapNotify: + case ConfigureNotify: + XtVaGetValues(widget,XtNheight,&sheight,XtNwidth,&swidth,NULL); + if (vfmt) + blit_resize(blit,swidth,sheight); + break; + } +} + +static XtActionsRec action_table[] = { + { "Quit", quit_ac }, +}; + +static String res[] = { + "pia.playback.translations: #override \\n" + " <Key>Q: Quit() \\n" + " <Key>Escape: Quit()", + "pia.playback.background: black", + NULL +}; + +static void usage(FILE *out, char *prog) +{ + char *h; + + if (NULL != (h = strrchr(prog,'/'))) + prog = h+1; + fprintf(out, + "%s is simple movie player\n" + "\n" + "usage: %s [ options ] movie\n" + "options:\n" + " -h, -help this text\n" + " -v, -verbose be verbose\n" + " -debug enable debug messages\n" + " -dsp <dev> use sound device <dev>\n" +#ifdef HAVE_LIBXV + " -noxv disable Xvideo extention\n" +#endif +#ifdef HAVE_GL + " -nogl disable OpenGL\n" +#endif + "\n", + prog,prog); +} + +static void sync_info(long long drift, int drops) +{ + fprintf(stderr,"a/v sync: audio drift is %3d ms / %d frame(s) dropped\r", + (int)((drift)/1000000),drops); +} + +int main(int argc, char *argv[]) +{ + long long start, now, delay, latency = 0, drift = 0; + struct timeval wait; + int fmtids[2*VIDEO_FMT_COUNT], i, n, drop, droptotal, ww, wh; + + app_shell = XtVaAppInitialize(&app_context, "pia", + opt_desc, opt_count, + &argc, argv, + res, NULL); + XtGetApplicationResources(app_shell,&args, + args_desc,args_count, + NULL,0); + if (args.help) { + usage(stdout,argv[0]); + exit(1); + } + if (args.debug) { + debug = args.debug; + ng_debug = args.debug; + } + + if (argc < 2) { + usage(stderr,argv[0]); + exit(1); + } + ng_init(); + if (ng_readers) + reader = ng_readers[0]; + if (NULL == reader) { + fprintf(stderr,"no reader\n"); + exit(1); + } + + /* init x11 stuff */ + dpy = XtDisplay(app_shell); + visual = x11_find_visual(XtDisplay(app_shell)); + vinfo.visualid = XVisualIDFromVisual(visual); + vinfo_list = XGetVisualInfo(dpy, VisualIDMask, &vinfo, &n); + vinfo = vinfo_list[0]; + XFree(vinfo_list); + if (visual != DefaultVisualOfScreen(XtScreen(app_shell))) { + fprintf(stderr,"switching visual (0x%lx)\n",vinfo.visualid); + colormap = XCreateColormap(dpy,RootWindowOfScreen(XtScreen(app_shell)), + vinfo.visual,AllocNone); + XtDestroyWidget(app_shell); + app_shell = XtVaAppCreateShell("pia","pia", + applicationShellWidgetClass, dpy, + XtNvisual,vinfo.visual, + XtNcolormap,colormap, + XtNdepth, vinfo.depth, + NULL); + } else { + colormap = DefaultColormapOfScreen(XtScreen(app_shell)); + } + x11_init_visual(XtDisplay(app_shell),&vinfo); +#if HAVE_LIBXV + if (args.xv) + xv_image_init(dpy); +#endif + XtAppAddActions(app_context,action_table, + sizeof(action_table)/sizeof(XtActionsRec)); + XtVaSetValues(app_shell, XtNtitle,argv[1],NULL); + + /* open file */ + blit_get_formats(fmtids,sizeof(fmtids)/sizeof(int)); + reader = ng_find_reader(argv[1]); + if (NULL == reader) { + fprintf(stderr,"can't handle %s\n",argv[1]); + exit(1); + } + rhandle = reader->rd_open(argv[1],fmtids,sizeof(fmtids)/sizeof(int)); + if (NULL == rhandle) { + fprintf(stderr,"opening %s failed\n",argv[1]); + exit(1); + } + vfmt = reader->rd_vfmt(rhandle); + afmt = reader->rd_afmt(rhandle); + + /* show window */ + ww = 320; + wh = 32; + if (vfmt) { + ww = vfmt->width; + wh = vfmt->height; + if (args.max) { + int sw = XtScreen(app_shell)->width; + int sh = XtScreen(app_shell)->height; + if (sw * wh > sh * ww) { + ww = ww * sh / wh; + wh = sh; + } else { + wh = wh * sw / ww; + ww =sw; + } + } + } + simple = XtVaCreateManagedWidget("playback",simpleWidgetClass,app_shell, + XtNwidth,ww, XtNheight,wh, NULL); + if (vfmt) { + blit = blit_init(simple,&vinfo,args.gl); + for (i = 0; i < sizeof(fmtids)/sizeof(int); i++) + if (fmtids[i] == vfmt->fmtid) + break; + if (i == sizeof(fmtids)/sizeof(int)) { + /* blit can't display directly -- have to convert somehow */ + for (i = 0; i < sizeof(fmtids)/sizeof(int); i++) + if (NULL != (conv = ng_conv_find_match(vfmt->fmtid,fmtids[i]))) + break; + if (conv) { + cfmt = *vfmt; + cfmt.fmtid = conv->fmtid_out; + cfmt.bytesperline = 0; + chandle = ng_convert_alloc(conv,vfmt,&cfmt); + ng_convert_init(chandle); + if (debug) + fprintf(stderr,"pia: conv [%s] => [%s]\n", + ng_vfmt_to_desc[vfmt->fmtid], + ng_vfmt_to_desc[cfmt.fmtid]); + } + } + } + if (afmt) { + struct ng_audio_fmt f = *afmt; + snd = ng_dsp_open(args.dsp ? args.dsp : "/dev/dsp", &f,0,&shandle); + if (NULL == snd) + afmt = NULL; + else { + snd_fd = snd->fd(shandle); + latency = snd->latency(shandle); + } + } + XtAddEventHandler(simple,StructureNotifyMask, True, resize_ev, NULL); + XtRealizeWidget(app_shell); + XSync(dpy,False); + + /* enter main loop + * + * can't use XtAppMainLoop + Input + Timeout handlers here because + * that doesn't give us usable event scheduling, thus we have our + * own main loop here ... + */ + start = ng_get_timestamp(); + if (afmt) { + /* fill sound buffer */ + fd_set wr; + int rc; + + for (;;) { + FD_ZERO(&wr); + FD_SET(snd_fd,&wr); + wait.tv_sec = 0; + wait.tv_usec = 0; + rc = select(snd_fd+1,NULL,&wr,NULL,&wait); + if (1 != rc) + break; + abuf = reader->rd_adata(rhandle); + if (NULL == abuf) + break; + drift = abuf->info.ts - (ng_get_timestamp() - start); + abuf = snd->write(shandle,abuf); + if (NULL != abuf) + break; + } + } + + drop = 0; + droptotal = 0; + for (; vfmt || afmt;) { + int rc,max; + fd_set rd,wr; + XEvent event; + + /* handle X11 events */ + if (True == XCheckMaskEvent(dpy, ~0, &event)) { + XtDispatchEvent(&event); + continue; + } + + /* read media data */ + if (afmt && NULL == abuf) { + abuf = reader->rd_adata(rhandle); + if (NULL == abuf) + afmt = NULL; /* EOF */ + else + drift = abuf->info.ts - (ng_get_timestamp() - start); + } + if (vfmt && NULL == vbuf) { + vbuf = reader->rd_vdata(rhandle,drop); + if (conv) + vbuf = ng_convert_frame(chandle,NULL,vbuf); + if (NULL == vbuf) + vfmt = NULL; /* EOF */ + } + + /* wait for events */ + XFlush(dpy); + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_SET(ConnectionNumber(dpy),&rd); + max = ConnectionNumber(dpy); + if (afmt) { + FD_SET(snd_fd,&wr); + if (snd_fd > max) + max = snd_fd; + } + if (vfmt) { + /* check how long we have to wait until the next frame + * should be blitted to the screen */ + now = ng_get_timestamp() - start; + if (afmt && latency) { + /* sync video with audio track */ + now += drift; + now -= latency; + if (args.verbose) + sync_info(drift-latency,droptotal); + } + delay = vbuf->info.ts - now; + if (delay < 0) { + /* FIXME: drop frames if needed */ + drop = -delay / reader->frame_time(rhandle); + if (drop) { + droptotal += drop; + if (args.verbose) + sync_info(drift-latency,droptotal); + } + wait.tv_sec = 0; + wait.tv_usec = 0; + } else { + drop = 0; + wait.tv_sec = delay / 1000000000; + wait.tv_usec = (delay / 1000) % 1000000; + } + } else { + wait.tv_sec = 1; + wait.tv_usec = 0; + } + rc = select(max+1,&rd,&wr,NULL,&wait); + + if (afmt && FD_ISSET(snd_fd,&wr)) { + /* write audio data */ + abuf = snd->write(shandle,abuf); + } + if (vfmt && 0 == rc) { + /* blit video frame */ + blit_putframe(blit,vbuf); + vbuf = NULL; + } + } + return 0; +} diff --git a/x11/v4lctl.c b/x11/v4lctl.c index 6c5cdbc..08a8b50 100644 --- a/x11/v4lctl.c +++ b/x11/v4lctl.c @@ -92,7 +92,8 @@ int main(int argc, char *argv[]) dpy = XOpenDisplay(NULL); if (dpy) { init_atoms(dpy); - xv_init(xvideo,0,0,0); + if (xvideo) + xv_video_init(-1,0); } #endif if (NULL == drv) @@ -36,6 +36,7 @@ #include "x11.h" #include "xv.h" #include "commands.h" +#include "blit.h" #define DISPLAY XtDisplay #define SCREEN XtScreen @@ -43,440 +44,99 @@ #define DEL_TIMER(proc) XtRemoveTimeOut(proc) #define ADD_TIMER(proc) XtAppAddTimeOut(app_context,200,proc,NULL) -/* ------------------------------------------------------------------------ */ - extern XtAppContext app_context; -extern int have_shmem; extern XVisualInfo vinfo; -static int display_bits = 0; -static int display_bytes = 0; -static int pixmap_bytes = 0; -static int x11_error = 0; -static int x11_byteswap = 0; - -static struct SEARCHFORMAT { - int depth; - unsigned long order; - unsigned long red; - unsigned long green; - unsigned long blue; - int format; -} fmt[] = { - { 2, MSBFirst, 0x7c00, 0x03e0, 0x001f, VIDEO_RGB15_BE }, - { 2, MSBFirst, 0xf800, 0x07e0, 0x001f, VIDEO_RGB16_BE }, - { 2, LSBFirst, 0x7c00, 0x03e0, 0x001f, VIDEO_RGB15_LE }, - { 2, LSBFirst, 0xf800, 0x07e0, 0x001f, VIDEO_RGB16_LE }, - - { 3, LSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_BGR24 }, - { 3, LSBFirst, 0x000000ff, 0x0000ff00, 0x00ff0000, VIDEO_RGB24 }, - { 3, MSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_RGB24 }, - { 3, MSBFirst, 0x000000ff, 0x0000ff00, 0x00ff0000, VIDEO_BGR24 }, - - { 4, LSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_BGR32 }, - { 4, LSBFirst, 0x0000ff00, 0x00ff0000, 0xff000000, VIDEO_RGB32 }, - { 4, MSBFirst, 0x00ff0000, 0x0000ff00, 0x000000ff, VIDEO_RGB32 }, - { 4, MSBFirst, 0x0000ff00, 0x00ff0000, 0xff000000, VIDEO_BGR32 }, - - { 2, -1, 0, 0, 0, VIDEO_LUT2 }, - { 4, -1, 0, 0, 0, VIDEO_LUT4 }, - { 0 /* END OF LIST */ }, -}; - -Visual* -x11_visual(Display *dpy) -{ - XVisualInfo *info, template; - Visual* vi = CopyFromParent; - int found,i; - char *class; - - template.screen = XDefaultScreen(dpy); - info = XGetVisualInfo(dpy, VisualScreenMask,&template,&found); - for (i = 0; i < found; i++) { - switch (info[i].class) { - case StaticGray: class = "StaticGray"; break; - case GrayScale: class = "GrayScale"; break; - case StaticColor: class = "StaticColor"; break; - case PseudoColor: class = "PseudoColor"; break; - case TrueColor: class = "TrueColor"; break; - case DirectColor: class = "DirectColor"; break; - default: class = "UNKNOWN"; break; - } - if (debug) - fprintf(stderr,"visual: id=0x%lx class=%d (%s), depth=%d\n", - info[i].visualid,info[i].class,class,info[i].depth); - } - for (i = 0; vi == CopyFromParent && i < found; i++) - if (info[i].class == TrueColor && info[i].depth >= 15) - vi = info[i].visual; - for (i = 0; vi == CopyFromParent && i < found; i++) - if (info[i].class == StaticGray && info[i].depth == 8) - vi = info[i].visual; - return vi; -} - -static int -x11_init(Display *dpy, XVisualInfo *vinfo) -{ - XPixmapFormatValues *pf; - int i,n; - int format = 0; - - if (XShmQueryExtension(dpy)) { - have_shmem = 1; - } - - display_bits = vinfo->depth; - display_bytes = (display_bits+7)/8; - - pf = XListPixmapFormats(dpy,&n); - for (i = 0; i < n; i++) - if (pf[i].depth == display_bits) - pixmap_bytes = pf[i].bits_per_pixel/8; - - if (debug) { - fprintf(stderr,"x11: color depth: " - "%d bits, %d bytes - pixmap: %d bytes\n", - display_bits,display_bytes,pixmap_bytes); - if (vinfo->class == TrueColor || vinfo->class == DirectColor) - fprintf(stderr, "x11: color masks: " - "red=0x%08lx green=0x%08lx blue=0x%08lx\n", - vinfo->red_mask, vinfo->green_mask, vinfo->blue_mask); - fprintf(stderr,"x11: server byte order: %s\n", - ImageByteOrder(dpy)==LSBFirst ? "little endian":"big endian"); - fprintf(stderr,"x11: client byte order: %s\n", - BYTE_ORDER==LITTLE_ENDIAN ? "little endian":"big endian"); - } - if (ImageByteOrder(dpy)==LSBFirst && BYTE_ORDER!=LITTLE_ENDIAN) - x11_byteswap=1; - if (ImageByteOrder(dpy)==MSBFirst && BYTE_ORDER!=BIG_ENDIAN) - x11_byteswap=1; - if (vinfo->class == TrueColor /* || vinfo->class == DirectColor */) { - /* pixmap format */ - for (i = 0; fmt[i].depth > 0; i++) { - if (fmt[i].depth == pixmap_bytes && - (fmt[i].order == ImageByteOrder(dpy) || fmt[i].order == -1) && - (fmt[i].red == vinfo->red_mask || fmt[i].red == 0) && - (fmt[i].green == vinfo->green_mask || fmt[i].green == 0) && - (fmt[i].blue == vinfo->blue_mask || fmt[i].blue == 0)) { - x11_fmt.fmtid = fmt[i].format; - break; - } - } - if (fmt[i].depth == 0) { - fprintf(stderr, "Huh?\n"); - exit(1); - } - ng_lut_init(vinfo->red_mask, vinfo->green_mask, vinfo->blue_mask, - x11_fmt.fmtid,x11_byteswap); - /* guess physical screen format */ - if (ImageByteOrder(dpy) == MSBFirst) { - switch (pixmap_bytes) { - case 2: format = (display_bits==15) ? - VIDEO_RGB15_BE : VIDEO_RGB16_BE; break; - case 3: format = VIDEO_RGB24; break; - case 4: format = VIDEO_RGB32; break; - } - } else { - switch (pixmap_bytes) { - case 2: format = (display_bits==15) ? - VIDEO_RGB15_LE : VIDEO_RGB16_LE; break; - case 3: format = VIDEO_BGR24; break; - case 4: format = VIDEO_BGR32; break; - } - } - } - if (vinfo->class == StaticGray && vinfo->depth == 8) { - format = VIDEO_GRAY; - x11_fmt.fmtid = VIDEO_GRAY; - } - if (0 == format) { - if (vinfo->class == PseudoColor && vinfo->depth == 8) { - fprintf(stderr, -"\n" -"8-bit Pseudocolor Visual (256 colors) is *not* supported.\n" -"You can startup X11 either with 15 bpp (or more)...\n" -" xinit -- -bpp 16\n" -"... or with StaticGray visual:\n" -" xinit -- -cc StaticGray\n" - ); - } else { - fprintf(stderr, "Sorry, I can't handle your strange display\n"); - } - exit(1); - } - return format; -} - -static int -x11_error_dev_null(Display * dpy, XErrorEvent * event) -{ - x11_error++; - if (debug > 1) - fprintf(stderr," x11-error\n"); - return 0; -} - /* ------------------------------------------------------------------------ */ -/* ximage handling for grab & display */ -XImage * -x11_create_ximage(Display *dpy, XVisualInfo *vinfo, - int width, int height, void **shm) +Pixmap +x11_capture_pixmap(Display *dpy, XVisualInfo *vinfo, Colormap colormap, + int width, int height) { - XImage *ximage = NULL; - unsigned char *ximage_data; - XShmSegmentInfo *shminfo = NULL; - void *old_handler; - - if (debug) - fprintf(stderr,"video: x11_create_ximage\n"); - if (have_shmem) { - x11_error = 0; - old_handler = XSetErrorHandler(x11_error_dev_null); - (*shm) = shminfo = malloc(sizeof(XShmSegmentInfo)); - memset(shminfo, 0, sizeof(XShmSegmentInfo)); - ximage = XShmCreateImage(dpy,vinfo->visual,vinfo->depth, - ZPixmap, NULL, - shminfo, width, height); - if (ximage) { - shminfo->shmid = shmget(IPC_PRIVATE, - ximage->bytes_per_line * ximage->height, - IPC_CREAT | 0777); - if (-1 == shminfo->shmid) { - have_shmem = 0; - perror("shmget"); - if (errno == ENOSYS) - fprintf(stderr, "WARNING: Your kernel has no support " - "for SysV IPC\n"); - XDestroyImage(ximage); - ximage = NULL; - goto no_sysvipc; - } - shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - if ((void *) -1 == shminfo->shmaddr) { - perror("shmat"); - goto oom; - } - ximage->data = shminfo->shmaddr; - shminfo->readOnly = False; - - XShmAttach(dpy, shminfo); - XSync(dpy, False); - shmctl(shminfo->shmid, IPC_RMID, 0); - if (x11_error) { - have_shmem = 0; - shmdt(shminfo->shmaddr); - free(shminfo); - shminfo = *shm = NULL; - XDestroyImage(ximage); - ximage = NULL; - } - } else { - have_shmem = 0; - free(shminfo); - shminfo = *shm = NULL; - } - XSetErrorHandler(old_handler); - } - -no_sysvipc: - if (ximage == NULL) { - (*shm) = NULL; - if (NULL == (ximage_data = malloc(width * height * pixmap_bytes))) { - fprintf(stderr,"out of memory\n"); - goto oom; - } - ximage = XCreateImage(dpy, vinfo->visual, vinfo->depth, - ZPixmap, 0, ximage_data, - width, height, - 8, 0); - } - memset(ximage->data, 0, ximage->bytes_per_line * ximage->height); + struct ng_video_buf *buf; + struct ng_video_fmt fmt; + Pixmap pix = 0; - return ximage; + if (!(f_drv & CAN_CAPTURE)) + return 0; -oom: - if (shminfo) { - if (shminfo->shmid && shminfo->shmid != -1) - shmctl(shminfo->shmid, IPC_RMID, 0); - free(shminfo); - } - if (ximage) - XDestroyImage(ximage); - return NULL; + memset(&fmt,0,sizeof(fmt)); + fmt.fmtid = x11_dpy_fmtid; + fmt.width = width ? width : cur_tv_width; + fmt.height = height ? height : cur_tv_height; + if (NULL == (buf = ng_grabber_get_image(&fmt))) + return 0; + buf = ng_filter_single(cur_filter,buf); + pix = x11_create_pixmap(dpy,vinfo,buf); + ng_release_video_buf(buf); + return pix; } void -x11_destroy_ximage(Display *dpy, XImage * ximage, void *shm) -{ - XShmSegmentInfo *shminfo = shm; - - if (shminfo) { - XShmDetach(dpy, shminfo); - XDestroyImage(ximage); - shmdt(shminfo->shmaddr); - free(shminfo); - } else - XDestroyImage(ximage); - - if (debug) - fprintf(stderr,"video: x11_destroy_ximage\n"); -} - -Pixmap -x11_create_pixmap(Display *dpy, XVisualInfo *vinfo, Colormap colormap, - unsigned char *byte_data, - int width, int height, char *label) +x11_label_pixmap(Display *dpy, Colormap colormap, Pixmap pixmap, + int height, char *label) { static XFontStruct *font; static XColor color,dummy; - - Pixmap pixmap; - XImage *ximage; - XGCValues values; - GC gc; - void *shm; - Screen *scr = DefaultScreenOfDisplay(dpy); - + XGCValues values; + GC gc; + if (!font) { font = XLoadQueryFont(dpy,"fixed"); XAllocNamedColor(dpy,colormap,"yellow",&color,&dummy); } - - pixmap = XCreatePixmap(dpy,RootWindowOfScreen(scr), - width, height, vinfo->depth); - values.font = font->fid; values.foreground = color.pixel; gc = XCreateGC(dpy, pixmap, GCFont | GCForeground, &values); - - if (NULL == (ximage = x11_create_ximage(dpy,vinfo,width,height,&shm))) { - XFreePixmap(dpy, pixmap); - XFreeGC(dpy, gc); - return 0; - } - memcpy(ximage->data,byte_data,width*height*pixmap_bytes); - XPUTIMAGE(dpy, pixmap, gc, ximage, 0, 0, 0, 0, width, height); - - if (label) - XDrawString(dpy,pixmap,gc,5,height-5,label,strlen(label)); - - x11_destroy_ximage(dpy, ximage, shm); + XDrawString(dpy,pixmap,gc,5,height-5,label,strlen(label)); XFreeGC(dpy, gc); - return pixmap; +} + +static int +x11_error_dev_null(Display * dpy, XErrorEvent * event) +{ + return 0; } /* ------------------------------------------------------------------------ */ /* video grabdisplay stuff */ -struct format_status { - int status; -#define STATUS_UNKNOWN 0 -#define STATUS_BROKEN 1 -#define STATUS_CONVERT 2 -#define STATUS_XVIDEO 3 - - /* current ximage/xvimage */ - struct ng_video_buf buf; - void *shm; /* MIT SHM */ - - /* convert stuff to RGB */ - struct ng_video_conv *conv; - struct ng_convert_handle *chandle; - XImage *ximage; - - /* image filtering */ - struct ng_filter *filter; - void *fhandle; - - /* Xvideo */ -#ifdef HAVE_LIBXV - int xv_id; - XvImage *xv_image; -#endif -}; - struct video_handle { Widget win; Dimension width,height; - GC gc; XtWorkProcId work_id; int suspend; /* temporarely disabled */ int nw,nh; /* new size (suspend) */ - int using_xv; - struct ng_video_fmt best; - struct format_status formats[VIDEO_FMT_COUNT]; + struct blit_state *blit; + + /* image filtering */ + struct ng_filter *filter; + void *fhandle; + struct ng_video_fmt ffmt; }; struct video_handle vh; -Pixmap -freeze_image(Display *dpy, Colormap colormap) -{ - struct ng_video_buf *buf; - struct ng_video_fmt fmt; - Pixmap pix = 0; - - if (!(f_drv & CAN_CAPTURE)) - return 0; - - fmt = x11_fmt; - if (NULL != (buf = ng_grabber_get_image(&fmt))) { - buf = ng_filter_single(cur_filter,buf); - pix = x11_create_pixmap(dpy,&vinfo,colormap,buf->data, - buf->fmt.width, buf->fmt.height, - NULL); - ng_release_video_buf(buf); - } - return pix; -} - -static void -video_initformat(struct format_status *st, int fmtid) -{ - struct ng_video_conv *conv; - int i; - -#ifdef HAVE_LIBXV - if (0 != im_formats[fmtid]) { - st->status = STATUS_XVIDEO; - return; - } -#endif - if (x11_fmt.fmtid == fmtid) { - st->status = STATUS_CONVERT; - return; - } - for (i = 0;;) { - conv = ng_conv_find(x11_fmt.fmtid, &i); - if (NULL == conv) { - st->status = STATUS_BROKEN; - return; - } - if (conv->fmtid_in != fmtid) - continue; - break; - } - st->status = STATUS_CONVERT; - st->conv = conv; -} - static struct ng_video_buf* -video_gd_filter(struct format_status *st, struct ng_video_buf *buf) +video_gd_filter(struct video_handle *h, struct ng_video_buf *buf) { - if (NULL != st->filter && cur_filter != st->filter) { - st->filter->fini(st->fhandle); - st->filter = NULL; - st->fhandle = NULL; + if (NULL != h->filter && + (cur_filter != h->filter || + buf->fmt.fmtid != h->ffmt.fmtid || + buf->fmt.width != h->ffmt.width || + buf->fmt.height != h->ffmt.height)) { + h->filter->fini(h->fhandle); + h->filter = NULL; + h->fhandle = NULL; + memset(&h->ffmt,0,sizeof(h->ffmt)); } if ((1 << buf->fmt.fmtid) & cur_filter->fmts) { - if (NULL == st->filter) { - st->filter = cur_filter; - st->fhandle = st->filter->init(&buf->fmt); + if (NULL == h->filter) { + h->filter = cur_filter; + h->fhandle = h->filter->init(&buf->fmt); + h->ffmt = buf->fmt; } - buf = cur_filter->frame(st->fhandle,buf); + buf = cur_filter->frame(h->fhandle,buf); } return buf; } @@ -484,106 +144,13 @@ video_gd_filter(struct format_status *st, struct ng_video_buf *buf) int video_gd_blitframe(struct video_handle *h, struct ng_video_buf *buf) { - struct format_status *st; - - if (buf->fmt.width > x11_fmt.width || - buf->fmt.height > x11_fmt.height) + if (buf->fmt.width > cur_tv_width || + buf->fmt.height > cur_tv_height) return -1; - st = h->formats + buf->fmt.fmtid; - - again: - switch (st->status) { - case STATUS_UNKNOWN: - video_initformat(st,buf->fmt.fmtid); - goto again; - case STATUS_CONVERT: - if (debug > 1) - fprintf(stderr,"gd: convert\n"); - if (st->buf.fmt.width != buf->fmt.width || - st->buf.fmt.height != buf->fmt.height) { - if (st->chandle) { - ng_convert_fini(st->chandle); - st->chandle = NULL; - } - if (st->filter) { - st->filter->fini(st->fhandle); - st->filter = NULL; - st->fhandle = NULL; - } - if (st->ximage) { - x11_destroy_ximage(XtDisplay(h->win),st->ximage,st->shm); - st->ximage = NULL; - } - } - if (cur_filter) - buf = video_gd_filter(st,buf); - if (NULL == st->chandle) { - st->buf.fmt.fmtid = x11_fmt.fmtid; - st->buf.fmt.width = buf->fmt.width; - st->buf.fmt.height = buf->fmt.height; - st->buf.fmt.bytesperline = 0; - st->chandle = ng_convert_alloc(st->conv,&buf->fmt,&st->buf.fmt); - ng_convert_init(st->chandle); - } - if (NULL == st->ximage) { - st->ximage = x11_create_ximage(XtDisplay(h->win),&vinfo, - st->buf.fmt.width, - st->buf.fmt.height, - &st->shm); - st->buf.data = st->ximage->data; - } - buf = ng_convert_frame(st->chandle,&st->buf,buf); - XPUTIMAGE(XtDisplay(h->win), XtWindow(h->win), h->gc,st->ximage,0,0, - (x11_fmt.width - st->buf.fmt.width) >> 1, - (x11_fmt.height - st->buf.fmt.height) >> 1, - st->buf.fmt.width, st->buf.fmt.height); - break; - -#ifdef HAVE_LIBXV - case STATUS_XVIDEO: - if (debug > 1) - fprintf(stderr,"gd: xvideo\n"); - if (st->buf.fmt.width != buf->fmt.width || - st->buf.fmt.height != buf->fmt.height) { - if (st->filter) { - st->filter->fini(st->fhandle); - st->filter = NULL; - st->fhandle = NULL; - } - if (st->xv_image) { - xv_destroy_ximage(XtDisplay(h->win),st->xv_image,st->shm); - st->xv_image = NULL; - } - } - if (cur_filter) - buf = video_gd_filter(st,buf); - if (NULL == st->xv_image) { - st->buf.fmt = buf->fmt; - st->xv_image = xv_create_ximage(XtDisplay(h->win), - st->buf.fmt.width, - st->buf.fmt.height, - im_formats[st->buf.fmt.fmtid], - &st->shm); - } - memcpy(st->xv_image->data,buf->data,buf->size); - ng_release_video_buf(buf); - XVPUTIMAGE(XtDisplay(h->win), im_port, XtWindow(h->win), - h->gc, st->xv_image, - 0, 0, st->buf.fmt.width, st->buf.fmt.height, - 0, 0, x11_fmt.width, x11_fmt.height); - h->using_xv = 1; - break; -#endif - - case STATUS_BROKEN: - default: - if (debug > 1) - fprintf(stderr,"gd: oops\n"); - ng_release_video_buf(buf); - return -1; - - } + if (cur_filter) + buf = video_gd_filter(h,buf); + blit_putframe(h->blit,buf); return 0; } @@ -650,10 +217,7 @@ video_gd_stop(void) drv->stopvideo(h_drv); XtRemoveWorkProc(h->work_id); h->work_id = 0; -#ifdef HAVE_LIBXV - if (h->using_xv) - XvStopVideo(XtDisplay(h->win), im_port, XtWindow(h->win)); -#endif + blit_fini_frame(h->blit); } } @@ -677,7 +241,7 @@ video_gd_restart(void) return; h->suspend = 0; if (h->nw && h->nh) { - video_gd_configure(h->nw,h->nh); + video_gd_configure(h->nw,h->nh,0); h->nw = 0; h->nh = 0; } @@ -687,15 +251,18 @@ video_gd_restart(void) } void -video_gd_configure(int width, int height) +video_gd_configure(int width, int height, int gl) { - struct ng_video_conv *conv; struct video_handle *h = &vh; - int i; + int i,fmtids[2*VIDEO_FMT_COUNT]; if (!(f_drv & CAN_CAPTURE)) return; + if (NULL == h->blit) + h->blit = blit_init(h->win,&vinfo, gl); + blit_resize(h->blit,width,height); + if (h->suspend) { if (debug) fprintf(stderr,"gd: delay configure\n"); @@ -711,48 +278,21 @@ video_gd_configure(int width, int height) if (!XtWindow(h->win)) return; - if (!h->gc) - h->gc = XCreateGC(XtDisplay(h->win),XtWindow(h->win),0,NULL); - - x11_fmt.width = width; - x11_fmt.height = height; - x11_fmt.bytesperline = 0; + cur_tv_width = width; + cur_tv_height = height; h->best.width = width; h->best.height = height; h->best.bytesperline = 0; - ng_ratio_fixup(&x11_fmt.width, &x11_fmt.height, NULL, NULL); + ng_ratio_fixup(&cur_tv_width, &cur_tv_height, NULL, NULL); ng_ratio_fixup(&h->best.width, &h->best.height, NULL, NULL); if (0 == h->best.fmtid) { -#ifdef HAVE_LIBXV - /* try yuv if we have hw scaling */ - if (0 != im_formats[VIDEO_YUV422]) { - h->best.fmtid = VIDEO_YUV422; + blit_get_formats(fmtids,sizeof(fmtids)/sizeof(int)); + for (i = 0; i < sizeof(fmtids)/sizeof(int); i++) { + h->best.fmtid = fmtids[i]; if (0 == ng_grabber_setformat(&h->best,0)) goto done; } - if (0 != im_formats[VIDEO_YUV420P]) { - h->best.fmtid = VIDEO_YUV420P; - if (0 == ng_grabber_setformat(&h->best,0)) - goto done; - } -#endif - - /* try native rgb */ - h->best.fmtid = x11_fmt.fmtid; - if (0 == ng_grabber_setformat(&h->best,0)) - goto done; - - /* try to find something we can convert from */ - for (i = 0;;) { - conv = ng_conv_find(x11_fmt.fmtid, &i); - if (NULL == conv) - break; - h->best.fmtid = conv->fmtid_in; - if (0 == ng_grabber_setformat(&h->best,0)) - goto done; - } - /* failed */ h->best.fmtid = 0; } @@ -770,8 +310,8 @@ video_gd_configure(int width, int height) /* ------------------------------------------------------------------------ */ /* video overlay stuff */ -int x11_native_format; -int swidth,sheight; /* screen */ +int swidth,sheight; /* screen */ +static int x11_overlay_fmtid; /* window */ static Widget video,video_parent; @@ -1010,7 +550,7 @@ video_new_size() wy = y; if (wy > 32768) wy -= 65536; wfmt.width = w; if (wfmt.width > 32768) wfmt.width -= 65536; wfmt.height = h; if (wfmt.height > 32768) wfmt.height -= 65536; - wfmt.fmtid = x11_native_format; + wfmt.fmtid = x11_overlay_fmtid; if (debug > 1) fprintf(stderr,"video: shell: size %dx%d+%d+%d\n", wfmt.width,wfmt.height,wx,wy); @@ -1148,17 +688,36 @@ video_overlay(int state) } Widget -video_init(Widget parent, XVisualInfo *vinfo, WidgetClass class) +video_init(Widget parent, XVisualInfo *vinfo, WidgetClass class, int args_bpp) { Window root = DefaultRootWindow(DISPLAY(parent)); swidth = SCREEN(parent)->width; sheight = SCREEN(parent)->height; - x11_native_format = x11_init(XtDisplay(parent),vinfo); + x11_overlay_fmtid = x11_dpy_fmtid; + if (ImageByteOrder(XtDisplay(parent)) == MSBFirst) { + /* X-Server is BE */ + switch(args_bpp) { + case 8: x11_overlay_fmtid = VIDEO_RGB08; break; + case 15: x11_overlay_fmtid = VIDEO_RGB15_BE; break; + case 16: x11_overlay_fmtid = VIDEO_RGB16_BE; break; + case 24: x11_overlay_fmtid = VIDEO_BGR24; break; + case 32: x11_overlay_fmtid = VIDEO_BGR32; break; + } + } else { + /* X-Server is LE */ + switch(args_bpp) { + case 8: x11_overlay_fmtid = VIDEO_RGB08; break; + case 15: x11_overlay_fmtid = VIDEO_RGB15_LE; break; + case 16: x11_overlay_fmtid = VIDEO_RGB16_LE; break; + case 24: x11_overlay_fmtid = VIDEO_BGR24; break; + case 32: x11_overlay_fmtid = VIDEO_BGR32; break; + } + } + video_parent = parent; - video = XtVaCreateManagedWidget("tv",class,parent, - NULL); + video = XtVaCreateManagedWidget("tv",class,parent,NULL); vh.win = video; /* Shell widget -- need map, unmap, configure */ @@ -1,21 +1,9 @@ -#define XPUTIMAGE(dpy,dr,gc,xi,a,b,c,d,w,h) \ - if (have_shmem) \ - XShmPutImage(dpy,dr,gc,xi,a,b,c,d,w,h,True); \ - else \ - XPutImage(dpy,dr,gc,xi,a,b,c,d,w,h) - -extern int x11_native_format; -extern int x11_byteswap; extern int swidth,sheight; -XImage *x11_create_ximage(Display *dpy, XVisualInfo *vinfo, - int width, int height, void **shm); -void x11_destroy_ximage(Display *dpy, XImage * ximage, void *shm); -Pixmap x11_create_pixmap(Display *dpy, XVisualInfo *vinfo, Colormap colormap, - unsigned char *byte_data, - int width, int height, char *label); - -Pixmap freeze_image(Display *dpy, Colormap colormap); +void x11_label_pixmap(Display *dpy, Colormap colormap, Pixmap pixmap, + int height, char *label); +Pixmap x11_capture_pixmap(Display *dpy, XVisualInfo *vinfo, Colormap colormap, + int width, int height); struct video_handle; extern struct video_handle vh; @@ -24,12 +12,11 @@ void video_gd_start(void); void video_gd_stop(void); void video_gd_suspend(void); void video_gd_restart(void); -void video_gd_configure(int width, int height); - +void video_gd_configure(int width, int height, int gl); void video_new_size(void); void video_overlay(int state); -Visual* x11_visual(Display *dpy); -Widget video_init(Widget parent, XVisualInfo *vinfo, WidgetClass class); +Widget video_init(Widget parent, XVisualInfo *vinfo, + WidgetClass class, int bpp); void video_close(void); diff --git a/x11/xawtv.c b/x11/xawtv.c index c55e9f9..177986d 100644 --- a/x11/xawtv.c +++ b/x11/xawtv.c @@ -1,7 +1,7 @@ /* * main.c for xawtv -- a TV application * - * (c) 1997-2001 Gerd Knorr <kraxel@bytesex.org> + * (c) 1997-2002 Gerd Knorr <kraxel@bytesex.org> * */ @@ -75,6 +75,7 @@ #include "complete.h" #include "wmhooks.h" #include "conf.h" +#include "blit.h" #include "vbi-data.h" #include "vbi-x11.h" @@ -486,7 +487,7 @@ resize_event(Widget widget, XtPointer client_data, XEvent *event, Boolean *d) height != event->xconfigure.height) { width = event->xconfigure.width; height = event->xconfigure.height; - video_gd_configure(width, height); + video_gd_configure(width, height, args.gl); XClearWindow(XtDisplay(tv),XtWindow(tv)); sprintf(label,"%-" LABEL_WIDTH "s: %dx%d",MOVIE_SIZE,width,height); if (w_movie_size) @@ -646,7 +647,7 @@ do_capture(int from, int to, int tmp_switch) case CAPTURE_OFF: sprintf(label,"%-" LABEL_WIDTH "s: %s","Capture","off"); if (!tmp_switch) { - tv_pix = freeze_image(dpy, colormap); + tv_pix = x11_capture_pixmap(dpy, &vinfo, colormap, 0, 0); if (tv_pix) XtVaSetValues(tv,XtNbackgroundPixmap,tv_pix,NULL); } @@ -693,26 +694,30 @@ pixit(void) return; video_gd_suspend(); - fmt = x11_fmt; + memset(&fmt,0,sizeof(fmt)); + fmt.fmtid = x11_dpy_fmtid; fmt.width = pix_width; fmt.height = pix_height; - if (NULL != (buf = ng_grabber_get_image(&fmt))) { - buf = ng_filter_single(cur_filter,buf); - if (0 != (pix = x11_create_pixmap(dpy,&vinfo,colormap,buf->data, - fmt.width,fmt.height, - channels[cur_sender]->name))) { - XtVaSetValues(channels[cur_sender]->button, - XtNbackgroundPixmap,pix, - XtNlabel,"", - XtNwidth,pix_width, - XtNheight,pix_height, - NULL); - if (channels[cur_sender]->pixmap) - XFreePixmap(dpy,channels[cur_sender]->pixmap); - channels[cur_sender]->pixmap = pix; - } - ng_release_video_buf(buf); - } + if (NULL == (buf = ng_grabber_get_image(&fmt))) + goto done1; + buf = ng_filter_single(cur_filter,buf); + if (0 == (pix = x11_create_pixmap(dpy,&vinfo,buf))) + goto done2; + x11_label_pixmap(dpy,colormap,pix,buf->fmt.height, + channels[cur_sender]->name); + XtVaSetValues(channels[cur_sender]->button, + XtNbackgroundPixmap,pix, + XtNlabel,"", + XtNwidth,pix_width, + XtNheight,pix_height, + NULL); + if (channels[cur_sender]->pixmap) + XFreePixmap(dpy,channels[cur_sender]->pixmap); + channels[cur_sender]->pixmap = pix; + + done2: + ng_release_video_buf(buf); + done1: video_gd_restart(); } @@ -1007,7 +1012,8 @@ jump_scb(Widget widget, XtPointer clientdata, XtPointer call_data) range = attr->max - attr->min; value = (int)(*(float*)call_data * range) + attr->min; - fprintf(stderr,"value is %d\n",value); + if (debug) + fprintf(stderr,"scroll: value is %d\n",value); if (value < attr->min) value = attr->min; if (value > attr->max) @@ -1346,8 +1352,8 @@ do_movie_record(int argc, char **argv) wr = ng_writers[movie_driver]; video.fmtid = wr->video[movie_video].fmtid; - video.width = x11_fmt.width; - video.height = x11_fmt.height; + video.width = cur_tv_width; + video.height = cur_tv_height; if (NULL != wr->audio[movie_audio].name) { audio.fmtid = wr->audio[movie_audio].fmtid; audio.rate = movie_rate; @@ -1549,8 +1555,7 @@ create_launchwin(void) /*--- main ---------------------------------------------------------------*/ int -main( - int argc, char *argv[]) +main(int argc, char *argv[]) { int i; unsigned long freq; @@ -1575,7 +1580,9 @@ main( /* device scan */ if (args.hwscan) { fprintf(stderr,"looking for available devices\n"); - xv_init(1,1,-1,1); +#ifdef HAVE_LIBXV + xv_video_init(-1,1); +#endif grabber_scan(); } @@ -1598,10 +1605,17 @@ main( if (debug) fprintf(stderr,"main: xinerama extention...\n"); xfree_xinerama_init(); +#ifdef HAVE_LIBXV if (debug) - fprintf(stderr,"main: xvideo extention...\n"); - xv_init(args.xv_video,args.xv_image,args.xv_port,0); - + fprintf(stderr,"main: xvideo extention [video]...\n"); + if (args.xv_video) + xv_video_init(args.xv_port,0); + if (debug) + fprintf(stderr,"main: xvideo extention [image]...\n"); + if (args.xv_image) + xv_image_init(dpy); +#endif + /* set hooks (command.c) */ update_title = new_title; display_message = new_message; @@ -1627,32 +1641,9 @@ main( if (debug) fprintf(stderr,"main: init main window...\n"); - tv = video_init(app_shell,&vinfo,simpleWidgetClass); + tv = video_init(app_shell,&vinfo,simpleWidgetClass,args.bpp); XtAddEventHandler(XtParent(tv),StructureNotifyMask, True, resize_event, NULL); - if (ImageByteOrder(dpy) == MSBFirst) { - /* X-Server is BE */ - switch(args.bpp) { - case 8: x11_native_format = VIDEO_RGB08; break; - case 15: x11_native_format = VIDEO_RGB15_BE; break; - case 16: x11_native_format = VIDEO_RGB16_BE; break; - case 24: x11_native_format = VIDEO_BGR24; break; - case 32: x11_native_format = VIDEO_BGR32; break; - default: - args.bpp = 0; - } - } else { - /* X-Server is LE */ - switch(args.bpp) { - case 8: x11_native_format = VIDEO_RGB08; break; - case 15: x11_native_format = VIDEO_RGB15_LE; break; - case 16: x11_native_format = VIDEO_RGB16_LE; break; - case 24: x11_native_format = VIDEO_BGR24; break; - case 32: x11_native_format = VIDEO_BGR32; break; - default: - args.bpp = 0; - } - } if (debug) fprintf(stderr,"main: install signal handlers...\n"); xt_siginit(); @@ -1792,7 +1783,7 @@ main( sprintf(modename,"%dx%d, ", XtScreen(app_shell)->width,XtScreen(app_shell)->height); - strcat(modename,ng_vfmt_to_desc[x11_native_format]); + strcat(modename,ng_vfmt_to_desc[x11_dpy_fmtid]); new_message(modename); if (!have_config) XtCallActionProc(tv,"Help",NULL,NULL,0); @@ -37,6 +37,7 @@ #include <X11/Shell.h> #include <X11/StringDefs.h> #include <X11/cursorfont.h> +# include <X11/extensions/XShm.h> #ifdef HAVE_LIBXXF86DGA # include <X11/extensions/xf86dga.h> # include <X11/extensions/xf86dgastr.h> @@ -77,6 +78,7 @@ Status DPMSDisable(Display*); #include "lirc.h" #include "joystick.h" #include "vbi-data.h" +#include "blit.h" /* jwz */ #include "remote.h" @@ -226,6 +228,11 @@ XtResource args_desc[] = { XtOffset(struct ARGS*,xv_image), XtRString, "1" },{ + "gl", + XtCBoolean, XtRBoolean, sizeof(int), + XtOffset(struct ARGS*,gl), + XtRString, "1" + },{ "vidmode", XtCBoolean, XtRBoolean, sizeof(int), XtOffset(struct ARGS*,vidmode), @@ -284,6 +291,8 @@ XrmOptionDescRec opt_desc[] = { { "-noxv-video", "xvVideo", XrmoptionNoArg, "0" }, { "-xv-image", "xvImage", XrmoptionNoArg, "1" }, { "-noxv-image", "xvImage", XrmoptionNoArg, "0" }, + { "-gl", "gl", XrmoptionNoArg, "1" }, + { "-nogl", "gl", XrmoptionNoArg, "0" }, { "-vm", "vidmode", XrmoptionNoArg, "1" }, { "-novm", "vidmode", XrmoptionNoArg, "0" }, @@ -296,7 +305,6 @@ XrmOptionDescRec opt_desc[] = { }; const int opt_count = (sizeof(opt_desc)/sizeof(XrmOptionDescRec)); - /*----------------------------------------------------------------------*/ Boolean @@ -632,7 +640,8 @@ exec_x11(char **argv) void exec_player(char *moviefile) { - static char *command = "xanim +f +Sr +Ze -Zr"; + //static char *command = "xanim +f +Sr +Ze -Zr"; + static char *command = "pia"; char *cmd; char **argv; int argc; @@ -749,7 +758,8 @@ xscreensaver_timefunc(XtPointer clientData, XtIntervalId *id) } status = xscreensaver_command(dpy,XA_DEACTIVATE,0,debug,&err); if (0 != status) { - fprintf(stderr,"xscreensaver_command: %s\n",err); + if (debug) + fprintf(stderr,"xscreensaver_command: %s\n",err); return; } xscreensaver_timer = XtAppAddTimeOut(app_context,60000, @@ -1083,7 +1093,7 @@ void tv_expose_event(Widget widget, XtPointer client_data, if (f_drv & NEEDS_CHROMAKEY) { if (debug) fprintf(stderr,"expose: chromakey [%dx%d]\n", - x11_fmt.width, x11_fmt.height); + cur_tv_width, cur_tv_height); if (0 == gc) { XColor color; color.red = (ng_chromakey & 0x00ff0000) >> 8; @@ -1098,7 +1108,7 @@ void tv_expose_event(Widget widget, XtPointer client_data, XFillRectangle(dpy,XtWindow(widget),gc, 0 /* (win_width - x11_fmt.width) >> 1 */, 0 /* (win_height - x11_fmt.height) >> 1 */, - x11_fmt.width, x11_fmt.height); + cur_tv_width, cur_tv_height); } if (have_xv) { if (debug) @@ -1228,8 +1238,8 @@ grabber_init() } else { screen.width = XtScreen(app_shell)->width; screen.height = XtScreen(app_shell)->height; - screen.fmtid = x11_native_format; - screen.bytesperline *= ng_vfmt_to_depth[x11_native_format]/8; + screen.fmtid = x11_dpy_fmtid; + screen.bytesperline *= ng_vfmt_to_depth[x11_dpy_fmtid]/8; if (debug) fprintf(stderr,"x11: %dx%d, %d bit/pixel, %d byte/scanline%s%s\n", screen.width,screen.height, @@ -1368,7 +1378,7 @@ visual_init(char *n1, char *n2) int n; /* look for a useful visual */ - visual = x11_visual(XtDisplay(app_shell)); + visual = x11_find_visual(XtDisplay(app_shell)); vinfo.visualid = XVisualIDFromVisual(visual); vinfo_list = XGetVisualInfo(dpy, VisualIDMask, &vinfo, &n); vinfo = vinfo_list[0]; @@ -1387,6 +1397,7 @@ visual_init(char *n1, char *n2) } else { colormap = DefaultColormapOfScreen(XtScreen(app_shell)); } + x11_init_visual(XtDisplay(app_shell),&vinfo); } void @@ -1423,11 +1434,16 @@ usage(void) " -f -fullscreen startup in fullscreen mode\n" " -(no)dga enable/disable DGA extention\n" " -(no)vm enable/disable VidMode extention\n" +#ifdef HAVE_LIBXV " -(no)xv enable/disable Xvideo extention altogether\n" " -(no)xv-video enable/disable Xvideo extention (for video only,\n" " i.e. XvPutVideo() calls)\n" " -(no)xv-image enable/disable Xvideo extention (for image scaling\n" " only, i.e. XvPutImage() calls)\n" +#endif +#ifdef HAVE_GL + " -(no)gl enable/disable OpenGL\n" +#endif " -b -bpp n color depth of the display is n (n=24,32)\n" " -o -outfile file filename base for snapshots\n" " -c -device file use <file> as video4linux device\n" @@ -24,6 +24,7 @@ struct ARGS { int xv; int xv_video; int xv_image; + int gl; int vidmode; int dga; int help; @@ -6,6 +6,8 @@ #include "config.h" +#ifdef HAVE_LIBXV + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -16,48 +18,28 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> -#ifdef HAVE_LIBXV -# include <X11/Intrinsic.h> -# include <X11/Shell.h> -# include <X11/extensions/XShm.h> -# include <X11/extensions/Xv.h> -# include <X11/extensions/Xvlib.h> -#endif +#include <X11/Intrinsic.h> +#include <X11/Shell.h> +#include <X11/extensions/XShm.h> +#include <X11/extensions/Xv.h> +#include <X11/extensions/Xvlib.h> #include "grab-ng.h" #include "commands.h" /* FIXME: global *drv vars */ #include "atoms.h" #include "xv.h" -#ifndef HAVE_LIBXV -/* dummy stubs */ -int have_xv; -void xv_init(int foo,int bar, int port, int hwscan) -{ - if (debug) - fprintf(stderr,"Xvideo: compiled without Xvideo extention support\n"); -} -//void xv_video(Window win, int width, int height, int on) {} -#else - -/* ********************************************************************* */ -/* the real code */ - extern Display *dpy; int have_xv; -int im_adaptor = -1, im_port = -1; -unsigned int im_formats[VIDEO_FMT_COUNT]; const struct ng_vid_driver xv_driver; static int ver, rel, req, ev, err, grabbed; static int adaptors; static int attributes; -static int formats; static XvAdaptorInfo *ai; static XvEncodingInfo *ei; static XvAttribute *at; -static XvImageFormatValues *fo; static int xv_overlay(void *handle, struct ng_video_fmt *fmt, int x, int y, @@ -326,104 +308,7 @@ static struct ng_attribute* xv_attrs(void *handle) /* ********************************************************************* */ -extern int have_shmem; -static int x11_error = 0; -static int -x11_error_dev_null(Display * dpy, XErrorEvent * event) -{ - x11_error++; - if (debug > 1) - fprintf(stderr," x11-error\n"); - return 0; -} - -XvImage* -xv_create_ximage(Display *dpy, int width, int height, - int format, void **shm) -{ - XvImage *xvimage = NULL; - unsigned char *ximage_data; - XShmSegmentInfo *shminfo; - void *old_handler; - - if (debug) - fprintf(stderr,"Xvideo: xv_create_ximage %dx%d\n",width,height); - - if (have_shmem) { - x11_error = 0; - old_handler = XSetErrorHandler(x11_error_dev_null); - shminfo = malloc(sizeof(XShmSegmentInfo)); - memset(shminfo, 0, sizeof(XShmSegmentInfo)); - xvimage = XvShmCreateImage(dpy, im_port, format, 0, - width, height, shminfo); - if (xvimage) { - shminfo->shmid = shmget(IPC_PRIVATE, xvimage->data_size, - IPC_CREAT | 0777); - if (-1 == shminfo->shmid) { - have_shmem = 0; - XFree(xvimage); - xvimage = NULL; - free(shminfo); - shminfo = *shm = NULL; - goto no_sysvipc; - } - shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - shminfo->readOnly = False; - xvimage->data = shminfo->shmaddr; - XShmAttach(dpy, shminfo); - XSync(dpy, False); - shmctl(shminfo->shmid, IPC_RMID, 0); - if (x11_error) { - have_shmem = 0; - XFree(xvimage); - xvimage = NULL; - shmdt(shminfo->shmaddr); - free(shminfo); - shminfo = *shm = NULL; - goto no_sysvipc; - } - } else { - have_shmem = 0; - free(shminfo); - shminfo = *shm = NULL; - goto no_sysvipc; - } - XSetErrorHandler(old_handler); - *shm = shminfo; - return xvimage; - } - - no_sysvipc: - *shm = NULL; - if (NULL == (ximage_data = malloc(width * height * 2))) { - fprintf(stderr,"out of memory\n"); - return NULL; - } - xvimage = XvCreateImage(dpy, im_port, format, ximage_data, - width, height); - return xvimage; -} - -void -xv_destroy_ximage(Display *dpy, XvImage * xvimage, void *shm) -{ - XShmSegmentInfo *shminfo = shm; - - if (debug) - fprintf(stderr,"Xvideo: x11_destroy_ximage\n"); - - if (shminfo) { - XShmDetach(dpy, shminfo); - XFree(xvimage); - shmdt(shminfo->shmaddr); - free(shminfo); - } else - XFree(xvimage); -} - -/* ********************************************************************* */ - -void xv_init(int xvideo, int hwscale, int port, int hwscan) +void xv_video_init(int port, int hwscan) { struct xv_handle *handle; struct STRTAB *norms = NULL; @@ -431,9 +316,6 @@ void xv_init(int xvideo, int hwscale, int port, int hwscan) char *h; int n, i, vi_port = -1, vi_adaptor = -1; - if (!xvideo && !hwscale) - return; - if (Success != XvQueryExtension(dpy,&ver,&rel,&req,&ev,&err)) { if (debug) fprintf(stderr,"Xvideo: Server has no Xvideo extention support\n"); @@ -491,22 +373,12 @@ void xv_init(int xvideo, int hwscale, int port, int hwscan) ai[i].base_id, ai[i].base_id+ai[i].num_ports-1, port); } } - - if ((ai[i].type & XvInputMask) && - (ai[i].type & XvImageMask) && - (im_port == -1)) { - im_port = ai[i].base_id; - im_adaptor = i; - } } if (hwscan) return; /* *** video port *** */ - if (!xvideo) { - if (debug) - fprintf(stderr,"Xvideo: video disabled\n"); - } else if (vi_port == -1) { + if (vi_port == -1) { if (debug) fprintf(stderr,"Xvideo: no usable video port found\n"); } else { @@ -577,41 +449,6 @@ void xv_init(int xvideo, int hwscale, int port, int hwscan) f_drv = xv_flags(h_drv); add_attrs(xv_attrs(h_drv)); } - - /* *** image scaler port *** */ - if (!hwscale) { - if (debug) - fprintf(stderr,"Xvideo: hw scaler disabled\n"); - } else if (im_port == -1) { - if (debug) - fprintf(stderr,"Xvideo: no usable hw scaler port found\n"); - } else { - fo = XvListImageFormats(dpy, im_port, &formats); - if (debug) - fprintf(stderr," image format list for port %d\n",im_port); - for(i = 0; i < formats; i++) { - if (debug) - fprintf(stderr, " 0x%x (%c%c%c%c) %s", - fo[i].id, - (fo[i].id) & 0xff, - (fo[i].id >> 8) & 0xff, - (fo[i].id >> 16) & 0xff, - (fo[i].id >> 24) & 0xff, - (fo[i].format == XvPacked) ? "packed" : "planar"); - if (0x32595559 == fo[i].id) { - if (debug) - fprintf(stderr," [ok]"); - im_formats[VIDEO_YUV422] = fo[i].id; - } - if (0x30323449 == fo[i].id) { - if (debug) - fprintf(stderr," [ok]"); - im_formats[VIDEO_YUV420P] = fo[i].id; - } - if (debug) - fprintf(stderr,"\n"); - } - } } /* ********************************************************************* */ @@ -706,4 +543,8 @@ const struct ng_vid_driver xv_driver = { is_tuned: xv_tuned, }; -#endif +#else /* HAVE_LIBXV */ + +int have_xv = 0; + +#endif /* HAVE_LIBXV */ @@ -1,19 +1,6 @@ extern int have_xv; -extern int im_adaptor,im_port; -extern unsigned int im_formats[]; -void xv_init(int,int,int port, int hwscan); +void xv_video_init(int port, int hwscan); #ifdef HAVE_LIBXV - void xv_video(Window win, int width, int height, int on); -XvImage* xv_create_ximage(Display *dpy, int width, int height, - int format, void **shm); -void xv_destroy_ximage(Display *dpy, XvImage * xvimage, void *shm); - -#define XVPUTIMAGE(dpy,port,dr,gc,xi,a,b,c,d,x,y,w,h) \ - if (have_shmem) \ - XvShmPutImage(dpy,port,dr,gc,xi,a,b,c,d,x,y,w,h,True); \ - else \ - XvPutImage(dpy,port,dr,gc,xi,a,b,c,d,x,y,w,h) - #endif @@ -2,7 +2,7 @@ Name: xawtv Group: Applications/Multimedia Requires: v4l-conf, tv-common Autoreqprov: on -Version: 3.75 +Version: 3.76 Release: 0 License: GPL Summary: Video4Linux TV application (Athena) |