From 6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d Mon Sep 17 00:00:00 2001 From: etobi Date: Tue, 3 Sep 2013 09:48:38 +0200 Subject: Imported Upstream version 1.1.0 --- Makefile | 28 + README | 21 + TODO | 1 + include/linux/dvb/audio.h | 125 ++ include/linux/dvb/ca.h | 91 ++ include/linux/dvb/dmx.h | 181 +++ include/linux/dvb/frontend.h | 260 ++++ include/linux/dvb/net.h | 41 + include/linux/dvb/osd.h | 111 ++ include/linux/dvb/version.h | 29 + include/linux/dvb/video.h | 199 +++ libdvb2/README | 23 + test/Makefile | 37 + test/README | 51 + test/dia | 7 + test/diseqc.c | 140 ++ test/hex_dump.c | 63 + test/hex_dump.h | 28 + test/sendburst.c | 55 + test/set22k.c | 50 + test/setpid.c | 87 ++ test/setvoltage.c | 47 + test/test.c | 281 ++++ test/test_audio.c | 345 +++++ test/test_av.c | 574 ++++++++ test/test_av_play.c | 310 +++++ test/test_dvr.c | 164 +++ test/test_dvr_play.c | 144 ++ test/test_front.c | 328 +++++ test/test_pes.c | 137 ++ test/test_sec_ne.c | 165 +++ test/test_sections.c | 197 +++ test/test_stc.c | 74 + test/test_stillimage.c | 103 ++ test/test_switch.c | 355 +++++ test/test_tt.c | 205 +++ test/test_vevent.c | 125 ++ test/test_video.c | 368 +++++ test/video.c | 182 +++ util/Makefile | 12 + util/av7110_loadkeys/Makefile | 48 + util/av7110_loadkeys/README | 64 + util/av7110_loadkeys/activy.rcmm | 54 + util/av7110_loadkeys/av7110_loadkeys.c | 186 +++ util/av7110_loadkeys/evtest.c | 177 +++ util/av7110_loadkeys/galaxis.rcmm | 51 + util/av7110_loadkeys/hauppauge.rc5 | 25 + util/av7110_loadkeys/hauppauge_grey.rc5 | 40 + util/av7110_loadkeys/input_fake.h | 84 ++ util/av7110_loadkeys/mbo_81095-code_562.rc5 | 39 + util/av7110_loadkeys/medion_088.rc5 | 36 + util/av7110_loadkeys/medion_155.rc5 | 35 + util/av7110_loadkeys/philips.rc5 | 32 + util/av7110_loadkeys/philips1358.rc5 | 37 + util/dvbdate/Makefile | 25 + util/dvbdate/dvbdate.c | 346 +++++ util/dvbnet/Makefile | 29 + util/dvbnet/dvbnet.c | 205 +++ util/dvbnet/net_start.pl | 25 + util/dvbnet/net_start.sh | 15 + util/dvbnet/version.h.in | 1 + util/dvbtraffic/Makefile | 6 + util/dvbtraffic/dvbtraffic.c | 130 ++ util/lib/Makefile | 20 + util/lib/lnb.c | 101 ++ util/lib/lnb.h | 24 + util/scan/Makefile | 21 + util/scan/README | 18 + util/scan/diseqc.c | 108 ++ util/scan/diseqc.h | 25 + util/scan/dump-vdr.c | 161 +++ util/scan/dump-vdr.h | 38 + util/scan/dump-zap.c | 119 ++ util/scan/dump-zap.h | 20 + util/scan/dvb-c/at-Vienna | 3 + util/scan/dvb-c/ch-unknown | 3 + util/scan/dvb-c/de-Berlin | 4 + util/scan/dvb-c/de-iesy | 3 + util/scan/dvb-c/fi-3ktv | 3 + util/scan/dvb-c/fi-vaasa-oncable | 13 + util/scan/dvb-s/Astra-19.2E | 3 + util/scan/dvb-s/Hispasat-30.0W | 6 + util/scan/dvb-s/Hotbird-13.0E | 3 + util/scan/dvb-s/PAS-43.0W | 6 + util/scan/dvb-s/Sirius-5.0E | 5 + util/scan/dvb-s/Telecom2-8.0W | 4 + util/scan/dvb-s/Telstar12-15.0W | 4 + util/scan/dvb-s/Thor-1.0W | 8 + util/scan/dvb-s/Turksat-42.0E | 4 + util/scan/dvb-t/au-Darwin | 5 + util/scan/dvb-t/au-canberra | 12 + util/scan/dvb-t/au-sydney_north_shore | 12 + util/scan/dvb-t/au-unknown | 3 + util/scan/dvb-t/de-Berlin | 5 + util/scan/dvb-t/es-Collserola | 6 + util/scan/dvb-t/fi-Espoo | 3 + util/scan/dvb-t/fi-Tampere | 6 + util/scan/dvb-t/fi-Turku | 3 + util/scan/dvb-t/nl-AlphenaandenRijn | 7 + util/scan/dvb-t/nl-Randstad | 7 + util/scan/dvb-t/se-Gavle | 6 + util/scan/dvb-t/uk-BlackHill | 3 + util/scan/dvb-t/uk-CrystalPalace | 3 + util/scan/dvb-t/uk-Hannington | 3 + util/scan/dvb-t/uk-Oxford | 3 + util/scan/dvb-t/uk-PontopPike | 3 + util/scan/dvb-t/uk-Redruth | 3 + util/scan/dvb-t/uk-Reigate | 3 + util/scan/dvb-t/uk-Rowridge | 3 + util/scan/dvb-t/uk-SandyHeath | 3 + util/scan/dvb-t/uk-Storeton | 3 + util/scan/dvb-t/uk-WinterHill | 3 + util/scan/list.h | 140 ++ util/scan/scan.c | 1928 +++++++++++++++++++++++++++ util/scan/scan.h | 29 + util/szap/Makefile | 35 + util/szap/README | 47 + util/szap/channels.conf-dvbc-berlin | 171 +++ util/szap/channels.conf-dvbs-astra | 226 ++++ util/szap/channels.conf-dvbt-australia | 31 + util/szap/channels.conf-dvbt-berlin | 51 + util/szap/channels.conf-dvbt-collserola | 25 + util/szap/channels.conf-dvbt-crystal-palace | 70 + util/szap/channels.conf-dvbt-hannington | 28 + util/szap/channels.conf-dvbt-madrid | 16 + util/szap/channels.conf-dvbt-oxford | 41 + util/szap/channels.conf-dvbt-reigate | 51 + util/szap/channels.conf-dvbt-sandy_heath | 13 + util/szap/czap.c | 368 +++++ util/szap/femon.c | 149 +++ util/szap/szap.c | 560 ++++++++ util/szap/tzap.c | 477 +++++++ util/ttusb_dec_reset/Makefile | 17 + util/ttusb_dec_reset/README | 28 + util/ttusb_dec_reset/ttusb_dec_reset.c | 53 + 135 files changed, 12823 insertions(+) create mode 100644 Makefile create mode 100644 README create mode 100644 TODO create mode 100644 include/linux/dvb/audio.h create mode 100644 include/linux/dvb/ca.h create mode 100644 include/linux/dvb/dmx.h create mode 100644 include/linux/dvb/frontend.h create mode 100644 include/linux/dvb/net.h create mode 100644 include/linux/dvb/osd.h create mode 100644 include/linux/dvb/version.h create mode 100644 include/linux/dvb/video.h create mode 100644 libdvb2/README create mode 100644 test/Makefile create mode 100644 test/README create mode 100755 test/dia create mode 100644 test/diseqc.c create mode 100644 test/hex_dump.c create mode 100644 test/hex_dump.h create mode 100644 test/sendburst.c create mode 100644 test/set22k.c create mode 100644 test/setpid.c create mode 100644 test/setvoltage.c create mode 100644 test/test.c create mode 100644 test/test_audio.c create mode 100644 test/test_av.c create mode 100644 test/test_av_play.c create mode 100644 test/test_dvr.c create mode 100644 test/test_dvr_play.c create mode 100644 test/test_front.c create mode 100644 test/test_pes.c create mode 100644 test/test_sec_ne.c create mode 100644 test/test_sections.c create mode 100644 test/test_stc.c create mode 100644 test/test_stillimage.c create mode 100644 test/test_switch.c create mode 100644 test/test_tt.c create mode 100644 test/test_vevent.c create mode 100644 test/test_video.c create mode 100644 test/video.c create mode 100644 util/Makefile create mode 100644 util/av7110_loadkeys/Makefile create mode 100644 util/av7110_loadkeys/README create mode 100644 util/av7110_loadkeys/activy.rcmm create mode 100644 util/av7110_loadkeys/av7110_loadkeys.c create mode 100644 util/av7110_loadkeys/evtest.c create mode 100644 util/av7110_loadkeys/galaxis.rcmm create mode 100644 util/av7110_loadkeys/hauppauge.rc5 create mode 100644 util/av7110_loadkeys/hauppauge_grey.rc5 create mode 100644 util/av7110_loadkeys/input_fake.h create mode 100644 util/av7110_loadkeys/mbo_81095-code_562.rc5 create mode 100644 util/av7110_loadkeys/medion_088.rc5 create mode 100644 util/av7110_loadkeys/medion_155.rc5 create mode 100644 util/av7110_loadkeys/philips.rc5 create mode 100644 util/av7110_loadkeys/philips1358.rc5 create mode 100644 util/dvbdate/Makefile create mode 100644 util/dvbdate/dvbdate.c create mode 100644 util/dvbnet/Makefile create mode 100644 util/dvbnet/dvbnet.c create mode 100755 util/dvbnet/net_start.pl create mode 100755 util/dvbnet/net_start.sh create mode 100644 util/dvbnet/version.h.in create mode 100644 util/dvbtraffic/Makefile create mode 100644 util/dvbtraffic/dvbtraffic.c create mode 100644 util/lib/Makefile create mode 100644 util/lib/lnb.c create mode 100644 util/lib/lnb.h create mode 100644 util/scan/Makefile create mode 100644 util/scan/README create mode 100644 util/scan/diseqc.c create mode 100644 util/scan/diseqc.h create mode 100644 util/scan/dump-vdr.c create mode 100644 util/scan/dump-vdr.h create mode 100644 util/scan/dump-zap.c create mode 100644 util/scan/dump-zap.h create mode 100644 util/scan/dvb-c/at-Vienna create mode 100644 util/scan/dvb-c/ch-unknown create mode 100644 util/scan/dvb-c/de-Berlin create mode 100644 util/scan/dvb-c/de-iesy create mode 100644 util/scan/dvb-c/fi-3ktv create mode 100644 util/scan/dvb-c/fi-vaasa-oncable create mode 100644 util/scan/dvb-s/Astra-19.2E create mode 100644 util/scan/dvb-s/Hispasat-30.0W create mode 100644 util/scan/dvb-s/Hotbird-13.0E create mode 100644 util/scan/dvb-s/PAS-43.0W create mode 100644 util/scan/dvb-s/Sirius-5.0E create mode 100644 util/scan/dvb-s/Telecom2-8.0W create mode 100644 util/scan/dvb-s/Telstar12-15.0W create mode 100644 util/scan/dvb-s/Thor-1.0W create mode 100644 util/scan/dvb-s/Turksat-42.0E create mode 100644 util/scan/dvb-t/au-Darwin create mode 100644 util/scan/dvb-t/au-canberra create mode 100644 util/scan/dvb-t/au-sydney_north_shore create mode 100644 util/scan/dvb-t/au-unknown create mode 100644 util/scan/dvb-t/de-Berlin create mode 100644 util/scan/dvb-t/es-Collserola create mode 100644 util/scan/dvb-t/fi-Espoo create mode 100644 util/scan/dvb-t/fi-Tampere create mode 100644 util/scan/dvb-t/fi-Turku create mode 100644 util/scan/dvb-t/nl-AlphenaandenRijn create mode 100644 util/scan/dvb-t/nl-Randstad create mode 100644 util/scan/dvb-t/se-Gavle create mode 100644 util/scan/dvb-t/uk-BlackHill create mode 100644 util/scan/dvb-t/uk-CrystalPalace create mode 100644 util/scan/dvb-t/uk-Hannington create mode 100644 util/scan/dvb-t/uk-Oxford create mode 100644 util/scan/dvb-t/uk-PontopPike create mode 100644 util/scan/dvb-t/uk-Redruth create mode 100644 util/scan/dvb-t/uk-Reigate create mode 100644 util/scan/dvb-t/uk-Rowridge create mode 100644 util/scan/dvb-t/uk-SandyHeath create mode 100644 util/scan/dvb-t/uk-Storeton create mode 100644 util/scan/dvb-t/uk-WinterHill create mode 100644 util/scan/list.h create mode 100644 util/scan/scan.c create mode 100644 util/scan/scan.h create mode 100644 util/szap/Makefile create mode 100644 util/szap/README create mode 100644 util/szap/channels.conf-dvbc-berlin create mode 100644 util/szap/channels.conf-dvbs-astra create mode 100644 util/szap/channels.conf-dvbt-australia create mode 100644 util/szap/channels.conf-dvbt-berlin create mode 100644 util/szap/channels.conf-dvbt-collserola create mode 100644 util/szap/channels.conf-dvbt-crystal-palace create mode 100644 util/szap/channels.conf-dvbt-hannington create mode 100644 util/szap/channels.conf-dvbt-madrid create mode 100644 util/szap/channels.conf-dvbt-oxford create mode 100644 util/szap/channels.conf-dvbt-reigate create mode 100644 util/szap/channels.conf-dvbt-sandy_heath create mode 100644 util/szap/czap.c create mode 100644 util/szap/femon.c create mode 100644 util/szap/szap.c create mode 100644 util/szap/tzap.c create mode 100644 util/ttusb_dec_reset/Makefile create mode 100644 util/ttusb_dec_reset/README create mode 100644 util/ttusb_dec_reset/ttusb_dec_reset.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e0eadcf --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +# Makefile for linuxtv.org dvb-apps + +VERSION := 1.1.0 +PACKAGE := linuxtv-dvb-apps-$(VERSION) +CVSROOT := $(shell cat CVS/Root) +RELEASE_TAG := LINUXTV-DVB-$(subst .,_,$(subst -,_,$(VERSION))) + +all: + +release dist: + rm -rf release-tmp $(PACKAGE).tar.gz + mkdir release-tmp + ( cd release-tmp; cvs -d$(CVSROOT) export -r$(RELEASE_TAG) -d$(PACKAGE) dvb-apps ) + find release-tmp -name .cvsignore | xargs rm -v + ( cd release-tmp; tar cjf ../$(PACKAGE).tar.bz2 $(PACKAGE) ) + rm -rf release-tmp + @echo + @echo -------------------------------------------------------------------------------- + @echo + @echo "dist package: ./$(PACKAGE).tar.bz2" + @echo + @echo -------------------------------------------------------------------------------- + @echo + +%:: +# $(MAKE) -C libdvb2 $(MAKECMDGOALS) + $(MAKE) -C util $(MAKECMDGOALS) + $(MAKE) -C test $(MAKECMDGOALS) diff --git a/README b/README new file mode 100644 index 0000000..190a4c4 --- /dev/null +++ b/README @@ -0,0 +1,21 @@ +linuxtv-dvb-apps-1.1.0 +====================== + +Linux DVB API test/demo applications and utilities. + +You find a README in each subdirectory explaining what the code there does. +For beginners utils/szap/ and utils/scan/ are probably most useful. + +For convenience, dvb-apps contains a copy of the DVB API include +files as they are contained in the linuxtv-dvb-1.1.0 realease +and the 2.6.x Linux kernel. However, since the DVB API hasn't changed, +the apps will still work with the old "DVB" drivers, should you decide not +to use linuxtv-dvb-1.1.0 (or the dvb-kernel CVS). + + +Historical note: +The apps have been copied from the "DVB" CVS tree, which means that +the stuff in "DVB" is now unmaintained and out of date. + + +Johannes Stezenbach diff --git a/TODO b/TODO new file mode 100644 index 0000000..416b66f --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +- create libdvb2, possibly merging util/lib/* diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h new file mode 100644 index 0000000..58956c3 --- /dev/null +++ b/include/linux/dvb/audio.h @@ -0,0 +1,125 @@ +/* + * audio.h + * + * Copyright (C) 2000 Ralph Metzler + * & Marcus Metzler + for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser 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. + * + */ + +#ifndef _DVBAUDIO_H_ +#define _DVBAUDIO_H_ + +#ifdef __KERNEL__ +#include +#else +#include +#endif + + +typedef enum { + AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ + AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ +} audio_stream_source_t; + + +typedef enum { + AUDIO_STOPPED, /* Device is stopped */ + AUDIO_PLAYING, /* Device is currently playing */ + AUDIO_PAUSED /* Device is paused */ +} audio_play_state_t; + + +typedef enum { + AUDIO_STEREO, + AUDIO_MONO_LEFT, + AUDIO_MONO_RIGHT +} audio_channel_select_t; + + +typedef struct audio_mixer { + unsigned int volume_left; + unsigned int volume_right; + // what else do we need? bass, pass-through, ... +} audio_mixer_t; + + +typedef struct audio_status { + int AV_sync_state; /* sync audio and video? */ + int mute_state; /* audio is muted */ + audio_play_state_t play_state; /* current playback state */ + audio_stream_source_t stream_source; /* current stream source */ + audio_channel_select_t channel_select; /* currently selected channel */ + int bypass_mode; /* pass on audio data to */ + audio_mixer_t mixer_state; /* current mixer state */ +} audio_status_t; /* separate decoder hardware */ + + +typedef +struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */ + int vocal1; /* into left and right t at 70% each */ + int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ + int melody; /* mixed into the left channel and */ + /* Vocal2 into the right channel at 100% each. */ + /* if Melody is non-zero, the melody channel gets mixed*/ +} audio_karaoke_t; /* into left and right */ + + +typedef uint16_t audio_attributes_t; +/* bits: descr. */ +/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ +/* 12 multichannel extension */ +/* 11-10 audio type (0=not spec, 1=language included) */ +/* 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */ +/* 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, */ +/* 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */ +/* 2- 0 number of audio channels (n+1 channels) */ + + +/* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */ +#define AUDIO_CAP_DTS 1 +#define AUDIO_CAP_LPCM 2 +#define AUDIO_CAP_MP1 4 +#define AUDIO_CAP_MP2 8 +#define AUDIO_CAP_MP3 16 +#define AUDIO_CAP_AAC 32 +#define AUDIO_CAP_OGG 64 +#define AUDIO_CAP_SDDS 128 +#define AUDIO_CAP_AC3 256 + +#define AUDIO_STOP _IO('o', 1) +#define AUDIO_PLAY _IO('o', 2) +#define AUDIO_PAUSE _IO('o', 3) +#define AUDIO_CONTINUE _IO('o', 4) +#define AUDIO_SELECT_SOURCE _IO('o', 5) +#define AUDIO_SET_MUTE _IO('o', 6) +#define AUDIO_SET_AV_SYNC _IO('o', 7) +#define AUDIO_SET_BYPASS_MODE _IO('o', 8) +#define AUDIO_CHANNEL_SELECT _IO('o', 9) +#define AUDIO_GET_STATUS _IOR('o', 10, audio_status_t) + +#define AUDIO_GET_CAPABILITIES _IOR('o', 11, unsigned int) +#define AUDIO_CLEAR_BUFFER _IO('o', 12) +#define AUDIO_SET_ID _IO('o', 13) +#define AUDIO_SET_MIXER _IOW('o', 14, audio_mixer_t) +#define AUDIO_SET_STREAMTYPE _IO('o', 15) +#define AUDIO_SET_EXT_ID _IO('o', 16) +#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) +#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) + +#endif /* _DVBAUDIO_H_ */ + diff --git a/include/linux/dvb/ca.h b/include/linux/dvb/ca.h new file mode 100644 index 0000000..026e5c3 --- /dev/null +++ b/include/linux/dvb/ca.h @@ -0,0 +1,91 @@ +/* + * ca.h + * + * Copyright (C) 2000 Ralph Metzler + * & Marcus Metzler + for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser 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. + * + */ + +#ifndef _DVBCA_H_ +#define _DVBCA_H_ + +/* slot interface types and info */ + +typedef struct ca_slot_info { + int num; /* slot number */ + + int type; /* CA interface this slot supports */ +#define CA_CI 1 /* CI high level interface */ +#define CA_CI_LINK 2 /* CI link layer level interface */ +#define CA_CI_PHYS 4 /* CI physical layer level interface */ +#define CA_DESCR 8 /* built-in descrambler */ +#define CA_SC 128 /* simple smart card interface */ + + unsigned int flags; +#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */ +#define CA_CI_MODULE_READY 2 +} ca_slot_info_t; + + +/* descrambler types and info */ + +typedef struct ca_descr_info { + unsigned int num; /* number of available descramblers (keys) */ + unsigned int type; /* type of supported scrambling system */ +#define CA_ECD 1 +#define CA_NDS 2 +#define CA_DSS 4 +} ca_descr_info_t; + +typedef struct ca_caps { + unsigned int slot_num; /* total number of CA card and module slots */ + unsigned int slot_type; /* OR of all supported types */ + unsigned int descr_num; /* total number of descrambler slots (keys) */ + unsigned int descr_type; /* OR of all supported types */ +} ca_caps_t; + +/* a message to/from a CI-CAM */ +typedef struct ca_msg { + unsigned int index; + unsigned int type; + unsigned int length; + unsigned char msg[256]; +} ca_msg_t; + +typedef struct ca_descr { + unsigned int index; + unsigned int parity; /* 0 == even, 1 == odd */ + unsigned char cw[8]; +} ca_descr_t; + +typedef struct ca_pid { + unsigned int pid; + int index; /* -1 == disable*/ +} ca_pid_t; + +#define CA_RESET _IO('o', 128) +#define CA_GET_CAP _IOR('o', 129, ca_caps_t) +#define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t) +#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t) +#define CA_GET_MSG _IOR('o', 132, ca_msg_t) +#define CA_SEND_MSG _IOW('o', 133, ca_msg_t) +#define CA_SET_DESCR _IOW('o', 134, ca_descr_t) +#define CA_SET_PID _IOW('o', 135, ca_pid_t) + +#endif + diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h new file mode 100644 index 0000000..62e6217 --- /dev/null +++ b/include/linux/dvb/dmx.h @@ -0,0 +1,181 @@ +/* + * dmx.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + for convergence integrated media 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. + * + */ + +#ifndef _DVBDMX_H_ +#define _DVBDMX_H_ + +#include +#ifdef __KERNEL__ +#include +#else +#include +#endif + + +#define DMX_FILTER_SIZE 16 + +typedef enum +{ + DMX_OUT_DECODER, /* Streaming directly to decoder. */ + DMX_OUT_TAP, /* Output going to a memory buffer */ + /* (to be retrieved via the read command).*/ + DMX_OUT_TS_TAP /* Output multiplexed into a new TS */ + /* (to be retrieved by reading from the */ + /* logical DVR device). */ +} dmx_output_t; + + +typedef enum +{ + DMX_IN_FRONTEND, /* Input from a front-end device. */ + DMX_IN_DVR /* Input from the logical DVR device. */ +} dmx_input_t; + + +typedef enum +{ + DMX_PES_AUDIO0, + DMX_PES_VIDEO0, + DMX_PES_TELETEXT0, + DMX_PES_SUBTITLE0, + DMX_PES_PCR0, + + DMX_PES_AUDIO1, + DMX_PES_VIDEO1, + DMX_PES_TELETEXT1, + DMX_PES_SUBTITLE1, + DMX_PES_PCR1, + + DMX_PES_AUDIO2, + DMX_PES_VIDEO2, + DMX_PES_TELETEXT2, + DMX_PES_SUBTITLE2, + DMX_PES_PCR2, + + DMX_PES_AUDIO3, + DMX_PES_VIDEO3, + DMX_PES_TELETEXT3, + DMX_PES_SUBTITLE3, + DMX_PES_PCR3, + + DMX_PES_OTHER +} dmx_pes_type_t; + +#define DMX_PES_AUDIO DMX_PES_AUDIO0 +#define DMX_PES_VIDEO DMX_PES_VIDEO0 +#define DMX_PES_TELETEXT DMX_PES_TELETEXT0 +#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 +#define DMX_PES_PCR DMX_PES_PCR0 + + +typedef enum +{ + DMX_SCRAMBLING_EV, + DMX_FRONTEND_EV +} dmx_event_t; + + +typedef enum +{ + DMX_SCRAMBLING_OFF, + DMX_SCRAMBLING_ON +} dmx_scrambling_status_t; + + +typedef struct dmx_filter +{ + __u8 filter[DMX_FILTER_SIZE]; + __u8 mask[DMX_FILTER_SIZE]; + __u8 mode[DMX_FILTER_SIZE]; +} dmx_filter_t; + + +struct dmx_sct_filter_params +{ + __u16 pid; + dmx_filter_t filter; + __u32 timeout; + __u32 flags; +#define DMX_CHECK_CRC 1 +#define DMX_ONESHOT 2 +#define DMX_IMMEDIATE_START 4 +#define DMX_KERNEL_CLIENT 0x8000 +}; + + +struct dmx_pes_filter_params +{ + __u16 pid; + dmx_input_t input; + dmx_output_t output; + dmx_pes_type_t pes_type; + __u32 flags; +}; + + +struct dmx_event +{ + dmx_event_t event; + time_t timeStamp; + union + { + dmx_scrambling_status_t scrambling; + } u; +}; + +typedef struct dmx_caps { + __u32 caps; + int num_decoders; +} dmx_caps_t; + +typedef enum { + DMX_SOURCE_FRONT0 = 0, + DMX_SOURCE_FRONT1, + DMX_SOURCE_FRONT2, + DMX_SOURCE_FRONT3, + DMX_SOURCE_DVR0 = 16, + DMX_SOURCE_DVR1, + DMX_SOURCE_DVR2, + DMX_SOURCE_DVR3 +} dmx_source_t; + +struct dmx_stc { + unsigned int num; /* input : which STC? 0..N */ + unsigned int base; /* output: divisor for stc to get 90 kHz clock */ + __u64 stc; /* output: stc in 'base'*90 kHz units */ +}; + + +#define DMX_START _IO('o', 41) +#define DMX_STOP _IO('o', 42) +#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) +#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) +#define DMX_SET_BUFFER_SIZE _IO('o', 45) +#define DMX_GET_EVENT _IOR('o', 46, struct dmx_event) +#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) +#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) +#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) +#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) + +#endif /*_DVBDMX_H_*/ + diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h new file mode 100644 index 0000000..3fa118e --- /dev/null +++ b/include/linux/dvb/frontend.h @@ -0,0 +1,260 @@ +/* + * frontend.h + * + * Copyright (C) 2000 Marcus Metzler + * Ralph Metzler + * Holger Waechtler + * Andre Draszik + * for convergence integrated media 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. + * + */ + +#ifndef _DVBFRONTEND_H_ +#define _DVBFRONTEND_H_ + +#include + + +typedef enum fe_type { + FE_QPSK, + FE_QAM, + FE_OFDM +} fe_type_t; + + +typedef enum fe_caps { + FE_IS_STUPID = 0, + FE_CAN_INVERSION_AUTO = 0x1, + FE_CAN_FEC_1_2 = 0x2, + FE_CAN_FEC_2_3 = 0x4, + FE_CAN_FEC_3_4 = 0x8, + FE_CAN_FEC_4_5 = 0x10, + FE_CAN_FEC_5_6 = 0x20, + FE_CAN_FEC_6_7 = 0x40, + FE_CAN_FEC_7_8 = 0x80, + FE_CAN_FEC_8_9 = 0x100, + FE_CAN_FEC_AUTO = 0x200, + FE_CAN_QPSK = 0x400, + FE_CAN_QAM_16 = 0x800, + FE_CAN_QAM_32 = 0x1000, + FE_CAN_QAM_64 = 0x2000, + FE_CAN_QAM_128 = 0x4000, + FE_CAN_QAM_256 = 0x8000, + FE_CAN_QAM_AUTO = 0x10000, + FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, + FE_CAN_BANDWIDTH_AUTO = 0x40000, + FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, + FE_CAN_HIERARCHY_AUTO = 0x100000, + FE_CAN_RECOVER = 0x20000000, + FE_CAN_CLEAN_SETUP = 0x40000000, + FE_CAN_MUTE_TS = 0x80000000 +} fe_caps_t; + + +struct dvb_frontend_info { + char name[128]; + fe_type_t type; + __u32 frequency_min; + __u32 frequency_max; + __u32 frequency_stepsize; + __u32 frequency_tolerance; + __u32 symbol_rate_min; + __u32 symbol_rate_max; + __u32 symbol_rate_tolerance; /* ppm */ + __u32 notifier_delay; /* ms */ + fe_caps_t caps; +}; + + +/** + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for + * the meaning of this struct... + */ +struct dvb_diseqc_master_cmd { + __u8 msg [6]; /* { framing, address, command, data [3] } */ + __u8 msg_len; /* valid values are 3...6 */ +}; + + +struct dvb_diseqc_slave_reply { + __u8 msg [4]; /* { framing, data [3] } */ + __u8 msg_len; /* valid values are 0...4, 0 means no msg */ + int timeout; /* return from ioctl after timeout ms with */ +}; /* errorcode when no message was received */ + + +typedef enum fe_sec_voltage { + SEC_VOLTAGE_13, + SEC_VOLTAGE_18, + SEC_VOLTAGE_OFF +} fe_sec_voltage_t; + + +typedef enum fe_sec_tone_mode { + SEC_TONE_ON, + SEC_TONE_OFF +} fe_sec_tone_mode_t; + + +typedef enum fe_sec_mini_cmd { + SEC_MINI_A, + SEC_MINI_B +} fe_sec_mini_cmd_t; + + +typedef enum fe_status { + FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ + FE_HAS_CARRIER = 0x02, /* found a DVB signal */ + FE_HAS_VITERBI = 0x04, /* FEC is stable */ + FE_HAS_SYNC = 0x08, /* found sync bytes */ + FE_HAS_LOCK = 0x10, /* everything's working... */ + FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ + FE_REINIT = 0x40 /* frontend was reinitialized, */ +} fe_status_t; /* application is recommended to reset */ + /* DiSEqC, tone and parameters */ + +typedef enum fe_spectral_inversion { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO +} fe_spectral_inversion_t; + + +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO +} fe_code_rate_t; + + +typedef enum fe_modulation { + QPSK, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_AUTO +} fe_modulation_t; + + +typedef enum fe_transmit_mode { + TRANSMISSION_MODE_2K, + TRANSMISSION_MODE_8K, + TRANSMISSION_MODE_AUTO +} fe_transmit_mode_t; + +typedef enum fe_bandwidth { + BANDWIDTH_8_MHZ, + BANDWIDTH_7_MHZ, + BANDWIDTH_6_MHZ, + BANDWIDTH_AUTO +} fe_bandwidth_t; + + +typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO +} fe_guard_interval_t; + + +typedef enum fe_hierarchy { + HIERARCHY_NONE, + HIERARCHY_1, + HIERARCHY_2, + HIERARCHY_4, + HIERARCHY_AUTO +} fe_hierarchy_t; + + +struct dvb_qpsk_parameters { + __u32 symbol_rate; /* symbol rate in Symbols per second */ + fe_code_rate_t fec_inner; /* forward error correction (see above) */ +}; + + +struct dvb_qam_parameters { + __u32 symbol_rate; /* symbol rate in Symbols per second */ + fe_code_rate_t fec_inner; /* forward error correction (see above) */ + fe_modulation_t modulation; /* modulation type (see above) */ +}; + + +struct dvb_ofdm_parameters { + fe_bandwidth_t bandwidth; + fe_code_rate_t code_rate_HP; /* high priority stream code rate */ + fe_code_rate_t code_rate_LP; /* low priority stream code rate */ + fe_modulation_t constellation; /* modulation type (see above) */ + fe_transmit_mode_t transmission_mode; + fe_guard_interval_t guard_interval; + fe_hierarchy_t hierarchy_information; +}; + + +struct dvb_frontend_parameters { + __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM */ + /* intermediate frequency in kHz for QPSK */ + fe_spectral_inversion_t inversion; + union { + struct dvb_qpsk_parameters qpsk; + struct dvb_qam_parameters qam; + struct dvb_ofdm_parameters ofdm; + } u; +}; + + +struct dvb_frontend_event { + fe_status_t status; + struct dvb_frontend_parameters parameters; +}; + + + +#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) + +#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) +#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) +#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) +#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ + +#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ +#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ +#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ + +#define FE_READ_STATUS _IOR('o', 69, fe_status_t) +#define FE_READ_BER _IOR('o', 70, __u32) +#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) +#define FE_READ_SNR _IOR('o', 72, __u16) +#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) + +#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) +#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) +#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) + + +#endif /*_DVBFRONTEND_H_*/ + diff --git a/include/linux/dvb/net.h b/include/linux/dvb/net.h new file mode 100644 index 0000000..4b8fa51 --- /dev/null +++ b/include/linux/dvb/net.h @@ -0,0 +1,41 @@ +/* + * net.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + for convergence integrated media 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. + * + */ + +#ifndef _DVBNET_H_ +#define _DVBNET_H_ + +#include + + +struct dvb_net_if { + __u16 pid; + __u16 if_num; +}; + + +#define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if) +#define NET_REMOVE_IF _IO('o', 53) +#define NET_GET_IF _IOWR('o', 54, struct dvb_net_if) + +#endif /*_DVBNET_H_*/ + diff --git a/include/linux/dvb/osd.h b/include/linux/dvb/osd.h new file mode 100644 index 0000000..0d81439 --- /dev/null +++ b/include/linux/dvb/osd.h @@ -0,0 +1,111 @@ +/* + * osd.h + * + * Copyright (C) 2001 Ralph Metzler + * & Marcus Metzler + for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser 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. + * + */ + +#ifndef _DVBOSD_H_ +#define _DVBOSD_H_ + +typedef enum { + // All functions return -2 on "not open" + OSD_Close=1, // () + // Disables OSD and releases the buffers + // returns 0 on success + OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) + // Opens OSD with this size and bit depth + // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" + OSD_Show, // () + // enables OSD mode + // returns 0 on success + OSD_Hide, // () + // disables OSD mode + // returns 0 on success + OSD_Clear, // () + // Sets all pixel to color 0 + // returns 0 on success + OSD_Fill, // (color) + // Sets all pixel to color + // returns 0 on success + OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) + // set palette entry to , and apply + // R,G,B: 0..255 + // R=Red, G=Green, B=Blue + // opacity=0: pixel opacity 0% (only video pixel shows) + // opacity=1..254: pixel opacity as specified in header + // opacity=255: pixel opacity 100% (only OSD pixel shows) + // returns 0 on success, -1 on error + OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) + // Set a number of entries in the palette + // sets the entries "firstcolor" through "lastcolor" from the array "data" + // data has 4 byte for each color: + // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel + OSD_SetTrans, // (transparency{color}) + // Sets transparency of mixed pixel (0..15) + // returns 0 on success + OSD_SetPixel, // (x0,y0,color) + // sets pixel , to color number + // returns 0 on success, -1 on error + OSD_GetPixel, // (x0,y0) + // returns color number of pixel ,, or -1 + OSD_SetRow, // (x0,y0,x1,data) + // fills pixels x0,y through x1,y with the content of data[] + // returns 0 on success, -1 on clipping all pixel (no pixel drawn) + OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) + // fills pixels x0,y0 through x1,y1 with the content of data[] + // inc contains the width of one line in the data block, + // inc<=0 uses blockwidth as linewidth + // returns 0 on success, -1 on clipping all pixel + OSD_FillRow, // (x0,y0,x1,color) + // fills pixels x0,y through x1,y with the color + // returns 0 on success, -1 on clipping all pixel + OSD_FillBlock, // (x0,y0,x1,y1,color) + // fills pixels x0,y0 through x1,y1 with the color + // returns 0 on success, -1 on clipping all pixel + OSD_Line, // (x0,y0,x1,y1,color) + // draw a line from x0,y0 to x1,y1 with the color + // returns 0 on success + OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 + // fills parameters with the picture dimensions and the pixel aspect ratio + // returns 0 on success + OSD_Test, // () + // draws a test picture. for debugging purposes only + // returns 0 on success +// TODO: remove "test" in final version + OSD_Text, // (x0,y0,size,color,text) + OSD_SetWindow, // (x0) set window with number 0 + * for convergence integrated media 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. + * + */ + +#ifndef _DVBVERSION_H_ +#define _DVBVERSION_H_ + +#define DVB_API_VERSION 3 + +#endif /*_DVBVERSION_H_*/ + diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h new file mode 100644 index 0000000..a8b6008 --- /dev/null +++ b/include/linux/dvb/video.h @@ -0,0 +1,199 @@ +/* + * video.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + for convergence integrated media 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. + * + */ + +#ifndef _DVBVIDEO_H_ +#define _DVBVIDEO_H_ + +#ifdef __KERNEL__ +#include +#else +#include +#include +#endif + + +typedef enum { + VIDEO_FORMAT_4_3, /* Select 4:3 format */ + VIDEO_FORMAT_16_9, /* Select 16:9 format. */ + VIDEO_FORMAT_221_1 /* 2.21:1 */ +} video_format_t; + + +typedef enum { + VIDEO_SYSTEM_PAL, + VIDEO_SYSTEM_NTSC, + VIDEO_SYSTEM_PALN, + VIDEO_SYSTEM_PALNc, + VIDEO_SYSTEM_PALM, + VIDEO_SYSTEM_NTSC60, + VIDEO_SYSTEM_PAL60, + VIDEO_SYSTEM_PALM60 +} video_system_t; + + +typedef enum { + VIDEO_PAN_SCAN, /* use pan and scan format */ + VIDEO_LETTER_BOX, /* use letterbox format */ + VIDEO_CENTER_CUT_OUT /* use center cut out format */ +} video_displayformat_t; + +typedef struct { + int w; + int h; + video_format_t aspect_ratio; +} video_size_t; + +typedef enum { + VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ + VIDEO_SOURCE_MEMORY /* If this source is selected, the stream + comes from the user through the write + system call */ +} video_stream_source_t; + + +typedef enum { + VIDEO_STOPPED, /* Video is stopped */ + VIDEO_PLAYING, /* Video is currently playing */ + VIDEO_FREEZED /* Video is freezed */ +} video_play_state_t; + + +struct video_event { + int32_t type; +#define VIDEO_EVENT_SIZE_CHANGED 1 + time_t timestamp; + union { + video_size_t size; + } u; +}; + + +struct video_status { + int video_blank; /* blank video on freeze? */ + video_play_state_t play_state; /* current state of playback */ + video_stream_source_t stream_source; /* current source (demux/memory) */ + video_format_t video_format; /* current aspect ratio of stream*/ + video_displayformat_t display_format;/* selected cropping mode */ +}; + + +struct video_still_picture { + char *iFrame; /* pointer to a single iframe in memory */ + int32_t size; +}; + + +typedef +struct video_highlight { + int active; /* 1=show highlight, 0=hide highlight */ + uint8_t contrast1; /* 7- 4 Pattern pixel contrast */ + /* 3- 0 Background pixel contrast */ + uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */ + /* 3- 0 Emphasis pixel-1 contrast */ + uint8_t color1; /* 7- 4 Pattern pixel color */ + /* 3- 0 Background pixel color */ + uint8_t color2; /* 7- 4 Emphasis pixel-2 color */ + /* 3- 0 Emphasis pixel-1 color */ + uint32_t ypos; /* 23-22 auto action mode */ + /* 21-12 start y */ + /* 9- 0 end y */ + uint32_t xpos; /* 23-22 button color number */ + /* 21-12 start x */ + /* 9- 0 end x */ +} video_highlight_t; + + +typedef struct video_spu { + int active; + int stream_id; +} video_spu_t; + + +typedef struct video_spu_palette { /* SPU Palette information */ + int length; + uint8_t *palette; +} video_spu_palette_t; + + +typedef struct video_navi_pack { + int length; /* 0 ... 1024 */ + uint8_t data[1024]; +} video_navi_pack_t; + + +typedef uint16_t video_attributes_t; +/* bits: descr. */ +/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ +/* 13-12 TV system (0=525/60, 1=625/50) */ +/* 11-10 Aspect ratio (0=4:3, 3=16:9) */ +/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ +/* 7 line 21-1 data present in GOP (1=yes, 0=no) */ +/* 6 line 21-2 data present in GOP (1=yes, 0=no) */ +/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ +/* 2 source letterboxed (1=yes, 0=no) */ +/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ + + +/* bit definitions for capabilities: */ +/* can the hardware decode MPEG1 and/or MPEG2? */ +#define VIDEO_CAP_MPEG1 1 +#define VIDEO_CAP_MPEG2 2 +/* can you send a system and/or program stream to video device? + (you still have to open the video and the audio device but only + send the stream to the video device) */ +#define VIDEO_CAP_SYS 4 +#define VIDEO_CAP_PROG 8 +/* can the driver also handle SPU, NAVI and CSS encoded data? + (CSS API is not present yet) */ +#define VIDEO_CAP_SPU 16 +#define VIDEO_CAP_NAVI 32 +#define VIDEO_CAP_CSS 64 + + +#define VIDEO_STOP _IO('o', 21) +#define VIDEO_PLAY _IO('o', 22) +#define VIDEO_FREEZE _IO('o', 23) +#define VIDEO_CONTINUE _IO('o', 24) +#define VIDEO_SELECT_SOURCE _IO('o', 25) +#define VIDEO_SET_BLANK _IO('o', 26) +#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) +#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) +#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) +#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) +#define VIDEO_FAST_FORWARD _IO('o', 31) +#define VIDEO_SLOWMOTION _IO('o', 32) +#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) +#define VIDEO_CLEAR_BUFFER _IO('o', 34) +#define VIDEO_SET_ID _IO('o', 35) +#define VIDEO_SET_STREAMTYPE _IO('o', 36) +#define VIDEO_SET_FORMAT _IO('o', 37) +#define VIDEO_SET_SYSTEM _IO('o', 38) +#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t) +#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t) +#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t) +#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t) +#define VIDEO_SET_ATTRIBUTES _IO('o', 53) +#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) + +#endif /*_DVBVIDEO_H_*/ + diff --git a/libdvb2/README b/libdvb2/README new file mode 100644 index 0000000..049acd6 --- /dev/null +++ b/libdvb2/README @@ -0,0 +1,23 @@ +Late in 2003 the idea to create a simple DVB library from the code snippets +in the test/utility programs was discussed on the linux-dvb mailing list. +Hopefully someone will invest some time in this project to turn the idea into +reality... + +Here is an outline of what libdvb2 should be, according to my recollection: +(For first hand information search the linux-dvb list archives for "libdvb2".) + +- C +- small: The goal is to make the library usable in *any* DVB project, which + is easier if the library sticks to the basics. Advanced stuff can be + done in a second library. What exacty "basic" and "advanced" means + is subject of discussion, but I want avoid to impose a certain programming + model (e.g. multi-threaded vw. event-loop) on users of the library. +- a prime target is to establish a standard DVB config and service list + format, to make this sharable between different applications +- LGPL + +About the name: There already is a libdvb written by the Metzler Bros., +but the main drawback is that it is written in C++ and thus rejected +by many projects. + +Johannes Stezenbach diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..ddff9ab --- /dev/null +++ b/test/Makefile @@ -0,0 +1,37 @@ +# Makefile for Linux DVB API Version 3 test programs + +CC = gcc +CFLAGS = -g -O2 -W -Wall -I../include + +TARGETS = \ + diseqc \ + set22k \ + sendburst \ + setvoltage \ + setpid \ + video \ + test_sections \ + test_sec_ne \ + test_pes \ + test_dvr \ + test_dvr_play \ + test_tt \ + test_av \ + test_av_play \ + test_vevent \ + test_stc \ + test_stillimage + +# test \ +# test_audio \ +# test_front \ +# test_switch \ +# test_video \ + +all: $(TARGETS) + +test_sections test_sec_ne test_pes test_tt: hex_dump.o + +clean: + rm -f $(TARGETS) *.o + diff --git a/test/README b/test/README new file mode 100644 index 0000000..b3f0cac --- /dev/null +++ b/test/README @@ -0,0 +1,51 @@ +Various small test/sample programs for the Linux DVB API Version 2 + +The default devices used by the test programs are generally +/dev/dvb/adapter0/*0, and can be overridden using environment +variables: + + FRONTEND=/dev/dvb/adapter0/frontend0 + DEMUX=/dev/dvb/adapter0/demux0 + DVR=/dev/dvb/adapter0/dvr0 + AUDIO=/dev/dvb/adapter0/audio0 + VIDEO=/dev/dvb/adapter0/video0 + NET=/dev/dvb/adapter0/net0 + + +diseqc : Send various diseqc sequences on a SAT frontend. + Best used with a diseqc test box with some LEDs to + show the result of the commands. +set22k : Legacy tone switching for SAT frontends. +setvoltage : Legacy voltage switching for SAT frontends. + +setpid : Set video and audio PIDs in the demux; useful only + if you have a hardware MPEG decoder. +video : A tiny video watching application, just starts capturing /dev/video + into /dev/fb0. + WARNING: May crash your box or mess up your console! + +test_sections : Hex dump of section data from stream. +test_sec_ne : Like test_sections, but also test Not-Equal filter mode. +test_pes : Hex dump of PES data from stream. +test_tt : Demonstrate teletext decoding from PES data. +test_av : Test audio and video MPEG decoder API. +test_vevent : Test VIDEO_GET_EVENT and poll() for video events +test_stc : Test DMX_GET_STC. + +test_stillimage : Display single iframes as stillimages + iframes can be created with the 'convert' tool from + imagemagick and mpeg2encode from ftp.mpeg.org, and must + have a supported size, e.g. 702x576 + ($ convert -sample 702x576\! test.jpg test.mpg) + +(test_av_play : Test playing MPEG TS from a file (apparently broken)) + + +test : +test_audio : +test_dmx : +test_dvr : +test_front : +test_switch : +test_video : + diff --git a/test/dia b/test/dia new file mode 100755 index 0000000..5cb2600 --- /dev/null +++ b/test/dia @@ -0,0 +1,7 @@ +#!/bin/sh + +for f in $@ +do /usr/X11R6/bin/convert -geomtry 702x576 $f test.mpg +test_video test.mpg +rm test.mpg +done \ No newline at end of file diff --git a/test/diseqc.c b/test/diseqc.c new file mode 100644 index 0000000..8f2e411 --- /dev/null +++ b/test/diseqc.c @@ -0,0 +1,140 @@ +/* + * Test sending DiSEqC commands on a SAT frontend. + * + * usage: FRONTEND=/dev/dvb/adapterX/frontendX diseqc [test_seq_no] + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +struct diseqc_cmd { + struct dvb_diseqc_master_cmd cmd; + uint32_t wait; +}; + + +struct diseqc_cmd switch_cmds[] = { + { { { 0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf2, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf1, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf3, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf4, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf6, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf5, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf7, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf8, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xfa, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xf9, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xfb, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xfc, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xfe, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xfd, 0x00, 0x00 }, 4 }, 0 }, + { { { 0xe0, 0x10, 0x38, 0xff, 0x00, 0x00 }, 4 }, 0 } +}; + + +/*--------------------------------------------------------------------------*/ + +static inline +void msleep(uint32_t msec) +{ + struct timespec req = { msec / 1000, 1000000 * (msec % 1000) }; + + while (nanosleep(&req, &req)) + ; +} + + +static +void diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd, + fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) +{ + ioctl(fd, FE_SET_TONE, SEC_TONE_OFF); + ioctl(fd, FE_SET_VOLTAGE, v); + + msleep(15); + while (*cmd) { + printf("msg: %02x %02x %02x %02x %02x %02x\n", + (*cmd)->cmd.msg[0], (*cmd)->cmd.msg[1], + (*cmd)->cmd.msg[2], (*cmd)->cmd.msg[3], + (*cmd)->cmd.msg[4], (*cmd)->cmd.msg[5]); + + ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &(*cmd)->cmd); + msleep((*cmd)->wait); + cmd++; + } + + printf("%s: ", __FUNCTION__); + + printf(" %s ", v == SEC_VOLTAGE_13 ? "SEC_VOLTAGE_13" : + v == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "???"); + + printf(" %s ", b == SEC_MINI_A ? "SEC_MINI_A" : + b == SEC_MINI_B ? "SEC_MINI_B" : "???"); + + printf(" %s\n", t == SEC_TONE_ON ? "SEC_TONE_ON" : + t == SEC_TONE_OFF ? "SEC_TONE_OFF" : "???"); + + msleep(15); + ioctl(fd, FE_DISEQC_SEND_BURST, b); + + msleep(15); + ioctl(fd, FE_SET_TONE, t); +} + + +int main(int argc, char **argv) +{ + struct diseqc_cmd *cmd[2] = { NULL, NULL }; + char *fedev = "/dev/dvb/adapter0/frontend0"; + int fd; + + if (getenv("FRONTEND")) + fedev = getenv("FRONTEND"); + + printf("diseqc test: using '%s'\n", fedev); + + if ((fd = open(fedev, O_RDWR)) < 0) { + perror("open"); + return -1; + } + + if (argc > 1) { + int i = atol(argv[1]); + cmd[0] = &switch_cmds[i]; + diseqc_send_msg(fd, + i % 2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, + cmd, + (i/2) % 2 ? SEC_TONE_ON : SEC_TONE_OFF, + (i/4) % 2 ? SEC_MINI_B : SEC_MINI_A); + } else { + unsigned int j; + + for (j=0; j + * + * 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 "hex_dump.h" + + +void hex_dump(uint8_t data[], int bytes) +{ + int i, j; + uint8_t c; + + for (i = 0; i < bytes; i++) { + if (!(i % 8) && i) + printf(" "); + if (!(i % 16) && i) { + printf(" "); + for (j = 0; j < 16; j++) { + c = data[i+j-16]; + if ((c < 0x20) || (c >= 0x7f)) + c = '.'; + printf("%c", c); + } + printf("\n"); + } + printf("%.2x ", data[i]); + } + j = (bytes % 16); + j = (j != 0 ? j : 16); + for (i = j; i < 16; i++) { + if (!(i % 8) && i) + printf(" "); + printf(" "); + } + printf(" "); + for (i = bytes - j; i < bytes; i++) { + c = data[i]; + if ((c < 0x20) || (c >= 0x7f)) + c = '.'; + printf("%c", c); + } + printf("\n"); +} + diff --git a/test/hex_dump.h b/test/hex_dump.h new file mode 100644 index 0000000..030cc37 --- /dev/null +++ b/test/hex_dump.h @@ -0,0 +1,28 @@ +#ifndef _HEXDUMP_H_ +#define _HEXDUMP_H_ +/* hex_dump.h -- simple hex dump routine + * + * Copyright (C) 2002 convergence GmbH + * Johannes Stezenbach + * + * 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 + +extern void hex_dump(uint8_t data[], int bytes); + + +#endif /* _HEXDUMP_H_ */ diff --git a/test/sendburst.c b/test/sendburst.c new file mode 100644 index 0000000..a96b68c --- /dev/null +++ b/test/sendburst.c @@ -0,0 +1,55 @@ +/* + * Test sending the burst mini command A/B on a SAT frontend. + * + * usage: FRONTEND=/dev/dvb/adapterX/frontendX sendburst {a|b} + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +int main (int argc, char **argv) +{ + char *fedev = "/dev/dvb/adapter0/frontend0"; + int fd, r; + + if (argc != 2 || (strcmp(argv[1], "a") && strcmp(argv[1], "b"))) { + fprintf (stderr, "usage: %s \n", argv[0]); + return 1; + } + + if (getenv("FRONTEND")) + fedev = getenv("FRONTEND"); + + printf("set22k: using '%s'\n", fedev); + + if ((fd = open (fedev, O_RDWR)) < 0) { + perror ("open"); + return 1; + } + + ioctl (fd, FE_SET_TONE, SEC_TONE_OFF); + + usleep (30000); /* 30ms according to DiSEqC spec */ + + if (strcmp(argv[1], "a") == 0) + r = ioctl (fd, FE_DISEQC_SEND_BURST, SEC_MINI_A); + else + r = ioctl (fd, FE_DISEQC_SEND_BURST, SEC_MINI_B); + + if (r == -1) + perror("ioctl FE_SET_TONE"); + + close (fd); + + return 0; +} + diff --git a/test/set22k.c b/test/set22k.c new file mode 100644 index 0000000..51ffa1c --- /dev/null +++ b/test/set22k.c @@ -0,0 +1,50 @@ +/* + * Test switching the 22kHz tone signal on and off on a SAT frontend. + * (Note: DiSEqC equipment ignores this after it has once seen a diseqc + * sequence; reload the driver or unplug/replug the SAT cable to reset.) + * + * usage: FRONTEND=/dev/dvb/adapterX/frontendX set22k {on|off} + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +int main (int argc, char **argv) +{ + char *fedev = "/dev/dvb/adapter0/frontend0"; + int fd, r; + + if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) { + fprintf (stderr, "usage: %s \n", argv[0]); + return 1; + } + if (getenv("FRONTEND")) + fedev = getenv("FRONTEND"); + printf("set22k: using '%s'\n", fedev); + + if ((fd = open (fedev, O_RDWR)) < 0) { + perror ("open"); + return 1; + } + + if (strcmp(argv[1], "on") == 0) + r = ioctl (fd, FE_SET_TONE, SEC_TONE_ON); + else + r = ioctl (fd, FE_SET_TONE, SEC_TONE_OFF); + if (r == -1) + perror("ioctl FE_SET_TONE"); + + close (fd); + + return 0; +} + diff --git a/test/setpid.c b/test/setpid.c new file mode 100644 index 0000000..fa0333c --- /dev/null +++ b/test/setpid.c @@ -0,0 +1,87 @@ +/* + * Set video and audio PIDs in the demux; useful only if you have + * a hardware MPEG decoder and you're tuned to a transport stream. + * + * usage: DEMUX=/dev/dvb/adapterX/demuxX setpid video_pid audio_pid + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +static +int setup_demux (char *dmxdev, int video_pid, int audio_pid) +{ + int vfd, afd; + struct dmx_pes_filter_params pesfilter; + + printf ("video_pid == 0x%04x\n", video_pid); + printf ("audio_pid == 0x%04x\n", audio_pid); + + if ((vfd = open (dmxdev, O_RDWR)) < 0) { + perror("open 1"); + return -1; + } + + pesfilter.pid = video_pid; + pesfilter.input = DMX_IN_FRONTEND; + pesfilter.output = DMX_OUT_DECODER; + pesfilter.pes_type = DMX_PES_VIDEO; + pesfilter.flags = DMX_IMMEDIATE_START; + + if (ioctl (vfd, DMX_SET_PES_FILTER, &pesfilter) < 0) { + perror("ioctl DMX_SET_PES_FILTER (video)"); + return -1; + } + + close (vfd); + + if ((afd = open (dmxdev, O_RDWR)) < 0) { + perror("open 1"); + return -1; + } + + pesfilter.pid = audio_pid; + pesfilter.input = DMX_IN_FRONTEND; + pesfilter.output = DMX_OUT_DECODER; + pesfilter.pes_type = DMX_PES_AUDIO; + pesfilter.flags = DMX_IMMEDIATE_START; + + if (ioctl (afd, DMX_SET_PES_FILTER, &pesfilter) < 0) { + perror("ioctl DMX_SET_PES_FILTER (audio)"); + return -1; + } + + close (afd); + return 0; +} + + +int main (int argc, char **argv) +{ + char *dmxdev = "/dev/dvb/adapter0/demux0"; + int video_pid, audio_pid; + + if (argc != 3) { + printf ("\nusage: %s