/* $Id$ * $URL$ * * new style Image (PPM/PNG) Driver for LCD4Linux * * Copyright (C) 2003 Michael Reinelt * Copyright (C) 2004 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux 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, or (at your option) * any later version. * * LCD4Linux 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. * */ /* * * exported fuctions: * * struct DRIVER drv_Image * */ #include "config.h" #include #include #include #include #include #include #include #include #ifdef WITH_PNG #ifdef HAVE_GD_GD_H #include #else #ifdef HAVE_GD_H #include #else #error "gd.h not found!" #error "cannot compile PNG driver" #endif #endif #if GD2_VERS != 2 #error "lcd4linux requires libgd version 2" #error "cannot compile PNG driver" #endif #endif #include "debug.h" #include "cfg.h" #include "timer.h" #include "qprintf.h" #include "plugin.h" #include "drv.h" #include "drv_generic_graphic.h" #ifdef WITH_DMALLOC #include #endif static char Name[] = "Image"; static enum { NIL, PPM, PNG } Format; static int pixel = -1; /* pointsize in pixel */ static int pgap = 0; /* gap between points */ static int rgap = 0; /* row gap between lines */ static int cgap = 0; /* column gap between characters */ static int border = 0; /* window border */ static int dimx, dimy; /* total window dimension in pixel */ static RGBA BC; static RGBA *drv_IMG_FB = NULL; static int dirty = 1; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ #ifdef WITH_PPM static int drv_IMG_flush_PPM(void) { static int seq = 0; static RGBA *bitbuf = NULL; static unsigned char *rowbuf = NULL; int xsize, ysize, row, col, i; char path[256], tmp[256], buffer[256]; int fd; xsize = 2 * border + (DCOLS / XRES - 1) * cgap + DCOLS * pixel + (DCOLS - 1) * pgap; ysize = 2 * border + (DROWS / YRES - 1) * rgap + DROWS * pixel + (DROWS - 1) * pgap; if (bitbuf == NULL) { if ((bitbuf = malloc(xsize * ysize * sizeof(*bitbuf))) == NULL) { error("%s: malloc() failed: %s", Name, strerror(errno)); return -1; } } if (rowbuf == NULL) { if ((rowbuf = malloc(3 * xsize * sizeof(*rowbuf))) == NULL) { error("Raster: malloc() failed: %s", strerror(errno)); return -1; } } for (i = 0; i < xsize * ysize; i++) { bitbuf[i] = BC; } for (row = 0; row < DROWS; row++) { int y = border + (row / YRES) * rgap + row * (pixel + pgap); for (col = 0; col < DCOLS; col++) { int x = border + (col / XRES) * cgap + col * (pixel + pgap); int a, b; for (a = 0; a < pixel; a++) for (b = 0; b < pixel; b++) bitbuf[y * xsize + x + a * xsize + b] = drv_IMG_FB[row * DCOLS + col]; } } snprintf(path, sizeof(path), output, seq++); qprintf(tmp, sizeof(tmp), "%s.tmp", path); /* remove the file */ unlink(tmp); /* avoid symlink security hole: */ /* open it with O_EXCL will fail if the file exists. */ /* This should not happen because we just unlinked it. */ if ((fd = open(tmp, O_WRONLY | O_CREAT | O_EXCL, 0644)) < 0) { error("%s: open(%s) failed: %s", Name, tmp, strerror(errno)); return -1; } qprintf(buffer, sizeof(buffer), "P6\n%d %d\n255\n", xs
#----------------------------------------------------------------------------------------------
# Auto-generated from:
# <http://stakeholders.ofcom.org.uk/broadcasting/guidance/tech-guidance/transmitter-frequency/>
#----------------------------------------------------------------------------------------------
# location and provider: UK, Preseli
# date (yyyy-mm-dd)    : 2013-09-18
#
# T[2] <freq> <bw> <fec_hi> <fec_lo> <mod> <tm> <guard> <hi> [<plp_id>] [# comment]
#----------------------------------------------------------------------------------------------
T  650167000 8MHz 2/3 NONE QAM64  8k  1/32  NONE   # PSB1
T  674167000 8MHz 2/3 NONE QAM64  8k  1/32  NONE   # PSB2
T2 626167000 8MHz 2/3 NONE QAM256 32k 1/128 NONE 0 # PSB3
T  641833000 8MHz 3/4 NONE QAM64  8k  1/32  NONE   # COM4
T  665833000 8MHz 3/4 NONE QAM64  8k  1/32  NONE   # COM5
T  618167000 8MHz 3/4 NONE QAM64  8k  1/32  NONE   # COM6
/* start display */ if ((ret = drv_IMG_start(section)) != 0) return ret; /* initialize generic graphic driver */ if ((ret = drv_generic_graphic_init(section, Name)) != 0) return ret; /* register plugins */ /* none at the moment... */ return 0; } /* close driver & display */ int drv_IMG_quit(const __attribute__ ((unused)) int quiet) { info("%s: shutting down.", Name); drv_generic_graphic_quit(); if (drv_IMG_FB) { free(drv_IMG_FB); drv_IMG_FB = NULL; } return (0); } DRIVER drv_Image = { .name = Name, .list = drv_IMG_list, .init = drv_IMG_init, .quit = drv_IMG_quit, };