/* * test_dvr_play.c - Play TS file via dvr device. * * Copyright (C) 2000 Ralph Metzler * & Marcus Metzler * for convergence integrated media GmbH * Copyright (C) 2003 Convergence GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define BUFSIZE (512*188) void play_file_dvr(int filefd, int dvrfd) { char buf[BUFSIZE]; int count, written, bytes, total = 0; while ((count = read(filefd, buf, BUFSIZE)) > 0) { total += count; fprintf(stderr, "read %d (%d total)\n", count, total); written = 0; while (written < count) { bytes = write(dvrfd, buf + written, count - written); fprintf(stderr, "write %d\n", bytes); if (bytes < 0) { perror("write dvr"); return; } else if (bytes == 0) { fprintf(stderr, "write dvr: 0 bytes !"); return; } written += bytes; } } } void set_pid(int fd, int pid, int type) { struct dmx_pes_filter_params pesFilterParams; fprintf(stderr, "set PID 0x%04x (%d)\n", pid, type); if (ioctl(fd, DMX_STOP) < 0) perror("DMX STOP:"); if (ioctl(fd, DMX_SET_BUFFER_SIZE, 64*1024) < 0) perror("DMX SET BUFFER:"); pesFilterParams.pid = pid; pesFilterParams.input = DMX_IN_DVR; pesFilterParams.output = DMX_OUT_DECODER; pesFilterParams.pes_type = type; pesFilterParams.flags = DMX_IMMEDIATE_START; if (ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams) < 0) perror("DMX SET FILTER"); } int main(int argc, char **argv) { char *dmxdev = "/dev/dvb/adapter0/demux0"; char *dvrdev = "/dev/dvb/adapter0/dvr0"; int vpid, apid; int filefd, dvrfd, vfd, afd; if (argc < 4) { fprintf(stderr, "usage: test_dvr_play TS-file video-PID audio-PID\n"); return 1; } vpid = strtoul(argv[2], NULL, 0); apid = strtoul(argv[3], NULL, 0); filefd = open(argv[1], O_RDONLY); if (filefd == -1) { fprintf(stderr, "Failed to open '%s': %d %m\n", argv[1], errno); return 1; } fprintf(stderr, "Playing '%s', video PID 0x%04x, audio PID 0x%04x\n", argv[1], vpid, apid); if (getenv("DEMUX")) dmxdev = getenv("DEMUX"); if (getenv("DVR")) dvrdev = getenv("DVR"); if ((dvrfd = open(dvrdev, O_WRONLY)) == -1) { fprintf(stderr, "Failed to open '%s': %d %m\n", dvrdev, errno); return 1; } if ((vfd = open(dmxdev, O_WRONLY)) == -1) { fprintf(stderr, "Failed to open video '%s': %d %m\n", dmxdev, errno); return 1; } if ((afd = open(dmxdev, O_WRONLY)) == -1) { fprintf(stderr, "Failed to open audio '%s': %d %m\n", dmxdev, errno); return 1; } /* playback timing is controlled via A/V PTS, so we cannot start * writing to the DVR device before the PIDs are set... */ set_pid(afd, apid, DMX_PES_AUDIO); set_pid(vfd, vpid, DMX_PES_VIDEO); play_file_dvr(filefd, dvrfd); close(dvrfd); close(afd); close(vfd); close(filefd); return 0; } ns'>+6 extended contrast range for Crystalfontz git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@460 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-06-02[lcd4linux @ 2004-06-02 05:35:55 by reinelt]reinelt1-0/+20 added i2c_sensors example to lcd4linux.conf.sample git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@459 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-06-02[lcd4linux @ 2004-06-02 05:27:59 by reinelt]reinelt26-0/+2405 added documentation tree git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@458 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-06-02[lcd4linux @ 2004-06-02 05:14:16 by reinelt]reinelt2-17/+31 fixed models listing for Beckmann+Egle driver some cosmetic changes git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@457 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-06-01[lcd4linux @ 2004-06-01 06:45:28 by reinelt]reinelt18-71/+241 some Fixme's processed documented some code git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@456 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-06-01[lcd4linux @ 2004-06-01 06:04:25 by reinelt]reinelt2-25/+25 made README.Plugins and plugin_sample up to date. git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@455 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 21:23:16 by reinelt]reinelt1-37/+49 some cleanups in the MatrixOrbital driver git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@454 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 21:05:13 by reinelt]reinelt5-77/+111 fixed lots of bugs in the Cwlinux driver do not emit EAGAIN error on the first retry made plugin_i2c_sensors a bit less 'chatty' moved init and exit functions to the bottom of plugin_pop3 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@453 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 16:39:05 by reinelt]reinelt11-180/+535 added NULL display driver (for debugging/profiling purposes) added backlight/contrast initialisation for matrixOrbital added Backlight initialisation for Cwlinux git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@452 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 06:27:34 by reinelt]reinelt1-0/+40 ChangeLog update git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@451 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 06:24:42 by reinelt]reinelt2-7/+29 fixed symlink security issue with the image driver git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@450 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 05:38:02 by reinelt]reinelt8-42/+94 fixed possible bugs with user-defined chars (clear high bits) thanks to Andy Baxter for debugging the MilfordInstruments driver! git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@449 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-31[lcd4linux @ 2004-05-31 01:31:01 by andy-b]andy-b1-10/+12 fixed bug in Milford Instruments driver which drew extra graphics chars in odd places when drawing double bars. (the display doesn't like it if you put the escape character 0xfe inside a define char sequence). git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@448 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-30[lcd4linux @ 2004-05-30 08:25:50 by reinelt]reinelt2-30/+92 Crystalfontz 631 driver finished git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@447 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-29[lcd4linux @ 2004-05-29 23:30:20 by reinelt]reinelt1-1/+9 fixed a compiler issue with drv_Image.c (thanks to Frank Stratmann) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@446 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-29[lcd4linux @ 2004-05-29 15:53:28 by reinelt]reinelt3-9/+25 M50530: reset parport signals on exit plugin_ppp: ppp() has two parameters, not three lcd4linux.conf.sample: diskstats() corrected git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@445 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-29[lcd4linux @ 2004-05-29 01:07:56 by reinelt]reinelt2-21/+25 bug in plugin_diskstats fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@444 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-29[lcd4linux @ 2004-05-29 00:27:14 by reinelt]reinelt8-11/+214 added plugin_diskstats.c git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@443 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-05-28[lcd4linux @ 2004-05-28 14:38:10 by reinelt]reinelt2-1/+41 Status and Changelog Update git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@442 3ae390bd-cb1e-0410-b409-cd5a39f66f1f