diff --git a/.gitignore b/.gitignore index 72d815bd9..7fe0b0260 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,7 @@ src/zapit/src/pzapit src/zapit/src/udpstreampes src/drivertool src/dt +src/rcsim.h +src/rcsim src/gui/version.h src/nhttpd/nhttpd.conf diff --git a/configure.ac b/configure.ac index ec633a252..6890298f7 100644 --- a/configure.ac +++ b/configure.ac @@ -261,3 +261,9 @@ src/zapit/src/Makefile src/zapit/data/Makefile ]) +if test "$BOXMODEL" = "apollo"; then +AC_OUTPUT([ +src/system/mtdutils/Makefile +src/system/mtdutils/lib/Makefile +]) +fi diff --git a/cross-configure.apollo.debug b/cross-configure.apollo.debug index ba8444848..4d7e066fe 100755 --- a/cross-configure.apollo.debug +++ b/cross-configure.apollo.debug @@ -29,5 +29,5 @@ 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 --enable-flac --with-target=cdk --with-targetprefix="" --with-boxmodel=apollo --enable-mdev "$*" +./configure --prefix=${PREFIX} --build=i386-pc-linux-gnu --host=$HOST --enable-flac --with-target=cdk --with-targetprefix="" --with-boxmodel=apollo --enable-mdev "$@" diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 67d8b603d..71ee57bb2 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -39,6 +39,7 @@ install_DATA += \ ats.png \ ats_gray.png \ audio.png \ + audioplay.png \ biss_green.png \ biss_white.png \ biss_yellow.png \ diff --git a/data/icons/audioplay.png b/data/icons/audioplay.png new file mode 100644 index 000000000..cf19b7ea9 Binary files /dev/null and b/data/icons/audioplay.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a46ac082b..c5ca174f6 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -233,6 +233,7 @@ channellist.nonefound Es wurden keine Kanäle gefunden!\nFühren Sie bitte eine channellist.numeric_adjust Numeric zap adjust channellist.provs Anbieter channellist.recording_not_possible Aufnahme nicht möglich! +channellist.reset_all Entferne Markierung "Neu" für alle Kanäle channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten channellist.since seit @@ -465,6 +466,16 @@ flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.checkupdate_internet Online nach Updates suchen flashupdate.checkupdate_local Lokales Update +flashupdate.createimage Image speichern +flashupdate.createimage_add_env 'env' hinzufügen +flashupdate.createimage_add_kernel 'kernel' hinzufügen +flashupdate.createimage_add_spare 'spare' hinzufügen +flashupdate.createimage_add_u_boot 'u-boot' hinzufügen +flashupdate.createimage_add_uldr 'uldr' hinzufügen +flashupdate.createimage_menu Aktuelle Software sichern +flashupdate.createimage_options Einstellungen +flashupdate.createimage_other Image für %s STB erstellen +flashupdate.createimage_warning Nachfolgend wird ein Image für die %s STB erstellt.\nDieses Image wird auch nur auf einer %s STB lauffähig sein!\n \nTrotzdem fortsetzten? flashupdate.currentversion_sep Installierte Version flashupdate.currentversiondate Datum flashupdate.currentversiontime Uhrzeit @@ -485,6 +496,9 @@ flashupdate.md5check Imageprüfung flashupdate.md5sumerror Das Image ist fehlerhaft flashupdate.menu_apply_kernel Kernel flashen flashupdate.menu_apply_settings Settingsübernahme erlauben +flashupdate.mkfs_create_image Image erstellen +flashupdate.mkfs_preparing_files Dateien und Verzeichnisse vorbereiten +flashupdate.mkfs_using_sumtool Benutze Sumtool flashupdate.msgbox Es wurde folgendes neues File gefunden:\nDatum: %s, %s\nBasisImage: %s\nTyp: %s\n\nWollen Sie diese Version jetzt herunterladen\nund installieren? flashupdate.msgbox_manual Es wurde ein neues Image gefunden:\nDatum: %s, %s\nBasisImage: %s\nImageTyp: %s\n\nWollen Sie diese Version jetzt installieren? flashupdate.mtdselector Partitions-Auswahl @@ -798,7 +812,7 @@ menu.hint_epg_max_events Maxiale Anzahl der Events im Zwischenspeicher menu.hint_epg_old_events Veraltete EPG-Daten werden nach dieser Zeit (in Stunden) verworfen menu.hint_epg_save Speichert die EPG-Daten auf einem externen Datenträger und läd es von dort nach einen Neustart menu.hint_epg_save_standby Speichert die EPG-Daten auch im Standby-Modus -menu.hint_epg_scan Aktivieren Sie den Hintergrundscan der EPG-Daten, wenn ein freier Tuner vorhanden ist +menu.hint_epg_scan Aktivieren Sie den Hintergrundscan der EPG-Daten, wenn ein freier Tuner vorhanden ist, im aktuellen Bouquet oder in allen Favoriten menu.hint_event_textcolor Ändern Sie die Farbe für farbige Events in der Kanalliste und der Infobar menu.hint_eventlist_additional Definiert, ob zusätzliche Informationen im Hauptfenster angezeigt werden sollen menu.hint_eventlist_fonts Ändern Sie die Schriftgröße in der Event-Liste @@ -962,6 +976,7 @@ menu.hint_net_ssid Geben Sie die SSID des WLAN ein, mit dem Sie eine Verbindung menu.hint_net_telnet Aktiviert Telnet auf Ihrer Box menu.hint_net_test Testet die Netzwerkverbindung:\nPing auf Gateway, Name-Server und externe IP-Adressen menu.hint_net_ushare Freigabe verbundener Datenträger über UPnP +menu.hint_net_xupnpd Freigabe von Live Channels über UPNP menu.hint_network IP-Adresse, Gateway, DNS, Zeit-Sync, Netzwerk-Freigaben, Dienste und mehr menu.hint_new_zap_mode Aktiviert Quickzap in der Kanalliste. Nach Betätigen der Mute-Taste wird mit den Hoch/Runter-Tasten direkt umgeschalten menu.hint_numeric_adjust Adjust channel list mode on numeric zap @@ -1099,9 +1114,11 @@ menu.hint_shutdown_count Die Zeit zum Herunterfahren in den Deep-Standby, wenn d menu.hint_shutdown_rcdelay Aktiviert den Deep-Standby, wenn die Power-Taste länger als 1 Sekunde betätigt wird menu.hint_shutdown_real Aktiviert den Standby-Modus. Ist diese Option deaktiviert, fährt die Box in den Deep-Standby menu.hint_sleeptimer Zeitschaltuhr auf Ihrer Box aktivieren\nDie Box fährt dann in den Standby-Modus +menu.hint_sleeptimer_min Voreinstellung der Zeitschaltuhr auf Ihrer Box menu.hint_soft_restart Neustarten von Neutrino-HD, ohne die Box neu zu starten menu.hint_softupdate_check Im Internet nach verfügbaren Updates suchen, herunterladen und installieren menu.hint_softupdate_check_local Lokal nach verfügbaren Updates suchen und installieren +menu.hint_softupdate_createimage_menu Sicherung der aktuellen Software inklusive aller Einstellungen menu.hint_softupdate_expert Einzelne Partitionen aus dem Flash lesen bzw. in den Flash schreiben menu.hint_softupdate_expert_read Einzelne Partitionen (U-Boot, Splash, Kernel, SystemFS) aus dem Flash lesen menu.hint_softupdate_expert_write Einzelne Partitionen (Splash, Kernel, SystemFS) in den Flash schreiben @@ -1179,6 +1196,8 @@ miscsettings.epg_old_events_hint2 Angabe in Stunden miscsettings.epg_save EPG zwischenspeichern miscsettings.epg_save_standby EPG speichern in Standby-Modus miscsettings.epg_scan Hintergrundscan EPG +miscsettings.epg_scan_bq Aktuelles Bouquet +miscsettings.epg_scan_fav Alle Favoriten miscsettings.general Allgemein miscsettings.head Erweitert miscsettings.infobar Infobar @@ -1223,6 +1242,7 @@ miscsettings.shutdown_count_hint2 den Deep-Standby geschalten wird (0 = aus) miscsettings.shutdown_real Standbymodus miscsettings.shutdown_real_rcdelay Verzögertes Ausschalten miscsettings.sleeptimer Ausschalten nach Inaktivität +miscsettings.sleeptimer_min Sleeptimer Vorgabe miscsettings.volume Lautstärke miscsettings.zapto_pre_time Umschaltstart-Vorlaufzeit (Minuten) motorcontrol.calc_positions Positionen (Neu)-Berechne(n)) @@ -1407,6 +1427,7 @@ movieplayer.bookmarkname_hint2 movieplayer.defplugin Start-Plugin movieplayer.fileplayback Abspielen (Multiformat) movieplayer.head Movieplayer +movieplayer.starting Wiedergabe starten... movieplayer.toomanybookmarks Sie haben bereits zu viele Lesezeichen angelegt.\nEs muß erst ein anderes gelöscht werden. movieplayer.tshelp1 Stopp movieplayer.tshelp10 ca. 10 Minuten zurück @@ -1778,8 +1799,8 @@ settings.restore_warn Alle Settings werden ersetzt.\nDie Box wird neu gestartet. shutdown.recoding_query Aufnahme läuft. Trotzdem beenden? shutdowntimer.announce Die Box wird in 1 Min. heruntergefahren.\nShutdown abbrechen? sleeptimerbox.announce Die Box wird in 1 Min. in Standby-Betrieb gehen.\nStandby-Betrieb abbrechen? -sleeptimerbox.hint1 Ausschaltzeit in Min. (000=aus) -sleeptimerbox.hint2 Die Box schaltet sich nach dieser Standby-Zeit aus. +sleeptimerbox.hint1 Ausschaltzeit in Minuten (000 = aus) +sleeptimerbox.hint2 Die Box schaltet sich nach dieser Zeit aus. sleeptimerbox.hint3 Die Box schaltet sich bei Nichtbenutzen der Fernbedienung aus. sleeptimerbox.title Sleeptimer sleeptimerbox.title2 Inaktivitätstimer diff --git a/data/locale/english.locale b/data/locale/english.locale index 499678b33..6da23c14d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -233,6 +233,7 @@ channellist.nonefound No channels were found!\nPlease execute a scan\n(MENU-key channellist.numeric_adjust Numeric zap adjust channellist.provs Providers channellist.recording_not_possible Recording not possible! +channellist.reset_all Reset 'new' flag for all channels channellist.reset_flags Reset 'new' channel flag channellist.sats Satellites channellist.since since @@ -465,6 +466,16 @@ flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open MTD flashupdate.checkupdate_internet Check for online updates flashupdate.checkupdate_local Local update +flashupdate.createimage Save image +flashupdate.createimage_add_env Add 'env' to image +flashupdate.createimage_add_kernel Add 'kernel' to image +flashupdate.createimage_add_spare Add 'spare' to image +flashupdate.createimage_add_u_boot Add 'u-boot' to image +flashupdate.createimage_add_uldr Add 'uldr' to image +flashupdate.createimage_menu Save current software +flashupdate.createimage_options Options +flashupdate.createimage_other Create image for %s STB +flashupdate.createimage_warning Now an image for the %s STB is created.\nThis image will also run on only one %s STB!\n \nNevertheless continued? flashupdate.currentversion_sep Current version flashupdate.currentversiondate Date flashupdate.currentversiontime Time @@ -485,6 +496,9 @@ flashupdate.md5check checking image flashupdate.md5sumerror image has errors flashupdate.menu_apply_kernel Flashing kernel flashupdate.menu_apply_settings Allow apply settings +flashupdate.mkfs_create_image Create image +flashupdate.mkfs_preparing_files Preparing files and directories +flashupdate.mkfs_using_sumtool Using sumtool flashupdate.msgbox Found the following new file:\nDate: %s, %s\nBaseImage: %s\nType: %s\n\nDo you want to download and install this version now? flashupdate.msgbox_manual Found the following new image:\nDate: %s, %s\nBaseImage: %s\nImageType: %s\n\nDo you want to install this version now? flashupdate.mtdselector Partition-Selector @@ -798,7 +812,7 @@ menu.hint_epg_max_events Maximum events to cache. After reaching limit\nEPG cach menu.hint_epg_old_events Hours after event end time to consider\nevent old and remove it from cache menu.hint_epg_save Save cached EPG to harddisk or usb flash\nand load it after boot menu.hint_epg_save_standby Save EPG on soft standby mode -menu.hint_epg_scan Enable background epg scan using free tuner +menu.hint_epg_scan Enable background epg scan using free tuner,\ncurrent bouquet or all favorites menu.hint_event_textcolor Change event color for colored-event options\nin channel list and infobar menu.hint_eventlist_additional Show additional informations\nin main box menu.hint_eventlist_fonts Change event list font sizes @@ -962,6 +976,7 @@ menu.hint_net_ssid Enter SSID of wireless network\nyou want to connect to menu.hint_net_telnet Enable telnet login to your box menu.hint_net_test Test network connection: ping gateway,\n name server and external IP menu.hint_net_ushare Share connected HDD over uPnp +menu.hint_net_xupnpd Share live channels over UPNP menu.hint_network IP address, gateway, DNS, Time sync\nNetwork shares and services menu.hint_new_zap_mode Allow channel switch while browsing\n(toggle mode with 'mute' in channel list) menu.hint_numeric_adjust Adjust channel list mode on numeric zap @@ -1099,9 +1114,11 @@ menu.hint_shutdown_count Time to put box in deep-standby\nfrom soft-standby mode menu.hint_shutdown_rcdelay Enable deep-standby, if power button\npressed more than 1 second menu.hint_shutdown_real Enable soft-standby mode\nIf disabled, power button put box to deep-standby menu.hint_sleeptimer Set timer to put your box\nin sleep mode +menu.hint_sleeptimer_min Default setting for sleeptimer menu.hint_soft_restart Restart Neutrino-HD without reboot menu.hint_softupdate_check Check online update, download and flash firmware menu.hint_softupdate_check_local Select and flash firmware from local file +menu.hint_softupdate_createimage_menu Backup of current software, including all settings menu.hint_softupdate_expert Separate partitions from the flash read / write to the flash menu.hint_softupdate_expert_read Separate partitions (U-Boot, Splash, Kernel, SystemFS) from the flash read menu.hint_softupdate_expert_write Separate partitions (Splash, Kernel, SystemFS) write to the flash @@ -1179,6 +1196,8 @@ miscsettings.epg_old_events_hint2 Set in hours miscsettings.epg_save Save/Restore epg on reboot miscsettings.epg_save_standby Save epg on soft standby miscsettings.epg_scan EPG scan +miscsettings.epg_scan_bq bouquet +miscsettings.epg_scan_fav favorites miscsettings.general General miscsettings.head Extended settings miscsettings.infobar Infobar @@ -1223,6 +1242,7 @@ miscsettings.shutdown_count_hint2 to deep standby (0 = off). miscsettings.shutdown_real Enable standby miscsettings.shutdown_real_rcdelay Delayed shutdown miscsettings.sleeptimer Inactivity shutdown timer +miscsettings.sleeptimer_min Sleeptimer default miscsettings.volume Volume miscsettings.zapto_pre_time Zapto Start Time Correction (minutes) motorcontrol.calc_positions (Re)-Calculate Positions @@ -1407,6 +1427,7 @@ movieplayer.bookmarkname_hint2 movieplayer.defplugin Start-Plugin movieplayer.fileplayback File play movieplayer.head Movieplayer +movieplayer.starting Starting playback... movieplayer.toomanybookmarks There are too many bookmarks.\nYou need to delete one of them first. movieplayer.tshelp1 Stop movieplayer.tshelp10 approx. 10 minutes back @@ -1778,8 +1799,8 @@ settings.restore_warn This will replace all settings and reboot\nContinue ? shutdown.recoding_query You really want to to stop record ? shutdowntimer.announce Box will shutdown in 1 min.\nCancel Shutdown ? sleeptimerbox.announce Box will standby in 1 min.\nCancel Standby ? -sleeptimerbox.hint1 Shutdown time in min. (000=off) -sleeptimerbox.hint2 The STB will shutdown after this time in standby. +sleeptimerbox.hint1 Shutdown time in minutes (000 = off) +sleeptimerbox.hint2 The STB will shutdown after this time. sleeptimerbox.hint3 The STB will shutdown, if remote not used. sleeptimerbox.title Sleeptimer sleeptimerbox.title2 Inactivity shutdown timer diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 6f90a4ca9..4814996a1 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -240,8 +240,8 @@ channellist.sats Satellieten channellist.since sinds channellist.start start tijd ci.clock CI kloksnelheid (Mhz) -ci.ignore_msg Negeer CA berichten ci.empty Geen CAM geplaatst +ci.ignore_msg Negeer CA berichten ci.init_failed Initialisatie CAM mislukt ci.init_ok Initialisatie CAM compleet ci.inserted Conditional access module herkend @@ -674,7 +674,6 @@ languagesetup.select OSD taal lcd_info_line Weergave in display lcd_info_line_channel kanaalnaam lcd_info_line_clock klok -reset_removed Gewiste kanalen definitief verwijderen lcdcontroler.brightness Normale helderheid lcdcontroler.brightnessdeepstandby Deep Standby helderheid lcdcontroler.brightnessstandby Standby Helderheid @@ -733,7 +732,6 @@ mainsettings.timezone Tijdzone mainsettings.video Video menu.back Terug menu.cancel Annuleer -menu.hint_ytplay Video's afspelen van de populaire video website Youtube menu.hint_a_pic Configureer audiospeler en afbeeldingen menu.hint_aplay Audiospeler menu.hint_audio Audio output, DD\nSRS True volume opties @@ -1105,6 +1103,7 @@ menu.hint_video_modes VF toets schakelt tussen de ingeschakelde opties menu.hint_video_scart_mode Selecteer analog output modus voor SCART aansluiting(en) menu.hint_volume_digits Numerieke weergave van de volume balk aan/uit menu.hint_volume_pos Selecteer positie volume indicator +menu.hint_ytplay Video's afspelen van de populaire video website Youtube menu.hint_zap_cycle Tijdens het schakelen tussen kanalen in huidige favorieten lijst menu.next Volgende (Druk op menu om af te sluiten) messagebox.back Terug @@ -1240,7 +1239,10 @@ moviebrowser.edit_book_type_info2 <0 terug , >0 voor, 0: geen moviebrowser.edit_serie Geef de naam van de serie op moviebrowser.error_no_movies geen films gevonden moviebrowser.foot_filter Filter: +moviebrowser.foot_focus Schakel venster +moviebrowser.foot_options Opties moviebrowser.foot_play Start film +moviebrowser.foot_refresh Lijst herladen moviebrowser.foot_sort Sorteer: moviebrowser.head Opnames afspelen moviebrowser.head_filter Filter flims per categorie: @@ -1330,8 +1332,6 @@ moviebrowser.update_if_dest_empty_only Kopieer indien doelbestemming leeg is moviebrowser.use_dir Gebruik directory moviebrowser.use_movie_dir Gebruik film directory moviebrowser.use_rec_dir Gebruik opname directory -moviebrowser.foot_focus Schakel venster -moviebrowser.foot_refresh Lijst herladen moviebrowser.yt_error Laden van youtube video mislukt moviebrowser.yt_max_results Maximaal aantal resultaten moviebrowser.yt_most_discussed Meest besproken @@ -1348,7 +1348,6 @@ moviebrowser.yt_related Gerelateerde video's moviebrowser.yt_search Trefwoord moviebrowser.yt_top_favorites Top favorieten moviebrowser.yt_top_rated Meest gewaardeerd -moviebrowser.foot_options Opties movieplayer.bookmark Markeerpunten movieplayer.bookmarkname Naam markeerpunt movieplayer.bookmarkname_hint1 Naam invoeren voor uw markeerpunt @@ -1448,12 +1447,12 @@ options.off Uit options.on Aan options.on.without_messages Zonder bericht options.serial serial -parentallock.changepin verander PIN code parentallock.bouquetmode Favorieten lijsten zijn standaard: -parentallock.defaultlocked Beveiligd met een PIN code -parentallock.defaultunlocked Onbeveiligd +parentallock.changepin verander PIN code parentallock.changepin_hint1 Geef de nieuwe jeugd-bescherm pin code hier in! parentallock.changetolocked bij vergrendelde zenderlijsten +parentallock.defaultlocked Beveiligd met een PIN code +parentallock.defaultunlocked Onbeveiligd parentallock.head Geef Lock PIN code in parentallock.lockage vergrendelde programma's parentallock.lockage12 tot aan 12 jaar @@ -1583,6 +1582,7 @@ repeatblocker.hint_2 Enter 0 to switch of the blocker (red is space) reset_all Fabrieksreset en herstart reset_channels Wis alle kanalen reset_confirm Weet u het zeker? +reset_removed Gewiste kanalen definitief verwijderen reset_settings Standaard instellingen herstellen satsetup.auto_scan Auto-Scan geselecteerd %s satsetup.auto_scan_all Auto-Scan meerdere satellieten @@ -1609,24 +1609,18 @@ satsetup.fastscan_prov_telesat TéléSAT satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd Enkel SD satsetup.fastscan_type Scantype +satsetup.fe_mode Tuner mode satsetup.fe_mode Tuner modus satsetup.fe_mode_alone Onafhankelijk - - -satsetup.fe_mode Tuner mode satsetup.fe_mode_independent Onafhankelijk satsetup.fe_mode_link_loop Doorgelust satsetup.fe_mode_link_twin Twin -satsetup.fe_mode_master Master -satsetup.fe_mode_unused Ongebruikt - - satsetup.fe_mode_loop Doorgelust +satsetup.fe_mode_master Master satsetup.fe_mode_single Single satsetup.fe_mode_twin Twin +satsetup.fe_mode_unused Ongebruikt satsetup.fe_setup Tuner instellen - - satsetup.lofh LNB High Offset satsetup.lofl LNB Low Offset satsetup.lofs LNB switch Offset diff --git a/data/satellites.xml b/data/satellites.xml index 922f1016c..9462dee81 100644 --- a/data/satellites.xml +++ b/data/satellites.xml @@ -2673,58 +2673,100 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + - + @@ -2732,130 +2774,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/lib/libcoolstream/playback_cs.h b/lib/libcoolstream/playback_cs.h index f65bdc6f0..5a5c61fb6 100644 --- a/lib/libcoolstream/playback_cs.h +++ b/lib/libcoolstream/playback_cs.h @@ -66,6 +66,7 @@ public: void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); bool SelectSubtitles(int pid); void GetChapters(std::vector &positions, std::vector &titles); + void RequestAbort(); }; #endif // __PLAYBACK_CS_H_ diff --git a/lib/libcoolstream2/playback_cs.h b/lib/libcoolstream2/playback_cs.h index f65bdc6f0..5a5c61fb6 100644 --- a/lib/libcoolstream2/playback_cs.h +++ b/lib/libcoolstream2/playback_cs.h @@ -66,6 +66,7 @@ public: void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); bool SelectSubtitles(int pid); void GetChapters(std::vector &positions, std::vector &titles); + void RequestAbort(); }; #endif // __PLAYBACK_CS_H_ diff --git a/lib/libdvbsub/Makefile.am b/lib/libdvbsub/Makefile.am index 8e789189b..1f910b413 100644 --- a/lib/libdvbsub/Makefile.am +++ b/lib/libdvbsub/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -6,16 +6,16 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions noinst_LIBRARIES = libdvbsub.a diff --git a/lib/libmd5sum/Makefile.am b/lib/libmd5sum/Makefile.am index cb8658fe8..55a647350 100644 --- a/lib/libmd5sum/Makefile.am +++ b/lib/libmd5sum/Makefile.am @@ -1,12 +1,12 @@ noinst_LIBRARIES = libtuxbox-md5sum.a -#not allowed cppflags for c files - fix your code to re-enable -#AM_CPPFLAGS = -fno-rtti -fno-exceptions - -AM_CPPFLAGS = - -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) +#not allowed cppflags for c files - fix your code to re-enable +#AM_CPPFLAGS += -fno-rtti -fno-exceptions + +#AM_CPPFLAGS += + libtuxbox_md5sum_a_SOURCES = libmd5sum.c md5.c diff --git a/lib/libtuxtxt/Makefile.am b/lib/libtuxtxt/Makefile.am index 33ba802a9..e3cb73260 100644 --- a/lib/libtuxtxt/Makefile.am +++ b/lib/libtuxtxt/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/lib \ @@ -9,17 +9,17 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions noinst_LIBRARIES = libtuxtxt.a diff --git a/lib/libupnpclient/Makefile.am b/lib/libupnpclient/Makefile.am index 87168ef65..737921751 100644 --- a/lib/libupnpclient/Makefile.am +++ b/lib/libupnpclient/Makefile.am @@ -2,7 +2,7 @@ noinst_LIBRARIES = libtuxbox-upnpclient.a AM_CPPFLAGS = -fno-rtti -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/lib/xmltree libtuxbox_upnpclient_a_SOURCES = UPNPSocket.cpp UPNPDevice.cpp UPNPService.cpp diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 98660c2b9..6611b21ed 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -34,6 +34,8 @@ #include #include "upnpclient.h" #include +#include +#include struct ToLower { @@ -433,11 +435,33 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act commandstr = command.str(); send(t_socket, commandstr.c_str(), commandstr.size(), 0); +#if 0 while ((received = recv(t_socket, buf, sizeof(buf)-1, 0)) > 0) { buf[received] = 0; reply << buf; } +#endif + struct pollfd fds[1]; + fds[0].fd = t_socket; + fds[0].events = POLLIN; + while (true) { + int result = poll(fds, 1, 4000); + if (result < 0) { + printf("CUPnPDevice::HTTP: poll error %s\n", strerror(errno)); + break; + } + if (result == 0) { + printf("CUPnPDevice::HTTP: poll timeout\n"); + break; + } + received = recv(t_socket, buf, sizeof(buf)-1, 0); + if (received <= 0) + break; + buf[received] = 0; + reply << buf; + } + close(t_socket); return reply.str(); } diff --git a/lib/sectionsdclient/Makefile.am b/lib/sectionsdclient/Makefile.am index 679d183e4..016fb6603 100644 --- a/lib/sectionsdclient/Makefile.am +++ b/lib/sectionsdclient/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/lib/connection \ @@ -6,7 +6,7 @@ INCLUDES = \ noinst_LIBRARIES = libsectionsdclient.a -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions libsectionsdclient_a_SOURCES = sectionsdclient.cpp diff --git a/lib/timerdclient/Makefile.am b/lib/timerdclient/Makefile.am index ead4c2c73..ce2f0f72d 100644 --- a/lib/timerdclient/Makefile.am +++ b/lib/timerdclient/Makefile.am @@ -1,10 +1,10 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/lib/connection \ -I$(top_srcdir)/lib/libeventserver -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions noinst_LIBRARIES = libtimerdclient.a diff --git a/lib/xmltree/Makefile.am b/lib/xmltree/Makefile.am index ab256f85a..b02b21b15 100644 --- a/lib/xmltree/Makefile.am +++ b/lib/xmltree/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(srcdir)/xmltok diff --git a/src/Makefile.am b/src/Makefile.am index d56170e88..fc424bdd0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,14 @@ +BUILT_SOURCES = rcsim.h +rcsim.h: + pushd $(top_srcdir)/src/ && ./create_rcsim_h.sh > $@ + +.PHONY: rcsim.h + AM_CXXFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS SUBDIRS = zapit gui daemonc driver system eitd timerd nhttpd -INCLUDES = \ +AM_CPPFLAGS = \ -I$(srcdir) \ -I$(top_builddir) \ -I$(top_srcdir) \ @@ -20,13 +26,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif if BOXTYPE_TRIPLE SUBDIRS += lcddisplay @@ -44,8 +50,6 @@ neutrino_SOURCES = neutrino_menue.cpp neutrino.cpp rcsim_SOURCES = rcsim.c rcsim.h -AM_CPPFLAGS = - if ENABLE_FLAC FLACLIBS = -lFLAC AM_CPPFLAGS += -DENABLE_FLAC @@ -53,6 +57,12 @@ else FLACLIBS = endif +if BOXMODEL_APOLLO +MTDUTILSLIBS = \ + system/mtdutils/libneutrino_system_mtdutils.a \ + system/mtdutils/lib/libneutrino_system_mtdutils_lib.a +endif + neutrino_LDADD = \ daemonc/libneutrino_daemonc.a \ gui/bedit/libneutrino_gui_bedit.a \ @@ -62,6 +72,7 @@ neutrino_LDADD = \ gui/widget/libneutrino_gui_widget2.a \ driver/pictureviewer/libneutrino_pictureviewer.a \ system/libneutrino_system.a \ + $(MTDUTILSLIBS) \ gui/movieinfo.o \ gui/libneutrino_gui2.a \ gui/components/libneutrino_gui_components.a \ diff --git a/src/create_rcsim_h.sh b/src/create_rcsim_h.sh index 90bcab10e..1884e43d4 100644 --- a/src/create_rcsim_h.sh +++ b/src/create_rcsim_h.sh @@ -7,6 +7,8 @@ # usage: sh ./create_rcsim_h.sh > rcsim.h cat << EOF +// rcsim.h - automatically created from driver/rcinput.h + #ifndef KEY_GAMES #define KEY_GAMES 0x1a1 /* Media Select Games */ #endif @@ -42,15 +44,25 @@ sed -n '/^[[:space:]]*RC_0/,/^[[:space:]]*RC_analog_off/s/^[[:space:]]*/ /p' dri cat << EOF }; +enum { // not defined in input.h but used like that, at least in 2.4.22 + KEY_RELEASED = 0, + KEY_PRESSED, + KEY_AUTOREPEAT +}; + struct key{ - char *name; - unsigned long code; + const char *name; + const unsigned long code; }; static const struct key keyname[] = { EOF sed -n '/^[[:space:]]*RC_0/,/^[[:space:]]*RC_analog_off/ s/^.*=[[:space:]]*\(KEY_.*\),.*/ { "\1", \1 },/p' driver/rcinput.h cat << EOF + /* to stay backward compatible */ + { "KEY_SETUP", KEY_MENU }, + { "KEY_HOME", KEY_EXIT }, }; EOF + diff --git a/src/daemonc/Makefile.am b/src/daemonc/Makefile.am index b2e233754..04971ab12 100644 --- a/src/daemonc/Makefile.am +++ b/src/daemonc/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -14,13 +14,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_daemonc.a diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 9787b80a1..9d8641b0e 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -470,7 +470,8 @@ void CRemoteControl::processAPIDnames() pref_found = j; pref_idx = i; } - if(current_PIDs.APIDs[j].is_ac3 && g_settings.audio_DolbyDigital && (pref_ac3_found < 0)) { + if((current_PIDs.APIDs[j].is_ac3 || current_PIDs.APIDs[j].is_eac3) + && g_settings.audio_DolbyDigital && (pref_ac3_found < 0)) { pref_ac3_found = j; pref_ac3_idx = i; } @@ -513,6 +514,8 @@ void CRemoteControl::processAPIDnames() } else if (current_PIDs.APIDs[count].is_aac && !strstr(current_PIDs.APIDs[count].desc, " (AAC)")) strncat(current_PIDs.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); + else if (current_PIDs.APIDs[count].is_eac3 && !strstr(current_PIDs.APIDs[count].desc, " (EAC3)")) + strncat(current_PIDs.APIDs[count].desc, " (EAC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); } if (! current_PIDs.APIDs.empty()) printf("\n"); @@ -540,6 +543,8 @@ void CRemoteControl::processAPIDnames() strncat(current_PIDs.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); else if (current_PIDs.APIDs[j].is_aac && !strstr(current_PIDs.APIDs[j].desc, " (AAC)")) strncat(current_PIDs.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); + else if (current_PIDs.APIDs[j].is_aac && !strstr(current_PIDs.APIDs[j].desc, " (EAC3)")) + strncat(current_PIDs.APIDs[j].desc, " (EAC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); } current_PIDs.APIDs[j].component_tag = -1; break; diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 5ad12a2bd..7d398c347 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -2,7 +2,7 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS SUBDIRS = pictureviewer audiodec -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -46,9 +46,9 @@ libneutrino_driver_a_SOURCES += \ vfd.cpp if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if BOXTYPE_TRIPLE @@ -70,7 +70,7 @@ libneutrino_driver_a_SOURCES += \ simple_display.cpp endif if USE_STB_HAL -INCLUDES += \ +AM_CPPFLAGS += \ -I$(STB_HAL_INC) \ @DIRECTFB_CFLAGS@ endif diff --git a/src/driver/audiodec/Makefile.am b/src/driver/audiodec/Makefile.am index 9e822fd28..d72b969d8 100644 --- a/src/driver/audiodec/Makefile.am +++ b/src/driver/audiodec/Makefile.am @@ -1,6 +1,6 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -13,13 +13,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_driver_audiodec.a diff --git a/src/driver/audioplay.cpp b/src/driver/audioplay.cpp index 3ea3fd4d4..5dea17d17 100644 --- a/src/driver/audioplay.cpp +++ b/src/driver/audioplay.cpp @@ -49,6 +49,7 @@ void CAudioPlayer::stop() if(thrPlay) pthread_join(thrPlay,NULL); thrPlay = 0; + state = CBaseDec::STOP; } void CAudioPlayer::pause() { diff --git a/src/driver/fade.cpp b/src/driver/fade.cpp index 85a940e0c..1b96ec95a 100644 --- a/src/driver/fade.cpp +++ b/src/driver/fade.cpp @@ -89,8 +89,8 @@ void COSDFader::Stop() { if ( fadeIn || fadeOut ) { g_RCInput->killTimer(fadeTimer); - usleep(40000); #ifdef BOXMODEL_APOLLO + usleep(40000); frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 24927fd98..ca6649176 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -583,7 +583,7 @@ void CFrameBuffer::setBlendLevel(int level) if (ioctl(fd, FBIO_SETOPACITY, value)) printf("FBIO_SETOPACITY failed.\n"); -#if 0 +#ifndef BOXMODEL_APOLLO if(level == 100) // TODO: sucks. usleep(20000); #endif diff --git a/src/driver/genpsi.cpp b/src/driver/genpsi.cpp index 4f11d2d03..e85e8f1fc 100644 --- a/src/driver/genpsi.cpp +++ b/src/driver/genpsi.cpp @@ -35,6 +35,7 @@ #define ES_TYPE_MPEG12 0x02 #define ES_TYPE_AVC 0x1b #define ES_TYPE_MPA 0x03 +#define ES_TYPE_EAC3 0x7a #define ES_TYPE_AC3 0x81 static const uint32_t crc_table[256] = { @@ -83,43 +84,6 @@ static const uint32_t crc_table[256] = { 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; -//-- special enigma stream description packet for -- -//-- at least 1 video, 1 audo and 1 PCR-Pid stream -- -//------------------------------------------------------------------------------------ -static uint8_t pkt_enigma[] = -{ - 0x47, 0x40, 0x1F, 0x10, 0x00, - 0x7F, 0x80, 0x24, - 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x6D, 0x66, 0x30, 0x19, - 0x80, 0x13, 'N','E','U','T','R','I','N','O','N','G', // tag(8), len(8), text(10) -> NG hihi ;) - 0x00, 0x02, 0x00, 0x6e, // cVPID(8), len(8), PID(16) - 0x01, 0x03, 0x00, 0x78, 0x00, // cAPID(8), len(8), PID(16), ac3flag(8) -// 0x02, 0x02, 0x00, 0x82,// cTPID(8), len(8), ... - 0x03, 0x02, 0x00, 0x6e // cPCRPID(8), ... -}; -//-- PAT packet for at least 1 PMT -- -//---------------------------------------------------------- -static uint8_t pkt_pat[] = -{ - 0x47, 0x40, 0x00, 0x10, 0x00, // HEADER-1 - 0x00, 0xB0, 0x0D, // HEADER-2 - 0x04, 0x37, 0xE9, 0x00, 0x00, // HEADER-3 sid - 0x6D, 0x66, 0xEF, 0xFF, // PAT-DATA - PMT (PID=0xFFF) entry -}; - -//-- PMT packet for at least 1 video and 1 audio stream -- -//-------------------------------------------------------- -static uint8_t pkt_pmt[] = -{ - 0x47, 0x4F, 0xFF, 0x10, 0x00, // HEADER-1 - 0x02, 0xB0, 0x17, // HEADER-2 - 0x6D, 0x66, 0xE9, 0x00, 0x00, // HEADER-3 - 0xE0, 0x00, 0xF0, 0x00, // PMT-DATA - 0x02, 0xE0, 0x00, 0xF0, 0x00, // (video stream 1) - 0x03, 0xE0, 0x00, 0xF0, 0x00 // (audio stream 1) -}; - CGenPsi::CGenPsi() { nba = 0; @@ -128,13 +92,12 @@ CGenPsi::CGenPsi() pcrpid=0; vtxtpid = 0; - vtxtlang[0] = 'g'; - vtxtlang[1] = 'e'; - vtxtlang[2] = 'r'; memset(apid, 0, sizeof(apid)); memset(atypes, 0, sizeof(atypes)); nsub = 0; memset(dvbsubpid, 0, sizeof(dvbsubpid)); + neac3 = 0; + memset(eac3_pid, 0, sizeof(eac3_pid)); } uint32_t CGenPsi::calc_crc32psi(uint8_t *dst, const uint8_t *src, uint32_t len) @@ -174,6 +137,15 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *da case EN_TYPE_AUDIO: apid[nba]=pid; atypes[nba]=isAC3; + if(data != NULL){ + apid_lang[nba][0] = data[0]; + apid_lang[nba][1] = data[1]; + apid_lang[nba][2] = data[2]; + }else{ + apid_lang[nba][0] = 'u'; + apid_lang[nba][1] = 'n'; + apid_lang[nba][2] = 'k'; + } nba++; break; case EN_TYPE_TELTEX: @@ -182,6 +154,10 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *da vtxtlang[0] = data[0]; vtxtlang[1] = data[1]; vtxtlang[2] = data[2]; + }else{ + vtxtlang[0] = 'u'; + vtxtlang[1] = 'n'; + vtxtlang[2] = 'k'; } break; case EN_TYPE_DVBSUB: @@ -190,165 +166,221 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *da dvbsublang[nsub][0] = data[0]; dvbsublang[nsub][1] = data[1]; dvbsublang[nsub][2] = data[2]; + }else{ + dvbsublang[nsub][0] = 'u'; + dvbsublang[nsub][1] = 'n'; + dvbsublang[nsub][2] = 'k'; } nsub++; break; + case EN_TYPE_AUDIO_EAC3: + eac3_pid[neac3] = pid; + if(data != NULL){ + eac3_lang[neac3][0] = data[0]; + eac3_lang[neac3][1] = data[1]; + eac3_lang[neac3][2] = data[2]; + }else{ + eac3_lang[neac3][0] = 'u'; + eac3_lang[neac3][1] = 'n'; + eac3_lang[neac3][2] = 'k'; + } + neac3++; + break; default: break; } } -//== setup a new TS packet with format == -//== predefined with a template == -//======================================= -#define COPY_TEMPLATE(dst, src) copy_template(dst, src, sizeof(src)) +void CGenPsi::build_pat(uint8_t* buffer) +{ + buffer[0x00] = 0x47; + buffer[0x01] = 0x40; + buffer[0x02] = 0x00; // PID = 0x0000 + buffer[0x03] = 0x10 ; -int CGenPsi::copy_template(uint8_t *dst, uint8_t *src, int len) -{ -//-- reset buffer -- - memset(dst, 0xFF, SIZE_TS_PKT); -//-- copy PMT template -- - memmove(dst, src, len); + buffer[0x04] = 0x00; // CRC calculation begins here + buffer[0x05] = 0x00; // 0x00: Program association section + buffer[0x06] = 0xb0; + buffer[0x07] = 0x11; // section_length + buffer[0x08] = 0x00; + buffer[0x09] = 0xbb; // TS id = 0x00b0 + buffer[0x0a] = 0xc1; + // section # and last section # + buffer[0x0b] = buffer[0x0c] = 0x00; + // Network PID (useless) + buffer[0x0d] = buffer[0x0e] = 0x00; + buffer[0x0f] = 0xe0; + buffer[0x10] = 0x10; - return len; + // Program Map PID + buffer[0x11] = 0x03; + buffer[0x12] = 0xe8; + buffer[0x13] = 0xe0; + buffer[0x14] = pmt_pid; + + // Put CRC in buffer[0x15...0x18] + calc_crc32psi(&buffer[0x15], &buffer[OFS_HDR_2], 0x15-OFS_HDR_2 ); + + // needed stuffing bytes + for (int i=0x19; i < 188; i++) + { + buffer[i]=0xff; + } +} + +void CGenPsi::build_pmt(uint8_t* buffer) +{ + int off=0; + + buffer[0x00] = 0x47; + buffer[0x01] = 0x40; + buffer[0x02] = pmt_pid; + buffer[0x03] = 0x10; + buffer[0x04] = 0x00; // CRC calculation begins here + buffer[0x05] = 0x02; // 0x02: Program map section + buffer[0x06] = 0xb0; + buffer[0x07] = 0x20; // section_length + buffer[0x08] = 0x03; + buffer[0x09] = 0xe8; // prog number + buffer[0x0a] = 0xc1; + // section # and last section # + buffer[0x0b] = buffer[0x0c] = 0x00; + // Program Clock Reference (PCR) PID + buffer[0x0d] = pcrpid>>8; + buffer[0x0e] = pcrpid&0xff; + // program_info_length == 0 + buffer[0x0f] = 0xf0; + buffer[0x10] = 0x00; + // Video PID + buffer[0x11] = vtype; // video stream type + buffer[0x12] = vpid>>8; + buffer[0x13] = vpid&0xff; + buffer[0x14] = 0xf0; + buffer[0x15] = 0x09; // es info length + // useless info + buffer[0x16] = 0x07; + buffer[0x17] = 0x04; + buffer[0x18] = 0x08; + buffer[0x19] = 0x80; + buffer[0x1a] = 0x24; + buffer[0x1b] = 0x02; + buffer[0x1c] = 0x11; + buffer[0x1d] = 0x01; + buffer[0x1e] = 0xfe; + off = 0x1e; + + // Audio streams + for (int index = 0; index < nba && index<10; index++) + { + buffer[++off] = (atypes[index]==1)? ES_TYPE_AC3 : ES_TYPE_MPA; + buffer[++off] = apid[index]>>8; + buffer[++off] = apid[index]&0xff; + + if (atypes[index] == 1)//ES_TYPE_AC3 + { + buffer[++off] = 0xf0; + buffer[++off] = 0x0c; // es info length + buffer[++off] = 0x05; + buffer[++off] = 0x04; + buffer[++off] = 0x41; + buffer[++off] = 0x43; + buffer[++off] = 0x2d; + buffer[++off] = 0x33; + } + else + { + buffer[++off] = 0xf0; + buffer[++off] = 0x06; // es info length + } + buffer[++off] = 0x0a; // iso639 descriptor tag + buffer[++off] = 0x04; // descriptor length + buffer[++off] = apid_lang[index][0]; + buffer[++off] = apid_lang[index][1]; + buffer[++off] = apid_lang[index][2]; + buffer[++off] = 0x00; // audio type + } + // eac3 audio + for (int index=0; index>8; + buffer[++off] = eac3_pid[index] & 0xFF; + buffer[++off] = 0xF0; + buffer[++off] = 0x0d; // es info length + buffer[++off] = 0x52; + buffer[++off] = 0x01; + buffer[++off] = 0x5d; + buffer[++off] = 0x0a; // iso639 descriptor tag + buffer[++off] = 0x04; // descriptor length + buffer[++off] = eac3_lang[index][0]; //language code[0] + buffer[++off] = eac3_lang[index][1]; //language code[1] + buffer[++off] = eac3_lang[index][2]; //language code[2] + buffer[++off] = 0x01; + buffer[++off] = 0x7a; //enhanced_AC-3_descriptor + buffer[++off] = 0x02; + buffer[++off] = 0x80; + buffer[++off] = 0xc5; + } + + // Subtitle streams + for (int index = 0; index < nsub && index<10; index++) + { + buffer[++off] = 0x06;//pes private type; + buffer[++off] = dvbsubpid[index]>>8; + buffer[++off] = dvbsubpid[index]&0xff; + buffer[++off] = 0xf0; + buffer[++off] = 0x0a; // es info length + buffer[++off] = 0x59; // DVB sub tag + buffer[++off] = 0x08; // descriptor length + buffer[++off] = dvbsublang[index][0]; + buffer[++off] = dvbsublang[index][1]; + buffer[++off] = dvbsublang[index][2]; + buffer[++off] = 0x20; //subtitle_stream.subtitling_type + buffer[++off] = 0x01>>8; //composition_page_id + buffer[++off] = 0x01&0xff; //composition_page_id + buffer[++off] = 0x01>>8; //ancillary_page_id + buffer[++off] = 0x01&0xff; //ancillary_page_id + } + + // TeleText streams + if(vtxtpid){ + buffer[++off] = 0x06; //teletext stream type; + buffer[++off] = 0xE0 | vtxtpid>>8; + buffer[++off] = vtxtpid&0xff; + buffer[++off] = 0xf0; + buffer[++off] = 0x0A; // ES_info_length + buffer[++off] = 0x52; //DVB-DescriptorTag: 82 (0x52) [= stream_identifier_descriptor] + buffer[++off] = 0x01; // descriptor_length + buffer[++off] = 0x03; //component_tag + buffer[++off] = 0x56; // DVB teletext tag + buffer[++off] = 0x05; // descriptor length + buffer[++off] = vtxtlang[0]; //language code[0] + buffer[++off] = vtxtlang[1]; //language code[1] + buffer[++off] = vtxtlang[2]; //language code[2] + buffer[++off] = (/*descriptor_magazine_number*/ 0x01 & 0x06) | ((/*descriptor_type*/ 0x01 << 3) & 0xF8); + buffer[++off] = 0x00 ; //Teletext_page_number + } + buffer[0x07] = off-3; // update section_length + + // Put CRC in ts[0x29...0x2c] + calc_crc32psi(&buffer[off+1], &buffer[OFS_HDR_2], off+1-OFS_HDR_2 ); + + // needed stuffing bytes + for (int i=off+5 ; i < 188 ; i++) + { + buffer[i] = 0xff; + } } int CGenPsi::genpsi(int fd) { - uint8_t pkt[SIZE_TS_PKT]; - int i, data_len, patch_len, ofs; + uint8_t buffer[SIZE_TS_PKT]; - //-- copy "Enigma"-template -- - data_len = COPY_TEMPLATE(pkt, pkt_enigma); + build_pat(buffer); + write(fd, buffer, SIZE_TS_PKT); - //-- adjust len dependent to number of audio streams -- - data_len += ((SIZE_ENIGMA_TAB_ROW+1) * (nba-1)); - - patch_len = data_len - OFS_HDR_2 + 1; - pkt[OFS_HDR_2+1] |= (patch_len>>8); - pkt[OFS_HDR_2+2] = (patch_len & 0xFF); - //-- write row with desc. for video stream -- - ofs = OFS_ENIGMA_TAB; - pkt[ofs] = EN_TYPE_VIDEO; - pkt[ofs+1] = 0x02; - pkt[ofs+2] = (vpid>>8); - pkt[ofs+3] = (vpid & 0xFF); - //-- for each audio stream, write row with desc. -- - ofs += SIZE_ENIGMA_TAB_ROW; - for (i=0; i>8); - pkt[ofs+3] = (apid[i] & 0xFF); - pkt[ofs+4] = (atypes[i]==1)? 0x01 : 0x00; - - ofs += (SIZE_ENIGMA_TAB_ROW + 1); - } - //-- write row with desc. for pcr stream (eq. video) -- - pkt[ofs] = EN_TYPE_PCR; - pkt[ofs+1] = 0x02; - pkt[ofs+2] = (pcrpid>>8); - pkt[ofs+3] = (pcrpid & 0xFF); - - //-- calculate CRC -- - calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); - //-- write TS packet -- - write(fd, pkt, SIZE_TS_PKT); - - //-- (II) build PAT -- - data_len = COPY_TEMPLATE(pkt, pkt_pat); -// pkt[0xf]= 0xE0 | (pmtpid>>8); -// pkt[0x10] = pmtpid & 0xFF; - //-- calculate CRC -- - calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); - //-- write TS packet -- - write(fd, pkt, SIZE_TS_PKT); - - //-- (III) build PMT -- - data_len = COPY_TEMPLATE(pkt, pkt_pmt); - //-- adjust len dependent to count of audio streams -- - data_len += (SIZE_STREAM_TAB_ROW * (nba-1)); - if(vtxtpid){ - data_len += (SIZE_STREAM_TAB_ROW * (1))+10;//add teletext row length - } - if(nsub){ - data_len += ((SIZE_STREAM_TAB_ROW+10) * nsub);//add dvbsub row length - } - patch_len = data_len - OFS_HDR_2 + 1; - pkt[OFS_HDR_2+1] |= (patch_len>>8); - pkt[OFS_HDR_2+2] = (patch_len & 0xFF); - //-- patch pcr PID -- - ofs = OFS_PMT_DATA; - pkt[ofs] |= (pcrpid>>8); - pkt[ofs+1] = (pcrpid & 0xFF); - //-- write row with desc. for ES video stream -- - ofs = OFS_STREAM_TAB; - pkt[ofs] = vtype; - pkt[ofs+1] = 0xE0 | (vpid>>8); - pkt[ofs+2] = (vpid & 0xFF); - pkt[ofs+3] = 0xF0; - pkt[ofs+4] = 0x00; - - //-- for each ES audio stream, write row with desc. -- - for (i=0; i>8); - pkt[ofs+2] = (apid[i] & 0xFF); - pkt[ofs+3] = 0xF0; - pkt[ofs+4] = 0x00; - } - - //teletext - if(vtxtpid){ - ofs += SIZE_STREAM_TAB_ROW; - pkt[ofs] = 0x06; //teletext stream type; - pkt[ofs+1] = 0xE0 | vtxtpid>>8; - pkt[ofs+2] = vtxtpid&0xff; - pkt[ofs+3] = 0xf0; - pkt[ofs+4] = 0x0A; // ES_info_length - pkt[ofs+5] = 0x52; //DVB-DescriptorTag: 82 (0x52) [= stream_identifier_descriptor] - pkt[ofs+6] = 0x01; // descriptor_length - pkt[ofs+7] = 0x03; //component_tag - pkt[ofs+8] = 0x56; // DVB teletext tag - pkt[ofs+9] = 0x05; // descriptor length - pkt[ofs+10] = vtxtlang[0]; //language code[0] - pkt[ofs+11] = vtxtlang[1]; //language code[1] - pkt[ofs+12] = vtxtlang[2]; //language code[2] - pkt[ofs+13] = (/*descriptor_magazine_number*/ 0x01 & 0x06) | ((/*descriptor_type*/ 0x01 << 3) & 0xF8); - pkt[ofs+14] = 0x00 ; //Teletext_page_number - } - - //dvbsub - for (i=0; i 0 || vtxtpid) - ofs += 10; - - pkt[ofs] = 0x06;//subtitle stream type; - pkt[ofs+1] = 0xE0 | dvbsubpid[i]>>8; - pkt[ofs+2] = dvbsubpid[i] & 0xFF; - pkt[ofs+3] = 0xF0; - pkt[ofs+4] = 0x0A; // es info length - pkt[ofs+5] = 0x59; // DVB sub tag - pkt[ofs+6] = 0x08; // descriptor length - pkt[ofs+7] = dvbsublang[i][0]; //language code[0] - pkt[ofs+8] = dvbsublang[i][1]; //language code[1] - pkt[ofs+9] = dvbsublang[i][2]; //language code[2] - pkt[ofs+10] = 0x20; //subtitle_stream.subtitling_type - pkt[ofs+11] = 0x01>>8; //composition_page_id - pkt[ofs+12] = 0x01&0xff; //composition_page_id - pkt[ofs+13] = 0x01>>8; //ancillary_page_id - pkt[ofs+14] = 0x01&0xff; //ancillary_page_id - } - - //-- calculate CRC -- - calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); - //-- write TS packet -- - write(fd, pkt, SIZE_TS_PKT); + build_pmt(buffer); + write(fd, buffer, SIZE_TS_PKT); //-- finish -- vpid=0; @@ -356,6 +388,9 @@ int CGenPsi::genpsi(int fd) nba=0; nsub = 0; vtxtpid = 0; + neac3 = 0; fdatasync(fd); return 1; + } + diff --git a/src/driver/genpsi.h b/src/driver/genpsi.h index bc39991aa..b34ff8510 100644 --- a/src/driver/genpsi.h +++ b/src/driver/genpsi.h @@ -23,17 +23,19 @@ #define __genpsi_h__ #include -#define EN_TYPE_VIDEO 0x00 -#define EN_TYPE_AUDIO 0x01 -#define EN_TYPE_TELTEX 0x02 -#define EN_TYPE_PCR 0x03 -#define EN_TYPE_AVC 0x04 -#define EN_TYPE_DVBSUB 0x06 +#define EN_TYPE_VIDEO 0x00 +#define EN_TYPE_AUDIO 0x01 +#define EN_TYPE_TELTEX 0x02 +#define EN_TYPE_PCR 0x03 +#define EN_TYPE_AVC 0x04 +#define EN_TYPE_DVBSUB 0x06 +#define EN_TYPE_AUDIO_EAC3 0x07 class CGenPsi { private: - short nba, nsub; + static const unsigned int pmt_pid = 0xcc; + short nba, nsub, neac3; uint16_t vpid; uint8_t vtype; uint16_t pcrpid; @@ -41,10 +43,14 @@ class CGenPsi char vtxtlang[3]; uint16_t apid[10]; short atypes[10]; + char apid_lang[10][3]; uint16_t dvbsubpid[10]; char dvbsublang[10][3]; - static int copy_template(uint8_t *dst, uint8_t *src, int len); + uint16_t eac3_pid[10]; + char eac3_lang[10][3]; uint32_t calc_crc32psi(uint8_t *dst, const uint8_t *src, uint32_t len); + void build_pat(uint8_t* buffer); + void build_pmt(uint8_t* buffer); public: CGenPsi(); diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index eed2ae77e..75a79f9c7 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -340,6 +340,7 @@ int request_file(URL *url) char str[255], *ptr; int slot; ID3 id3; + memset(&id3, 0, sizeof(ID3)); /* get the cache slot for this stream. A negative return value */ /* indicates that no cache has been set up for this stream */ diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 2a3808c4c..1e42bd049 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -230,13 +230,13 @@ int CNeutrinoFonts::getDynFontSize(int dx, int dy, std::string text, int style) if (dx == 0) dx = 1280; while (1) { - if (dynFont != NULL) + if (dynFont) delete dynFont; dynFont = g_dynFontRenderer->getFont(fontDescr.name.c_str(), dynFontStyle[style].c_str(), dynSize); - int _width = 0; - int _height = 0; // calculate height & width - _height = getFontHeight(dynFont); + int _width = 0; + int _height = getFontHeight(dynFont);; + std::string tmpText = text; if (text == "") tmpText = "x"; _width = dynFont->getRenderWidth(tmpText.c_str()); @@ -255,7 +255,7 @@ int CNeutrinoFonts::getDynFontSize(int dx, int dy, std::string text, int style) break; } - if (dynFont != NULL) + if (dynFont) delete dynFont; return dynSize; diff --git a/src/driver/neutrinofonts.h b/src/driver/neutrinofonts.h index d03edf779..e5c99d55e 100644 --- a/src/driver/neutrinofonts.h +++ b/src/driver/neutrinofonts.h @@ -27,6 +27,8 @@ #ifndef __neutrinofonts__ #define __neutrinofonts__ +#include + typedef struct neutrino_font_descr { std::string name; std::string filename; diff --git a/src/driver/pictureviewer/Makefile.am b/src/driver/pictureviewer/Makefile.am index 9b537443c..5d131ae24 100644 --- a/src/driver/pictureviewer/Makefile.am +++ b/src/driver/pictureviewer/Makefile.am @@ -1,6 +1,6 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -11,13 +11,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_pictureviewer.a diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 8c01f3ec4..d42b6f606 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include @@ -101,7 +103,7 @@ CPictureViewer::CFormathandler * CPictureViewer::fh_getsize (const char *name, i return (NULL); } -bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, bool unscaled) +bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, bool unscaled) { // dbout("DecodeImage {\n"); #if 0 // quick fix for issue #245. TODO more smart fix for this problem @@ -112,13 +114,37 @@ bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, b #endif int x, y, imx, imy; -// int xs = CFrameBuffer::getInstance()->getScreenWidth(true); -// int 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) showBusy (m_startx + 3, m_starty + 3, 10, 0xff, 00, 00); + std::string name = _name; + bool url = false; + + if (strstr(name.c_str(), "://")) { + std::string tmpname; + tmpname = "/tmp/pictureviewer" + name.substr(name.find_last_of(".")); + FILE *tmpFile = fopen(tmpname.c_str(), "wb"); + if (tmpFile) { + CURL *ch = curl_easy_init(); + curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); + curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); + curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(ch, CURLOPT_URL, name.c_str()); + curl_easy_perform(ch); + curl_easy_cleanup(ch); + fclose(tmpFile); + url = true; + } + name = tmpname; + } + CFormathandler *fh; if (unscaled) fh = fh_getsize (name.c_str (), &x, &y, INT_MAX, INT_MAX); @@ -201,6 +227,8 @@ bool CPictureViewer::DecodeImage (const std::string & name, bool showBusySign, b m_NextPic_YPan = 0; } m_NextPic_Name = name; + if (url) + unlink(name.c_str()); hideBusy (); // dbout("DecodeImage }\n"); return (m_NextPic_Buffer != NULL); @@ -470,51 +498,54 @@ void CPictureViewer::getSize(const char* name, int* width, int *height) } } -#define LOGO_DIR1 DATADIR "/neutrino/icons/logo" -#define LOGO_FMT ".jpg" +#define LOGO_FLASH_DIR DATADIR "/neutrino/icons/logo" -bool CPictureViewer::GetLogoName(uint64_t channel_id, std::string ChannelName, std::string & name, int *width, int *height) +bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string& ChannelName, std::string & name, int *width, int *height) { - int i, j; - char strChanId[16]; + std::string fileType[] = { ".png", ".jpg" , ".gif" }; - sprintf(strChanId, "%llx", channel_id & 0xFFFFFFFFFFFFULL); - /* first the channel-id, then the channelname */ - std::string strLogoName[2] = { (std::string)strChanId, ChannelName }; - /* first png, then jpg, then gif */ - std::string strLogoExt[3] = { ".png", ".jpg" , ".gif" }; + //get channel id as string + char strChnId[16]; + snprintf(strChnId, 16, "%llx", channel_id & 0xFFFFFFFFFFFFULL); + strChnId[15] = '\0'; - for (i = 0; i < 2; i++) - { - for (j = 0; j < 3; j++) - { - std::string tmp(g_settings.logo_hdd_dir + "/" + strLogoName[i] + strLogoExt[j]); - if (access(tmp.c_str(), R_OK) != -1) - { + for (size_t i = 0; i<(sizeof(fileType) / sizeof(fileType[0])); i++){ + std::vector v_path; + std::string id_tmp_path; + + //create filename with channel name (logo_hdd_dir) + id_tmp_path = g_settings.logo_hdd_dir + "/"; + id_tmp_path += ChannelName + fileType[i]; + v_path.push_back(id_tmp_path); + + //create filename with id (logo_hdd_dir) + id_tmp_path = g_settings.logo_hdd_dir + "/"; + id_tmp_path += strChnId + fileType[i]; + v_path.push_back(id_tmp_path); + + //create filename with channel name (LOGO_FLASH_DIR) + id_tmp_path = LOGO_FLASH_DIR "/"; + id_tmp_path += ChannelName + fileType[i]; + v_path.push_back(id_tmp_path); + + //create filename with id (LOGO_FLASH_DIR) + id_tmp_path = LOGO_FLASH_DIR "/"; + id_tmp_path += strChnId + fileType[i]; + v_path.push_back(id_tmp_path); + + //check if file is available, name with real name is preferred, return true on success + for (size_t j = 0; j < v_path.size(); j++){ + if (access(v_path[j].c_str(), R_OK) != -1){ if(width && height) - getSize(tmp.c_str(), width, height); - name = tmp; + getSize(v_path[j].c_str(), width, height); + name = v_path[j]; return true; } - } + } } - for (i = 0; i < 2; i++) - { - for (j = 0; j < 3; j++) - { - std::string tmp(LOGO_DIR1 "/" + strLogoName[i] + strLogoExt[j]); - if (access(tmp.c_str(), R_OK) != -1) - { - if(width && height) - getSize(tmp.c_str(), width, height); - name = tmp; - return true; - } - } - } return false; } - +#if 0 bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height) { char fname[255]; @@ -539,7 +570,7 @@ bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int w } return ret; } - +#endif void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int max_width, const int max_height, bool upscale) { float aspect; diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index bb47b34bd..0c6550160 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -64,8 +64,8 @@ class CPictureViewer void SetVisible(int startx, int endx, int starty, int endy); static double m_aspect_ratio_correction; bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, int transp=CFrameBuffer::TM_EMPTY); - bool DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height); - bool GetLogoName(uint64_t channel_id, std::string ChanName, std::string & name, int *width = NULL, int *height = NULL); +// bool DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height); + virtual bool GetLogoName(const uint64_t& channel_id, const std::string& ChanName, std::string & name, int *width = NULL, int *height = NULL); fb_pixel_t * getImage (const std::string & name, int width, int height); fb_pixel_t * getIcon (const std::string & name, int *width, int *height); void getSize(const char *name, int* width, int *height); diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 79beccd25..19f47826f 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -834,6 +834,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 *msg = NeutrinoMessages::SHUTDOWN; *data = 0; break; + case NeutrinoMessages::REBOOT : + *msg = NeutrinoMessages::REBOOT; + *data = 0; + break; case NeutrinoMessages::EVT_POPUP : *msg = NeutrinoMessages::EVT_POPUP; *data = (unsigned long) p; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 1e5e17aee..a3619f934 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -171,7 +171,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) } for (unsigned int i = 0; i < recMovieInfo->audioPids.size(); i++) { apids[numpids++] = recMovieInfo->audioPids[i].epgAudioPid; - psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype); + if(channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3){ + psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); + }else + psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); } if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){ apids[numpids++] = allpids.PIDs.vtxtpid; @@ -321,7 +324,7 @@ bool CRecordInstance::Update() audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = 0; recMovieInfo->audioPids.push_back(audio_pids); } @@ -354,11 +357,13 @@ void CRecordInstance::GetPids(CZapitChannel * channel) CZapitClient::responseGetAPIDs response; response.pid = channel->getAudioPid(i); strncpy(response.desc, channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN - 1); - response.is_ac3 = response.is_aac = 0; + response.is_ac3 = response.is_aac = response.is_eac3 = 0; if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AC3) { response.is_ac3 = 1; } else if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AAC) { response.is_aac = 1; + } else if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) { + response.is_eac3 = 1; } response.component_tag = channel->getAudioChannel(i)->componentTag; allpids.APIDs.push_back(response); @@ -382,6 +387,8 @@ void CRecordInstance::ProcessAPIDnames() strncat(allpids.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); else if (allpids.APIDs[count].is_aac && !strstr(allpids.APIDs[count].desc, " (AAC)")) strncat(allpids.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); + else if (allpids.APIDs[count].is_eac3 && !strstr(allpids.APIDs[count].desc, " (EAC3)")) + strncat(allpids.APIDs[count].desc, " (EAC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); } if(has_unresolved_ctags && (epgid != 0)) { @@ -396,6 +403,8 @@ void CRecordInstance::ProcessAPIDnames() strncat(allpids.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); else if (allpids.APIDs[j].is_aac && !strstr(allpids.APIDs[j].desc, " (AAC)")) strncat(allpids.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); + else if (allpids.APIDs[j].is_eac3 && !strstr(allpids.APIDs[j].desc, " (EAC3)")) + strncat(allpids.APIDs[j].desc, " (EAC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); } allpids.APIDs[j].component_tag = -1; break; @@ -455,7 +464,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) 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) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -468,12 +477,12 @@ void CRecordInstance::FilterPids(APIDList & apid_list) if (apidmode & TIMERD_APIDS_ALT) { uint32_t apid_min=UINT_MAX; for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; } } for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { - if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3) { + if (allpids.APIDs[i].pid != apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { APIDDesc a = {allpids.APIDs[i].pid, i, false}; apid_list.push_back(a); } @@ -482,7 +491,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) 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) { + if (allpids.APIDs[i].is_ac3 || allpids.APIDs[i].is_eac3) { APIDDesc a = {allpids.APIDs[i].pid, i, true}; apid_list.push_back(a); ac3_found=true; @@ -493,7 +502,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) 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) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -509,7 +518,7 @@ void CRecordInstance::FilterPids(APIDList & apid_list) 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) { + if (allpids.APIDs[i].pid < apid_min && !allpids.APIDs[i].is_ac3 && !allpids.APIDs[i].is_eac3) { apid_min = allpids.APIDs[i].pid; apid_min_idx = i; } @@ -571,7 +580,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if(allpids.APIDs[i].pid == it->apid) { audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0; recMovieInfo->audioPids.push_back(audio_pids); } @@ -582,7 +591,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis int i = 0; audio_pids.epgAudioPid = allpids.APIDs[i].pid; audio_pids.epgAudioPidName = allpids.APIDs[i].desc; - audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; + audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : allpids.APIDs[i].is_eac3 ? 7 : 0; audio_pids.selected = 1; recMovieInfo->audioPids.push_back(audio_pids); } @@ -1463,7 +1472,7 @@ bool CRecordManager::ShowMenu(void) inst->GetRecordString(title, duration); durations.push_back(duration); - const char* mode_icon = NULL; + const char* mode_icon = NEUTRINO_ICON_REC; //if (inst->tshift_mode) if (inst->Timeshift()) mode_icon = NEUTRINO_ICON_AUTO_SHIFT; diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index b0e2075d5..40c10b720 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -36,13 +36,16 @@ #include #include +#include -extern CBouquetList * bouquetList; - +extern CBouquetList * bouquetList; +extern CBouquetList * TVfavList; + CEpgScan::CEpgScan() { - current_bnum = -1; - next_chid = 0; + current_mode = 0; + standby = false; + Clear(); } CEpgScan::~CEpgScan() @@ -61,32 +64,108 @@ void CEpgScan::Clear() { scanmap.clear(); current_bnum = -1; + current_bmode = -1; next_chid = 0; + allfav_done = false; } -void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) +bool CEpgScan::Running() { - if (!g_settings.epg_scan || CFEManager::getInstance()->getEnabledCount() <= 1) + return (g_settings.epg_scan && !scanmap.empty()); +} + +void CEpgScan::AddBouquet(CChannelList * clist) +{ + for (unsigned i = 0; i < clist->Size(); i++) { + CZapitChannel * chan = clist->getChannelFromIndex(i); + if (scanned.find(chan->getTransponderId()) == scanned.end()) + scanmap.insert(eit_scanmap_pair_t(chan->getTransponderId(), chan->getChannelID())); + } +} + +bool CEpgScan::AddFavorites() +{ + INFO("allfav_done: %d", allfav_done); + if ((g_settings.epg_scan != 2) || allfav_done) + return false; + + allfav_done = true; + unsigned old_size = scanmap.size(); + for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) { + CChannelList * clist = TVfavList->Bouquets[j]->channelList; + AddBouquet(clist); + } + INFO("scan map size: %d -> %d\n", old_size, scanmap.size()); + return (old_size != scanmap.size()); +} + +void CEpgScan::AddTransponders() +{ + if(bouquetList->Bouquets.empty()) return; + if (current_mode != g_settings.epg_scan) { + current_mode = g_settings.epg_scan; + Clear(); + } + /* TODO: add interval check to clear scanned ? */ + + int mode = CNeutrinoApp::getInstance()->GetChannelMode(); + if ((g_settings.epg_scan == 1) || (mode == LIST_MODE_FAV)) { + /* current bouquet mode */ + if (current_bmode != mode) { + current_bmode = mode; + current_bnum = -1; + } + if (current_bnum != bouquetList->getActiveBouquetNumber()) { + allfav_done = false; + scanmap.clear(); + current_bnum = bouquetList->getActiveBouquetNumber(); + AddBouquet(bouquetList->Bouquets[current_bnum]->channelList); + INFO("Added bouquet #%d, scan map size: %d", current_bnum, scanmap.size()); + } + } else { + AddFavorites(); + } +} + +void CEpgScan::StartStandby() +{ + if (!g_settings.epg_scan) + return; + + live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + AddTransponders(); + INFO("starting standby scan, scan map size: %d", scanmap.size()); + if (!scanmap.empty()) { + standby = true; + Next(); + } +} + +void CEpgScan::StopStandby() +{ + if (!g_settings.epg_scan) + return; + + INFO("stopping standby scan..."); + standby = false; + CZapit::getInstance()->SetCurrentChannelID(live_channel_id); +} + +int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) +{ + if (!g_settings.epg_scan || (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1))) { + if ((msg == NeutrinoMessages::EVT_EIT_COMPLETE) || (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE)) + return messages_return::handled; + return messages_return::unhandled; + } + CZapitChannel * newchan; if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) { - if(bouquetList->Bouquets.empty()) - return; - - if (current_bnum != bouquetList->getActiveBouquetNumber()) { - scanmap.clear(); - current_bnum = bouquetList->getActiveBouquetNumber(); - CChannelList * clist = bouquetList->Bouquets[current_bnum]->channelList; - int lsize = clist->Size(); - for (int i = 0; i < lsize; i++) { - CZapitChannel * chan = clist->getChannelFromIndex(i); - /* TODO: add interval check to clear scanned ? */ - if (scanned.find(chan->getTransponderId()) == scanned.end()) - scanmap.insert(eit_scanmap_pair_t(chan->getTransponderId(), chan->getChannelID())); - } - INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); - } + AddTransponders(); + INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); + return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) { t_channel_id chid = *(t_channel_id *)data; @@ -97,10 +176,8 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) } INFO("EIT read complete [" PRINTF_CHANNEL_ID_TYPE "], scan map size: %d", chid, scanmap.size()); - if (scanmap.empty()) - return; - Next(); + return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE) { t_channel_id chid = *(t_channel_id *)data; @@ -109,8 +186,12 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) newchan = CServiceManager::getInstance()->FindChannel(next_chid); if (newchan) { if(chid) { - INFO("try to scan [%s]", newchan->getName().c_str()); - g_Sectionsd->setServiceChanged(newchan->getChannelID(), false, newchan->getRecordDemux()); + if (!CRecordManager::getInstance()->RecordingStatus()) { + INFO("try to scan [%s]", newchan->getName().c_str()); + if (standby && !g_Sectionsd->getIsScanningActive()) + g_Sectionsd->setPauseScanning(false); + g_Sectionsd->setServiceChanged(newchan->getChannelID(), false, newchan->getRecordDemux()); + } } else { INFO("tune failed [%s]", newchan->getName().c_str()); scanmap.erase(newchan->getTransponderId()); @@ -118,31 +199,59 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) } } } + return messages_return::handled; + } + return messages_return::unhandled; +} + +void CEpgScan::EnterStandby() +{ + if (standby) { + CZapit::getInstance()->SetCurrentChannelID(live_channel_id); + g_Zapit->setStandby(true); + g_Sectionsd->setPauseScanning(true); } } void CEpgScan::Next() { + bool locked = false; + next_chid = 0; - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) + if (!g_settings.epg_scan) + return; + if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) + return; + if (CRecordManager::getInstance()->RecordingStatus()) return; - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + if (g_settings.epg_scan == 2 && scanmap.empty()) + AddFavorites(); + + if (scanmap.empty()) { + EnterStandby(); + return; + } /* executed in neutrino thread - possible race with locks in zapit zap NOWAIT : send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time */ CFEManager::getInstance()->Lock(); - CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend(); - CFEManager::getInstance()->lockFrontend(live_fe); + CFrontend *live_fe = NULL, *pip_fe = NULL; + if (!standby) { + locked = true; + live_fe = CZapit::getInstance()->GetLiveFrontend(); + CFEManager::getInstance()->lockFrontend(live_fe); #ifdef ENABLE_PIP - CFrontend *pip_fe = CZapit::getInstance()->GetPipFrontend(); - if (pip_fe && pip_fe != live_fe) - CFEManager::getInstance()->lockFrontend(pip_fe); + pip_fe = CZapit::getInstance()->GetPipFrontend(); + if (pip_fe && pip_fe != live_fe) + CFEManager::getInstance()->lockFrontend(pip_fe); #endif + } +_repeat: for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) { CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second); - if ((newchan == NULL) || SAME_TRANSPONDER(live_channel_id, newchan->getChannelID())) { + if (newchan == NULL) { scanmap.erase(it++); continue; } @@ -154,12 +263,19 @@ void CEpgScan::Next() INFO("skip [%s], cannot tune", newchan->getName().c_str()); ++it; } - CFEManager::getInstance()->unlockFrontend(live_fe); + if (!next_chid && AddFavorites()) + goto _repeat; + + if (locked) { + CFEManager::getInstance()->unlockFrontend(live_fe); #ifdef ENABLE_PIP - if (pip_fe && pip_fe != live_fe) - CFEManager::getInstance()->unlockFrontend(pip_fe); + if (pip_fe && pip_fe != live_fe) + CFEManager::getInstance()->unlockFrontend(pip_fe); #endif + } CFEManager::getInstance()->Unlock(); if (next_chid) - g_Zapit->zapTo_epg(next_chid); + g_Zapit->zapTo_epg(next_chid, standby); + else + EnterStandby(); } diff --git a/src/driver/scanepg.h b/src/driver/scanepg.h index bdd9f5c32..9625b2cb7 100644 --- a/src/driver/scanepg.h +++ b/src/driver/scanepg.h @@ -30,18 +30,30 @@ class CEpgScan { private: int current_bnum; + int current_mode; + int current_bmode; + bool allfav_done; + bool standby; eit_scanmap_t scanmap; t_channel_id next_chid; + t_channel_id live_channel_id; std::set scanned; - void Next(); + void AddBouquet(CChannelList * clist); + bool AddFavorites(); + void AddTransponders(); + void EnterStandby(); CEpgScan(); public: ~CEpgScan(); static CEpgScan * getInstance(); - void handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data); + int handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data); + void Next(); void Clear(); + void StartStandby(); + void StopStandby(); + bool Running(); }; #endif diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 3f8f74ce5..d31bfcec6 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -380,6 +380,7 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) pids.insert(channel->getVideoPid()); for (int i = 0; i < channel->getAudioChannelCount(); i++) pids.insert(channel->getAudioChannel(i)->pid); + } CGenPsi psi; for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) { @@ -391,7 +392,11 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) if (*it == channel->getAudioChannel(i)->pid) { CZapitAudioChannel::ZapitAudioChannelType atype = channel->getAudioChannel(i)->audioChannelType; printf("CStreamManager::Parse: genpsi apid %x (%d)\n", *it, atype); - psi.addPid(*it, EN_TYPE_AUDIO, atype); + if(channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3){ + psi.addPid(*it, EN_TYPE_AUDIO_EAC3, atype, channel->getAudioChannel(i)->description.c_str()); + }else{ + psi.addPid(*it, EN_TYPE_AUDIO, atype, channel->getAudioChannel(i)->description.c_str()); + } } } } diff --git a/src/eitd/Makefile.am b/src/eitd/Makefile.am index 4fbec41ae..7869b1b02 100644 --- a/src/eitd/Makefile.am +++ b/src/eitd/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -11,17 +11,17 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif #AM_CPPFLAGS = -AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS +AM_CPPFLAGS += -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS noinst_LIBRARIES = libsectionsd.a libsectionsd_a_SOURCES = \ diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 17b7359c4..1e7810fb0 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -903,7 +903,7 @@ static void commandserviceChanged(int connfd, char *data, const unsigned dataLen /* assume live demux always 0, other means background scan */ if (cmd->dnum) { /* dont wakeup EIT, if we have max events allready */ - if (max_events && (mySIeventsOrderUniqueKey.size() < max_events)) { + if (max_events == 0 || (mySIeventsOrderUniqueKey.size() < max_events)) { threadEIT.setDemux(cmd->dnum); threadEIT.setCurrentService(uniqueServiceKey); } @@ -1709,10 +1709,12 @@ void CEitThread::beforeSleep() writeLockMessaging(); messaging_zap_detected = false; unlockMessaging(); - eventServer->sendEvent(CSectionsdClient::EVT_EIT_COMPLETE, - CEventServer::INITID_SECTIONSD, - ¤t_service, - sizeof(messaging_current_servicekey)); + if (scanning) { + eventServer->sendEvent(CSectionsdClient::EVT_EIT_COMPLETE, + CEventServer::INITID_SECTIONSD, + ¤t_service, + sizeof(messaging_current_servicekey)); + } if(notify_complete) system(CONFIGDIR "/epgdone.sh"); } @@ -2838,3 +2840,11 @@ void CEitManager::setLanguages(const std::vector& newLanguages) SIlanguage::setLanguages(newLanguages); SIlanguage::saveLanguages(); } + +unsigned CEitManager::getEventsCount() +{ + readLockEvents(); + unsigned anzEvents = mySIeventsOrderUniqueKey.size(); + unlockEvents(); + return anzEvents; +} diff --git a/src/eitd/sectionsd.h b/src/eitd/sectionsd.h index 9f82b216a..3d3d398c1 100644 --- a/src/eitd/sectionsd.h +++ b/src/eitd/sectionsd.h @@ -65,6 +65,7 @@ class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex bool getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors); bool getNVODTimesServiceKey(const t_channel_id uniqueServiceKey, CSectionsdClient::NVODTimesList& nvod_list); void setLanguages(const std::vector& newLanguages); + unsigned getEventsCount(); }; #endif diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 0f510d108..8bd95f44b 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS +AM_CPPFLAGS = -fno-rtti -D__STDC_FORMAT_MACROS #AM_CPPFLAGS = -fno-rtti BUILT_SOURCES = version.h version.h: @@ -15,7 +15,7 @@ noinst_HEADERS = version.h SUBDIRS = bedit components widget -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -33,14 +33,14 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libtimerlist.a libneutrino_gui.a libneutrino_gui2.a diff --git a/src/gui/audio_setup.cpp b/src/gui/audio_setup.cpp index 1e4748f55..e28384740 100644 --- a/src/gui/audio_setup.cpp +++ b/src/gui/audio_setup.cpp @@ -215,7 +215,9 @@ int CAudioSetup::showAudioSetup() audioSettings->addItem(GenericMenuSeparatorLine); audioSettings->addItem(as_oj_srsonoff); audioSettings->addItem(as_oj_algo); +#ifndef BOXMODEL_APOLLO audioSettings->addItem(as_oj_noise); +#endif audioSettings->addItem(as_oj_volrev); #endif #if 0 @@ -225,6 +227,9 @@ int CAudioSetup::showAudioSetup() int res = audioSettings->exec(NULL, ""); selected = audioSettings->getSelected(); delete audioSettings; +#ifdef BOXMODEL_APOLLO + delete as_oj_noise; +#endif return res; } diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 439f1531e..568c3a189 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1646,7 +1646,7 @@ void CAudioPlayerGui::paintHead() return; CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_MP3); - header.setCornerRadius(RADIUS_MID); + header.setCorner(RADIUS_MID); if (m_inetmode) header.setCaption(LOCALE_INETRADIO_NAME); @@ -1923,7 +1923,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) // paint id3 infobox if (ibox == NULL) ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height); - ibox->setCornerRadius(RADIUS_LARGE); + ibox->setCorner(RADIUS_LARGE); ibox->setYPos(ypos2); ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); ibox->paint(false); diff --git a/src/gui/bedit/Makefile.am b/src/gui/bedit/Makefile.am index a7c67224f..bdc6f1e9b 100644 --- a/src/gui/bedit/Makefile.am +++ b/src/gui/bedit/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -13,13 +13,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_gui_bedit.a diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index edcf407cc..829a14900 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -248,7 +248,7 @@ void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) #if 0 ibox->paint(false,true); #endif - ibox->setCornerRadius(RADIUS_LARGE); + ibox->setCorner(RADIUS_LARGE); ibox->setShadowOnOff(CC_SHADOW_OFF); } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 56bf80e6d..f3a02fde3 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -259,7 +259,7 @@ void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/) if (ibox){ ibox->setDimensionsAll(x, ypos2, width, info_height); ibox->setFrameThickness(2); - ibox->setCornerRadius(RADIUS_LARGE); + ibox->setCorner(RADIUS_LARGE); ibox->setShadowOnOff(CC_SHADOW_OFF); } } diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index d79e64cbd..361b132c3 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -119,9 +119,9 @@ void CBouquetList::deleteBouquet(CBouquet*bouquet) } } -int CBouquetList::getActiveBouquetNumber() +t_bouquet_id CBouquetList::getActiveBouquetNumber() { - return selected; + return (t_bouquet_id)selected; } #if 0 @@ -244,6 +244,7 @@ int CBouquetList::doMenu() delete menu; delete selector; printf("CBouquetList::doMenu: %d selected\n", select); + bool added = false; if(select >= 0) { old_selected = select; switch(select) { @@ -252,16 +253,28 @@ int CBouquetList::doMenu() bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); if(bouquet_id < 0) { tmp = g_bouquetManager->addBouquet(Bouquets[selected]->channelList->getName(), true); + bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); } else tmp = g_bouquetManager->Bouquets[bouquet_id]; + if(bouquet_id < 0) + return -1; + channels = &zapitBouquet->tvChannels; - for(int li = 0; li < (int) channels->size(); li++) - tmp->addService((*channels)[li]); + for(int li = 0; li < (int) channels->size(); li++) { + if (!g_bouquetManager->existsChannelInBouquet(bouquet_id, ((*channels)[li])->getChannelID())) { + added = true; + tmp->addService((*channels)[li]); + } + } channels = &zapitBouquet->radioChannels; - for(int li = 0; li < (int) channels->size(); li++) - tmp->addService((*channels)[li]); - return 1; + for(int li = 0; li < (int) channels->size(); li++) { + if (!g_bouquetManager->existsChannelInBouquet(bouquet_id, ((*channels)[li])->getChannelID())) { + added = true; + tmp->addService((*channels)[li]); + } + } + return added ? 1 : -1; break; default: break; @@ -397,39 +410,41 @@ int CBouquetList::show(bool bShowChannelList) loop=false; } else if(msg == CRCInput::RC_red || msg == CRCInput::RC_favorites) { - if (CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) { + if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) { CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_FAV); hide(); return -3; } } else if(msg == CRCInput::RC_green) { - if (CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_PROV) { + if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_PROV) { CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_PROV); hide(); return -3; } } else if(msg == CRCInput::RC_yellow || msg == CRCInput::RC_sat) { - if(bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_SAT) { + if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_SAT) { CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_SAT); hide(); return -3; } } else if(msg == CRCInput::RC_blue) { - if(bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_ALL) { + if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_ALL) { CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_ALL); hide(); return -3; } } else if ( msg == CRCInput::RC_setup) { - if (!Bouquets.empty()) { + if (!favonly && !Bouquets.empty()) { int ret = doMenu(); if(ret > 0) { CNeutrinoApp::getInstance()->MarkChannelListChanged(); res = -4; loop = false; - } else if(ret < 0) + } else if(ret < 0) { + paintHead(); paint(); + } } } else if ( msg == (neutrino_msg_t) g_settings.key_list_start ) { @@ -600,10 +615,16 @@ void CBouquetList::paint() frameBuffer->paintBoxRel(x, y+theight, width, height - theight - footerHeight, COL_MENUCONTENT_PLUS_0); int numbuttons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); +#if 0 if (favonly) /* this actually shows favorites and providers button, but both are active anyway */ numbuttons = 2; ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); +#endif + if (favonly) + frameBuffer->paintBoxRel(x, y + (height - footerHeight), width, footerHeight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round + else + ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); if(!Bouquets.empty()) { diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index bad5fd4f2..c8eb4b3ec 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -112,7 +112,7 @@ class CBouquetList CBouquet* addBouquet(const char * const name, int BouquetKey=-1, bool locked=false ); CBouquet* addBouquet(CZapitBouquet * zapitBouquet); void deleteBouquet(CBouquet* bouquet); - int getActiveBouquetNumber(); + t_bouquet_id getActiveBouquetNumber(); int activateBouquet(int id, bool bShowChannelList); int show(bool bShowChannelList = true); int showChannelList(int nBouquet = -1); diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 45c8faed2..53e7ae49c 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -75,8 +75,6 @@ #include -#include - extern CBouquetList * bouquetList; /* neutrino.cpp */ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ extern CPictureViewer * g_PicViewer; @@ -88,13 +86,13 @@ extern CBouquetList * RADIObouquetList; extern CBouquetList * RADIOsatList; extern CBouquetList * RADIOfavList; extern CBouquetList * RADIOallList; +extern CBouquetList * AllFavBouquetList; extern bool autoshift; extern CBouquetManager *g_bouquetManager; extern int old_b_id; -extern cVideo * videoDecoder; static CComponentsFrmClock *headerClock = NULL; static int headerClockWidth = 0; @@ -122,7 +120,9 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; + cc_minitv = NULL; logo_off = 0; + pig_on_win = false; //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); } @@ -131,6 +131,8 @@ CChannelList::~CChannelList() //printf("************ DELETE LIST %s : %x\n", name.c_str(), this);fflush(stdout); chanlist.clear(); delete dline; + if (cc_minitv) + delete cc_minitv; if (headerClock) { headerClock->Stop(); if (headerClock->isPainted()) @@ -277,7 +279,9 @@ CZapitChannel* CChannelList::getChannel(t_channel_id channel_id) int CChannelList::getKey(int id) { - return chanlist[id]->number; + if (id > -1 && id < (int)chanlist.size()) + return chanlist[id]->number; + return 0; } static const std::string empty_string; @@ -294,8 +298,7 @@ t_satellite_position CChannelList::getActiveSatellitePosition(void) const { if (selected < chanlist.size()) return chanlist[selected]->getSatellitePosition(); - else - return 0; + return 0; } t_channel_id CChannelList::getActiveChannel_ChannelID(void) const @@ -309,7 +312,6 @@ t_channel_id CChannelList::getActiveChannel_ChannelID(void) const int CChannelList::getActiveChannelNumber(void) const { - //return (selected + 1); if (selected < chanlist.size()) return chanlist[selected]->number; return 0; @@ -367,6 +369,9 @@ int CChannelList::doChannelMenu(void) bool reset_enabled = chanlist[selected]->flags & CZapitChannel::NEW; menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_RESET_FLAGS, reset_enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); snprintf(cnt, sizeof(cnt), "%d", i); + bool reset_all = (name == g_Locale->getText(LOCALE_BOUQUETNAME_NEW)); + menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_RESET_ALL, reset_all, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); + snprintf(cnt, sizeof(cnt), "%d", i); menu->addItem(new CMenuSeparator(CMenuSeparator::LINE)); menu->addItem(new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); menu->exec(NULL, ""); @@ -424,6 +429,7 @@ int CChannelList::doChannelMenu(void) break; case 2: // add to +#if 0 /* default to favorites list, it makes no sense to add to autogenerated bouquets */ if (CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_FAV); @@ -431,6 +437,7 @@ int CChannelList::doChannelMenu(void) do { bouquet_id = bouquetList->exec(false); } while(bouquet_id == -3); + bouquet_id = bouquetList->exec(false); hide(); if(bouquet_id < 0) return 0; @@ -439,6 +446,16 @@ int CChannelList::doChannelMenu(void) bouquet_id = g_bouquetManager->existsUBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); else bouquet_id = g_bouquetManager->existsBouquet(bouquetList->Bouquets[bouquet_id]->channelList->getName()); +#endif + bouquet_id = AllFavBouquetList->exec(false); + hide(); + if(bouquet_id < 0) + return 0; + + if(!strcmp(AllFavBouquetList->Bouquets[bouquet_id]->channelList->getName(), g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME))) + bouquet_id = g_bouquetManager->existsUBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); + else + bouquet_id = g_bouquetManager->existsUBouquet(AllFavBouquetList->Bouquets[bouquet_id]->channelList->getName()); if (bouquet_id == -1) return 0; @@ -460,13 +477,20 @@ int CChannelList::doChannelMenu(void) break; case 4: // reset new - chanlist[selected]->flags &= ~CZapitChannel::NEW; + chanlist[selected]->flags = CZapitChannel::UPDATED; CServiceManager::getInstance()->SetServicesChanged(true); /* if make_new_list == ON, signal to re-init services */ if(g_settings.make_new_list) return 2; break; - case 5: // settings + case 5: // reset all new + for (unsigned int j = 0 ; j < chanlist.size(); j++) { + chanlist[j]->flags = CZapitChannel::UPDATED; + } + if (g_settings.make_new_list) + return 2; + break; + case 6: // settings { previous_channellist_additional = g_settings.channellist_additional; COsdSetup osd_setup; @@ -502,7 +526,7 @@ int CChannelList::exec() void CChannelList::calcSize() { - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, name.c_str()); + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8 /*, name.c_str()*/); // recalculate theight, fheight and footerHeight for a possilble change of fontsize factor theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -513,8 +537,10 @@ void CChannelList::calcSize() fheight = 1; /* avoid div-by-zero crash on invalid font */ footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; + pig_on_win = ( (g_settings.channellist_additional == 2) /* with miniTV */ && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); // calculate width - full_width = frameBuffer->getScreenWidthRel(); + full_width = pig_on_win ? (frameBuffer->getScreenWidth()-2*ConnectLineBox_Width) : frameBuffer->getScreenWidthRel(); + if (g_settings.channellist_additional) width = full_width / 3 * 2; else @@ -526,7 +552,8 @@ void CChannelList::calcSize() // calculate height (the infobox below mainbox is handled outside height) info_height = 2*fheight + fdescrheight + 10; - height = frameBuffer->getScreenHeightRel() - info_height; + height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel(); + height = height - info_height; // calculate x position x = getScreenStartX(full_width); @@ -549,7 +576,7 @@ void CChannelList::calcSize() // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; pig_width = infozone_width; - if ( (g_settings.channellist_additional == 2) /* with miniTV */ && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ) + if ( pig_on_win /* with miniTV */ ) pig_height = (pig_width * 9) / 16; else pig_height = 0; @@ -986,7 +1013,9 @@ void CChannelList::hide() { if ((g_settings.channellist_additional == 2) || (previous_channellist_additional == 2)) // with miniTV { - videoDecoder->Pig(-1, -1, -1, -1); + if (cc_minitv) + delete cc_minitv; + cc_minitv = NULL; } if (headerClock) { headerClock->Stop(); @@ -1099,7 +1128,7 @@ bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo) printf("CChannelList::adjustToChannelID me %p [%s] list size %d channel_id %" PRIx64 "\n", this, getName(), (int)chanlist.size(), channel_id); for (i = 0; i < chanlist.size(); i++) { if(chanlist[i] == NULL) { - printf("CChannelList::adjustToChannelID REPORT BUG !! ******************************** %d is NULL !!\n", i); + printf("CChannelList::adjustToChannelID REPORT BUG !! ******************************** %u is NULL !!\n", i); continue; } if (chanlist[i]->channel_id == channel_id) { @@ -1623,7 +1652,7 @@ void CChannelList::paintDetails(int index) int noch = (p_event->startTime + p_event->duration - time(NULL)) / 60; if ((noch< 0) || (noch>=10000)) noch= 0; - snprintf(cNoch, sizeof(cNoch), "(%d / %d min)", seit, noch); + snprintf(cNoch, sizeof(cNoch), "(%u / %d min)", seit, noch); } int seit_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cSeit, true); // UTF-8 int noch_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cNoch, true); // UTF-8 @@ -1687,11 +1716,12 @@ void CChannelList::paintDetails(int index) g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT, 0, true); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event - char buf[128] = {0}; - char cFrom[50] = {0}; // UTF-8 + CSectionsdClient::CurrentNextInfo CurrentNext; CEitManager::getInstance()->getCurrentNextServiceKey(chanlist[index]->channel_id, CurrentNext); if (!CurrentNext.next_name.empty()) { + char buf[128] = {0}; + char cFrom[50] = {0}; // UTF-8 struct tm *pStartZeit = localtime (& CurrentNext.next_zeit.startzeit); snprintf(cFrom, sizeof(cFrom), "%s %02d:%02d",g_Locale->getText(LOCALE_WORD_FROM),pStartZeit->tm_hour, pStartZeit->tm_min ); snprintf(buf, sizeof(buf), "%s", CurrentNext.next_name.c_str()); @@ -1868,7 +1898,6 @@ void CChannelList::paintItem(int pos, const bool firstpaint) bool iscurrent = true; bool paintbuttons = false; unsigned int curr = liststart + pos; - int rec_mode; fb_pixel_t c_rad_small = 0; #if 0 if(CNeutrinoApp::getInstance()->recordingstatus && !autoshift && curr < chanlist.size()) { @@ -1886,12 +1915,18 @@ void CChannelList::paintItem(int pos, const bool firstpaint) paintDetails(curr); c_rad_small = RADIUS_LARGE; paintbuttons = true; + } + else if (getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber() && new_zap_mode != 2/*active*/) + { + color = !displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; + bgcolor = !displayNext ? COL_MENUCONTENT_PLUS_1 : COL_MENUCONTENTINACTIVE_PLUS_0; + c_rad_small = RADIUS_LARGE; } else { color = iscurrent ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; } - if(!firstpaint || (curr == selected)){ + if(!firstpaint || (curr == selected) || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()){ frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_rad_small); } @@ -1903,7 +1938,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) int title_offset=0; fb_pixel_t tcolor=(liststart + pos == selected) ? color : COL_MENUCONTENTINACTIVE_TEXT; int xtheight=fheight-2; - + int rec_mode; if(g_settings.channellist_extended) { prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00"); @@ -1968,7 +2003,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) #endif //calculating icons int icon_x = (x+width-15-2) - RADIUS_LARGE/2; - int r_icon_w=0; int s_icon_h=0; int s_icon_w=0; + int r_icon_w; int s_icon_h=0; int s_icon_w=0; frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &s_icon_w, &s_icon_h); r_icon_w = ChannelList_Rec; int r_icon_x = icon_x; @@ -2097,8 +2132,7 @@ void CChannelList::paintHead() } headerClock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); - headerClock->setCornerRadius(RADIUS_LARGE); - headerClock->setCornerType(CORNER_TOP_RIGHT); + headerClock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); headerClock->setYPos(y); headerClock->setHeight(theight); headerClock->setTextColor(COL_MENUHEAD_TEXT); @@ -2122,24 +2156,8 @@ void CChannelList::paint() liststart = (selected/listmaxshow)*listmaxshow; updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow)); - if (g_settings.channellist_additional == 2) // with miniTV - { - // paint box for miniTV again - important! - frameBuffer->paintBoxFrame(x+width, y+theight , pig_width, pig_height, 10, COL_MENUCONTENT_PLUS_0, 0); - // 5px offset - same value as in list below -#if 0 - /* focus: its possible now to scale video with still image, but on nevis - artifacts possible on SD osd */ - paint_pig(x+width+5, y+theight+5, pig_width-10, pig_height-10); -#else - if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv) { - paint_pig(x+width+5, y+theight+5, pig_width-10, pig_height-10); - } - else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { - g_PicViewer->DisplayImage(DATADIR "/neutrino/icons/radiomode.jpg", x+width+5, y+theight+5, pig_width-10, pig_height-10, frameBuffer->TM_NONE); - } -#endif - } + if (pig_on_win) // with miniTV + paintPig(x+width, y+theight, pig_width, pig_height); // paint background for main box frameBuffer->paintBoxRel(x, y+theight, width, height-footerHeight-theight, COL_MENUCONTENT_PLUS_0); @@ -2232,11 +2250,18 @@ std::string CChannelList::MaxChanNr() return maxchansize; } -void CChannelList::paint_pig (int _x, int _y, int w, int h) +void CChannelList::paintPig (int _x, int _y, int w, int h) { - frameBuffer->paintBackgroundBoxRel (_x, _y, w, h); - //printf("CChannelList::paint_pig x %d y %d w %d h %d osd_w %d osd_w %d\n", _x, _y, w, h, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); - videoDecoder->Pig(_x, _y, w, h, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); + //init minitv object with basic properties + if (cc_minitv == NULL){ + cc_minitv = new CComponentsPIP (0, 0); + cc_minitv->setPicture(NEUTRINO_ICON_AUDIOPLAY); + cc_minitv->setFrameThickness(5); + } + //set changeable minitv properties + cc_minitv->setDimensionsAll(_x, _y, w, h); + cc_minitv->setColorFrame(COL_MENUCONTENT_PLUS_0); + cc_minitv->paint(false); } void CChannelList::paint_events(int index) @@ -2284,11 +2309,10 @@ void CChannelList::paint_events(int index) //Display the remaining events if ((y+ theight+ pig_height + i*ffheight) < (y+ theight+ pig_height + infozone_height)) { - bool first = false; fb_pixel_t color = COL_MENUCONTENTDARK_TEXT; if (e->eventID) { - first = (i == 1); + bool first = (i == 1); if ((first && g_settings.colored_events_channellist == 1 /* current */) || (!first && g_settings.colored_events_channellist == 2 /* next */)) color = COL_COLORED_EVENTS_TEXT; struct tm *tmStartZeit = localtime(&e->startTime); @@ -2336,8 +2360,7 @@ void CChannelList::showdescription(int index) { ffheight = g_Font[eventFont]->getHeight(); CZapitChannel* chan = chanlist[index]; - CChannelEvent *p_event=NULL; - p_event = &chan->currentEvent; + CChannelEvent *p_event = &chan->currentEvent; epgData.info2.clear(); epgText.clear(); CEitManager::getInstance()->getEPGid(p_event->eventID, p_event->startTime, &epgData); diff --git a/src/gui/channellist.h b/src/gui/channellist.h index ce34914d1..da8600dfc 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,7 @@ class CChannelList { private: CFrameBuffer *frameBuffer; + CComponentsPIP *cc_minitv; unsigned int selected, selected_in_new_mode; unsigned int tuned; t_channel_id selected_chid; @@ -97,6 +99,7 @@ private: bool vlist; // "virtual" list, not bouquet bool displayNext; bool displayList; + bool pig_on_win; int first_mode_found; int ChannelList_Rec; @@ -113,7 +116,7 @@ private: void showChannelLogo(); void calcSize(); std::string MaxChanNr(); - void paint_pig(int x, int y, int w, int h); + void paintPig(int x, int y, int w, int h); void paint_events(int index); CChannelEventList evtlist; void readEvents(const t_channel_id channel_id); diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index eaab0d0e4..352515250 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -13,14 +13,14 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_gui_components.a @@ -35,6 +35,7 @@ libneutrino_gui_components_a_SOURCES = \ cc_frm_footer.cpp \ cc_frm_header.cpp \ cc_frm_icons.cpp \ + cc_frm_signalbars.cpp \ cc_frm_window.cpp \ cc_item.cpp \ cc_item_infobox.cpp \ diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e86b43799..6426285fe 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -51,17 +51,17 @@ class CComponents ///container: for frambuffer properties and pixel buffer std::vector v_fbdata; - ///property: x-position on screen + ///property: x-position on screen, to alter with setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED int x; - ///property: y-position on screen + ///property: y-position on screen, to alter setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED int y; ///property: contains real x-position on screen int cc_xr; ///property: contains real y-position on screen int cc_yr; - ///property: height-dimension on screen + ///property: height-dimension on screen, to alter with setHeight() or setDimensionsAll() int height; - ///property: width-dimension on screen + ///property: width-dimension on screen, to alter with setWidth() or setDimensionsAll() int width; ///property: has corners with definied type, types are defined in /driver/frambuffer.h, without effect, if corner_radius=0 int corner_type; @@ -182,8 +182,8 @@ class CComponents ///Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h) ///Note: default values are given from settings inline virtual void setCornerType(const int& type){corner_type = type;}; - ///set corner radius - inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; + ///set corner radius and type + inline virtual void setCorner(const int& radius, const int& type = CORNER_ALL){corner_rad = radius; corner_type = type;}; ///get corner types inline virtual int getCornerType(){return corner_type;}; ///get corner radius @@ -244,6 +244,8 @@ class CComponentsItem : public CComponents virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; ///returns pointer to the form object in which this item is embedded. virtual CComponentsItem * getParent(){return cc_parent;}; + ///property: returns true if item is added to a form + virtual bool isAdded(); ///abstract: paint item, arg: do_save_bg see paintInit() above virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 9cd5eed0b..1d2420a56 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -165,14 +165,6 @@ int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) return -1; } -bool CComponentsForm::isAdded(CComponentsItem* cc_item) -{ - bool ret = false; - if (getCCItemId(cc_item) != -1) - ret = true; - return ret; -} - int CComponentsForm::genIndex() { int count = v_cc_items.size(); @@ -254,6 +246,12 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) #endif } +void CComponentsForm::removeCCItem(CComponentsItem* cc_Item) +{ + uint id = getCCItemId(cc_Item); + removeCCItem(id); +} + void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b) { if (!v_cc_items.empty()) @@ -303,23 +301,35 @@ void CComponentsForm::paintCCItems() int xpos = cc_item->getXPos(); int ypos = cc_item->getYPos(); - //set required x-position to item + //set required x-position to item: + //append vertical if (xpos == CC_APPEND){ auto_x += append_h_offset; cc_item->setRealXPos(auto_x + xpos + 1); auto_x += w_item; } + //positionize vertical centered + else if (xpos == CC_CENTERED){ + auto_x = width/2 - cc_item->getWidth()/2; + cc_item->setRealXPos(this_x + auto_x); + } else{ cc_item->setRealXPos(this_x + xpos); auto_x = (cc_item->getRealXPos() + w_item); } //set required y-position to item + //append hor if (ypos == CC_APPEND){ auto_y += append_v_offset; cc_item->setRealYPos(auto_y + ypos + 1); auto_y += h_item; } + //positionize hor centered + else if (ypos == CC_CENTERED){ + auto_y = height/2 - cc_item->getHeight()/2; + cc_item->setRealYPos(this_y + auto_y); + } else{ cc_item->setRealYPos(this_y + ypos); auto_y = (cc_item->getRealYPos() + h_item); diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index e936eaf6f..181b4ec78 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -58,6 +58,7 @@ class CComponentsForm : public CComponentsItem virtual void addCCItem(CComponentsItem* cc_Item); virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); virtual void removeCCItem(const uint& cc_item_id); + virtual void removeCCItem(CComponentsItem* cc_Item); virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item); virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item); virtual void exchangeCCItem(const uint& item_id_a, const uint& item_id_b); @@ -68,8 +69,6 @@ class CComponentsForm : public CComponentsItem virtual void clearCCItems(); virtual void cleanCCForm(); virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;}; - ///property: returns true, if item already added to form - virtual bool isAdded(CComponentsItem *cc_item); }; class CComponentsIconForm : public CComponentsForm @@ -123,6 +122,7 @@ class CComponentsHeader : public CComponentsForm Font* cch_font; int cch_items_y, cch_icon_x, cch_icon_w, cch_text_x, cch_buttons, cch_buttons_w, cch_buttons_h, cch_buttons_space, cch_offset; std::vector v_cch_btn; + int cch_size_mode; void initIcon(); void initCaption(); @@ -148,6 +148,12 @@ class CComponentsHeader : public CComponentsForm CC_HEADER_ITEM_TEXT = 1, CC_HEADER_ITEM_BUTTONS = 2 }; + + enum + { + CC_HEADER_SIZE_LARGE = 0, + CC_HEADER_SIZE_SMALL = 1 + }; CComponentsHeader(); CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, const int buttons = 0, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); @@ -167,6 +173,7 @@ class CComponentsHeader : public CComponentsForm virtual void setDefaultButtons(const int buttons); virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}; virtual void initCCItems(); + virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;}; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; @@ -209,7 +216,7 @@ items like text, labels, pictures ... class CComponentsWindow : public CComponentsForm { - private: + protected: ///object: header object, to get access to header properties see also getHeaderObject() CComponentsHeader * ccw_head; ///object: body object, this is the container for all needed items, to add with addWindowItem() @@ -222,6 +229,8 @@ class CComponentsWindow : public CComponentsForm const char* ccw_icon_name; ///property: assigned default icon buttons in header, see also getHeaderObject() int ccw_buttons; + ///property: value = true, let show footer + bool ccw_show_footer; ///initialze header object void initHeader(); @@ -231,8 +240,6 @@ class CComponentsWindow : public CComponentsForm void initFooter(); ///initialze all window objects at once void initCCWItems(); - - protected: ///initialize all attributes void initVarWindow(); @@ -277,6 +284,9 @@ class CComponentsWindow : public CComponentsForm ///add item to body object, also usable is addCCItem() to add items to the windo object void addWindowItem(CComponentsItem* cc_Item); + + /// + void showFooter(bool show = true){ccw_show_footer = show;}; ///set caption in header with string, see also getHeaderObject() void setWindowCaption(const std::string& text){ccw_caption = text;}; diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index d78471f63..a126ab040 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -46,13 +46,11 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i cc_btn_icon = icon_name; cc_btn_capt = caption; cc_btn_capt_col = COL_MENUCONTENT_TEXT; - cc_btn_text_w = cc_btn_font->getRenderWidth(cc_btn_capt, true); - cc_btn_text_h = cc_btn_font->getHeight(); x = x_pos; y = y_pos; - width = max(w, cc_btn_text_w); - height = max(h, cc_btn_text_h); + width = w; + height = h; shadow = has_shadow; shadow_w = SHADOW_OFFSET; col_frame = color_frame; @@ -63,17 +61,40 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i fr_thickness = FRAME_TH; } +CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, const std::string& icon_name, + bool selected, bool enabled, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarButton(); + cc_btn_icon = icon_name; + cc_btn_capt = g_Locale->getText(caption_locale);; + cc_btn_capt_col = COL_MENUCONTENT_TEXT; + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + cc_item_enabled = enabled; + cc_item_selected = selected; + fr_thickness = FRAME_TH; +} + void CComponentsButton::initVarButton() { initVarForm(); cc_item_type = CC_ITEMTYPE_BUTTON; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; - cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + cc_btn_dy_font = CNeutrinoFonts::getInstance(); + cc_btn_font = NULL; cc_btn_icon = ""; cc_btn_capt = ""; - cc_btn_text_w = 0; - cc_btn_text_h = 0; } void CComponentsButton::initIcon() @@ -102,7 +123,7 @@ void CComponentsButton::initIcon() //set properties to picture object if (cc_btn_icon_obj){ - cc_btn_icon_obj->setPos(icon_x, icon_y); + cc_btn_icon_obj->setDimensionsAll(icon_x, icon_y, icon_w, icon_h); cc_btn_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); cc_btn_icon_obj->doPaintBg(false); } @@ -111,36 +132,69 @@ void CComponentsButton::initIcon() void CComponentsButton::initCaption() { - if (cc_btn_capt_obj == NULL){ - cc_btn_capt_obj = new CComponentsLabel(); + //if we have an icon, we must calculate positions for booth items together + //also the icon width and left position = 0 + int face_w = 0; + int face_x = 0; - addCCItem(cc_btn_capt_obj); - } - - //text position is default centere - int cap_x = (width/2)-(cc_btn_text_w/2); - int cap_y = (height/2)-(cc_btn_text_h/2); - - //if we have a icon, then we must calculate centered position for booth items together + //calculate width and left position of icon, if available, picture position is default centered if (cc_btn_icon_obj){ - int face_w = cc_btn_icon_obj->getWidth() + H_SPACE + cc_btn_text_w + 2*fr_thickness; - int face_x = width/2 - face_w/2; + //if found a picture object, then get width from it... + face_w = cc_btn_icon_obj->getWidth(); + //...and set position as centered + face_x = width/2 - face_w/2; cc_btn_icon_obj->setXPos(face_x); - cap_x = face_x + cc_btn_icon_obj->getWidth() + H_SPACE; + } + + //init label as caption object and add to container + if (!cc_btn_capt.empty()){ + if (cc_btn_capt_obj == NULL){ + cc_btn_capt_obj = new CComponentsLabel(); + cc_btn_capt_obj->doPaintBg(false); + addCCItem(cc_btn_capt_obj); + } + }else{ + if (cc_btn_capt_obj){ + delete cc_btn_capt_obj; + cc_btn_capt_obj = NULL; + } } + //basicly we set caption appended to picture if available and to top border, width = 0 + int cap_x = fr_thickness + H_SPACE; + int cap_y = fr_thickness + H_SPACE; + //set properties to label object - if (cc_btn_capt_obj){ - cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, width-cap_x, height); + if (cc_btn_capt_obj){ + int cap_w = width - 2*fr_thickness - face_w; + int cap_h = height - 2*fr_thickness - 2*H_SPACE; + if (cc_btn_icon_obj){ + cc_btn_icon_obj->setXPos(cap_x); + cap_x += face_w + H_SPACE; + } + + cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, cap_w, cap_h); + cc_btn_font = *cc_btn_dy_font->getDynFont(cap_w, cap_h, cc_btn_capt); + cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT); cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font); cc_btn_capt_obj->forceTextPaint(); //here required; - cc_btn_capt_obj->doPaintBg(false); //corner of text item - cc_btn_capt_obj->setCornerRadius(corner_rad-fr_thickness); - cc_btn_capt_obj->setCornerType(corner_type); + cc_btn_capt_obj->setCorner(corner_rad-fr_thickness, corner_type); } + + +} + +void CComponentsButton::setCaption(const std::string& text) +{ + cc_btn_capt = text; +} + +void CComponentsButton::setCaption(const neutrino_locale_t locale_text) +{ + cc_btn_capt = g_Locale->getText(locale_text); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 915288498..65cc918ee 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -26,10 +26,11 @@ #ifndef __CC_BUTTONS_H__ #define __CC_BUTTONS_H__ -#include "config.h" +#include #include "cc.h" #include "cc_frm.h" #include +#include //! Sub class of CComponentsForm. /*! @@ -55,11 +56,8 @@ class CComponentsButton : public CComponentsForm fb_pixel_t cc_btn_capt_col; ///object: text font Font* cc_btn_font; - ///property: label object width, too long text will be truncated - int cc_btn_text_w; - ///property: label object heigth - int cc_btn_text_h; - + ///object: dynamic font object handler + CNeutrinoFonts *cc_btn_dy_font; ///initialize picture object void initIcon(); @@ -72,12 +70,24 @@ class CComponentsButton : public CComponentsForm public: ///basic constructor for button object with most needed params, no button icon is definied here CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, - const std::string& caption, const std::string& icon_name, + const std::string& caption, const std::string& icon_name = "", + bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, const std::string& icon_name = "", bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set text color virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;}; + + ///set caption: parameter as string + virtual void setCaption(const std::string& text); + ///set caption: parameter as locale + virtual void setCaption(const neutrino_locale_t locale_text); + + ///reinitialize items + virtual void Refresh(){initCCBtnItems();}; ///paint button object void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); @@ -151,5 +161,4 @@ class CComponentsButtonBlue : public CComponentsButton }; }; - #endif /*__CC_BUTTONS_H__*/ diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index eda580c72..efc190194 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -38,6 +38,11 @@ using namespace std; +CComponentsFrmClock::CComponentsFrmClock() +{ + initVarClock(); +} + CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, const char* format_str, bool activ, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) @@ -87,8 +92,10 @@ CComponentsFrmClock::~CComponentsFrmClock() void CComponentsFrmClock::initTimeString() { - time_t tm = time(0); - strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str, localtime(&tm)); + struct tm t; + time_t ltime; + ltime=time(<ime); + strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str, localtime_r(<ime, &t)); } // How does it works? @@ -136,8 +143,7 @@ void CComponentsFrmClock::initCCLockItems() lbl->doPaintBg(false); //set corner properties of label item - lbl->setCornerRadius(corner_rad-fr_thickness); - lbl->setCornerType(corner_type); + lbl->setCorner(corner_rad-fr_thickness, corner_type); //set text border to 0 lbl->setTextBorderWidth(0,0); @@ -180,7 +186,6 @@ void CComponentsFrmClock::initCCLockItems() //ensure paint of text and label bg on changed text or painted form background bool force_txt_and_bg = (lbl->textChanged() || this->paint_bg); lbl->forceTextPaint(force_txt_and_bg); - lbl->doPaintTextBoxBg(force_txt_and_bg); //set xpos of item cl_x += wtmp; diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index ebc0530d3..1ca1a8fa5 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -81,41 +81,42 @@ class CComponentsFrmClock : public CComponentsForm void initSegmentAlign(int* segment_width, int* segment_height); public: + CComponentsFrmClock(); CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, const char* format_str = "%H:%M", bool activ=true, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ~CComponentsFrmClock(); + virtual ~CComponentsFrmClock(); ///set font type for segments - void setClockFont(Font *font){cl_font = font;}; + virtual void setClockFont(Font *font){cl_font = font;}; ///set text color - void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}; + virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}; ///set alignment of timestring, possible modes see align types in cc_types.h - void setClockAlignment(int align_type){cl_align = align_type;}; + virtual void setClockAlignment(int align_type){cl_align = align_type;}; ///use string expession: "%H:%M" = 12:22, "%H:%M:%S" = 12:22:12 - void setClockFormat(const char* format_str){cl_format_str = format_str;}; + virtual void setClockFormat(const char* format_str){cl_format_str = format_str;}; ///start ticking clock thread, returns true on success, if false causes log output - bool startThread(); + virtual bool startThread(); ///stop ticking clock thread, returns true on success, if false causes log output - bool stopThread(); + virtual bool stopThread(); - bool Start(); - bool Stop(); + virtual bool Start(); + virtual bool Stop(); ///returns true, if clock is running in thread - bool isClockRun() const {return cl_thread == 0 ? false:true;}; + virtual bool isClockRun() const {return cl_thread == 0 ? false:true;}; ///set refresh interval in seconds, default value=1 (=1 sec) - void setClockIntervall(const int& seconds){cl_interval = seconds;}; + virtual void setClockIntervall(const int& seconds){cl_interval = seconds;}; ///show clock on screen - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); ///reinitialize clock contents - void refresh() { initCCLockItems(); } + virtual void refresh() { initCCLockItems(); } }; #endif diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index da53e5de2..554601fb9 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -98,6 +98,7 @@ void CComponentsHeader::initVarHeader() corner_type = CORNER_TOP; //init header height + cch_size_mode = CC_HEADER_SIZE_LARGE; cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; height = cch_font->getHeight(); @@ -183,13 +184,12 @@ void CComponentsHeader::initIcon() cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); //set corner mode of icon item - cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); int cc_icon_corner_type = corner_type; if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) cc_icon_corner_type = CORNER_TOP_LEFT; else cc_icon_corner_type = CORNER_LEFT; - cch_icon_obj->setCornerType(cc_icon_corner_type); + cch_icon_obj->setCorner(corner_rad-fr_thickness, cc_icon_corner_type); //global set width of icon object cch_icon_w = cch_icon_obj->getWidth(); @@ -278,13 +278,12 @@ void CComponentsHeader::initButtons() cch_btn_obj->addIcon(v_cch_btn); //set corner mode of button item - cch_btn_obj->setCornerRadius(corner_rad-fr_thickness); int cc_btn_corner_type = corner_type; if (corner_type == CORNER_TOP_RIGHT || corner_type == CORNER_TOP) cc_btn_corner_type = CORNER_TOP_RIGHT; else cc_btn_corner_type = CORNER_RIGHT; - cch_btn_obj->setCornerType(cc_btn_corner_type); + cch_btn_obj->setCorner(corner_rad-fr_thickness, cc_btn_corner_type); //global adapt height height = max(height, cch_btn_obj->getHeight()); @@ -330,8 +329,7 @@ void CComponentsHeader::initCaption() cch_text_obj->setColorBody(col_body); //corner of text item - cch_text_obj->setCornerRadius(corner_rad-fr_thickness); - cch_text_obj->setCornerType(corner_type); + cch_text_obj->setCorner(corner_rad-fr_thickness, corner_type); /* global adapt height not needed here again @@ -343,6 +341,9 @@ void CComponentsHeader::initCaption() void CComponentsHeader::initCCItems() { + //set size + cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); + //init icon initIcon(); diff --git a/src/gui/widget/signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp similarity index 85% rename from src/gui/widget/signalbars.cpp rename to src/gui/components/cc_frm_signalbars.cpp index a8268b11a..ea7949519 100644 --- a/src/gui/widget/signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -29,7 +29,7 @@ #include #include -#include "signalbars.h" +#include "cc_frm_signalbars.h" #include #define SB_MIN_HEIGHT 12 @@ -57,18 +57,20 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int void CSignalBar::initDimensions() { //set current required dimensions and font size - sb_item_height = max(height, SB_MIN_HEIGHT) - 2*fr_thickness; + sb_item_height = max(height, SB_MIN_HEIGHT) - 2*fr_thickness - append_h_offset; sb_item_top = height/2 - sb_item_height/2; if (sb_scale_height == -1) sb_scale_height = sb_item_height; - int dx = 0; + //use value in % of signalbox width for scale, rest is reserved for caption + sb_scale_width = width*sb_scale_w_percent/100; + + int dx = width - sb_scale_width; int dy = sb_item_height; sb_font = *dy_font->getDynFont(dx, dy); - sb_vlbl_width = sb_font->getRenderWidth ("00%", true); - sb_lbl_width = sb_font->getRenderWidth ("XXXX"/*sb_name*/, true); - sb_scale_width = width - sb_vlbl_width - sb_lbl_width - 2*fr_thickness; + //use 15% for value and name label + sb_vlbl_width = sb_lbl_width = dx /2; } void CSignalBar::initSBItems() @@ -97,11 +99,11 @@ void CSignalBar::initVarSigBar() corner_rad = 0; corner_type = 0; append_h_offset = 2; - append_v_offset = 0; + append_v_offset = 2; height = SB_MIN_HEIGHT; sb_scale_height = -1; - + sb_scale_w_percent = 60; dy_font = CNeutrinoFonts::getInstance(); sb_caption_color= COL_INFOBAR_TEXT; @@ -127,11 +129,11 @@ void CSignalBar::initSBarScale() //move and set dimensions int scale_y = (sb_item_height/2 - sb_scale_height/2); - sb_scale->setDimensionsAll(fr_thickness, scale_y, sb_scale_width, sb_scale_height/*sb_item_height*/); + sb_scale->setDimensionsAll(fr_thickness, scale_y, sb_scale_width, sb_scale_height); sb_scale->setColorBody(col_body); //add scale object to container - if(!isAdded(sb_scale)) + if(!sb_scale->isAdded()) addCCItem(sb_scale); } @@ -146,15 +148,17 @@ void CSignalBar::initSBarValue() } //move and set dimensions - int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_h_offset; - sb_vlbl->setDimensionsAll(vlbl_x/*CC_APPEND*/, sb_item_top, sb_vlbl_width, sb_item_height); + int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_v_offset; + int vlbl_h = sb_scale->getHeight(); + int vlbl_y = sb_item_height/2 + sb_item_top - vlbl_h/2 - append_h_offset; + sb_vlbl->setDimensionsAll(vlbl_x, vlbl_y, sb_vlbl_width, vlbl_h); //set current text and body color color sb_vlbl->setTextColor(sb_caption_color); sb_vlbl->setColorBody(col_body); //add value label object to container - if (!isAdded(sb_vlbl)) + if (!sb_vlbl->isAdded()) addCCItem(sb_vlbl); } @@ -163,22 +167,24 @@ void CSignalBar::initSBarName() //create name label object with basic properties if (sb_lbl == NULL){ sb_lbl = new CComponentsLabel(); - //paint no backround - sb_lbl->doPaintBg(true); + sb_lbl->doPaintBg(false); + sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK/* | CTextBox::RIGHT*/, sb_font); sb_lbl->forceTextPaint(); + sb_lbl->doPaintTextBoxBg(true); } //move and set dimensions - int lbl_x = width - sb_lbl_width - fr_thickness; - sb_lbl->setDimensionsAll(lbl_x, sb_item_top, sb_lbl_width, sb_item_height); - sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, sb_font); + int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth(); + int lbl_h = sb_vlbl->getHeight(); + int lbl_y = sb_item_height/2 + sb_item_top - lbl_h/2 - append_h_offset; + sb_lbl->setDimensionsAll(lbl_x, lbl_y, sb_lbl_width, lbl_h); //set current text and body color sb_lbl->setTextColor(sb_caption_color); sb_lbl->setColorBody(col_body); //add name label object to container - if (!isAdded(sb_lbl)) + if (!sb_lbl->isAdded()) addCCItem(sb_lbl); } @@ -310,6 +316,7 @@ void CSignalBox::initVarSigBox() sbx_bar_height = height/2; sbx_bar_x = corner_rad; sbx_caption_color = COL_INFOBAR_TEXT; + sbx_scale_w_percent = 60; } void CSignalBox::initSignalItems() @@ -327,13 +334,15 @@ void CSignalBox::initSignalItems() sbar->setDimensionsAll(sbar_x, fr_thickness, sbar_w, sbar_h); sbar->setFrontEnd(sbx_frontend); - sbar->setCornerRadius(0); + sbar->setCorner(0); sbar->setScaleHeight(scale_h); + sbar->setScaleWidth(sbx_scale_w_percent); snrbar->setDimensionsAll(sbar_x, CC_APPEND, sbar_w, sbar_h); snrbar->setFrontEnd(sbx_frontend); - snrbar->setCornerRadius(0); + snrbar->setCorner(0); snrbar->setScaleHeight(scale_h); + snrbar->setScaleWidth(sbx_scale_w_percent); } void CSignalBox::paintScale() diff --git a/src/gui/widget/signalbars.h b/src/gui/components/cc_frm_signalbars.h similarity index 92% rename from src/gui/widget/signalbars.h rename to src/gui/components/cc_frm_signalbars.h index b6ee7544c..0e8268b6c 100644 --- a/src/gui/widget/signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -87,6 +87,9 @@ class CSignalBar : public CComponentsForm int sb_lastsig; ///current signal value uint16_t sb_signal; + + ///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value + short sb_scale_w_percent; ///initialize all needed basich attributes and objects void initVarSigBar(); @@ -121,6 +124,8 @@ class CSignalBar : public CComponentsForm virtual void setTextColor(const fb_pixel_t& caption_color){ sb_caption_color = caption_color;}; ///assigns the height of scale virtual void setScaleHeight(const int& scale_height){sb_scale_height = scale_height;}; + ///assigns the width of scale + virtual void setScaleWidth(const short & scale_width_percent){sb_scale_w_percent = scale_width_percent;}; ///assigns the name of signal value in the caption object, see also sb_name virtual void setName(const std::string& name){sb_name = name;}; @@ -201,12 +206,12 @@ void CSampleClass::showSNR() signalbox = new CSignalBox(10, 100, 500, 38, frontend); // signalbox->setCornerRadius(0); //optional // signalbox->setColorBody(COL_BLACK); //optional - signalbox->setColorBody(COL_MENUHEAD_PLUS_0); + signalbox->setColorBody(COL_MENUHEAD_PLUS_0);q signalbox->doPaintBg(false); //if you want to add the object to a CC-Container (e.g. CComponentsWindow()), remove this line: signalbox->paint(false); //and add this lines: -// if (!isAdded(signalbox)) +// if (!ignalbox->isAdded()) // addCCItem(signalbox); //Note: signal box objects deallocate together with the CC-Container! } @@ -248,6 +253,9 @@ class CSignalBox : public CComponentsForm ///property: text color, see also setTextColor() fb_pixel_t sbx_caption_color; + ///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value + short sbx_scale_w_percent; + ///initialize all needed basic attributes and objects void initVarSigBox(); ///initialize general properties of signal items @@ -270,7 +278,9 @@ class CSignalBox : public CComponentsForm ///get caption color of signalbars, see also property 'sbx_caption_color' fb_pixel_t getTextColor(){return sbx_caption_color;}; - + ///assigns the width of scale + void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;}; + ///paint items void paint(bool do_save_bg); }; diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 9feaffcdf..69997d755 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -140,6 +140,7 @@ void CComponentsWindow::initVarWindow() ccw_caption = ""; ccw_icon_name = NULL; ccw_buttons = 0; //no header buttons + ccw_show_footer = true; setShadowOnOff(true); } @@ -160,7 +161,7 @@ void CComponentsWindow::initHeader() //set header properties if (ccw_head){ ccw_head->setPos(0, 0); - ccw_head->setWidth(width); + ccw_head->setWidth(width-2*fr_thickness); ccw_head->setIcon(ccw_icon_name); ccw_head->setCaption(ccw_caption); ccw_head->initCCItems(); @@ -179,10 +180,12 @@ void CComponentsWindow::initBody() //set body properties if (ccw_body){ ccw_body->setCornerType(0); - int fh = ccw_footer->getHeight(); + int fh = 0; + if (ccw_footer) + fh = ccw_footer->getHeight(); int hh = ccw_head->getHeight(); - int h_body = height - hh - fh; - ccw_body->setDimensionsAll(0, CC_APPEND, width, h_body); + int h_body = height - hh - fh - 2*fr_thickness; + ccw_body->setDimensionsAll(0, CC_APPEND, width-2*fr_thickness, h_body); ccw_body->doPaintBg(false); } } @@ -199,7 +202,7 @@ void CComponentsWindow::initFooter() //set footer properties if (ccw_footer){ ccw_footer->setPos(0, CC_APPEND); - ccw_footer->setWidth(width); + ccw_footer->setWidth(width-2*fr_thickness); ccw_footer->setShadowOnOff(shadow); } } @@ -216,16 +219,26 @@ void CComponentsWindow::initCCWItems() printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__); #endif initHeader(); - initFooter(); + + //add footer if required + if (ccw_show_footer){ + initFooter(); + }else{ + if (ccw_footer != NULL){ + removeCCItem(ccw_footer); + ccw_footer = NULL; + } + } initBody(); //add header, body and footer items only one time - if (!isAdded(ccw_head)) + if (!ccw_head->isAdded()) addCCItem(ccw_head); - if (!isAdded(ccw_body)) + if (!ccw_body->isAdded()) addCCItem(ccw_body); - if (!isAdded(ccw_footer)) - addCCItem(ccw_footer); + if (ccw_footer) + if (!ccw_footer->isAdded()) + addCCItem(ccw_footer); } void CComponentsWindow::paint(bool do_save_bg) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 7f9362bb1..d8d4fbbf0 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -151,3 +151,12 @@ int CComponentsItem::getItemType() #endif return -1; } + +//returns true if current item is added to a form +bool CComponentsItem::isAdded() +{ + if (cc_parent) + return true; + + return false; +} diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 3243247ab..6ccc94de6 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -206,3 +206,58 @@ void CComponentsPicture::hide(bool no_restore) hideCCItem(no_restore); pic_painted = false; } + + +CComponentsChannelLogo::CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h, + const uint64_t& channelId, const std::string& channelName, + const int alignment, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) + :CComponentsPicture(x_pos, y_pos, w, h, + "", alignment, has_shadow, + color_frame, color_background, color_shadow) +{ + channel_id = channelId; + channel_name = channelName; + initVarPictureChannellLogo(); +} + +void CComponentsChannelLogo::setPicture(const std::string& picture_name) +{ + pic_name = picture_name; + channel_id = 0; + channel_name = ""; + initVarPictureChannellLogo(); +} + +void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) +{ + channel_id = channelId; + channel_name = channelName; + initVarPictureChannellLogo(); +} + +void CComponentsChannelLogo::initVarPictureChannellLogo() +{ + string tmp_logo = pic_name; + has_logo = false; + + if (!(channel_id == 0 && channel_name.empty() && pic_name.empty())) + has_logo = GetLogoName(channel_id, channel_name, pic_name, &pic_width, &pic_height); + + if (!has_logo) + pic_name = tmp_logo; + +// #ifdef DEBUG_CC + printf(" [CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%lld)\n", __FUNCTION__, pic_name.c_str(), has_logo, channel_id); +// #endif + + initVarPicture(); +} + +void CComponentsChannelLogo::paint(bool do_save_bg) +{ + initVarPictureChannellLogo(); + paintInit(do_save_bg); + paintPicture(); + has_logo = false; //reset +} diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index a70534898..2b74c1709 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -89,4 +89,27 @@ class CComponentsPicture : public CComponentsItem virtual void setMaxHeight(const int h_max){pic_max_h = h_max;}; }; +class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer +{ + protected: + ///initialize all required attributes + void initVarPictureChannellLogo(); + + private: + uint64_t channel_id; + std::string channel_name; + bool has_logo; + + public: + CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h, + const uint64_t& channelId =0, const std::string& channelName = "", + const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + void setChannel(const uint64_t& channelId, const std::string& channelName); + void setPicture(const std::string& picture_name); + bool hasLogo(){return has_logo;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + #endif diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index c0dbd024a..1b5aba9a1 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -199,8 +199,7 @@ void CComponentsText::setText(const int digit, const int mode, Font* font_text) setText(s_digit, mode, font_text); } -//set text lines directly from a file, returns true on succsess -bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text) +string CComponentsText::getTextFromFile(const string& path_to_textfile) { string file = path_to_textfile; string txt = ""; @@ -208,7 +207,7 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int ifstream in (file.c_str(), ios::in); if (!in){ printf("[CComponentsText] [%s - %d] error while open %s -> %s\n", __FUNCTION__, __LINE__, file.c_str(), strerror(errno)); - return false; + return ""; } string line; @@ -217,8 +216,19 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int } in.close(); - setText(txt, mode, font_text); + return txt; +} +//set text lines directly from a file, returns true on succsess +bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text) +{ + string txt = getTextFromFile(path_to_textfile); + + if (txt.empty()) + return false; + + setText(txt, mode, font_text); + return true; } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 194bd2dfb..e6bf1365e 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -118,6 +118,8 @@ class CComponentsText : public CComponentsItem, public CBox virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); ///set text directly from a textfile, path as string is required virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + ///get text directly from a textfile, path as string is required + virtual std::string getTextFromFile(const std::string& path_to_textfile); ///helper to remove linebreak chars from a string if needed virtual void removeLineBreaks(std::string& str); diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index e06b7fb97..9dc397c48 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -89,10 +89,10 @@ void CComponentsPIP::paint(bool do_save_bg) } if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){ - videoDecoder->Pig(pig_x+2, pig_y, pig_w, pig_h, screen_w, screen_h); + videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); } else{ //paint an alternate image if no tv mode available - CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_LEFT); + CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); pic.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 76c4b12b6..55011123c 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -134,7 +134,12 @@ typedef struct comp_element_data_t #define CC_SAVE_SCREEN_NO false #define CC_NO_INDEX -1 + +///predefined parameters for auto positionizing of embedded items inside a parent form +///CC_APPEND used for x or y position or booth. An item with this parameter will paint automatically arranged side by side #define CC_APPEND -1 +///CC CENTERED used for x or y position or booth. An item with this parameter will paint automatically centered +#define CC_CENTERED -2 diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index cd93597db..41c2fa8eb 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -548,11 +548,12 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c loop = false; } } - else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_red ){ + else if ( msg==CRCInput::RC_red ){ loop= false; } - else if ( msg==CRCInput::RC_rewind || msg==CRCInput::RC_forward) { - + else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_right || msg==CRCInput::RC_rewind || msg==CRCInput::RC_forward ) { + // maybe remove RC_rewind and RC_forward in the future? + bgRightBoxPaint = false; t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber(); t_channel_id channel_id_tmp, _channel_id = channel_id; const unsigned int channel_nr = bouquetList->Bouquets[current_bouquet_id]->channelList->getSize(); @@ -564,7 +565,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c { channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id; if(channel_id_tmp == channel_id){ - if ( msg==CRCInput::RC_forward) { + if ( msg==CRCInput::RC_right || msg==CRCInput::RC_forward ) { channel = (channel+1) %channel_nr; }else { //RC_rewind channel = (channel == 0) ? channel_nr -1 : channel - 1; @@ -610,7 +611,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c eplus.exec(NULL, ""); loop = false; } - else if (msg==CRCInput::RC_help || msg==CRCInput::RC_right || msg==CRCInput::RC_ok || msg==CRCInput::RC_info) + else if (msg==CRCInput::RC_help || msg==CRCInput::RC_ok || msg==CRCInput::RC_info) { if ( evtlist[selected].eventID != 0 ) { @@ -842,7 +843,6 @@ void CNeutrinoEventList::paintDescription(int index) infozone_text = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); cc_infozone->setText(infozone_text, CTextBox::TOP, g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_EVENT]); - cc_infozone->doPaintTextBoxBg(true); cc_infozone->doPaintBg(false); cc_infozone->forceTextPaint(); cc_infozone->paint(CC_SAVE_SCREEN_NO); @@ -1310,23 +1310,25 @@ int CEventFinderMenu::showMenu(void) m_search_channelname =""; } + int shortcut = 1; + CStringInputSMS stringInput(LOCALE_EVENTFINDER_KEYWORD,m_search_keyword, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); - CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1); - CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2); - m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::RC_3, NEUTRINO_ICON_BUTTON_3); - CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::RC_4); - CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_5, NEUTRINO_ICON_BUTTON_5); + CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); + m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::convertDigitToKey(shortcut++)); + CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); + CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); - CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES); + CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES, 40); - searchMenu.addItem(GenericMenuSeparator); - searchMenu.addItem(mf0); - searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(GenericMenuSeparator); + searchMenu.addItem(mf0); + searchMenu.addItem(GenericMenuSeparatorLine); searchMenu.addItem(mo0); searchMenu.addItem(m_search_channelname_mf); searchMenu.addItem(mo1); - searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(GenericMenuSeparatorLine); searchMenu.addItem(mf1); res = searchMenu.exec(NULL,""); diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 00c2e5803..f6258816a 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1419,23 +1419,23 @@ void CFileBrowser::paintHead() free(l_name); } -bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng) +bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng, bool allow_tmp) { std::string tmp_setting_dir = setting_dir; - if(chooserDir(tmp_setting_dir, test_dir, action_str)){ + if(chooserDir(tmp_setting_dir, test_dir, action_str,allow_tmp)){ strncpy(setting_dir,tmp_setting_dir.c_str(), str_leng); return true; } return false; } -bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str) +bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str, bool allow_tmp) { const char *wrong_str = "Wrong/unsupported"; CFileBrowser b; b.Dir_Mode=true; if (b.exec(setting_dir.c_str())) { const char * newdir = b.getSelectedFile()->Name.c_str(); - if(test_dir && check_dir(newdir)){ + if(test_dir && check_dir(newdir,allow_tmp)){ printf("%s %s dir %s\n",wrong_str ,action_str, newdir); return false; }else { diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index 43ecc81ad..c209b4df0 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -56,8 +56,8 @@ #define ENABLE_INTERNETRADIO #define VLC_URI "vlc://" -bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str); -bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng); +bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str, bool allow_tmp = false); +bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng, bool allow_tmp = false); /** * Converts input of numeric keys to SMS style char input. diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 81c6b1a6e..165a05f9c 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -676,6 +676,10 @@ _remount: safe_mkdir((char *) cmd); snprintf(cmd, sizeof(cmd), "%s/music", dst); safe_mkdir((char *) cmd); + snprintf(cmd, sizeof(cmd), "%s/logos", dst); + safe_mkdir((char *) cmd); + snprintf(cmd, sizeof(cmd), "%s/plugins", dst); + safe_mkdir((char *) cmd); sync(); #if HAVE_TRIPLEDRAGON /* on the tripledragon, we mount via fstab, so we need to add an diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 289a0c53d..3a75b43c2 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -148,7 +148,7 @@ void CImageInfo::ShowWindow() InitInfos(); //prepare license text - InitLicenseText(); + InitInfoText(getLicenseText()); //paint window cc_win->paint(); @@ -287,26 +287,34 @@ void CImageInfo::InitInfos() cc_info->setHeight(h_tmp); } -//prepare license infos -void CImageInfo::InitLicenseText() +//get license +string CImageInfo::getLicenseText() { string file = LICENSEDIR; file += g_settings.language; file += ".license"; + CComponentsText txt; + string res = txt.getTextFromFile(file); + + return res; +} + +//prepare info text +void CImageInfo::InitInfoText(const std::string& text) +{ //get window body object CComponentsForm *winbody = cc_win->getBodyObject(); int h_body = winbody->getHeight(); int w_body = winbody->getWidth(); - int y_lic = item_offset + cc_info->getHeight() + item_offset; int h_lic = h_body - y_lic - item_offset; - + if (cc_lic == NULL) cc_lic = new CComponentsInfoBox(item_offset, cc_info->getYPos()+cc_info->getHeight()+item_offset, w_body-2*item_offset, h_lic); cc_lic->setSpaceOffset(0); - cc_lic->setTextFromFile(file, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); + cc_lic->setText(text, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); #if 0 //calc y pos of license box to avoid an overlap with pip @@ -321,7 +329,8 @@ void CImageInfo::InitLicenseText() #endif //add text to container - cc_win->addWindowItem(cc_lic); + if (!cc_lic->isAdded()) + cc_win->addWindowItem(cc_lic); } //scroll licens text diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index f412b1cb4..367d7ee91 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -55,7 +55,8 @@ class CImageInfo : public CMenuTarget void Init(); void InitMinitv(); void InitInfos(); - void InitLicenseText(); + void InitInfoText(const std::string& text); + std::string getLicenseText(); void ShowWindow(); void ScrollLic(bool scrollDown); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index b00b0f351..89434d8a8 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -158,9 +158,6 @@ void CInfoViewer::Init() casysChange = g_settings.casystem_display; channellogoChange = g_settings.infobar_show_channellogo; - /* we need to calculate this only once */ - info_time_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth("22:22") + 10; - channel_id = CZapit::getInstance()->GetCurrentChannelID();; lcdUpdateTimer = 0; rt_x = rt_y = rt_h = rt_w = 0; @@ -194,6 +191,8 @@ void CInfoViewer::Init() */ void CInfoViewer::start () { + info_time_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth("22:22") + 10; + InfoHeightY = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight() * 9/8 + 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 25; infoViewerBB->Init(); @@ -622,7 +621,6 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap void CInfoViewer::showTitle(t_channel_id chid, const bool calledFromNumZap, int epgpos) { - CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(chid); if(channel) { @@ -864,7 +862,7 @@ void CInfoViewer::loop(bool show_dot) #endif if (msg == (neutrino_msg_t) g_settings.key_screenshot) { res = CNeutrinoApp::getInstance()->handleMsg(msg, data); - + } else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) { g_RCInput->postMsg (msg, 0); res = messages_return::cancel_info; @@ -1263,6 +1261,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_ISNVOD)) { channel_id = (*(t_channel_id *)data); + killInfobarText(); return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_CA_ID) { //chanready = 1; @@ -1888,7 +1887,7 @@ void CInfoViewer::showInfoFile() //set some properties for info object infobar_txt->setDimensionsAll(xStart, yStart, width, height); - infobar_txt->setCornerRadius(RADIUS_SMALL); + infobar_txt->setCorner(RADIUS_SMALL); infobar_txt->setShadowOnOff(true); infobar_txt->setTextColor(COL_INFOBAR_TEXT); infobar_txt->setColorBody(COL_INFOBAR_PLUS_0); @@ -1896,7 +1895,7 @@ void CInfoViewer::showInfoFile() //paint info, don't save background, if already painted, global hide is also done by killTitle() bool save_bg = !infobar_txt->isPainted(); - if (infobar_txt->textChanged()) + if (infobar_txt->textChanged() || virtual_zap_mode) infobar_txt->paint(save_bg); } @@ -2015,32 +2014,7 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id, const int c { res = 0; } - /* TODO: g_settings.infobar_channellogo_background*/ -#if 0 - // paint logo background (shaded/framed) - if ((g_settings.infobar_channellogo_background !=0) && (res !=0)) // with background - { - int frame_w = 2, logo_bg_x=0, logo_bg_y=0, logo_bg_w=0, logo_bg_h=0; - if (g_settings.infobar_channellogo_background == 1) // framed - { - //sh_offset = 2; - logo_bg_x = logo_x-frame_w; - logo_bg_y = logo_y-frame_w; - logo_bg_w = logo_w+frame_w*2; - logo_bg_h = logo_h+frame_w*2; - } - else if (g_settings.infobar_channellogo_background == 2) // shaded - { - //sh_offset = 3; - logo_bg_x = logo_x+SHADOW_OFFSET; - logo_bg_y = logo_y+SHADOW_OFFSET; - logo_bg_w = logo_w; - logo_bg_h = logo_h; - } - frameBuffer->paintBoxRel(logo_bg_x, logo_bg_y, logo_bg_w, logo_bg_h, COL_INFOBAR_BUTTONS_BACKGROUND); - } -#endif // paint the logo if (res != 0) { if (!g_PicViewer->DisplayImage(strAbsIconPath, logo_x, logo_y, logo_w, logo_h)) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 900ae00bc..1e2311300 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -640,9 +640,9 @@ void CInfoViewerBB::showSysfsHdd() if (g_settings.infobar_show_sysfs_hdd) { //sysFS info int percent = 0; - long t, u; + uint64_t t, u; if (get_fs_usage("/", t, u)) - percent = (u * 100ULL) / t; + percent = (int)((u * 100ULL) / t); showBarSys(percent); if (check_dir(g_settings.network_nfs_recordingdir) == 0) @@ -655,9 +655,9 @@ void CInfoViewerBB::showSysfsHdd() void* CInfoViewerBB::hddperThread(void *arg) { CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg; - long t, u; + uint64_t t, u; if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u)) - infoViewerBB->hddpercent = (u * 100ULL) / t; + infoViewerBB->hddpercent = (int)((u * 100ULL) / t); else infoViewerBB->hddpercent = 0; infoViewerBB->hddperTflag=false; diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index 50e0a72b0..6ff2edbd7 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -149,7 +149,7 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) CMenuForwarder *fw_pviewer = NULL; CPictureViewerGui *pictureviewergui = NULL; #if ENABLE_UPNP - CUpnpBrowserGui *upnpbrowsergui = NULL; + static CUpnpBrowserGui *upnpbrowsergui = NULL; CMenuForwarder *fw_upnp = NULL; #endif CMenuWidget *moviePlayer = NULL; @@ -185,7 +185,8 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) fw_pviewer->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICVIEW); #if ENABLE_UPNP //upnp browser - upnpbrowsergui = new CUpnpBrowserGui(); + if (!upnpbrowsergui) + upnpbrowsergui = new CUpnpBrowserGui(); fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, upnpbrowsergui, NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0); #endif // media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK); @@ -237,7 +238,7 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) delete personalize; delete pictureviewergui; #if ENABLE_UPNP - delete upnpbrowsergui; + //delete upnpbrowsergui; #endif setUsageMode();//set default usage_mode diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 88b3526e6..a987aa4ee 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -45,11 +45,13 @@ #include #include +#include #include #include #include +#include //#define ONE_KEY_PLUGIN @@ -113,6 +115,14 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } #endif /*ONE_KEY_PLUGIN*/ + else if(actionKey == "info") + { + unsigned num = CEitManager::getInstance()->getEventsCount(); + char str[128]; + sprintf(str, "Event count: %d", num); + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, str, CMessageBox::mbrBack, CMessageBox::mbBack); + return menu_return::RETURN_REPAINT; + } return showMiscSettingsMenu(); } @@ -161,6 +171,25 @@ const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] = }; #endif /*CPU_FREQ*/ +#define EPG_SCAN_OPTION_COUNT 3 +const CMenuOptionChooser::keyval EPG_SCAN_OPTIONS[EPG_SCAN_OPTION_COUNT] = +{ + { 0, LOCALE_OPTIONS_OFF }, + { 1, LOCALE_MISCSETTINGS_EPG_SCAN_BQ }, + { 2, LOCALE_MISCSETTINGS_EPG_SCAN_FAV }, +}; + +#define SLEEPTIMER_MIN_OPTION_COUNT 7 +const CMenuOptionChooser::keyval_ext SLEEPTIMER_MIN_OPTIONS[SLEEPTIMER_MIN_OPTION_COUNT] = +{ + { 0, NONEXISTANT_LOCALE, "EPG" }, + { 30, NONEXISTANT_LOCALE, "30 min" }, + { 60, NONEXISTANT_LOCALE, "60 min" }, + { 90, NONEXISTANT_LOCALE, "90 min" }, + { 120, NONEXISTANT_LOCALE, "120 min" }, + { 150, NONEXISTANT_LOCALE, "150 min" } +}; + //show misc settings menue int CMiscMenue::showMiscSettingsMenu() { @@ -312,13 +341,17 @@ void CMiscMenue::showMiscSettingsMenuEnergy(CMenuWidget *ms_energy) m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, g_settings.shutdown_min, new CSleepTimerWidget, "permanent"); m2->setHint("", LOCALE_MENU_HINT_INACT_TIMER); ms_energy->addItem(m2); + + CMenuOptionChooser * m4 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_SLEEPTIMER_MIN, &g_settings.sleeptimer_min, SLEEPTIMER_MIN_OPTIONS, SLEEPTIMER_MIN_OPTION_COUNT, true); + m4->setHint("", LOCALE_MENU_HINT_SLEEPTIMER_MIN); + ms_energy->addItem(m4); } //EPG settings void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) { ms_epg->addIntroItems(LOCALE_MISCSETTINGS_EPG_HEAD); - + ms_epg->addKey(CRCInput::RC_info, this, "info"); CMenuOptionChooser * mc1 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE_STANDBY, &g_settings.epg_save_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.epg_save); mc1->setHint("", LOCALE_MENU_HINT_EPG_SAVE_STANDBY); @@ -353,8 +386,8 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE, &g_settings.epg_save, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true,miscEpgNotifier); mc->setHint("", LOCALE_MENU_HINT_EPG_SAVE); - CMenuOptionChooser * mc2 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &g_settings.epg_scan, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, - CFEManager::getInstance()->getEnabledCount() > 1); + CMenuOptionChooser * mc2 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &g_settings.epg_scan, EPG_SCAN_OPTIONS, EPG_SCAN_OPTION_COUNT, + true /*CFEManager::getInstance()->getEnabledCount() > 1*/); mc2->setHint("", LOCALE_MENU_HINT_EPG_SCAN); ms_epg->addItem(mc); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index d9a8eeb53..968216551 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -52,6 +52,8 @@ #include #include #include +#include + #include #include #include @@ -149,6 +151,7 @@ void CMoviePlayerGui::Init(void) speed = 1; timeshift = 0; numpida = 0; + showStartingHint = false; } void CMoviePlayerGui::cutNeutrino() @@ -157,6 +160,12 @@ void CMoviePlayerGui::cutNeutrino() return; playing = true; + /* set g_InfoViewer update timer to 1 sec, should be reset to default from restoreNeutrino->set neutrino mode */ + g_InfoViewer->setUpdateTimer(1000 * 1000); + + if (isUPNP) + return; + g_Zapit->lockPlayBack(); g_Sectionsd->setPauseScanning(true); @@ -170,8 +179,6 @@ void CMoviePlayerGui::cutNeutrino() CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts); m_LastMode = (CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); - /* set g_InfoViewer update timer to 1 sec, should be reset to default from restoreNeutrino->set neutrino mode */ - g_InfoViewer->setUpdateTimer(1000 * 1000); } void CMoviePlayerGui::restoreNeutrino() @@ -185,6 +192,9 @@ void CMoviePlayerGui::restoreNeutrino() CZapit::getInstance()->SetVolume(CZapit::getInstance()->GetVolume()); #endif + if (isUPNP) + return; + g_Zapit->unlockPlayBack(); g_Sectionsd->setPauseScanning(false); @@ -198,18 +208,18 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) if (parent) parent->hide(); - file_name = ""; - full_name = ""; - - startposition = 0; - puts("[movieplayer.cpp] executing " MOVIEPLAYER_START_SCRIPT "."); if (my_system(MOVIEPLAYER_START_SCRIPT) != 0) perror(MOVIEPLAYER_START_SCRIPT " failed"); - + + Cleanup(); + isMovieBrowser = false; isBookmark = false; timeshift = 0; + isHTTP = false; + isUPNP = false; + if (actionKey == "tsmoviebrowser") { isMovieBrowser = true; moviebrowser->setMode(MB_SHOW_RECORDS); @@ -235,11 +245,16 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) isBookmark = true; } #endif + else if (actionKey == "upnp") { + isUPNP = true; + is_file_player = 1; + PlayFile(); + } else { return menu_return::RETURN_REPAINT; } - while(SelectFile()) { + while(!isHTTP && !isUPNP && SelectFile()) { PlayFile(); if(timeshift) break; @@ -327,11 +342,8 @@ void CMoviePlayerGui::fillPids() vtype = p_movie_info->VideoType; } -bool CMoviePlayerGui::SelectFile() +void CMoviePlayerGui::Cleanup() { - bool ret = false; - menu_ret = menu_return::RETURN_REPAINT; - /*clear audiopids */ for (int i = 0; i < numpida; i++) { apids[i] = 0; @@ -342,9 +354,19 @@ bool CMoviePlayerGui::SelectFile() currentspid = -1; numsubs = 0; + startposition = 0; is_file_player = false; p_movie_info = NULL; +} + +bool CMoviePlayerGui::SelectFile() +{ + bool ret = false; + menu_ret = menu_return::RETURN_REPAINT; + + Cleanup(); file_name = ""; + full_name = ""; printf("CMoviePlayerGui::SelectFile: isBookmark %d timeshift %d isMovieBrowser %d\n", isBookmark, timeshift, isMovieBrowser); if (has_hdd) @@ -386,7 +408,7 @@ bool CMoviePlayerGui::SelectFile() is_file_player = true; } fillPids(); - + // get the start position for the movie startposition = 1000 * moviebrowser->getCurrentStartPos(); printf("CMoviePlayerGui::SelectFile: file %s start %d apid %X atype %d vpid %x vtype %d\n", full_name.c_str(), startposition, currentapid, currentac3, vpid, vtype); @@ -421,7 +443,7 @@ bool CMoviePlayerGui::SelectFile() if (strlen(cLine) > 0 && cLine[0]!='#') { char *url = NULL; - if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) ){ + if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) ){ if (url != NULL) { printf("name %s [%d] url: %s\n", name, dur, url); full_name = url; @@ -444,6 +466,13 @@ bool CMoviePlayerGui::SelectFile() std::replace(file_name.begin(), file_name.end(), '_', ' '); } else file_name = full_name; + + if(file_name.substr(0,14)=="videoplayback?"){//youtube name + if(!p_movie_info->epgTitle.empty()) + file_name = p_movie_info->epgTitle; + else + file_name = ""; + } printf("CMoviePlayerGui::SelectFile: full_name [%s] file_name [%s]\n", full_name.c_str(), file_name.c_str()); } //store last multiformat play dir @@ -454,6 +483,31 @@ bool CMoviePlayerGui::SelectFile() return ret; } +void *CMoviePlayerGui::ShowStartHint(void *arg) +{ + set_threadname(__func__); + CMoviePlayerGui *caller = (CMoviePlayerGui *)arg; + CHintBox *hintbox = NULL; + if(!caller->file_name.empty()){ + hintbox = new CHintBox(LOCALE_MOVIEPLAYER_STARTING, caller->file_name.c_str(), 450, NEUTRINO_ICON_MOVIEPLAYER); + hintbox->paint(); + } + while (caller->showStartingHint) { + neutrino_msg_t msg; + neutrino_msg_data_t data; + g_RCInput->getMsg(&msg, &data, 1); + if (msg == CRCInput::RC_home || msg == CRCInput::RC_stop) { + if(caller->playback) + caller->playback->RequestAbort(); + } + } + if(hintbox != NULL){ + hintbox->hide(); + delete hintbox; + } + return NULL; +} + void CMoviePlayerGui::PlayFile(void) { neutrino_msg_t msg; @@ -486,7 +540,18 @@ void CMoviePlayerGui::PlayFile(void) } file_prozent = 0; - if(!playback->Start((char *) full_name.c_str(), vpid, vtype, currentapid, currentac3, duration)) { + pthread_t thrStartHint = 0; + if (is_file_player) { + showStartingHint = true; + pthread_create(&thrStartHint, NULL, CMoviePlayerGui::ShowStartHint, this); + } + bool res = playback->Start((char *) full_name.c_str(), vpid, vtype, currentapid, currentac3, duration); + if (thrStartHint) { + showStartingHint = false; + pthread_join(thrStartHint, NULL); + } + + if(!res) { playback->Close(); } else { playstate = CMoviePlayerGui::PLAY; @@ -873,7 +938,7 @@ void CMoviePlayerGui::addAudioFormat(int count, std::string &apidtitle, bool& en void CMoviePlayerGui::getCurrentAudioName( bool file_player, std::string &audioname) { - if(file_player && !numpida){ + if(file_player && !numpida){ playback->FindAllPids(apids, ac3flags, &numpida, language); if(numpida) currentapid = apids[0]; @@ -1370,7 +1435,7 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) if (sub->format == 0) { int xres = 0, yres = 0, framerate; videoDecoder->getPictureInfo(xres, yres, framerate); - + double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(/*true*/)/(double) xres; double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(/*true*/)/(double) yres; diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index c3356e12e..46282be89 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -98,6 +98,9 @@ class CMoviePlayerGui : public CMenuTarget /* playback from MB */ bool isMovieBrowser; + bool isHTTP; + bool isUPNP; + bool showStartingHint; CMovieBrowser* moviebrowser; MI_MOVIE_INFO * p_movie_info; const static short MOVIE_HINT_BOX_TIMER = 5; // time to show bookmark hints in seconds @@ -138,6 +141,9 @@ class CMoviePlayerGui : public CMenuTarget void clearSubtitle(); void selectChapter(); + void Cleanup(); + static void *ShowStartHint(void *arg); + CMoviePlayerGui(const CMoviePlayerGui&) {}; CMoviePlayerGui(); @@ -155,6 +161,7 @@ class CMoviePlayerGui : public CMenuTarget void UpdatePosition(); int timeshift; int file_prozent; + void SetFile(std::string &name, std::string &file) { file_name = name; full_name = file; } }; #endif diff --git a/src/gui/network_service.cpp b/src/gui/network_service.cpp index aec0baaab..6deb94962 100644 --- a/src/gui/network_service.cpp +++ b/src/gui/network_service.cpp @@ -51,13 +51,14 @@ struct network_service int enabled; }; -#define SERVICE_COUNT 4 +#define SERVICE_COUNT 5 static struct network_service services[SERVICE_COUNT] = { { "FTP", "vsftpd", "", LOCALE_MENU_HINT_NET_FTPD, "", 0 }, { "Telnet", "telnetd", "-l/bin/login", LOCALE_MENU_HINT_NET_TELNET, "", 0 }, { "DjMount", "djmount", "-o iocharset=utf8 /media/00upnp/", LOCALE_MENU_HINT_NET_DJMOUNT, "", 0 }, - { "uShare", "ushare", "-D -n `cat /etc/hostname`", LOCALE_MENU_HINT_NET_USHARE, "", 0 } + { "uShare", "ushare", "-D -n `cat /etc/hostname`", LOCALE_MENU_HINT_NET_USHARE, "", 0 }, + { "xupnpd", "xupnpd", "", LOCALE_MENU_HINT_NET_XUPNPD, "", 0 }, }; CNetworkService::CNetworkService(std::string cmd, std::string opts) diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 158688eae..49592b4e5 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index ec0b38701..8f699a790 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -197,27 +197,8 @@ const CMenuOptionChooser::keyval SATSETUP_FRONTEND_MODE[SATSETUP_FRONTEND_MODE_C CScanSetup::CScanSetup(bool wizard_mode) { width = w_max (40, 10); - r_system = g_info.delivery_system; - fec_count = (r_system == DVB_S) ? SATSETUP_SCANTP_FEC_COUNT : CABLESETUP_SCANTP_FEC_COUNT; - freq_length = (r_system == DVB_S) ? 8 : 6; - is_wizard = wizard_mode; - //define caption of some forwarders and widgets depends of current receiver type - switch (r_system) - { - case DVB_S: - satprov_locale = LOCALE_SATSETUP_SATELLITE; - break; - case DVB_T: - satprov_locale = LOCALE_TERRESTRIALSETUP_PROVIDER; - break; - case DVB_C: - default: - satprov_locale = LOCALE_CABLESETUP_PROVIDER; - break; - } - satSelect = NULL; cableSelect = NULL; terrSelect = NULL; @@ -424,11 +405,6 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: //sat/provider selector if(CFEManager::getInstance()->haveSat() || CFEManager::getInstance()->getFrontendCount() > 1) { -#if 0 - CMenuWidget * setupMenu = new CMenuWidget(LOCALE_SATSETUP_FE_SETUP, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_SCAN_FE_SETUP); - addScanMenuFrontendSetup(setupMenu); - mf = new CMenuDForwarder(LOCALE_SATSETUP_FE_SETUP, allow_start, NULL, setupMenu, "", CRCInput::convertDigitToKey(shortcut++)); -#endif mf = new CMenuForwarder(LOCALE_SATSETUP_FE_SETUP, allow_start, NULL, this, "setup_frontend", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_FESETUP); settings->addItem(mf); @@ -444,13 +420,6 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: satOnOff = new CMenuWidget(LOCALE_SATSETUP_SATELLITE, NEUTRINO_ICON_SETTINGS, width); -#if 0 - CMenuWidget * setupMenu = new CMenuWidget(LOCALE_SATSETUP_FE_SETUP, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_SCAN_FE_SETUP); - addScanMenuFrontendSetup(setupMenu); - mf = new CMenuDForwarder(LOCALE_SATSETUP_FE_SETUP, allow_start, NULL, setupMenu, "", CRCInput::convertDigitToKey(shortcut++)); - mf->setHint("", LOCALE_MENU_HINT_SCAN_FESETUP); - settings->addItem(mf); -#endif /* add configured satellites to satSelect */ fillSatSelect(satSelect); @@ -566,58 +535,6 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); settings->addItem(mf); } -#if 0 - //-------------------------------------------------------------- - settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_SCAN)); - //-------------------------------------------------------------- - - int w = getSatMenuListWidth(); - - //auto scan - char autoscan[64]; - std::string s_capt_part = g_Locale->getText(satprov_locale); - snprintf(autoscan, 64, g_Locale->getText(LOCALE_SATSETUP_AUTO_SCAN), s_capt_part.c_str()); - - /* FIXME leak, satSelect added to both auto and manual scan, so one of them cannot be deleted */ - CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); - addScanMenuAutoScan(autoScan); - mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); - mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); - settings->addItem(mf); - - //manual scan - CMenuWidget manualScan(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN); - addScanMenuManualScan(&manualScan); - mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, &manualScan, "", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); - mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); - settings->addItem(mf); - - if (r_system == DVB_S) - { - //auto scan all - CMenuWidget * autoScanAll = new CMenuWidget(LOCALE_SATSETUP_AUTO_SCAN_ALL, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN_ALL); - addScanMenuAutoScanAll(autoScanAll); - fautoScanAll = new CMenuDForwarder(LOCALE_SATSETUP_AUTO_SCAN_ALL, true /*(dmode != NO_DISEQC)*/, NULL, autoScanAll, "", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); - fautoScanAll->setHint("", LOCALE_MENU_HINT_SCAN_AUTOALL); - settings->addItem(fautoScanAll); -#ifdef ENABLE_FASTSCAN - //fast scan - CMenuWidget * fastScanMenu = new CMenuWidget(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, MN_WIDGET_ID_SCAN_FAST_SCAN); - addScanMenuFastScan(fastScanMenu); - mf = new CMenuDForwarder(LOCALE_SATSETUP_FASTSCAN_HEAD, true, NULL, fastScanMenu, "", CRCInput::convertDigitToKey(shortcut++)); - mf->setHint("", LOCALE_MENU_HINT_SCAN_FAST); - settings->addItem(mf); -#endif /*ENABLE_FASTSCAN*/ - } - else if (r_system == DVB_C) //cable - { - CMenuWidget * cableScan = new CMenuWidget(LOCALE_SATSETUP_CABLE, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_CABLE_SCAN); - addScanMenuCable(cableScan); - CMenuForwarder * fcableScan = new CMenuDForwarder(LOCALE_SATSETUP_CABLE, true, NULL, cableScan, "", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); - fcableScan->setHint("", LOCALE_MENU_HINT_SCAN_CABLE_SIMPLE); - settings->addItem(fcableScan); - } -#endif int res = settings->exec(NULL, ""); //delete satSelect; @@ -1004,10 +921,6 @@ void CScanSetup::fillSatSelect(CMenuOptionStringChooser * select) sfound = true; } } -#if 0 - if(CFEManager::getInstance()->getMode() != CFEManager::FE_MODE_ALONE) - break; -#endif } if(!sfound && !satpos.empty()) { tmpit = satpos.begin(); @@ -1148,10 +1061,6 @@ void CScanSetup::addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t & satcon satconfig.diseqc = 0; unilnb = new CMenuOptionNumberChooser(LOCALE_UNICABLE_LNB, &satconfig.diseqc, true, 0, 1); } -#if 0 - if(!satconfig.use_usals) - all_usals = 0; -#endif CIntInput* lofL = new CIntInput(LOCALE_SATSETUP_LOFL, (int&) satconfig.lnbOffsetLow, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput* lofH = new CIntInput(LOCALE_SATSETUP_LOFH, (int&) satconfig.lnbOffsetHigh, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); @@ -1375,8 +1284,6 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc { printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortCut = shortcut; - fec_count = (r_system == DVB_S) ? SATSETUP_SCANTP_FEC_COUNT : CABLESETUP_SCANTP_FEC_COUNT; - freq_length = (r_system == DVB_S) ? 8 : 6; CMenuOptionChooser *fec = NULL; CMenuOptionChooser *mod_pol = NULL; @@ -1390,7 +1297,7 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc CStringInput *rate = new CStringInput(LOCALE_EXTRA_TP_RATE, (char *) scansettings.sat_TP_rate, 8, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); Rate = new CMenuDForwarder(LOCALE_EXTRA_TP_RATE, true, scansettings.sat_TP_rate, rate, "", CRCInput::convertDigitToKey(shortCut++)); Rate->setHint("", LOCALE_MENU_HINT_SCAN_RATE); - fec = new CMenuOptionChooser(LOCALE_EXTRA_TP_FEC, (int *)&scansettings.sat_TP_fec, SATSETUP_SCANTP_FEC, fec_count, true, NULL, CRCInput::convertDigitToKey(shortCut++), "", true); + fec = new CMenuOptionChooser(LOCALE_EXTRA_TP_FEC, (int *)&scansettings.sat_TP_fec, SATSETUP_SCANTP_FEC, SATSETUP_SCANTP_FEC_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++), "", true); fec->setHint("", LOCALE_MENU_HINT_SCAN_FEC); mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_POL, (int *)&scansettings.sat_TP_pol, SATSETUP_SCANTP_POL, SATSETUP_SCANTP_POL_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_POL); @@ -1405,7 +1312,7 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); } else if (r_system == DVB_T) { - CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, (char *)scansettings.terr_TP_freq, freq_length, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); + CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, (char *)scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); } @@ -1487,14 +1394,6 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* bool ret = false; if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_USE_USALS)) { -#if 0 - CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); - printf("[neutrino] CScanSetup::%s: all usals %d \n", __FUNCTION__, all_usals); - satellite_map_t & satmap = fe->getSatellites(); - for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++) { - sit->second.use_usals = all_usals; - } -#endif } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_DISEQC)) { printf("[neutrino] CScanSetup::%s: diseqc %d fenumber %d\n", __FUNCTION__, dmode, fenumber); @@ -1506,22 +1405,6 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* fe->setDiseqcType((diseqc_t) dmode); fe->setTsidOnid(0); -#if 0 - if(femode != CFEManager::FE_MODE_ALONE) - CFEManager::getInstance()->saveSettings(true); - - fautoScanAll->setActive(dmode != NO_DISEQC); - uniSetup->setActive(dmode == DISEQC_UNICABLE); - if (dmode == NO_DISEQC || dmode == DISEQC_UNICABLE) { - ojDiseqcRepeats->setActive(false); - } - else if(dmode < DISEQC_ADVANCED) { - ojDiseqcRepeats->setActive(true); - } - else if(dmode == DISEQC_ADVANCED) { - ojDiseqcRepeats->setActive(true); - } -#endif uniSetup->setActive(dmode == DISEQC_UNICABLE); bool enable = (dmode < DISEQC_ADVANCED) && (dmode != NO_DISEQC); ojDiseqcRepeats->setActive(enable && !CFrontend::linked(femode) && femode != CFrontend::FE_MODE_UNUSED); @@ -1530,17 +1413,6 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_FE_MODE)) { printf("[neutrino] CScanSetup::%s: fe%d mode %d master %d\n", __FUNCTION__, fenumber, femode, femaster); -#if 0 - /* cable dont have this menu */ - if(frontendSetup) - frontendSetup->setActive(femode == CFEManager::FE_MODE_ALONE); - CFEManager::getInstance()->setMode((CFEManager::fe_mode_t) femode); - /* to copy settings from fe0 */ - if(femode != CFEManager::FE_MODE_ALONE) - CFEManager::getInstance()->saveSettings(true); - if (r_system == DVB_S) //sat - fillSatSelect(satSelect); -#endif CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); if (fe->getMode() == femode) return ret; diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index 00ab51983..e1408a637 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -94,8 +94,6 @@ class CScanSetup : public CMenuTarget, public CChangeObserver bool is_wizard; - int fec_count; - int freq_length; int r_system; neutrino_locale_t satprov_locale; diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index 08ebbbc20..02c847b78 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -70,16 +70,20 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) if(permanent) { inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE2, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT3, "0123456789 "); } else { - CSectionsdClient::CurrentNextInfo info_CurrentNext; - g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext); - if ( info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { - time_t jetzt=time(NULL); - int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer+150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ; - if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000) - { - sprintf(value,"%03d",current_epg_zeit_dauer_rest); + if (g_settings.sleeptimer_min == 0) { + CSectionsdClient::CurrentNextInfo info_CurrentNext; + g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext); + if ( info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { + time_t jetzt=time(NULL); + int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer+150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ; + if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000) + { + sprintf(value,"%03d", current_epg_zeit_dauer_rest); + } } } + else + sprintf(value,"%03d", g_settings.sleeptimer_min); inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 "); } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 6eb3c2d92..2d737fc89 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -57,7 +57,8 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ CStreamInfo2::CStreamInfo2 () { frameBuffer = CFrameBuffer::getInstance (); - pip = NULL; + pip = NULL; + signalbox = NULL; font_head = SNeutrinoSettings::FONT_TYPE_MENU_TITLE; font_info = SNeutrinoSettings::FONT_TYPE_MENU; font_small = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; @@ -94,7 +95,6 @@ CStreamInfo2::CStreamInfo2 () rate.min_short_average = 0; box_h = 0; box_h2 = 0; - yypos = -1; dmxbuf = NULL; } @@ -123,14 +123,6 @@ int CStreamInfo2::doSignalStrengthLoop () #define BAR_HEIGHT 12 int res = menu_return::RETURN_REPAINT; - sigscale = new CProgressBar(); - sigscale->setBlink(); - - snrscale = new CProgressBar(); - snrscale->setBlink(); - - lastsnr = lastsig = -1; - neutrino_msg_t msg; uint64_t maxb, minb, lastb, tmp_rate; unsigned int current_pmt_version= pmt_version; @@ -140,7 +132,6 @@ int CStreamInfo2::doSignalStrengthLoop () const int delay = 15; int offset = g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)); int sw = g_Font[font_info]->getRenderWidth ("99999.999"); - int dheight = g_Font[font_info]->getHeight (); maxb = minb = lastb = tmp_rate = 0; ts_setup (); while (1) { @@ -155,9 +146,10 @@ int CStreamInfo2::doSignalStrengthLoop () int ret = update_rate (); if (paint_mode == 0) { - char currate[150]; + if (cnt < 12) cnt++; + int dheight = g_Font[font_info]->getHeight (); int dx1 = x + 10; if(delay_counter > delay + 1){ @@ -176,6 +168,7 @@ int CStreamInfo2::doSignalStrengthLoop () if ((cnt > 10) && ((minb == 0) || (minb > bit_s))) rate.min_short_average = minb = bit_s; + char currate[150]; sprintf(tmp_str, "%s:",g_Locale->getText(LOCALE_STREAMINFO_BITRATE)); g_Font[font_info]->RenderString(dx1 , average_bitrate_pos, offset+10, tmp_str, COL_INFOBAR_TEXT, 0, true); sprintf(currate, "%5llu.%02llu", rate.short_average / 1000ULL, rate.short_average % 1000ULL); @@ -213,12 +206,13 @@ int CStreamInfo2::doSignalStrengthLoop () paint_signal_fe(rate, signal); + signal.old_sig = signal.sig; + signal.old_snr = signal.snr; + signal.old_ber = signal.ber; + // switch paint mode if (msg == CRCInput::RC_red || msg == CRCInput::RC_blue || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow) { hide (); - sigscale->reset(); - snrscale->reset(); - lastsnr = lastsig = -1; paint_mode = !paint_mode; paint (paint_mode); continue; @@ -245,10 +239,8 @@ int CStreamInfo2::doSignalStrengthLoop () if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) CNeutrinoApp::getInstance ()->handleMsg (msg, data); } - delete sigscale; - sigscale = NULL; - delete snrscale; - snrscale = NULL; + delete signalbox; + signalbox = NULL; ts_close (); return res; } @@ -310,24 +302,19 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h) g_Font[font_small]->RenderString(maxmin_x, y1 + (sheight * 3) +5, fw*3, "min", COL_INFOBAR_TEXT, 0, true); - s_old.ber = s_old.max_ber = s_old.min_ber = -1; - s_old.sig = s_old.max_sig = s_old.min_sig = -1; - s_old.snr = s_old.max_snr = s_old.min_snr = -1; - br_old.short_average = br_old.max_short_average = br_old.min_short_average = -1000; sigBox_pos = 0; -// feSignal s = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -// paint_signal_fe(rate, signal); + signal.old_sig = 1; + signal.old_snr = 1; + signal.old_ber = 1; } void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s) { int x_now = sigBox_pos; int yt = sig_text_y + (sheight *2)+4; - int yd[4]; - const fb_pixel_t colors[4] = { COL_YELLOW, COL_RED, COL_GREEN, COL_BLUE }; - static int old_x = 0, old_y[4] = { 0, 0, 0, 0 }; - int i; + int yd; + static int old_x=0,old_y=0; sigBox_pos++; sigBox_pos %= sigBox_w; @@ -336,52 +323,48 @@ void CStreamInfo2::paint_signal_fe(struct bitrate br, struct feSignal s) long value = (long) (bit_s / 1000ULL); + SignalRenderStr(value, sig_text_rate_x, yt + sheight); + SignalRenderStr(br.max_short_average/ 1000ULL, sig_text_rate_x, yt); + SignalRenderStr(br.min_short_average/ 1000ULL, sig_text_rate_x, yt + (sheight * 2)); if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){ - yd[0] = y_signal_fe (value, scaling, sigBox_h);// Video + Audio + yd = y_signal_fe (value, scaling, sigBox_h);// Video + Audio } else { - yd[0] = y_signal_fe (value, 512, sigBox_h); // Audio only + yd = y_signal_fe (value, 512, sigBox_h); // Audio only } - yd[1] = y_signal_fe(s.ber, 4000, sigBox_h); - yd[2] = y_signal_fe(s.sig, 65000, sigBox_h); - yd[3] = y_signal_fe(s.snr, 65000, sigBox_h); - - for (i = 0; i < 4; i++) - { - if (!((old_x == 0 && old_y[i] == 0) || sigBox_pos == 1)) - frameBuffer->paintLine(old_x, old_y[i], - sigBox_x + x_now, sigBox_y + sigBox_h - yd[i], colors[i]); - old_y[i] = sigBox_y + sigBox_h - yd[i]; + if ((old_x == 0 && old_y == 0) || sigBox_pos == 1) { + old_x = sigBox_x+x_now; + old_y = sigBox_y+sigBox_h-yd; + } else { + frameBuffer->paintLine(old_x, old_y, sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_YELLOW); //yellow + old_x = sigBox_x+x_now; + old_y = sigBox_y+sigBox_h-yd; } - old_x = sigBox_x + x_now; - if (s.max_ber != s_old.max_ber) - SignalRenderStr(s_old.max_ber, s.max_ber, sig_text_ber_x, yt); - if (s.ber != s_old.ber) - SignalRenderStr(s_old.ber, s.ber, sig_text_ber_x, yt + sheight); - if (s.min_ber != s_old.min_ber) - SignalRenderStr(s_old.min_ber, s.min_ber, sig_text_ber_x, yt + (sheight * 2)); + if (s.ber != s.old_ber) { + SignalRenderStr(s.ber, sig_text_ber_x, yt + sheight); + SignalRenderStr(s.max_ber, sig_text_ber_x, yt); + SignalRenderStr(s.min_ber, sig_text_ber_x, yt + (sheight * 2)); + } + yd = y_signal_fe (s.ber, 4000, sigBox_h); + frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_RED); //red - if (s.max_snr != s_old.max_snr) - SignalRenderStr(s_old.max_snr, s.max_snr, sig_text_snr_x, yt); - if (s.snr != s_old.snr) - SignalRenderStr(s_old.snr, s.snr, sig_text_snr_x, yt + sheight); - if (s.min_snr != s_old.min_snr) - SignalRenderStr(s_old.min_snr, s.min_snr, sig_text_snr_x, yt + (sheight * 2)); - if (s.max_sig != s_old.max_sig) - SignalRenderStr(s_old.max_sig, s.max_sig, sig_text_sig_x, yt); - if (s.sig != s_old.sig) - SignalRenderStr(s_old.sig, s.sig, sig_text_sig_x, yt + sheight); - if (s.min_sig != s_old.min_sig) - SignalRenderStr(s_old.min_sig, s.min_sig, sig_text_sig_x, yt + (sheight * 2)); + if (s.sig != s.old_sig) { + SignalRenderStr(s.sig, sig_text_sig_x, yt + sheight); + SignalRenderStr(s.max_sig, sig_text_sig_x, yt); + SignalRenderStr(s.min_sig, sig_text_sig_x, yt + (sheight * 2)); + } + yd = y_signal_fe (s.sig, 65000, sigBox_h); + frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_GREEN); //green - if (br.max_short_average / 1000 != br_old.max_short_average / 1000) - SignalRenderStr(br_old.max_short_average / 1000, br.max_short_average / 1000ULL, sig_text_rate_x, yt); - SignalRenderStr(222222, value, sig_text_rate_x, yt + sheight); - if (br.min_short_average / 1000 != br_old.min_short_average / 1000) - SignalRenderStr(br_old.min_short_average / 1000, br.min_short_average / 1000ULL, sig_text_rate_x, yt + (sheight * 2)); - memcpy(&s_old, &s, sizeof(s)); - memcpy(&br_old, &br, sizeof(br)); + + if (s.snr != s.old_snr) { + SignalRenderStr(s.snr, sig_text_snr_x, yt + sheight); + SignalRenderStr(s.max_snr, sig_text_snr_x, yt); + SignalRenderStr(s.min_snr, sig_text_snr_x, yt + (sheight * 2)); + } + yd = y_signal_fe (s.snr, 65000, sigBox_h); + frameBuffer->paintPixel(sigBox_x+x_now, sigBox_y+sigBox_h-yd, COL_BLUE); //blue } // -- calc y from max_range and max_y @@ -399,11 +382,11 @@ int CStreamInfo2::y_signal_fe (unsigned long value, unsigned long max_value, int return (int) l; } -void CStreamInfo2::SignalRenderStr(unsigned int oldvalue, unsigned int value, int _x, int _y) +void CStreamInfo2::SignalRenderStr(unsigned int value, int _x, int _y) { char str[30]; - sprintf(str,"%6u", oldvalue); - int fw = g_Font[font_small]->getRenderWidth(str); + int fw = g_Font[font_small]->getWidth(); + fw *=(fw>17)?5:6; frameBuffer->paintBoxRel(_x, _y - sheight + 5, fw, sheight -1, COL_MENUHEAD_PLUS_0); sprintf(str,"%6u",value); g_Font[font_small]->RenderString(_x, _y + 5, fw, str, COL_INFOBAR_TEXT, 0, true); @@ -481,6 +464,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) if(channel->getVideoPid() && !(videoDecoder->getBlank())){ videoDecoder->getPictureInfo(xres, yres, framerate); + if (yres == 1088) + yres = 1080; aspectRatio = videoDecoder->getAspectRatio(); } @@ -557,15 +542,14 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) int type, layer, freq, mode, lbitrate; audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); - const char *mpegmodes[4] = { "stereo", "joint_st", "dual_ch", "single_ch" }; - const char *ddmodes[8] = { "CH1/CH2", "C", "L/R", "L/C/R", "L/R/S", "L/C/R/S", "L/R/SL/SR", "L/C/R/SL/SR" }; - sprintf (buf, "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT, 0, true); // UTF-8 if(type == 0) { + const char *mpegmodes[4] = { "stereo", "joint_st", "dual_ch", "single_ch" }; sprintf (buf, "MPEG %s (%d)", mpegmodes[mode], freq); } else { + const char *ddmodes[8] = { "CH1/CH2", "C", "L/R", "L/C/R", "L/R/S", "L/C/R/S", "L/R/SL/SR", "L/C/R/SL/SR" }; sprintf (buf, "DD %s (%d)", ddmodes[mode], freq); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT, 0, true); // UTF-8 @@ -851,17 +835,14 @@ int CStreamInfo2::update_rate () if(!dmx) return 0; - long b = 0; int ret = 0; - int b_len = 0; int timeout = 100; - - b_len = dmx->Read(dmxbuf, TS_BUF_SIZE, timeout); + int b_len = dmx->Read(dmxbuf, TS_BUF_SIZE, timeout); //printf("ts: read %d\n", b_len); - b = b_len; + long b = b_len; if (b <= 0) return 0; @@ -904,44 +885,13 @@ int CStreamInfo2::ts_close () void CStreamInfo2::showSNR () { - char percent[10]; - int barwidth = 150; - int sig, snr; - int posx, posy; - if (yypos < 0) - return; /* nothing to paint. No channel or similar */ - int sw = g_Font[font_info]->getRenderWidth ("100%"); - int pw = g_Font[font_info]->getRenderWidth (" SNR"); - - snr = (signal.snr & 0xFFFF) * 100 / 65535; - sig = (signal.sig & 0xFFFF) * 100 / 65535; - - int mheight = g_Font[font_info]->getHeight(); - if (lastsig != sig) { - lastsig = sig; - posy = yypos + (mheight/2)-5; - posx = x + 10; - sprintf(percent, "%d%%", sig); - sigscale->setProgress(posx - 1, posy, BAR_WIDTH, BAR_HEIGHT, sig, 100); - sigscale->paint(); - - posx = posx + barwidth + 3; - frameBuffer->paintBoxRel(posx, posy -1, sw, mheight-8, COL_MENUHEAD_PLUS_0); - g_Font[font_info]->RenderString (posx + 2, posy + mheight-5, sw, percent, COL_INFOBAR_TEXT); - g_Font[font_info]->RenderString (posx + 2 + sw, posy + mheight-5, pw, "SIG", COL_INFOBAR_TEXT); + if (signalbox == NULL){ + signalbox = new CSignalBox(x + 10, yypos, 240/*statusbox->getWidth()-2*/, 50, frontend); + signalbox->setScaleWidth(66); + signalbox->setColorBody(COL_MENUHEAD_PLUS_0); + signalbox->setTextColor(COL_INFOBAR_TEXT); + signalbox->doPaintBg(true); } - if (lastsnr != snr) { - lastsnr = snr; - posy = yypos + mheight + 5; - posx = x + 10; - sprintf(percent, "%d%% SNR", snr); - snrscale->setProgress(posx - 1, posy+2, BAR_WIDTH, BAR_HEIGHT, snr, 100); - snrscale->paint(); -// snrscale->paintProgressBar2(posx - 1, posy+2, snr); - posx = posx + barwidth + 3; - frameBuffer->paintBoxRel(posx, posy - 1, sw, mheight-8, COL_MENUHEAD_PLUS_0, 0, true); - g_Font[font_info]->RenderString (posx + 2, posy + mheight-5, sw, percent, COL_INFOBAR_TEXT, 0, true); - g_Font[font_info]->RenderString (posx + 2 + sw, posy + mheight-5, pw, "SNR", COL_INFOBAR_TEXT, 0, true); - } + signalbox->paint(false); } diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index d8fbef52a..cbdded7f7 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -71,16 +71,14 @@ class CStreamInfo2 : public CMenuTarget unsigned int pmt_version; int box_h,box_h2; struct feSignal { - long ber, max_ber, min_ber; - long sig, max_sig, min_sig; - long snr, max_snr, min_snr; + unsigned long ber, old_ber, max_ber, min_ber; + unsigned long sig, old_sig, max_sig, min_sig; + unsigned long snr, old_snr, max_snr, min_snr; } signal; - struct feSignal s_old; struct bitrate { - int short_average, max_short_average, min_short_average; + unsigned int short_average, max_short_average, min_short_average; } rate; - struct bitrate br_old; int doSignalStrengthLoop(); @@ -100,10 +98,9 @@ class CStreamInfo2 : public CMenuTarget void paint_signal_fe_box(int x, int y, int w, int h); void paint_signal_fe(struct bitrate rate, struct feSignal s); int y_signal_fe(unsigned long value, unsigned long max_range, int max_y); - void SignalRenderStr(unsigned int oldvalue, unsigned int value, int x, int y); - CProgressBar *sigscale; - CProgressBar *snrscale; - int lastsig, lastsnr; + void SignalRenderStr (unsigned int value, int x, int y); + CSignalBox *signalbox; + void showSNR (); public: diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 710c6859f..d01a31241 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -67,7 +67,7 @@ CTestMenu::CTestMenu() width = w_max (50, 10); circle = NULL; sq = NULL; - pic= NULL; + pic = chnl_pic = NULL; form = NULL; txt = NULL; header = NULL; @@ -92,6 +92,7 @@ CTestMenu::~CTestMenu() delete button; delete clock; delete clock_r; + delete chnl_pic; } static int test_pos[4] = { 130, 192, 282, 360 }; @@ -407,6 +408,16 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) pic->hide(); return res; } + else if (actionKey == "channellogo"){ + if (chnl_pic == NULL) + chnl_pic = new CComponentsChannelLogo(100, 100, 200, 200, 0, "ProSieben"); + + if (!chnl_pic->isPainted() && !chnl_pic->isPicPainted()) + chnl_pic->paint(); + else + chnl_pic->hide(); + return res; + } else if (actionKey == "form"){ if (form == NULL) form = new CComponentsForm(); @@ -420,16 +431,14 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) ptmp->setHeight(28); ptmp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); ptmp->setColorBody(COL_BLUE); - ptmp->setCornerRadius(RADIUS_MID); - ptmp->setCornerType(CORNER_TOP_LEFT); + ptmp->setCorner(RADIUS_MID, CORNER_TOP_LEFT); form->addCCItem(ptmp); CComponentsText *t1 = new CComponentsText(28, 0, 100, 28, "Text1", CTextBox::NO_AUTO_LINEBREAK); form->addCCItem(t1); CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 200, 50, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); - t2->setCornerRadius(RADIUS_MID); - t2->setCornerType(CORNER_TOP_RIGHT); + t2->setCorner(RADIUS_MID, CORNER_TOP_RIGHT); form->addCCItem(t2); CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); @@ -669,6 +678,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); + widget->addItem(new CMenuForwarderNonLocalized("Channel-Logo", true, NULL, this, "channellogo")); widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 39fd3913d..e595794c6 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -54,6 +54,7 @@ class CTestMenu : public CMenuTarget CComponentsWindow *window; CComponentsButton *button; CComponentsFrmClock *clock ,*clock_r; + CComponentsChannelLogo* chnl_pic; int width, selected; int showTestMenu(); diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 6b0cd6488..0978e927d 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -127,7 +127,7 @@ void CTimeOSD::update(int position, int duration) if(!visible) return; - int percent = 0; + short percent = 0; if(duration > 100) percent = (unsigned char) (position / (duration / 100)); if(m_mode == CTimeOSD::MODE_ASC) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index b6cfd59b3..d3aaa1d62 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -511,8 +512,8 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) char * buffer; off_t filesize = lseek(fileno(fd), 0, SEEK_END); lseek(fileno(fd), 0, SEEK_SET); - buffer =(char *) malloc(filesize+1); - fread(buffer, filesize, 1, fd); + buffer =(char *) malloc((uint32_t)filesize+1); + fread(buffer, (uint32_t)filesize, 1, fd); fclose(fd); buffer[filesize] = 0; ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, buffer, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8 @@ -544,6 +545,11 @@ CFlashExpert::CFlashExpert() { selectedMTD = -1; width = w_max (40, 10); +#ifdef BOXMODEL_APOLLO + forceOtherFilename = false; + otherFilename = ""; + createimage_other = 0; +#endif } CFlashExpert* CFlashExpert::getInstance() @@ -556,6 +562,9 @@ CFlashExpert* CFlashExpert::getInstance() bool CFlashExpert::checkSize(int mtd, std::string &backupFile) { +#ifndef BOXMODEL_APOLLO + if (mtd < 0) return false; +#endif char errMsg[1024] = {0}; std::string path = getPathName(backupFile); if (!file_exists(path.c_str())) { @@ -564,19 +573,35 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile) return false; } - int mtdSize = CMTDInfo::getInstance()->getMTDSize(mtd) / 1024; + uint64_t btotal = 0, bused = 0; + long bsize = 0; + uint64_t backupRequiredSize = 0; +#ifdef BOXMODEL_APOLLO + if (mtd == -1) { // check disk space for image creation + if (!get_fs_usage("/", btotal, bused, &bsize)) { + snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), "root0"); + ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg); + return false; + } + backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image + } + else +#endif + backupRequiredSize = CMTDInfo::getInstance()->getMTDSize(mtd) / 1024ULL; - long btotal = 0, bused = 0, bsize = 0; + btotal = 0; bused = 0; bsize = 0; if (!get_fs_usage(path.c_str(), btotal, bused, &bsize)) { snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), path.c_str()); ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg); return false; } - int backupMaxSize = (int)((btotal - bused) * bsize); - int res = 10; // Reserved 10% of available space - backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100)) / 1024; - if (backupMaxSize < mtdSize) { - snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, mtdSize); + uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize; + uint64_t res = 10; // Reserved 10% of available space + backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100ULL)) / 1024ULL; + printf("##### [%s] backupMaxSize: %llu, btotal: %llu, bused: %llu, bsize: %ld\n", __FUNCTION__, backupMaxSize, btotal, bused, bsize); + + if (backupMaxSize < backupRequiredSize) { + snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, backupRequiredSize); ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg); return false; } @@ -584,20 +609,110 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile) return true; } +#ifdef BOXMODEL_APOLLO +bool CFlashExpert::readDevtableFile(std::string &devtableFile, CMkfsJFFS2::v_devtable_t &v_devtable) +{ + FILE *fd = fopen(devtableFile.c_str(), "r"); + if (!fd) return false; + char lineRead[1024]; + memset(lineRead, 0, sizeof(lineRead)); + bool status = false; + while (fgets(lineRead, sizeof(lineRead)-1, fd)) { + std::string line = lineRead; + line = trim(line); + // ignore comments + if (line.find_first_of("#") == 0) { + continue; + } + // ignore comments after the entry + size_t pos = line.find_first_of("#"); + if (pos != std::string::npos) { + line = line.substr(0, pos); + line = trim(line); + } + // minimal entry: "/dev/x x 0000" + // length = 13 + if (line.length() > 12) { + v_devtable.push_back(line); + status = true; + } + memset(lineRead, 0, sizeof(lineRead)); + } + fclose(fd); + if (!status) return false; + return true; +} + +void CFlashExpert::readmtdJFFS2(std::string &filename) +{ + if (!checkSize(-1, filename)) + return; + CProgressWindow progress; + progress.setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH); + progress.paint(); + + bool devtableFileIO = false; + CMkfsJFFS2::v_devtable_t v_devtable; + std::string devtableFile = (std::string)CONFIGDIR + "/devtable.txt"; + if (file_exists(devtableFile.c_str())) { + if (readDevtableFile(devtableFile, v_devtable)) + devtableFileIO = true; + } + if ((!devtableFileIO) || (v_devtable.empty())) { + v_devtable.push_back("/dev/console c 0600 0 0 5 1 0 0 0"); + v_devtable.push_back("/dev/null c 0666 0 0 1 3 0 0 0"); + } + + std::string path = "/"; + int eSize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem()); + if (createimage_other == 1) { + if (eSize == 0x40000) eSize = 0x20000; + else if (eSize == 0x20000) eSize = 0x40000; + } + CMkfsJFFS2 mkfs; + mkfs.makeJffs2Image(path, filename, eSize, 0, 0, __LITTLE_ENDIAN, true, true, &progress, &v_devtable); + progress.hide(); + + char message[500]; + sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str()); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message); +} +#endif + void CFlashExpert::readmtd(int preadmtd) { std::string filename; CMTDInfo* mtdInfo = CMTDInfo::getInstance(); std::string hostName = netGetHostname(); std::string timeStr = getNowTimeStr("_%Y%m%d_%H%M"); + std::string tankStr = ""; #if ENABLE_EXTUPDATE +#ifdef BOXMODEL_APOLLO + int eSize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem()); + if (preadmtd == 0) { + if (createimage_other == 0) { + if (eSize == 0x40000) tankStr = ".256k"; + if (eSize == 0x20000) tankStr = ""; + } + else if (createimage_other == 1) { + if (eSize == 0x40000) tankStr = ""; + if (eSize == 0x20000) tankStr = ".256k"; + } + } +#endif if (g_settings.softupdate_name_mode_backup == CExtUpdate::SOFTUPDATE_NAME_HOSTNAME_TIME) - filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + "_" + hostName + ".img"; + filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + "_" + hostName + tankStr + ".img"; else #endif - filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + ".img"; + filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + tankStr + ".img"; +#ifdef BOXMODEL_APOLLO + if (preadmtd == 0) { + readmtdJFFS2(filename); + return; + } +#endif if (preadmtd == -1) { filename = (std::string)g_settings.update_dir + "/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1) preadmtd = MTD_OF_WHOLE_IMAGE; @@ -607,6 +722,9 @@ void CFlashExpert::readmtd(int preadmtd) #ifndef BOXMODEL_APOLLO if ((std::string)g_settings.update_dir == "/tmp") skipCheck = true; +#else + if (forceOtherFilename) + filename = otherFilename; #endif if ((!skipCheck) && (!checkSize(preadmtd, filename))) return; @@ -629,7 +747,12 @@ void CFlashExpert::readmtd(int preadmtd) sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str()); sleep(1); hide(); +#ifdef BOXMODEL_APOLLO + if (!forceOtherFilename) + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message); +#else ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message); +#endif } } @@ -668,7 +791,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) } } -void CFlashExpert::showMTDSelector(const std::string & actionkey) +int CFlashExpert::showMTDSelector(const std::string & actionkey) { int shortcut = 0; @@ -677,7 +800,7 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) widget_id = MN_WIDGET_ID_MTDREAD_SELECTOR; else if (actionkey == "writemtd") widget_id = MN_WIDGET_ID_MTDWRITE_SELECTOR; - + //generate mtd-selector CMenuWidget* mtdselector = new CMenuWidget(LOCALE_SERVICEMENU_UPDATE, NEUTRINO_ICON_UPDATE, width, widget_id); mtdselector->addIntroItems(LOCALE_FLASHUPDATE_MTDSELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); @@ -687,12 +810,20 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) char sActionKey[20]; bool enabled = true; #ifdef BOXMODEL_APOLLO - // disable write uboot / uldr, FIXME correct numbers - if ((actionkey == "writemtd") && (lx == 5 || lx == 6)) + // disable write uboot / uldr / env + if ((actionkey == "writemtd") && (lx == mtdInfo->findMTDNumberFromName("u-boot") || + lx == mtdInfo->findMTDNumberFromName("uldr") || + lx == mtdInfo->findMTDNumberFromName("env"))) enabled = false; + // build jffs2 image from root0 + if ((actionkey == "readmtd") && (lx == mtdInfo->findMTDNumberFromName("root0"))) { + CMenuForwarder *mf = new CMenuForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); + mtdselector->addItem(mf); + continue; + } #else // disable write uboot - if ((actionkey == "writemtd") && (lx == 0)) + if ((actionkey == "writemtd") && (lx == mtdInfo->findMTDNumberFromName("U-Boot"))) enabled = false; #endif sprintf(sActionKey, "%s%d", actionkey.c_str(), lx); @@ -704,11 +835,12 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); #endif #endif - mtdselector->exec(NULL,""); + int res = mtdselector->exec(NULL,""); delete mtdselector; + return res; } -void CFlashExpert::showFileSelector(const std::string & actionkey) +int CFlashExpert::showFileSelector(const std::string & actionkey) { CMenuWidget* fileselector = new CMenuWidget(LOCALE_SERVICEMENU_UPDATE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_FILESELECTOR); fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); @@ -735,12 +867,14 @@ void CFlashExpert::showFileSelector(const std::string & actionkey) } free(namelist); } - fileselector->exec(NULL,""); + int res = fileselector->exec(NULL,""); delete fileselector; + return res; } int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) { + int res = menu_return::RETURN_REPAINT; if(parent) parent->hide(); @@ -748,13 +882,13 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) readmtd(-1); } else if(actionKey=="writeflash") { - showFileSelector(""); + res = showFileSelector(""); } else if(actionKey=="readflashmtd") { - showMTDSelector("readmtd"); + res = showMTDSelector("readmtd"); } else if(actionKey=="writeflashmtd") { - showMTDSelector("writemtd"); + res = showMTDSelector("writemtd"); } else { int iReadmtd = -1; @@ -783,10 +917,153 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) selectedMTD=-1; } } - hide(); + res = menu_return::RETURN_REPAINT; + } + hide(); + return res; +} + +#ifdef BOXMODEL_APOLLO +CFlashExpertSetup::CFlashExpertSetup() +{ + width = w_max (40, 10); +} + +void CFlashExpertSetup::readMTDPart(int mtd, const std::string &fileName) +{ + CFlashExpert *cfe = CFlashExpert::getInstance(); + if (file_exists(fileName.c_str())) + unlink(fileName.c_str()); + cfe->otherFilename = fileName; + cfe->readmtd(mtd); + sync(); +} + +//#define UBOOT_BIN +//#define SPARE_BIN + +int CFlashExpertSetup::exec(CMenuTarget* parent, const std::string &actionKey) +{ +#define UPDATEDIR "/var/update" + if (parent) + parent->hide(); + + if (actionKey == "readmtd0") { + CFlashExpert *cfe = CFlashExpert::getInstance(); + CMTDInfo *mtdInfo = CMTDInfo::getInstance(); + bool skipImage = false; + if (cfe->createimage_other == 1) { + char message[512] = {0}; + // create image warning + const char *box = (mtdInfo->getMTDEraseSize(mtdInfo->findMTDsystem()) == 0x40000) ? "Trinity" : "Tank"; + snprintf(message, sizeof(message)-1, g_Locale->getText(LOCALE_FLASHUPDATE_CREATEIMAGE_WARNING), box, box); + if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, message, CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) != CMessageBox::mbrYes) + skipImage = true; + } + if (!skipImage) { + std::string uldrName = (std::string)UPDATEDIR + "/uldr.bin"; + cfe->forceOtherFilename = true; + if (g_settings.flashupdate_createimage_add_uldr == 1) + readMTDPart(mtdInfo->findMTDNumberFromName("uldr"), uldrName); +#ifdef UBOOT_BIN + std::string ubootName = (std::string)UPDATEDIR + "/u-boot.bin"; + if (g_settings.flashupdate_createimage_add_u_boot == 1) + readMTDPart(mtdInfo->findMTDNumberFromName("u-boot"), ubootName); + std::string envName = (std::string)UPDATEDIR + "/env.bin"; + if (g_settings.flashupdate_createimage_add_env == 1) + readMTDPart(mtdInfo->findMTDNumberFromName("env"), envName); +#endif +#ifdef SPARE_BIN + std::string spareName = (std::string)UPDATEDIR + "/spare.bin"; + if (g_settings.flashupdate_createimage_add_spare == 1) + readMTDPart(mtdInfo->findMTDNumberFromName("spare"), spareName); +#endif + std::string kernelName = (std::string)UPDATEDIR + "/vmlinux.ub.gz"; + if (g_settings.flashupdate_createimage_add_kernel == 1) + readMTDPart(mtdInfo->findMTDNumberFromName("kernel"), kernelName); + cfe->forceOtherFilename = false; + cfe->otherFilename = ""; + + cfe->readmtd(0); + + if (g_settings.flashupdate_createimage_add_uldr == 1) + unlink(uldrName.c_str()); +#ifdef UBOOT_BIN + if (g_settings.flashupdate_createimage_add_u_boot == 1) + unlink(ubootName.c_str()); + if (g_settings.flashupdate_createimage_add_env == 1) + unlink(envName.c_str()); +#endif +#ifdef SPARE_BIN + if (g_settings.flashupdate_createimage_add_spare == 1) + unlink(spareName.c_str()); +#endif + if (g_settings.flashupdate_createimage_add_kernel == 1) + unlink(kernelName.c_str()); + sync(); + } + + cfe->createimage_other = 0; return menu_return::RETURN_EXIT_ALL; } - - hide(); - return menu_return::RETURN_REPAINT; + return showMenu(); } + +int CFlashExpertSetup::showMenu() +{ + CFlashExpert *cfe = CFlashExpert::getInstance(); + CMenuWidget *rootfsSetup = new CMenuWidget(LOCALE_SERVICEMENU_UPDATE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_MTDREAD_ROOT0); + rootfsSetup->addIntroItems(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU); + + CMenuSeparator *s1 = new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FLASHUPDATE_CREATEIMAGE_OPTIONS); + CMenuForwarder *m1 = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE, true, NULL, this, "readmtd0", CRCInput::convertDigitToKey(0)); + CMenuOptionChooser *m2 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_ULDR, &g_settings.flashupdate_createimage_add_uldr, + MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); +#ifndef UBOOT_BIN + g_settings.flashupdate_createimage_add_u_boot = 0; +g_settings.flashupdate_createimage_add_env = 0; +#endif +#ifdef UBOOT_BIN + CMenuOptionChooser *m3 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_U_BOOT, &g_settings.flashupdate_createimage_add_u_boot, + MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); + CMenuOptionChooser *m4 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_ENV, &g_settings.flashupdate_createimage_add_env, + MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); +#endif +#ifndef SPARE_BIN +g_settings.flashupdate_createimage_add_spare = 0; +#endif +#ifdef SPARE_BIN + CMenuOptionChooser *m5 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_SPARE, &g_settings.flashupdate_createimage_add_spare, + MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); +#endif + CMenuOptionChooser *m6 = new CMenuOptionChooser(LOCALE_FLASHUPDATE_CREATEIMAGE_ADD_KERNEL, &g_settings.flashupdate_createimage_add_kernel, + MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); + + + CMTDInfo *mtdInfo = CMTDInfo::getInstance(); + const char *box = (mtdInfo->getMTDEraseSize(mtdInfo->findMTDsystem()) == 0x40000) ? "Trinity" : "Tank"; + char mText[512] = {0}; + snprintf(mText, sizeof(mText)-1, g_Locale->getText(LOCALE_FLASHUPDATE_CREATEIMAGE_OTHER), box); + CMenuOptionChooser *m7 = new CMenuOptionChooser(mText, &(cfe->createimage_other), MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); + + rootfsSetup->addItem(m1); // create image + rootfsSetup->addItem(s1); + rootfsSetup->addItem(m2); // include uldr +#ifdef UBOOT_BIN + rootfsSetup->addItem(m3); // include u-boot + rootfsSetup->addItem(m4); // include env +#endif +#ifdef SPARE_BIN + rootfsSetup->addItem(m5); // include spare +#endif + rootfsSetup->addItem(m6); // include kernel + rootfsSetup->addItem(GenericMenuSeparatorLine); + rootfsSetup->addItem(m7); // create image for other STB + + int res = rootfsSetup->exec (NULL, ""); + delete rootfsSetup; + + cfe->createimage_other = 0; + return res; +} +#endif // BOXMODEL_APOLLO diff --git a/src/gui/update.h b/src/gui/update.h index ae9e436d5..05bb4cfe9 100644 --- a/src/gui/update.h +++ b/src/gui/update.h @@ -39,6 +39,9 @@ #include #include +#ifdef BOXMODEL_APOLLO +#include +#endif #include @@ -72,19 +75,44 @@ class CFlashExpert : public CProgressWindow int selectedMTD; int width; - void showMTDSelector(const std::string & actionkey); - void showFileSelector(const std::string & actionkey); + int showMTDSelector(const std::string & actionkey); + int showFileSelector(const std::string & actionkey); bool checkSize(int mtd, std::string &backupFile); - void readmtd(int readmtd); +#ifdef BOXMODEL_APOLLO + bool readDevtableFile(std::string &devtableFile, CMkfsJFFS2::v_devtable_t &v_devtable); + void readmtdJFFS2(std::string &filename); +#endif public: +#ifdef BOXMODEL_APOLLO + bool forceOtherFilename; + std::string otherFilename; + int createimage_other; +#endif CFlashExpert(); static CFlashExpert* getInstance(); int exec(CMenuTarget* parent, const std::string & actionKey); void writemtd(const std::string & filename, int mtdNumber); + void readmtd(int readmtd); }; +#ifdef BOXMODEL_APOLLO +class CFlashExpertSetup : public CMenuTarget +{ + private: + int width; + + int showMenu(); + void readMTDPart(int mtd, const std::string &fileName); + + public: + CFlashExpertSetup(); +// ~CFlashExpertSetup(); + + int exec(CMenuTarget* parent, const std::string &actionKey); +}; +#endif // BOXMODEL_APOLLO #endif diff --git a/src/gui/update_ext.cpp b/src/gui/update_ext.cpp index 5deeb5ea7..dad3e296f 100644 --- a/src/gui/update_ext.cpp +++ b/src/gui/update_ext.cpp @@ -74,8 +74,9 @@ CExtUpdate::CExtUpdate() FileHelpers = NULL; MTDBuf = NULL; flashErrorFlag = false; - total = bsize = used = 0; - free1 = free2 = free3 = 0; + bsize = 0; + total = used = 0; + free1 = free2 = free3 = 0; copyList.clear(); blackList.clear(); @@ -232,11 +233,11 @@ bool CExtUpdate::applySettings() return ErrorReset(0, "error system mtd not found"); #ifdef BOXMODEL_APOLLO - int mtdSize = 65536*1024; // FIXME hack, mtd size more than free RAM + uint64_t mtdSize = 65536*1024; // FIXME hack, mtd size more than free RAM #else - int mtdSize = mtdInfo->getMTDSize(mtdFilename); + uint64_t mtdSize = mtdInfo->getMTDSize(mtdFilename); #endif - int mtdEraseSize = mtdInfo->getMTDEraseSize(mtdFilename); + uint64_t mtdEraseSize = mtdInfo->getMTDEraseSize(mtdFilename); mtdNumber = mtdInfo->findMTDNumber(mtdFilename); // get osrelease @@ -258,8 +259,8 @@ bool CExtUpdate::applySettings() if ( !file_exists(mtdramDriver.c_str()) ) return ErrorReset(0, "no mtdram driver available"); // load mtdram driver - snprintf(buf1, sizeof(buf1), "total_size=%d", mtdSize/1024); - snprintf(buf2, sizeof(buf2), "erase_size=%d", mtdEraseSize/1024); + snprintf(buf1, sizeof(buf1), "total_size=%llu", mtdSize/1024); + snprintf(buf2, sizeof(buf2), "erase_size=%llu", mtdEraseSize/1024); my_system(4, "insmod", mtdramDriver.c_str(), buf1, buf2); // check if mtdram driver is now loaded if (!isMtdramLoad()) @@ -271,7 +272,8 @@ bool CExtUpdate::applySettings() // find mtdram device std::string mtdRamFilename = "", mtdBlockFileName = ""; - int mtdRamSize = 0, mtdRamEraseSize = 0, mtdRamNr = 0; + uint64_t mtdRamSize = 0, mtdRamEraseSize = 0; + int mtdRamNr = 0; f1 = fopen("/proc/mtd", "r"); if(!f1) return ErrorReset(RESET_UNLOAD, "cannot read /proc/mtd"); @@ -279,7 +281,10 @@ bool CExtUpdate::applySettings() while(!feof(f1)) { if(fgets(buf1, sizeof(buf1), f1)!=NULL) { char dummy[50] = ""; - sscanf(buf1, "mtd%1d: %8x %8x \"%48s\"\n", &mtdRamNr, &mtdRamSize, &mtdRamEraseSize, dummy); + uint32_t tmp1, tmp2; + sscanf(buf1, "mtd%1d: %8x %8x \"%48s\"\n", &mtdRamNr, &tmp1, &tmp2, dummy); + mtdRamSize = (uint64_t)tmp1; + mtdRamEraseSize = (uint64_t)tmp2; if (strstr(buf1, "mtdram test device") != NULL) { sprintf(buf1, "/dev/mtd%d", mtdRamNr); mtdRamFilename = buf1; @@ -296,7 +301,7 @@ bool CExtUpdate::applySettings() else { // check mtdRamSize / mtdRamEraseSize if ((mtdRamSize != mtdSize) || (mtdRamEraseSize != mtdEraseSize)) { - snprintf(buf2, sizeof(buf2), "error MTDSize(%08x/%08x) or MTDEraseSize(%08x/%08x)\n", mtdSize, mtdRamSize, mtdEraseSize, mtdRamEraseSize); + snprintf(buf2, sizeof(buf2), "error MTDSize(%08llx/%08llx) or MTDEraseSize(%08llx/%08llx)\n", mtdSize, mtdRamSize, mtdEraseSize, mtdRamEraseSize); return ErrorReset(RESET_UNLOAD, buf2); } } @@ -309,7 +314,7 @@ bool CExtUpdate::applySettings() fd1 = open(imgFilename.c_str(), O_RDONLY); if (fd1 < 0) return ErrorReset(RESET_UNLOAD | DELETE_MTDBUF, "cannot read image file: " + imgFilename); - long filesize = lseek(fd1, 0, SEEK_END); + uint64_t filesize = (uint64_t)lseek(fd1, 0, SEEK_END); lseek(fd1, 0, SEEK_SET); if(filesize == 0) return ErrorReset(RESET_UNLOAD | CLOSE_FD1 | DELETE_MTDBUF, "image filesize is 0"); @@ -326,11 +331,11 @@ bool CExtUpdate::applySettings() } if (fd2 < 0) return ErrorReset(RESET_UNLOAD | CLOSE_FD1 | DELETE_MTDBUF, "cannot open mtdBlock"); - long fsize = filesize; - long block; + uint64_t fsize = filesize; + uint32_t block; while(fsize > 0) { - block = fsize; - if(block > (long)MTDBufSize) + block = (uint32_t)fsize; + if(block > (uint32_t)MTDBufSize) block = MTDBufSize; read(fd1, MTDBuf, block); write(fd2, MTDBuf, block); @@ -373,15 +378,15 @@ bool CExtUpdate::applySettings() if (fd2 < 0) return ErrorReset(RESET_UNLOAD | CLOSE_FD1 | DELETE_MTDBUF, "cannot open image file: ", imgFilename); while(fsize > 0) { - block = fsize; - if(block > (long)MTDBufSize) + block = (uint32_t)fsize; + if(block > (uint32_t)MTDBufSize) block = MTDBufSize; read(fd1, MTDBuf, block); write(fd2, MTDBuf, block); fsize -= block; } lseek(fd2, 0, SEEK_SET); - long fsizeDst = lseek(fd2, 0, SEEK_END); + uint64_t fsizeDst = (uint64_t)lseek(fd2, 0, SEEK_END); close(fd1); close(fd2); // check image file size @@ -704,12 +709,12 @@ bool CExtUpdate::readBackupList(const std::string & dstPath) sync(); if (get_fs_usage(mountPkt.c_str(), total, used, &bsize)) { - long flashWarning = 1000; // 1MB - long flashError = 600; // 600KB + uint64_t flashWarning = 1000; // 1MB + uint64_t flashError = 600; // 600KB char buf1[1024]; total = (total * bsize) / 1024; free3 = total - (used * bsize) / 1024; - printf("##### [%s] %ld KB free org, %ld KB free after delete, %ld KB free now\n", __FUNCTION__, free1, free2, free3); + printf("##### [%s] %llu KB free org, %llu KB free after delete, %llu KB free now\n", __FUNCTION__, free1, free2, free3); memset(buf1, '\0', sizeof(buf1)); if (free3 <= flashError) { snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_ERROR), free3, total); diff --git a/src/gui/update_ext.h b/src/gui/update_ext.h index 9ad7356b1..de7d7cd3d 100644 --- a/src/gui/update_ext.h +++ b/src/gui/update_ext.h @@ -58,8 +58,9 @@ class CExtUpdate std::vector copyList, blackList, deleteList; bool flashErrorFlag; - long total, bsize, used; - long free1, free2, free3; + long bsize; + uint64_t total, used; + uint64_t free1, free2, free3; bool applySettings(void); bool readBackupList(const std::string & dstPath); diff --git a/src/gui/update_menue.cpp b/src/gui/update_menue.cpp index 55fe6ce46..0c23ef26b 100644 --- a/src/gui/update_menue.cpp +++ b/src/gui/update_menue.cpp @@ -112,6 +112,14 @@ int CSoftwareUpdate::showSoftwareUpdate() mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_EXPERT); softUpdate.addItem(mf); +#ifdef BOXMODEL_APOLLO + softUpdate.addItem(GenericMenuSeparatorLine); + + mf = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(1)); + mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CREATEIMAGE_MENU); + softUpdate.addItem(mf); +#endif + int res = softUpdate.exec (NULL, ""); return res; } diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index c7a5a4c55..eb9609c33 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -95,7 +95,7 @@ int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey) if(actionKey == "update_dir") { const char *action_str = "update"; - if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1)) + if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1,true)) printf("[neutrino] new %s dir %s\n", action_str, g_settings.update_dir); return res; diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 71c7fc7c1..375c1f663 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -51,26 +50,23 @@ #include #include -#include - #include -#include #include -#include +#include #include #include #include -#include #include #include -#include -#include - #include +#include +#include #include + extern cVideo * videoDecoder; +extern CPictureViewer * g_PicViewer; const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN}; const struct button_label BrowseButtons[4] = @@ -81,51 +77,37 @@ const struct button_label BrowseButtons[4] = { NEUTRINO_ICON_BUTTON_OKAY , LOCALE_AUDIOPLAYER_PLAY } }; -//------------------------------------------------------------------------ - CUpnpBrowserGui::CUpnpBrowserGui() { m_socket = new CUPnPSocket(); m_frameBuffer = CFrameBuffer::getInstance(); m_playing_entry_is_shown = false; + dline = NULL; } -//------------------------------------------------------------------------ - CUpnpBrowserGui::~CUpnpBrowserGui() { delete m_socket; + delete dline; } -//------------------------------------------------------------------------ - int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { - CAudioPlayer::getInstance()->init(); if (parent) - { parent->hide(); - } g_Zapit->stopPlayBack(); + //g_Zapit->lockPlayBack(); + CZapit::getInstance()->EnablePlayback(false); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/mp3.jpg"); // tell neutrino we're in audio mode - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_audio ); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_audio); + // remember last mode -#if 0 - CZapitClient::responseGetLastChannel firstchannel; - g_Zapit->getLastChannel(firstchannel.channelNumber, firstchannel.mode); - if ((firstchannel.mode == 'r') ? - (CNeutrinoApp::getInstance()->zapto_radio_on_init_done) : - (CNeutrinoApp::getInstance()->zapto_tv_on_init_done)) - m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); - else - m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); -#endif m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); m_width = m_frameBuffer->getScreenWidthRel(); @@ -141,16 +123,17 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ m_listmaxshow = (m_height - m_info_height - m_title_height - m_theight - 2*m_buttonHeight) / (m_fheight); m_height = m_theight + m_info_height + m_title_height + 2*m_buttonHeight + m_listmaxshow * m_fheight; // recalc height - m_x=getScreenStartX( m_width ); + m_x=getScreenStartX(m_width); if (m_x < ConnectLineBox_Width) m_x = ConnectLineBox_Width; - m_y=getScreenStartY( m_height ); + m_y=getScreenStartY(m_height); // Stop sectionsd g_Sectionsd->setPauseScanning(true); - m_indexdevice=0; + m_deviceliststart=0; m_selecteddevice=0; + timeout = 0; selectDevice(); @@ -162,15 +145,16 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ // Start Sectionsd g_Sectionsd->setPauseScanning(false); videoDecoder->StopPicture(); + m_frameBuffer->Clear(); - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); - g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); + //g_Zapit->unlockPlayBack(); + CZapit::getInstance()->EnablePlayback(true); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , m_LastMode); + g_RCInput->postMsg(NeutrinoMessages::SHOW_INFOBAR, 0); - return menu_return::RETURN_EXIT_ALL; + return menu_return::RETURN_REPAINT; } -//------------------------------------------------------------------------ - void CUpnpBrowserGui::splitProtocol(std::string &protocol, std::string &prot, std::string &network, std::string &mime, std::string &additional) { std::string::size_type pos; @@ -205,7 +189,59 @@ void CUpnpBrowserGui::splitProtocol(std::string &protocol, std::string &prot, st //printf("%s -> %s - %s - %s - %s\n", protocol.c_str(), prot.c_str(), network.c_str(), mime.c_str(), additional.c_str()); } -//------------------------------------------------------------------------ +bool CUpnpBrowserGui::discoverDevices() +{ + if (!m_devices.empty()) + return true; + + CHintBox *scanBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_UPNPBROWSER_SCANNING)); // UTF-8 + scanBox->paint(); + + try { + m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); + } + catch (std::runtime_error error) + { + delete scanBox; + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + return false; + } + delete scanBox; + if (m_devices.empty()) + { + ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + return false; + } + return true; +} + +bool CUpnpBrowserGui::getResults(std::string id, unsigned int start, unsigned int count, std::list &results) +{ + std::listattribs; + std::stringstream sindex; + std::stringstream scount; + + sindex << start; + scount << count; + + attribs.push_back(UPnPAttribute("ObjectID", id)); + attribs.push_back(UPnPAttribute("BrowseFlag", "BrowseDirectChildren")); + attribs.push_back(UPnPAttribute("Filter", "*")); + attribs.push_back(UPnPAttribute("StartingIndex", sindex.str())); + attribs.push_back(UPnPAttribute("RequestedCount", scount.str())); + attribs.push_back(UPnPAttribute("SortCriteria", "")); + + try + { + results=m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); + } + catch (std::runtime_error error) + { + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + return false; + } + return true; +} std::vector *CUpnpBrowserGui::decodeResult(std::string result) { @@ -324,7 +360,11 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) splitProtocol(protocol, prot, network, mime, additional); if (prot != "http-get") continue; -#if 0 + + if (mime.substr(0,6) == "image/" && pref < 1) + { + preferred=i; + } if (mime == "image/jpeg" && pref < 1) { preferred=i; @@ -335,7 +375,6 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) preferred=i; pref=2; } -#endif if (mime == "audio/mpeg" && pref < 3) { preferred=i; @@ -346,6 +385,26 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) preferred=i; pref=4; } + if (mime == "audio/x-flac" && pref < 5) + { + preferred=i; + pref=5; + } + if (mime.substr(0,6) == "video/" && pref < 6) + { + preferred=i; + pref=6; + } + if (mime == "video/x-flv" && pref < 7) + { + preferred=i; + pref=7; + } + if (mime == "video/mp4" && pref < 8) + { + preferred=i; + pref=8; + } } } p = node->GetAttributeValue("id"); @@ -367,109 +426,99 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) return entries; } -//------------------------------------------------------------------------ +void CUpnpBrowserGui::updateDeviceSelection(int newpos) +{ + if((int) m_selecteddevice != newpos) { + int prev_selected = m_selecteddevice; + unsigned int oldliststart = m_deviceliststart; + + m_selecteddevice = newpos; + m_deviceliststart = (m_selecteddevice/m_listmaxshow)*m_listmaxshow; + if (oldliststart != m_deviceliststart) + paintDevices(); + else { + paintDevice(prev_selected - m_deviceliststart); + paintDevice(m_selecteddevice - m_deviceliststart); + } + } +} void CUpnpBrowserGui::selectDevice() { bool loop = true; - bool changed = true; + bool refresh = true; neutrino_msg_t msg; neutrino_msg_data_t data; - CHintBox *scanBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_UPNPBROWSER_SCANNING)); // UTF-8 - scanBox->paint(); -#if 0 - try { - m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); - } - catch (std::runtime_error error) - { - delete scanBox; - ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + if (!discoverDevices()) return; - } -#endif - m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); - scanBox->hide(); - - if (m_devices.empty()) - { - ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); - delete scanBox; - return; - } CAudioMute::getInstance()->enableMuteIcon(false); while (loop) { - if (changed) + if (refresh) { - paintDevice(); - changed=false; + paintDevices(); + refresh=false; } g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; - if ( msg == CRCInput::RC_timeout) + if (msg == CRCInput::RC_timeout) { // nothing } - - else if ( msg == CRCInput::RC_home) + else if (msg == CRCInput::RC_home) { loop=false; } - - else if (msg_repeatok == CRCInput::RC_up && m_selecteddevice > 0) - { - m_selecteddevice--; - if (m_selecteddevice < m_indexdevice) - m_indexdevice-=m_listmaxshow; - changed=true; + else if (msg_repeatok == (neutrino_msg_t) g_settings.key_list_start) { + updateDeviceSelection(0); } - - else if (msg_repeatok == CRCInput::RC_down && m_selecteddevice + 1 < m_devices.size()) - { - m_selecteddevice++; - if (m_selecteddevice + 1 > m_indexdevice + m_listmaxshow) - m_indexdevice+=m_listmaxshow; - changed=true; + else if (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end) { + updateDeviceSelection(m_devices.size()-1); } - - else if ( msg == CRCInput::RC_right || msg == CRCInput::RC_ok) + else if (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) + { + int step = ((int) msg == g_settings.key_channelList_pageup) ? m_listmaxshow : 1; // browse or step 1 + int new_selected = m_selecteddevice - step; + if (new_selected < 0) { + if (m_selecteddevice != 0 && step != 1) + new_selected = 0; + else + new_selected = m_devices.size() - 1; + } + updateDeviceSelection(new_selected); + } + else if (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) + { + int step = ((int) msg == g_settings.key_channelList_pagedown) ? m_listmaxshow : 1; // browse or step 1 + int new_selected = m_selecteddevice + step; + if (new_selected >= (int) m_devices.size()) { + if ((m_devices.size() - m_listmaxshow -1 < m_selecteddevice) && (m_selecteddevice != (m_devices.size() - 1)) && (step != 1)) + new_selected = m_devices.size() - 1; + else if (((m_devices.size() / m_listmaxshow) + 1) * m_listmaxshow == m_devices.size() + m_listmaxshow) // last page has full entries + new_selected = 0; + else + new_selected = ((step == (int) m_listmaxshow) && (new_selected < (int) (((m_devices.size() / m_listmaxshow)+1) * m_listmaxshow))) ? (m_devices.size() - 1) : 0; + } + updateDeviceSelection(new_selected); + } + else if (msg == CRCInput::RC_right || msg == CRCInput::RC_ok) { m_folderplay = false; selectItem("0"); - changed=true; + refresh=true; } - - else if ( msg == CRCInput::RC_blue) + else if (msg == CRCInput::RC_blue) { - scanBox->paint(); -#if 0 - try { - m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); - } - catch (std::runtime_error error) - { - delete scanBox; - ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + m_devices.clear(); + if (!discoverDevices()) return; - } -#endif - m_devices = m_socket->Discover("urn:schemas-upnp-org:service:ContentDirectory:1"); - scanBox->hide(); - if (m_devices.empty()) - { - ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_UPNPBROWSER_NOSERVERS, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); - delete scanBox; - return; - } - changed=true; + refresh=true; } - else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || @@ -479,57 +528,38 @@ void CUpnpBrowserGui::selectDevice() loop=false; g_RCInput->postMsg(msg, data); } - +#if 0 else if (msg == NeutrinoMessages::EVT_TIMER) { - CNeutrinoApp::getInstance()->handleMsg( msg, data ); + CNeutrinoApp::getInstance()->handleMsg(msg, data); } - + else if (msg > CRCInput::RC_MaxRC) +#endif else { - if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) +printf("msg: %x\n", (int) msg); + if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) loop = false; - changed=true; } } - delete scanBox; - CAudioMute::getInstance()->enableMuteIcon(true); } -//------------------------------------------------------------------------ - void CUpnpBrowserGui::playnext(void) { + std::vector *entries = NULL; while (true) { - std::listattribs; + timeout = 0; + std::listresults; std::list::iterator i; - std::stringstream sindex; - std::vector *entries = NULL; - sindex << m_playid; - attribs.push_back(UPnPAttribute("ObjectID", m_playfolder)); - attribs.push_back(UPnPAttribute("BrowseFlag", "BrowseDirectChildren")); - attribs.push_back(UPnPAttribute("Filter", "*")); - attribs.push_back(UPnPAttribute("StartingIndex", sindex.str())); - attribs.push_back(UPnPAttribute("RequestedCount", "1")); - attribs.push_back(UPnPAttribute("SortCriteria", "")); - -#if 0 - try - { - results=m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); - } - catch (std::runtime_error error) - { - ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); + printf("playnext: getResults m_playfolder %s m_playid %d\n", m_playfolder.c_str(), m_playid); + if (!getResults(m_playfolder, m_playid, 1, results)) { m_folderplay = false; return; } -#endif - results=m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); for (i=results.begin(); i!=results.end(); ++i) { if (i->first=="NumberReturned") @@ -540,15 +570,12 @@ void CUpnpBrowserGui::playnext(void) return; } } - if (i->first=="TotalMatches") - { - } - if (i->first=="Result") + else if (i->first=="Result") { entries=decodeResult(i->second); } } - m_playid++; + //m_playid++; if ((entries != NULL) && (!(*entries)[0].isdir)) { int preferred=(*entries)[0].preferred; @@ -557,285 +584,252 @@ void CUpnpBrowserGui::playnext(void) std::string protocol, prot, network, mime, additional; protocol=(*entries)[0].resources[preferred].protocol; splitProtocol(protocol, prot, network, mime, additional); - if (mime == "audio/mpeg") - { + if (mime == "audio/mpeg" || mime == "audio/x-vorbis+ogg" || mime == "audio/x-flac") { m_playing_entry = (*entries)[0]; m_playing_entry_is_shown = false; - CAudiofile mp3((*entries)[0].resources[preferred].url, CFile::FILE_MP3); - CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); - return; + playAudio((*entries)[0].resources[preferred].url, mime); } - else if (mime == "audio/x-vorbis+ogg") - { - m_playing_entry = (*entries)[0]; - m_playing_entry_is_shown = false; - CAudiofile mp3((*entries)[0].resources[preferred].url, CFile::FILE_OGG); - CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); - return; + else if (mime.substr(0,6) == "video/") { + playVideo((*entries)[0].title, (*entries)[0].resources[preferred].url); + m_folderplay = false; // FIXME else no way to stop in video folder } + else if (mime.substr(0,6) == "image/") { + if (m_folderplay) + timeout = time(NULL) + atoi(g_settings.picviewer_slide_time); + showPicture((*entries)[0].resources[preferred].url); + } + return; } } else { neutrino_msg_t msg; neutrino_msg_data_t data; g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display - if ( msg == CRCInput::RC_home) + if (msg == CRCInput::RC_home) { m_folderplay = false; break; } } } + delete entries; + m_frameBuffer->Clear(); } -//------------------------------------------------------------------------ +bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector * &entries, unsigned int &total) +{ + bool tfound = false; + bool rfound = false; + bool nfound = false; + unsigned int returned = 0; + std::listresults; + std::list::iterator i; + + delete entries; + entries = NULL; + + printf("getItems: getResults: index %d count %d\n", index, m_listmaxshow); + if (!getResults(id, index, m_listmaxshow, results)) + return false; + + for (i=results.begin(); i!=results.end(); ++i) { + if (i->first=="NumberReturned") { + returned=atoi(i->second.c_str()); + nfound=true; + } else if (i->first=="TotalMatches") { + total=atoi(i->second.c_str()); + tfound=true; + } else if (i->first=="Result") { + entries=decodeResult(i->second); + rfound=true; + } + } + if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0) + return false; + + return true; +} + +bool CUpnpBrowserGui::updateItemSelection(std::string id, std::vector * &entries, int newpos, unsigned int &selected, unsigned int &liststart) +{ + if((int) selected != newpos) { + int prev_selected = selected; + unsigned int oldliststart = liststart; + + selected = newpos; + liststart = (selected/m_listmaxshow)*m_listmaxshow; + printf("updateItemSelection: list start old %d new %d selected old %d new %d\n", oldliststart, liststart, prev_selected, selected); + if (oldliststart != liststart) { + unsigned int total; + if (!getItems(id, liststart, entries, total)) + return false; + paintItems(entries, selected - liststart, total - liststart, liststart); + } else { + paintItem(entries, prev_selected - liststart, selected - liststart); + paintItem(entries, selected - liststart, selected - liststart); + } + } + return true; +} bool CUpnpBrowserGui::selectItem(std::string id) { bool loop = true; bool endall = false; - bool changed = true; - bool rchanged = true; + bool refresh = true; neutrino_msg_t msg; neutrino_msg_data_t data; std::vector *entries = NULL; - unsigned int index, selected, dirnum; - index=0; - selected=0; - dirnum=0; - - while (loop) - { + unsigned int liststart = 0; + unsigned int selected = 0; + unsigned int total = 0; + + printf("selectItem: [%s]\n", id.c_str()); + if (!getItems(id, liststart, entries, total)) + return endall; + + while (loop) { updateTimes(); - if (rchanged) - { - std::listattribs; - std::listresults; - std::list::iterator i; - std::stringstream sindex; - std::stringstream scount; - unsigned int returned = 0; - bool rfound = false; - bool nfound = false; - bool tfound = false; - - sindex << index; - scount << m_listmaxshow; - - attribs.push_back(UPnPAttribute("ObjectID", id)); - attribs.push_back(UPnPAttribute("BrowseFlag", "BrowseDirectChildren")); - attribs.push_back(UPnPAttribute("Filter", "*")); - attribs.push_back(UPnPAttribute("StartingIndex", sindex.str())); - attribs.push_back(UPnPAttribute("RequestedCount", scount.str())); - attribs.push_back(UPnPAttribute("SortCriteria", "")); -#if 0 - try - { - results=m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); - } - catch (std::runtime_error error) - { - ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, error.what(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); - if (entries) - delete entries; - return endall; - } -#endif - results=m_devices[m_selecteddevice].SendSOAP("urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", attribs); - for (i=results.begin(); i!=results.end(); ++i) - { - if (i->first=="NumberReturned") - { - returned=atoi(i->second.c_str()); - nfound=true; - } - if (i->first=="TotalMatches") - { - dirnum=atoi(i->second.c_str()); - tfound=true; - } - if (i->first=="Result") - { - entries=decodeResult(i->second); - rfound=true; - } - } - if (!entries) - return endall; - if (!nfound || !tfound || !rfound) - { - delete entries; - return endall; - } - if (returned != entries->size()) - { - delete entries; - return endall; - } - - if (returned == 0) - { - delete entries; - return endall; - } - rchanged=false; - changed=true; - } - - if (changed) - { - paintItem(entries, selected - index, dirnum - index, index); - changed=false; + if (refresh) { + printf("selectItem: refresh, timeout = %d\n", (int) timeout); + if (!timeout) + paintItems(entries, selected - liststart, total - liststart, liststart); + refresh=false; } g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; - if ( msg == CRCInput::RC_timeout) - { + if (msg == CRCInput::RC_timeout) { // nothing } - else if (msg == CRCInput::RC_home) - { + else if (msg == CRCInput::RC_home) { loop=false; endall=true; } - else if (msg == CRCInput::RC_left) - { + else if (!timeout && (msg == CRCInput::RC_left)) { loop=false; } - - else if (msg_repeatok == CRCInput::RC_up && selected > 0) - { - selected--; - if (selected < index) - { - index-=m_listmaxshow; - rchanged=true; - } - changed=true; + else if (!timeout && (msg_repeatok == (neutrino_msg_t) g_settings.key_list_start)) { + updateItemSelection(id, entries, 0, selected, liststart); } - - else if (msg == CRCInput::RC_green && selected > 0) - { - if (index > 0) - { - index-=m_listmaxshow; - selected-=m_listmaxshow; - rchanged=true; - } - else - selected=0; - changed=true; + else if (!timeout && (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end)) { + updateItemSelection(id, entries, total-1, selected, liststart); } - - else if (msg_repeatok == CRCInput::RC_down && selected + 1 < dirnum) - { - selected++; - if (selected + 1 > index + m_listmaxshow) - { - index+=m_listmaxshow; - rchanged=true; + else if (!timeout && (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)) { + int step = ((int) msg == g_settings.key_channelList_pageup) ? m_listmaxshow : 1; // browse or step 1 + int new_selected = selected - step; + if (new_selected < 0) { + if (selected != 0 && step != 1) + new_selected = 0; + else + new_selected = total - 1; } - changed=true; + updateItemSelection(id, entries, new_selected, selected, liststart); } - - else if (msg == CRCInput::RC_red && selected + 1 < dirnum) - { - if (index < ((dirnum - 1) / m_listmaxshow) * m_listmaxshow) - { - index+=m_listmaxshow; - selected+=m_listmaxshow; - if (selected + 1 >= dirnum) - selected=dirnum - 1; - rchanged=true; + else if (!timeout && (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)) { + int step = ((int) msg == g_settings.key_channelList_pagedown) ? m_listmaxshow : 1; // browse or step 1 + int new_selected = selected + step; + if (new_selected >= (int) total) { + if ((total - m_listmaxshow -1 < selected) && (selected != (total - 1)) && (step != 1)) + new_selected = total - 1; + else if (((total / m_listmaxshow) + 1) * m_listmaxshow == total + m_listmaxshow) // last page has full entries + new_selected = 0; + else + new_selected = ((step == (int) m_listmaxshow) && (new_selected < (int) (((total / m_listmaxshow)+1) * m_listmaxshow))) ? (total - 1) : 0; } - else - selected=dirnum - 1; - changed=true; + updateItemSelection(id, entries, new_selected, selected, liststart); } - - else if (msg == CRCInput::RC_right) - { - if ((*entries)[selected - index].isdir) - { - endall=selectItem((*entries)[selected - index].id); + else if (!timeout && (msg == CRCInput::RC_ok || msg == CRCInput::RC_right)) { + if ((*entries)[selected - liststart].isdir) { + endall=selectItem((*entries)[selected - liststart].id); if (endall) loop=false; - } - changed=true; - } - else if (msg == CRCInput::RC_ok) - { - if (!(*entries)[selected - index].isdir) - { + refresh=true; + } else { m_folderplay = false; - int preferred=(*entries)[selected - index].preferred; + int preferred=(*entries)[selected - liststart].preferred; if (preferred != -1) { std::string protocol, prot, network, mime, additional; - protocol=(*entries)[selected - index].resources[preferred].protocol; + protocol=(*entries)[selected - liststart].resources[preferred].protocol; splitProtocol(protocol, prot, network, mime, additional); - if (mime == "audio/mpeg") + if (mime == "audio/mpeg" || mime == "audio/x-vorbis+ogg" || mime == "audio/x-flac") { - CAudiofile mp3((*entries)[selected - index].resources[preferred].url, CFile::FILE_MP3); - CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); + m_playing_entry = (*entries)[selected - liststart]; + m_playing_entry_is_shown = false; + playAudio((*entries)[selected - liststart].resources[preferred].url, mime); } - else if (mime == "audio/x-vorbis+ogg") + else if (mime.substr(0,6) == "video/") { - CAudiofile mp3((*entries)[selected - index].resources[preferred].url, CFile::FILE_OGG); - CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); - } - m_playing_entry = (*entries)[selected - index]; -#if 0 // TODO ! -// #ifdef ENABLE_PICTUREVIEWER - else if ((mime == "image/gif") || (mime == "image/jpeg")) - { - CPictureViewer *viewer = new CPictureViewer(); - bool loop=true; - viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); - viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); - - if (g_settings.video_Format==1) - viewer->SetAspectRatio(16.0/9); - else - viewer->SetAspectRatio(4.0/3); - - m_frameBuffer->setMode(720, 576, 16); - m_frameBuffer->setTransparency(0); - viewer->ShowImage((*entries)[selected - index].resources[preferred].url, true); - while (loop) - { - g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display - - if ( msg == CRCInput::RC_home) - loop=false; - } - m_frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); m_frameBuffer->Clear(); - delete viewer; + playVideo((*entries)[selected - liststart].title, (*entries)[selected - liststart].resources[preferred].url); + videoDecoder->ShowPicture(DATADIR "/neutrino/icons/mp3.jpg"); + refresh = true; } -// #endif -#endif - } + else if (mime.substr(0,6) == "image/") + { + videoDecoder->setBlank(true); + showPicture((*entries)[selected - liststart].resources[preferred].url); + m_playid = selected; + while (true) + { + g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout - } else { - m_folderplay = true; - m_playfolder = (*entries)[selected - index].id; - m_playid = 0; - playnext(); + if (msg == CRCInput::RC_home || msg == CRCInput::RC_ok) + break; + else if (msg == CRCInput::RC_right || msg == CRCInput::RC_down) { + m_playfolder = id; + m_playid = (m_playid + 1)%total; + playnext(); + } + else if (msg == CRCInput::RC_left || msg == CRCInput::RC_up) { + m_playfolder = id; + m_playid--; + if (m_playid < 0) + m_playid = total - 1; + playnext(); + } else + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } + m_frameBuffer->Clear(); + videoDecoder->setBlank(false); + refresh = true; + } + } } - changed=true; } - else if ( msg == CRCInput::RC_yellow) - { + else if (msg == CRCInput::RC_play) { + m_folderplay = true; + m_playfolder = (*entries)[selected - liststart].id; + m_playid = 0; + playnext(); + m_playid++; + } + else if (msg == CRCInput::RC_yellow) { if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) CAudioPlayer::getInstance()->stop(); m_folderplay = false; } - + else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_stop) { + timeout = 0; + m_folderplay = false; + m_frameBuffer->Clear(); + refresh = true; + } + else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_prev) { + timeout = 0; + m_playid -= 2; + if (m_playid < 0) + m_playid = 0; + } + else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_next) { + timeout = 0; + if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) + CAudioPlayer::getInstance()->stop(); + } else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || @@ -845,39 +839,83 @@ bool CUpnpBrowserGui::selectItem(std::string id) loop = false; g_RCInput->postMsg(msg, data); } - +#if 0 else if (msg == NeutrinoMessages::EVT_TIMER) { - CNeutrinoApp::getInstance()->handleMsg( msg, data ); + CNeutrinoApp::getInstance()->handleMsg(msg, data); } - + else if (msg > CRCInput::RC_MaxRC) +#endif else { - if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) + if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) loop = false; - changed=true; + //refresh=true; } - if (m_folderplay && (CAudioPlayer::getInstance()->getState() == CBaseDec::STOP)) + if (m_folderplay && ((!timeout || (timeout <= time(NULL))) && (CAudioPlayer::getInstance()->getState() == CBaseDec::STOP))) { playnext(); + m_playid++; + } } - if (entries) - delete entries; + + delete entries; + timeout = 0; + m_frameBuffer->Clear(); + return endall; } -//------------------------------------------------------------------------ - -void CUpnpBrowserGui::paintDevicePos(unsigned int pos) +void CUpnpBrowserGui::paintDeviceInfo() { - int ypos = m_y + m_title_height + m_theight + pos*m_fheight; + std::string tmp; + int w, xstart; + + CVFD::getInstance()->showMenuText(0, m_devices[m_selecteddevice].friendlyname.c_str(), -1, true); + + // Info + m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6, RADIUS_MID); + m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0, RADIUS_MID); + + // first line + tmp = m_devices[m_selecteddevice].manufacturer + " " + + m_devices[m_selecteddevice].manufacturerurl; + w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 + w = std::min(w, m_width - 20); + xstart = (m_width - w) / 2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20, + tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 + + // second line + tmp = m_devices[m_selecteddevice].modelname + " " + + m_devices[m_selecteddevice].modelnumber + " " + + m_devices[m_selecteddevice].modeldescription; + w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 + w = std::min(w, m_width - 20); + xstart = (m_width - w) / 2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20, + tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 + // third line + tmp = m_devices[m_selecteddevice].modelurl; + w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 + w = std::min(w, m_width - 20); + xstart = (m_width - w) / 2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, + tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 +} + +void CUpnpBrowserGui::paintDevice(unsigned int _pos) +{ + int ypos = m_y + m_title_height + m_theight + _pos*m_fheight; fb_pixel_t color; fb_pixel_t bgcolor; + unsigned int pos = m_deviceliststart + _pos; if (pos == m_selecteddevice) { color = COL_MENUCONTENT_TEXT_PLUS_2; bgcolor = COL_MENUCONTENT_PLUS_2; + paintDeviceInfo(); } else { @@ -886,14 +924,14 @@ void CUpnpBrowserGui::paintDevicePos(unsigned int pos) } m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, bgcolor); - if (pos + m_indexdevice >= m_devices.size()) + if (pos >= m_devices.size()) return; char sNr[20]; sprintf(sNr, "%2d", pos + 1); std::string num = sNr; - std::string name = m_devices[pos + m_indexdevice].friendlyname; + std::string name = m_devices[pos].friendlyname; int w = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getRenderWidth(name) + 5; g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 10, ypos + m_fheight, m_width - 30 - w, @@ -902,9 +940,44 @@ void CUpnpBrowserGui::paintDevicePos(unsigned int pos) w, name, color, m_fheight, true); // UTF-8 } -//------------------------------------------------------------------------ +void CUpnpBrowserGui::paintDevices() +{ + std::string tmp; + int ypos, top; -void CUpnpBrowserGui::paintItemPos(std::vector *entry, unsigned int pos, unsigned int selected) + // LCD + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "Select UPnP Device"); + + // Head + CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); + if (CNeutrinoApp::getInstance()->isMuted()) + header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); + header.paint(CC_SAVE_SCREEN_NO); + + // Items + for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, ypos, 15, sb, COL_MENUCONTENT_PLUS_1); + + int sbc = ((m_devices.size() - 1) / m_listmaxshow) + 1; + int sbs = ((m_selecteddevice) / m_listmaxshow); + + m_frameBuffer->paintBoxRel(m_x + m_width - 13, ypos + 2 + sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); + + // Foot + top = m_y + (m_height - m_info_height - 2 * m_buttonHeight); + + m_frameBuffer->paintBoxRel(m_x, top, m_width, m_buttonHeight+2, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); +// m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); + ::paintButtons(m_x, top, 0, 1, &RescanButton, m_width, m_buttonHeight); + + paintItem2DetailsLine (-1); // clear it +} + +void CUpnpBrowserGui::paintItem(std::vector *entry, unsigned int pos, unsigned int selected) { int ypos = m_y + m_title_height + m_theight + pos*m_fheight; fb_pixel_t color; @@ -914,11 +987,12 @@ void CUpnpBrowserGui::paintItemPos(std::vector *entry, unsigned int p { color = COL_MENUCONTENT_TEXT_PLUS_2; bgcolor = COL_MENUCONTENT_PLUS_2; + paintItemInfo(entry, selected); paintDetails(entry, pos); if ((*entry)[pos].isdir) - paintItem2DetailsLine (-1, pos); // clear it + paintItem2DetailsLine (-1); // clear it else - paintItem2DetailsLine (pos, pos); + paintItem2DetailsLine (pos); } else { @@ -961,100 +1035,21 @@ void CUpnpBrowserGui::paintItemPos(std::vector *entry, unsigned int p w, info, color, m_fheight); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 30, ypos + m_fheight, m_width - 50 - w, name, color, m_fheight, true); // UTF-8 - } -//------------------------------------------------------------------------ - -void CUpnpBrowserGui::paintDevice() -{ - std::string tmp; - int w, xstart, ypos, top; - int c_rad_mid = RADIUS_MID; - - // LCD - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "Select UPnP Device"); - CVFD::getInstance()->showMenuText(0, m_devices[m_selecteddevice].friendlyname.c_str(), -1, true); - - // Info - m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6, c_rad_mid); - m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); - - // first line - tmp = m_devices[m_selecteddevice].manufacturer + " " + - m_devices[m_selecteddevice].manufacturerurl; - w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20, - tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 - - // second line - tmp = m_devices[m_selecteddevice].modelname + " " + - m_devices[m_selecteddevice].modelnumber + " " + - m_devices[m_selecteddevice].modeldescription; - w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20, - tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 - // third line - tmp = m_devices[m_selecteddevice].modelurl; - w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, - tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 - - // Head - CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP, CComponentsHeader::CC_BTN_MENU); - if (CNeutrinoApp::getInstance()->isMuted()) - header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); - header.paint(CC_SAVE_SCREEN_NO); - - // Items - for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, ypos, 15, sb, COL_MENUCONTENT_PLUS_1); - - int sbc = ((m_devices.size() - 1) / m_listmaxshow) + 1; - int sbs = ((m_selecteddevice) / m_listmaxshow); - - m_frameBuffer->paintBoxRel(m_x + m_width - 13, ypos + 2 + sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); - - // Foot - top = m_y + (m_height - m_info_height - 2 * m_buttonHeight); - - //int ButtonWidth = (m_width - 20) / 4; - m_frameBuffer->paintBoxRel(m_x, top, m_width, m_buttonHeight+2, COL_INFOBAR_SHADOW_PLUS_1, c_rad_mid, CORNER_BOTTOM); -// m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_0); - ::paintButtons(m_x, top, 0, 1, &RescanButton, m_width, m_buttonHeight); - - clearItem2DetailsLine(); // clear it -} - -//------------------------------------------------------------------------ - -void CUpnpBrowserGui::paintItem(std::vector *entry, unsigned int selected, unsigned int max, unsigned int offset) +void CUpnpBrowserGui::paintItemInfo(std::vector *entry, unsigned int selected) { std::string tmp; std::stringstream ts; - int w, xstart, ypos, top; + int w, xstart; int preferred=(*entry)[selected].preferred; // LCD - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "Select UPnP Entry"); CVFD::getInstance()->showMenuText(0, (*entry)[selected].title.c_str(), -1, true); // Info - m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6); - m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6, RADIUS_MID); + m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0, RADIUS_MID); // first line ts << "Resources: " << (*entry)[selected].resources.size() << " Selected: " << preferred+1 << " "; @@ -1064,12 +1059,10 @@ void CUpnpBrowserGui::paintItem(std::vector *entry, unsigned int sele tmp = tmp + "Duration: " + (*entry)[selected].resources[preferred].duration; else tmp = tmp + "No resource for Item"; + w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - if (w > m_width - 20) - w = m_width - 20; + w = std::min(w, m_width - 20); xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20, tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 @@ -1085,61 +1078,45 @@ void CUpnpBrowserGui::paintItem(std::vector *entry, unsigned int sele splitProtocol((*entry)[selected].resources[preferred].protocol, proto, network, mime, info); tmp = "Protocol: " + proto + ", MIME-Type: " + mime; } - } w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - if (w > m_width - 20) - w = m_width - 20; + w = std::min(w, m_width - 20); xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20, tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 //third line tmp = ""; - if (!(*entry)[selected].isdir) - { - if (preferred != -1) - { - tmp = "URL: " + (*entry)[selected].resources[preferred].url; - } + if (!(*entry)[selected].isdir && preferred != -1) + tmp = "URL: " + (*entry)[selected].resources[preferred].url; - } w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8 - if (w > m_width - 20) - w = m_width - 20; + w = std::min(w, m_width - 20); xstart = (m_width - w) / 2; - if (xstart < 10) - xstart = 10; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 +} +void CUpnpBrowserGui::paintItems(std::vector *entry, unsigned int selected, unsigned int max, unsigned int offset) +{ +printf("CUpnpBrowserGui::paintItem:s selected %d max %d offset %d\n", selected, max, offset); + int ypos, top; + + // LCD + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "Select UPnP Entry"); // Head - tmp = g_Locale->getText(LOCALE_UPNPBROWSER_HEAD); - m_frameBuffer->paintBoxRel(m_x, m_y + m_title_height, m_width, m_theight, COL_MENUHEAD_PLUS_0); - m_frameBuffer->paintIcon(NEUTRINO_ICON_UPNP, m_x + 7, m_y + m_title_height + 6); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0, - m_width - 45, tmp, COL_MENUHEAD_TEXT, 0, true); // UTF-8 - ypos = m_y + m_title_height; - if (m_theight > 26) - ypos = (m_theight - 26) / 2 + m_y + m_title_height; - m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, m_x + m_width - 30, ypos); -#if 0 - if ( CNeutrinoApp::getInstance()->isMuted() ) - { - xpos = m_x + m_width - 75; - ypos = m_y + m_title_height; - if (m_theight > 32) - ypos = (m_theight - 32) / 2 + m_y + m_title_height; - m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos); - } -#endif + std::string name = g_Locale->getText(LOCALE_UPNPBROWSER_HEAD); + name += " : "; + name += m_devices[m_selecteddevice].friendlyname; + CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, name, NEUTRINO_ICON_UPNP); + if (CNeutrinoApp::getInstance()->isMuted()) + header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); + header.paint(CC_SAVE_SCREEN_NO); // Items for (unsigned int count=0; count *entry, unsigned int sele ::paintButtons(m_x, top, 0, 4, BrowseButtons, m_width, m_buttonHeight); } - -//------------------------------------------------------------------------ - void CUpnpBrowserGui::paintDetails(std::vector *entry, unsigned int index, bool use_playing) { // Foot info int top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; int text_start = m_x + 10; +printf("paintDetails: index %d use_playing %d shown %d\n", index, use_playing, m_playing_entry_is_shown); if ((!use_playing) && ((*entry)[index].isdir)) { - m_frameBuffer->paintBackgroundBoxRel(m_x+2, top + 2, m_width-4, 2 * m_buttonHeight+8); + m_frameBuffer->paintBackgroundBoxRel(m_x+2, top + 2, m_width-4, 2 * m_buttonHeight+8); + m_playing_entry_is_shown = false; } else { -// char cNoch[50]; // UTF-8 -// char cSeit[50]; // UTF-8 int ih = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight(); - m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * ih, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); - if (use_playing) + //m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * ih, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); + if (use_playing) { - if (!m_playing_entry_is_shown) + if (!m_playing_entry_is_shown) { m_playing_entry_is_shown = true; + m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * ih, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 1 * m_buttonHeight + 4, m_x + m_width - 8, m_playing_entry.title + " - " + m_playing_entry.artist, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 2 * m_buttonHeight + 4, m_x + m_width - 8, m_playing_entry.album, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 } - } - else + } + else { if (entry == NULL) return; m_playing_entry_is_shown = false; + m_frameBuffer->paintBoxRel(m_x, top + 2, m_width-2, 2 * ih, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 1 * m_buttonHeight + 4, m_x + m_width - 8, (*entry)[index].title + " - " + (*entry)[index].artist, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(text_start, top + 2 * m_buttonHeight + 4, m_x + m_width - 8, (*entry)[index].album, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 } -//// printf("title = %s\n", (*entry)[selected].title.c_str()); -// printf("artist = %s\n", (*entry)[selected].artist.c_str()); -// printf("album = %s\n", (*entry)[selected].album.c_str()); -// printf("children = %s\n", (*entry)[selected].children.c_str()); -// printf("id = %s\n", (*entry)[selected].id.c_str()); -#if 0 - struct tm *pStartZeit = localtime(&chanlist[index]->currentEvent.startTime); - unsigned seit = ( time(NULL) - chanlist[index]->currentEvent.startTime ) / 60; - sprintf( cSeit, g_Locale->getText(LOCALE_CHANNELLIST_SINCE), pStartZeit->tm_hour, pStartZeit->tm_min); //, seit ); - int seit_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cSeit, true); // UTF-8 - - int noch = ( chanlist[index]->currentEvent.startTime + chanlist[index]->currentEvent.duration - time(NULL) ) / 60; - if ( (noch< 0) || (noch>=10000) ) - noch= 0; - sprintf( cNoch, "(%d / %d min)", seit, noch ); - int noch_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(cNoch, true); // UTF-8 - - std::string text1= chanlist[index]->currentEvent.description; - std::string text2= chanlist[index]->currentEvent.text; - - int xstart = 10; - if (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (width - 30 - seit_len) ) - { - // zu breit, Umbruch versuchen... - int pos; - do - { - pos = text1.find_last_of("[ -.]+"); - if ( pos!=-1 ) - text1 = text1.substr( 0, pos ); - } while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (width - 30 - seit_len) ) ); - - std::string text3= chanlist[index]->currentEvent.description.substr(text1.length()+ 1); - if (!(text2.empty())) - text3 += " . "; - - xstart += g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text3); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2* fheight, width - 30- noch_len, text3, COL_MENUCONTENTDARK_TEXT); - } - - if (!(text2.empty())) - { - while ( text2.find_first_of("[ -.+*#?=!$%&/]+") == 0 ) - text2 = text2.substr( 1 ); - text2 = text2.substr( 0, text2.find('\n') ); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, y+ height+ 5+ 2* fheight, width- xstart- 20- noch_len, text2, COL_MENUCONTENTDARK_TEXT); - } - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30 - seit_len, text1, COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString (x+ width- 10- seit_len, y+ height+ 5+ fheight , seit_len, cSeit, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ width- 10- noch_len, y+ height+ 5+ 2* fheight- 2, noch_len, cNoch, COL_MENUCONTENTDARK_TEXT, 0, true); // UTF-8 -#endif - } } -//------------------------------------------------------------------------ - -// -// -- Decoreline to connect ChannelDisplayLine with ChannelDetail display -// -- 2002-03-17 rasc -// - -void CUpnpBrowserGui::clearItem2DetailsLine () +void CUpnpBrowserGui::paintItem2DetailsLine (int pos) { - paintItem2DetailsLine (-1, 0); -} + if (dline) { + dline->kill(); + delete dline; + dline = NULL; + } -//------------------------------------------------------------------------ + if (pos < 0) + return; -void CUpnpBrowserGui::paintItem2DetailsLine (int pos, unsigned int /*ch_index*/) -{ int xpos = m_x - ConnectLineBox_Width; int ypos1 = m_y + m_title_height+0 + m_theight + pos*m_fheight; int ypos2 = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; int ypos1a = ypos1 + (m_fheight/2); int ypos2a = ypos2 + (m_info_height/2)-4; - fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6; - fb_pixel_t col2 = COL_MENUCONTENT_PLUS_1; - // Clear - m_frameBuffer->paintBackgroundBoxRel(xpos, m_y + m_title_height, ConnectLineBox_Width, m_height+m_info_height-(m_y + m_title_height)); - if (pos < 0) - m_frameBuffer->paintBackgroundBoxRel(m_x, m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2, m_width, m_info_height); - - // paint Line if detail info (and not valid list pos) - if (pos >= 0) - { - // 1. col thick line - // vertical - int mh = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight() +2; - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 4, m_fheight, col1); //left from item - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2 + mh/2, 4, mh, col1); //left from detailbox - - // long vertical line - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 4, ypos2a-ypos1a, col1); - - // short horizontal lines - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 4, col1); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos2a, 12, 4, col1); - - // 2. col small line - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1, 1, m_fheight, col2); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2 + mh/2, 1, mh, col2); - - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 1, ypos2a-ypos1a+4, col2); - - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-15, ypos1a, 12, 1, col2); - m_frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-12, ypos2a, 8, 1, col2); - - // small Frame around infobox - m_frameBuffer->paintBoxFrame(m_x, ypos2, m_width, mh*2-2, 2, col1, RADIUS_LARGE); - } + dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, m_fheight/2+1, m_info_height-RADIUS_LARGE*2); + dline->paint(CC_SAVE_SCREEN_NO); } -//------------------------------------------------------------------------ - void CUpnpBrowserGui::updateTimes(const bool force) { int top; @@ -1330,6 +1213,8 @@ void CUpnpBrowserGui::updateTimes(const bool force) m_time_played = CAudioPlayer::getInstance()->getTimePlayed(); updatePlayed = true; } + +printf("updateTimes: force %d updatePlayed %d\n", force, updatePlayed); char play_time[8]; snprintf(play_time, 7, "%ld:%02ld", m_time_played / 60, m_time_played % 60); char tmp_time[] = "000:00"; @@ -1345,3 +1230,33 @@ void CUpnpBrowserGui::updateTimes(const bool force) } } +void CUpnpBrowserGui::playAudio(std::string name, std::string mime) +{ + CFile::FileType type = mime == "audio/mpeg" ? CFile::FILE_MP3 : mime == "audio/x-vorbis+ogg" ? CFile::FILE_OGG : CFile::FILE_FLAC; + CAudiofile mp3(name, type); + CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); +} + +void CUpnpBrowserGui::showPicture(std::string name) +{ + g_PicViewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); + g_PicViewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); + + if (g_settings.video_Format==3) + g_PicViewer->SetAspectRatio(16.0/9); + else + g_PicViewer->SetAspectRatio(4.0/3); + + g_PicViewer->ShowImage(name, false); + g_PicViewer->Cleanup(); +} + +void CUpnpBrowserGui::playVideo(std::string name, std::string url) +{ + if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) + CAudioPlayer::getInstance()->stop(); + + videoDecoder->StopPicture(); + CMoviePlayerGui::getInstance().SetFile(name, url); + CMoviePlayerGui::getInstance().exec(NULL, "upnp"); +} diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index c4495d5fc..4014ff6aa 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -81,7 +81,7 @@ class CUpnpBrowserGui : public CMenuTarget int m_x; int m_y; unsigned int m_listmaxshow; - unsigned int m_indexdevice; + unsigned int m_deviceliststart; unsigned int m_selecteddevice; int m_fheight; // Fonthoehe Inhalt int m_theight; // Fonthoehe Titel @@ -95,21 +95,34 @@ class CUpnpBrowserGui : public CMenuTarget int m_playid; time_t m_time_played; bool m_playing_entry_is_shown; + time_t timeout; + CComponentsDetailLine * dline; - void selectDevice(); - bool selectItem(std::string); - void paintItem(std::vector *entry, unsigned int selected, unsigned int max, unsigned int offset); - void paintDevice(); - std::vector *decodeResult(std::string); - void playnext(); + bool discoverDevices(); void splitProtocol(std::string &protocol, std::string &prot, std::string &network, std::string &mime, std::string &additional); - void paintItemPos (std::vector *entry, unsigned int pos, unsigned int selected); - void paintDevicePos(unsigned int pos); + bool getResults(std::string id, unsigned int start, unsigned int count, std::list &results); + std::vector *decodeResult(std::string); + + void updateDeviceSelection(int newpos); + void selectDevice(); + void paintDevices(); + void paintDevice(unsigned int pos); + void paintDeviceInfo(); + void playnext(); + + bool getItems(std::string id, unsigned int index, std::vector * &entries, unsigned int &total); + bool updateItemSelection(std::string id, std::vector * &entries, int newpos, unsigned int &selected, unsigned int &liststart); + bool selectItem(std::string); + void paintItems(std::vector *entry, unsigned int selected, unsigned int max, unsigned int offset); + void paintItem (std::vector *entry, unsigned int pos, unsigned int selected); + void paintItemInfo(std::vector *entry, unsigned int selected); void paintDetails(std::vector *entry, unsigned int index, bool use_playing = false); - void clearItem2DetailsLine (void); - void paintItem2DetailsLine (int pos,unsigned int ch_index); + void paintItem2DetailsLine (int pos); void updateTimes(const bool force = false); + void playAudio(std::string name, std::string mime); + void showPicture(std::string name); + void playVideo(std::string name, std::string url); }; #endif diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index b28e1b3cb..f2c1ade75 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -175,8 +175,7 @@ void CVolumeBar::initVolumeBarIcon() vb_icon->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); vb_icon->setColorBody(col_body); - vb_icon->setCornerRadius(cornerRad()); - vb_icon->setCornerType(CORNER_LEFT); + vb_icon->setCorner(cornerRad(), CORNER_LEFT); //add icon to container addCCItem(vb_icon); @@ -210,8 +209,7 @@ void CVolumeBar::initVolumeBarDigit() vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); - vb_digit->setCornerRadius(cornerRad()); - vb_digit->setCornerType(CORNER_RIGHT); + vb_digit->setCorner(cornerRad(), CORNER_RIGHT); initVolumeBarDigitValue(); //add digit label to container diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index 0f030168a..44941a6fd 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -12,13 +12,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libneutrino_gui_widget.a libneutrino_gui_widget2.a @@ -37,7 +37,6 @@ libneutrino_gui_widget_a_SOURCES = \ messagebox.cpp \ mountchooser.cpp \ msgbox.cpp \ - signalbars.cpp \ stringinput.cpp \ stringinput_ext.cpp \ textbox.cpp diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index e2e060725..4269fc328 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -122,12 +122,13 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &) unsigned char r_alt= *value[VALUE_R]; unsigned char g_alt= *value[VALUE_G]; unsigned char b_alt= *value[VALUE_B]; - unsigned char a_alt = (value[VALUE_ALPHA]) ? (*(value[VALUE_ALPHA])) : 0; + unsigned char a_null = 0; + unsigned char a_alt = (value[VALUE_ALPHA]) ? (*(value[VALUE_ALPHA])) : a_null; paint(); setColor(); - int selected = 0; + int selected = 0; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings ::TIMING_MENU]); diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index f6a40518c..c74164a90 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -82,6 +82,7 @@ #define NEUTRINO_ICON_16_9 "16_9" #define NEUTRINO_ICON_16_9_GREY "16_9_gray" #define NEUTRINO_ICON_AUDIO "audio" +#define NEUTRINO_ICON_AUDIOPLAY "audioplay" #define NEUTRINO_ICON_COLORS "colors" #define NEUTRINO_ICON_DD "dd" #define NEUTRINO_ICON_DD_AVAIL "dd_avail" diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 7a92def87..8d332399e 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -35,7 +35,7 @@ #include #include - +#include #include #include #include @@ -143,9 +143,9 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, //left text int _dx = dx; + int icon_w = 0; + int icon_h = 0; if (!iconName_Info_right.empty()) { - int icon_w = 0; - int icon_h = 0; CFrameBuffer::getInstance()->getIconSize(iconName_Info_right.c_str(), &icon_w, &icon_h); if (icon_w) _dx -= icon_frame_w + icon_w; @@ -162,11 +162,15 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, if (right_bgcol) { if (!right_text) stringstartposOption -= 60; - CFrameBuffer::getInstance()->paintBoxRel(stringstartposOption, y + 1, dx - stringstartposOption + x - 1, item_height - 2, right_bgcol, RADIUS_LARGE); - CFrameBuffer::getInstance()->paintBoxFrame(stringstartposOption, y + 1, dx - stringstartposOption + x - 1, item_height - 2, 1, COL_MENUCONTENT_PLUS_6, RADIUS_LARGE); + CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, false, COL_MENUCONTENT_PLUS_6, right_bgcol); + col.setFrameThickness(3); + col.setCorner(RADIUS_LARGE); + col.paint(false); } - if (right_text) + if (right_text) { + stringstartposOption -= (icon_w == 0 ? 0 : icon_w + icon_frame_w); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y+item_height,dx- (stringstartposOption- x), right_text, item_color, 0, true); + } } } @@ -215,11 +219,7 @@ void CMenuItem::paintItemButton(const bool select_mode, const int &item_height, int icon_h = 0; //define icon name depends of numeric value -#ifdef MARTII - if (g_settings.menu_numbers_as_icons && icon_name.empty() && CRCInput::isNumeric(directKey)) -#else if (icon_name.empty() && CRCInput::isNumeric(directKey)) -#endif { char i_name[6]; /* X +'\0' */ snprintf(i_name, 6, "%d", CRCInput::getNumericValue(directKey)); @@ -269,14 +269,8 @@ void CMenuItem::paintItemButton(const bool select_mode, const int &item_height, { frameBuffer->getIconSize(iconName_Info_right.c_str(), &icon_w, &icon_h); -#ifdef MARTII - if (icon_w>0 && icon_h>0) -#else if (active && icon_w>0 && icon_h>0) -#endif - { icon_painted = frameBuffer->paintIcon(iconName_Info_right, dx + icon_start_x - (icon_w + 20), y+ ((item_height/2- icon_h/2)) ); - } } } @@ -544,7 +538,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) std::map::iterator it = keyActionMap.find(msg); if (it != keyActionMap.end()) { fader.Stop(); - int rv = it->second.menue->exec(parent, it->second.action); + int rv = it->second.menue->exec(this, it->second.action); switch ( rv ) { case menu_return::RETURN_EXIT_ALL: retval = menu_return::RETURN_EXIT_ALL; @@ -575,7 +569,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; } } -#ifdef MARTII +#if 0 if (msg == (uint32_t) g_settings.key_channelList_pageup) msg = CRCInput::RC_page_up; else if (msg == (uint32_t) g_settings.key_channelList_pagedown) @@ -1184,7 +1178,7 @@ void CMenuWidget::paintHint(int pos) info_box->setFrameThickness(2); info_box->removeLineBreaks(str); info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - info_box->setCornerRadius(RADIUS_LARGE); + info_box->setCorner(RADIUS_LARGE); info_box->syncSysColors(); info_box->setColorBody(COL_MENUCONTENTDARK_PLUS_0); info_box->setShadowOnOff(CC_SHADOW_ON); @@ -1679,7 +1673,7 @@ int CMenuOptionLanguageChooser::paint( bool selected ) //convert first letter to large std::string s_optionValue = optionValue; if(!s_optionValue.empty()) - s_optionValue[0] = toupper(s_optionValue[0]); + s_optionValue[0] = (char)toupper(s_optionValue[0]); //paint text paintItemCaption(selected, height , s_optionValue.c_str()); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index d45ac125c..556697723 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -135,13 +135,14 @@ CTextBox::~CTextBox() //TRACE("[CTextBox] del\r\n"); m_cLineArray.clear(); hide(); - + delete[] m_bgpixbuf; } void CTextBox::initVar(void) { //TRACE("[CTextBox]->InitVar\r\n"); frameBuffer = NULL; + m_bgpixbuf = NULL; m_showTextFrame = 0; m_nNrOfNewLine = 0; @@ -510,10 +511,30 @@ void CTextBox::refreshText(void) //TRACE("[CTextBox] m_nCurrentLine: %d, m_nNrOfLines %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_nNrOfLines, m_cLineArray[m_nCurrentLine].c_str()); + //bg variables + int ax = m_cFrameTextRel.iX+m_cFrame.iX; + int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY; + int dx = m_cFrameTextRel.iWidth; + int dy = m_cFrameTextRel.iHeight; + + //save screen + if (m_bgpixbuf == NULL){ + m_bgpixbuf= new fb_pixel_t[dx * dy]; + frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf); + } + //Paint Text Background - if (m_nPaintBackground) - frameBuffer->paintBoxRel(m_cFrameTextRel.iX+m_cFrame.iX, /*m_cFrameTextRel.iY+*/m_cFrame.iY, - m_cFrameTextRel.iWidth, m_cFrameTextRel.iHeight, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType); + if (m_nPaintBackground){ + if (m_bgpixbuf){ + delete[] m_bgpixbuf; + m_bgpixbuf = NULL; + } + frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType); + } + else{ + if (m_bgpixbuf) + frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf); + } if( m_nNrOfLines <= 0) return; diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 210db2717..39a1f9ff8 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -150,6 +150,7 @@ class CTextBox int m_nFontTextHeight; CFBWindow::color_t m_textBackgroundColor; fb_pixel_t m_textColor; + fb_pixel_t* m_bgpixbuf; CFrameBuffer * frameBuffer; /* int max_width;*/ diff --git a/src/neutrino.cpp b/src/neutrino.cpp index abad2737b..40eb34b1b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -176,6 +176,8 @@ CBouquetList * RADIOsatList; CBouquetList * RADIOfavList; CBouquetList * RADIOallList; +CBouquetList * AllFavBouquetList; + CPlugins * g_PluginList; CRemoteControl * g_RemoteControl; CPictureViewer * g_PicViewer; @@ -411,6 +413,7 @@ int CNeutrinoApp::loadSetup(const char * fname) strcpy(g_settings.shutdown_min, "000"); if (can_deepstandby || cs_get_revision() == 1) strcpy(g_settings.shutdown_min, configfile.getString("shutdown_min","180").c_str()); + g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); @@ -487,7 +490,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.epg_save = configfile.getBool("epg_save", false); g_settings.epg_save_standby = configfile.getBool("epg_save_standby", true); - g_settings.epg_scan = configfile.getBool("epg_scan", false); + g_settings.epg_scan = configfile.getInt32("epg_scan", 0); //widget settings g_settings.widget_fade = false; g_settings.widget_fade = configfile.getBool("widget_fade" , false ); @@ -642,8 +645,8 @@ int CNeutrinoApp::loadSetup(const char * fname) // default plugin for movieplayer g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "Teletext" ); g_settings.onekey_plugin = configfile.getString( "onekey_plugin", "noplugin" ); - g_settings.plugin_hdd_dir = configfile.getString( "plugin_hdd_dir", "/hdd/tuxbox/plugins" ); - g_settings.logo_hdd_dir = configfile.getString( "logo_hdd_dir", "/var/share/icons/logo" ); + g_settings.plugin_hdd_dir = configfile.getString( "plugin_hdd_dir", "/media/sda1/plugins" ); + g_settings.logo_hdd_dir = configfile.getString( "logo_hdd_dir", "/media/sda1/logos" ); loadKeys(); @@ -715,6 +718,12 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.softupdate_name_mode_backup = 0; /* unused, but still initialize it */ #endif + g_settings.flashupdate_createimage_add_uldr = configfile.getInt32( "flashupdate_createimage_add_uldr", 1); + g_settings.flashupdate_createimage_add_u_boot = configfile.getInt32( "flashupdate_createimage_add_u_boot", 0); + g_settings.flashupdate_createimage_add_env = configfile.getInt32( "flashupdate_createimage_add_env", 0); + g_settings.flashupdate_createimage_add_spare = configfile.getInt32( "flashupdate_createimage_add_spare", 0); + g_settings.flashupdate_createimage_add_kernel = configfile.getInt32( "flashupdate_createimage_add_kernel", 1); + strcpy(g_settings.softupdate_url_file, configfile.getString("softupdate_url_file", "/var/etc/update.urls").c_str()); strcpy(g_settings.softupdate_proxyserver, configfile.getString("softupdate_proxyserver", "" ).c_str()); strcpy(g_settings.softupdate_proxyusername, configfile.getString("softupdate_proxyusername", "" ).c_str()); @@ -923,6 +932,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("shutdown_real_rcdelay", g_settings.shutdown_real_rcdelay); configfile.setString("shutdown_count" , g_settings.shutdown_count); configfile.setString("shutdown_min" , g_settings.shutdown_min ); + configfile.setInt32("sleeptimer_min", g_settings.sleeptimer_min); configfile.setBool("infobar_sat_display" , g_settings.infobar_sat_display ); configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); @@ -966,7 +976,7 @@ void CNeutrinoApp::saveSetup(const char * fname) // epg configfile.setBool("epg_save", g_settings.epg_save); configfile.setBool("epg_save_standby", g_settings.epg_save_standby); - configfile.setBool("epg_scan", g_settings.epg_scan); + configfile.setInt32("epg_scan", g_settings.epg_scan); configfile.setString("epg_cache_time" ,g_settings.epg_cache ); configfile.setString("epg_extendedcache_time" ,g_settings.epg_extendedcache); configfile.setString("epg_old_events" ,g_settings.epg_old_events ); @@ -1155,6 +1165,12 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32 ("softupdate_name_mode_apply", g_settings.softupdate_name_mode_apply); configfile.setInt32 ("softupdate_name_mode_backup", g_settings.softupdate_name_mode_backup); + configfile.setInt32("flashupdate_createimage_add_uldr", g_settings.flashupdate_createimage_add_uldr); + configfile.setInt32("flashupdate_createimage_add_u_boot", g_settings.flashupdate_createimage_add_u_boot); + configfile.setInt32("flashupdate_createimage_add_env", g_settings.flashupdate_createimage_add_env); + configfile.setInt32("flashupdate_createimage_add_spare", g_settings.flashupdate_createimage_add_spare); + configfile.setInt32("flashupdate_createimage_add_kernel", g_settings.flashupdate_createimage_add_kernel); + configfile.setString("softupdate_proxyserver" , g_settings.softupdate_proxyserver ); configfile.setString("softupdate_proxyusername" , g_settings.softupdate_proxyusername ); configfile.setString("softupdate_proxypassword" , g_settings.softupdate_proxypassword ); @@ -1405,12 +1421,14 @@ void CNeutrinoApp::channelsInit(bool bOnly) TIMER_STOP("[neutrino] sats took"); } + delete AllFavBouquetList; + AllFavBouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS)); /* Favorites and providers bouquets */ tvi = ri = 0; for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) { CZapitBouquet *b = g_bouquetManager->Bouquets[i]; if (!b->bHidden) { - if (b->getTvChannels(zapitList) || b->bUser) { + if (b->getTvChannels(zapitList) /* || b->bUser */) { if(b->bUser) tmp = TVfavList->addBouquet(b); else @@ -1419,7 +1437,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) tmp->channelList->SetChannelList(&zapitList); tvi++; } - if (b->getRadioChannels(zapitList) || b->bUser) { + if (b->getRadioChannels(zapitList) /* || b->bUser */) { if(b->bUser) tmp = RADIOfavList->addBouquet(b); else @@ -1428,6 +1446,8 @@ void CNeutrinoApp::channelsInit(bool bOnly) tmp->channelList->SetChannelList(&zapitList); ri++; } + if(b->bUser) + AllFavBouquetList->addBouquet(b); } } printf("[neutrino] got %d TV and %d RADIO bouquets\n", tvi, ri); fflush(stdout); @@ -1754,7 +1774,7 @@ void CNeutrinoApp::InitSectiondClient() #include #endif -void wake_up(long &wakeup) +void wake_up(bool &wakeup) { #if HAVE_COOL_HARDWARE #ifndef FP_IOCTL_CLEAR_WAKEUP_TIMER @@ -1884,7 +1904,8 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms g_Zapit->setStandby(false); //timer start - long timer_wakeup = 0; + long timerd_signal = 0; + timer_wakeup = false;//init wake_up( timer_wakeup ); init_cec_setting = true; @@ -1894,14 +1915,12 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms cecsetup.setCECSettings(); init_cec_setting = false; } + timer_wakeup = (timer_wakeup && g_settings.shutdown_timer_record_type); g_settings.shutdown_timer_record_type = false; - /* todo: check if this is necessary - pthread_create (&timer_thread, NULL, timerd_main_thread, (void *) (timer_wakeup && g_settings.shutdown_timer_record_type)); - */ - pthread_create (&timer_thread, NULL, timerd_main_thread, (void *)&timer_wakeup); + timerd_signal = (timer_wakeup && g_settings.shutdown_timer_record_type); + pthread_create (&timer_thread, NULL, timerd_main_thread, (void *)&timerd_signal); timerd_thread_started = true; - // timer_wakeup = false; powerManager = new cPowerManager; powerManager->Open(); @@ -1992,7 +2011,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms /* wait until timerd is ready... */ time_t timerd_wait = time_monotonic_ms(); - while (timer_wakeup >= 0) + while (timerd_signal >= 0) usleep(100); dprintf(DEBUG_NORMAL, "had to wait %ld ms for timerd start...\n", time_monotonic_ms() - timerd_wait); InitTimerdClient(); @@ -2419,7 +2438,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* update scan settings for manual scan to current channel */ CScanSetup::getInstance()->updateManualSettings(); - CEpgScan::getInstance()->handleMsg(msg, data); } if ((msg == NeutrinoMessages::EVT_TIMER)) { if(data == scrambled_timer) { @@ -2431,10 +2449,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } } - if ((msg == NeutrinoMessages::EVT_EIT_COMPLETE || msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE)) { - CEpgScan::getInstance()->handleMsg(msg, data); - return messages_return::handled; - } res = res | g_RemoteControl->handleMsg(msg, data); res = res | g_InfoViewer->handleMsg(msg, data); @@ -2442,10 +2456,12 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) res = res | channelList->handleMsg(msg, data); // else fprintf(stderr, "channelList = NULL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); res = res | CRecordManager::getInstance()->handleMsg(msg, data); + res = res | CEpgScan::getInstance()->handleMsg(msg, data); if( res != messages_return::unhandled ) { - if( ( msg>= CRCInput::RC_WithData ) && ( msg< CRCInput::RC_WithData+ 0x10000000 ) ) + if( ( msg>= CRCInput::RC_WithData ) && ( msg< CRCInput::RC_WithData+ 0x10000000 ) ) { delete[] (unsigned char*) data; + } return( res & ( 0xFFFFFFFF - messages_return::unhandled ) ); } @@ -2466,6 +2482,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) _show: int nNewChannel = -1; int old_b = bouquetList->getActiveBouquetNumber(); + t_channel_id old_id = 0; + if(!bouquetList->Bouquets.empty()) + old_id = bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->getActiveChannel_ChannelID(); //int old_mode = g_settings.channel_mode; int old_mode = GetChannelMode(); printf("************************* ZAP START: bouquetList %p size %d old_b %d\n", bouquetList, (int)bouquetList->Bouquets.size(), old_b);fflush(stdout); @@ -2508,7 +2527,6 @@ _repeat: bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->setSelected(old_num); #endif if(!bouquetList->Bouquets.empty()) { - t_channel_id old_id = bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->getActiveChannel_ChannelID(); bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->adjustToChannelID(old_id, false); } StartSubtitles(mode == mode_tv); @@ -2744,9 +2762,13 @@ _repeat: if(!CRecordManager::getInstance()->RecordingStatus() && (!data)) { if(mode == mode_standby) { - g_Zapit->setStandby(true); + /* do not put zapit to standby, if epg scan not finished */ + if (!CEpgScan::getInstance()->Running()) + g_Zapit->setStandby(true); cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); } + /* try to wakeup epg scan */ + CEpgScan::getInstance()->Next(); } recordingstatus = data; autoshift = CRecordManager::getInstance()->TimeshiftOnly(); @@ -2758,6 +2780,7 @@ _repeat: return messages_return::handled; } else if (msg == NeutrinoMessages::RECORD_START) { + //FIXME better at announce ? if( mode == mode_standby ) { cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); @@ -2766,6 +2789,29 @@ _repeat: g_CamHandler->exec(NULL, "ca_ci_reset1"); } } +#if 0 + //zap to rec channel if box start from deepstandby + if(timer_wakeup){ + timer_wakeup=false; + dvbsub_stop(); + CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; + t_channel_id channel_id=eventinfo->channel_id; + g_Zapit->zapTo_serviceID_NOWAIT(channel_id); + } +#endif + //zap to rec channel in standby-mode + if(mode == mode_standby){ + CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; + bool recordingStatus = CRecordManager::getInstance()->RecordingStatus(eventinfo->channel_id); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + + if( !recordingStatus && (eventinfo->channel_id != live_channel_id) && channelList->SameTP(eventinfo->channel_id) && !(SAME_TRANSPONDER(live_channel_id, eventinfo->channel_id)) ){ + dvbsub_stop(); + t_channel_id channel_id=eventinfo->channel_id; + g_Zapit->zapTo_serviceID_NOWAIT(channel_id); + } + } + if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) { CRecordManager::getInstance()->Record((CTimerd::RecordingInfo *) data); autoshift = CRecordManager::getInstance()->TimeshiftOnly(); @@ -3361,7 +3407,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) g_Zapit->stopPip(); #endif bool stream_status = CStreamManager::getInstance()->StreamStatus(); - if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus() && !stream_status) { + if(!g_settings.epg_scan && !fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus() && !stream_status) { g_Zapit->setStandby(true); } else { g_Zapit->stopPlayBack(); @@ -3409,6 +3455,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) frameBuffer->setActive(false); // Active standby on powerManager->SetStandby(false, false); + CEpgScan::getInstance()->StartStandby(); } else { // Active standby off powerManager->SetStandby(false, false); @@ -3416,6 +3463,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) CVFD::getInstance()->ShowText("resume... "); cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); videoDecoder->Standby(false); + CEpgScan::getInstance()->StopStandby(); CSectionsdClient::CurrentNextInfo dummy; g_InfoViewer->getEPG(0, dummy); @@ -4190,6 +4238,10 @@ void CNeutrinoApp::Cleanup() delete CEitManager::getInstance(); printf("cleanup 6\n");fflush(stdout); //delete CVFD::getInstance(); +#ifdef __UCLIBC__ + malloc_stats(NULL); +#else //malloc_stats(); #endif +#endif } diff --git a/src/neutrino.h b/src/neutrino.h index d93fd5d3e..c2d2c6a4a 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -100,6 +100,7 @@ private: bool lockStandbyCall; bool pbBlinkChange; bool g_channel_list_changed; + bool timer_wakeup; int tvsort[LIST_MODE_LAST]; int radiosort[LIST_MODE_LAST]; diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 2607c631e..6435ab333 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -155,6 +155,7 @@ enum MN_WIDGET_ID MN_WIDGET_ID_MTDREAD_SELECTOR, MN_WIDGET_ID_MTDWRITE_SELECTOR, MN_WIDGET_ID_FILESELECTOR, + MN_WIDGET_ID_MTDREAD_ROOT0, //software update MN_WIDGET_ID_SOFTWAREUPDATE, diff --git a/src/nhttpd/Makefile.am b/src/nhttpd/Makefile.am index 1e1ea948d..dfd2195f3 100644 --- a/src/nhttpd/Makefile.am +++ b/src/nhttpd/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = yhttpd_core yhttpd_mods tuxboxapi web AM_CPPFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS += \ -I$(srcdir) \ -I$(top_builddir) \ -I$(top_srcdir) \ diff --git a/src/nhttpd/tuxboxapi/coolstream/Makefile.am b/src/nhttpd/tuxboxapi/coolstream/Makefile.am index e29925da1..77bba00a5 100644 --- a/src/nhttpd/tuxboxapi/coolstream/Makefile.am +++ b/src/nhttpd/tuxboxapi/coolstream/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_builddir) \ -I$(top_srcdir) \ -I$(top_srcdir)/lib \ @@ -17,13 +17,13 @@ INCLUDES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO -INCLUDES += -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2 else -INCLUDES += -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream endif endif if USE_STB_HAL -INCLUDES += -I$(STB_HAL_INC) +AM_CPPFLAGS += -I$(STB_HAL_INC) endif noinst_LIBRARIES = libnhttpd_tuxboxapi.a diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index efe10c28e..262b7a784 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // yhttpd #include @@ -53,12 +54,6 @@ extern CBouquetManager *g_bouquetManager; #define EVENTDEV "/dev/input/input0" //----------------------------------------------------------------------------- -enum { // not defined in input.h but used like that, at least in 2.4.22 - KEY_RELEASED = 0, - KEY_PRESSED, - KEY_AUTOREPEAT -}; - //============================================================================= // Initialization of static variables //============================================================================= @@ -435,6 +430,7 @@ void CControlAPI::StandbyCGI(CyhookHandler *hh) } else if (hh->ParamList["1"] == "off")// standby mode off { + NeutrinoAPI->Zapit->setStandby(false); if(CNeutrinoApp::getInstance()->getMode() == 4) NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); hh->SendOk(); @@ -602,55 +598,13 @@ void CControlAPI::InfoCGI(CyhookHandler *hh) void CControlAPI::HWInfoCGI(CyhookHandler *hh) { - unsigned int system_rev = cs_get_revision(); - std::string boxname = "CST "; + std::string boxname = NeutrinoAPI->NeutrinoYParser->func_get_boxtype(hh, ""); + static CNetAdapter netadapter; std::string eth_id = netadapter.getMacAddr(); std::transform(eth_id.begin(), eth_id.end(), eth_id.begin(), ::tolower); -#if HAVE_TRIPLEDRAGON - boxname = "Armas "; -#endif - - switch(system_rev) - { - case 1: - if( boxname == "Armas ") - boxname += "TripleDragon"; - break; - case 6: - boxname += "HD1"; - break; - case 7: - boxname += "BSE"; - break; - case 8: - boxname += "Neo"; - if (CFEManager::getInstance()->getFrontendCount() > 1) - boxname += " Twin"; - break; - case 9: - boxname += "Tank"; - break; - case 10: - boxname += "Zee"; - break; - case 11: - boxname += "Trinity"; - break; - - default: - char buffer[10]; - snprintf(buffer, sizeof(buffer), "%u\n", system_rev); - boxname += "Unknown nr. "; - boxname += buffer; - break; - } - - boxname += (g_info.delivery_system == DVB_S || (system_rev == 1)) ? " SAT":" CABLE"; hh->printf("%s\nMAC:%s\n", boxname.c_str(),eth_id.c_str()); - - } //----------------------------------------------------------------------------- void CControlAPI::ShutdownCGI(CyhookHandler *hh) @@ -667,9 +621,13 @@ void CControlAPI::ShutdownCGI(CyhookHandler *hh) //----------------------------------------------------------------------------- void CControlAPI::RebootCGI(CyhookHandler *hh) { - FILE *f = fopen("/tmp/.reboot", "w"); - fclose(f); - return ShutdownCGI(hh); + if (hh->ParamList.empty()) + { + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::REBOOT, CEventServer::INITID_HTTPD); + hh->SendOk(); + } + else + hh->SendError(); } //----------------------------------------------------------------------------- @@ -683,96 +641,22 @@ int CControlAPI::rc_send(int ev, unsigned int code, unsigned int value) } //----------------------------------------------------------------------------- -// security: use const char-Pointers -struct key { - const char *name; - const int code; -}; - -#ifndef KEY_TOPLEFT -#define KEY_TOPLEFT 0x1a2 -#endif - -#ifndef KEY_TOPRIGHT -#define KEY_TOPRIGHT 0x1a3 -#endif - -#ifndef KEY_BOTTOMLEFT -#define KEY_BOTTOMLEFT 0x1a4 -#endif - -#ifndef KEY_BOTTOMRIGHT -#define KEY_BOTTOMRIGHT 0x1a5 -#endif - -static const struct key keynames[] = { - {"KEY_POWER", KEY_POWER}, - {"KEY_MUTE", KEY_MUTE}, - {"KEY_1", KEY_1}, - {"KEY_2", KEY_2}, - {"KEY_3", KEY_3}, - {"KEY_4", KEY_4}, - {"KEY_5", KEY_5}, - {"KEY_6", KEY_6}, - {"KEY_7", KEY_7}, - {"KEY_8", KEY_8}, - {"KEY_9", KEY_9}, - {"KEY_0", KEY_0}, - {"KEY_INFO", KEY_INFO}, - {"KEY_MODE", KEY_MODE}, - {"KEY_SETUP", KEY_MENU}, - {"KEY_EPG", KEY_EPG}, - {"KEY_FAVORITES", KEY_FAVORITES}, - {"KEY_HOME", KEY_EXIT}, - {"KEY_UP", KEY_UP}, - {"KEY_LEFT", KEY_LEFT}, - {"KEY_OK", KEY_OK}, - {"KEY_RIGHT", KEY_RIGHT}, - {"KEY_DOWN", KEY_DOWN}, - {"KEY_VOLUMEUP", KEY_VOLUMEUP}, - {"KEY_VOLUMEDOWN", KEY_VOLUMEDOWN}, - {"KEY_PAGEUP", KEY_PAGEUP}, - {"KEY_PAGEDOWN", KEY_PAGEDOWN}, - {"KEY_TV", KEY_TV}, - {"KEY_TEXT", KEY_TEXT}, - {"KEY_RADIO", KEY_RADIO}, - {"KEY_RED", KEY_RED}, - {"KEY_GREEN", KEY_GREEN}, - {"KEY_YELLOW", KEY_YELLOW}, - {"KEY_BLUE", KEY_BLUE}, - {"KEY_SAT", KEY_SAT}, - {"KEY_HELP", KEY_HELP}, - {"KEY_NEXT", KEY_NEXT}, - {"KEY_PREVIOUS", KEY_PREVIOUS}, - {"KEY_TIME", KEY_TIME}, - {"KEY_SLEEP", KEY_SLEEP}, - {"KEY_AUDIO", KEY_AUDIO}, - {"KEY_REWIND", KEY_REWIND}, - {"KEY_FORWARD", KEY_FORWARD}, - {"KEY_PAUSE", KEY_PAUSE}, - {"KEY_RECORD", KEY_RECORD}, - {"KEY_STOP", KEY_STOP}, - {"KEY_PLAY", KEY_PLAY}, - {"KEY_WWW", KEY_WWW}, - {"KEY_GAMES", KEY_GAMES} -}; - // The code here is based on rcsim. Thx Carjay! void CControlAPI::RCEmCGI(CyhookHandler *hh) { if (hh->ParamList.empty()) { hh->SendError(); return; } - std::string keyname = hh->ParamList["1"]; + std::string _keyname = hh->ParamList["1"]; int sendcode = -1; - for (unsigned int i = 0; sendcode == -1 && i < sizeof(keynames) + for (unsigned int i = 0; sendcode == -1 && i < sizeof(keyname) / sizeof(key); i++) { - if (!strcmp(keyname.c_str(), keynames[i].name)) - sendcode = keynames[i].code; + if (!strcmp(_keyname.c_str(), keyname[i].name)) + sendcode = keyname[i].code; } if (sendcode == -1) { - printf("[nhttpd] Key %s not found\n", keyname.c_str()); + printf("[nhttpd] Key %s not found\n", _keyname.c_str()); hh->SendError(); return; } @@ -954,7 +838,7 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * result += hh->outPair("number", string_printf("%u", nr), true); result += hh->outPair("id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->channel_id), true); result += hh->outPair("short_id", string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->channel_id&0xFFFFFFFFFFFFULL), true); - result += hh->outPair("name", channel->getName(), true); + result += hh->outPair("name", hh->outValue(channel->getName()), true); result += hh->outPair("logo", hh->outValue(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)), true); result += hh->outPair("bouquetnr", string_printf("%d", bouquetNr), isEPGdetails); if(isEPGdetails) @@ -962,12 +846,24 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * result = hh->outArrayItem("channel", result, false); } else { - result += string_printf("%u " - PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - " %s\n", - nr, - channel->channel_id, - channel->getName().c_str()); + CChannelEvent *event; + event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; + + if (event && isEPGdetails) { + result += string_printf("%u " + PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS + " %s (%s)\n", + nr, + channel->channel_id, + channel->getName().c_str(), event->description.c_str()); + } else { + result += string_printf("%u " + PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS + " %s\n", + nr, + channel->channel_id, + channel->getName().c_str()); + } } return result; } @@ -1072,10 +968,14 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { BouquetNr = atoi(hh->ParamList["bouquet"].c_str()); if (BouquetNr > 0) BouquetNr--; + if((BouquetNr > 0) && (BouquetNr >= bsize)) + BouquetNr = bsize-1; + startBouquet = BouquetNr; bsize = BouquetNr+1; } - NeutrinoAPI->GetChannelEvents(); + if (!(hh->ParamList["epg"].empty())) + NeutrinoAPI->GetChannelEvents(); for (int i = startBouquet; i < bsize; i++) { channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels; int num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i) @@ -1187,12 +1087,16 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) { if (hh->ParamList["encode"] == "true") encode = true; + bool fav = false; + if (hh->ParamList["fav"] == "true") + fav = true; + int mode = NeutrinoAPI->Zapit->getMode(); std::string bouquet; for (int i = 0, size = (int) g_bouquetManager->Bouquets.size(); i < size; i++) { std::string item = ""; ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels; - if (!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden)) { + if (!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden) && (!fav || g_bouquetManager->Bouquets[i]->bUser)) { bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str()); if (encode) bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname @@ -1373,13 +1277,14 @@ void CControlAPI::epgDetailList(CyhookHandler *hh) { //------------------------------------------------------------------------- void CControlAPI::EpgCGI(CyhookHandler *hh) { NeutrinoAPI->eList.clear(); + bool param_empty = hh->ParamList.empty(); hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); // default // Detailed EPG list in XML or JSON if (!hh->ParamList["xml"].empty() || !hh->ParamList["json"].empty() || !hh->ParamList["detaillist"].empty()) { epgDetailList(hh); } // Standard list normal or extended - else if (hh->ParamList.empty() || hh->ParamList["1"] == "ext") { + else if (param_empty || hh->ParamList["1"] == "ext") { hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); bool isExt = (hh->ParamList["1"] == "ext"); CChannelEvent *event = NULL; @@ -1638,6 +1543,8 @@ void CControlAPI::SendEventList(CyhookHandler *hh, t_channel_id channel_id) void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP) { t_channel_id current_channel = 0; + std::vector v; + if(currentTP){ current_channel = CZapit::getInstance()->GetCurrentChannelID(); current_channel=(current_channel>>16); @@ -1649,6 +1556,12 @@ void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP) for (; !(cit.EndOfChannels()); cit++) { CZapitChannel * channel = *cit; if(!currentTP || (channel->channel_id >>16) == current_channel){ + + size_t pos = std::find(v.begin(), v.end(), channel->channel_id) - v.begin(); + if( pos < v.size() ) + continue; + v.push_back(channel->channel_id); + hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->channel_id, channel->getName().c_str()); } } @@ -1718,7 +1631,7 @@ void CControlAPI::SendAllCurrentVAPid(CyhookHandler *hh) { strncpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ),DESC_MAX_LEN ); } - hh->printf("%05u %s %s\n",pids.APIDs[j].pid,pids.APIDs[j].desc,pids.APIDs[j].is_ac3 ? " (AC3)": " "); + hh->printf("%05u %s %s\n",pids.APIDs[j].pid,pids.APIDs[j].desc,pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].desc,pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].desc,pids.APIDs[j].is_eac3 ? "(EAC3)" : " "); } eit_not_ok=false; break; @@ -1735,7 +1648,7 @@ void CControlAPI::SendAllCurrentVAPid(CyhookHandler *hh) { strncpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ),DESC_MAX_LEN ); } - hh->printf("%05u %s %s\n",it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": " "); + hh->printf("%05u %s %s\n",it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": pids.APIDs[i].desc,pids.APIDs[i].is_aac ? "(AAC)" : pids.APIDs[i].desc,pids.APIDs[i].is_eac3 ? "(EAC3)" : " "); i++; } } diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 9c9d6d9bb..bf23dc0f6 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -119,6 +119,7 @@ CNeutrinoAPI::CNeutrinoAPI() EventServer = new CEventServer; EventServer->registerEvent2( NeutrinoMessages::SHUTDOWN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); + EventServer->registerEvent2( NeutrinoMessages::REBOOT, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); EventServer->registerEvent2( NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); EventServer->registerEvent2( NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); EventServer->registerEvent2( NeutrinoMessages::STANDBY_TOGGLE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); @@ -258,6 +259,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10]) bool CNeutrinoAPI::GetChannelEvents(void) { + eList.clear(); CEitManager::getInstance()->getChannelEvents(eList); CChannelEventList::iterator eventIterator; diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 8824c9342..0673b132b 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -600,7 +600,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, { strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) ); } - yresult += string_printf("\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " "); + yresult += string_printf("\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].is_eac3 ? "(EAC3)" : " "); } eit_not_ok=false; break; @@ -617,7 +617,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, { strcpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ) ); } - yresult += string_printf("\r\n",idx_as_id ? i : it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": " "); + yresult += string_printf("\r\n",idx_as_id ? i : it->pid,pids.APIDs[i].desc,pids.APIDs[i].is_ac3 ? " (AC3)": pids.APIDs[i].is_aac ? "(AAC)" : pids.APIDs[i].is_eac3 ? "(EAC3)" : " "); i++; } } @@ -729,7 +729,8 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) break; } - boxname += (g_info.delivery_system == DVB_S || (system_rev == 1)) ? " SAT":" CABLE"; + if (system_rev != 9) // don't add delivery_system for Tank + boxname += (g_info.delivery_system == DVB_S || (system_rev == 1)) ? " SAT":" CABLE"; return boxname; } //------------------------------------------------------------------------- diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h index b32f99c32..6b934c37d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h @@ -43,7 +43,6 @@ private: std::string func_get_audio_pids_as_dropdown(CyhookHandler *hh, std::string para); std::string func_unmount_get_list(CyhookHandler *hh, std::string para); std::string func_get_partition_list(CyhookHandler *hh, std::string para); - std::string func_get_boxtype(CyhookHandler *hh, std::string para); std::string func_get_current_stream_info(CyhookHandler *hh, std::string para); std::string func_get_timer_list(CyhookHandler *hh, std::string para); std::string func_set_timer_form(CyhookHandler *hh, std::string para); @@ -65,6 +64,9 @@ public: virtual std::string getHookVersion(void) {return std::string("$Revision$");} virtual THandleStatus Hook_SendResponse(CyhookHandler *hh); virtual THandleStatus Hook_ReadConfig(CConfigFile *Config, CStringList &ConfigList); + + // func TUXBOX + std::string func_get_boxtype(CyhookHandler *hh, std::string para); }; #endif /*__nhttpd_neutrinoyparser_h__*/ diff --git a/src/nhttpd/tuxboxapi/dbox/Makefile.am b/src/nhttpd/tuxboxapi/dbox/Makefile.am index 5e7aed6f5..6c341a62a 100644 --- a/src/nhttpd/tuxboxapi/dbox/Makefile.am +++ b/src/nhttpd/tuxboxapi/dbox/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions -INCLUDES = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/src \ diff --git a/src/nhttpd/web/Y_Blocks.txt b/src/nhttpd/web/Y_Blocks.txt index 8dab68a26..e604de86b 100644 --- a/src/nhttpd/web/Y_Blocks.txt +++ b/src/nhttpd/web/Y_Blocks.txt @@ -430,7 +430,7 @@ start-block~frame_boxcontrol {=var-set:work= {=if-equal:{=var-get:startpage=}~bouquets~Y_Boxcontrol_Bouquets.yhtm ~ - {=if-equal:{=var-get:startpage=}~control~Y_Tools_Boxcontrol.yhtm~Y_blank.yhtm=} + {=if-equal:{=var-get:startpage=}~control~Y_Tools_Boxcontrol.yhtm~Y_blank.htm=} =}=} {=include-block:Y_Blocks.txt;frame_secondary=} end-block~frame_boxcontrol @@ -508,11 +508,12 @@ start-block~remote {=if-equal:{=var-get:boxtype=}~CST Zee CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ {=if-equal:{=var-get:boxtype=}~CST Neo Twin SAT~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ {=if-equal:{=var-get:boxtype=}~CST Neo Twin CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ - {=if-equal:{=var-get:boxtype=}~CST Tank SAT~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ - {=if-equal:{=var-get:boxtype=}~CST Tank CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ + {=if-equal:{=var-get:boxtype=}~CST Tank~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ + {=if-equal:{=var-get:boxtype=}~CST Trinity SAT~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ + {=if-equal:{=var-get:boxtype=}~CST Trinity CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} - =}=}=}=}=}=}=}=} + =}=}=}=}=}=}=}=}=} =}=} ~ {=if-equal:{=var-get:yfbtype=}~-2~ {=include-block:Y_Blocks.txt;rc_dbox_philips=}~ @@ -522,9 +523,10 @@ start-block~remote {=if-equal:{=var-get:yfbtype=}~3~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ {=if-equal:{=var-get:yfbtype=}~4~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ {=if-equal:{=var-get:yfbtype=}~5~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ + {=if-equal:{=var-get:yfbtype=}~6~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} - =}=}=}=}=}=}=} + =}=}=}=}=}=}=}=} =} end-block~remote @@ -789,6 +791,72 @@ start-block~rc_cst_v5 end-block~rc_cst_v5 +# ------- Remote CST V6 (TRINITY) +start-block~rc_cst_v6 +remote + + standby + mute + sat + + tv-radio + + skip+ + skip- + picsize + picmode + + fav + t/s + audio + text + + + help + + + epg + info + menu + exit + ok + vol+ + page+ + vol- + page- + up + down + left + right + rec + + w + pause + ff + rew + stop + play + + red + green + yellow + blue + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + sleep + +end-block~rc_cst_v6 + # ------- Remote d-Box Nokia old start-block~rc_dbox_nokia_old remote diff --git a/src/nhttpd/web/Y_Settings_yWeb.yhtm b/src/nhttpd/web/Y_Settings_yWeb.yhtm index 17a0991e8..bf3a914ab 100644 --- a/src/nhttpd/web/Y_Settings_yWeb.yhtm +++ b/src/nhttpd/web/Y_Settings_yWeb.yhtm @@ -20,6 +20,7 @@ function do_init(){ case "3": // cst zee/neo2 case "4": // cst neo twin case "5": // cst tank + case "6": // cst trinity sel=(sel*1+val*1); break; default: @@ -97,6 +98,7 @@ function do_init(){ + diff --git a/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm b/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm index d4b1b6fec..1e98c9d64 100644 --- a/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm +++ b/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm @@ -45,8 +45,10 @@ function goUrl(_url){ +{=comment:disable non-working rec on/off buttons~ +=} diff --git a/src/nhttpd/web/images/Makefile.am b/src/nhttpd/web/images/Makefile.am index 0b4d21667..a2c2c2015 100644 --- a/src/nhttpd/web/images/Makefile.am +++ b/src/nhttpd/web/images/Makefile.am @@ -69,6 +69,7 @@ install_DATA = accept.png \ rc_cst_v3.jpg \ rc_cst_v4.jpg \ rc_cst_v5.jpg \ + rc_cst_v6.jpg \ rc_dbox_nokia_old.jpg \ rc_dbox_philips.jpg \ record.gif \ diff --git a/src/nhttpd/web/images/rc_cst_v6.jpg b/src/nhttpd/web/images/rc_cst_v6.jpg new file mode 100644 index 000000000..5a2b296ec Binary files /dev/null and b/src/nhttpd/web/images/rc_cst_v6.jpg differ diff --git a/src/nhttpd/yhttpd_core/Makefile.am b/src/nhttpd/yhttpd_core/Makefile.am index de0679d2b..1a0a81aaa 100644 --- a/src/nhttpd/yhttpd_core/Makefile.am +++ b/src/nhttpd/yhttpd_core/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(srcdir) \ -I$(top_builddir) \ -I$(top_srcdir) \ @@ -11,7 +11,7 @@ INCLUDES = \ -I$(top_srcdir)/lib/libconfigfile \ @FREETYPE_CFLAGS@ -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions noinst_LIBRARIES = libyhttpd.a diff --git a/src/nhttpd/yhttpd_mods/Makefile.am b/src/nhttpd/yhttpd_mods/Makefile.am index 6f7f05823..fc85656f3 100644 --- a/src/nhttpd/yhttpd_mods/Makefile.am +++ b/src/nhttpd/yhttpd_mods/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ @@ -10,7 +10,7 @@ INCLUDES = \ -I$(top_srcdir)/lib/libconfigfile \ @FREETYPE_CFLAGS@ -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS += -fno-rtti -fno-exceptions noinst_LIBRARIES = libyhttpdmods.a diff --git a/src/rcsim.c b/src/rcsim.c index 94e184f94..c274f6c4b 100644 --- a/src/rcsim.c +++ b/src/rcsim.c @@ -68,17 +68,12 @@ enum initiators }; #endif -enum { // not defined in input.h but used like that, at least in 2.4.22 - KEY_RELEASED = 0, - KEY_PRESSED, - KEY_AUTOREPEAT -}; - #include "rcsim.h" void usage(char *n){ unsigned int keynum = sizeof(keyname)/sizeof(struct key); unsigned int i; +#ifdef HAVE_DBOX_HARDWARE printf ("rcsim v1.1\nUsage: %s [