From bc188c66bacdf27cff569cd7c3489ef650e6607d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 5 Mar 2017 13:48:40 +0100 Subject: [PATCH 01/12] src/zapit/src/zapit.cpp fix segfault without services.xml --- src/zapit/src/zapit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index e8682ba1b..da0b6eaa8 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -515,7 +515,7 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay if (IS_WEBTV(newchannel->getChannelID()) && !newchannel->getUrl().empty()) { dvbsub_stop(); - if (current_channel->getChannelID() == newchannel->getChannelID() && !newchannel->getScriptName().empty()){ + if (current_channel && current_channel->getChannelID() == newchannel->getChannelID() && !newchannel->getScriptName().empty()){ INFO("[zapit] stop rezap to channel %s id %" PRIx64 ")", newchannel->getName().c_str(), newchannel->getChannelID()); return true; } From d5cf6527638b9c389e824418fb89f39dab8e0bd6 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 5 Mar 2017 14:41:15 +0100 Subject: [PATCH 02/12] src/gui/widget/msgbox.cpp init result --- src/gui/widget/msgbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index bc364fd9f..28657be05 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -103,7 +103,8 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t //set result if (Default_result != mbrNone) result = default_result = Default_result; - + else + result = mbrNone; //add and initialize footer buttons with required buttons and basic properties if (ShowButtons > -1) mb_show_button = ShowButtons; From b3f69009af719c6a72c9db28d359095645eaefd8 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 5 Mar 2017 17:06:22 +0100 Subject: [PATCH 03/12] try fix YT cache wirite to root --- src/gui/movieinfo.cpp | 1 + src/system/ytcache.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index f06e68c9b..269d613f9 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -546,6 +546,7 @@ void MI_MOVIE_INFO::clear(void) marked = false; delAsk = true; + source = UNKNOWN; } bool CMovieInfo::loadFile(CFile &file, std::string &buffer) diff --git a/src/system/ytcache.cpp b/src/system/ytcache.cpp index 0f04358f4..66b52832d 100644 --- a/src/system/ytcache.cpp +++ b/src/system/ytcache.cpp @@ -70,7 +70,7 @@ std::string cYTCache::getName(MI_MOVIE_INFO *mi, std::string ext) case MI_MOVIE_INFO::NK: return g_settings.downloadcache_dir + "/nk-" + mi->ytid + "." + ext; default: - return ""; + return g_settings.downloadcache_dir + "/error-" + mi->ytid + "." + ext;; } } From f9b7fca210978a90cadd9cbdfd5cd8b85e2b38cf Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 4 Mar 2017 19:49:48 +0100 Subject: [PATCH 04/12] unbreak msgbox the "if (msg)" was basically always true, killing all keys that were not handled in this clause (e.g. it was not possible to switch the box from standby if a plugin with output was running during standby) --- src/gui/widget/msgbox.cpp | 82 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 28657be05..12caa52ef 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -276,53 +276,51 @@ int CMsgBox::exec() { scroll_down(); } - else if (msg){ - //***navi buttons for button selection*** - if(msg==CRCInput::RC_right || msg==CRCInput::RC_left) - { - if(msg==CRCInput::RC_right){ - ccw_footer->setSelectedButton(selected+1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } - if(msg==CRCInput::RC_left){ - ccw_footer->setSelectedButton(selected-1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } - selected = ccw_footer->getSelectedButton(); + //***navi buttons for button selection*** + else if(msg == CRCInput::RC_right || msg == CRCInput::RC_left) + { + if (msg == CRCInput::RC_right) { + ccw_footer->setSelectedButton(selected+1); + mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); + } + if (msg == CRCInput::RC_left) { + ccw_footer->setSelectedButton(selected-1); + mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); + } + selected = ccw_footer->getSelectedButton(); - //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** - if (ccw_footer->getButtonChainObject()->size()>1) - refreshFoot(); + //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** + if (ccw_footer->getButtonChainObject()->size()>1) + refreshFoot(); - //***refresh timeout on any pressed navi key! This resets current timeout end to initial value*** - if (timeout > 0){ - timeout_pb->setValues(0, timeout); - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - } + //***refresh timeout on any pressed navi key! This resets current timeout end to initial value*** + if (timeout > 0) { + timeout_pb->setValues(0, timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + } + dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); + } + + //***action buttons without preselection*** + for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ + CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); + if (msg == btn_action->getButtonDirectKey() || msg == btn_action->getButtonDirectKeyA()){ + result = (msg_result_t)btn_action->getButtonResult(); dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); - } - - //***action buttons without preselection*** - for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ - CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); - if (msg == btn_action->getButtonDirectKey() || msg == btn_action->getButtonDirectKeyA()){ - result = (msg_result_t)btn_action->getButtonResult(); - dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); - loop = false; - } - } - //***action button ok with preselected button*** - if ((msg == CRCInput::RC_ok) && (ccw_footer->getSelectedButtonObject()->getButtonAlias() == mb_show_button)){ - result = (msg_result_t)ccw_footer->getSelectedButtonObject()->getButtonResult(); loop = false; } - else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::RECORD_STOP) { - CNeutrinoApp::getInstance()->handleMsg(msg, data); - } - //***ignore*** - else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ - // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! - } + } + //***action button ok with preselected button*** + if ((msg == CRCInput::RC_ok) && (ccw_footer->getSelectedButtonObject()->getButtonAlias() == mb_show_button)){ + result = (msg_result_t)ccw_footer->getSelectedButtonObject()->getButtonResult(); + loop = false; + } + else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::RECORD_STOP) { + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } + //***ignore*** + else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ + // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! } else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) { From c3ab1b91d8f8f37db510106cb321d5c9a1c8cde0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 4 Mar 2017 19:55:59 +0100 Subject: [PATCH 05/12] msgbox: remove duplicated code --- src/gui/widget/msgbox.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 12caa52ef..4bed64224 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -279,14 +279,11 @@ int CMsgBox::exec() //***navi buttons for button selection*** else if(msg == CRCInput::RC_right || msg == CRCInput::RC_left) { - if (msg == CRCInput::RC_right) { + if (msg == CRCInput::RC_right) ccw_footer->setSelectedButton(selected+1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } - if (msg == CRCInput::RC_left) { + else ccw_footer->setSelectedButton(selected-1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } + mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); selected = ccw_footer->getSelectedButton(); //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** From f80f69c232e4b5d0bfbed5b6f4c889b730154a22 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 4 Mar 2017 19:56:41 +0100 Subject: [PATCH 06/12] msgbox: remove explicit handling of record events these are handled in the last else clause anyway --- src/gui/widget/msgbox.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 4bed64224..48921105b 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -312,9 +312,6 @@ int CMsgBox::exec() result = (msg_result_t)ccw_footer->getSelectedButtonObject()->getButtonResult(); loop = false; } - else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::RECORD_STOP) { - CNeutrinoApp::getInstance()->handleMsg(msg, data); - } //***ignore*** else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! From 92abe90d58ba4f132f75b1f2409ec68553f2d01b Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 6 Mar 2017 14:41:25 +0100 Subject: [PATCH 07/12] src/gui/movieplayer.cpp some streams need more time pro frame --- src/gui/movieplayer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index fead5c9be..eabe0e255 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1323,12 +1323,12 @@ void CMoviePlayerGui::PlayFileLoop(void) printf("CMoviePlayerGui::%s: spd %d pos %d/%d (%d, %d%%)\n", __func__, speed, position, duration, duration-position, file_prozent); #endif /* in case ffmpeg report incorrect values */ - if((playstate == CMoviePlayerGui::PLAY) && (speed == 1)){ + if(file_prozent > 96 && (playstate == CMoviePlayerGui::PLAY) && (speed == 1)){ if(position_tmp != position){ position_tmp = position ; eof2 = 0; }else{ - if (++eof2 > 6) { + if (++eof2 > 12) { at_eof = true; break; } From 4c388bb71c69dda7f669107c67a4c99b47ded204 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Mar 2017 20:48:39 +0100 Subject: [PATCH 08/12] CTextBox: fix pass of SCROLL_FRAME_WIDTH --- src/gui/widget/textbox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index f8ed60af4..82195ae5a 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -299,9 +299,9 @@ void CTextBox::initFramesRel(void) if(m_nMode & SCROLL) { - m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLL_FRAME_WIDTH; - m_cFrameScrollRel.iY = m_cFrameTextRel.iY + m_nBgRadius; m_cFrameScrollRel.iWidth = SCROLL_FRAME_WIDTH; + m_cFrameScrollRel.iX = m_cFrame.iWidth - m_cFrameScrollRel.iWidth; + m_cFrameScrollRel.iY = m_cFrameTextRel.iY + m_nBgRadius; m_cFrameScrollRel.iHeight = m_cFrameTextRel.iHeight - 2*m_nBgRadius; } else @@ -708,7 +708,7 @@ void CTextBox::refreshText(void) if (m_nMode & CENTER) x_center /= 2; if (m_nMode & SCROLL) - x_center -= SCROLL_FRAME_WIDTH; + x_center -= m_cFrameScrollRel.iWidth; } x_center = std::max(x_center, 0); From 29fd05002fc1a9a57081b18c16498fd49118b716 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Mar 2017 21:49:32 +0100 Subject: [PATCH 09/12] - port hardware_caps from Neutrino-MP --- configure.ac | 2 + lib/Makefile.am | 5 ++ lib/hardware/coolstream/Makefile.am | 12 ++++ lib/hardware/coolstream/hardware_caps.cpp | 72 +++++++++++++++++++++++ lib/hardware/coolstream/hardware_caps.h | 43 ++++++++++++++ src/Makefile.am | 2 + src/neutrino.cpp | 2 + src/system/settings.h | 3 + 8 files changed, 141 insertions(+) create mode 100644 lib/hardware/coolstream/Makefile.am create mode 100644 lib/hardware/coolstream/hardware_caps.cpp create mode 100644 lib/hardware/coolstream/hardware_caps.h diff --git a/configure.ac b/configure.ac index 6da3d63c6..900f8f21a 100644 --- a/configure.ac +++ b/configure.ac @@ -250,6 +250,7 @@ if test -e ${srcdir}/lib/libcoolstream2/cs_frontpanel.h; then fi HWLIB_CFLAGS='-I$(top_srcdir)/lib/libcoolstream2 -I$(top_srcdir)/src/zapit/include/private' fi +HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/lib/hardware/coolstream' fi # hack, so that framebuffer.h does not need to be included everywhere... @@ -313,6 +314,7 @@ data/y-web/scripts/Makefile data/y-web/styles/Makefile lib/Makefile lib/connection/Makefile +lib/hardware/coolstream/Makefile lib/jsoncpp/Makefile lib/libconfigfile/Makefile lib/libdvbsub/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index bc4b8f2e5..63e00773d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -17,3 +17,8 @@ if ENABLE_UPNP SUBDIRS += \ libupnpclient endif + +if BOXTYPE_COOL +SUBDIRS += \ + hardware/coolstream +endif diff --git a/lib/hardware/coolstream/Makefile.am b/lib/hardware/coolstream/Makefile.am new file mode 100644 index 000000000..359ce20b2 --- /dev/null +++ b/lib/hardware/coolstream/Makefile.am @@ -0,0 +1,12 @@ +noinst_LIBRARIES = libhwcaps.a + +AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing + +if BOXMODEL_CS_HD2 +AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream2 +else +AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream +endif + +libhwcaps_a_SOURCES = \ + hardware_caps.cpp diff --git a/lib/hardware/coolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp new file mode 100644 index 000000000..216a6dcae --- /dev/null +++ b/lib/hardware/coolstream/hardware_caps.cpp @@ -0,0 +1,72 @@ +/* + * determine the capabilities of the hardware. + * part of libstb-hal + * + * (C) 2010-2012,2016 Stefan Seyfried + * + * License: GPL v2 or later + */ +#include "cs_api.h" +#include +#include +#include "hardware_caps.h" + +static int initialized = 0; +static hw_caps_t caps; + +hw_caps_t *get_hwcaps(void) { + if (initialized) + return ∩︀ + int rev = cs_get_revision(); + caps.has_fan = (rev < 8); + caps.has_HDMI = 1; + caps.has_SCART = (rev != 10); + caps.has_SCART_input = 0; + caps.has_YUV_cinch = 1; + caps.can_shutdown = (rev > 7); + caps.can_cec = 1; + caps.display_type = HW_DISPLAY_LINE_TEXT; + caps.display_xres = 12; + caps.display_yres = 0; + caps.can_set_display_brightness = 1; + caps.can_ar_14_9 = 1; + caps.can_ps_14_9 = 1; + caps.force_tuner_2G = 0; + strcpy(caps.boxvendor, "Coolstream"); + /* list of boxnames from neutrinoyparser.cpp */ + strcpy(caps.boxarch, "Nevis"); + switch (rev) { + case 6: + case 7: // Black Stallion Edition + strcpy(caps.boxname, "HD1"); + caps.force_tuner_2G = 1; + break; + case 8: + strcpy(caps.boxname, "Neo"); + caps.force_tuner_2G = 1; + break; + case 9: + strcpy(caps.boxname, "Tank"); + strcpy(caps.boxarch, "Apollo"); + break; + case 10: + strcpy(caps.boxname, "Zee"); + caps.force_tuner_2G = 1; + break; + case 11: + strcpy(caps.boxname, "Trinity"); + strcpy(caps.boxarch, "Shiner"); + break; + case 12: + strcpy(caps.boxname, "Zee2"); + strcpy(caps.boxarch, "Kronos"); + break; + default: + strcpy(caps.boxname, "UNKNOWN_BOX"); + strcpy(caps.boxarch, "Unknown"); + fprintf(stderr, "[%s] unhandled box revision %d\n", __func__, rev); + } + initialized = 1; + return ∩︀ +} + diff --git a/lib/hardware/coolstream/hardware_caps.h b/lib/hardware/coolstream/hardware_caps.h new file mode 100644 index 000000000..aaea1334e --- /dev/null +++ b/lib/hardware/coolstream/hardware_caps.h @@ -0,0 +1,43 @@ +/* + * determine the capabilities of the hardware. + * part of libstb-hal + * + * (C) 2010-2012,2016 Stefan Seyfried + * + * License: GPL v2 or later + */ +#ifndef __HARDWARE_CAPS_H__ +#define __HARDWARE_CAPS_H__ + +typedef enum +{ + HW_DISPLAY_NONE, + HW_DISPLAY_LED_NUM, /* simple 7 segment LED display */ + HW_DISPLAY_LINE_TEXT, /* 1 line text display */ + HW_DISPLAY_GFX +} display_type_t; + + +typedef struct hw_caps +{ + int has_fan; + int has_HDMI; + int has_SCART; + int has_SCART_input; + int has_YUV_cinch; + int can_shutdown; + int can_cec; + int can_ar_14_9; /* video drivers have 14:9 aspect ratio mode */ + int can_ps_14_9; /* video drivers have 14:9 panscan mode */ + int force_tuner_2G; /* force DVB-S2 even though driver may not advertise it */ + display_type_t display_type; + int display_xres; /* x resolution or chars per line */ + int display_yres; + int can_set_display_brightness; + char boxvendor[64]; + char boxname[64]; + char boxarch[64]; +} hw_caps_t; + +hw_caps_t *get_hwcaps(void); +#endif diff --git a/src/Makefile.am b/src/Makefile.am index 1d452bd8f..73843b7d0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -142,6 +142,8 @@ neutrino_LDADD += \ endif if BOXTYPE_COOL +neutrino_LDADD += \ + $(top_builddir)/lib/hardware/coolstream/libhwcaps.a neutrino_LDADD += -lcoolstream-mt -lca-sc if ENABLE_TMSDK else diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0a15d9969..0b9848d3a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2036,6 +2036,8 @@ TIMER_START(); cs_api_init(); cs_register_messenger(CSSendMessage); + g_info.hw_caps = get_hwcaps(); + g_Locale = new CLocaleManager; int loadSettingsErg = loadSetup(NEUTRINO_SETTINGS_FILE); diff --git a/src/system/settings.h b/src/system/settings.h index 64b6423c4..c6e352b85 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -39,6 +39,8 @@ #include #include // UTF8 +#include + #include #include @@ -924,6 +926,7 @@ struct SglobalInfo unsigned char box_Type; delivery_system_t delivery_system; bool has_fan; + hw_caps_t *hw_caps; }; const int RECORDING_OFF = 0; From 2029a684e51f33fbd7076c7127d55288a1155e2e Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Mar 2017 21:49:32 +0100 Subject: [PATCH 10/12] - move public libcoolstream-headers to hardware directory --- configure.ac | 10 +++++----- lib/hardware/coolstream/Makefile.am | 4 ++-- .../coolstream/hd1}/libcoolstream/audio_cs.h | 0 .../coolstream/hd1}/libcoolstream/ca_cs.h | 0 .../coolstream/hd1}/libcoolstream/cnxtfb.h | 0 .../coolstream/hd1}/libcoolstream/control.h | 0 .../coolstream/hd1}/libcoolstream/cs_api.h | 0 .../coolstream/hd1}/libcoolstream/cs_frontpanel.h | 0 .../coolstream/hd1}/libcoolstream/cs_types.h | 0 .../coolstream/hd1}/libcoolstream/cs_vfd.h | 0 .../coolstream/hd1}/libcoolstream/dmx_cs.h | 0 lib/{ => hardware/coolstream/hd1}/libcoolstream/mmi.h | 0 .../coolstream/hd1}/libcoolstream/nevis_ir.h | 0 .../coolstream/hd1}/libcoolstream/playback.h | 0 .../coolstream/hd1}/libcoolstream/playback_cs.h | 0 .../coolstream/hd1}/libcoolstream/pwrmngr.h | 0 .../coolstream/hd1}/libcoolstream/record_cs.h | 0 .../coolstream/hd1}/libcoolstream/tsrouter.h | 0 .../coolstream/hd1}/libcoolstream/video_cs.h | 0 .../coolstream/hd2/libcoolstream}/audio_cs.h | 0 .../coolstream/hd2/libcoolstream}/ca_cs.h | 0 .../coolstream/hd2/libcoolstream}/cnxtfb.h | 0 .../coolstream/hd2/libcoolstream}/control.h | 0 .../coolstream/hd2/libcoolstream}/cs_api.h | 0 .../coolstream/hd2/libcoolstream}/cs_frontpanel.h | 0 .../coolstream/hd2/libcoolstream}/cs_ir_generic.h | 0 .../coolstream/hd2/libcoolstream}/cs_types.h | 0 .../coolstream/hd2/libcoolstream}/cs_vfd.h | 0 .../coolstream/hd2/libcoolstream}/dmx_cs.h | 0 .../coolstream/hd2/libcoolstream}/mmi.h | 0 .../coolstream/hd2/libcoolstream}/nevis_ir.h | 0 .../coolstream/hd2/libcoolstream}/playback.h | 0 .../coolstream/hd2/libcoolstream}/playback_cs.h | 0 .../coolstream/hd2/libcoolstream}/pwrmngr.h | 0 .../coolstream/hd2/libcoolstream}/record_cs.h | 0 .../coolstream/hd2/libcoolstream}/tsrouter.h | 0 .../coolstream/hd2/libcoolstream}/video_cs.h | 0 lib/libcoolstream/.svnignore | 5 ----- 38 files changed, 7 insertions(+), 12 deletions(-) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/audio_cs.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/ca_cs.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/cnxtfb.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/control.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/cs_api.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/cs_frontpanel.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/cs_types.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/cs_vfd.h (100%) mode change 100755 => 100644 rename lib/{ => hardware/coolstream/hd1}/libcoolstream/dmx_cs.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/mmi.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/nevis_ir.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/playback.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/playback_cs.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/pwrmngr.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/record_cs.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/tsrouter.h (100%) rename lib/{ => hardware/coolstream/hd1}/libcoolstream/video_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/audio_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/ca_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cnxtfb.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/control.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cs_api.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cs_frontpanel.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cs_ir_generic.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cs_types.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/cs_vfd.h (100%) mode change 100755 => 100644 rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/dmx_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/mmi.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/nevis_ir.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/playback.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/playback_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/pwrmngr.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/record_cs.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/tsrouter.h (100%) rename lib/{libcoolstream2 => hardware/coolstream/hd2/libcoolstream}/video_cs.h (100%) delete mode 100644 lib/libcoolstream/.svnignore diff --git a/configure.ac b/configure.ac index 900f8f21a..8b7fe6969 100644 --- a/configure.ac +++ b/configure.ac @@ -236,19 +236,19 @@ fi if test "$BOXTYPE" = "coolstream"; then -if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then +if test -e ${srcdir}/lib/hardware/coolstream/hd1/libcoolstream/nevis_ir.h; then AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the header file.]) fi -HWLIB_CFLAGS='-I$(top_srcdir)/lib/libcoolstream -I$(top_srcdir)/src/zapit/include/private' +HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd1/libcoolstream -I$(top_srcdir)/src/zapit/include/private' if test "$BOXMODEL" = "hd2"; then -if test -e ${srcdir}/lib/libcoolstream2/cs_ir_generic.h; then +if test -e ${srcdir}/lib/hardware/coolstream/hd2/libcoolstream/cs_ir_generic.h; then AC_DEFINE(HAVE_COOLSTREAM_CS_IR_GENERIC_H,1,[Define to 1 if you have the header file.]) fi -if test -e ${srcdir}/lib/libcoolstream2/cs_frontpanel.h; then +if test -e ${srcdir}/lib/hardware/coolstream/hd2/libcoolstream/cs_frontpanel.h; then AC_DEFINE(HAVE_COOLSTREAM_CS_FRONTPANEL_H,1,[Define to 1 if you have the header file.]) fi -HWLIB_CFLAGS='-I$(top_srcdir)/lib/libcoolstream2 -I$(top_srcdir)/src/zapit/include/private' +HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd2/libcoolstream -I$(top_srcdir)/src/zapit/include/private' fi HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/lib/hardware/coolstream' fi diff --git a/lib/hardware/coolstream/Makefile.am b/lib/hardware/coolstream/Makefile.am index 359ce20b2..d460837c3 100644 --- a/lib/hardware/coolstream/Makefile.am +++ b/lib/hardware/coolstream/Makefile.am @@ -3,9 +3,9 @@ noinst_LIBRARIES = libhwcaps.a AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing if BOXMODEL_CS_HD2 -AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream2 +AM_CPPFLAGS = -I$(top_srcdir)/lib/hardware/coolstream/hd2/libcoolstream else -AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream +AM_CPPFLAGS = -I$(top_srcdir)/lib/hardware/coolstream/hd1/libcoolstream endif libhwcaps_a_SOURCES = \ diff --git a/lib/libcoolstream/audio_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/audio_cs.h similarity index 100% rename from lib/libcoolstream/audio_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/audio_cs.h diff --git a/lib/libcoolstream/ca_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/ca_cs.h similarity index 100% rename from lib/libcoolstream/ca_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/ca_cs.h diff --git a/lib/libcoolstream/cnxtfb.h b/lib/hardware/coolstream/hd1/libcoolstream/cnxtfb.h similarity index 100% rename from lib/libcoolstream/cnxtfb.h rename to lib/hardware/coolstream/hd1/libcoolstream/cnxtfb.h diff --git a/lib/libcoolstream/control.h b/lib/hardware/coolstream/hd1/libcoolstream/control.h similarity index 100% rename from lib/libcoolstream/control.h rename to lib/hardware/coolstream/hd1/libcoolstream/control.h diff --git a/lib/libcoolstream/cs_api.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h similarity index 100% rename from lib/libcoolstream/cs_api.h rename to lib/hardware/coolstream/hd1/libcoolstream/cs_api.h diff --git a/lib/libcoolstream/cs_frontpanel.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_frontpanel.h similarity index 100% rename from lib/libcoolstream/cs_frontpanel.h rename to lib/hardware/coolstream/hd1/libcoolstream/cs_frontpanel.h diff --git a/lib/libcoolstream/cs_types.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_types.h similarity index 100% rename from lib/libcoolstream/cs_types.h rename to lib/hardware/coolstream/hd1/libcoolstream/cs_types.h diff --git a/lib/libcoolstream/cs_vfd.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_vfd.h old mode 100755 new mode 100644 similarity index 100% rename from lib/libcoolstream/cs_vfd.h rename to lib/hardware/coolstream/hd1/libcoolstream/cs_vfd.h diff --git a/lib/libcoolstream/dmx_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/dmx_cs.h similarity index 100% rename from lib/libcoolstream/dmx_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/dmx_cs.h diff --git a/lib/libcoolstream/mmi.h b/lib/hardware/coolstream/hd1/libcoolstream/mmi.h similarity index 100% rename from lib/libcoolstream/mmi.h rename to lib/hardware/coolstream/hd1/libcoolstream/mmi.h diff --git a/lib/libcoolstream/nevis_ir.h b/lib/hardware/coolstream/hd1/libcoolstream/nevis_ir.h similarity index 100% rename from lib/libcoolstream/nevis_ir.h rename to lib/hardware/coolstream/hd1/libcoolstream/nevis_ir.h diff --git a/lib/libcoolstream/playback.h b/lib/hardware/coolstream/hd1/libcoolstream/playback.h similarity index 100% rename from lib/libcoolstream/playback.h rename to lib/hardware/coolstream/hd1/libcoolstream/playback.h diff --git a/lib/libcoolstream/playback_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/playback_cs.h similarity index 100% rename from lib/libcoolstream/playback_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/playback_cs.h diff --git a/lib/libcoolstream/pwrmngr.h b/lib/hardware/coolstream/hd1/libcoolstream/pwrmngr.h similarity index 100% rename from lib/libcoolstream/pwrmngr.h rename to lib/hardware/coolstream/hd1/libcoolstream/pwrmngr.h diff --git a/lib/libcoolstream/record_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/record_cs.h similarity index 100% rename from lib/libcoolstream/record_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/record_cs.h diff --git a/lib/libcoolstream/tsrouter.h b/lib/hardware/coolstream/hd1/libcoolstream/tsrouter.h similarity index 100% rename from lib/libcoolstream/tsrouter.h rename to lib/hardware/coolstream/hd1/libcoolstream/tsrouter.h diff --git a/lib/libcoolstream/video_cs.h b/lib/hardware/coolstream/hd1/libcoolstream/video_cs.h similarity index 100% rename from lib/libcoolstream/video_cs.h rename to lib/hardware/coolstream/hd1/libcoolstream/video_cs.h diff --git a/lib/libcoolstream2/audio_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/audio_cs.h similarity index 100% rename from lib/libcoolstream2/audio_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/audio_cs.h diff --git a/lib/libcoolstream2/ca_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/ca_cs.h similarity index 100% rename from lib/libcoolstream2/ca_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/ca_cs.h diff --git a/lib/libcoolstream2/cnxtfb.h b/lib/hardware/coolstream/hd2/libcoolstream/cnxtfb.h similarity index 100% rename from lib/libcoolstream2/cnxtfb.h rename to lib/hardware/coolstream/hd2/libcoolstream/cnxtfb.h diff --git a/lib/libcoolstream2/control.h b/lib/hardware/coolstream/hd2/libcoolstream/control.h similarity index 100% rename from lib/libcoolstream2/control.h rename to lib/hardware/coolstream/hd2/libcoolstream/control.h diff --git a/lib/libcoolstream2/cs_api.h b/lib/hardware/coolstream/hd2/libcoolstream/cs_api.h similarity index 100% rename from lib/libcoolstream2/cs_api.h rename to lib/hardware/coolstream/hd2/libcoolstream/cs_api.h diff --git a/lib/libcoolstream2/cs_frontpanel.h b/lib/hardware/coolstream/hd2/libcoolstream/cs_frontpanel.h similarity index 100% rename from lib/libcoolstream2/cs_frontpanel.h rename to lib/hardware/coolstream/hd2/libcoolstream/cs_frontpanel.h diff --git a/lib/libcoolstream2/cs_ir_generic.h b/lib/hardware/coolstream/hd2/libcoolstream/cs_ir_generic.h similarity index 100% rename from lib/libcoolstream2/cs_ir_generic.h rename to lib/hardware/coolstream/hd2/libcoolstream/cs_ir_generic.h diff --git a/lib/libcoolstream2/cs_types.h b/lib/hardware/coolstream/hd2/libcoolstream/cs_types.h similarity index 100% rename from lib/libcoolstream2/cs_types.h rename to lib/hardware/coolstream/hd2/libcoolstream/cs_types.h diff --git a/lib/libcoolstream2/cs_vfd.h b/lib/hardware/coolstream/hd2/libcoolstream/cs_vfd.h old mode 100755 new mode 100644 similarity index 100% rename from lib/libcoolstream2/cs_vfd.h rename to lib/hardware/coolstream/hd2/libcoolstream/cs_vfd.h diff --git a/lib/libcoolstream2/dmx_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/dmx_cs.h similarity index 100% rename from lib/libcoolstream2/dmx_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/dmx_cs.h diff --git a/lib/libcoolstream2/mmi.h b/lib/hardware/coolstream/hd2/libcoolstream/mmi.h similarity index 100% rename from lib/libcoolstream2/mmi.h rename to lib/hardware/coolstream/hd2/libcoolstream/mmi.h diff --git a/lib/libcoolstream2/nevis_ir.h b/lib/hardware/coolstream/hd2/libcoolstream/nevis_ir.h similarity index 100% rename from lib/libcoolstream2/nevis_ir.h rename to lib/hardware/coolstream/hd2/libcoolstream/nevis_ir.h diff --git a/lib/libcoolstream2/playback.h b/lib/hardware/coolstream/hd2/libcoolstream/playback.h similarity index 100% rename from lib/libcoolstream2/playback.h rename to lib/hardware/coolstream/hd2/libcoolstream/playback.h diff --git a/lib/libcoolstream2/playback_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/playback_cs.h similarity index 100% rename from lib/libcoolstream2/playback_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/playback_cs.h diff --git a/lib/libcoolstream2/pwrmngr.h b/lib/hardware/coolstream/hd2/libcoolstream/pwrmngr.h similarity index 100% rename from lib/libcoolstream2/pwrmngr.h rename to lib/hardware/coolstream/hd2/libcoolstream/pwrmngr.h diff --git a/lib/libcoolstream2/record_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/record_cs.h similarity index 100% rename from lib/libcoolstream2/record_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/record_cs.h diff --git a/lib/libcoolstream2/tsrouter.h b/lib/hardware/coolstream/hd2/libcoolstream/tsrouter.h similarity index 100% rename from lib/libcoolstream2/tsrouter.h rename to lib/hardware/coolstream/hd2/libcoolstream/tsrouter.h diff --git a/lib/libcoolstream2/video_cs.h b/lib/hardware/coolstream/hd2/libcoolstream/video_cs.h similarity index 100% rename from lib/libcoolstream2/video_cs.h rename to lib/hardware/coolstream/hd2/libcoolstream/video_cs.h diff --git a/lib/libcoolstream/.svnignore b/lib/libcoolstream/.svnignore deleted file mode 100644 index 3694ff0e6..000000000 --- a/lib/libcoolstream/.svnignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile.in -.libs -.deps -*.la -*.lo From d3c3d3760cd1a457ff5cf4193628f3fb617862d2 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Mar 2017 21:49:32 +0100 Subject: [PATCH 11/12] - configure.ac: remove duplicated code --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8b7fe6969..2dc77868d 100644 --- a/configure.ac +++ b/configure.ac @@ -239,7 +239,7 @@ if test "$BOXTYPE" = "coolstream"; then if test -e ${srcdir}/lib/hardware/coolstream/hd1/libcoolstream/nevis_ir.h; then AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the header file.]) fi -HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd1/libcoolstream -I$(top_srcdir)/src/zapit/include/private' +HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd1/libcoolstream' if test "$BOXMODEL" = "hd2"; then if test -e ${srcdir}/lib/hardware/coolstream/hd2/libcoolstream/cs_ir_generic.h; then @@ -248,8 +248,9 @@ fi if test -e ${srcdir}/lib/hardware/coolstream/hd2/libcoolstream/cs_frontpanel.h; then AC_DEFINE(HAVE_COOLSTREAM_CS_FRONTPANEL_H,1,[Define to 1 if you have the header file.]) fi -HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd2/libcoolstream -I$(top_srcdir)/src/zapit/include/private' +HWLIB_CFLAGS='-I$(top_srcdir)/lib/hardware/coolstream/hd2/libcoolstream' fi +HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/src/zapit/include/private' HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/lib/hardware/coolstream' fi From bfa589eb08a087ebfdff55a6b0676473f86db3fe Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 7 Mar 2017 15:00:17 +0100 Subject: [PATCH 12/12] make neutrino compatible with new ffmpeg --- lib/libdvbsub/dvbsubtitle.cpp | 15 +++++++- src/driver/audiodec/ffmpegdec.cpp | 62 +++++++++++++++++++++++++++---- src/driver/record.cpp | 61 +++++++++++++++++++++++++++--- src/driver/streamts.cpp | 54 ++++++++++++++++++++++++--- src/driver/streamts.h | 4 ++ src/gui/movieplayer.cpp | 12 +++++- 6 files changed, 184 insertions(+), 24 deletions(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 0be467e10..e2c41188b 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -68,8 +68,13 @@ cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps() if(sub.rects) { for (i = 0; i < Count(); i++) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) av_freep(&sub.rects[i]->pict.data[0]); av_freep(&sub.rects[i]->pict.data[1]); +#else + av_freep(&sub.rects[i]->data[0]); + av_freep(&sub.rects[i]->data[1]); +#endif av_freep(&sub.rects[i]); } @@ -122,7 +127,11 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) int xf = int(xc * (double) 720); for (i = 0; i < Count(); i++) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) uint32_t * colors = (uint32_t *) sub.rects[i]->pict.data[1]; +#else + uint32_t * colors = (uint32_t *) sub.rects[i]->data[1]; +#endif int width = sub.rects[i]->w; int height = sub.rects[i]->h; int xoff, yoff; @@ -142,9 +151,11 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh); - +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); - +#else + fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh); +#endif fb_pixel_t * ptr = newdata; for (int y2 = 0; y2 < nh; y2++) { int y = (yoff + y2) * stride; diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index c97497175..695f67d89 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -47,6 +47,11 @@ extern "C" { #define av_frame_unref avcodec_get_frame_defaults #define av_frame_free avcodec_free_frame #endif + +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#define av_packet_unref av_free_packet +#endif + #include #include @@ -218,9 +223,16 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, Status=DATA_ERR; return Status; } - +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *c = avc->streams[best_stream]->codec; - +#else + AVCodecContext *c = avcodec_alloc_context3(codec); + if(avcodec_parameters_to_context(c,avc->streams[best_stream]->codecpar) < 0){ + DeInit(); + Status=DATA_ERR; + return Status; + } +#endif mutex.lock(); int r = avcodec_open2(c, codec, NULL); mutex.unlock(); @@ -326,9 +338,10 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, Status=DATA_ERR; break; } - } else + } else{ av_frame_unref(frame); - + } +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) int len = avcodec_decode_audio4(c, frame, &got_frame, &packet); if (len < 0) { // skip frame @@ -340,6 +353,27 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, mutex.unlock(); continue; } + packet.size -= len; + packet.data += len; +#else + int ret = avcodec_send_packet(c, &packet); + if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF){ + break; + } + if (ret >= 0){ + packet.size = 0; + } + ret = avcodec_receive_frame(c, frame); + if (ret < 0){ + if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF){ + break; + } + else{ + continue; + } + } + got_frame = 1; +#endif if (got_frame && *state!=PAUSE) { int out_samples; outsamples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + frame->nb_samples, @@ -368,8 +402,6 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, if (!start_pts) start_pts = pts; } - packet.size -= len; - packet.data += len; } if (time_played && avc->streams[best_stream]->time_base.den) *time_played = (pts - start_pts) * avc->streams[best_stream]->time_base.num / avc->streams[best_stream]->time_base.den; @@ -428,7 +460,11 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) if (!is_stream) { GetMeta(avc->metadata); for(unsigned int i = 0; i < avc->nb_streams; i++) { +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) +#else + if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) +#endif GetMeta(avc->streams[i]->metadata); } } @@ -445,12 +481,17 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) DeInit(); return false; } - +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (!codec) codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id); samplerate = avc->streams[best_stream]->codec->sample_rate; mChannels = av_get_channel_layout_nb_channels(avc->streams[best_stream]->codec->channel_layout); - +#else + if (!codec) + codec = avcodec_find_decoder(avc->streams[best_stream]->codecpar->codec_id); + samplerate = avc->streams[best_stream]->codecpar->sample_rate; + mChannels = av_get_channel_layout_nb_channels(avc->streams[best_stream]->codecpar->channel_layout); +#endif std::stringstream ss; if (codec && codec->long_name != NULL) @@ -470,8 +511,13 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover) printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time); for(unsigned int i = 0; i < avc->nb_streams; i++) { +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) if (avc->streams[i]->codec->bit_rate > 0) bitrate += avc->streams[i]->codec->bit_rate; +#else + if (avc->streams[i]->codecpar->bit_rate > 0) + bitrate += avc->streams[i]->codecpar->bit_rate; +#endif if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) { mkdir(COVERDIR, 0755); std::string cover(COVERDIR); diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 517ecff64..0c234cbe6 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -68,12 +68,20 @@ extern "C" { #include } +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#define av_packet_unref av_free_packet +#endif + class CStreamRec : public CRecordInstance, OpenThreads::Thread { private: AVFormatContext *ifcx; AVFormatContext *ofcx; +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) AVBitStreamFilterContext *bsfc; +#else + AVBSFContext *bsfc; +#endif bool stopped; bool interrupt; time_t time_started; @@ -1912,8 +1920,13 @@ void CStreamRec::Close() } avformat_free_context(ofcx); } - if (bsfc) + if (bsfc){ +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) av_bitstream_filter_close(bsfc); +#else + av_bsf_free(&bsfc); +#endif + } ifcx = NULL; ofcx = NULL; bsfc = NULL; @@ -1930,7 +1943,11 @@ void CStreamRec::FillMovieInfo(CZapitChannel * /*channel*/, APIDList & /*apid_li for (unsigned i = 0; i < ofcx->nb_streams; i++) { AVStream *st = ofcx->streams[i]; +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * codec = st->codec; +#else + AVCodecParameters * codec = st->codecpar; +#endif if (codec->codec_type == AVMEDIA_TYPE_AUDIO) { AUDIO_PIDS audio_pids; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); @@ -2159,12 +2176,17 @@ bool CStreamRec::Open(CZapitChannel * channel) stream_index = -1; int stid = 0x200; for (unsigned i = 0; i < ifcx->nb_streams; i++) { +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * iccx = ifcx->streams[i]->codec; - AVStream *ost = avformat_new_stream(ofcx, iccx->codec); avcodec_copy_context(ost->codec, iccx); +#else + AVCodecParameters * iccx = ifcx->streams[i]->codecpar; + AVStream *ost = avformat_new_stream(ofcx, NULL); + avcodec_parameters_copy(ost->codecpar, iccx); +#endif av_dict_copy(&ost->metadata, ifcx->streams[i]->metadata, 0); - ost->time_base = iccx->time_base; + ost->time_base = ifcx->streams[i]->time_base; ost->id = stid++; if (iccx->codec_type == AVMEDIA_TYPE_VIDEO) { stream_index = i; @@ -2174,10 +2196,19 @@ bool CStreamRec::Open(CZapitChannel * channel) av_log_set_level(AV_LOG_VERBOSE); av_dump_format(ofcx, 0, ofcx->filename, 1); av_log_set_level(AV_LOG_WARNING); +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) bsfc = av_bitstream_filter_init("h264_mp4toannexb"); if (!bsfc) printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__); - +#else + const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb"); + if(!bsf) { + return false; + } + if ((av_bsf_alloc(bsf, &bsfc))) { + return false; + } +#endif return true; } @@ -2201,16 +2232,34 @@ void CStreamRec::run() break; if (pkt.stream_index < 0) continue; - +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; +#else + AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar; +#endif if (bsfc && codec->codec_id == AV_CODEC_ID_H264) { AVPacket newpkt = pkt; - +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { av_packet_unref(&pkt); newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); pkt = newpkt; } +#else + int ret = av_bsf_send_packet(bsfc, &pkt); + if (ret < 0){ + break; + } + ret = av_bsf_receive_packet(bsfc, &newpkt); + if (ret == AVERROR(EAGAIN)){ + break; + } + if(ret != AVERROR_EOF){ + av_packet_unref(&pkt); + newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); + pkt = newpkt; + } +#endif } pkt.pts = av_rescale_q(pkt.pts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index f0144806c..d2f4a2d3c 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -59,6 +59,10 @@ #include #include +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#define av_packet_unref av_free_packet +#endif + /* experimental mode: * stream not possible, if record running * pids in url ignored, and added from channel, with fake PAT/PMT @@ -753,8 +757,13 @@ void CStreamStream::Close() if (avio_ctx) av_free(avio_ctx); - if (bsfc) + if (bsfc){ +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) av_bitstream_filter_close(bsfc); +#else + av_bsf_free(&bsfc); +#endif + } ifcx = NULL; ofcx = NULL; @@ -837,21 +846,35 @@ bool CStreamStream::Open() av_dict_copy(&ofcx->metadata, ifcx->metadata, 0); int stid = 0x200; for (unsigned i = 0; i < ifcx->nb_streams; i++) { +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext * iccx = ifcx->streams[i]->codec; - AVStream *ost = avformat_new_stream(ofcx, iccx->codec); avcodec_copy_context(ost->codec, iccx); +#else + AVCodecParameters * iccx = ifcx->streams[i]->codecpar; + AVStream *ost = avformat_new_stream(ofcx, NULL); + avcodec_parameters_copy(ost->codecpar, iccx); +#endif av_dict_copy(&ost->metadata, ifcx->streams[i]->metadata, 0); - ost->time_base = iccx->time_base; + ost->time_base = ifcx->streams[i]->time_base; ost->id = stid++; } av_log_set_level(AV_LOG_VERBOSE); av_dump_format(ofcx, 0, ofcx->filename, 1); av_log_set_level(AV_LOG_WARNING); +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) bsfc = av_bitstream_filter_init("h264_mp4toannexb"); if (!bsfc) printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__); - +#else + const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb"); + if(!bsf) { + return false; + } + if ((av_bsf_alloc(bsf, &bsfc))) { + return false; + } +#endif return true; } @@ -896,15 +919,34 @@ void CStreamStream::run() if (pkt.stream_index < 0) continue; +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 )) AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec; +#else + AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar; +#endif if (bsfc && codec->codec_id == AV_CODEC_ID_H264 ) { AVPacket newpkt = pkt; - +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { av_packet_unref(&pkt); newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); pkt = newpkt; - } + } +#else + int ret = av_bsf_send_packet(bsfc, &pkt); + if (ret < 0){ + break; + } + ret = av_bsf_receive_packet(bsfc, &newpkt); + if (ret == AVERROR(EAGAIN)){ + break; + } + if(ret != AVERROR_EOF){ + av_packet_unref(&pkt); + newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); + pkt = newpkt; + } +#endif } pkt.pts = av_rescale_q(pkt.pts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); diff --git a/src/driver/streamts.h b/src/driver/streamts.h index da2708e51..7ec1bd321 100644 --- a/src/driver/streamts.h +++ b/src/driver/streamts.h @@ -73,7 +73,11 @@ class CStreamStream : public CStreamInstance private: AVFormatContext *ifcx; AVFormatContext *ofcx; +#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 )) AVBitStreamFilterContext *bsfc; +#else + AVBSFContext *bsfc; +#endif AVIOContext *avio_ctx; bool stopped; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index eabe0e255..46e222231 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2468,8 +2468,11 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) clearSubtitle(); for (unsigned i = 0; i < sub->num_rects; i++) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) uint32_t * colors = (uint32_t *) sub->rects[i]->pict.data[1]; - +#else + uint32_t * colors = (uint32_t *) sub->rects[i]->data[1]; +#endif int xoff = (double) sub->rects[i]->x * xc; int yoff = (double) sub->rects[i]->y * yc; int nw = frameBuffer->getWidth4FB_HW_ACC(xoff, (double) sub->rects[i]->w * xc); @@ -2478,9 +2481,14 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) printf("Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors, xoff, yoff, nw, nh); - +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0) fb_pixel_t * newdata = simple_resize32 (sub->rects[i]->pict.data[0], colors, sub->rects[i]->nb_colors, sub->rects[i]->w, sub->rects[i]->h, nw, nh); +#else + fb_pixel_t * newdata = simple_resize32 (sub->rects[i]->data[0], colors, + sub->rects[i]->nb_colors, sub->rects[i]->w, sub->rects[i]->h, nw, nh); +#endif + frameBuffer->blit2FB(newdata, nw, nh, xoff, yoff); free(newdata);