diff --git a/.gitignore b/.gitignore index 82a60602d..7a616e898 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ INSTALL *.lo *.a *.la +.*.swp ### binaries that fall out of the build lib/sectionsdclient/sectionsdcontrol @@ -31,3 +32,5 @@ src/neutrino src/nhttpd/web/*.js.gz src/zapit/src/pzapit src/zapit/src/udpstreampes +src/drivertool +src/gui/svn_version.h diff --git a/configure.ac b/configure.ac index 65470d086..4ceecf734 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT(tuxbox-neutrino,1.0.1) -AM_INIT_AUTOMAKE(tuxbox-neutrino,1.0.1) +AM_INIT_AUTOMAKE([1.0.1 nostdinc]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) TUXBOX_APPS @@ -126,6 +126,9 @@ if test "$STB_HAL_INC"; then AC_DEFINE(USE_STB_HAL, 1,[use libstb-hal]) fi +AC_ARG_ENABLE(cleanup, + [ --enable-cleanup enable cleanup on exit], + [AC_DEFINE(EXIT_CLEANUP,1,[enable cleanup on exit])]) AC_CHECK_HEADERS(coolstream/nevis_ir.h) @@ -198,7 +201,7 @@ data/lcd/clock/Makefile data/locale/Makefile data/scripts/Makefile data/themes/Makefile -src/sectionsd/Makefile +src/eitd/Makefile src/timerd/Makefile src/zapit/Makefile src/zapit/lib/Makefile diff --git a/cross-configure.cool b/cross-configure.cool index e8117eb56..b35b48763 100755 --- a/cross-configure.cool +++ b/cross-configure.cool @@ -1,6 +1,6 @@ #!/bin/sh -PREFIX=/opt/newcross/arm-cx2450x-linux-gnueabi/arm-cx2450x-linux-gnueabi/sys-root/usr +PREFIX=/opt/arm/arm-cx2450x-linux-gnueabi/arm-cx2450x-linux-gnueabi/sys-root/usr CCPATH= HOST=arm-cx2450x-linux-gnueabi @@ -12,11 +12,11 @@ export RANLIB=$CCPATH$HOST-ranlib export OBJDUMP=$CCPATH$HOST-objdump export STRIP=$CCPATH$HOST-strip -export CFLAGS="-Wall -Werror -g0 -O2 \ +export CFLAGS="-Wall -Werror -g0 -O2 -fno-strict-aliasing \ -D__KERNEL_STRICT_NAMES -DUSE_NEVIS_GXA \ -I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2" -export CXXFLAGS="-Wall -Werror -g0 -O2 \ +export CXXFLAGS="-Wall -Werror -g0 -O2 -fno-strict-aliasing \ -D__KERNEL_STRICT_NAMES -DUSE_NEVIS_GXA \ -I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2" diff --git a/cross-configure.cool.debug b/cross-configure.cool.debug new file mode 100755 index 000000000..6ce9ebed1 --- /dev/null +++ b/cross-configure.cool.debug @@ -0,0 +1,31 @@ +#!/bin/sh + +PREFIX=/opt/newcross/arm-cx2450x-linux-gnueabi/arm-cx2450x-linux-gnueabi/sys-root/usr +CCPATH= +HOST=arm-cx2450x-linux-gnueabi + +export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig +export CC=$CCPATH$HOST-gcc +export AR=$CCPATH$HOST-ar +export NM=$CCPATH$HOST-nm +export RANLIB=$CCPATH$HOST-ranlib +export OBJDUMP=$CCPATH$HOST-objdump +export STRIP=$CCPATH$HOST-strip + +export CFLAGS=" -Wall -Wextra -Wshadow -Werror -g -ggdb3 \ + -D__KERNEL_STRICT_NAMES -DUSE_NEVIS_GXA \ + -I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2" + +export CXXFLAGS=" -Wall -Wextra -Wshadow -Werror -g -ggdb3 \ + -D__KERNEL_STRICT_NAMES -DUSE_NEVIS_GXA \ + -I"$PWD"/include -I"$PWD"/include/linux/dvb -I"$PREFIX"/include/freetype2" + +export LDFLAGS="-L"$PREFIX"/lib -lcurl -lssl -lcrypto -ldl" + +export DVB_API_VERSION=3 +export FREETYPE_CONFIG=$PREFIX/bin/freetype-config +export CURL_CONFIG=$PREFIX/bin/curl-config + +./autogen.sh +./configure --prefix=${PREFIX} --build=i386-pc-linux-gnu --host=$HOST --without-driver --with-target=cdk --with-targetprefix="" "$*" + diff --git a/data/Makefile.am b/data/Makefile.am index f5f5e5cf1..7519719cd 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,4 +5,4 @@ SUBDIRS += lcd endif configdir = $(CONFIGDIR) -config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf +config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml diff --git a/data/cables.xml b/data/cables.xml index f56dd0ef2..3ef2d5188 100644 --- a/data/cables.xml +++ b/data/cables.xml @@ -2,7 +2,8 @@ - + + @@ -13,29 +14,27 @@ - + - + - + - - - + + - @@ -221,6 +220,7 @@ + @@ -253,6 +253,12 @@ + + + + + + @@ -502,7 +508,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1280,4 +1310,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 3e5c281ab..5cdd35240 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -185,6 +185,8 @@ install_DATA = \ suomi.png \ svenska.png \ timer.png \ + tuner_1.png \ + tuner_2.png \ up.png \ upnp.png \ via_green.png \ diff --git a/data/icons/tuner_1.png b/data/icons/tuner_1.png new file mode 100644 index 000000000..41cc06b5f Binary files /dev/null and b/data/icons/tuner_1.png differ diff --git a/data/icons/tuner_2.png b/data/icons/tuner_2.png new file mode 100644 index 000000000..7749a9993 Binary files /dev/null and b/data/icons/tuner_2.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 655822dcd..d27c6f72f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -194,6 +194,10 @@ bouqueteditor.savingchanges Änderungen werden gespeichert. Bitte warten ... bouqueteditor.switch Kanal aufnehmen/entfernen bouqueteditor.switchmode TV/Radio bouquetlist.head Bouquets +bouquetname.hdtv HD Kanäle +bouquetname.new Neue Kanäle +bouquetname.other Unbekannter Provider +bouquetname.removed Gelöschte Kanäle cablesetup.provider Kabelanbieter channellist.current_tp Aktueller Transponder channellist.edit Bearbeiten @@ -205,16 +209,24 @@ channellist.foot Kanalinformationen channellist.foot_freq Tuning-Parameter channellist.foot_next Nachfolgesendung channellist.foot_off aus +channellist.foot_sort_alpha Sortiert[alpha] +channellist.foot_sort_freq Sortiert[freq] +channellist.foot_sort_sat Sortiert[sat] channellist.head Alle Kanäle channellist.history Verlauf -channellist.make_hdlist Erzeuge "HD"- Bouquet +channellist.keep_numbers Dauerhafte Kanalnummern +channellist.make_hdlist Erzeuge Bouquet mit HD-Kanälen +channellist.make_newlist Erzeuge Bouquet mit neuen Kanälen +channellist.make_removedlist Erzeuge Bouquet mit gelöschten Kanälen channellist.new_zap_mode Quickzap in Liste channellist.nonefound Es wurden keine Kanäle gefunden!\nFühren Sie bitte eine Kanalsuche durch\n(MENU-Taste -> Service) channellist.provs Anbieter channellist.recording_not_possible Aufnahme nicht möglich! +channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten channellist.since seit channellist.start Start +ci.clock CI Takt (Mhz) ci.empty Kein CAM im Slot ci.init_failed CAM-Init fehlgeschlagen ci.init_ok CAM-Init beendet @@ -234,7 +246,7 @@ colorchooser.red rot colormenu.background Hintergrundfarbe colormenu.contrast_fonts Schriftkontrast colormenu.fade Menüs faden -colormenu.font Neutrino Schriftart +colormenu.font Neutrino-HD Schriftart colormenu.font_ttx Teletext Schriftart colormenu.hd_preset LCD colormenu.menucolors Menüfarben @@ -343,10 +355,9 @@ extra.key_timeshift Timeshift extra.key_unlock Entsperrtaste extra.ladirection Breitengrad-Ausrichtung extra.latitude Breitengrad -extra.loadconfig Neutrino-Einstellungen: Laden von +extra.loadconfig Neutrino-HD Einstellungen: Laden von extra.loadkeys Lade Tastenbelegung von extra.lodirection Längengrad-Ausrichtung -extra.logo Logonummer extra.longitude Längengrad extra.menu_left_exit "links" = Menü zurück extra.north Norden @@ -355,10 +366,8 @@ extra.rotor_swap Rotor dreht Ost/West extra.rounded_corners Eckendarstellung extra.rounded_corners_off eckig extra.rounded_corners_on abgerundet -extra.saveconfig Neutrino-Einstellungen: Sichern als +extra.saveconfig Neutrino-HD Einstellungen: Sichern als extra.savekeys Speichere Tastenbelegung als -extra.scan_fast Schnell -extra.scan_full Total extra.scrambled_message Verschlüsselung melden extra.show_mute_icon Mute-Icon bei Lautstärke 0 extra.sms_channel SMS-Modus Kanal @@ -377,8 +386,10 @@ extra.tp_mod_32 QAM/32 extra.tp_mod_64 QAM/64 extra.tp_pol Polarisation extra.tp_pol_h H +extra.tp_pol_l L +extra.tp_pol_r R extra.tp_rate Symbolrate -extra.update_dir Update-Verzeichnis +extra.update_dir Lokales Update-Verzeichnis extra.use_gotoxx Benutze gotoXX extra.volume_pos Lautstärkeanzeige extra.west Westen @@ -386,11 +397,9 @@ extra.zap_cycle Zap nur in Bouquet extra.zapit_fe_timeout Tuning Timeout (1=10ms) extra.zapit_hvoltage High (13.5/ 18.5) Voltage extra.zapit_make_bouquet Kanalliste auffüllen -extra.zapit_menu Zapit-Einstellungen extra.zapit_motor_speed Rotor Drehzeit (10 = 1°/ sec) extra.zapit_scanpids PIDs scannen/nutzen extra.zapit_sdt_changed Kanalliste wird neu geladen. -extra.zapit_write_names Schreibe Kanalname fan_speed CPU-Lüftergeschwindigkeit favorites.addchannel Der aktuelle Kanal wird dem Bouquet \n"Meine Favoriten" hinzugefügt. \nDie Speicherung benötigt einen Moment... favorites.bouquetname Meine Favoriten @@ -425,7 +434,7 @@ filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash lese Flash flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann das MTD-Device nicht öffnen -flashupdate.checkupdate nach neuer Version suchen +flashupdate.checkupdate Nach Updates suchen flashupdate.currentversion_sep Installierte Version flashupdate.currentversiondate Datum flashupdate.currentversiontime Uhrzeit @@ -466,13 +475,14 @@ flashupdate.ready fertig flashupdate.reallyflashmtd Wollen Sie den Flashvorgang wirklich durchführen?\n\nFalls ein Fehler auftritt oder das Image nicht\nfunktionfähig ist, wird Ihre Box nicht mehr booten.\n\nImagename: %s\nZiel: %s flashupdate.savesuccess Das Image wurde erfolgreich unter dem\nDateinamen %s gespeichert. flashupdate.selectimage Verfügbare Images/Files +flashupdate.settings Update-Einstellungen flashupdate.squashfs.noversion Bei Updates werden Versionsüberprüfungen derzeit nur über Web-Updates unterstützt.\nWollen Sie das ausgewählte Image wirklich installieren? flashupdate.titlereadflash Flash auslesen flashupdate.titlewriteflash Flash schreiben flashupdate.updatemode Updatemodus flashupdate.updatemode_internet Internet -flashupdate.updatemode_manual manuell (ftp) -flashupdate.url_file Konfigfile +flashupdate.updatemode_manual von lokalem Update-Verzeichnis +flashupdate.url_file Internet Konfigurations-Datei flashupdate.versioncheck Versionsüberprüfung flashupdate.writeflash ganzes Flashimage einspielen flashupdate.writeflashmtd einzelne Partition einspielen @@ -513,8 +523,6 @@ fontsize.infobar_small Klein fontsize.menu Menütext fontsize.menu_info Menüinfo fontsize.menu_title Menütitel -gtxalpha.alpha1 Alpha 1 -gtxalpha.alpha2 Alpha 2 hdd_10min 10 min. hdd_1min 1 min. hdd_20min 20 min. @@ -593,7 +601,7 @@ keybindingmenu.mode_left_right_key_tv_zap Umschalten keybindingmenu.modechange Moduswechsel keybindingmenu.pagedown Seite weiter keybindingmenu.pageup Seite zurück -keybindingmenu.poweroff Umschalter +keybindingmenu.poweroff Standby EIN/AUS keybindingmenu.quickzap Schnellumschaltung keybindingmenu.remotecontrol_hardware Hardware keybindingmenu.remotecontrol_hardware_coolstream Coolstream @@ -625,7 +633,6 @@ lcd_info_line_clock Uhrzeit lcdcontroler.brightness normale lcdcontroler.brightnessdeepstandby Deep-Standby lcdcontroler.brightnessstandby Standby -lcdcontroler.contrast Kontrast lcdmenu.dim_brightness nach Dimm-Timeout lcdmenu.dim_time Dimm-Timeout lcdmenu.head VFD Einstellungen @@ -729,9 +736,11 @@ miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo Verz. miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen +miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen miscsettings.infobar_show_res Auflösung anzeigen miscsettings.infobar_show_res_simple einfach -miscsettings.infobar_show_var_hdd Füllstandanzeige (var & hdd) +miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) +miscsettings.infobar_show_tuner Aktiven Tuner anzeigen miscsettings.radiotext Radiotext miscsettings.shutdown_count Komplett ausschalten nach miscsettings.shutdown_count_hint1 Zeit (in Minuten), nach der vom Standby in @@ -948,7 +957,7 @@ networkmenu.setuponstartup Beim Start Netzwerk setzen networkmenu.show Aktive Einstellungen zeigen networkmenu.ssid Netzwerkname networkmenu.test Netzwerk testen -neutrino_starting Neutrino wird gestartet... +neutrino_starting Neutrino-HD wird gestartet... nfs.alreadymounted Verzeichnis bereits gemountet. nfs.automount Beim Start mounten nfs.dir Verzeichnis/Freigabe @@ -1011,7 +1020,6 @@ personalize.button_red Rot personalize.button_yellow Gelb personalize.disabled deaktiviert personalize.enabled aktiviert -personalize.features Erweiterungen personalize.head Menüs anpassen personalize.help Hilfe personalize.help_line1 Die Personalisierung ermöglicht es, die wichtigsten @@ -1033,7 +1041,6 @@ personalize.pinhint Personalisierungs PIN Code eingeben personalize.pinprotect ja personalize.pinstatus mit PIN personalize.plugins Plugins -personalize.setupmenuwithpin Einstellungen-Menü mit PIN personalize.usermenu_preferred_buttons Bevorzugte Tasten zuweisen personalize.usermenu_show_cancel Zeige Schalter "Abbrechen" personalize.visible sichtbar @@ -1121,6 +1128,7 @@ reset_confirm Sind Sie sich sicher? reset_settings Einstellungen auf Standardwerte satsetup.auto_scan Automatisch einen gewählten %s satsetup.auto_scan_all Automatisch alle Satelliten +satsetup.cable_nid Netzwerk ID satsetup.comm_input Committed Input satsetup.diseqc DiSEqC satsetup.diseqc10 DiSEqC 1.0 @@ -1142,18 +1150,28 @@ satsetup.fastscan_prov_telesat TéléSAT satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd nur SD satsetup.fastscan_type Scantyp +satsetup.fe_mode Tuner Modus +satsetup.fe_mode_alone independent +satsetup.fe_mode_loop loop +satsetup.fe_mode_single single +satsetup.fe_mode_twin twin +satsetup.fe_setup Setup tuner satsetup.lofh LNB High Offset satsetup.lofl LNB Low Offset satsetup.lofs LNB Switch Offset +satsetup.logical_numbers Nutze logische Nummern satsetup.manual_scan Manueller Frequenzscan satsetup.minidiseqc Mini-DiSEqC satsetup.motor_pos Rotor-Position satsetup.nodiseqc Kein DiSEqC +satsetup.reset_numbers Reset Kanalnummern satsetup.sat_setup LNB-Konfiguration satsetup.satellite Satellit +satsetup.select_sat Auswahl Satellit satsetup.smatvremote SMATV Remote Tuning satsetup.uncomm_input Uncommitted satsetup.usals_repeat USALS wiederholen +satsetup.use_bat Benutze BAT satsetup.use_fta_flag nur FTA Kanäle satsetup.use_nit Auswertung NIT satsetup.use_usals Benutze USALS @@ -1211,8 +1229,8 @@ servicemenu.head Service servicemenu.imageinfo Imageinfo servicemenu.reload Kanallisten neu laden servicemenu.reload_hint Kanallisten werden neu geladen,\nbitte warten... -servicemenu.restart Neutrino neu starten -servicemenu.restart_hint Neutrino wird neu gestartet... +servicemenu.restart Neutrino-HD neu starten +servicemenu.restart_hint Neutrino-HD wird neu gestartet... servicemenu.restart_refused_recording Aufnahme läuft. Neustart nicht möglich. servicemenu.scants Kanalsuche servicemenu.update Software-Aktualisierung @@ -1220,8 +1238,8 @@ settings.backup Image-Einstellungen: Sichern settings.backup_failed Sicherung fehlgeschlagen! settings.help Hilfe settings.menu_pos Menüposition -settings.missingoptionsconffile Die Neutrino-Einstellungen wurden erweitert.\nDie neuen Werte werden auf Standard gesetzt. -settings.noconffile Die Neutrino-Einstellungen wurden nicht\ngefunden. Es werden Standardwerte benutzt. +settings.missingoptionsconffile Die Neutrino-HD Einstellungen wurden erweitert.\nDie neuen Werte werden auf Standard gesetzt. +settings.noconffile Die Neutrino-HD Einstellungen wurden nicht\ngefunden. Es werden Standardwerte benutzt. settings.pos_bottom_left unten links settings.pos_bottom_right unten rechts settings.pos_default_center oben Mitte @@ -1249,7 +1267,7 @@ streaminfo.head Tech. Information streaminfo.not_available nicht verfügbar streaminfo.resolution Auflösung streaminfo.signal Empfangssignal -streaming.busy Ein oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart von Neutrino Abhilfe. +streaming.busy Ein oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart von Neutrino-HD Abhilfe. streaming.dir_not_writable Das Aufnahmeverzeichnis ist nicht beschreibbar.\nAufnahmen sind daher nicht möglich. streaming.write_error Die Aufnahme wurde leider abgebrochen,\nda ein Fehler beim Schreiben der Daten auftrat. stringinput.caps Groß-/Kleinbuchstaben @@ -1373,7 +1391,6 @@ videomenu.auto Automatisch videomenu.brightness Helligkeit videomenu.cinch Cinch videomenu.contrast Kontrast -videomenu.csync Sync.-Korrektur videomenu.dbdr MPEG2 Filter videomenu.dbdr_both deBlock & deRing videomenu.dbdr_deblock deBlock diff --git a/data/locale/english.locale b/data/locale/english.locale index 0f6cff618..dd3f53163 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -194,6 +194,10 @@ bouqueteditor.savingchanges Saving changes. Please wait ... bouqueteditor.switch add/remove bouqueteditor.switchmode TV/Radio bouquetlist.head Bouquets +bouquetname.hdtv HD channels +bouquetname.new New channels +bouquetname.other Unknown provider +bouquetname.removed Removed channels cablesetup.provider cable provider channellist.current_tp Current transponder channellist.edit Edit @@ -205,16 +209,24 @@ channellist.foot Channel Information channellist.foot_freq Sat/Freq Info channellist.foot_next next Event channellist.foot_off off +channellist.foot_sort_alpha sorted[alpha] +channellist.foot_sort_freq sorted[freq] +channellist.foot_sort_sat sorted[sat] channellist.head All Services channellist.history History +channellist.keep_numbers Persistent channel numbers channellist.make_hdlist Create list of HD channels +channellist.make_newlist Create list of new channels +channellist.make_removedlist Create list of removed channels channellist.new_zap_mode Quickzap in list channellist.nonefound No channels were found!\nPlease execute a scan\n(MENU-key -> service) channellist.provs Providers channellist.recording_not_possible Recording not possible! +channellist.reset_flags Reset 'new' channel flag channellist.sats Satellites channellist.since since channellist.start starts +ci.clock CI clock (Mhz) ci.empty No CAM in slot ci.init_failed CAM init failed ci.init_ok CAM init complete @@ -343,10 +355,9 @@ extra.key_timeshift Timeshift extra.key_unlock Unlock key extra.ladirection LaDirection extra.latitude Latitude -extra.loadconfig Neutrino-Settings: Load from +extra.loadconfig Neutrino-HD Settings: Load from extra.loadkeys Load keys from extra.lodirection LoDirection -extra.logo Logo number extra.longitude Longitude extra.menu_left_exit "Left" = menu back extra.north North @@ -355,10 +366,8 @@ extra.rotor_swap Swap rotor east/west extra.rounded_corners Shape of corners extra.rounded_corners_off angular extra.rounded_corners_on rounded -extra.saveconfig Neutrino-Settings: Save as +extra.saveconfig Neutrino-HD Settings: Save as extra.savekeys Save keys as -extra.scan_fast Fast -extra.scan_full Full extra.scrambled_message Scrambled Message extra.show_mute_icon mute-icon at volume 0 extra.sms_channel sms-mode channel @@ -377,8 +386,10 @@ extra.tp_mod_32 QAM/32 extra.tp_mod_64 QAM/64 extra.tp_pol Polarization extra.tp_pol_h H +extra.tp_pol_l L +extra.tp_pol_r R extra.tp_rate Symbol rate -extra.update_dir Directory for updates +extra.update_dir Local update directory extra.use_gotoxx Use gotoXX extra.volume_pos Volumebar extra.west West @@ -386,11 +397,9 @@ extra.zap_cycle Zap cycle extra.zapit_fe_timeout Tune timeout (1 = 10 msec) extra.zapit_hvoltage 18V for rotor moving extra.zapit_make_bouquet Make Remaining Channels list -extra.zapit_menu Zapit options extra.zapit_motor_speed Motor moving speed (10 = 1deg/sec) extra.zapit_scanpids Scan/Use pids extra.zapit_sdt_changed Channels changed, reload settings. -extra.zapit_write_names Write channel names fan_speed CPU Fan speed favorites.addchannel The current channel will be added \nto the bouquet "My Favorites". \n This will take a few seconds... favorites.bouquetname My Favorites @@ -425,7 +434,7 @@ filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash reading flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open mtd-device -flashupdate.checkupdate search for new version +flashupdate.checkupdate Check for updates flashupdate.currentversion_sep Current version flashupdate.currentversiondate Date flashupdate.currentversiontime Time @@ -466,12 +475,13 @@ flashupdate.ready ready flashupdate.reallyflashmtd Do you really want to flash?\n\nIf a error occurs or the image is not\nvalid, the box will not boot after flashing.\n\nImagename: %s\nTarget: %s flashupdate.savesuccess The image was successfully saved \nunder %s. flashupdate.selectimage Available Images/Files +flashupdate.settings Update settings flashupdate.squashfs.noversion SquashFS version checks are currently only supported when updating over the web.\nAre you sure that you wish to install this image? flashupdate.titlereadflash Reading Flash flashupdate.titlewriteflash Writing Flash flashupdate.updatemode Updatemode flashupdate.updatemode_internet internet -flashupdate.updatemode_manual manual (ftp) +flashupdate.updatemode_manual from local update directory flashupdate.url_file config file flashupdate.versioncheck checking version flashupdate.writeflash Write whole image @@ -513,8 +523,6 @@ fontsize.infobar_small Small fontsize.menu Menutext fontsize.menu_info Menu Info fontsize.menu_title Menu Title -gtxalpha.alpha1 Alpha 1 -gtxalpha.alpha2 Alpha 2 hdd_10min 10 min. hdd_1min 1 min. hdd_20min 20 min. @@ -625,7 +633,6 @@ lcd_info_line_clock clock lcdcontroler.brightness normal Brightness lcdcontroler.brightnessdeepstandby DeepStandby Brightness lcdcontroler.brightnessstandby Standby Brightness -lcdcontroler.contrast Contrast lcdmenu.dim_brightness Brightness after dim timeout lcdmenu.dim_time Dim timeout lcdmenu.head VFD Settings @@ -729,9 +736,11 @@ miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change +miscsettings.infobar_show_dd_available show DD availability miscsettings.infobar_show_res show resolution on infobar miscsettings.infobar_show_res_simple simple -miscsettings.infobar_show_var_hdd Fill level (var & hdd ) +miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) +miscsettings.infobar_show_tuner Display active tuner miscsettings.radiotext Radiotext miscsettings.shutdown_count In standby, switch off after miscsettings.shutdown_count_hint1 time (in minutes) to switch from standby @@ -943,12 +952,13 @@ networkmenu.ntptitle Time-Syncronisation networkmenu.password Key networkmenu.reset_settings_now Do you want restore the previous settings? networkmenu.select_if Interface +networkmenu.services Network services networkmenu.setupnow Apply network settings now networkmenu.setuponstartup Setup network on startup networkmenu.show Show active Network settings networkmenu.ssid Network name networkmenu.test Test network now -neutrino_starting Neutrino starting... +neutrino_starting Neutrino-HD starting... nfs.alreadymounted directory already mounted nfs.automount Mount on startup nfs.dir directory/share @@ -1011,7 +1021,6 @@ personalize.button_red red personalize.button_yellow yellow personalize.disabled Disabled personalize.enabled Enabled -personalize.features Features menue personalize.head Personalization personalize.help Help personalize.help_line1 Personalization makes it possible to adapt the most @@ -1033,7 +1042,6 @@ personalize.pinhint Enter the Personalization PIN Code personalize.pinprotect Yes personalize.pinstatus Require PIN personalize.plugins Plugins -personalize.setupmenuwithpin Settings Menu with PIN personalize.usermenu_preferred_buttons Assigning of preferred keys personalize.usermenu_show_cancel Show "Cancel"-Button personalize.visible Visible @@ -1121,6 +1129,7 @@ reset_confirm Are you sure ? reset_settings Reset settings to defaults satsetup.auto_scan Auto-Scan selected %s satsetup.auto_scan_all Auto-Scan multiple Satellites +satsetup.cable_nid Network ID satsetup.comm_input Commited input satsetup.diseqc DiSEqC satsetup.diseqc10 DiSEqC 1.0 @@ -1142,18 +1151,28 @@ satsetup.fastscan_prov_telesat TéléSAT satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd SD only satsetup.fastscan_type Scan type +satsetup.fe_mode Tuner mode +satsetup.fe_mode_alone independent +satsetup.fe_mode_loop loop +satsetup.fe_mode_single single +satsetup.fe_mode_twin twin +satsetup.fe_setup Setup tuner satsetup.lofh LNB High Offset satsetup.lofl LNB Low Offset satsetup.lofs LNB switch Offset +satsetup.logical_numbers Use logical numbers satsetup.manual_scan Manual frequency scan satsetup.minidiseqc Mini-DiSEqC satsetup.motor_pos Rotor position satsetup.nodiseqc no DiSEqC +satsetup.reset_numbers Reset channel numbers satsetup.sat_setup Setup satellites input / LNB satsetup.satellite Satellite +satsetup.select_sat Select satellites satsetup.smatvremote SMATV Remote Tuning satsetup.uncomm_input Uncommited input satsetup.usals_repeat USALS command repeat +satsetup.use_bat Use BAT satsetup.use_fta_flag just free Channels satsetup.use_nit Use NIT satsetup.use_usals Use usals for all @@ -1220,8 +1239,8 @@ settings.backup Image-Settings: Backup settings.backup_failed Backup failed! settings.help Help settings.menu_pos Menu position -settings.missingoptionsconffile The neutrino-settings have been updated.\nNew Options will be set to default. -settings.noconffile No neutrino-settings found.\nUsing defaults. +settings.missingoptionsconffile The Neutrino-HD settings have been updated.\nNew Options will be set to default. +settings.noconffile No Neutrino-HD settings found.\nUsing defaults. settings.pos_bottom_left bottom left settings.pos_bottom_right bottom right settings.pos_default_center top center @@ -1249,7 +1268,7 @@ streaminfo.head Stream-Information streaminfo.not_available not available streaminfo.resolution Resolution streaminfo.signal Receipt signal -streaming.busy One or several recording processes are active.\nIf you encounter this message and no recording is active, please restart Neutrino. +streaming.busy One or several recording processes are active.\nIf you encounter this message and no recording is active, please restart Neutrino-HD. streaming.dir_not_writable The recording directory is not writable.\nRecording will not work. streaming.write_error The recording was aborted,\nsince an error occured during the writing process. stringinput.caps caps / no caps @@ -1373,7 +1392,6 @@ videomenu.auto Auto videomenu.brightness Brightness videomenu.cinch Cinch videomenu.contrast Contrast -videomenu.csync sync correction videomenu.dbdr MPEG2 de-block/de-ring videomenu.dbdr_both de-block+de-ring videomenu.dbdr_deblock de-block diff --git a/data/providermap.xml b/data/providermap.xml new file mode 100644 index 000000000..807012f04 --- /dev/null +++ b/data/providermap.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/satellites.xml b/data/satellites.xml index 83b5dd895..da0d9bc18 100755 --- a/data/satellites.xml +++ b/data/satellites.xml @@ -1406,6 +1406,7 @@ + @@ -1575,18 +1576,23 @@ + + + + + @@ -1616,7 +1622,7 @@ - + diff --git a/lib/controldclient/Makefile.am b/lib/controldclient/Makefile.am deleted file mode 100644 index 56165105b..000000000 --- a/lib/controldclient/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/lib/connection \ - -I$(top_srcdir)/lib/libeventserver - -AM_CPPFLAGS = -fno-rtti -fno-exceptions - -lib_LTLIBRARIES = libcontroldclient.la - -libcontroldclient_la_SOURCES = controldclient.cpp diff --git a/lib/controldclient/controldMsg.h b/lib/controldclient/controldMsg.h deleted file mode 100644 index e68d6f112..000000000 --- a/lib/controldclient/controldMsg.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - License: GPL - - 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. -*/ - -#ifndef __controldMsg__ -#define __controldMsg__ - -#include -#include - -#define CONTROLD_UDS_NAME "/tmp/controld.sock" - - -class CControldMsg : public CBasicMessage -{ - - public: - - static const CBasicMessage::t_version ACTVERSION = 2; - - enum commands - { - CMD_SHUTDOWN = 1, - CMD_SAVECONFIG, - - CMD_SETVOLUME, - CMD_GETVOLUME, - - CMD_SETVOLUME_AVS, - CMD_GETVOLUME_AVS, - - CMD_SETMUTE, - CMD_GETMUTESTATUS, - - CMD_SETVIDEOFORMAT, - CMD_GETVIDEOFORMAT, - - CMD_SETVIDEOOUTPUT, - CMD_GETVIDEOOUTPUT, - - CMD_SETVCROUTPUT, - CMD_GETVCROUTPUT, - - CMD_SETBOXTYPE, - CMD_GETBOXTYPE, - - CMD_SETSCARTMODE, - CMD_GETSCARTMODE, - - CMD_GETASPECTRATIO, - - CMD_SETVIDEOPOWERDOWN, - CMD_GETVIDEOPOWERDOWN, - - CMD_REGISTEREVENT, - CMD_UNREGISTEREVENT, - - CMD_EVENT, - - CMD_SETCSYNC, - CMD_GETCSYNC, - CMD_SETVIDEOMODE, - CMD_GETVIDEOMODE - - }; - - struct commandVolume - { - unsigned char volume; - CControld::volume_type type; - }; - - struct commandMute - { - bool mute; - CControld::volume_type type; - }; - - struct commandVideoFormat - { - unsigned char format; - }; - - struct commandVideoOutput - { - unsigned char output; - }; - - struct commandVCROutput - { - unsigned char vcr_output; - }; - - struct commandBoxType - { - CControld::tuxbox_maker_t boxtype; - }; - - struct commandScartMode - { - unsigned char mode; - }; - - struct commandVideoPowerSave - { - bool powerdown; - }; - - //response structures - - struct responseVideoFormat - { - unsigned char format; - }; - - struct responseAspectRatio - { - unsigned char aspectRatio; - }; - - struct responseVideoOutput - { - unsigned char output; - }; - - struct responseVCROutput - { - unsigned char vcr_output; - }; - - struct responseBoxType - { - CControld::tuxbox_maker_t boxtype; - }; - - struct responseScartMode - { - unsigned char mode; - }; - - struct commandCsync - { - unsigned char csync; - }; - - struct responseVideoPowerSave - { - bool videoPowerSave; - }; - -}; - -#endif diff --git a/lib/controldclient/controldclient.cpp b/lib/controldclient/controldclient.cpp deleted file mode 100644 index f0c44520f..000000000 --- a/lib/controldclient/controldclient.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - - License: GPL - - 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. -*/ - -#include - -#include -#include - - -unsigned char CControldClient::getVersion () const -{ - return CControldMsg::ACTVERSION; -} - -const char * CControldClient::getSocketName() const -{ - return CONTROLD_UDS_NAME; -} - -void CControldClient::shutdown() -{ - send(CControldMsg::CMD_SHUTDOWN); - close_connection(); -} - -void CControldClient::setBoxType(CControld::tuxbox_maker_t type) -{ - CControldMsg::commandBoxType msg2; - - msg2.boxtype = type; - - send(CControldMsg::CMD_SETBOXTYPE, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -CControld::tuxbox_maker_t CControldClient::getBoxType() -{ - CControldMsg::responseBoxType rmsg; - - send(CControldMsg::CMD_GETBOXTYPE); - - if (!receive_data((char*)&rmsg, sizeof(rmsg))) - rmsg.boxtype = CControld::TUXBOX_MAKER_UNKNOWN; - - close_connection(); - - return rmsg.boxtype; -} - -void CControldClient::setScartMode(bool mode) -{ - CControldMsg::commandScartMode msg2; - - msg2.mode = mode; - - send(CControldMsg::CMD_SETSCARTMODE, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -char CControldClient::getScartMode() -{ - CControldMsg::responseScartMode rmsg; - send(CControldMsg::CMD_GETSCARTMODE); - receive_data((char*)&rmsg, sizeof(rmsg)); - close_connection(); - - return rmsg.mode; -} - -void CControldClient::setVolume(const char volume, const CControld::volume_type volume_type) -{ - CControldMsg::commandVolume msg2; - msg2.type = volume_type; - msg2.volume = volume; - send(CControldMsg::CMD_SETVOLUME, (char*)&msg2, sizeof(msg2)); - close_connection(); -} - -char CControldClient::getVolume(const CControld::volume_type volume_type) -{ - CControldMsg::commandVolume rmsg; - rmsg.type = volume_type; - send(CControldMsg::CMD_GETVOLUME, (char*)&rmsg, sizeof(rmsg)); - receive_data((char*)&rmsg, sizeof(rmsg)); - close_connection(); - - return rmsg.volume; -} - -void CControldClient::setVideoFormat(char format) -{ - CControldMsg::commandVideoFormat msg2; - - msg2.format = format; - - send(CControldMsg::CMD_SETVIDEOFORMAT, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -char CControldClient::getAspectRatio() -{ - CControldMsg::responseAspectRatio rmsg; - - send(CControldMsg::CMD_GETASPECTRATIO); - - receive_data((char*)&rmsg, sizeof(rmsg)); - - close_connection(); - - return rmsg.aspectRatio; -} - -char CControldClient::getVideoFormat() -{ - CControldMsg::responseVideoFormat rmsg; - - send(CControldMsg::CMD_GETVIDEOFORMAT); - - bool success = receive_data((char*)&rmsg, sizeof(rmsg)); - - close_connection(); - - return success ? rmsg.format : 2; /* default value is 2 (cf. controld.cpp) */ -} - -void CControldClient::setVideoOutput(char output) -{ - CControldMsg::commandVideoOutput msg2; - - msg2.output = output; - - send(CControldMsg::CMD_SETVIDEOOUTPUT, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -void CControldClient::setVCROutput(char output) -{ - CControldMsg::commandVCROutput msg2; - - msg2.vcr_output = output; - - send(CControldMsg::CMD_SETVCROUTPUT, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -char CControldClient::getVideoOutput() -{ - CControldMsg::responseVideoOutput rmsg; - - send(CControldMsg::CMD_GETVIDEOOUTPUT); - - bool success = receive_data((char*)&rmsg, sizeof(rmsg)); - - close_connection(); - - return success ? rmsg.output : 1; /* default value is 1 (cf. controld.cpp) */ -} - -char CControldClient::getVCROutput() -{ - CControldMsg::responseVCROutput rmsg; - - send(CControldMsg::CMD_GETVCROUTPUT); - - bool success = receive_data((char*)&rmsg, sizeof(rmsg)); - - close_connection(); - - return success ? rmsg.vcr_output : 1; /* default value is 1 (cf. controld.cpp) */ -} - -void CControldClient::Mute(const CControld::volume_type volume_type) -{ - setMute(true,volume_type); -} - -void CControldClient::UnMute(const CControld::volume_type volume_type) -{ - setMute(false,volume_type); -} - -void CControldClient::setMute(const bool mute, const CControld::volume_type volume_type) -{ - CControldMsg::commandMute msg; - msg.mute = mute; - msg.type = volume_type; - send(CControldMsg::CMD_SETMUTE, (char*)&msg, sizeof(msg)); - close_connection(); -} - -bool CControldClient::getMute(const CControld::volume_type volume_type) -{ - CControldMsg::commandMute rmsg; - rmsg.type = volume_type; - send(CControldMsg::CMD_GETMUTESTATUS, (char*)&rmsg, sizeof(rmsg)); - receive_data((char*)&rmsg, sizeof(rmsg)); - close_connection(); - return rmsg.mute; -} - -void CControldClient::registerEvent(unsigned int eventID, unsigned int clientID, const char * const udsName) -{ - CEventServer::commandRegisterEvent msg2; - - msg2.eventID = eventID; - msg2.clientID = clientID; - strcpy(msg2.udsName, udsName); - - send(CControldMsg::CMD_REGISTEREVENT, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -void CControldClient::unRegisterEvent(unsigned int eventID, unsigned int clientID) -{ - CEventServer::commandUnRegisterEvent msg2; - - msg2.eventID = eventID; - msg2.clientID = clientID; - - send(CControldMsg::CMD_UNREGISTEREVENT, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -void CControldClient::videoPowerDown(bool powerdown) -{ - CControldMsg::commandVideoPowerSave msg2; - - msg2.powerdown = powerdown; - - send(CControldMsg::CMD_SETVIDEOPOWERDOWN, (char*)&msg2, sizeof(msg2)); - - close_connection(); -} - -bool CControldClient::getVideoPowerDown() -{ - CControldMsg::responseVideoPowerSave msg; - send(CControldMsg::CMD_GETVIDEOPOWERDOWN); - receive_data((char*) &msg, sizeof(msg)); - close_connection(); - return msg.videoPowerSave; -} - -void CControldClient::saveSettings() -{ - send(CControldMsg::CMD_SAVECONFIG); - close_connection(); -} - -void CControldClient::setRGBCsync(char val) -{ - CControldMsg::commandCsync msg; - msg.csync = val; - send(CControldMsg::CMD_SETCSYNC, (char*) &msg, sizeof(msg)); - close_connection(); -} - -char CControldClient::getRGBCsync() -{ - CControldMsg::commandCsync msg; - send(CControldMsg::CMD_GETCSYNC); - receive_data((char*) &msg, sizeof(msg)); - close_connection(); - return msg.csync; -} -char CControldClient::getVideoMode() -{ - CControldMsg::responseVideoFormat rmsg; - send(CControldMsg::CMD_GETVIDEOMODE); - bool success = receive_data((char*)&rmsg, sizeof(rmsg)); - close_connection(); - return success ? rmsg.format : 1; /* default value is 2 (cf. controld.cpp) */ -} -void CControldClient::setVideoMode(char format) -{ - CControldMsg::commandVideoFormat msg2; - msg2.format = format; - send(CControldMsg::CMD_SETVIDEOMODE, (char*)&msg2, sizeof(msg2)); - close_connection(); -} - diff --git a/lib/controldclient/controldclient.h b/lib/controldclient/controldclient.h deleted file mode 100644 index 7a9ded911..000000000 --- a/lib/controldclient/controldclient.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - License: GPL - - 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. -*/ - -#ifndef __controldclient__ -#define __controldclient__ - -#include -#include - - -#define VCR_STATUS_OFF 0 -#define VCR_STATUS_ON 1 -#define VCR_STATUS_16_9 2 - -class CControldClient:private CBasicClient -{ - private: - virtual unsigned char getVersion () const; - virtual const char * getSocketName() const; - - public: - - enum events - { - EVT_VOLUMECHANGED, - EVT_MUTECHANGED, - EVT_MODECHANGED, - EVT_VCRCHANGED - }; - - //VideoFormat - static const char VIDEOFORMAT_AUTO = 0; - static const char VIDEOFORMAT_16_9 = 1; - static const char VIDEOFORMAT_4_3 = 2; - static const char VIDEOFORMAT_4_3_PS = 3; - - //VideoOutput - static const char VIDEOOUTPUT_COMPOSITE = 0; - static const char VIDEOOUTPUT_RGB = 1; - static const char VIDEOOUTPUT_SVIDEO = 2; - static const char VIDEOOUTPUT_YUV_VBS = 3; - static const char VIDEOOUTPUT_YUV_CVBS = 4; - - //mute - static const bool VOLUME_MUTE = true; - static const bool VOLUME_UNMUTE = false; - - //scartmode - static const char SCARTMODE_ON = 1; - static const char SCARTMODE_OFF = 0; - - /* - setVolume(volume_type) : Setzen der Lautstaerke - Parameter: 0..100 - 0=leise 100=laut - volume_type : device AVS/OST/UNKOWN(=last used) - */ - void setVolume(const char volume, const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - char getVolume(const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - - /* - setMute(bool, volume_type) : setzen von Mute - Parameter: mute == true : ton aus - mute == false : ton an - volume_type : device AVS/OST/UNKOWN(=last used) - */ - void setMute(const bool mute, const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - bool getMute(const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - - /* - Mute(volume_type) : Ton ausschalten - Parameter: volume_type : device AVS/OST/UNKOWN(=last used) - */ - void Mute(const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - - /* - UnMute(bool) : Ton wieder einschalten - Parameter: volume_type : device AVS/OST/UNKOWN(=last used) - - */ - void UnMute(const CControld::volume_type volume_type = CControld::TYPE_UNKNOWN); - - - /* - setVideoFormat(char) : Setzten des Bildformates ( 4:3 / 16:9 ) - Parameter: VIDEOFORMAT_AUTO = auto - VIDEOFORMAT_4_3 = 4:3 - VIDEOFORMAT_16_9 = 16:9 - */ - void setVideoFormat(char); - char getVideoFormat(); - /* - getAspectRatio : Aktueller Wert aus dem Bitstream - 0: 4:3 - 1: 16:9 - 2: 2:2.1 - */ - char getAspectRatio(); - - /* - setVideoOutput(char) : Setzten des Videooutputs ( composite (= cvbs) / svideo / rgb+cvbs / yuv+vbs / yuv+cvbs ) - Parameter: VIDEOOUTPUT_COMPOSITE = cvbs (composite) video - VIDEOOUTPUT_SVIDEO = svideo - VIDEOOUTPUT_RGB = rgb+cvbs - VIDEOOUTPUT_YUV_VBS = yuv+vbs - VIDEOOUTPUT_YUV_CVBS = yuv+cvbs - */ - void setVideoOutput(char); - char getVideoOutput(); - - /* - setVCROutput(char) : Setzen des Videooutputs fuer VCR ( composite / svideo ) - Parameter: VIDEOOUTPUT_COMPOSITE = cvbs - VIDEOOUTPUT_SVIDEO = svideo - */ - void setVCROutput(char); - char getVCROutput(); - - /* - setBoxType(CControldClient::tuxbox_vendor_t) : Setzten des Boxentyps ( nokia / sagem / philips ) - */ - void setBoxType(const CControld::tuxbox_maker_t); - CControld::tuxbox_maker_t getBoxType(); - - /* - setScartMode(char) : Scartmode ( an / aus ) - Parameter: SCARTMODE_ON = auf scartinput schalten - SCARTMODE_OFF = wieder dvb anzeigen - - - */ - void setScartMode(bool); - char getScartMode(); - - - /* - die dBox in standby bringen - */ - void videoPowerDown(bool); - - /* - standby abfragen - */ - bool getVideoPowerDown(); - - /* - die Dbox herunterfahren - */ - void shutdown(); - - - /* - ein beliebiges Event anmelden - */ - void registerEvent(unsigned int eventID, unsigned int clientID, const char * const udsName); - - /* - ein beliebiges Event abmelden - */ - void unRegisterEvent(unsigned int eventID, unsigned int clientID); - - void saveSettings(); - - /* - setzen der sync correction im RGB mode des saa7126 (csync) 0=aus, 31=max - */ - - void setRGBCsync(char csync); - /* - lesen der sync correction im RGB mode des saa7126 (csync) 0=aus, 31=max - */ - char getRGBCsync(); - void setVideoMode(char); - char getVideoMode(); -}; - -#endif diff --git a/lib/controldclient/controldtypes.h b/lib/controldclient/controldtypes.h deleted file mode 100644 index 1025b0494..000000000 --- a/lib/controldclient/controldtypes.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - License: GPL - - 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. -*/ - -#ifndef __controldtypes__ -#define __controldtypes__ - -class CControld -{ -public: - - //BoxType /* cf. driver/include/tuxbox/tuxbox_info.h */ - typedef enum tuxbox_maker - { - TUXBOX_MAKER_UNKNOWN = 0, - TUXBOX_MAKER_NOKIA = 1, - TUXBOX_MAKER_PHILIPS = 2, - TUXBOX_MAKER_SAGEM = 3, - TUXBOX_MAKER_DREAM_MM = 4, - TUXBOX_MAKER_TECHNOTREND = 5 - } tuxbox_maker_t; - - enum volume_type - { - TYPE_OST=0, - TYPE_AVS=1, - TYPE_LIRC=2, - TYPE_UNKNOWN - }; - - const static int no_video_formats = 5; - - typedef enum video_format - { - FORMAT_CVBS = 0, - FORMAT_RGB = 1, - FORMAT_SVIDEO = 2, - FORMAT_YUV_VBS = 3, - FORMAT_YUV_CVBS = 4 - } t_video_format; - -}; -#endif diff --git a/lib/libconfigfile/configfile.cpp b/lib/libconfigfile/configfile.cpp index 8d7677456..52830b3c0 100644 --- a/lib/libconfigfile/configfile.cpp +++ b/lib/libconfigfile/configfile.cpp @@ -95,7 +95,7 @@ bool CConfigFile::saveConfig(const char * const filename) if (configFile != NULL) { - for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); it++) + for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it) { configFile << it->first << "=" << it->second << std::endl; } @@ -391,8 +391,10 @@ void CConfigFile::setInt32Vector(const std::string & key, const std::vector::const_iterator it = vec.begin(); ; ) { + if (it == vec.end()) + break; s << (*it); - it++; + ++it; if (it == vec.end()) break; s << delimiter; @@ -406,8 +408,10 @@ void CConfigFile::setStringVector(const std::string & key, const std::vector::const_iterator it = vec.begin(); ; ) { + if (it == vec.end()) + break; configData[key] += *it; - it++; + ++it; if (it == vec.end()) break; configData[key] += delimiter; diff --git a/lib/libcoolstream/ca_cs.h b/lib/libcoolstream/ca_cs.h index 638762b83..b2aa613ca 100644 --- a/lib/libcoolstream/ca_cs.h +++ b/lib/libcoolstream/ca_cs.h @@ -5,12 +5,14 @@ /* */ /* (C) 2010 CoolStream International Ltd. */ /* */ +/* $Id:: $ */ /*******************************************************************************/ #ifndef __CA_CS_H_ #define __CA_CS_H_ #include #include "cs_types.h" +#include enum CA_INIT_MASK { CA_INIT_SC = 1, @@ -21,24 +23,33 @@ enum CA_INIT_MASK { enum CA_SLOT_TYPE { CA_SLOT_TYPE_SMARTCARD, CA_SLOT_TYPE_CI, - CA_SLOT_TYPE_ALL, + CA_SLOT_TYPE_ALL }; enum CA_MESSAGE_FLAGS { CA_MESSAGE_EMPTY = (1 << 0), - CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), // Free after use! + CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), /// Free after use! CA_MESSAGE_HAS_PARAM1_INT = (1 << 2), CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3), CA_MESSAGE_HAS_PARAM2_INT = (1 << 4), CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5), CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6), - CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), // Free after use! + CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), /// Free after use! CA_MESSAGE_HAS_PARAM3_INT = (1 << 8), CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9), CA_MESSAGE_HAS_PARAM4_INT = (1 << 10), CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11), CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12), - CA_MESSAGE_HAS_PARAM_LONG = (1 << 13), + CA_MESSAGE_HAS_PARAM5_INT = (1 << 13), + CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14), + CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15), + CA_MESSAGE_HAS_PARAM6_INT = (1 << 16), + CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17), + CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18), + CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19), + CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20), + CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21), + CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22) }; enum CA_MESSAGE_MSGID { @@ -55,11 +66,13 @@ enum CA_MESSAGE_MSGID { CA_MESSAGE_MSG_MMI_CLOSE, CA_MESSAGE_MSG_INTERNAL, CA_MESSAGE_MSG_PMT_ARRIVED, + CA_MESSAGE_MSG_CAPMT_ARRIVED, CA_MESSAGE_MSG_CAT_ARRIVED, CA_MESSAGE_MSG_ECM_ARRIVED, CA_MESSAGE_MSG_EMM_ARRIVED, CA_MESSAGE_MSG_CHANNEL_CHANGE, - CA_MESSAGE_MSG_EXIT, + CA_MESSAGE_MSG_GUI_READY, + CA_MESSAGE_MSG_EXIT }; typedef struct CA_MESSAGE { @@ -68,13 +81,17 @@ typedef struct CA_MESSAGE { int Slot; u32 Flags; union { - u8 *Data[4]; - u32 Param[4]; - void *Ptr[4]; - u64 ParamLong; + u8 *Data[8]; + u32 Param[8]; + void *Ptr[8]; + u64 ParamLong[4]; } Msg; } CA_MESSAGE; +typedef std::vector CaIdVector; +typedef std::vector::iterator CaIdVectorIterator; +typedef std::vector::const_iterator CaIdVectorConstIterator; + #define CA_MESSAGE_SIZE sizeof(CA_MESSAGE) #define CA_MESSAGE_ENTRIES 256 #define CA_MESSAGE_ENTRIES_CI 128 @@ -84,36 +101,64 @@ typedef struct CA_MESSAGE { #define CS_CA_PDATA void #endif +/// CA module class class cCA : public OpenThreads::Thread { private: + /// Static instance of the CA module static cCA *inst; - // + /// Private constructor (singleton method) cCA(void); - // + /// Private data for the CA module CS_CA_PDATA *privateData; enum CA_INIT_MASK initMask; bool exit; bool started; bool guiReady; + /// Thread method virtual void run(void); public: + /// Returns the number of CI slots u32 GetNumberCISlots(void); - u32 GetNumberSmartCardSlots(void); // + /// Returns the number of Smartcard slots + u32 GetNumberSmartCardSlots(void); + /// Singleton static cCA *GetInstance(void); + /// Send PMT to a individual or to all available modules bool SendPMT(int Unit, unsigned char *Data, int Len, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL); + /// Sends a message to the CA thread bool SendMessage(const CA_MESSAGE *Msg); + /// Sets which modules to initialize. It is only + /// possible to change this once! void SetInitMask(enum CA_INIT_MASK InitMask); + /// Sets the frequency (in Hz) of the TS stream input (only valid for CI) + void SetTSClock(u32 Speed); + /// Start the CA module bool Start(void); + /// Stops the CA module void Stop(void); + /// Notify that the GUI is ready to receive messages + /// (CA messages coming from a module) void Ready(bool Set); + /// Resets a module (if possible) void ModuleReset(enum CA_SLOT_TYPE, u32 Slot); + /// Checks if a module is present bool ModulePresent(enum CA_SLOT_TYPE, u32 Slot); + /// Returns the module name in array Name void ModuleName(enum CA_SLOT_TYPE, u32 Slot, char *Name); + /// Notify the module we want to enter menu void MenuEnter(enum CA_SLOT_TYPE, u32 Slot); + /// Notify the module with our answer (choice nr) void MenuAnswer(enum CA_SLOT_TYPE, u32 Slot, u32 choice); + /// Notify the module with our answer (binary) void InputAnswer(enum CA_SLOT_TYPE, u32 Slot, u8 * Data, int Len); + /// Notify the module we closed the menu void MenuClose(enum CA_SLOT_TYPE, u32 Slot); + /// Get the supported CAIDs + int GetCAIDS(CaIdVector & Caids); + /// Send a CA-PMT object and Raw unparsed PMT to the CA layer + bool SendCAPMT(u64 Source, u8 DemuxSource, u8 DemuxMask, const unsigned char *CAPMT, u32 CAPMTLen, const unsigned char *RawPMT, u32 RawPMTLen); + /// Virtual destructor virtual ~cCA(); }; -#endif //__CA_H_ +#endif ///__CA_H_ diff --git a/lib/libcoolstream/cs_api.h b/lib/libcoolstream/cs_api.h index 11696daf3..294b08c26 100644 --- a/lib/libcoolstream/cs_api.h +++ b/lib/libcoolstream/cs_api.h @@ -30,7 +30,7 @@ enum CS_LOG_MODULE { CS_LOG_POWER_CLK, CS_LOG_MEM, CS_LOG_API, - CS_LOG_CA, + CS_LOG_CA }; // Initialization diff --git a/lib/libdvbsub/Makefile.am b/lib/libdvbsub/Makefile.am index e70a168f8..f77cb2709 100644 --- a/lib/libdvbsub/Makefile.am +++ b/lib/libdvbsub/Makefile.am @@ -1,6 +1,8 @@ INCLUDES = \ - -I$(top_srcdir)/src/zapit/include \ - -I$(top_srcdir)/src + -I$(top_builddir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/zapit/include if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream diff --git a/lib/libeventserver/eventserver.cpp b/lib/libeventserver/eventserver.cpp index c37f4dfda..e34c9f52f 100644 --- a/lib/libeventserver/eventserver.cpp +++ b/lib/libeventserver/eventserver.cpp @@ -31,7 +31,7 @@ #include "eventserver.h" -void CEventServer::registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string udsName) +void CEventServer::registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string &udsName) { strcpy(eventData[eventID][ClientID].udsName, udsName.c_str()); } @@ -64,7 +64,7 @@ void CEventServer::sendEvent(const unsigned int eventID, const initiators initia { eventClientMap notifyClients = eventData[eventID]; - for(eventClientMap::iterator pos = notifyClients.begin(); pos != notifyClients.end(); pos++) + for(eventClientMap::iterator pos = notifyClients.begin(); pos != notifyClients.end(); ++pos) { //allen clients ein event schicken eventClient client = pos->second; diff --git a/lib/libeventserver/eventserver.h b/lib/libeventserver/eventserver.h index f68233fe9..16a581ca2 100644 --- a/lib/libeventserver/eventserver.h +++ b/lib/libeventserver/eventserver.h @@ -68,7 +68,7 @@ class CEventServer unsigned int dataSize; }; - void registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string udsName); + void registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string &udsName); void registerEvent(const int fd); void unRegisterEvent2(const unsigned int eventID, const unsigned int ClientID); void unRegisterEvent(const int fd); diff --git a/lib/libmd5sum/Makefile.am b/lib/libmd5sum/Makefile.am index 58b5fea8f..cb8658fe8 100644 --- a/lib/libmd5sum/Makefile.am +++ b/lib/libmd5sum/Makefile.am @@ -5,5 +5,8 @@ noinst_LIBRARIES = libtuxbox-md5sum.a AM_CPPFLAGS = +INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) libtuxbox_md5sum_a_SOURCES = libmd5sum.c md5.c diff --git a/lib/libmd5sum/libmd5sum.c b/lib/libmd5sum/libmd5sum.c index f6894d495..784861f43 100644 --- a/lib/libmd5sum/libmd5sum.c +++ b/lib/libmd5sum/libmd5sum.c @@ -1,16 +1,15 @@ -#include "libmd5sum.h" -#include -#include - #ifdef HAVE_CONFIG_H # include #endif - -#include "md5.h" -#include "getline.h" +#include +#include #include #include +#include "libmd5sum.h" +#include "md5.h" +#include "getline.h" + #define STREQ(a, b) (strcmp ((a), (b)) == 0) static int have_read_stdin; diff --git a/lib/libnet/network_interfaces.cpp b/lib/libnet/network_interfaces.cpp index 3b87a0ee3..f97b2b9fe 100644 --- a/lib/libnet/network_interfaces.cpp +++ b/lib/libnet/network_interfaces.cpp @@ -24,6 +24,7 @@ #include #include #include +#include /* * Known bugs: @@ -56,7 +57,7 @@ bool write_file(const std::string filename, const std::list line) if (!out.is_open()) return false; - for (std::list::const_iterator it = line.begin(); it != line.end(); it++) + for (std::list::const_iterator it = line.begin(); it != line.end(); ++it) out << (*it) << std::endl; return true; @@ -64,7 +65,7 @@ bool write_file(const std::string filename, const std::list line) std::list::iterator add_attributes(const std::map attribute, std::list &line, std::list::iterator here) { - for (std::map::const_iterator it = attribute.begin(); it != attribute.end(); it++) + for (std::map::const_iterator it = attribute.begin(); it != attribute.end(); ++it) { std::ostringstream out; out << '\t' << (it -> first) << ' ' << (it -> second); @@ -112,7 +113,7 @@ bool write_interface(const std::string filename, const std::string name, const b if (!(in >> s)) { - it++; + ++it; continue; } @@ -135,22 +136,22 @@ bool write_interface(const std::string filename, const std::string name, const b } } if (advance) - it++; + ++it; } else - it++; + ++it; continue; } if (!(in >> s)) { - it++; + ++it; continue; } if (s != std::string(name)) { - it++; + ++it; continue; } } @@ -166,7 +167,7 @@ bool write_interface(const std::string filename, const std::string name, const b line.insert(it, "auto " + name); /* add attributes */ - it++; + ++it; it = add_attributes(attribute, line, it); /* remove current attributes */ @@ -176,13 +177,13 @@ bool write_interface(const std::string filename, const std::string name, const b if (!(in >> s)) /* retain empty lines */ { - it++; + ++it; continue; } if (s[0] == '#') /* retain comments */ { - it++; + ++it; continue; } @@ -328,7 +329,7 @@ bool getInetAttributes(const std::string name, bool &automatic_start, std::strin broadcast = ""; gateway = ""; - for (std::map::const_iterator it = attribute.begin(); it != attribute.end(); it++) + for (std::map::const_iterator it = attribute.begin(); it != attribute.end(); ++it) { if ((*it).first == "address") address = (*it).second; diff --git a/lib/libtuxtxt/Makefile.am b/lib/libtuxtxt/Makefile.am index cf638cb75..c731c0f9e 100644 --- a/lib/libtuxtxt/Makefile.am +++ b/lib/libtuxtxt/Makefile.am @@ -1,6 +1,8 @@ INCLUDES = \ - -I$(top_srcdir)/src/zapit/include \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/zapit/include \ $(FREETYPE_CFLAGS) if BOXTYPE_COOL diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 834f2ca8a..98660c2b9 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "upnpclient.h" #include @@ -387,7 +388,7 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act } path = url.substr(pos2); - if (post.size()) + if (!post.empty()) command << "POST " << path << " HTTP/1.0\r\n"; else command << "GET " << path << " HTTP/1.0\r\n"; @@ -397,18 +398,18 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act command << "Accept: text/xml\r\n"; command << "Connection: Close\r\n"; - if (post.size()) + if (!post.empty()) { command << "Content-Length: " << post.size() << "\r\n"; command << "Content-Type: text/xml\r\n"; } - if (action.size()) + if (!action.empty()) command << "SOAPAction: \"" << action << "\"\r\n"; command << "\r\n"; - if (post.size()) + if (!post.empty()) command << post; t_socket = socket(PF_INET, SOCK_STREAM, 0); @@ -445,7 +446,7 @@ std::list CUPnPDevice::SendSOAP(std::string servicename, std::str std::list::iterator i; std::list empty; - for (i=services.begin(); i != services.end(); i++) + for (i=services.begin(); i != services.end(); ++i) { if (i->servicename == servicename) return i->SendSOAP(action, attribs); @@ -458,7 +459,7 @@ std::list CUPnPDevice::GetServices(void) std::list::iterator i; std::list result; - for (i=services.begin(); i != services.end(); i++) + for (i=services.begin(); i != services.end(); ++i) result.push_back(i->servicename); return result; } diff --git a/lib/libupnpclient/UPNPService.cpp b/lib/libupnpclient/UPNPService.cpp index 7944a8aa1..7e845aa27 100644 --- a/lib/libupnpclient/UPNPService.cpp +++ b/lib/libupnpclient/UPNPService.cpp @@ -67,7 +67,7 @@ std::list CUPnPService::SendSOAP(std::string action, std::list"; } else { post << ">"; - for (i = attribs.begin(); i != attribs.end(); i++) + for (i = attribs.begin(); i != attribs.end(); ++i) { if (i->second == "") post << "<" << i->first << "/>"; diff --git a/lib/libupnpclient/UPNPSocket.cpp b/lib/libupnpclient/UPNPSocket.cpp index b56e269f5..5c3bcbe6e 100644 --- a/lib/libupnpclient/UPNPSocket.cpp +++ b/lib/libupnpclient/UPNPSocket.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "upnpclient.h" @@ -140,7 +141,7 @@ std::vector CUPnPSocket::Discover(std::string service) if (line.substr(0,7) == "http://") { std::vector::iterator i; - for (i=devices.begin(); i != devices.end(); i++) + for (i=devices.begin(); i != devices.end(); ++i) if (line == i->descurl) goto found; try diff --git a/lib/sectionsdclient/sectionsdMsg.h b/lib/sectionsdclient/sectionsdMsg.h index e6327a58f..527b45cce 100644 --- a/lib/sectionsdclient/sectionsdMsg.h +++ b/lib/sectionsdclient/sectionsdMsg.h @@ -53,21 +53,8 @@ struct sectionsd enum commands { - /* actualEPGchannelName=0,*/ - dummy1, - dummy3, //actualEventListTVshort, // commandEventListTV - /*currentNextInformation,*/ - dummy2, dumpStatusinformation, // commandDumpStatusInformation - /*allEventsChannelName,*/ allEventsChannelIDSearch, // commandAllEventsChannelIDSearch - dummy4, // setHoursToCache, - dummy5, // setHoursExtendedCache, - dummy6, // setEventsAreOldInMinutes, - dummy7, // dumpAllServices, // commandDumpAllServices - dummy8, // actualEventListRadioshort, // commandEventListRadio - dummy9, // getNextEPG, // commandGetNextEPG - dummy10,// getNextShort, // commandGetNextShort pauseScanning, // commandPauseScanning // for the grabbers ;) getIsScanningActive, // commandGetIsScanningActive actualEPGchannelID, // commandActualEPGchannelID @@ -79,11 +66,9 @@ struct sectionsd ComponentTagsUniqueKey, // commandComponentTagsUniqueKey allEventsChannelID_, // commandAllEventsChannelID timesNVODservice, // commandTimesNVODservice - getEPGPrevNext, // commandGetEPGPrevNext getIsTimeSet, // commandGetIsTimeSet serviceChanged, // commandserviceChanged LinkageDescriptorsUniqueKey, // commandLinkageDescriptorsUniqueKey - pauseSorting, // commandPauseSorting CMD_registerEvents, // commandRegisterEventClient CMD_unregisterEvents, // commandUnRegisterEventClient #ifdef ENABLE_PPT @@ -91,20 +76,11 @@ struct sectionsd #else dummy11_setPrivatePid, #endif - setSectionsdScanMode, // commandSetSectionsdScanMode freeMemory, // commandFreeMemory readSIfromXML, // commandReadSIfromXML writeSI2XML, // commandWriteSI2XML - LoadLanguages, // commandLoadLanguages - SaveLanguages, // commandSaveLanguages - SetLanguages, // commandSetLanguages - GetLanguages, // commandGetLanguages - SetLanguageMode, // commandSetLanguageMode - GetLanguageMode, // commandGetLanguageMode setConfig, // commandSetConfig - Restart, // commandRestart - ping, numberOfCommands // <- no actual command, end of command marker }; diff --git a/lib/sectionsdclient/sectionsdclient.cpp b/lib/sectionsdclient/sectionsdclient.cpp index 55db153f6..97eadb83d 100644 --- a/lib/sectionsdclient/sectionsdclient.cpp +++ b/lib/sectionsdclient/sectionsdclient.cpp @@ -120,27 +120,6 @@ bool CSectionsdClient::getIsTimeSet() } } - -#if 0 -void CSectionsdClient::setEventsAreOldInMinutes(const unsigned short minutes) -{ - send(sectionsd::setEventsAreOldInMinutes, (char*)&minutes, sizeof(minutes)); - - readResponse(); - close_connection(); -} -#endif - -void CSectionsdClient::setPauseSorting(const bool doPause) -{ - int PauseIt = (doPause) ? 1 : 0; - - send(sectionsd::pauseSorting, (char*)&PauseIt, sizeof(PauseIt)); - - readResponse(); - close_connection(); -} - void CSectionsdClient::setPauseScanning(const bool doPause) { int PauseIt = (doPause) ? 1 : 0; @@ -738,15 +717,6 @@ void CSectionsdClient::setPrivatePid(const unsigned short pid) close_connection(); } #endif -#if 0 -void CSectionsdClient::setSectionsdScanMode(const int scanMode) -{ - send(sectionsd::setSectionsdScanMode, (char*)&scanMode, sizeof(scanMode)); - - readResponse(); - close_connection(); -} -#endif void CSectionsdClient::freeMemory() { diff --git a/lib/sectionsdclient/sectionsdclient.h b/lib/sectionsdclient/sectionsdclient.h index ae876668e..d42e99237 100644 --- a/lib/sectionsdclient/sectionsdclient.h +++ b/lib/sectionsdclient/sectionsdclient.h @@ -174,14 +174,10 @@ class CSectionsdClient : private CBasicClient bool getIsTimeSet(); -// void setEventsAreOldInMinutes(const unsigned short minutes); - void setPauseScanning(const bool doPause); bool getIsScanningActive(); - void setPauseSorting(const bool doPause); - void setServiceChanged(const t_channel_id channel_id, const bool requestEvent); CChannelEventList getChannelEvents(const bool tv_mode = true, t_channel_id* = NULL, int size = 0); @@ -198,8 +194,6 @@ class CSectionsdClient : private CBasicClient void setPrivatePid(const unsigned short pid); -// void setSectionsdScanMode(const int scanMode); - void freeMemory(); void readSIfromXML(const char * epgxmlname); diff --git a/lib/sectionsdclient/sectionsdcontrol.cpp b/lib/sectionsdclient/sectionsdcontrol.cpp index 365100e21..505dd80f5 100644 --- a/lib/sectionsdclient/sectionsdcontrol.cpp +++ b/lib/sectionsdclient/sectionsdcontrol.cpp @@ -70,6 +70,11 @@ int main(int argc, char** argv) if (!strcmp(argv[i], "--dump")) { client.dumpStatus(); } + else + if (!strcmp(argv[i], "--freemem")) { + printf("Removing all cached epg...\n"); + client.freeMemory(); + } } return 0; diff --git a/lib/timerdclient/timerdclient.cpp b/lib/timerdclient/timerdclient.cpp index 8ad4e967d..0926748a9 100644 --- a/lib/timerdclient/timerdclient.cpp +++ b/lib/timerdclient/timerdclient.cpp @@ -247,7 +247,7 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, //printf("[CTimerdClient] checking for overlapping timers\n"); CTimerd::TimerList overlappingTimer; overlappingTimer = getOverlappingTimers(alarmtime, stoptime); - if (overlappingTimer.size() > 0) + if (!overlappingTimer.empty()) { // timerd starts eventID at 0 so we can return -1 return -1; @@ -357,7 +357,7 @@ CTimerd::TimerList CTimerdClient::getOverlappingTimers(time_t& startTime, time_t getRecordingSafety(timerPre,timerPost); for (CTimerd::TimerList::iterator it = timerlist.begin(); - it != timerlist.end();it++) + it != timerlist.end();++it) { if(it->stopTime != 0 && stopTime != 0) { diff --git a/lib/xmltree/Makefile.am b/lib/xmltree/Makefile.am index fc2d4201e..ab256f85a 100644 --- a/lib/xmltree/Makefile.am +++ b/lib/xmltree/Makefile.am @@ -1,4 +1,7 @@ -INCLUDES = -I$(srcdir)/xmltok +INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + -I$(srcdir)/xmltok AM_CXXFLAGS = -fno-rtti -fno-exceptions diff --git a/lib/xmltree/hashtab.c b/lib/xmltree/hashtab.c index 9e164a959..9b7defc60 100644 --- a/lib/xmltree/hashtab.c +++ b/lib/xmltree/hashtab.c @@ -21,7 +21,7 @@ Contributor(s): #include #include -#include "xmldef.h" +#include #include "hashtab.h" #ifdef XML_UNICODE diff --git a/lib/xmltree/xmlinterface.cpp b/lib/xmltree/xmlinterface.cpp index 2b118ebf2..a1699d612 100644 --- a/lib/xmltree/xmlinterface.cpp +++ b/lib/xmltree/xmlinterface.cpp @@ -40,7 +40,7 @@ #include #include #else /* USE_LIBXML */ -#include +#include "xmltok.h" #endif /* USE_LIBXML */ @@ -114,7 +114,8 @@ std::string convert_UTF8_To_UTF8_XML(const char* s) r += "'"; break; default: - r += *s; + if ((unsigned char)*s >= 32) + r += *s; } s++; } diff --git a/lib/xmltree/xmlinterface.h b/lib/xmltree/xmlinterface.h index 037731815..97d7b8325 100644 --- a/lib/xmltree/xmlinterface.h +++ b/lib/xmltree/xmlinterface.h @@ -33,7 +33,7 @@ #define __xmlinterface_h__ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include diff --git a/lib/xmltree/xmlparse.cpp b/lib/xmltree/xmlparse.cpp index 95643c609..d0a531824 100644 --- a/lib/xmltree/xmlparse.cpp +++ b/lib/xmltree/xmlparse.cpp @@ -392,7 +392,8 @@ long XML_Parser::GetCurrentByteIndex() int XML_Parser::GetCurrentLineNumber() { - if (eventPtr) + /* at EOF positionPtr point to input, while eventPtr not updated -- focus */ + if (eventPtr && (positionPtr < eventPtr)) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr=eventPtr; diff --git a/src/Makefile.am b/src/Makefile.am index dccfc6bbd..3b6559367 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,11 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -SUBDIRS = zapit gui daemonc driver system sectionsd timerd nhttpd +SUBDIRS = zapit gui daemonc driver system eitd timerd nhttpd INCLUDES = \ - -I$(top_srcdir)/daemons \ + -I$(srcdir) \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/lib/connection \ @@ -62,7 +64,7 @@ neutrino_LDADD = \ system/libneutrino_system.a \ gui/movieinfo.o \ gui/libneutrino_gui2.a \ - sectionsd/libsectionsd.a \ + eitd/libsectionsd.a \ driver/libneutrino_driver.a \ driver/audiodec/libneutrino_driver_audiodec.a \ driver/libneutrino_driver_netfile.a \ @@ -94,11 +96,17 @@ neutrino_LDADD = \ @AVCODEC_LIBS@ \ $(FLACLIBS) \ $(VORBISLIBS) \ - -lungif \ + -ldvbsi++ \ -ljpeg \ -lOpenThreads \ -lrt -lpthread +if ENABLE_GIFLIB +neutrino_LDADD += -lgif +else +neutrino_LDADD += -lungif +endif + if ENABLE_UPNP neutrino_LDADD += \ $(top_builddir)/lib/libupnpclient/libtuxbox-upnpclient.a diff --git a/src/daemonc/Makefile.am b/src/daemonc/Makefile.am index 7274ed345..b57f8f2e5 100644 --- a/src/daemonc/Makefile.am +++ b/src/daemonc/Makefile.am @@ -1,15 +1,16 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions INCLUDES = \ - -I$(top_srcdir)/daemons \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/libeventserver \ -I$(top_srcdir)/lib/libconfigfile \ -I$(top_srcdir)/lib/libnet \ -I$(top_srcdir)/lib/xmltree \ - @FREETYPE_CFLAGS@ \ - -I$(top_srcdir)/lib + @FREETYPE_CFLAGS@ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 4836f7435..17dbb8928 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -41,8 +41,8 @@ #include #include -#include #include +#include #include "libdvbsub/dvbsub.h" #include "libtuxtxt/teletext.h" @@ -51,6 +51,8 @@ #include #include +#define ZAP_GUARD_TIME 2000 // ms + extern CBouquetManager *g_bouquetManager; extern uint32_t scrambled_timer; @@ -89,7 +91,7 @@ CSubService::CSubService(const t_original_network_id anoriginal_network_id, cons t_channel_id CSubService::getChannelID(void) const { return ((uint64_t) ( satellitePosition >= 0 ? satellitePosition : (uint64_t)(0xF000+ abs(satellitePosition))) << 48) | - (uint64_t) CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(service.service_id, service.original_network_id, service.transport_stream_id); + (uint64_t) CREATE_CHANNEL_ID(service.service_id, service.original_network_id, service.transport_stream_id); } @@ -102,7 +104,6 @@ CRemoteControl::CRemoteControl() zap_completion_timeout = 0; current_EPGid = 0; - next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); has_ac3 = false; selected_subchannel = -1; @@ -110,6 +111,7 @@ CRemoteControl::CRemoteControl() director_mode = 0; // current_programm_timer = 0; is_video_started = true; + //next_EPGid = 0; } @@ -123,9 +125,9 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data if ((*(t_channel_id *)data) != current_channel_id) { g_InfoViewer->chanready = 0; g_Zapit->zapTo_serviceID_NOWAIT(current_channel_id ); - g_Sectionsd->setServiceChanged(current_channel_id &0xFFFFFFFFFFFFULL, false); + //g_Sectionsd->setServiceChanged(current_channel_id, false); - zap_completion_timeout = getcurrenttime() + 2 * (int64_t) 1000000; + zap_completion_timeout = time_monotonic_ms() + ZAP_GUARD_TIME; return messages_return::handled; } @@ -158,7 +160,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data current_channel_id = new_id; current_EPGid = 0; - next_EPGid = 0; + //next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); @@ -170,7 +172,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data director_mode = 0; needs_nvods = (msg == NeutrinoMessages:: EVT_ZAP_ISNVOD); - g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, true ); + //g_Sectionsd->setServiceChanged( current_channel_id, true ); CNeutrinoApp::getInstance()->channelList->adjustToChannelID(current_channel_id); if ( g_InfoViewer->is_visible ) g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR , 0 ); @@ -248,7 +250,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data { if ((*(t_channel_id *)data) != current_channel_id) return messages_return::handled; - +#if 0 const CSectionsdClient::CurrentNextInfo info_CN = g_InfoViewer->getCurrentNextInfo(); if ((info_CN.next_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL) ) { @@ -256,6 +258,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data if (info_CN.next_uniqueKey != next_EPGid) next_EPGid = info_CN.next_uniqueKey; } +#endif if ( !is_video_started ) g_RCInput->postMsg( NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false ); return messages_return::handled; @@ -310,11 +313,11 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data { getNVODs(); if (subChannels.empty()) - g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, true ); + g_Sectionsd->setServiceChanged( current_channel_id, true ); } else // EVENT anfordern! - g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, true ); + g_Sectionsd->setServiceChanged( current_channel_id, true ); } return messages_return::handled; @@ -331,6 +334,15 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data return messages_return::handled; } #endif + else if (msg == NeutrinoMessages::EVT_TUNE_COMPLETE) { + t_channel_id chid = *(t_channel_id *)data; +printf("CRemoteControl::handleMsg: EVT_TUNE_COMPLETE (%016llx)\n", chid); + if(chid) + g_Sectionsd->setServiceChanged( chid, true ); + else + g_Sectionsd->setServiceChanged( current_channel_id, true ); + return messages_return::handled; + } //else if (msg == NeutrinoMessages::EVT_ZAP_FAILED || msg == NeutrinoMessages::EVT_ZAP_SUB_FAILED) //return messages_return::handled; else @@ -340,7 +352,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data void CRemoteControl::getSubChannels() { //printf("[neutrino] getSubChannels, current_EPGid %llx\n", current_EPGid); - if ( subChannels.size() == 0 ) + if ( subChannels.empty() ) { CSectionsdClient::LinkageDescriptorList linkedServices; //if ( g_Sectionsd->getLinkageDescriptorsUniqueKey( current_EPGid, linkedServices ) ) @@ -352,12 +364,12 @@ void CRemoteControl::getSubChannels() //printf("CRemoteControl::getSubChannels linkedServices.size %d\n", linkedServices.size()); for (unsigned int i=0; i< linkedServices.size(); i++) { -//printf("CRemoteControl::getSubChannels %s\n", linkedServices[i].name.c_str()); subChannels.push_back(CSubService( linkedServices[i].originalNetworkId, linkedServices[i].serviceId, linkedServices[i].transportStreamId, linkedServices[i].name)); +//printf("CRemoteControl::getSubChannels %s: %016llx\n", linkedServices[i].name.c_str(), subChannels[i].getChannelID()); if ((subChannels[i].getChannelID()&0xFFFFFFFFFFFFULL) == (current_channel_id&0xFFFFFFFFFFFFULL)) selected_subchannel = i; } @@ -374,7 +386,7 @@ void CRemoteControl::getSubChannels() void CRemoteControl::getNVODs() { //printf("[neutrino] getNVODs, current_EPGid %llx\n", current_EPGid); - if ( subChannels.size() == 0 ) + if ( subChannels.empty() ) { CSectionsdClient::NVODTimesList NVODs; //if ( g_Sectionsd->getNVODTimesServiceKey( current_channel_id & 0xFFFFFFFFFFFFULL, NVODs ) ) @@ -427,7 +439,7 @@ void CRemoteControl::getNVODs() void CRemoteControl::processAPIDnames() { has_unresolved_ctags= false; - has_ac3 = false; //FIXME what this variable suppoused to do ?? seems unused + has_ac3 = false; //use in infoviewer int pref_found = -1; int pref_ac3_found = -1; int pref_idx = -1; @@ -456,7 +468,7 @@ void CRemoteControl::processAPIDnames() std::string temp(g_settings.pref_lang[i]); std::map::const_iterator it; - for(it = iso639.begin(); it != iso639.end(); it++) { + for(it = iso639.begin(); it != iso639.end(); ++it) { if(temp == it->second && strcasecmp(desc, it->first.c_str()) == 0) { /* remember first pref found index and pid*/ if(pref_found < 0) { @@ -563,7 +575,7 @@ void CRemoteControl::copySubChannelsToZapit(void) { CZapitClient::subServiceList zapitList; - for (CSubServiceListSorted::const_iterator e = subChannels.begin(); e != subChannels.end(); e++) + for (CSubServiceListSorted::const_iterator e = subChannels.begin(); e != subChannels.end(); ++e) zapitList.push_back(e->getAsZapitSubService()); g_Zapit->setSubServices(zapitList); @@ -597,22 +609,22 @@ const std::string & CRemoteControl::setSubChannel(const int numSub, const bool f g_Zapit->zapTo_subServiceID_NOWAIT( current_sub_channel_id ); // Houdini: to restart reading the private EPG when switching to a new option - g_Sectionsd->setServiceChanged( current_sub_channel_id , true ); + //g_Sectionsd->setServiceChanged( current_sub_channel_id , true ); return subChannels[numSub].subservice_name; } const std::string & CRemoteControl::subChannelUp(void) { - //return setSubChannel((subChannels.size() == 0) ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); + //return setSubChannel((subChannels.empty()) ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); // if there are any NVOD/subchannels switch these else switch audio channel (if any) - if (subChannels.size() > 0 || !g_settings.audiochannel_up_down_enable) + if ( !subChannels.empty() || !g_settings.audiochannel_up_down_enable) { - return setSubChannel((subChannels.size() == 0) ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); + return setSubChannel( subChannels.empty() ? -1 : (int)((selected_subchannel + 1) % subChannels.size())); } else { - if (current_PIDs.APIDs.size() > 0) + if ( !current_PIDs.APIDs.empty() ) { setAPID((current_PIDs.PIDs.selected_apid + 1) % current_PIDs.APIDs.size()); } @@ -624,13 +636,13 @@ const std::string & CRemoteControl::subChannelDown(void) { //return setSubChannel((selected_subchannel <= 0) ? (subChannels.size() - 1) : (selected_subchannel - 1)); // if there are any NVOD/subchannels switch these else switch audio channel (if any) - if (subChannels.size() > 0 || !g_settings.audiochannel_up_down_enable) + if ( !subChannels.empty() || !g_settings.audiochannel_up_down_enable) { return setSubChannel((selected_subchannel <= 0) ? (subChannels.size() - 1) : (selected_subchannel - 1)); } else { - if (current_PIDs.APIDs.size() > 0) + if ( !current_PIDs.APIDs.empty() ) { if (current_PIDs.PIDs.selected_apid <= 0) setAPID(current_PIDs.APIDs.size() - 1); @@ -641,7 +653,6 @@ const std::string & CRemoteControl::subChannelDown(void) } } -void stopAutoRecord(); void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, const bool start_video) // UTF-8 { current_channel_id = channel_id; @@ -654,7 +665,7 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s current_sub_channel_id = 0; current_EPGid = 0; - next_EPGid = 0; + //next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); @@ -666,7 +677,7 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s needs_nvods = false; director_mode = 0; - uint64_t now = getcurrenttime(); + uint64_t now = time_monotonic_ms(); if ( zap_completion_timeout < now ) { g_InfoViewer->chanready = 0; @@ -677,9 +688,9 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s //dvbsub_pause(true); CZapit::getInstance()->Abort(); g_Zapit->zapTo_serviceID_NOWAIT(channel_id); - g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, false ); - zap_completion_timeout = now + 2 * (int64_t) 1000000; + zap_completion_timeout = now + ZAP_GUARD_TIME; + //g_Sectionsd->setServiceChanged( current_channel_id, false ); // g_RCInput->killTimer( current_programm_timer ); } } diff --git a/src/daemonc/remotecontrol.h b/src/daemonc/remotecontrol.h index c3151bb41..b18201eee 100644 --- a/src/daemonc/remotecontrol.h +++ b/src/daemonc/remotecontrol.h @@ -83,7 +83,7 @@ class CRemoteControl public: t_channel_id current_channel_id; uint64_t current_EPGid; - uint64_t next_EPGid; + //uint64_t next_EPGid; CZapitClient::responseGetPIDs current_PIDs; // APID - Details diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 9728d8560..d7921afda 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -3,15 +3,16 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions SUBDIRS = pictureviewer audiodec INCLUDES = \ - -I$(top_srcdir)/daemons \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/libnet \ -I$(top_srcdir)/lib/libconfigfile \ -I$(top_srcdir)/lib/connection \ -I$(top_srcdir)/lib/libeventserver \ - @FREETYPE_CFLAGS@ \ - -I$(top_srcdir)/lib + @FREETYPE_CFLAGS@ noinst_LIBRARIES = libneutrino_driver.a libneutrino_driver_netfile.a diff --git a/src/driver/abstime.c b/src/driver/abstime.c index c2af8d4f7..af7c1c7fc 100644 --- a/src/driver/abstime.c +++ b/src/driver/abstime.c @@ -1,3 +1,4 @@ +#include #include /* for perror */ #include @@ -27,3 +28,14 @@ time_t time_monotonic(void) time comparisons if the uptime is low, so add 7 days */ return t.tv_sec + 604800; } + +uint64_t time_monotonic_us(void) +{ + struct timespec t; + if (clock_gettime(CLOCK_MONOTONIC, &t)) + { + perror("time_monotonic_us clock_gettime"); + return -1; + } + return ((int64_t)t.tv_sec + (uint64_t)604800) * (uint64_t) 1000000 + (uint64_t) t.tv_nsec / (uint64_t)1000; +} diff --git a/src/driver/abstime.h b/src/driver/abstime.h index bbd000993..b530755b6 100644 --- a/src/driver/abstime.h +++ b/src/driver/abstime.h @@ -1,3 +1,5 @@ +#include + #ifndef _ABS_TIME_H_ #define _ABS_TIME_H_ #ifdef __cplusplus @@ -6,6 +8,7 @@ extern "C" #endif extern time_t time_monotonic_ms(void); extern time_t time_monotonic(void); +uint64_t time_monotonic_us(void); #ifdef __cplusplus } #endif diff --git a/src/driver/audiodec/Makefile.am b/src/driver/audiodec/Makefile.am index 374004b23..4250e31c8 100644 --- a/src/driver/audiodec/Makefile.am +++ b/src/driver/audiodec/Makefile.am @@ -1,12 +1,15 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ - -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src/driver/audiodec \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/lib/libconfigfile \ - @FREETYPE_CFLAGS@ \ - @VORBISIDEC_CFLAGS@ + @FREETYPE_CFLAGS@ \ + @VORBISIDEC_CFLAGS@ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream diff --git a/src/driver/audiodec/basedec.cpp b/src/driver/audiodec/basedec.cpp index 6a88b8028..08dfed926 100644 --- a/src/driver/audiodec/basedec.cpp +++ b/src/driver/audiodec/basedec.cpp @@ -27,12 +27,6 @@ #ifdef HAVE_CONFIG_H #include #endif - -#include -#include -#include -#include -#include #ifdef ENABLE_FLAC #include #endif @@ -47,6 +41,11 @@ #include #include +#include "basedec.h" +#include "cdrdec.h" +#include "mp3dec.h" +#include "oggdec.h" +#include "wavdec.h" #include unsigned int CBaseDec::mSamplerate=0; diff --git a/src/driver/audiodec/cdrdec.cpp b/src/driver/audiodec/cdrdec.cpp index 1d483d4ee..8ba63bcb5 100644 --- a/src/driver/audiodec/cdrdec.cpp +++ b/src/driver/audiodec/cdrdec.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include "cdrdec.h" CCdrDec* CCdrDec::getInstance() { diff --git a/src/driver/audiodec/cdrdec.h b/src/driver/audiodec/cdrdec.h index 65217aa3e..64e0250e1 100644 --- a/src/driver/audiodec/cdrdec.h +++ b/src/driver/audiodec/cdrdec.h @@ -29,7 +29,7 @@ #ifndef __CDR_DEC__ #define __CDR_DEC__ -#include +#include "wavdec.h" class CCdrDec : public CWavDec { diff --git a/src/driver/audiodec/flacdec.cpp b/src/driver/audiodec/flacdec.cpp index 53b6b7b0a..f988940f8 100644 --- a/src/driver/audiodec/flacdec.cpp +++ b/src/driver/audiodec/flacdec.cpp @@ -38,9 +38,9 @@ #include #include #include -#include #include +#include extern cAudio *audioDecoder; #define ProgName "FlacDec" diff --git a/src/driver/audiodec/flacdec.h b/src/driver/audiodec/flacdec.h index 8d92617b4..269432676 100644 --- a/src/driver/audiodec/flacdec.h +++ b/src/driver/audiodec/flacdec.h @@ -31,9 +31,9 @@ #include #include #include -#include #include #include +#include "basedec.h" #define DECODE_SLOTS 30 diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index 595a31815..8c8a678fc 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -53,8 +52,9 @@ #include #include -#include #include +#include "mp3dec.h" +#include extern cAudio * audioDecoder; diff --git a/src/driver/audiodec/mp3dec.h b/src/driver/audiodec/mp3dec.h index b18924a9d..cafdc4f9c 100644 --- a/src/driver/audiodec/mp3dec.h +++ b/src/driver/audiodec/mp3dec.h @@ -42,11 +42,12 @@ #include #include #include -#include #include + +#include "basedec.h" extern "C" { -#include "driver/audiodec/tag.h" +#include "tag.h" } class CMP3Dec : public CBaseDec diff --git a/src/driver/audiodec/oggdec.cpp b/src/driver/audiodec/oggdec.cpp index a494abd37..c3de04273 100644 --- a/src/driver/audiodec/oggdec.cpp +++ b/src/driver/audiodec/oggdec.cpp @@ -32,14 +32,16 @@ #include #include -#include #include #include #include -#include #include +#include "oggdec.h" + +#include + extern cAudio * audioDecoder; #define ProgName "OggDec" diff --git a/src/driver/audiodec/oggdec.h b/src/driver/audiodec/oggdec.h index e08189bf3..f3948d3d4 100644 --- a/src/driver/audiodec/oggdec.h +++ b/src/driver/audiodec/oggdec.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #ifdef USE_TREMOR #include @@ -46,6 +45,8 @@ #include #endif +#include "basedec.h" + #define DECODE_SLOTS 30 class COggDec : public CBaseDec diff --git a/src/driver/audiodec/tag.c b/src/driver/audiodec/tag.c index 1aeefd20a..e3efe9834 100644 --- a/src/driver/audiodec/tag.c +++ b/src/driver/audiodec/tag.c @@ -20,7 +20,7 @@ */ # ifdef HAVE_CONFIG_H -# include "config.h" +# include # endif //# include "global.h" diff --git a/src/driver/audiodec/vis.cpp b/src/driver/audiodec/vis.cpp index f2311a848..179d817a1 100644 --- a/src/driver/audiodec/vis.cpp +++ b/src/driver/audiodec/vis.cpp @@ -19,13 +19,17 @@ #include #include + #if HAVE_COOL_HARDWARE #include #endif + #if HAVE_TRIPLEDRAGON #include #endif + #include "int_fft.c" + typedef signed short gint16; typedef int gint; typedef float gfloat; diff --git a/src/driver/audiodec/wavdec.cpp b/src/driver/audiodec/wavdec.cpp index 895f12ccc..0ab88aa10 100644 --- a/src/driver/audiodec/wavdec.cpp +++ b/src/driver/audiodec/wavdec.cpp @@ -34,12 +34,13 @@ #include #include #include -#include #include #include #include #include +#include "wavdec.h" + extern cAudio * audioDecoder; #define ProgName "WavDec" @@ -51,18 +52,18 @@ extern cAudio * audioDecoder; struct WavHeader { char ChunkID[4]; - int ChunkSize; +// int ChunkSize; char Format[4]; - char Subchunk1ID[4]; - int Subchunk1Size; +// char Subchunk1ID[4]; +// int Subchunk1Size; short AudioFormat; short NumChannels; int SampleRate; int ByteRate; - short BlockAlign; +// short BlockAlign; short BitsPerSample; - char Subchunk2ID[4]; - int Subchunk2Size; +// char Subchunk2ID[4]; +// int Subchunk2Size; } __attribute__ ((packed)); int endianTest=1; @@ -90,12 +91,12 @@ CBaseDec::RetCode CWavDec::Decoder(FILE *in, int /*OutputFd*/, State* state, CAu return Status; } fseek(in, header_size, SEEK_SET); - int fmt; +// int fmt; switch(mBitsPerSample) { - case 8 : fmt = AFMT_U8; + case 8 : //fmt = AFMT_U8; break; - case 16 : fmt = header_size == 0 ? AFMT_S16_BE : AFMT_S16_LE; + case 16 : //fmt = header_size == 0 ? AFMT_S16_BE : AFMT_S16_LE; break; default: printf("%s: wrong bits per sample (%d)\n", ProgName, mBitsPerSample); diff --git a/src/driver/audiodec/wavdec.h b/src/driver/audiodec/wavdec.h index 5a9a9fadb..f8f4ccb58 100644 --- a/src/driver/audiodec/wavdec.h +++ b/src/driver/audiodec/wavdec.h @@ -30,7 +30,7 @@ #define __WAV_DEC__ #include -#include +#include "basedec.h" class CWavDec : public CBaseDec { diff --git a/src/driver/aviaext.cpp b/src/driver/aviaext.cpp deleted file mode 100644 index 22a51e7c0..000000000 --- a/src/driver/aviaext.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - LCD-Daemon - DBoxII-Project - - Copyright (C) 2004 Zwen@tuxbox.org - - License: GPL - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#if 1 -#include -#include - -#define AVIAEXT_DEV "/dev/dbox/aviaEXT" - -CAViAExt* CAViAExt::getInstance() -{ - static CAViAExt* AViAExt = NULL; - if(AViAExt == NULL) - { - AViAExt = new CAViAExt(); - } - return AViAExt; -} - -void CAViAExt::iecOn() -{ - int res,fd; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return; - } - res = ioctl(fd, AVIA_EXT_IEC_SET, 1); - if (res<0) - perror("aviaext: ioctl"); - close(fd); -} - -void CAViAExt::iecOff() -{ - int res,fd; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return; - } - res = ioctl(fd, AVIA_EXT_IEC_SET, 0); - if (res<0) - perror("aviaext: ioctl"); - close(fd); -} - -int CAViAExt::iecState() -{ - int res,fd; - unsigned int param; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return -1; - } - res = ioctl(fd, AVIA_EXT_IEC_GET, ¶m); - - close(fd); - - if (res<0) - { - perror("aviaext: ioctl"); - return -1; - } - return param; -} - -void CAViAExt::playbackSPTS() -{ - int res,fd; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return; - } - res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_SET, 1); - if (res<0) - perror("aviaext: ioctl"); - close(fd); -} - -void CAViAExt::playbackPES() -{ - int res,fd; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return; - } - res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_SET, 0); - if (res<0) - perror("aviaext: ioctl"); - close(fd); -} - -int CAViAExt::playbackState() -{ - int res,fd; - unsigned int param; - - if ((fd = open(AVIAEXT_DEV,O_RDWR))<0) - { - if (errno==ENOENT) - fprintf (stderr,"%s does not exist, did you forget to load the aviaEXT module?\n",AVIAEXT_DEV); - else - perror ("aviaext: error opening /dev/dbox/aviaEXT"); - return -1; - } - res = ioctl(fd, AVIA_EXT_AVIA_PLAYBACK_MODE_GET, ¶m); - - close(fd); - - if (res<0) - { - perror("aviaext: ioctl"); - return -1; - } - return param; -} -#endif diff --git a/src/driver/bigclock.cpp b/src/driver/bigclock.cpp deleted file mode 100644 index e5264f59b..000000000 --- a/src/driver/bigclock.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - LCD-Daemon - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - - - License: GPL - - 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. -*/ - - -#include "bigclock.h" - - -void doppelpunkt(CLCDDisplay* display, int pos) -{ - int i,j; - - for (i=1;i<=4;i++) - for (j=1;j<=4;j++) - display->draw_point(i+10+pos*24-3,j+23,CLCDDisplay::PIXEL_ON); - for (i=1;i<=4;i++) - for (j=1;j<=4;j++) - display->draw_point(i+10+pos*24-3,j+37,CLCDDisplay::PIXEL_ON); -} - - -void balken(CLCDDisplay* display, int pos, int balken) -{ - int i,j; - - if (balken==3||balken==6||balken==7) - { - //horizontaler balken - if (balken == 6) for (i=1;i<=14;i++) for (j=1;j<=4;j++) display->draw_point(i+5+pos*24-3,j+14,CLCDDisplay::PIXEL_ON); - if (balken == 7) for (i=1;i<=8;i++) for (j=1;j<=4;j++) display->draw_point(i+8+pos*24-3,j+30,CLCDDisplay::PIXEL_ON); - } if (balken == 3) for (i=1;i<=14;i++) for (j=1;j<=4;j++) display->draw_point(i+5+pos*24-3,j+46,CLCDDisplay::PIXEL_ON); - else - { - //vertikaler balken - if (balken == 1) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+19+pos*24-3,j+18,CLCDDisplay::PIXEL_ON); - if (balken == 2) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+19+pos*24-3,j+33,CLCDDisplay::PIXEL_ON); - if (balken == 5) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+1+pos*24-3,j+18,CLCDDisplay::PIXEL_ON); - if (balken == 4) for (i=1;i<=4;i++) for (j=1;j<=13;j++) display->draw_point(i+1+pos*24-3,j+33,CLCDDisplay::PIXEL_ON); - - } -} - -void showBigClock(CLCDDisplay* display, int h, int m) -{ - - //stunden einer - if (h==0||h==10||h==20) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6);} - if (h==1||h==11||h==21) - { balken(display, 1,1); balken(display, 1,2);} - if (h==2||h==12||h==22) - { balken(display, 1,1); balken(display, 1,7); balken(display, 1,3); balken(display, 1,4); balken(display, 1,6);} - if (h==3||h==13||h==23) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,7); balken(display, 1,6);} - if (h==4||h==14) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,7); balken(display, 1,5);} - if (h==5||h==15) - { balken(display, 1,2); balken(display, 1,3); balken(display, 1,5); balken(display, 1,6); balken(display, 1,7);} - if (h==6||h==16) - { balken(display, 1,7); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6);} - if (h==7||h==17) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,6);} - if (h==8||h==18) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,4); balken(display, 1,5); balken(display, 1,6); balken(display, 1,7);} - if (h==9||h==19) - { balken(display, 1,1); balken(display, 1,2); balken(display, 1,3); balken(display, 1,7); balken(display, 1,5); balken(display, 1,6);} - //stunden zehner - if (h>9&&h<20){ balken(display, 0,1); balken(display, 0,2);} - if (h>19) { balken(display, 0,1); balken(display, 0,7); balken(display, 0,3); balken(display, 0,4); balken(display, 0,6);} - - - //minuten einer - if (m==0||m==10||m==20||m==30||m==40||m==50) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6);} - if (m==1||m==11||m==21||m==31||m==41||m==51) - { balken(display, 4,1); balken(display, 4,2);} - if (m==2||m==12||m==22||m==32||m==42||m==52) - { balken(display, 4,1); balken(display, 4,7); balken(display, 4,3); balken(display, 4,4); balken(display, 4,6);} - if (m==3||m==13||m==23||m==33||m==43||m==53) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,7); balken(display, 4,6);} - if (m==4||m==14||m==24||m==34||m==44||m==54) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,7); balken(display, 4,5);} - if (m==5||m==15||m==25||m==35||m==45||m==55) - { balken(display, 4,2); balken(display, 4,3); balken(display, 4,5); balken(display, 4,6); balken(display, 4,7);} - if (m==6||m==16||m==26||m==36||m==46||m==56) - { balken(display, 4,7); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6);} - if (m==7||m==17||m==27||m==37||m==47||m==57) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,6);} - if (m==8||m==18||m==28||m==38||m==48||m==58) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,4); balken(display, 4,5); balken(display, 4,6); balken(display, 4,7);} - if (m==9||m==19||m==29||m==39||m==49||m==59) - { balken(display, 4,1); balken(display, 4,2); balken(display, 4,3); balken(display, 4,7); balken(display, 4,5); balken(display, 4,6);} - - //minuten zehner - if (m<10) - { balken(display, 3,1); balken(display, 3,2); balken(display, 3,3); balken(display, 3,4); balken(display, 3,5); balken(display, 3,6);} - if (m>9&&m<20){ balken(display, 3,1); balken(display, 3,2);} - if (m>19&&m<30){ balken(display, 3,1); balken(display, 3,7); balken(display, 3,3); balken(display, 3,4); balken(display, 3,6);} - if (m>29&&m<40){ balken(display, 3,1); balken(display, 3,2); balken(display, 3,3); balken(display, 3,7); balken(display, 3,6);} - if (m>39&&m<50){ balken(display, 3,1); balken(display, 3,2); balken(display, 3,7); balken(display, 3,5);} - if (m>=50) { balken(display, 3,2); balken(display, 3,3); balken(display, 3,5); balken(display, 3,6); balken(display, 3,7);} - - doppelpunkt(display, 2); - } diff --git a/src/driver/bigclock.h b/src/driver/bigclock.h deleted file mode 100644 index 91735f93c..000000000 --- a/src/driver/bigclock.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - LCD-Daemon - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - - - License: GPL - - 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. -*/ - -#ifndef __bigclock__ -#define __bigclock__ - -#include - - -void showBigClock(CLCDDisplay* display, int h,int m); - - -#endif diff --git a/src/driver/capture.cpp b/src/driver/capture.cpp deleted file mode 100644 index 35c580b42..000000000 --- a/src/driver/capture.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - - License: GPL - - 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. -*/ - - - - - -#include -#include -#include -#include -#include -#include -#include - -#include "capture.h" - - -#include -#warning "experimental..." - - -// -// -- TV Picture Capture -// -- This module is a class to provide a capture abstraction layer -// -- -// -- 2003-12 rasc -// - - - -// -// -- Constructor -// - -CCAPTURE::CCAPTURE() -{ - fd = -1; -} - - -CCAPTURE::CCAPTURE(int capture_nr) -{ - fd = -1; - fd = captureopen(capture_nr); -} - - -CCAPTURE::CCAPTURE(int capture_nr, int x, int y, int w, int h) -{ - fd = -1; - fd = captureopen (capture_nr); - set_coord (x,y, w,h); -} - - - - -CCAPTURE::~CCAPTURE() -{ - captureclose (); // cleanup anyway!! -} - - -// -// -- open Capture device -// -- return >=0: ok -// - -int CCAPTURE::captureopen (int cap_nr) -{ - char *capturedevs[] = { - CAPTURE_DEV "0" // CAPTURE device 0 - // CAPTURE_DEV "1", // CAPTURE device 1 - // CAPTURE_DEV "2", // CAPTURE device 2 - // CAPTURE_DEV "3" // CAPTURE device 3 - }; - - - if ( (cap_nr>0) || (cap_nr < (int)(sizeof (capturedevs)/sizeof(char *))) ) { - - if (fd < 0) { - fd = open( capturedevs[cap_nr], O_RDWR ); - if (fd >= 0) { - cx = cy = cw = ch = 0; - out_w = out_h = 0; - stride = 0; - } else perror (capturedevs[cap_nr]); - return fd; - } - - } - - return -1; -} - - -// -// -- close Capture Device -// - -void CCAPTURE::captureclose () -{ - if (fd >=0 ) { - close (fd); - fd = -1; - cx = cy = cw = ch = 0; - out_w = out_h = 0; - stride = 0; - } - return; -} - - - - -/* - -- Coordination routines... - */ - -void CCAPTURE::set_coord (int x, int y, int w, int h) -{ - if (( x != cx ) || ( y != cy )) { - cx = x; - cy = y; - cw = w; - ch = h; - _set_window (cx,cy,cw,ch); - } -} - - -void CCAPTURE::set_xy (int x, int y) -{ - if (( x != cx ) || ( y != cy )) { - cx = x; - cy = y; - _set_window (cx,cy,cw,ch); - } -} - - - -void CCAPTURE::set_size (int w, int h) -{ - if (( w != cw ) || ( h != ch )) { - cw = w; - ch = h; - _set_window (cx,cy,cw,ch); - } -} - - - - -// -// -- set Capture Position -// - -void CCAPTURE::_set_window (int x, int y, int w, int h) -{ -#ifdef __v4l_capture - - struct v4l2_crop crop; - - crop.c.left = x; - crop.c.top = y; - crop.c.width = w; - crop.c.height = h; - if( ioctl(fd, VIDIOC_S_CROP, &crop) < 0) - perror ("error VIDIOC_S_CROP"); - -#else - - capture_set_input_pos(fd, x, y); - capture_set_input_size(fd, w, h); - -#endif -} - - - -void CCAPTURE::set_output_size (int w, int h) -{ -#ifdef __v4l_capture - - struct v4l2_format format; - - out_w = w; - out_h = h; - format.fmt.pix.width = w; - format.fmt.pix.height = h; - - if (ioctl(fd, VIDIOC_S_FMT, &format) < 0) - perror ("error VIDIOC_S_FMT"); - -#else - - out_w = w; - out_h = h; - capture_set_output_size(fd, w, h); - -#endif -} - - -// -// -- capture a frame -// -- if buffer == NULL, routine will alloc memory! -// -- destroy will not free this allocated memory! -// -- otherwise buffer has to be large enough! -// - -u_char *CCAPTURE::readframe (u_char *buf) -{ -#ifdef __v4l_capture - - struct v4l2_format vid; - int n; - u_char *b; - - if (fd >= 0) { - // get capture information - vid.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (ioctl(fd, VIDIOC_G_FMT, &vid) < 0) - perror ("Error getting info with VIDIOC_G_FMT"); - - printf ("reported bytesperline: %d, height: %d, sizeimage: %d\n", - vid.fmt.pix.bytesperline, - vid.fmt.pix.height, - vid.fmt.pix.sizeimage); - - b = (buf != NULL) - ? buf - : (u_char *) malloc (vid.fmt.pix.bytesperline * - vid.fmt.pix.height); - - - n = read (fd, b, vid.fmt.pix.bytesperline*vid.fmt.pix.height); - if (n < 0) { - perror ("Error reading capture buffer"); - if (!buf) free (b); - return (u_char *)NULL; - } - - return b; - } - - return (u_char *) NULL; - - -#else - - u_char *b; - int stride; - int n; - - if (fd >= 0) { - stride = capture_start(fd); - - b = (buf != NULL) - ? buf - : (u_char *) malloc (stride * out_h); - - n = read(fd, b, stride * out_h); - capture_stop(fd); - if (n < 0) { - perror ("Error reading capture buffer"); - if (!buf) free (b); - return (u_char *)NULL; - } - - - return b; - } - - return (u_char *) NULL; - -#endif -} - - - - - - - - - - diff --git a/src/driver/capture.h b/src/driver/capture.h deleted file mode 100644 index 53775739e..000000000 --- a/src/driver/capture.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - - License: GPL - - 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. -*/ - - -#ifndef __CAPTURE_CONTROL__ -#define __CAPTURE_CONTROL__ - - -#define __v4l_capture - - -using namespace std; - - -// -// -- Picture Capture Control -// -- 2003-12 rasc -// - -#ifdef __v4l_capture - -#include -#define CAPTURE_DEV "/dev/v4l/video" // CaptureNr will be appended! - -#else - -#include -#define CAPTURE_DEV "/dev/dbox/capture" // CaptureNr will be appended! - -#endif - - -class CCAPTURE -{ - public: - CCAPTURE (); - CCAPTURE (int capture_nr); // incl. open - CCAPTURE (int capture_nr, int x, int y, int w, int h); // open + set_coord - ~CCAPTURE (); - - int captureopen (int capture_nr); - void captureclose (void); - void set_coord (int x, int y, int w, int h); - void set_xy (int x, int y); - void set_size (int w, int h); - void set_output_size (int w, int h); - u_char *readframe (u_char *buf); - - private: - void _set_window (int x, int y, int w, int h); - - int fd; // io descriptor - int cx, cy, cw, ch; // capture size - int out_w, out_h; // capture output size - int stride; - -}; - - - -#endif - - diff --git a/src/driver/encoding.cpp b/src/driver/encoding.cpp deleted file mode 100644 index 519b10d89..000000000 --- a/src/driver/encoding.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/encoding.cpp,v 1.2 2003/09/27 11:48:09 thegoodguy Exp $ - * - * conversion of character encodings - d-box2 linux project - * - * (C) 2003 by thegoodguy - * - * 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. - * - */ - -#include - -std::string Latin1_to_UTF8(const std::string & s) -{ - std::string r; - - for (std::string::const_iterator it = s.begin(); it != s.end(); it++) - { - unsigned char c = *it; - if (c < 0x80) - r += c; - else - { - unsigned char d = 0xc0 | (c >> 6); - r += d; - d = 0x80 | (c & 0x3f); - r += d; - } - } - return r; -} diff --git a/src/driver/encoding.h b/src/driver/encoding.h deleted file mode 100644 index 9564a8733..000000000 --- a/src/driver/encoding.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/encoding.h,v 1.2 2003/09/27 11:48:09 thegoodguy Exp $ - * - * conversion of character encodings - d-box2 linux project - * - * (C) 2003 by thegoodguy - * - * 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. - * - */ - -#ifndef __neutrino__encoding_h__ -#define __neutrino__encoding_h__ - -#include - -std::string Latin1_to_UTF8(const std::string & s); - -#endif /* __neutrino__encoding_h__ */ diff --git a/src/driver/fb_window.cpp b/src/driver/fb_window.cpp index 0555b17a7..4d0d5f4a1 100644 --- a/src/driver/fb_window.cpp +++ b/src/driver/fb_window.cpp @@ -31,13 +31,6 @@ #include #include -class CPrivateData -{ - public: - CFrameBuffer * frameBuffer; - fb_pixel_t * Background; -}; - CFBWindow::CFBWindow(const int _x, const int _y, const int _dx, const int _dy) { x = _x ; @@ -45,44 +38,35 @@ CFBWindow::CFBWindow(const int _x, const int _y, const int _dx, const int _dy) dx = _dx; dy = _dy; - private_data = (void *) new CPrivateData; - ((CPrivateData *)private_data)->frameBuffer = CFrameBuffer::getInstance(); - ((CPrivateData *)private_data)->Background = new fb_pixel_t [_dx * _dy]; - if (((CPrivateData *)private_data)->Background != NULL) - ((CPrivateData *)private_data)->frameBuffer->SaveScreen(_x, _y, _dx, _dy, ((CPrivateData *)private_data)->Background); + frameBuffer = CFrameBuffer::getInstance(); + Background = new fb_pixel_t [_dx * _dy]; + if (Background != NULL) + frameBuffer->SaveScreen(_x, _y, _dx, _dy, Background); } CFBWindow::~CFBWindow(void) { - if (private_data != NULL) - { - if (((CPrivateData *)private_data)->Background != NULL) - { - ((CPrivateData *)private_data)->frameBuffer->RestoreScreen(x, y, dx, dy, ((CPrivateData *)private_data)->Background); - ((CPrivateData *)private_data)->frameBuffer->blit(); - } - delete[] ((CPrivateData *)private_data)->Background; - delete ((CPrivateData *)private_data); - private_data = NULL; - } + if (Background != NULL) + frameBuffer->RestoreScreen(x, y, dx, dy, Background); + delete[] Background; } void CFBWindow::paintBoxRel(const int _x, const int _y, const int _dx, const int _dy, const color_t _col, int radius, int type) { - ((CPrivateData *)private_data)->frameBuffer->paintBoxRel(x + _x, y + _y, _dx, _dy, _col, radius, type); - ((CPrivateData *)private_data)->frameBuffer->blit(); + frameBuffer->paintBoxRel(x + _x, y + _y, _dx, _dy, _col, radius, type); + frameBuffer->blit(); } bool CFBWindow::paintIcon(const char * const _filename, const int _x, const int _y, const int _h, const color_t _offset) { - ((CPrivateData *)private_data)->frameBuffer->paintIcon(_filename, x + _x, y + _y, _h, _offset); - ((CPrivateData *)private_data)->frameBuffer->blit(); + frameBuffer->paintIcon(_filename, x + _x, y + _y, _h, _offset); + frameBuffer->blit(); return 0; } void CFBWindow::RenderString(const font_t _font, const int _x, const int _y, const int _width, const char * const _text, const color_t _color, const int _boxheight, const bool _utf8_encoded) { ((Font *)_font)->RenderString(x + _x, y + _y, _width, _text, _color, _boxheight, _utf8_encoded); - ((CPrivateData *)private_data)->frameBuffer->blit(); + frameBuffer->blit(); } diff --git a/src/driver/fb_window.h b/src/driver/fb_window.h index ec8fa857e..9e4a0b347 100644 --- a/src/driver/fb_window.h +++ b/src/driver/fb_window.h @@ -1,8 +1,4 @@ -#ifndef __fb_window_h__ -#define __fb_window_h__ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/fb_window.h,v 1.3 2004/03/13 12:45:41 thegoodguy Exp $ - * * abstract fb_window class - d-box2 linux project * * (C) 2003 by thegoodguy @@ -23,15 +19,21 @@ * */ +#ifndef __fb_window_h__ +#define __fb_window_h__ + +#include +#include + class CFBWindow { public: typedef unsigned int color_t; typedef void * font_t; - typedef void * private_data_t; private: - private_data_t private_data; + CFrameBuffer * frameBuffer; + fb_pixel_t * Background; public: int x, y; /* upper left corner */ diff --git a/src/driver/file.cpp b/src/driver/file.cpp index 01723fe7c..775332ee6 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -45,8 +45,8 @@ const char * const file_extension_list[] = "asf", "avi", "bmp", "cdr", "crw", "flac", "gif", "imu", "jpeg", "jpg", "m2a", "m3u", "mkv", "mp2", "mp3", - "mpa", "ogg", "png", "sh", "txt", - "url", "wav", "xml" + "mpa", "ogg", "pls", "png", "sh", + "txt", "url", "wav", "xml" }; /* ATTENTION: the array file_extension_list MUST BE SORTED ASCENDING (cf. sort, man bsearch) - otherwise bsearch will not work correctly! */ @@ -55,8 +55,8 @@ const CFile::FileType file_type_list[] = CFile::FILE_ASF , CFile::FILE_AVI , CFile::FILE_PICTURE , CFile::FILE_CDR , CFile::FILE_PICTURE , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_PICTURE , CFile::FILE_PICTURE , CFile::FILE_MP3 , CFile::FILE_PLAYLIST , CFile::FILE_MKV , CFile::FILE_MP3 , CFile::FILE_MP3 , - CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PICTURE , CFile::FILE_TEXT , CFile::FILE_TEXT , - CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML + CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PLAYLIST, CFile::FILE_PICTURE , CFile::FILE_TEXT , + CFile::FILE_TEXT , CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML }; int mycasecmp(const void * a, const void * b) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index e6c8de1bf..b2cb2d480 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -380,7 +380,7 @@ CFrameBuffer::~CFrameBuffer() { std::map::iterator it; - for(it = icon_cache.begin(); it != icon_cache.end(); it++) { + for(it = icon_cache.begin(); it != icon_cache.end(); ++it) { /* printf("FB: delete cached icon %s: %x\n", it->first.c_str(), (int) it->second.data); */ cs_free_uncached(it->second.data); } diff --git a/src/driver/genpsi.c b/src/driver/genpsi.c index eeca06d22..381f0ac50 100644 --- a/src/driver/genpsi.c +++ b/src/driver/genpsi.c @@ -194,7 +194,7 @@ static int copy_template(uint8_t *dst, uint8_t *src, int len) } int genpsi(int fd2) { - int bytes = 0; +// int bytes = 0; uint8_t pkt[SIZE_TS_PKT]; int i, data_len, patch_len, ofs; @@ -234,13 +234,13 @@ int genpsi(int fd2) //-- calculate CRC -- calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); //-- write TS packet -- - bytes += write(fd2, pkt, SIZE_TS_PKT); + /*bytes +=*/ write(fd2, pkt, SIZE_TS_PKT); //-- (II) build PAT -- data_len = COPY_TEMPLATE(pkt, pkt_pat); //-- calculate CRC -- calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); //-- write TS packet -- - bytes += write(fd2, pkt, SIZE_TS_PKT); + /*bytes +=*/ write(fd2, pkt, SIZE_TS_PKT); //-- (III) build PMT -- data_len = COPY_TEMPLATE(pkt, pkt_pmt); @@ -274,7 +274,7 @@ int genpsi(int fd2) //-- calculate CRC -- calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); //-- write TS packet -- - bytes += write(fd2, pkt, SIZE_TS_PKT); + /*bytes +=*/ write(fd2, pkt, SIZE_TS_PKT); //-- finish -- avPids.vpid=0; avPids.nba=0; diff --git a/src/driver/lcdd.cpp b/src/driver/lcdd.cpp index 83f6f6685..0921eee8c 100644 --- a/src/driver/lcdd.cpp +++ b/src/driver/lcdd.cpp @@ -1241,7 +1241,7 @@ void CLCD::showFilelist(int flist_pos,CFileList* flist,const char * const mainDi if (mode == MODE_FILEBROWSER && m_fileList != NULL && - m_fileList->size() > 0) + !m_fileList->empty() ) { printf("[lcdd] FileList:OK\n"); diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 210fc4ce5..71d61d2f2 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -1021,7 +1021,7 @@ FILE *f_open(const char *filename, const char *acctype) case MODE_PLS: { char *ptr2, /*buf[4096], use local buf from function */ servers[25][1024]; - int rval, retries = retry_num; + int /*rval,*/ retries = retry_num; ptr = NULL; /* fetch the playlist from the shoutcast directory with our own */ @@ -1037,7 +1037,7 @@ FILE *f_open(const char *filename, const char *acctype) /* operating system because we don't need/want stream caching for */ /* this operation */ - rval = fread(buf, sizeof(char), 4096, fd); + /*rval =*/ fread(buf, sizeof(char), 4096, fd); f_close(fd); ptr = strstr(buf, "http://"); diff --git a/src/driver/pictureviewer/Makefile.am b/src/driver/pictureviewer/Makefile.am index 5baec7e08..1e7310784 100644 --- a/src/driver/pictureviewer/Makefile.am +++ b/src/driver/pictureviewer/Makefile.am @@ -1,11 +1,13 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ + -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/libconfigfile \ - @FREETYPE_CFLAGS@ \ - -I$(top_srcdir)/lib + @FREETYPE_CFLAGS@ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream diff --git a/src/driver/pictureviewer/crw.cpp b/src/driver/pictureviewer/crw.cpp index 632e1ca73..16bba96fb 100644 --- a/src/driver/pictureviewer/crw.cpp +++ b/src/driver/pictureviewer/crw.cpp @@ -169,7 +169,7 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/) struct jpeg_decompress_struct *ciptr; struct r_crw_jpeg_error_mgr emgr; unsigned char *bp; - int px,py,c,x=*xp; + int px/*,py*/,c,x=*xp; FILE *fh; JSAMPLE *lb; @@ -204,7 +204,7 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/) jpeg_start_decompress(ciptr); - px=ciptr->output_width; py=ciptr->output_height; + px=ciptr->output_width; //py=ciptr->output_height; c=ciptr->output_components; @@ -234,7 +234,7 @@ int fh_crw_getsize(const char *filename,int *x,int *y, int wanted_width, int wan struct jpeg_decompress_struct *ciptr; struct r_crw_jpeg_error_mgr emgr; - int px,py,c; + int px,py/*,c*/; FILE *fh; ciptr=&cinfo; @@ -271,7 +271,7 @@ int fh_crw_getsize(const char *filename,int *x,int *y, int wanted_width, int wan jpeg_start_decompress(ciptr); px=ciptr->output_width; py=ciptr->output_height; - c=ciptr->output_components; +// c=ciptr->output_components; *x=px; *y=py; // jpeg_finish_decompress(ciptr); jpeg_destroy_decompress(ciptr); diff --git a/src/driver/pictureviewer/gif.cpp b/src/driver/pictureviewer/gif.cpp index 1246f6ab8..a37238772 100644 --- a/src/driver/pictureviewer/gif.cpp +++ b/src/driver/pictureviewer/gif.cpp @@ -6,6 +6,7 @@ #ifdef FBV_SUPPORT_GIF #include "pictureviewer.h" #include + #include #include #include #include @@ -47,7 +48,7 @@ inline void m_rend_gif_decodecolormap(unsigned char *cmb,unsigned char *rgbb,Col } int fh_gif_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/) { - int px,py,i,ibxs; + int px,py,i/*,ibxs*/; int j; unsigned char *fbptr; unsigned char *lb; @@ -79,7 +80,7 @@ int fh_gif_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/) cmap=(gft->Image.ColorMap ? gft->Image.ColorMap : gft->SColorMap); cmaps=cmap->ColorCount; - ibxs=ibxs*3; +// ibxs=ibxs*3; fbptr=*buffer; if(!(gft->Image.Interlace)) { diff --git a/src/driver/pictureviewer/jpeg.cpp b/src/driver/pictureviewer/jpeg.cpp index 33aae72cf..34a604bdf 100644 --- a/src/driver/pictureviewer/jpeg.cpp +++ b/src/driver/pictureviewer/jpeg.cpp @@ -234,7 +234,7 @@ int fh_jpeg_getsize(const char *filename,int *x,int *y, int wanted_width, int wa struct jpeg_decompress_struct *ciptr; struct r_jpeg_error_mgr emgr; - int px,py,c; + int px,py/*,c*/; FILE *fh; ciptr=&cinfo; if(!(fh=fopen(filename,"rb"))) return(FH_ERROR_FILE); @@ -269,7 +269,7 @@ int fh_jpeg_getsize(const char *filename,int *x,int *y, int wanted_width, int wa jpeg_start_decompress(ciptr); px=ciptr->output_width; py=ciptr->output_height; - c=ciptr->output_components; +// c=ciptr->output_components; #if 1 if(!g_settings.picviewer_decode_server_ip.empty()) { diff --git a/src/driver/pictureviewer/make15color_errdiff.cpp b/src/driver/pictureviewer/make15color_errdiff.cpp deleted file mode 100644 index e00ae47ee..000000000 --- a/src/driver/pictureviewer/make15color_errdiff.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2005 Zwen - - Kommentar: - This is an implementation of the floyd steinberg error diffusion algorithm - adapted for 24bit to 15bit color reduction. - - For a description of the base alorithm see e.g.: - http://www.informatik.fh-muenchen.de/~schieder/graphik-01-02/slide0264.html - - License: GPL - - 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. -*/ - -#include -#include -#include - -#include "pictureviewer.h" - -void c32_15(unsigned char r, unsigned char g , unsigned char b , unsigned char* d) -{ - *d = ((r >> 1) & 0x7C) | (g >> 6); - *(d+1) = ((g << 2) & 0xE0) | (b >> 3); -} - -#define FS_CALC_ERROR_COMMON(color, index) \ - p1 = p2 = (p_src[index] + (this_line_error_##color[ix]>>4)); \ - if(p1>255)p1=255; if(p1<0)p1=0; \ - color = (p1 & 0xF8) | 0x4; \ - error = p2 - color; \ - -#define FS_CALC_ERROR_RIGHT(color, index) \ - FS_CALC_ERROR_COMMON(color,index) \ - this_line_error_##color[ix+1] += (error * 7); \ - next_line_error_##color[ix-1] += (error * 3); \ - next_line_error_##color[ix] += (error * 5); \ - next_line_error_##color[ix+1] += error; - -#define FS_CALC_ERROR_LEFT(color, index) \ - FS_CALC_ERROR_COMMON(color,index) \ - this_line_error_##color[ix-1] += (error * 7); \ - next_line_error_##color[ix+1] += (error * 3); \ - next_line_error_##color[ix] += (error * 5); \ - next_line_error_##color[ix-1] += error; - -unsigned char * make15color_errdiff(unsigned char * src,int width, int height) -{ - int odd_line=1; - int ix,iy, error, p1, p2; - unsigned char r,g,b; - unsigned char *p_src, *p_dst; - unsigned char *dst = (unsigned char*) malloc(width*height*2); - int *this_line_error_r; - int *this_line_error_g; - int *this_line_error_b; - int *next_line_error_r; - int *next_line_error_g; - int *next_line_error_b; - int *save_error; - int *error1_r = (int*) malloc((width+2)*sizeof(int)); - int *error1_g = (int*) malloc((width+2)*sizeof(int)); - int *error1_b = (int*) malloc((width+2)*sizeof(int)); - int *error2_r = (int*) malloc((width+2)*sizeof(int)); - int *error2_g = (int*) malloc((width+2)*sizeof(int)); - int *error2_b = (int*) malloc((width+2)*sizeof(int)); - - dbout("Start error diffusion\n"); - - this_line_error_r = error1_r; - this_line_error_g = error1_g; - this_line_error_b = error1_b; - next_line_error_r = error2_r; - next_line_error_g = error2_g; - next_line_error_b = error2_b; - memset (this_line_error_r, 0 , (width+2) * sizeof(int)); - memset (this_line_error_g, 0 , (width+2) * sizeof(int)); - memset (this_line_error_b, 0 , (width+2) * sizeof(int)); - memset (next_line_error_r, 0 , (width+2) * sizeof(int)); - memset (next_line_error_g, 0 , (width+2) * sizeof(int)); - memset (next_line_error_b, 0 , (width+2) * sizeof(int)); - p_src = src; - p_dst = dst; - - for(iy=0 ; iy < height ; iy++) - { - save_error = this_line_error_r; - this_line_error_r = next_line_error_r; - next_line_error_r = save_error; - save_error = this_line_error_g; - this_line_error_g = next_line_error_g; - next_line_error_g = save_error; - save_error = this_line_error_b; - this_line_error_b = next_line_error_b; - next_line_error_b = save_error; - memset (next_line_error_r, 0 , (width+2) * sizeof(int)); - memset (next_line_error_g, 0 , (width+2) * sizeof(int)); - memset (next_line_error_b, 0 , (width+2) * sizeof(int)); - - if(odd_line) - { - for(ix=1 ; ix <= width ; ix++) - { - FS_CALC_ERROR_RIGHT(r,0); - FS_CALC_ERROR_RIGHT(g,1); - FS_CALC_ERROR_RIGHT(b,2); - c32_15(r,g,b,p_dst); - p_src+=3; - p_dst+=2; - } - odd_line=0; - } - else - { - p_src+=(width-1)*3; - p_dst+=(width-1)*2; - for(ix=width ; ix >= 1 ; ix--) - { - FS_CALC_ERROR_LEFT(r,0); - FS_CALC_ERROR_LEFT(g,1); - FS_CALC_ERROR_LEFT(b,2); - c32_15(r,g,b,p_dst); - p_src-=3; - p_dst-=2; - } - p_src+=width*3; - p_dst+=width*2; - odd_line=1; - } - } - free(error1_r); - free(error1_g); - free(error1_b); - free(error2_r); - free(error2_g); - free(error2_b); - dbout("End error diffusion\n"); - return dst; -} - diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 6fdb3f364..d6983b472 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -5,7 +5,7 @@ #include "pv_config.h" #include "driver/framebuffer.h" - +#include #include #include #include @@ -111,10 +111,10 @@ bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, b return true; } #endif - int x, y, xs, ys, imx, imy; + int x, y, imx, imy; - xs = CFrameBuffer::getInstance()->getScreenWidth(true); - ys = CFrameBuffer::getInstance()->getScreenHeight(true); +// int xs = CFrameBuffer::getInstance()->getScreenWidth(true); +// int ys = CFrameBuffer::getInstance()->getScreenHeight(true); // Show red block for "next ready" in view state if (showBusySign) @@ -589,7 +589,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, if (buffer == NULL) { printf("%s: Error: malloc\n", mode_str.c_str()); - return false; + return 0; } #ifdef FBV_SUPPORT_PNG if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str()))) diff --git a/src/driver/pictureviewer/resize.cpp b/src/driver/pictureviewer/resize.cpp deleted file mode 100644 index 5da99fa09..000000000 --- a/src/driver/pictureviewer/resize.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include - -#include "pictureviewer.h" - -unsigned char * simple_resize(unsigned char * orgin,int ox,int oy,int dx,int dy) -{ - unsigned char *cr,*p,*l; - int i,j,k,ip; - cr=(unsigned char*) malloc(dx*dy*3); - if(cr==NULL) - { - printf("Error: malloc\n"); - return(orgin); - } - l=cr; - - for(j=0;j=ox) - xb_v[i]=ox-1; - } - for(j=0;j=oy) yb=oy-1; - for(i=0;i -#include -#include -#include -#include -#include -#include - -#include "pig.h" - - - - -// Video4Linux API for PIG -// - -// -// -- Picture in Graphics Control -// -- This module is a Class to provide a PIG abstraction layer -// -- -// -- 2002-11 rasc -// -- 2003-06 rasc V4L Api -// - - - -// -// -- Constructor -// - -CPIG::CPIG() -{ - fd = -1; - status = CLOSED; -} - - -CPIG::CPIG(int pig_nr) -{ - fd = -1; - status = CLOSED; - fd = pigopen (pig_nr); -} - - -CPIG::CPIG(int pig_nr, int x, int y, int w, int h) -{ - fd = -1; - status = CLOSED; - fd = pigopen (pig_nr); - set_coord (x,y, w,h); - -} - -CPIG::~CPIG() -{ - pigclose (); // cleanup anyway!! - -} - - -// -// -- open PIG #nr -// -- return >=0: ok -// - -int CPIG::pigopen (int pig_nr) -{ - - char *pigdevs[] = { - PIG_DEV "0" // PIG device 0 - // PIG_DEV "1", // PIG device 1 - // PIG_DEV "2", // PIG device ... - // PIG_DEV "3" - }; - - - if ( (pig_nr>0) || (pig_nr < (int)(sizeof (pigdevs)/sizeof(char *))) ) { - - if (fd < 0) { - fd = open( pigdevs[pig_nr], O_RDWR ); - if (fd >= 0) { - status = HIDE; - px = py = pw = ph = 0; - } - return fd; - } - - } - - return -1; -} - - -// -// -- close PIG -// - -void CPIG::pigclose () -{ - if (fd >=0 ) { - close (fd); - fd = -1; - status = CLOSED; - px = py = pw = ph = 0; - } - return; -} - - -// -// -- set PIG Position -// -- routines should be self explaining -// - -void CPIG::_set_window (int x, int y, int w, int h) -{ -#if 1 - // -- Modul interne Routine - struct v4l2_crop crop; - struct v4l2_format coord; - int err; - - crop.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = ioctl(fd, VIDIOC_G_CROP, &crop); - - // take whole input frame - crop.c.left = 0; - crop.c.top = 0; - crop.c.width = 720; - crop.c.height = 576; - err = ioctl(fd, VIDIOC_S_CROP, &crop); - - coord.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = ioctl(fd, VIDIOC_G_FMT, &coord); - - // fit into small window - coord.fmt.win.w.left = x; - coord.fmt.win.w.top = y; - coord.fmt.win.w.width = w; - coord.fmt.win.w.height = h; - - err = ioctl(fd, VIDIOC_S_FMT, &coord); -#if 0 // old - struct v4l2_format coord; - int err; - - ioctl(fd, VIDIOC_G_FMT, &coord); - coord.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - - coord.fmt.win.w.left = x; - coord.fmt.win.w.top = y; - coord.fmt.win.w.width = w; - coord.fmt.win.w.height = h; - - int pigmode = 0; - err = ioctl(fd, VIDIOC_OVERLAY, &pigmode); -printf("pig::window VIDIOC_OVERLAY %d\n", err); - - err = ioctl(fd, VIDIOC_S_FMT, &coord); -printf("pig::window VIDIOC_S_FMT %d\n", err); -#endif -#else - avia_pig_set_pos(fd,x,y); - avia_pig_set_size(fd, w, h); - avia_pig_set_stack(fd,2); -#endif -} - - -void CPIG::set_coord (int x, int y, int w, int h) -{ - - if (( x != px ) || ( y != py )) { - px = x; - py = y; - pw = w; - ph = h; - _set_window (px,py,pw,ph); - } - -} - - -void CPIG::set_xy (int x, int y) -{ - - if (( x != px ) || ( y != py )) { - px = x; - py = y; - _set_window (px,py,pw,ph); - } - -} - - -void CPIG::set_size (int w, int h) -{ - - if (( w != pw ) || ( h != ph )) { - pw = w; - ph = h; - _set_window (px,py,pw,ph); - } - -} - - -// $$$ ???? what this for? - -//void CPIG::set_source (int x, int y) -//{ -// -// if (fd >= 0) { -// -// if (( x != px ) || ( y != py )) { -// // avia_pig_set_source(fd,x,y); -// } -// -// } -// -//} - - -// -// -- routine set's stack position of PIG on display -// - -//void CPIG::set_stackpos (int pos) -// -//{ -// if (fd >= 0) { -// avia_pig_set_stack(fd,pos); -// stackpos = pos; -// } -//} - - -// -// -- Show PIG or hide PIG -// - -void CPIG::show (int x, int y, int w, int h) -{ - set_coord (x,y, w,h); - show (); -} - -void CPIG::show (void) -{ - if ( fd >= 0 ) { -#if 1 - int pigmode = 1; - int err; - err = ioctl(fd, VIDIOC_OVERLAY, &pigmode); -//printf("pig::show err %d\n", err); -#else - avia_pig_show(fd); -#endif - status = SHOW; - } -} - -void CPIG::hide (void) -{ - if ( fd >= 0 ) { -#if 1 - int pigmode = 0; - int err; - err = ioctl(fd, VIDIOC_OVERLAY, &pigmode); -#else - avia_pig_hide(fd); -#endif - status = HIDE; - } -} - - -CPIG::PigStatus CPIG::getStatus(void) -{ - return status; - -} - - - - - -// -// ToDo's: -// -- Capability unavail check/status -// -- Cropping for resizing (possible zoom/scaling?) -// -- Capturing -// - diff --git a/src/driver/pig.h b/src/driver/pig.h deleted file mode 100644 index c88cda236..000000000 --- a/src/driver/pig.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - - License: GPL - - 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. -*/ - - -#ifndef __PIG_CONTROL__ -#define __PIG_CONTROL__ -#include -using namespace std; - - -// -// -- Picture in Graphics Control -// -- 2002-11 rasc -// -- 2003-06 rasc V4L API -// - - - -#if 1 -#include - -#define PIG_DEV "/dev/v4l/video" // PigNr will be appended! -#else -#include -#define PIG_DEV "/dev/dbox/pig" -#endif - - -class CPIG -{ - public: - CPIG (); - CPIG (int pig_nr); // incl. open - CPIG (int pig_nr, int x, int y, int w, int h); // open + set_coord - ~CPIG (); - - int pigopen (int pig_nr); - void pigclose (void); - void set_coord (int x, int y, int w, int h); - void set_xy (int x, int y); - void set_size (int w, int h); -// void set_source(int x, int y); -// void set_stackpos (int pos); - void show (void); - void show (int x, int y, int w, int h); - void hide (void); - - enum PigStatus { CLOSED, HIDE, SHOW }; - PigStatus getStatus(void); - - private: - void _set_window (int x, int y, int w, int h); - - int fd; // io descriptor - int px, py, pw, ph; // pig frame - int stackpos; // Order (Framebuffer, PIGs) - PigStatus status; // on display? - - -}; - - -#endif - - diff --git a/src/driver/radiotext.cpp b/src/driver/radiotext.cpp index c447f8ec3..a32cc059e 100644 --- a/src/driver/radiotext.cpp +++ b/src/driver/radiotext.cpp @@ -427,7 +427,7 @@ fprintf(stderr, "MEC=0x%02x DSN=0x%02x PSN=0x%02x MEL=%02d STATUS=0x%02x MFL=%02 RTP_TToggle = 0x03; // Bit 0/1 = Title/Artist RT_MsgShow = true; S_RtOsd = 1; - RT_Info = (RT_Info > 0) ? : 1; + RT_Info = (RT_Info > 0) ? RT_Info : 1; RadioStatusMsg(); } diff --git a/src/driver/radiotext.h b/src/driver/radiotext.h index 7df14c1d3..5b6af9726 100644 --- a/src/driver/radiotext.h +++ b/src/driver/radiotext.h @@ -58,7 +58,7 @@ #include #endif -#include +#include //#define ENABLE_RASS diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 1c99d94eb..ca03ad5b1 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -34,14 +34,13 @@ #endif #include -#include +#include #include #include #include #include #include -//#define RCDEBUG #include #include #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL @@ -62,11 +61,17 @@ #include #include +//#define RCDEBUG +//#define USE_GETTIMEOFDAY + +#define ENABLE_REPEAT_CHECK + #if HAVE_SPARK_HARDWARE /* this relies on event0 being the AOTOM frontpanel driver device * TODO: what if another input device is present? */ const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; #else +//const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir"}; #endif typedef struct input_event t_input_event; @@ -347,13 +352,15 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) return res; } - int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t timeNow = time_monotonic_us(); +#endif timer _newtimer; if (!oneshot) @@ -380,6 +387,7 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) return _newtimer.id; } +#ifdef USE_GETTIMEOFDAY int CRCInput::addTimer(struct timeval Timeout) { uint64_t timesout = (uint64_t) Timeout.tv_usec + (uint64_t)((uint64_t) Timeout.tv_sec * (uint64_t) 1000000); @@ -390,6 +398,7 @@ int CRCInput::addTimer(const time_t *Timeout) { return addTimer( (uint64_t)*Timeout* (uint64_t) 1000000, true, false ); } +#endif void CRCInput::killTimer(uint32_t &id) { @@ -409,13 +418,14 @@ void CRCInput::killTimer(uint32_t &id) int CRCInput::checkTimers() { - struct timeval tv; int _id = 0; - +#ifdef USE_GETTIMEOFDAY + struct timeval tv; gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - - +#else + uint64_t timeNow = time_monotonic_us(); +#endif std::vector::iterator e; for ( e= timers.begin(); e!= timers.end(); ++e ) if ( e->times_out< timeNow+ 2000 ) @@ -455,41 +465,46 @@ int CRCInput::checkTimers() int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec + (uint64_t)timeout_in_seconds) * (uint64_t) 1000000; +#else + return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); +#endif } int64_t CRCInput::calcTimeoutEnd_MS(const int timeout_in_milliseconds) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday(&tv, NULL); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - +#else + uint64_t timeNow = time_monotonic_us(); +#endif return ( timeNow + timeout_in_milliseconds * 1000 ); } - void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t *TimeoutEnd, bool bAllowRepeatLR) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - +#else + uint64_t timeNow = time_monotonic_us(); +#endif uint64_t diff; if ( *TimeoutEnd < timeNow+ 100 ) diff = 100; // Minimum Differenz... else diff = ( *TimeoutEnd - timeNow ); + //printf("CRCInput::getMsgAbsoluteTimeout diff %llx TimeoutEnd %llx now %llx\n", diff, *TimeoutEnd, timeNow); getMsg_us( msg, data, diff, bAllowRepeatLR ); - +#ifdef USE_GETTIMEOFDAY if ( *msg == NeutrinoMessages::EVT_TIMESET ) { // recalculate timeout.... @@ -498,6 +513,7 @@ void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * //printf("[getMsgAbsoluteTimeout]: EVT_TIMESET - recalculate timeout\n%llx/%llx - %llx/%llx\n", timeNow, *(int64_t*) *data, *TimeoutEnd, ta ); } +#endif } void CRCInput::getMsg(neutrino_msg_t * msg, neutrino_msg_data_t * data, int Timeout, bool bAllowRepeatLR) @@ -510,16 +526,16 @@ void CRCInput::getMsg_ms(neutrino_msg_t * msg, neutrino_msg_data_t * data, int T getMsg_us(msg, data, (uint64_t) Timeout * 1000, bAllowRepeatLR); } -#define ENABLE_REPEAT_CHECK void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t Timeout, bool bAllowRepeatLR) { static uint64_t last_keypress = 0ULL; - uint64_t getKeyBegin; + //uint64_t getKeyBegin; //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; - struct timeval tv, tvselect; + struct timeval tv; + struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -540,18 +556,25 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } // wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird! +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); - getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - + uint64_t getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t getKeyBegin = time_monotonic_us(); +#endif while(1) { /* we later check for ev.type = EV_SYN which is 0x00, so set something invalid here... */ memset(&ev, 0, sizeof(ev)); ev.type = EV_MAX; timer_id = 0; - if ( timers.size()> 0 ) + if ( !timers.empty() ) { +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); uint64_t t_n= (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t t_n = time_monotonic_us(); +#endif if ( timers[0].times_out< t_n ) { timer_id = checkTimers(); @@ -868,6 +891,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 { case CSectionsdClient::EVT_TIMESET: { +#if 0 struct timeval ltv; gettimeofday(<v, NULL); int64_t timeOld = ltv.tv_usec + ltv.tv_sec * (int64_t)1000000; @@ -875,7 +899,8 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if (dvbtime) { printf("[neutrino] timeset event. "); time_t difftime = dvbtime - ltv.tv_sec; - if (abs(difftime) > 120) { + if (abs(difftime) > 120) + { printf("difference is %ld s, stepping...\n", difftime); if (stime(&dvbtime)) perror("stime"); @@ -896,14 +921,18 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 delete[] p;//new [] delete [] p = new unsigned char[sizeof(int64_t)]; *(int64_t*) p = timeNew - timeOld; - +#endif + printf("[neutrino] CSectionsdClient::EVT_TIMESET: timediff %lld\n", *(int64_t*) p); + /* FIXME what this code really do ? */ if ((int64_t)last_keypress > *(int64_t*)p) - last_keypress += *(int64_t *)p; + last_keypress += *(int64_t *)p; +#ifdef USE_GETTIMEOFDAY // Timer anpassen for(std::vector::iterator e = timers.begin(); e != timers.end(); ++e) if (e->correct_time) e->times_out+= *(int64_t*) p; +#endif *msg = NeutrinoMessages::EVT_TIMESET; *data = (neutrino_msg_data_t) p; dont_delete_p = true; @@ -915,16 +944,18 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); *data = (neutrino_msg_data_t) p; dont_delete_p = true; break; + case CSectionsdClient::EVT_WRITE_SI_FINISHED: + *msg = NeutrinoMessages::EVT_SI_FINISHED; + *data = 0; + break; +#if 0 case CSectionsdClient::EVT_SERVICES_UPDATE: *msg = NeutrinoMessages::EVT_SERVICES_UPD; *data = 0; break; case CSectionsdClient::EVT_BOUQUETS_UPDATE: break; - case CSectionsdClient::EVT_WRITE_SI_FINISHED: - *msg = NeutrinoMessages::EVT_SI_FINISHED; - *data = 0; - break; +#endif default: printf("[neutrino] event INITID_SECTIONSD - unknown eventID 0x%x\n", emsg.eventID ); } @@ -1045,6 +1076,10 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); *msg = NeutrinoMessages::EVT_PMT_CHANGED; *data = (neutrino_msg_data_t) p; break; + case CZapitClient::EVT_TUNE_COMPLETE: + *msg = NeutrinoMessages::EVT_TUNE_COMPLETE; + *data = (neutrino_msg_data_t) p; + break; default: printf("[neutrino] event INITID_ZAPIT - unknown eventID 0x%x\n", emsg.eventID ); } @@ -1136,6 +1171,7 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); } else if (emsg.initiatorID == CEventServer::INITID_NEUTRINO) { +#if 0 if ((emsg.eventID == NeutrinoMessages::EVT_RECORDING_ENDED) && (read_bytes == sizeof(stream2file_status2_t))) { @@ -1143,6 +1179,7 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); *data = (neutrino_msg_data_t) p; dont_delete_p = true; } +#endif } else if (emsg.initiatorID == CEventServer::INITID_GENERIC_INPUT_EVENT_PROVIDER) { @@ -1297,8 +1334,12 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); else { //timeout neu kalkulieren +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); int64_t getKeyNow = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); +#else + int64_t getKeyNow = time_monotonic_us(); +#endif int64_t diff = (getKeyNow - getKeyBegin); if( Timeout <= (uint64_t) diff ) { diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index f0c9978f0..66e04502b 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -259,7 +259,7 @@ class CRCInput RC_HW_COOLSTREAM = 0, RC_HW_DBOX = 1, RC_HW_PHILIPS = 2, - RC_HW_TRIPLEDRAGON = 3, + RC_HW_TRIPLEDRAGON = 3 }; void set_rc_hw(void); diff --git a/src/driver/record.cpp b/src/driver/record.cpp index c167ca73d..bcde1f378 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -52,7 +52,7 @@ #include #include -#include +#include #include #include #include @@ -130,6 +130,7 @@ bool CRecordInstance::SaveXml() void CRecordInstance::WaitRecMsg(time_t StartTime, time_t WaitTime) { + return; while (time(0) < StartTime + WaitTime) usleep(100000); } @@ -171,7 +172,7 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList & apids[numpids++] = allpids.PIDs.pmtpid; if(record == NULL) - record = new cRecord(RECORD_DEMUX); + record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/); record->Open(); @@ -185,6 +186,9 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList & return RECORD_FAILURE; } + if(!autoshift) + CFEManager::getInstance()->lockFrontend(frontend);//FIXME testing + start_time = time(0); SaveXml(); @@ -193,7 +197,7 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList & int len; unsigned char * pmt = channel->getRawPmt(len); cCA * ca = cCA::GetInstance(); - ca->SendPMT(DEMUX_SOURCE_2, pmt, len); + ca->SendPMT(channel->getRecordDemux() /*DEMUX_SOURCE_2*/, pmt, len); //CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true); WaitRecMsg(msg_start_time, 2); @@ -224,6 +228,9 @@ bool CRecordInstance::Stop(bool remove_event) SaveXml(); record->Stop(); + if(!autoshift) + CFEManager::getInstance()->unlockFrontend(frontend);//FIXME testing + CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD); if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) { @@ -272,7 +279,7 @@ bool CRecordInstance::Update() GetPids(channel); FilterPids(apid_list); - for(it = apid_list.begin(); it != apid_list.end(); it++) { + for(it = apid_list.begin(); it != apid_list.end(); ++it) { bool found = false; for(unsigned int i = 0; i < numpids; i++) { if(apids[i] == it->apid) { @@ -438,11 +445,9 @@ void CRecordInstance::FilterPids(APIDList & apid_list) } if (apidmode & TIMERD_APIDS_ALT) { uint32_t apid_min=UINT_MAX; - uint32_t apid_min_idx=0; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { apid_min = allpids.APIDs[i].pid; - apid_min_idx = i; } } for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { @@ -491,7 +496,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) APIDDesc a = {apid_min, apid_min_idx, false}; apid_list.push_back(a); } - for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); it++) + for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); ++it) printf("Record APID 0x%X %d\n",it->apid, it->ac3); } } @@ -518,7 +523,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis info2 = epgdata.info2; recMovieInfo->parentalLockAge = epgdata.fsk; - if(epgdata.contentClassification.size() > 0 ) + if( !epgdata.contentClassification.empty() ) recMovieInfo->genreMajor = epgdata.contentClassification[0]; recMovieInfo->length = epgdata.epg_times.dauer / 60; @@ -540,7 +545,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis EPG_AUDIO_PIDS audio_pids; APIDList::iterator it; for(unsigned int i= 0; i< allpids.APIDs.size(); i++) { - for(it = apid_list.begin(); it != apid_list.end(); it++) { + for(it = apid_list.begin(); it != apid_list.end(); ++it) { if(allpids.APIDs[i].pid == it->apid) { audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; @@ -551,7 +556,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis } } /* FIXME sometimes no apid in xml ?? */ - if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) { + if(recMovieInfo->audioPids.empty() && !allpids.APIDs.empty()) { int i = 0; audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; @@ -779,17 +784,15 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons * neutrino check if this channel_id already recording, may be not needed */ bool direct_record = timeshift || strlen(eventinfo->recordingDir) == 0; - int mode = g_Zapit->isChannelTVChannel(eventinfo->channel_id) ? NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio; - - printf("%s channel_id %llx epg: %llx, apidmode 0x%X mode %d\n", __FUNCTION__, - eventinfo->channel_id, eventinfo->epgID, eventinfo->apids, mode); + printf("%s channel_id %llx epg: %llx, apidmode 0x%X\n", __FUNCTION__, + eventinfo->channel_id, eventinfo->epgID, eventinfo->apids); if(!CheckRecording(eventinfo)) return false; #if 1 // FIXME test StopSectionsd = false; - if(recmap.size()) + if( !recmap.empty() ) StopSectionsd = true; #endif RunStartScript(); @@ -807,7 +810,13 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons nextmap.push_back((CTimerd::RecordingInfo *)evt); } } else if(recmap.size() < RECORD_MAX_COUNT) { - if(CutBackNeutrino(eventinfo->channel_id, mode)) { +#if 1//FIXME test + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id); + CFrontend * frontend = CFEManager::getInstance()->allocateFE(channel); + int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ? + NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio; +#endif + if(frontend && CutBackNeutrino(eventinfo->channel_id, mode)) { std::string newdir; if(dir && strlen(dir)) newdir = std::string(dir); @@ -819,6 +828,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons if (inst == NULL) inst = new CRecordInstance(eventinfo, newdir, timeshift, StreamVTxtPid, StreamPmtPid); + inst->frontend = frontend; error_msg = inst->Record(); if(error_msg == RECORD_OK) { recmap.insert(std::pair(eventinfo->channel_id, inst)); @@ -913,7 +923,7 @@ void CRecordManager::StartNextRecording() for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) { bool tested = true; eventinfo = *it; - if(recmap.size() > 0) { + if( !recmap.empty() ) { CRecordInstance * inst = FindInstance(eventinfo->channel_id); /* same channel recording and not auto - skip */ if(inst && !inst->Timeshift()) @@ -949,7 +959,7 @@ bool CRecordManager::RecordingStatus(const t_channel_id channel_id) CRecordInstance * inst = FindInstance(channel_id); ret = (inst != NULL); } else - ret = recmap.size() != 0; + ret = !recmap.empty(); mutex.unlock(); return ret; @@ -1455,20 +1465,21 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo last_mode = CNeutrinoApp::getInstance()->getMode(); - if(last_mode == NeutrinoMessages::mode_standby && !recmap.size()) + if(last_mode == NeutrinoMessages::mode_standby && recmap.empty()) g_Zapit->setStandby(false); // this zap to live_channel_id t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); +#if 0 if(live_channel_id != channel_id) { if(SAME_TRANSPONDER(live_channel_id, channel_id)) { printf("%s zapTo_record channel_id %llx\n", __FUNCTION__, channel_id); ret = g_Zapit->zapTo_record(channel_id) > 0; - } else if(recmap.size()) { + } else if(!recmap.empty()) { ret = false; } else { if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); - // Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen... + // When we were on standby, then we need not wake up for streaming if(last_mode == NeutrinoMessages::mode_standby) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); } @@ -1483,7 +1494,36 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo if(!ret) printf("%s: failed to change channel\n", __FUNCTION__); } +#endif + bool mode_changed = false; + if(live_channel_id != channel_id) { + bool found = false; + if(SAME_TRANSPONDER(live_channel_id, channel_id)) { + found = true; + } else { + for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) { + if(SAME_TRANSPONDER(it->first, channel_id)) { + found = true; + break; + } + } + } + if(found) { + ret = g_Zapit->zapTo_record(channel_id) > 0; + printf("%s found same tp, zapTo_record channel_id %llx result %d\n", __FUNCTION__, channel_id, ret); + } + else { + printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode()); + if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { + CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); + mode_changed = true; + } + + ret = g_Zapit->zapTo_serviceID(channel_id) > 0; + printf("%s zapTo_serviceID channel_id %llx result %d\n", __FUNCTION__, channel_id, ret); + } + } if(ret) { if(StopSectionsd) { printf("%s: g_Sectionsd->setPauseScanning(true)\n", __FUNCTION__); @@ -1495,13 +1535,19 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo if(last_mode == NeutrinoMessages::mode_standby) g_Zapit->stopPlayBack(); } + if(last_mode == NeutrinoMessages::mode_standby) { + //CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); + g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); + } else if(!ret && mode_changed /*mode != last_mode*/) + CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , last_mode); + printf("%s channel_id %llx mode %d : result %s\n", __FUNCTION__, channel_id, mode, ret ? "OK" : "BAD"); return ret; } void CRecordManager::RestoreNeutrino(void) { - if(recmap.size()) + if(!recmap.empty()) return; /* after this zapit send EVT_RECORDMODE_DEACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */ diff --git a/src/driver/record.h b/src/driver/record.h index cd8c27572..777889f8f 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -35,6 +35,7 @@ #include #include #include +#include #if HAVE_COOL_HARDWARE #include @@ -68,7 +69,7 @@ enum record_error_msg_t RECORD_BUSY = -1, RECORD_INVALID_DIRECTORY = -2, RECORD_INVALID_CHANNEL = -3, - RECORD_FAILURE = -4, + RECORD_FAILURE = -4 }; class CRecordInstance @@ -128,6 +129,8 @@ class CRecordInstance bool Timeshift() { return autoshift; }; int tshift_mode; void SetStopMessage(const char* text) {rec_stop_msg = text;} ; + + CFrontend * frontend; }; typedef std::map recmap_t; @@ -169,7 +172,7 @@ class CRecordManager : public CMenuTarget, public CChangeObserver RECMODE_OFF = 0, RECMODE_REC = 1, RECMODE_TSHIFT = 2, - RECMODE_REC_TSHIFT = 3, + RECMODE_REC_TSHIFT = 3 }; CRecordManager(); diff --git a/src/driver/rfmod.cpp b/src/driver/rfmod.cpp deleted file mode 100644 index 5cbe6f071..000000000 --- a/src/driver/rfmod.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include - -#define RFMOD_DEV "/dev/rfmod0" -#define IOCTL_SET_CHANNEL 0 -#define IOCTL_SET_TESTMODE 1 -#define IOCTL_SET_SOUNDENABLE 2 -#define IOCTL_SET_SOUNDSUBCARRIER 3 -#define IOCTL_SET_FINETUNE 4 -#define IOCTL_SET_STANDBY 5 - -#define C0 3 -#define C1 2 -#define FL 1 -#define FM 0 - -RFmod::RFmod() -{ - rfmodfd=open(RFMOD_DEV, O_RDWR); -} - -void RFmod::init() -{ - soundsubcarrier=g_settings.rf_subcarrier; - soundenable=g_settings.rf_soundenable; - channel = g_settings.rf_channel; - finetune = g_settings.rf_finetune; - standby = g_settings.rf_standby; - - setSoundSubCarrier(soundsubcarrier); - setSoundEnable(soundenable); - setChannel(channel); - setFinetune(finetune); - setStandby(standby); - setTestPattern(0); -} - -RFmod::~RFmod() -{ - if (rfmodfd>=0) - close(rfmodfd); -} - -int RFmod::setSoundEnable(int val) -{ - soundenable = val; -//printf("RF sound: %d\n", val); - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_SOUNDENABLE,&soundenable); - - return 0; -} - -int RFmod::setStandby(int val) -{ - standby = val; -//printf("RF standby: %d\n", val); - - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_STANDBY,&standby); - - return 0; -} - -int RFmod::setChannel(int val) -{ - channel = val; -//printf("RF channel: %d\n", val); - - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_CHANNEL,&channel); - - return 0; -} - -int RFmod::setFinetune(int val) -{ - finetune = val; -//printf("RF finetune: %d\n", val); - - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_FINETUNE,&finetune); - - return 0; -} - -int RFmod::setTestPattern(int val) -{ -//printf("RF test: %d\n", val); - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_TESTMODE,&val); - - return 0; -} - - -int RFmod::setSoundSubCarrier(int freq) //freq in KHz -{ -//printf("RF carrier: %d\n", freq); - soundsubcarrier=freq; -/* - switch(freq) - { - case 4500: - sfd=0; - break; - case 5500: - sfd=1; - break; - case 6000: - sfd=2; - break; - case 6500: - sfd=3; - break; - default: - return -1; - } -*/ - if(rfmodfd > 0) - ioctl(rfmodfd,IOCTL_SET_SOUNDSUBCARRIER,&soundsubcarrier); - - return 0; -} diff --git a/src/driver/rfmod.h b/src/driver/rfmod.h deleted file mode 100644 index 31b669077..000000000 --- a/src/driver/rfmod.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __erfmod_h -#define __erfmod_h - - -class RFmod -{ - int channel,soundsubcarrier,soundenable,finetune,standby; - -public: - RFmod(); - ~RFmod(); - - int rfmodfd; - void init(); - - int setChannel(int channel); - int setSoundSubCarrier(int val); - int setSoundEnable(int val); - int setStandby(int val); - int setFinetune(int val); - int setTestPattern(int val); -}; -#endif diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index 11c5e5100..6ae11889f 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -359,7 +360,7 @@ void CScreenShot::MakeFileName(const t_channel_id channel_id) snprintf(fname, sizeof(fname), "%s/", g_settings.screenshot_dir.c_str()); pos = strlen(fname); - channel_name = g_Zapit->getChannelName(channel_id); + channel_name = CServiceManager::getInstance()->GetServiceName(channel_id); if (!(channel_name.empty())) { strcpy(&(fname[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str())); ZapitTools::replace_char(&fname[pos]); diff --git a/src/driver/showframe.c b/src/driver/showframe.c deleted file mode 100644 index a00afd1b0..000000000 --- a/src/driver/showframe.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define VIDEO_DEV "/dev/dvb/card0/video0" -#define VIDEO_SET_AUTOFLUSH _IOW('o', 2, int) - -void showframe(char * fname) -{ - int file, size; - char *buffer; - - file=open(fname, O_RDONLY); - if (file < 0) - return; - size=lseek(file, 0, SEEK_END); - lseek(file, 0, SEEK_SET); - if (size < 0) - { - close(file); - return; - } - buffer = malloc(size); - read(file, buffer, size); - close(file); - displayIFrame(buffer, size); - free(buffer); - return; -} -static int displayIFrame(const char *frame, int len) -{ - int fdv, fdvideo, i; - fdv=open("/dev/video", O_WRONLY); - if (fdv < 0) { - printf("cant open /dev/video\n"); - return -1; - } - - fdvideo = open(VIDEO_DEV, O_RDWR); - if (fdvideo < 0) { - colose(fdv);//Resource leak: fdv - printf("cant open %s\n", VIDEO_DEV); - return -1; - } - if (ioctl(fdvideo, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY ) <0) - printf("VIDEO_SELECT_SOURCE failed \n"); - if (ioctl(fdvideo, VIDEO_CLEAR_BUFFER) <0 ) - printf("VIDEO_CLEAR_BUFFER failed \n"); - if (ioctl(fdvideo, VIDEO_PLAY) < 0 ) - printf("VIDEO_PLAY failed\n"); - - for (i=0; i < 2; i++ ) - write(fdv, frame, len); - - unsigned char buf[128]; - memset(&buf, 0, 128); - write(fdv, buf, 128); - - if ( ioctl(fdv, VIDEO_SET_AUTOFLUSH, 0) < 0 ) - printf("VIDEO_SET_AUTOFLUSH off failed\n"); - - if (ioctl(fdvideo, VIDEO_SET_BLANK, 0) < 0 ) - printf("VIDEO_SET_BLANK failed\n"); - - close(fdvideo); - if ( ioctl(fdv, VIDEO_SET_AUTOFLUSH, 1) < 0 ) - printf("VIDEO_SET_AUTOFLUSH on failed\n"); - - close(fdv); - return 0; -} - diff --git a/src/driver/shutdown_count.cpp b/src/driver/shutdown_count.cpp index c9219f583..9bf77c2f1 100644 --- a/src/driver/shutdown_count.cpp +++ b/src/driver/shutdown_count.cpp @@ -34,6 +34,7 @@ #include #include +#include SHTDCNT::SHTDCNT() diff --git a/src/driver/slotbuffer.c b/src/driver/slotbuffer.c deleted file mode 100644 index 9b50e6875..000000000 --- a/src/driver/slotbuffer.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/slotbuffer.c,v 1.1 2004/06/03 09:51:54 thegoodguy Exp $ - * - * (C) 2004 by thegoodguy - * - * 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. - * - */ - -/* Note: this slotbuffer "wastes" one slot */ - -#include "slotbuffer.h" -#include - -slotbuffer_t * slotbuffer_construct(const size_t size) -{ - slotbuffer_t * slotbuffer; - - slotbuffer = malloc(sizeof(slotbuffer_t)); - - slotbuffer->buffer = malloc(size); - slotbuffer->size = size; - slotbuffer->read_pointer = 0; - slotbuffer->write_pointer = 0; - - return slotbuffer; -} - -void slotbuffer_destruct(slotbuffer_t * const slotbuffer) -{ - free(slotbuffer->buffer); - free(slotbuffer); -} - -size_t slotbuffer_remaining_read_space(slotbuffer_t * const slotbuffer) -{ - ssize_t delta; - - delta = slotbuffer->write_pointer; - delta -= slotbuffer->read_pointer; - - return (delta >= 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size); -} - -size_t slotbuffer_remaining_write_space(slotbuffer_t * const slotbuffer) -{ - ssize_t delta; - - delta = slotbuffer->read_pointer; - delta -= slotbuffer->write_pointer; - - return ((delta > 0) ? (size_t)delta : (size_t)(delta + slotbuffer->size)) - 1; -} - -size_t slotbuffer_remaining_continuous_read_space(slotbuffer_t * const slotbuffer) -{ - ssize_t delta; - size_t read_pointer; - - delta = slotbuffer->write_pointer; - read_pointer = slotbuffer->read_pointer; - delta -= read_pointer; - - return (delta >= 0) ? (size_t)delta : (size_t)(slotbuffer->size - read_pointer); -} - -size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuffer) -{ - ssize_t delta; - size_t write_pointer; - - delta = slotbuffer->read_pointer; - - if (delta == 0) - return (slotbuffer->size - slotbuffer->write_pointer - 1); - - write_pointer = slotbuffer->write_pointer; - delta -= write_pointer; - - return (delta > 0) ? (size_t)(delta - 1) : (size_t)(slotbuffer->size - write_pointer); -} - -void slotbuffer_advance_read_pointer(slotbuffer_t * const slotbuffer, const size_t delta) -{ - slotbuffer->read_pointer += delta; - if (slotbuffer->read_pointer >= slotbuffer->size) - slotbuffer->read_pointer = 0; -} - -void slotbuffer_advance_write_pointer(slotbuffer_t * const slotbuffer, const size_t delta) -{ - slotbuffer->write_pointer += delta; - if (slotbuffer->write_pointer >= slotbuffer->size) - slotbuffer->write_pointer = 0; -} diff --git a/src/driver/slotbuffer.h b/src/driver/slotbuffer.h deleted file mode 100644 index 07266f62d..000000000 --- a/src/driver/slotbuffer.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __slotbuffer_h__ -#define __slotbuffer_h__ - -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/slotbuffer.h,v 1.1 2004/06/03 09:51:54 thegoodguy Exp $ - * - * (C) 2004 by thegoodguy - * - * 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. - * - */ - -#include - -typedef struct -{ - unsigned char * buffer; - size_t size; - volatile size_t read_pointer; - volatile size_t write_pointer; -} slotbuffer_t; - -slotbuffer_t * slotbuffer_construct (size_t const size ); -void slotbuffer_destruct (slotbuffer_t * const slotbuffer ); -size_t slotbuffer_remaining_read_space (slotbuffer_t * const slotbuffer ); -size_t slotbuffer_remaining_write_space (slotbuffer_t * const slotbuffer ); -size_t slotbuffer_remaining_continuous_read_space (slotbuffer_t * const slotbuffer ); -size_t slotbuffer_remaining_continuous_write_space(slotbuffer_t * const slotbuffer ); -void slotbuffer_advance_read_pointer (slotbuffer_t * const slotbuffer, size_t const delta); -void slotbuffer_advance_write_pointer (slotbuffer_t * const slotbuffer, size_t const delta); - -#endif diff --git a/src/driver/stream2file.cpp b/src/driver/stream2file.cpp deleted file mode 100644 index c6a836c44..000000000 --- a/src/driver/stream2file.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * $Id: stream2file.cpp,v 1.19 2005/01/12 20:40:22 chakazulu Exp $ - * - * streaming to file/disc - * - * Copyright (C) 2004 Axel Buehning , - * thegoodguy - * - * based on code which is - * Copyright (C) 2001 TripleDES - * Copyright (C) 2000, 2001 Marcus Metzler - * Copyright (C) 2002 Andreas Oberritter - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * Or, point your browser to http://www.gnu.org/copyleft/gpl.html - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if HAVE_COOL_HARDWARE -#include -#include -#endif -#if HAVE_TRIPLEDRAGON -#include -#include -#endif -#include -#include -#include - -extern "C" { -#include -} - -static cRecord * record = NULL; -extern CZapitChannel *g_current_channel; -extern CCam *cam0; - -extern bool autoshift; -extern bool autoshift_delete; - -#define MAXPIDS 64 -#define FILENAMEBUFFERSIZE 1024 - -static stream2file_status_t exit_flag = STREAM2FILE_STATUS_IDLE; - -char rec_filename[FILENAMEBUFFERSIZE]; - -stream2file_error_msg_t start_recording(const char * const filename, - const char * const info, const unsigned short vpid, const unsigned short * const pids, - const unsigned int numpids) -{ - int fd; - char buf[FILENAMEBUFFERSIZE]; - struct statfs s; - - if(autoshift) - sprintf(rec_filename, "%s_temp", filename); - else - sprintf(rec_filename, "%s", filename); - - // write stream information (should wakeup the disk from standby, too) - sprintf(buf, "%s.xml", rec_filename); - - char * dir = strdup(buf); - int ret = statfs(dirname(dir), &s); - free(dir); - if((ret != 0) || (s.f_type == 0x72b6) || (s.f_type == 0x24051905)) { - return STREAM2FILE_INVALID_DIRECTORY; - } - if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { - write(fd, info, strlen(info)); - fdatasync(fd); - close(fd); - } else { - return STREAM2FILE_INVALID_DIRECTORY; - } - - exit_flag = STREAM2FILE_STATUS_RUNNING; - - sprintf(buf, "%s.ts", rec_filename); - - printf("Record start: file %s vpid %x apid %x\n", buf, vpid, pids[0]); - - fd = open(buf, O_CREAT | O_RDWR | O_LARGEFILE | O_TRUNC , S_IRWXO | S_IRWXG | S_IRWXU); - if(fd < 0) { - perror(buf); - return STREAM2FILE_INVALID_DIRECTORY; - } - genpsi(fd); - - if(!record) - record = new cRecord(2); - - record->Open(numpids); - - if(!record->Start(fd, (unsigned short ) vpid, (unsigned short *) pids, numpids)) { - record->Stop(); - delete record; - record = NULL; - return STREAM2FILE_INVALID_DIRECTORY; - } - if(g_current_channel) { - cam0->setCaPmt(g_current_channel->getCaPmt(), DEMUX_SOURCE_0, cam0->getCaMask() | DEMUX_DECODE_2 /*5*/, true); // demux 0 + 2, update - - int len; - unsigned char * pmt = g_current_channel->getRawPmt(len); - cCA * ca = cCA::GetInstance(); - ca->SendPMT(DEMUX_SOURCE_2, pmt, len); - } - - CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true); - - return STREAM2FILE_OK; -} - -stream2file_error_msg_t stop_recording(const char * const info) -{ - char buf[FILENAMEBUFFERSIZE]; - char buf1[FILENAMEBUFFERSIZE]; - int fd; - stream2file_error_msg_t ret = STREAM2FILE_RECORDING_THREADS_FAILED; - - //if(!autoshift || autoshift_delete) - { - sprintf(buf, "%s.xml", rec_filename); - if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { - write(fd, info, strlen(info)); - fdatasync(fd); - close(fd); - } - } - - if(record) { - record->Stop(); - delete record; - record = NULL; - } - - if (exit_flag == STREAM2FILE_STATUS_RUNNING) { - exit_flag = STREAM2FILE_STATUS_IDLE; - ret = STREAM2FILE_OK; - } - else - ret = STREAM2FILE_RECORDING_THREADS_FAILED; - - if((autoshift && g_settings.auto_delete) || autoshift_delete) { - sprintf(buf, "rm -f %s.ts &", rec_filename); - sprintf(buf1, "%s.xml", rec_filename); - autoshift_delete = false; - system(buf); - unlink(buf1); - } - CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, false); - - rec_filename[0] = 0; - return ret; -} - -stream2file_error_msg_t update_recording(const char * const info, const unsigned short vpid, - const unsigned short * const pids, const unsigned int numpids) -{ -// stream2file_error_msg_t ret; - char buf[FILENAMEBUFFERSIZE]; - int fd; - - sprintf(buf, "%s.xml", rec_filename); - if ((fd = open(buf, O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { - write(fd, info, strlen(info)); - fdatasync(fd); - close(fd); - } - if(record) - record->ChangePids((unsigned short) vpid, (unsigned short *) pids, numpids); - - if(g_current_channel) - cam0->setCaPmt(g_current_channel->getCaPmt(), DEMUX_SOURCE_0, cam0->getCaMask() | DEMUX_DECODE_0 | DEMUX_DECODE_2, true); - - return STREAM2FILE_OK /*ret*/; -} diff --git a/src/driver/stream2file.h b/src/driver/stream2file.h deleted file mode 100644 index 059bca9d4..000000000 --- a/src/driver/stream2file.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: stream2file.h,v 1.10 2005/01/12 20:40:22 chakazulu Exp $ - * - * (C) 2004 by thegoodguy - * - * 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. - * - */ - -#ifndef __stream2file_h__ -#define __stream2file_h__ - -enum stream2file_error_msg_t -{ - STREAM2FILE_OK = 0, - STREAM2FILE_BUSY = -1, - STREAM2FILE_INVALID_DIRECTORY = -2, - STREAM2FILE_INVALID_PID = -3, - STREAM2FILE_PES_FILTER_FAILURE = -4, - STREAM2FILE_DVR_OPEN_FAILURE = -5, - STREAM2FILE_RECORDING_THREADS_FAILED = -6 -}; - -enum stream2file_status_t -{ - STREAM2FILE_STATUS_RUNNING = 0, - STREAM2FILE_STATUS_IDLE = 1, - STREAM2FILE_STATUS_BUFFER_OVERFLOW = -1, - STREAM2FILE_STATUS_WRITE_OPEN_FAILURE = -2, - STREAM2FILE_STATUS_WRITE_FAILURE = -3, - STREAM2FILE_STATUS_READ_FAILURE = -4 -}; - -struct stream2file_status2_t -{ - stream2file_status_t status; - char dir[100]; -}; - -stream2file_error_msg_t start_recording(const char * const filename, - const char * const info, - const unsigned short vpid, - const unsigned short * const apids, - const unsigned int numpids); -stream2file_error_msg_t stop_recording(const char * const info); -stream2file_error_msg_t update_recording(const char * const info, - const unsigned short vpid, - const unsigned short * const apids, - const unsigned int numpids); - -#endif diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 6794358b3..c7149a0e4 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include @@ -208,8 +208,6 @@ void streamts_main_thread(void * /*data*/) if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) { printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents); if (pfd[i].fd == listenfd) { - if(connfd >= 0) - close(connfd); connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); printf("new connection, fd %d\n", connfd); if(connfd < 0) { @@ -316,7 +314,14 @@ void * streamts_live_thread(void *data) if(demuxfd_count == 0) { printf("No pids!\n"); - return 0; + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + if(!channel) + return 0; + pids[demuxfd_count++] = 0; + pids[demuxfd_count++] = channel->getPmtPid(); + pids[demuxfd_count++] = channel->getVideoPid(); + for (int i = 0; i < channel->getAudioChannelCount(); i++) + pids[demuxfd_count++] = channel->getAudioChannel(i)->pid; } buf = (unsigned char *) malloc(IN_SIZE); diff --git a/src/driver/vcrcontrol.cpp b/src/driver/vcrcontrol.cpp deleted file mode 100644 index 5b212ab99..000000000 --- a/src/driver/vcrcontrol.cpp +++ /dev/null @@ -1,963 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - - License: GPL - - 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. -*/ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -int was_record = 0; -extern bool autoshift; -extern bool autoshift_delete; - -#define SA struct sockaddr -#define SAI struct sockaddr_in -extern "C" { -#include -} - -extern t_channel_id rec_channel_id; - -static CVCRControl vcrControl; - -CVCRControl * CVCRControl::getInstance() -{ - return &vcrControl; -} - -//------------------------------------------------------------------------- -CVCRControl::CVCRControl() -{ - Device = NULL; -} - -//------------------------------------------------------------------------- -CVCRControl::~CVCRControl() -{ - unregisterDevice(); -} - -//------------------------------------------------------------------------- -void CVCRControl::unregisterDevice() -{ - if (Device) - { - delete Device; - Device = NULL; - } -} - -//------------------------------------------------------------------------- -void CVCRControl::registerDevice(CDevice * const device) -{ - unregisterDevice(); - - Device = device; - if(CNeutrinoApp::getInstance()->recordingstatus) - Device->deviceState = CMD_VCR_RECORD; -} - -//------------------------------------------------------------------------- -bool CVCRControl::Record(const CTimerd::RecordingInfo * const eventinfo) -{ - int mode = g_Zapit->isChannelTVChannel(eventinfo->channel_id) ? NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio; - - return Device->Record(eventinfo->channel_id, mode, eventinfo->epgID, eventinfo->epgTitle, eventinfo->apids, eventinfo->epg_starttime); -} - -MI_MOVIE_INFO * CVCRControl::GetMovieInfo(void) -{ - if(Device) - return Device->recMovieInfo; - return NULL; -} - -bool CVCRControl::GetPids(unsigned short *vpid, unsigned short *vtype, unsigned short *apid, unsigned short *atype, unsigned short * apidnum, unsigned short * apids, unsigned short * atypes) -{ - if(Device) { - if(vpid) - *vpid = Device->rec_vpid; - if(vtype) - *vtype = Device->rec_vtype; - if(apid) - *apid = Device->rec_currentapid; - if(atype) - *atype = Device->rec_currentac3; - if(apidnum) { - *apidnum = Device->rec_numpida; - for(int i = 0; i < Device->rec_numpida; i++) { - if(apids) - apids[i] = Device->rec_apids[i]; - if(atypes) - atypes[i] = Device->rec_ac3flags[i]; - } - } - return true; - } - return false; -} - -//------------------------------------------------------------------------- -void CVCRControl::CDevice::getAPIDs(const unsigned char _apidmode, APIDList & apid_list) -{ - unsigned char apidmode = _apidmode; - - if (apidmode == TIMERD_APIDS_CONF) - apidmode = g_settings.recording_audio_pids_default; - - apid_list.clear(); - //CZapitClient::responseGetPIDs allpids; - g_Zapit->getPIDS(allpids); - - // assume smallest apid ist std apid - if (apidmode & TIMERD_APIDS_STD) { - uint32_t apid_min=UINT_MAX; - uint32_t apid_min_idx=0; - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { - apid_min = allpids.APIDs[i].pid; - apid_min_idx = i; - } - } - if (apid_min != UINT_MAX) { - APIDDesc a = {apid_min, apid_min_idx, false}; - apid_list.push_back(a); - } - } - if (apidmode & TIMERD_APIDS_ALT) { - uint32_t apid_min=UINT_MAX; - uint32_t apid_min_idx=0; - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { - apid_min = allpids.APIDs[i].pid; - apid_min_idx = i; - } - } - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3) { - APIDDesc a = {allpids.APIDs[i].pid, i, false}; - apid_list.push_back(a); - } - } - } - if (apidmode & TIMERD_APIDS_AC3) { - bool ac3_found=false; - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].is_ac3) { - APIDDesc a = {allpids.APIDs[i].pid, i, true}; - apid_list.push_back(a); - ac3_found=true; - } - } - // add non ac3 apid if ac3 not found - if (!(apidmode & TIMERD_APIDS_STD) && !ac3_found) { - uint32_t apid_min=UINT_MAX; - uint32_t apid_min_idx=0; - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { - apid_min = allpids.APIDs[i].pid; - apid_min_idx = i; - } - } - if (apid_min != UINT_MAX) { - APIDDesc a = {apid_min, apid_min_idx, false}; - apid_list.push_back(a); - } - } - } - // no apid selected use standard - if (apid_list.empty() && !allpids.APIDs.empty()) { - uint32_t apid_min=UINT_MAX; - uint32_t apid_min_idx=0; - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { - apid_min = allpids.APIDs[i].pid; - apid_min_idx = i; - } - } - if (apid_min != UINT_MAX) { - APIDDesc a = {apid_min, apid_min_idx, false}; - apid_list.push_back(a); - } - for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); it++) - printf("Record APID 0x%X %d\n",it->apid, it->ac3); - - } -} - -//------------------------------------------------------------------------- -bool CVCRControl::CVCRDevice::Stop() -{ - deviceState = CMD_VCR_STOP; - - if(last_mode != NeutrinoMessages::mode_scart) - { - g_RCInput->postMsg( NeutrinoMessages::VCR_OFF, 0 ); - g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); - } - return true; -} - -//------------------------------------------------------------------------- -bool CVCRControl::CVCRDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& /*epgTitle*/, unsigned char apidmode, const time_t /*epg_time*/) -{ - printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx, apidmode 0x%X mode \n", - channel_id, epgid, apidmode); - - // leave menu (if in any) - g_RCInput->postMsg( CRCInput::RC_timeout, 0 ); - - last_mode = CNeutrinoApp::getInstance()->getMode(); - if(mode != last_mode) - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); - - if(channel_id != 0) { - if(g_Zapit->getCurrentServiceID() != channel_id) - g_Zapit->zapTo_serviceID(channel_id); - } - if(! (apidmode & TIMERD_APIDS_STD)) { - APIDList apid_list; - getAPIDs(apidmode,apid_list); - if(!apid_list.empty()) { - if(!apid_list.begin()->ac3) - g_Zapit->setAudioChannel(apid_list.begin()->index); - else - g_Zapit->setAudioChannel(0); - } - else - g_Zapit->setAudioChannel(0); - } - else - g_Zapit->setAudioChannel(0); - - if(SwitchToScart) { - // Auf Scart schalten - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::VCR_ON, 0 ); - // Das ganze nochmal in die queue, da obiges RC_timeout erst in der naechsten ev. loop ausgeführt wird - // und dann das menu widget das display falsch rücksetzt - g_RCInput->postMsg( NeutrinoMessages::VCR_ON, 0 ); - } - - deviceState = CMD_VCR_RECORD; - - return true; -} - -//------------------------------------------------------------------------- -void CVCRControl::CFileAndServerDevice::RestoreNeutrino(void) -{ -//printf("RestoreNeutrino\n");fflush(stdout); - /* after this zapit send EVT_RECORDMODE_DEACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */ - g_Zapit->setRecordMode( false ); - if (!g_Zapit->isPlayBackActive() && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby)) - g_Zapit->startPlayBack(); - // alten mode wieder herstellen (ausser wen zwischenzeitlich auf oder aus sb geschalten wurde) - if(CNeutrinoApp::getInstance()->getMode() != last_mode && - CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby && - last_mode != NeutrinoMessages::mode_standby) - if(!autoshift) - g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); - - if(last_mode == NeutrinoMessages::mode_standby && - CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby ) - { - //Wenn vorher und jetzt standby, dann die zapit wieder auf sb schalten - //g_Zapit->setStandby(true); - //was_record = 1; - } - if((last_mode != NeutrinoMessages::mode_standby) && StopSectionsd) - g_Sectionsd->setPauseScanning(false); -} - -void CVCRControl::CFileAndServerDevice::CutBackNeutrino(const t_channel_id channel_id, const int mode) -{ - rec_channel_id = channel_id; -//printf("CutBackNeutrino\n");fflush(stdout); - g_Zapit->setStandby(false); - last_mode = CNeutrinoApp::getInstance()->getMode(); - if(last_mode == NeutrinoMessages::mode_standby) - was_record = 1; - if (channel_id != 0) { - if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); - // Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen... - if(last_mode == NeutrinoMessages::mode_standby) - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); - } - if(g_Zapit->getCurrentServiceID() != channel_id) { - g_Zapit->zapTo_serviceID(channel_id); - } - } - if(StopSectionsd) // wenn sectionsd gestoppt werden soll - g_Sectionsd->setPauseScanning(true); // sectionsd stoppen - - /* after this zapit send EVT_RECORDMODE_ACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */ - g_Zapit->setRecordMode( true ); - if((last_mode == NeutrinoMessages::mode_standby) || (StopPlayBack && g_Zapit->isPlayBackActive())) - g_Zapit->stopPlayBack(); -} - -bool sectionsd_getEPGidShort(event_id_t epgID, CShortEPGData * epgdata); -bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata); - -std::string CVCRControl::CFileAndServerDevice::getCommandString(const CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode) -{ - char tmp[40]; - std::string apids_selected; - const char * extCommand; - std::string info1, info2; - - std::string extMessage = "\n\n\n\t\n" - "\t\t"; - - CZapitClient::responseGetPIDs pids; - g_Zapit->getPIDS (pids); - CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo (); - - APIDList apid_list; - getAPIDs(apidmode,apid_list); - apids_selected=""; - for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); it++) - { - if(it != apid_list.begin()) - apids_selected += " "; - sprintf(tmp, "%u", it->apid); - apids_selected += tmp; - } - - std::string tmpstring = g_Zapit->getChannelName(channel_id); - if (tmpstring.empty()) - extMessage += "unknown"; - else - extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); - - extMessage += "\n\t\t"; - - tmpstring = "not available"; - if (epgid != 0) - { - CShortEPGData epgdata; - //if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) { - if(sectionsd_getEPGidShort(epgid, &epgdata)) { -//#warning fixme sectionsd should deliver data in UTF-8 format - tmpstring = epgdata.title; - info1 = epgdata.info1; - info2 = epgdata.info2; - } - } else if (!epgTitle.empty()) { - tmpstring = epgTitle; - } - extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); - - extMessage += "\n\t\t"; - - sprintf(tmp, PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id); - extMessage += tmp; - - extMessage += "\n\t\t"; - extMessage += ZapitTools::UTF8_to_UTF8XML(info1.c_str()); - extMessage += "\n\t\t"; - extMessage += ZapitTools::UTF8_to_UTF8XML(info2.c_str()); - extMessage += "\n\t\t"; - sprintf(tmp, "%llu", epgid); - extMessage += tmp; - extMessage += "\n\t\t"; - sprintf(tmp, "%d", g_Zapit->getMode()); - extMessage += tmp; - extMessage += "\n\t\t"; - sprintf(tmp, "%u", si.vpid); - extMessage += tmp; - extMessage += "\n\t\t\n"; - // super hack :-), der einfachste weg an die apid descriptions ranzukommen - g_RemoteControl->current_PIDs = pids; - g_RemoteControl->processAPIDnames(); - - for(unsigned int i= 0; i< pids.APIDs.size(); i++) - { - extMessage += "\t\t\t\n" - "\t\t"; - sprintf(tmp, "%u", si.vtxtpid); - extMessage += tmp; - extMessage += - "\n" - "\t\n" - "\n"; - - return extMessage; -} - -bool CVCRControl::CFileDevice::Stop() -{ - std::string extMessage = " "; - time_t end_time = time(0); -//printf("[direct] Stop recording, recMovieInfo %lx\n", recMovieInfo); fflush(stdout); -//FIXME why not save info if shift ? - //if(!autoshift || autoshift_delete) - if(recMovieInfo && cMovieInfo) { - // recMovieInfo->length = (end_time - start_time) / 60; - recMovieInfo->length = (int) round((double) (end_time - start_time) / (double) 60); - cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo); - } - bool return_value = (::stop_recording(extMessage.c_str()) == STREAM2FILE_OK); - - RestoreNeutrino(); - - deviceState = CMD_VCR_STOP; - - if(recMovieInfo) { - recMovieInfo->audioPids.clear(); - delete recMovieInfo; - recMovieInfo = NULL; - } - if(cMovieInfo) { - delete cMovieInfo; - cMovieInfo = NULL; - } - - return return_value; -} - -bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode, const time_t epg_time) -{ - std::string ext_channel_name; - unsigned short apids[REC_MAX_PIDS]; - unsigned int numpids = 0; - unsigned int pos; - char filename[512]; // UTF-8 - - printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx, apidmode 0x%X mode %d\n", - channel_id, epgid, apidmode, mode); - - CutBackNeutrino(channel_id, mode); - - apids_mode = apidmode; - - CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo(); - - if (si.vpid != 0) - transfer_pids(si.vpid, si.vtype ? EN_TYPE_AVC : EN_TYPE_VIDEO, 0); - - APIDList apid_list; - getAPIDs(apids_mode, apid_list); - - for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); it++) { - apids[numpids++] = it->apid; - transfer_pids(it->apid, EN_TYPE_AUDIO, it->ac3 ? 1 : 0); - } -#if 0 // FIXME : why this needed ? - if(!apid_list.empty()) - g_Zapit->setAudioChannel(apid_list.begin()->index); -#endif -#if 0 - CZapitClient::responseGetPIDs allpids; - g_Zapit->getPIDS(allpids); -#endif - - if ((StreamVTxtPid) && (si.vtxtpid != 0)) { - apids[numpids++] = si.vtxtpid; - } - if ((StreamPmtPid) && (si.pmtpid != 0)) { - apids[numpids++] = si.pmtpid; - } - - // Create filename for recording - pos = Directory.size(); - strcpy(filename, Directory.c_str()); - - if ((pos == 0) || (filename[pos - 1] != '/')) { - filename[pos] = '/'; - pos++; - filename[pos] = '\0'; - } - pos = strlen(filename); -#if 0 - time_t t = time(NULL); - strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); - strcat(filename, "_"); - pos = strlen(filename); -#endif - ext_channel_name = g_Zapit->getChannelName(channel_id); - if (!(ext_channel_name.empty())) - { - strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_channel_name.c_str())); - ZapitTools::replace_char(&filename[pos]); - - if (!autoshift && g_settings.recording_save_in_channeldir) { - struct stat statInfo; - int res = stat(filename,&statInfo); - if (res == -1) { - if (errno == ENOENT) { - res = safe_mkdir(filename); - if (res == 0) { - strcat(filename,"/"); - } else { - perror("[vcrcontrol] mkdir"); - } - - } else { - perror("[vcrcontrol] stat"); - } - } else { - // directory exists - strcat(filename,"/"); - } - - } else - strcat(filename, "_"); - } - - pos = strlen(filename); - if (g_settings.recording_epg_for_filename) { - if(epgid != 0) { - CShortEPGData epgdata; - //if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) - if(sectionsd_getEPGidShort(epgid, &epgdata)) - { - if (!(epgdata.title.empty())) - { - strcpy(&(filename[pos]), epgdata.title.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } - } else if (!epgTitle.empty()) { - strcpy(&(filename[pos]), epgTitle.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } -#if 1 - pos = strlen(filename); - time_t t = time(NULL); - strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); - //pos = strlen(filename); -#endif - - start_time = time(0); - stream2file_error_msg_t error_msg = ::start_recording(filename, - getMovieInfoString(CMD_VCR_RECORD, channel_id, epgid, epgTitle, apid_list, epg_time).c_str(), - si.vpid, apids, numpids); - - if (error_msg == STREAM2FILE_OK) { - deviceState = CMD_VCR_RECORD; - return true; - } - else { - RestoreNeutrino(); - - printf("[vcrcontrol] stream2file error code: %d\n", error_msg); - //FIXME: Use better error message - DisplayErrorMessage(g_Locale->getText( - error_msg == STREAM2FILE_BUSY ? LOCALE_STREAMING_BUSY : - error_msg == STREAM2FILE_INVALID_DIRECTORY ? LOCALE_STREAMING_DIR_NOT_WRITABLE : - LOCALE_STREAMINGSERVER_NOCONNECT - )); // UTF-8 - - return false; - } -} - -bool CVCRControl::CFileDevice::Update(void) -{ - EPG_AUDIO_PIDS audio_pids; - std::string extMessage; - //unsigned short apids[REC_MAX_PIDS]; - //unsigned int numpids = 0; - APIDList apid_list; - APIDList::iterator it; - bool update = false; - - if(!recMovieInfo || !cMovieInfo) - return false; - - getAPIDs(apids_mode, apid_list); - CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo (); - - g_RemoteControl->current_PIDs = allpids; - g_RemoteControl->processAPIDnames(); - - for(it = apid_list.begin(); it != apid_list.end(); it++) { - bool found = false; - for(unsigned int i = 0; i < rec_numpida; i++) { - if(rec_apids[i] == it->apid) { - found = true; - break; - } - } - if(!found) { - update = true; - printf("CVCRControl::CFileDevice::Update: apid %x not found in recording pids\n", it->apid); - for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if(allpids.APIDs[i].pid == it->apid) { - audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; - audio_pids.selected = (audio_pids.epgAudioPid == (int) rec_currentapid) ? 1 : 0; - recMovieInfo->audioPids.push_back(audio_pids); - - if(allpids.APIDs[i].is_ac3) - rec_ac3flags[rec_numpida] = 1; - if(allpids.APIDs[i].is_aac) - rec_ac3flags[rec_numpida] = 5; - - rec_apids[rec_numpida] = allpids.APIDs[i].pid; - if(rec_apids[rec_numpida] == rec_currentapid) - rec_currentac3 = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; - rec_numpida++; - } - - } - } - } - if(!update) { - printf("CVCRControl::CFileDevice::Update: no update needed\n"); - return false; - } - - cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo); - /* neutrino check if vpid changed, so using 0 to disable vpid restart */ - ::update_recording(extMessage.c_str(), 0 /*si.vpid*/, rec_apids, rec_numpida); - - return true; -} - -bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata); - -void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname) -{ - char filename[512]; // UTF-8 - char cmd[512]; - std::string channel_name; - CEPGData epgData; - event_id_t epgid = 0; - unsigned int pos; - - if(!fname) { - if(safe_mkdir((char *) "/hdd/screenshots/")) - return; - - strcpy(filename, "/hdd/screenshots/"); - - pos = strlen(filename); - channel_name = g_Zapit->getChannelName(channel_id); - if (!(channel_name.empty())) { - strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str())); - ZapitTools::replace_char(&filename[pos]); - strcat(filename, "_"); - } - pos = strlen(filename); - - //if (g_Sectionsd->getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData)) - if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData)) - {}; - epgid = epgData.eventID; - if(epgid != 0) { - CShortEPGData epgdata; - //if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) { - if(sectionsd_getEPGidShort(epgid, &epgdata)) { - if (!(epgdata.title.empty())) { - strcpy(&(filename[pos]), epgdata.title.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } - } - pos = strlen(filename); - time_t t = time(NULL); - strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); - strcat(filename, ".bmp"); - } else - strcpy(filename, fname); - - sprintf(cmd, "grab -v %s", filename); -printf("Executing %s\n", cmd); - CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Saving screenshot.."); - hintBox->paint(); - system(cmd); - hintBox->hide(); - delete hintBox; -} - -//------------------------------------------------------------------------- -bool CVCRControl::CServerDevice::Stop() -{ - printf("Stop\n"); - - bool return_value = sendCommand(CMD_VCR_STOP); - RestoreNeutrino(); - - return return_value; -} - -//------------------------------------------------------------------------- -bool CVCRControl::CServerDevice::Record(const t_channel_id channel_id, int mode, const event_id_t epgid, const std::string& epgTitle, unsigned char apids, const time_t /*epg_time*/) -{ - printf("Record channel_id: " - PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - " epg: %llx, apids 0x%X mode %d\n", - channel_id, - epgid, - apids, - mode); - - CutBackNeutrino(channel_id, mode); - if(!sendCommand(CMD_VCR_RECORD, channel_id, epgid, epgTitle, apids)) - { - RestoreNeutrino(); - - DisplayErrorMessage(g_Locale->getText(LOCALE_STREAMINGSERVER_NOCONNECT)); - - return false; - } - else { - //ext_channel_name = g_Zapit->getChannelName(channel_id); - return true; - } -} - - -//------------------------------------------------------------------------- -void CVCRControl::CServerDevice::serverDisconnect() -{ - close(sock_fd); -} - -//------------------------------------------------------------------------- -bool CVCRControl::CServerDevice::sendCommand(CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apids) -{ - printf("Send command: %d channel_id: " - PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - " epgid: %llx\n", - command, - channel_id, - epgid); - if(serverConnect()) - { - std::string extMessage = getCommandString(command, channel_id, epgid, epgTitle, apids); - - printf("sending to vcr-client:\n\n%s\n", extMessage.c_str()); - write(sock_fd, extMessage.c_str() , extMessage.length() ); - - serverDisconnect(); - - deviceState = command; - return true; - } - else - return false; - -} - -//------------------------------------------------------------------------- -bool CVCRControl::CServerDevice::serverConnect() -{ - - printf("connect to server: %s:%d\n",ServerAddress.c_str(),ServerPort); - - sock_fd=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - SAI servaddr; - memset(&servaddr,0,sizeof(SAI)); - servaddr.sin_family=AF_INET; - servaddr.sin_port=htons(ServerPort); - inet_pton(AF_INET, ServerAddress.c_str(), &servaddr.sin_addr); - - - if(connect(sock_fd, (SA *)&servaddr, sizeof(servaddr))==-1) - { - perror("[cvcr] - cannot connect to streamingserver\n"); - return false; - } - - return true; -} - -//------------------------------------------------------------------------- -std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const CVCRCommand /*command*/, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, APIDList apid_list, const time_t epg_time) -{ - std::string extMessage; - std::string info1, info2; - - if(!cMovieInfo) - cMovieInfo = new CMovieInfo(); - if(!recMovieInfo) - recMovieInfo = new MI_MOVIE_INFO(); - - cMovieInfo->clearMovieInfo(recMovieInfo); -#if 0 - CZapitClient::responseGetPIDs pids; - g_Zapit->getPIDS (pids); -#endif - CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo (); - - std::string tmpstring = g_Zapit->getChannelName(channel_id); - if (tmpstring.empty()) - recMovieInfo->epgChannel = "unknown"; - else - recMovieInfo->epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); - - tmpstring = "not available"; - if (epgid != 0) { - CEPGData epgdata; - if (sectionsd_getEPGid(epgid, epg_time, &epgdata)) { - tmpstring = epgdata.title; - info1 = epgdata.info1; - info2 = epgdata.info2; - - recMovieInfo->parentalLockAge = epgdata.fsk; - if(epgdata.contentClassification.size() > 0 ) - recMovieInfo->genreMajor = epgdata.contentClassification[0]; - - recMovieInfo->length = epgdata.epg_times.dauer / 60; - - printf("fsk:%d, Genre:%d, Dauer: %d\r\n",recMovieInfo->parentalLockAge,recMovieInfo->genreMajor,recMovieInfo->length); - } - } else if (!epgTitle.empty()) { - tmpstring = epgTitle; - } - recMovieInfo->epgTitle = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); - recMovieInfo->epgId = channel_id; - recMovieInfo->epgInfo1 = ZapitTools::UTF8_to_UTF8XML(info1.c_str()); - recMovieInfo->epgInfo2 = ZapitTools::UTF8_to_UTF8XML(info2.c_str()); - recMovieInfo->epgEpgId = epgid ; - recMovieInfo->epgMode = g_Zapit->getMode(); - recMovieInfo->epgVideoPid = si.vpid; - recMovieInfo->VideoType = si.vtype; - - rec_vpid = si.vpid; - rec_vtype = si.vtype; - rec_currentapid = si.apid; - memset(rec_apids, 0, sizeof(unsigned short)*REC_MAX_APIDS); - memset(rec_ac3flags, 0, sizeof(unsigned short)*REC_MAX_APIDS); - rec_numpida = 0; - - EPG_AUDIO_PIDS audio_pids; - /* super hack :-), der einfachste weg an die apid descriptions ranzukommen */ - g_RemoteControl->current_PIDs = allpids; - g_RemoteControl->processAPIDnames(); - - APIDList::iterator it; - for(unsigned int i= 0; i< allpids.APIDs.size(); i++) { - for(it = apid_list.begin(); it != apid_list.end(); it++) { - if(allpids.APIDs[i].pid == it->apid) { - audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; - audio_pids.selected = (audio_pids.epgAudioPid == (int) rec_currentapid) ? 1 : 0; - recMovieInfo->audioPids.push_back(audio_pids); - - if(allpids.APIDs[i].is_ac3) - rec_ac3flags[rec_numpida] = 1; - if(allpids.APIDs[i].is_aac) - rec_ac3flags[rec_numpida] = 5; - - rec_apids[rec_numpida] = allpids.APIDs[i].pid; - if(rec_apids[rec_numpida] == rec_currentapid) - rec_currentac3 = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; - rec_numpida++; - } - } - } - /* FIXME sometimes no apid in xml ?? */ - if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) { - int i = 0; - audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; - audio_pids.selected = 1; - recMovieInfo->audioPids.push_back(audio_pids); - } - recMovieInfo->epgVTXPID = si.vtxtpid; - - cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo); - - return extMessage; -} diff --git a/src/driver/vcrcontrol.h b/src/driver/vcrcontrol.h deleted file mode 100644 index 088d5ee58..000000000 --- a/src/driver/vcrcontrol.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - - License: GPL - - 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. -*/ -#ifndef __vcrcontrol__ -#define __vcrcontrol__ - -#include -//#include -#include - -#include -#include - -#include -#include - -#define REC_MAX_APIDS 10 -#define REC_MAX_PIDS 13 - -class CVCRControl -{ - public: - typedef enum CVCRStates - { - CMD_VCR_UNKNOWN = 0, - CMD_VCR_RECORD = 1, - CMD_VCR_STOP = 2, - CMD_VCR_PAUSE = 3, - CMD_VCR_RESUME = 4, - CMD_VCR_AVAILABLE = 5 - } CVCRCommand; - - enum CVCRDevices - { - DEVICE_VCR, - DEVICE_SERVER, - DEVICE_FILE - }; - - class CDevice // basisklasse für die devices - { - public: - int sock_fd; - int last_mode; - time_t start_time; - virtual CVCRDevices getDeviceType(void) const = 0; - CVCRStates deviceState; - virtual bool Stop() = 0; - virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0) = 0; // epg_time added for .xml (MovieBrowser) - virtual bool Pause() = 0; - virtual bool Resume() = 0; - virtual bool Update() = 0; - virtual bool IsAvailable() = 0; - CDevice() { deviceState = CMD_VCR_STOP; cMovieInfo = NULL; recMovieInfo = NULL; rec_numpida = 0; rec_vpid = 0;}; - virtual ~CDevice(){}; - typedef struct { - unsigned short apid; - unsigned int index; - bool ac3; - } APIDDesc; - typedef std::list APIDList; - virtual void getAPIDs(const unsigned char apidmode, APIDList & apid_list); - CMovieInfo * cMovieInfo; - MI_MOVIE_INFO * recMovieInfo; - unsigned short rec_vpid; - unsigned short rec_vtype; - unsigned short rec_apids[REC_MAX_APIDS]; - unsigned short rec_ac3flags[REC_MAX_APIDS]; - unsigned short rec_numpida; - unsigned short rec_currentapid, rec_currentac3; - unsigned char apids_mode; - CZapitClient::responseGetPIDs allpids; - }; - - class CVCRDevice : public CDevice // VCR per IR - { - public: - bool SwitchToScart; - - virtual CVCRDevices getDeviceType(void) const - { - return DEVICE_VCR; - }; - virtual bool Stop(); - virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser) - virtual bool Pause() { return false; }; - virtual bool Resume() { return false; }; - virtual bool Update() { return false; }; - virtual bool IsAvailable() { return true; }; - CVCRDevice(bool switchtoscart) { SwitchToScart = switchtoscart; }; - virtual ~CVCRDevice(){}; - }; - - class CFileAndServerDevice : public CDevice - { - protected: - void RestoreNeutrino(void); - void CutBackNeutrino(const t_channel_id channel_id, const int mode); - std::string getCommandString(const CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apidmode); - std::string getMovieInfoString(const CVCRCommand command, const t_channel_id channel_id,const event_id_t epgid, const std::string& epgTitle, APIDList apid_list, const time_t epg_time); - - public: - bool StopPlayBack; - bool StopSectionsd; - - virtual bool Pause() { return false; }; - virtual bool Resume() { return false; }; - virtual bool Update() { return false; }; - virtual bool IsAvailable() { return true; }; - }; - - class CFileDevice : public CFileAndServerDevice - { - public: - std::string Directory; - unsigned int SplitSize; - bool Use_O_Sync; - bool Use_Fdatasync; - bool StreamVTxtPid; - bool StreamPmtPid; - unsigned int RingBuffers; - - virtual CVCRDevices getDeviceType(void) const - { - return DEVICE_FILE; - }; - - virtual bool Stop(); - virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser) - virtual bool Update(void); - - CFileDevice(const bool stopplayback, const bool stopsectionsd, const char * const directory, const unsigned int splitsize, const bool use_o_sync, const bool use_fdatasync, const bool stream_vtxt_pid, const bool stream_pmt_pid, const unsigned int ringbuffers) - { - StopPlayBack = stopplayback; - StopSectionsd = stopsectionsd; - Directory = directory; - SplitSize = splitsize; - Use_O_Sync = use_o_sync; - Use_Fdatasync = use_fdatasync; - StreamVTxtPid = stream_vtxt_pid; - StreamPmtPid = stream_pmt_pid; - RingBuffers = ringbuffers; - }; - virtual ~CFileDevice() - { - }; - }; - - class CServerDevice : public CFileAndServerDevice // externer Streamingserver per tcp - { - private: - bool serverConnect(); - void serverDisconnect(); - - bool sendCommand(CVCRCommand command, const t_channel_id channel_id = 0, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0); - - public: - std::string ServerAddress; - unsigned int ServerPort; - - virtual CVCRDevices getDeviceType(void) const - { - return DEVICE_SERVER; - }; - - virtual bool Stop(); - virtual bool Record(const t_channel_id channel_id = 0, int mode=1, const event_id_t epgid = 0, const std::string& epgTitle = "", unsigned char apidmode = 0, const time_t epg_time=0); // epg_time added for .xml (MovieBrowser) - - CServerDevice(const bool stopplayback, const bool stopsectionsd, const char * const serveraddress, const unsigned int serverport) - { - StopPlayBack = stopplayback; - StopSectionsd = stopsectionsd; - ServerAddress = serveraddress; - ServerPort = serverport; - }; - virtual ~CServerDevice(){}; - }; - - public: - CVCRControl(); - ~CVCRControl(); - static CVCRControl * getInstance(); - - CDevice * Device; - - void registerDevice(CDevice * const device); - void unregisterDevice(); - - inline bool isDeviceRegistered(void) const { return (Device != NULL); }; - - inline CVCRStates getDeviceState(void) const { return Device->deviceState; }; - bool Stop(){return Device->Stop();}; - bool Record(const CTimerd::RecordingInfo * const eventinfo); - bool Pause(){return Device->Pause();}; - bool Resume(){return Device->Resume();}; - bool Update() {return Device->Update();}; - void Screenshot(const t_channel_id channel_id, char * fname = NULL); - MI_MOVIE_INFO * GetMovieInfo(void); - bool GetPids(unsigned short *vpid, unsigned short *vtype, unsigned short *apid, unsigned short *atype, unsigned short * apidnum, unsigned short * apids, unsigned short * atypes); -}; - - -#endif diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index b4c2e42a1..f39896ecb 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -67,6 +67,7 @@ CVFD::CVFD() } text[0] = 0; clearClock = 0; + mode = MODE_TVRADIO; } CVFD::~CVFD() @@ -801,7 +802,7 @@ void CVFD::showFilelist(int flist_pos,CFileList* flist,const char * const mainDi if (mode == MODE_FILEBROWSER && m_fileList != NULL && - m_fileList->size() > 0) + !m_fileList->empty() ) { printf("[lcdd] FileList:OK\n"); diff --git a/src/sectionsd/FreesatTables.hpp b/src/eitd/FreesatTables.hpp similarity index 100% rename from src/sectionsd/FreesatTables.hpp rename to src/eitd/FreesatTables.hpp diff --git a/src/sectionsd/Makefile.am b/src/eitd/Makefile.am similarity index 67% rename from src/sectionsd/Makefile.am rename to src/eitd/Makefile.am index b08bc2f1e..8b2afccc5 100644 --- a/src/sectionsd/Makefile.am +++ b/src/eitd/Makefile.am @@ -1,4 +1,6 @@ INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ @@ -18,7 +20,9 @@ INCLUDES += -I$(top_srcdir)/lib/libtriple endif endif -AM_CPPFLAGS = -D DO_NOT_INCLUDE_STUFF_NOT_NEEDED_FOR_SECTIONSD +#AM_CPPFLAGS = +AM_CPPFLAGS = -fno-rtti -fno-exceptions noinst_LIBRARIES = libsectionsd.a -libsectionsd_a_SOURCES = sectionsd.cpp dmxapi.cpp debug.cpp dmx.cpp SIsections.cpp SIevents.cpp SIutils.cpp SIlanguage.cpp edvbstring.cpp +libsectionsd_a_SOURCES = sectionsd.cpp debug.cpp dmx.cpp xmlutil.cpp \ + SIsections.cpp SIevents.cpp SIutils.cpp SIlanguage.cpp edvbstring.cpp diff --git a/src/eitd/SIevents.cpp b/src/eitd/SIevents.cpp new file mode 100644 index 000000000..3e89ed875 --- /dev/null +++ b/src/eitd/SIevents.cpp @@ -0,0 +1,580 @@ +/* + * class SIevents (dbox-II-project) + * + * Copyright (C) 2001 fnbrd (fnbrd@gmx.de) + * Homepage: http://dbox2.elxsi.de + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * 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; + * + * 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. + * + */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "SIlanguage.hpp" +#include "SIutils.hpp" +#include "SIevents.hpp" + +const std::string languangeOFF = "OFF"; + +struct descr_generic_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; +} __attribute__ ((packed)) ; + +struct descr_short_event_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; + unsigned language_code_hi : 8; + unsigned language_code_mid : 8; + unsigned language_code_lo : 8; + unsigned event_name_length : 8; +} __attribute__ ((packed)) ; + +struct descr_extended_event_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; + unsigned descriptor_number : 4; + unsigned last_descriptor_number : 4; + unsigned iso_639_2_language_code_hi : 8; + unsigned iso_639_2_language_code_mid : 8; + unsigned iso_639_2_language_code_lo : 8; + unsigned length_of_items : 8; +} __attribute__ ((packed)) ; + +inline unsigned min(unsigned a, unsigned b) +{ + return b < a ? b : a; +} + +SIevent::SIevent(const t_original_network_id _original_network_id, const t_transport_stream_id _transport_stream_id, const t_service_id _service_id, + const unsigned short _event_id) +{ + original_network_id = _original_network_id; + transport_stream_id = _transport_stream_id; + service_id = _service_id; + eventID = _event_id; + table_id = 0xFF; /* not set */ + version = 0xFF; + running = 0; +} + +SIevent::SIevent(const struct eit_event *e) +{ + eventID = (e->event_id_hi << 8) | e->event_id_lo; + time_t start_time = changeUTCtoCtime(((const unsigned char *)e) + 2); + unsigned long duration = 0; + + if (!((e->duration_hi == 0xff) && (e->duration_mid == 0xff) && (e->duration_lo == 0xff))) + duration = ((e->duration_hi)>>4)*10*3600L + ((e->duration_hi)&0x0f)*3600L + + ((e->duration_mid)>>4)*10*60L + ((e->duration_mid)&0x0f)*60L + + ((e->duration_lo)>>4)*10 + ((e->duration_lo)&0x0f); + + if (start_time && duration) + times.insert(SItime(start_time, duration)); + + running = (int)e->running_status; + + table_id = 0xFF; /* not set */ + version = 0xFF; + service_id = 0; + original_network_id = 0; + transport_stream_id = 0; +} + +void SIevent::parse(Event &event) +{ + int tsidonid = (transport_stream_id << 16) | original_network_id; + time_t start_time = parseDVBtime(event.getStartTimeMjd(), event.getStartTimeBcd()); + + running = event.getRunningStatus(); + + uint32_t duration = event.getDuration(); + uint8_t duration_hi = (duration >> 16) & 0xFF; + uint8_t duration_mid = (duration >> 8) & 0xFF; + uint8_t duration_lo = duration & 0xFF; + + if (!((duration_hi == 0xff) && (duration_mid == 0xff) && (duration_lo == 0xff))) + duration = ((duration_hi)>>4)*10*3600L + ((duration_hi)&0x0f)*3600L + + ((duration_mid)>>4)*10*60L + ((duration_mid)&0x0f)*60L + + ((duration_lo)>>4)*10 + ((duration_lo)&0x0f); + +//printf("SIevent::parse : eventID %x start %d duration %d\n", eventID, (int) start_time, (int) duration); + if (start_time && duration) + times.insert(SItime(start_time, duration)); + const DescriptorList &dlist = *event.getDescriptors(); + for (DescriptorConstIterator dit = dlist.begin(); dit != dlist.end(); ++dit) { + uint8_t dtype = (*dit)->getTag(); + if(dtype == SHORT_EVENT_DESCRIPTOR) { + const ShortEventDescriptor *d = (ShortEventDescriptor*) *dit; + std::string lang = d->getIso639LanguageCode(); + std::transform(lang.begin(), lang.end(), lang.begin(), tolower); + int table = getCountryCodeDefaultMapping(lang); + setName(lang, stringDVBUTF8(d->getEventName(), table, tsidonid)); + setText(lang, stringDVBUTF8(d->getText(), table, tsidonid)); + } + else if(dtype == EXTENDED_EVENT_DESCRIPTOR) { + const ExtendedEventDescriptor *d = (ExtendedEventDescriptor*) *dit; + std::string lang = d->getIso639LanguageCode(); + std::transform(lang.begin(), lang.end(), lang.begin(), tolower); + int table = getCountryCodeDefaultMapping(lang); +#ifdef USE_ITEM_DESCRIPTION + const ExtendedEventList *itemlist = d->getItems(); + for (ExtendedEventConstIterator it = itemlist->begin(); it != itemlist->end(); ++it) { + itemDescription.append(stringDVBUTF8((*it)->getItemDescription(), table, tsidonid)); + itemDescription.append("\n"); + item.append(stringDVBUTF8((*it)->getItem(), table, tsidonid)); + item.append("\n"); + } +#endif + appendExtendedText(lang, stringDVBUTF8(d->getText(), table, tsidonid)); + } + else if(dtype == CONTENT_DESCRIPTOR) { + const ContentDescriptor * d = (ContentDescriptor *) *dit; + const ContentClassificationList *clist = d->getClassifications(); + for (ContentClassificationConstIterator cit = clist->begin(); cit != clist->end(); ++cit) { + ContentClassification * c = *cit; + char content = c->getContentNibbleLevel1() << 4 | c->getContentNibbleLevel2(); + contentClassification += content; + char user = c->getUserNibble1() << 4 | c->getUserNibble2(); + userClassification += user; + } + } + else if(dtype == COMPONENT_DESCRIPTOR) { + const ComponentDescriptor *d = (ComponentDescriptor*)*dit; + SIcomponent c; + c.streamContent = d->getStreamContent(); + c.componentType = d->getComponentType(); + c.componentTag = d->getComponentTag(); + std::string lang = d->getIso639LanguageCode(); + std::transform(lang.begin(), lang.end(), lang.begin(), tolower); + int table = getCountryCodeDefaultMapping(lang); + c.component = stringDVBUTF8(d->getText(), table, tsidonid); + //components.insert(c); + components.push_back(c); + } + else if(dtype == PARENTAL_RATING_DESCRIPTOR) { + const ParentalRatingDescriptor *d = (ParentalRatingDescriptor*) *dit; + const ParentalRatingList *plist = d->getParentalRatings(); + for (ParentalRatingConstIterator it = plist->begin(); it != plist->end(); ++it) { + SIparentalRating p((*it)->getCountryCode(), (*it)->getRating()); + //ratings.insert(p); + ratings.push_back(p); + } + } + else if(dtype == LINKAGE_DESCRIPTOR) { + const LinkageDescriptor * d = (LinkageDescriptor *) *dit; + SIlinkage l; + l.linkageType = d->getLinkageType(); + l.transportStreamId = d->getTransportStreamId(); + l.originalNetworkId = d->getOriginalNetworkId(); + l.serviceId = d->getServiceId(); + const PrivateDataByteVector *privateData = d->getPrivateDataBytes(); + l.name = convertDVBUTF8((const char*)&((*privateData)[0]), privateData->size(), 1, tsidonid); + linkage_descs.insert(linkage_descs.end(), l); + } +#if 0 // TODO ? vps was never used + else if(dtype == PDC_DESCRIPTOR) { + } +#endif + } +} + +void SIevent::parseDescriptors(const uint8_t *des, unsigned len) +{ + struct descr_generic_header *desc; + /* we pass the buffer including the eit_event header, so we have to + * skip it here... */ + des += sizeof(struct eit_event); + len -= sizeof(struct eit_event); + while(len>=sizeof(struct descr_generic_header)) { + desc=(struct descr_generic_header *)des; + /*printf("Type: %s\n", decode_descr(desc->descriptor_tag)); */ + if(desc->descriptor_tag==0x4D) + parseShortEventDescriptor((const uint8_t *)desc, len); + else if(desc->descriptor_tag==0x4E) + parseExtendedEventDescriptor((const uint8_t *)desc, len); + else if(desc->descriptor_tag==0x54) + parseContentDescriptor((const uint8_t *)desc, len); + else if(desc->descriptor_tag==0x50) + parseComponentDescriptor((const uint8_t *)desc, len); + else if(desc->descriptor_tag==0x55) + parseParentalRatingDescriptor((const uint8_t *)desc, len); + else if(desc->descriptor_tag==0x4A) { + parseLinkageDescriptor((const uint8_t *)desc, len); + } +#if 0 + else if(desc->descriptor_tag==0x69) + parsePDCDescriptor((const char *)desc, e, len); +#endif + if((unsigned)(desc->descriptor_length+2)>len) + break; + len-=desc->descriptor_length+2; + des+=desc->descriptor_length+2; + } +} + +void SIevent::parseShortEventDescriptor(const uint8_t *buf, unsigned maxlen) +{ + struct descr_short_event_header *evt=(struct descr_short_event_header *)buf; + if((evt->descriptor_length+sizeof(descr_generic_header) > maxlen) || + (evt->descriptor_lengthlanguage_code_hi), tolower(evt->language_code_mid), tolower(evt->language_code_lo), '\0'}; + std::string language(lang); + int table = getCountryCodeDefaultMapping(language); + + buf+=sizeof(struct descr_short_event_header); + if(evt->event_name_length) + setName(language, convertDVBUTF8((const char*) buf, evt->event_name_length, table, tsidonid)); + + buf+=evt->event_name_length; + unsigned char textlength=*((unsigned char *)buf); + if(textlength > 2) + setText(language, convertDVBUTF8((const char*) (++buf), textlength, table, tsidonid)); +} + +void SIevent::parseExtendedEventDescriptor(const uint8_t *buf, unsigned maxlen) +{ + struct descr_extended_event_header *evt=(struct descr_extended_event_header *)buf; + if((evt->descriptor_length+sizeof(descr_generic_header)>maxlen) || + (evt->descriptor_lengthiso_639_2_language_code_hi), tolower(evt->iso_639_2_language_code_mid), tolower(evt->iso_639_2_language_code_lo), '\0'}; + std::string language(lang); + int table = getCountryCodeDefaultMapping(language); + + unsigned char *items=(unsigned char *)(buf+sizeof(struct descr_extended_event_header)); + while(items < (unsigned char *)(buf + sizeof(struct descr_extended_event_header) + evt->length_of_items)) { +#ifdef USE_ITEM_DESCRIPTION + if(*items) { + itemDescription.append(convertDVBUTF8((const char *)(items+1), min(maxlen-(items+1-buf), *items), table, tsidonid)); + itemDescription.append("\n"); + } +#endif + items+=1+*items; +#ifdef USE_ITEM_DESCRIPTION + if(*items) { + item.append(convertDVBUTF8((const char *)(items+1), min(maxlen-(items+1-buf), *items), table, tsidonid)); + item.append("\n"); + } +#endif + items+=1+*items; + } + if(*items) + appendExtendedText(language, convertDVBUTF8((const char *)(items+1), min(maxlen-(items+1-buf), (*items)), table, tsidonid)); +} + +void SIevent::parseContentDescriptor(const uint8_t *buf, unsigned maxlen) +{ + struct descr_generic_header *cont=(struct descr_generic_header *)buf; + if(cont->descriptor_length+sizeof(struct descr_generic_header)>maxlen) + return; + + const uint8_t *classification=buf+sizeof(struct descr_generic_header); + while(classification <= buf+sizeof(struct descr_generic_header)+cont->descriptor_length-2) { + contentClassification+=std::string((const char *)classification, 1); + userClassification+=std::string((const char *)classification+1, 1); + classification+=2; + } +} + +void SIevent::parseComponentDescriptor(const uint8_t *buf, unsigned maxlen) +{ + if(maxlen>=sizeof(struct descr_component_header)) + components.push_back(SIcomponent((const struct descr_component_header *)buf)); + //components.insert(SIcomponent((const struct descr_component_header *)buf)); +} + +void SIevent::parseParentalRatingDescriptor(const uint8_t *buf, unsigned maxlen) +{ + struct descr_generic_header *cont=(struct descr_generic_header *)buf; + if(cont->descriptor_length+sizeof(struct descr_generic_header)>maxlen) + return; + const uint8_t *s=buf+sizeof(struct descr_generic_header); + while(sdescriptor_length-4) { + //ratings.insert(SIparentalRating(std::string((const char *)s, 3), *(s+3))); + ratings.push_back(SIparentalRating(std::string((const char *)s, 3), *(s+3))); + s+=4; + } +} +void SIevent::parseLinkageDescriptor(const uint8_t *buf, unsigned maxlen) +{ + if(maxlen>=sizeof(struct descr_linkage_header)) { + SIlinkage l((const struct descr_linkage_header *)buf); + linkage_descs.insert(linkage_descs.end(), l); + } +} + +char SIevent::getFSK() const +{ + for (SIparentalRatings::const_iterator it = ratings.begin(); it != ratings.end(); ++it) + { + if (it->countryCode == "DEU") + { + if ((it->rating >= 0x01) && (it->rating <= 0x0F)) + return (it->rating + 3); // 0x01 to 0x0F minimum age = rating + 3 years + else + return (it->rating == 0 ? 0 : 18); // return FSK 18 for : 0x10 to 0xFF defined by the broadcaster + } + } + if (!ratings.empty()) + { + if ((ratings.begin()->rating >= 0x01) && (ratings.begin()->rating <= 0x0F)) + return (ratings.begin()->rating + 3); + else + return (ratings.begin()->rating == 0 ? 0 : 18); + } + + return 0x00; // 0x00 undefined +} + +std::string SIevent::getName() const +{ + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + std::map::const_iterator it = langName.begin() ; + if (it != langName.end()) return it->second; + else return(""); + } else { + std::string retval; + SIlanguage::filter(langName, 1, retval); + return retval; + } +} + +void SIevent::setName(const std::string &lang, const std::string &name) +{ + std::string tmp = name; + std::replace(tmp.begin(), tmp.end(), '\n', ' '); +//printf("setName: lang %s text %s\n", lang.c_str(), name.c_str()); + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + langName[languangeOFF] = tmp; //name; + } else { + langName[lang] = tmp; //name; + } +} + +std::string SIevent::getText() const +{ + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + std::map::const_iterator it = langText.begin() ; + if (it != langText.end()) return it->second; + else return(""); + } else { + std::string retval; + SIlanguage::filter(langText, 0, retval); + return retval; + } +} + +void SIevent::setText(const std::string &lang, const std::string &text) +{ +//printf("setText: lang %s text %s\n", lang.c_str(), text.c_str()); + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + langText[languangeOFF] = text; + } else { + langText[lang] = text; + } +} + +std::string SIevent::getExtendedText() const +{ + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + std::map::const_iterator it = langExtendedText.begin() ; + if (it != langExtendedText.end()) return it->second; + else return(""); + } else { + std::string retval; + SIlanguage::filter(langExtendedText, 0, retval); + return retval; + } +} + +void SIevent::appendExtendedText(const std::string &lang, const std::string &text) +{ + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + langExtendedText[languangeOFF] += text; + } else { + langExtendedText[lang] += text; + } +} + +void SIevent::setExtendedText(const std::string &lang, const std::string &text) +{ +//printf("setExtendedText: lang %s text %s\n", lang.c_str(), text.c_str()); + if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode()) { + langExtendedText[languangeOFF] = text; + } else { + langExtendedText[lang] = text; + } +} + +int SIevent::saveXML(FILE *file, const char *serviceName) const +{ + if(saveXML0(file)) + return 1; + if(serviceName) { + if(fprintf(file, " ")<0) + return 2; + saveStringToXMLfile(file, serviceName); + if(fprintf(file, "\n")<0) + return 3; + } + return saveXML2(file); +} + +int SIevent::saveXML0(FILE *file) const +{ + if(fprintf(file, "\t\t\n", eventID, table_id)<0) + return 1; + return 0; +} + +int SIevent::saveXML2(FILE *file) const +{ + for (std::map::const_iterator + i = langName.begin() ; + i != langName.end() ; + ++i) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } + for (std::map::const_iterator + i = langText.begin() ; + i != langText.end() ; + ++i) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } +#ifdef USE_ITEM_DESCRIPTION + if(item.length()) { + fprintf(file, "\t\t\t\n"); + } + if(itemDescription.length()) { + fprintf(file, "\t\t\t\n"); + } +#endif + for (std::map::const_iterator + i = langExtendedText.begin() ; + i != langExtendedText.end() ; + ++i) { + if (i->second.length()) { + fprintf(file, "\t\t\tfirst.c_str()); + saveStringToXMLfile(file, i->second.c_str()); + fprintf(file, "\"/>\n"); + } + } + for_each(times.begin(), times.end(), saveSItimeXML(file)); + for(unsigned i=0; i\n", contentClassification[i], userClassification[i]); + } + for_each(components.begin(), components.end(), saveSIcomponentXML(file)); + for_each(ratings.begin(), ratings.end(), saveSIparentalRatingXML(file)); + for_each(linkage_descs.begin(), linkage_descs.end(), saveSIlinkageXML(file)); + fprintf(file, "\t\t\n"); + return 0; +} + +void SIevent::dump(void) const +{ + printf("Unique key: %llx\n", uniqueKey()); + if(original_network_id) + printf("Original-Network-ID: %hu\n", original_network_id); + if (service_id) + printf("Service-ID: %hu\n", service_id); + printf("Event-ID: %hu\n", eventID); +#ifdef USE_ITEM_DESCRIPTION + if(item.length()) + printf("Item: %s\n", item.c_str()); + if(itemDescription.length()) + printf("Item-Description: %s\n", itemDescription.c_str()); +#endif + for (std::map::const_iterator it = langName.begin() ; + it != langName.end() ; ++it) + printf("Name (%s): %s\n", it->first.c_str(), it->second.c_str()); + for (std::map::const_iterator it = langText.begin() ; + it != langText.end() ; ++it) + printf("Text (%s): %s\n", it->first.c_str(), it->second.c_str()); + for (std::map::const_iterator it = langExtendedText.begin() ; + it != langExtendedText.end() ; ++it) + printf("Extended-Text (%s): %s\n", it->first.c_str(), it->second.c_str()); + + if(contentClassification.length()) { + printf("Content classification:"); + for(unsigned i=0; i::const_iterator it = langName.begin() ; + it != langName.end() ; ++it) + printf("Name (%s): %s\n", it->first.c_str(), it->second.c_str()); + for (std::map::const_iterator it = langText.begin() ; + it != langText.end() ; ++it) + printf("Text (%s): %s\n", it->first.c_str(), it->second.c_str()); + for (std::map::const_iterator it = langExtendedText.begin() ; + it != langExtendedText.end() ; ++it) + printf("Extended-Text (%s): %s\n", it->first.c_str(), it->second.c_str()); + + for_each(times.begin(), times.end(), printSItime()); + for_each(ratings.begin(), ratings.end(), printSIparentalRating()); + for_each(linkage_descs.begin(), linkage_descs.end(), printSIlinkage()); +} diff --git a/src/eitd/SIevents.hpp b/src/eitd/SIevents.hpp new file mode 100644 index 000000000..398f384b5 --- /dev/null +++ b/src/eitd/SIevents.hpp @@ -0,0 +1,503 @@ +/* + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * 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; + * + * 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. + * + */ +#ifndef SIEVENTS_HPP +#define SIEVENTS_HPP + +#include +#include +#include +#include +#include + +#include +#include +#include "edvbstring.h" + +//#define USE_ITEM_DESCRIPTION + +struct eit_event { + unsigned event_id_hi : 8; + unsigned event_id_lo : 8; + unsigned start_time_hi : 8; + unsigned start_time_hi2 : 8; + unsigned start_time_mid : 8; + unsigned start_time_lo2 : 8; + unsigned start_time_lo : 8; + unsigned duration_hi : 8; + unsigned duration_mid : 8; + unsigned duration_lo : 8; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned running_status : 3; + unsigned free_CA_mode : 1; + unsigned descriptors_loop_length_hi : 4; +#else + unsigned descriptors_loop_length_hi : 4; + unsigned free_CA_mode : 1; + unsigned running_status : 3; +#endif + unsigned descriptors_loop_length_lo : 8; +} __attribute__ ((packed)) ; + + +struct descr_component_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned reserved_future_use : 4; + unsigned stream_content : 4; +#else + unsigned stream_content : 4; + unsigned reserved_future_use : 4; +#endif + unsigned component_type : 8; + unsigned component_tag : 8; + unsigned iso_639_2_language_code_hi : 8; + unsigned iso_639_2_language_code_mid : 8; + unsigned iso_639_2_language_code_lo : 8; +} __attribute__ ((packed)) ; + +struct descr_linkage_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; + unsigned transport_stream_id_hi : 8; + unsigned transport_stream_id_lo : 8; + unsigned original_network_id_hi : 8; + unsigned original_network_id_lo : 8; + unsigned service_id_hi : 8; + unsigned service_id_lo : 8; + unsigned linkage_type : 8; +} __attribute__ ((packed)) ; + +struct descr_pdc_header { + unsigned descriptor_tag : 8; + unsigned descriptor_length : 8; + unsigned pil0 : 8; + unsigned pil1 : 8; + unsigned pil2 : 8; +} __attribute__ ((packed)) ; + +class SIlinkage { +public: + unsigned char linkageType; + std::string name; + t_transport_stream_id transportStreamId; + t_original_network_id originalNetworkId; + t_service_id serviceId; + + SIlinkage(void) { + linkageType = 0; + transportStreamId = 0; + originalNetworkId = 0; + serviceId = 0; + } + + SIlinkage(const struct descr_linkage_header *link) { + linkageType = link->linkage_type; + transportStreamId = (link->transport_stream_id_hi << 8) | link->transport_stream_id_lo; + originalNetworkId = (link->original_network_id_hi << 8) | link->original_network_id_lo; + serviceId = (link->service_id_hi << 8) | link->service_id_lo; + if (link->descriptor_length > sizeof(struct descr_linkage_header) - 2) + name = convertDVBUTF8(((const char *)link)+sizeof(struct descr_linkage_header), link->descriptor_length-(sizeof(struct descr_linkage_header)-2), 0, 0); + } + + void dump(void) const { + printf("Linakge Type: 0x%02hhx\n", linkageType); + if (name.length()) + printf("Name: %s\n", name.c_str()); + printf("Transport Stream Id: 0x%04hhx\n", transportStreamId); + printf("Original Network Id: 0x%04hhx\n", originalNetworkId); + printf("Service Id: 0x%04hhx\n", serviceId); + } + + int saveXML(FILE *file) const { + fprintf(file, "\t\t\t\n", transportStreamId, originalNetworkId, serviceId); +// %s, , name.c_str())<0) +// return 1; + return 0; + } + // Der Operator zum sortieren + bool operator < (const SIlinkage& l) const { + return name < l.name; + } + bool operator==(const SIlinkage& s) const { + return (linkageType == s.linkageType) && + (transportStreamId == s.transportStreamId) && + (originalNetworkId == s.originalNetworkId) && + (serviceId == s.serviceId) && + (name == s.name); + } + bool operator!=(const SIlinkage& s) const { + return (linkageType != s.linkageType) || + (transportStreamId != s.transportStreamId) || + (originalNetworkId != s.originalNetworkId) || + (serviceId != s.serviceId) || + (name != s.name); + } +}; +typedef std::vector SIlinkage_descs; + +// Fuer for_each +struct printSIlinkage : public std::unary_function +{ + void operator() (const SIlinkage &l) { l.dump();} +}; + +// Fuer for_each +struct saveSIlinkageXML : public std::unary_function +{ + FILE *f; + saveSIlinkageXML(FILE *fi) { f=fi;} + void operator() (const SIlinkage &l) { l.saveXML(f);} +}; + +class SIcomponent +{ + public: + std::string component; + unsigned char componentType; + unsigned char componentTag; + unsigned char streamContent; + + SIcomponent(void) { + streamContent=0; + componentType=0; + componentTag=0; + } + SIcomponent(const struct descr_component_header *comp) { + streamContent=comp->stream_content; + componentType=comp->component_type; + componentTag=comp->component_tag; + if(comp->descriptor_length>sizeof(struct descr_component_header)-2) + component=convertDVBUTF8(((const char *)comp)+sizeof(struct descr_component_header), + comp->descriptor_length-(sizeof(struct descr_component_header)-2), 0, 0); + } + + void dump(void) const { + if(component.length()) + printf("Component: %s\n", component.c_str()); + printf("Stream Content: 0x%02hhx\n", streamContent); + printf("Component type: 0x%02hhx\n", componentType); + printf("Component tag: 0x%02hhx\n", componentTag); + } + int saveXML(FILE *file) const { + fprintf(file, "\t\t\t\n"); + return 0; + } + // Der Operator zum sortieren + bool operator < (const SIcomponent& c) const { + return streamContent < c.streamContent; + } + bool operator==(const SIcomponent& c) const { + return (componentType == c.componentType) && + (componentTag == c.componentTag) && + (streamContent == c.streamContent) && + (component == c.component); + } + bool operator!=(const SIcomponent& c) const { + return (componentType != c.componentType) || + (componentTag != c.componentTag) || + (streamContent != c.streamContent) || + (component != c.component); + } +}; + +//typedef std::multiset > SIcomponents; +typedef std::vector SIcomponents; + +// Fuer for_each +struct printSIcomponent : public std::unary_function +{ + void operator() (const SIcomponent &c) { c.dump();} +}; + +// Fuer for_each +struct saveSIcomponentXML : public std::unary_function +{ + FILE *f; + saveSIcomponentXML(FILE *fi) { f=fi;} + void operator() (const SIcomponent &c) { c.saveXML(f);} +}; + +class SIparentalRating +{ + public: + std::string countryCode; + unsigned char rating; // Bei 1-16 -> Minumim Alter = rating +3 + + SIparentalRating(const std::string &cc, unsigned char rate) { + rating=rate; + countryCode=cc; + } + + // Der Operator zum sortieren + bool operator < (const SIparentalRating& c) const { + return countryCode < c.countryCode; + } + void dump(void) const { + printf("Rating: %s %hhu (+3)\n", countryCode.c_str(), rating); + } + int saveXML(FILE *file) const { + if(fprintf(file, "\t\t\t\n", countryCode.c_str(), rating)<0) + return 1; + return 0; + } + bool operator==(const SIparentalRating& p) const { + return (rating == p.rating) && + (countryCode == p.countryCode); + } + bool operator!=(const SIparentalRating& p) const { + return (rating != p.rating) || + (countryCode != p.countryCode); + } +}; +//typedef std::set > SIparentalRatings; +typedef std::vector SIparentalRatings; + +// Fuer for_each +struct printSIparentalRating : public std::unary_function +{ + void operator() (const SIparentalRating &r) { r.dump();} +}; + +// Fuer for_each +struct saveSIparentalRatingXML : public std::unary_function +{ + FILE *f; + saveSIparentalRatingXML(FILE *fi) { f=fi;} + void operator() (const SIparentalRating &r) { r.saveXML(f);} +}; + +class SItime { + public: + time_t startzeit; // lokale Zeit, 0 -> time shifted (cinedoms) + unsigned dauer; // in Sekunden, 0 -> time shifted (cinedoms) + + SItime(time_t s, unsigned d) { + startzeit=s; + dauer=d; // in Sekunden, 0 -> time shifted (cinedoms) + } + + // Der Operator zum sortieren + bool operator < (const SItime& t) const { + return startzeit < t.startzeit; + } + void dump(void) const { + printf("Startzeit: %s", ctime(&startzeit)); + printf("Dauer: %02u:%02u:%02u (%umin, %us)\n", dauer/3600, (dauer%3600)/60, dauer%60, dauer/60, dauer); + } + int saveXML(FILE *file) const { // saves the time + fprintf(file, "\t\t\t\n"); - - if (!tp_existed) - write_xml_provend(dst, is_sat); - - if (newprov) { - write_xml_footer(dst); - } - else { - fgets(buffer, 255, src); - while(!feof(src)) - { - fprintf(dst, buffer); - fgets(buffer, 255, src); - } - fclose(src); - } - - fclose(dst); - } - - return is_needed; -} - -xmlNodePtr getProviderFromSatellitesXML(xmlNodePtr node, const int position) -{ - struct stat buf; - const char *filename = ZAPITCONFIGDIR "/" SATELLITES_XML; - if ((stat(filename, &buf) == -1) && (errno == ENOENT)) - filename = DATADIR "/" SATELLITES_XML; - - xmlDocPtr satellites_parser = parseXmlFile(filename); - if (satellites_parser == NULL) - return NULL; - xmlNodePtr satellite = xmlDocGetRootElement(satellites_parser)->xmlChildrenNode; - while (satellite) { - if (xmlGetSignedNumericAttribute(satellite, "position", 16) == position) { - while (node) { - if (!strcmp(xmlGetAttribute(satellite, "name"), xmlGetAttribute(node, "name"))) - { - xmlFreeDoc(satellites_parser); - return node; - } - node = node->xmlNextNode; - } - } - satellite = satellite->xmlNextNode; - } - xmlFreeDoc(satellites_parser); - return NULL; -} - -xmlNodePtr getProviderbyName(xmlNodePtr current_provider, xmlNodePtr provider) { - while (current_provider) { - if (!strcmp(xmlGetAttribute(current_provider, "name"), xmlGetAttribute(provider, "name"))) - return current_provider; - current_provider = current_provider->xmlNextNode; - } - return NULL; -} - -xmlNodePtr findTransponderFromProv(xmlNodePtr transponder, const t_original_network_id onid, const t_transport_stream_id tsid) { - while (transponder) { - if ((xmlGetNumericAttribute(transponder, "onid", 16) == onid) && (xmlGetNumericAttribute(transponder, "id", 16) == tsid)) - return transponder; - transponder = transponder->xmlNextNode; - } - return NULL; -} - -//SDT-Thread calls this function if it found a complete Service Description Table (SDT). Overwrite for actual = true - for other = false -//static bool updateTP(const t_original_network_id onid, const t_transport_stream_id tsid, const int scanType, const bool overwrite) -static bool updateTP(const int scanType) -{ - xmlDocPtr service_parser = parseXmlFile(SERVICES_XML); - xmlDocPtr current_parser = NULL; - bool need_update = false; - FILE * tmp = NULL; - xmlNodePtr provider = NULL; - xmlNodePtr current_provider = NULL; - t_transport_stream_id tsid = 0; - t_original_network_id onid = 0; - - if (service_parser == NULL) - return false; - - int i = 0; - while ((i < MAX_SDTs) && (messaging_sdt_tid[i] != 0)) { - readLockMessaging(); - if (messaging_zap_detected) { - unlockMessaging(); - need_update = false; - if (current_parser != NULL) - xmlFreeDoc(current_parser); - unlink(CURRENTSERVICES_TMP); - break; - } - unlockMessaging(); - onid = (t_original_network_id) (messaging_sdt_tid[i] >> 16) & 0xffff; - tsid = (t_transport_stream_id) messaging_sdt_tid[i] & 0xffff; - -//GET_ORIGINAL_NETWORK_ID_FROM_CHANNEL_ID(channel_id) ((t_original_network_id)((channel_id) >> 16)) -//GET_SERVICE_ID_FROM_CHANNEL_ID(channel_id) ((t_service_id)(channel_id)) - - xmlNodePtr services_tp = FindTransponder(xmlDocGetRootElement(service_parser)->xmlChildrenNode, onid, tsid); - - if (services_tp) - provider = GetProvider(xmlDocGetRootElement(service_parser)->xmlChildrenNode, services_tp); - else - provider = NULL; - - tmp = fopen(CURRENTSERVICES_XML, "r"); - if (tmp) { - fclose(tmp); - current_parser= parseXmlFile(CURRENTSERVICES_XML); - } - - xmlNodePtr current_tp = NULL; - - if (current_parser != NULL) { - current_tp = FindTransponder(xmlDocGetRootElement(current_parser)->xmlChildrenNode, onid, tsid); - if (provider) { - //printf("getProvbyname\n"); - current_provider = getProviderbyName(xmlDocGetRootElement(current_parser)->xmlChildrenNode, provider); - - } - else { - if (current_tp) - current_provider = GetProvider(xmlDocGetRootElement(current_parser)->xmlChildrenNode, current_tp); - } - } - - if (!current_tp) { - if (provider) { - if (current_provider) { - //printf("update with current\n"); - if (!strcmp(xmlGetAttribute(current_provider, "name"), xmlGetAttribute(provider, "name"))) - if (updateCurrentXML(current_provider, services_tp, scanType, false)) - need_update = true; - - } - else { - //printf("update with prov\n"); - if (updateCurrentXML(provider, services_tp, scanType, false)) - need_update = true; - - } - } - else - dprintf("[sectionsd] No Transponder with ONID: %04x TSID: %04x found in services.xml!\n", onid, tsid); - } - else { - if (!provider) { - //printf("update with current / current\n"); - - if (updateCurrentXML(current_provider, current_tp, scanType, false)) - need_update = true; - - } - else - dprintf("[sectionsd] No Update needed for Transponder with ONID: %04x TSID: %04x!\n", onid, tsid); - } - if (current_parser != NULL) - xmlFreeDoc(current_parser); - current_parser = NULL; - - i++; - } - - xmlFreeDoc(service_parser); - - if (need_update) - { - rename(CURRENTSERVICES_TMP, CURRENTSERVICES_XML); - - dprintf("[sectionsd] We updated at least one Transponder in currentservices.xml!\n"); - - } else - dprintf("[sectionsd] No new services found!\n"); -//printf("Finishing updateTP\n"); - return need_update; -} -//stolen from frontend.cpp please fix. -fe_code_rate_t getCodeRate(const uint8_t fec_inner) -{ - switch (fec_inner & 0x0F) { - case 0x01: - return FEC_1_2; - case 0x02: - return FEC_2_3; - case 0x03: - return FEC_3_4; - case 0x04: - return FEC_5_6; - case 0x05: - return FEC_7_8; - case 0x0F: - return FEC_NONE; - default: - return FEC_AUTO; - } -} -//also stolen from frontend.cpp. please fix. -fe_modulation_t getModulation(const uint8_t modulation) -{ - switch (modulation) { - case 0x00: - return QPSK; - case 0x01: - return QAM_16; - case 0x02: - return QAM_32; - case 0x03: - return QAM_64; - case 0x04: - return QAM_128; - case 0x05: - return QAM_256; - default: -#if 1 - return QAM_AUTO; -#else - // i do not know how to do it correctly for old API -- seife - return QAM_256; -#endif - } -} - -static void writeTransponderFromDescriptor(FILE *dst, const t_original_network_id onid, const t_transport_stream_id tsid, const char *ddp, const bool is_sat) -{ - struct satellite_delivery_descriptor *sdd; - struct cable_delivery_descriptor *cdd; - - if (is_sat) { - sdd = (struct satellite_delivery_descriptor *)ddp; - fprintf(dst,"\t\t\n", - tsid, - onid, - ((sdd->frequency_1 >> 4) * 100000000) + - ((sdd->frequency_1 & 0x0F) * 10000000) + - ((sdd->frequency_2 >> 4) * 1000000) + - ((sdd->frequency_2 & 0x0F) * 100000) + - ((sdd->frequency_3 >> 4) * 10000) + - ((sdd->frequency_3 & 0x0F) * 1000) + - ((sdd->frequency_4 >> 4) * 100) + - ((sdd->frequency_4 & 0x0F) * 10), -// sdd->modulation, - INVERSION_AUTO, - ((sdd->symbol_rate_1 >> 4) * 100000000) + - ((sdd->symbol_rate_1 & 0x0F) * 10000000) + - ((sdd->symbol_rate_2 >> 4) * 1000000) + - ((sdd->symbol_rate_2 & 0x0F) * 100000) + - ((sdd->symbol_rate_3 >> 4) * 10000) + - ((sdd->symbol_rate_3 & 0x0F) * 1000) + - ((sdd->symbol_rate_4 >> 4) * 100), - (fe_code_rate_t) getCodeRate(sdd->fec_inner & 0x0F), - sdd->polarization); - } - else { - cdd = (struct cable_delivery_descriptor *)ddp; - fprintf(dst,"\t\t\n", - tsid, - onid, - ((cdd->frequency_1 >> 4) * 1000000000) + - ((cdd->frequency_1 & 0x0F) * 100000000) + - ((cdd->frequency_2 >> 4) * 10000000) + - ((cdd->frequency_2 & 0x0F) * 1000000) + - ((cdd->frequency_3 >> 4) * 100000) + - ((cdd->frequency_3 & 0x0F) * 10000) + - ((cdd->frequency_4 >> 4) * 1000) + - ((cdd->frequency_4 & 0x0F) * 100), -// cdd->fec_outer, - INVERSION_AUTO, - ((cdd->symbol_rate_1 >> 4) * 100000000) + - ((cdd->symbol_rate_1 & 0x0F) * 10000000) + - ((cdd->symbol_rate_2 >> 4) * 1000000) + - ((cdd->symbol_rate_2 & 0x0F) * 100000) + - ((cdd->symbol_rate_3 >> 4) * 10000) + - ((cdd->symbol_rate_3 & 0x0F) * 1000) + - ((cdd->symbol_rate_4 >> 4) * 100), - (fe_code_rate_t) getCodeRate(cdd->fec_inner & 0x0F), - (fe_modulation_t) getModulation(cdd->modulation)); - } - fprintf(dst,"\t\t\n"); -} - -static void updateXMLnet(xmlNodePtr provider, const t_original_network_id onid, const t_transport_stream_id tsid, - const char *ddp, const int position) -{ - FILE * src = NULL; - FILE * dst = NULL; - bool is_new = false; - bool is_sat = false; - -#define MAX_SIZE_PROV_STR 256 - char prov_str_neu[MAX_SIZE_PROV_STR] = ""; - char buffer[256] = ""; - - std::string frontendType; - std::string provider_name; - std::string diseqc; - - if (!(dst = fopen(CURRENTSERVICES_TMP, "w"))) { - dprintf("unable to open %s for writing\n", CURRENTSERVICES_TMP); - return; - } - - frontendType = xmlGetName(provider); - provider_name = xmlGetAttribute(provider, "name"); - - if (!strcmp(frontendType.c_str(), "sat")) { - diseqc = xmlGetAttribute(provider, "diseqc"); - snprintf(prov_str_neu, MAX_SIZE_PROV_STR, "\t<%s name=\"%s\" position=\"%04x\" diseqc=\"%s\">\n", frontendType.c_str(), provider_name.c_str(), - position, diseqc.c_str()); - is_sat = true; - } - else { - snprintf(prov_str_neu, MAX_SIZE_PROV_STR, "\t<%s name=\"%s\">\n", frontendType.c_str(), provider_name.c_str()); - is_sat = false; - } - - if (!(src = fopen(CURRENTSERVICES_XML, "r"))) { - is_new = true; - write_xml_header(dst); - fprintf(dst, prov_str_neu); - if (ddp != NULL) - writeTransponderFromDescriptor(dst, onid, tsid, ddp, is_sat); - write_xml_provend(dst, is_sat); - write_xml_footer(dst); - } - else { - if (!feof(src)) { - fgets(buffer, 255, src); - //find prov in currentservices.xml - while( (!feof(src)) && (strcmp(buffer, "\n") != 0) && (strcmp(buffer, prov_str_neu) != 0) ) - { - fprintf(dst, buffer); - fgets(buffer, 255, src); - } - if (strcmp(buffer, prov_str_neu) != 0) - fprintf(dst, prov_str_neu); - if (ddp != NULL) { - while( (!feof(src)) && (strcmp(buffer, "\n") != 0) && - (strcmp(buffer, "\t\n") != 0) && (strcmp(buffer, "\t\n")) ) - { - fprintf(dst, buffer); - fgets(buffer, 255, src); - } - //if (strcmp(buffer, "\n") == 0) - writeTransponderFromDescriptor(dst, onid, tsid, ddp, is_sat); - } - if (strcmp(buffer, "\n") == 0) - write_xml_provend(dst, is_sat); - - while (!feof(src)) - { - fprintf(dst, buffer); - fgets(buffer, 255, src); - } - } - - fclose(src); - } - fclose(dst); - - rename(CURRENTSERVICES_TMP, CURRENTSERVICES_XML); - - return; -} - -static bool updateNetwork() -{ - t_transport_stream_id tsid; - t_original_network_id onid; - t_network_id network_id; - - int position = 0; - struct satellite_delivery_descriptor *sdd; - const char *ddp; - std::string frontendType; - - bool need_update = false; - bool needs_fix = false; - - xmlNodePtr provider; - xmlNodePtr tp; - - FILE * tmp; - - xmlDocPtr service_parser = parseXmlFile(SERVICES_XML); - - if (service_parser == NULL) - return false; - - xmlDocPtr current_parser = NULL; - xmlNodePtr current_tp = NULL; - xmlNodePtr current_provider = NULL; - - tmp = fopen(CURRENTSERVICES_XML, "r"); - if (tmp) { - fclose(tmp); - current_parser= parseXmlFile(CURRENTSERVICES_XML); - } - - int i = 0; - readLockMessaging(); - while ((i < MAX_NIDs) && (messaging_nit_nid[i] != 0) && (!messaging_zap_detected)) { - unlockMessaging(); - - network_id = messaging_nit_nid[i]; - - // go through all transpopnders currently cached by neutrino - I won't need them after this loop. They COULD be cleared. - for (MySItranspondersOrderUniqueKey::iterator s = mySItranspondersOrderUniqueKey.begin(); s != - mySItranspondersOrderUniqueKey.end(); s++) - { - readLockMessaging(); - if (messaging_zap_detected) { - unlockMessaging(); - break; - } - unlockMessaging(); - if (s->second->network_id == network_id) { - needs_fix = false; - tsid = s->second->transport_stream_id; - onid = s->second->original_network_id; - ddp = &s->second->delivery_descriptor[0]; - - //printf("Descriptor_type: %02x\n", s->second->delivery_type); - frontendType = xmlGetName(xmlDocGetRootElement(service_parser)->xmlChildrenNode); - switch (s->second->delivery_type) { - case 0x43: - if (!strcmp(frontendType.c_str(), "sat")) { - sdd = (struct satellite_delivery_descriptor *)ddp; - position = (sdd->orbital_pos_hi << 8) | sdd->orbital_pos_lo; - if (!sdd->west_east_flag) - position = -position; - provider = getProvbyPosition(xmlDocGetRootElement(service_parser)->xmlChildrenNode, position); - } - else { - provider = NULL; - position = 1000; - } - break; - case 0x44: - if (!strcmp(frontendType.c_str(), "cable")) { - provider = xmlDocGetRootElement(service_parser)->xmlChildrenNode; - position = 0; - } - else { - position = 1000; - provider = NULL; - } - break; - default: - position = 1000; - provider = NULL; - break; - } - - //provider with satellite position does not exist in services.xml - if ((!provider) && (position != 1000)) { - provider = getProviderFromSatellitesXML(xmlDocGetRootElement(service_parser)->xmlChildrenNode, position); - if (provider) - needs_fix = true; //backward compatibility - add position node - } - //provider also not found in satellites.xml... - if ((!provider) && (position != 1000)) { - if (current_parser != NULL) { - provider = getProvbyPosition(xmlDocGetRootElement(current_parser)->xmlChildrenNode, position); - } - } - //and finally provider not found in currentservices.xml - we give up - if (!provider) { - dprintf("[sectionsd::updateNetwork] Provider not found for Transponder ONID: %04x TSID: %04x.\n", onid, - tsid); - } - else { - //we found a valid provider node - tp = findTransponderFromProv(provider->xmlChildrenNode, onid, tsid); - if (!tp) { - dprintf("[sectionsd::updateNetwork] Transponder ONID: %04x TSID: %04x not found.\n", onid, tsid); - if (current_parser != NULL) { - - switch (s->second->delivery_type) { - case 0x43: //satellite descriptor - current_provider = - getProvbyPosition(xmlDocGetRootElement(current_parser)->xmlChildrenNode, - position); - break; - case 0x44: //cable - current_provider = xmlDocGetRootElement(current_parser)->xmlChildrenNode; - break; - default: - break; - } - if (current_provider) - current_tp = findTransponderFromProv(current_provider->xmlChildrenNode, onid, - tsid); - } - //write the new transponder to currentservices.xml - if (!current_tp) { - updateXMLnet(provider, onid, tsid, ddp, position); - xmlFreeDoc(current_parser); - current_parser= parseXmlFile(CURRENTSERVICES_XML); - } - - } else { - dprintf("[sectionsd::updateNetwork] Transponder ONID: %04x TSID: %04x found.\n", onid, tsid); - if ( (s->second->is_actual & 7) && (needs_fix) ) { - //if(!(tmp = fopen(CURRENTSERVICES_XML, "r"))) - if (current_parser == NULL) { - dprintf("[sectionsd::updateNetwork] services.xml provider needs update\n"); - updateXMLnet(provider, onid, tsid, NULL, position); - current_parser= parseXmlFile(CURRENTSERVICES_XML); - } - else { - current_provider = - getProvbyPosition(xmlDocGetRootElement(current_parser)->xmlChildrenNode, - position); - if (!current_provider) { - updateXMLnet(provider, onid, tsid, NULL, position); - xmlFreeDoc(current_parser); - current_parser= parseXmlFile(CURRENTSERVICES_XML); - } - } - } - } - } - } - //sleep(10); - } - i++; - readLockMessaging(); - } - unlockMessaging(); - if (current_parser != NULL) - xmlFreeDoc(current_parser); - xmlFreeDoc(service_parser); - - return need_update; -} - -xmlNodePtr findBouquet(xmlDocPtr parser,t_bouquet_id bouquet_id) -{ - xmlNodePtr bouquet = xmlDocGetRootElement(parser)->xmlChildrenNode; - while (xmlGetNextOccurence(bouquet, "Bouquet") != NULL) { - //printf("Checking: %04x\n", xmlGetNumericAttribute(bouquet, "bouquet_id", 16)); - if (xmlGetNumericAttribute(bouquet, "bouquet_id", 16) == bouquet_id) - return bouquet; - bouquet = bouquet->xmlNextNode; - } - return NULL; -} - -static bool compareBouquet(xmlNodePtr channel, t_bouquet_id bouquet_id) -{ - MySIbouquetsOrderUniqueKey::iterator s = mySIbouquetsOrderUniqueKey.begin(); - while (s != mySIbouquetsOrderUniqueKey.end()) { - if (s->second->bouquet_id == bouquet_id) { - if (channel) { - if ( (xmlGetNumericAttribute(channel, "serviceID", 16) != s->second->service_id) || - (xmlGetNumericAttribute(channel, "tsid", 16) != s->second->transport_stream_id) || - (xmlGetNumericAttribute(channel, "onid", 16) != s->second->original_network_id) ) { - //printf("Service: %04x\n",s->second->service_id); - return true; - } - channel = channel->xmlNextNode; - } else - return true; - } - s++; - } - if ((!channel) && (s == mySIbouquetsOrderUniqueKey.end())) - return false; - else - return true; -} - -static void write_bouquet_xml_node(FILE *fd, t_bouquet_id bouquet_id) -{ - bool found = false; - - MySIbouquetsOrderUniqueKey::iterator s = mySIbouquetsOrderUniqueKey.begin(); - while ((!found) && (s != mySIbouquetsOrderUniqueKey.end())) { - if ((s->second->bouquet_id == bouquet_id) && (s->second->bouquetName.length() != 0)) - found = true; - else - s++; - } - if (found) - fprintf(fd, "\t