diff --git a/configure.ac b/configure.ac index 925854238..04e913f76 100644 --- a/configure.ac +++ b/configure.ac @@ -284,20 +284,22 @@ 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' 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' fi +HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/src/zapit/include/private' +HWLIB_CFLAGS="$HWLIB_CFLAGS "'-I$(top_srcdir)/lib/hardware/coolstream' fi # hack, so that framebuffer.h does not need to be included everywhere... @@ -363,9 +365,9 @@ 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/libcoolstream/Makefile lib/libdvbsub/Makefile lib/libeventserver/Makefile lib/libiw/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index 037c33c38..63e00773d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -20,5 +20,5 @@ endif if BOXTYPE_COOL SUBDIRS += \ - libcoolstream + hardware/coolstream endif diff --git a/lib/hardware/coolstream/Makefile.am b/lib/hardware/coolstream/Makefile.am new file mode 100644 index 000000000..d460837c3 --- /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/hardware/coolstream/hd2/libcoolstream +else +AM_CPPFLAGS = -I$(top_srcdir)/lib/hardware/coolstream/hd1/libcoolstream +endif + +libhwcaps_a_SOURCES = \ + hardware_caps.cpp diff --git a/lib/libcoolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp similarity index 100% rename from lib/libcoolstream/hardware_caps.cpp rename to lib/hardware/coolstream/hardware_caps.cpp diff --git a/lib/libcoolstream/hardware_caps.h b/lib/hardware/coolstream/hardware_caps.h similarity index 100% rename from lib/libcoolstream/hardware_caps.h rename to lib/hardware/coolstream/hardware_caps.h 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 diff --git a/lib/libcoolstream/Makefile.am b/lib/libcoolstream/Makefile.am deleted file mode 100644 index eaa9c7d79..000000000 --- a/lib/libcoolstream/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -noinst_LIBRARIES = libhwcaps.a - -AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing - -AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream - -libhwcaps_a_SOURCES = \ - hardware_caps.cpp diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 26f1e5f8f..e7f79963d 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]); } @@ -134,7 +139,11 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y) #endif 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; @@ -162,7 +171,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 #ifdef HAVE_SPARK_HARDWARE // CFrameBuffer::getInstance()->waitForIdle(); diff --git a/src/Makefile.am b/src/Makefile.am index 388ff1f28..0adb0e148 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -143,7 +143,7 @@ endif if BOXTYPE_COOL neutrino_LDADD += \ - $(top_builddir)/lib/libcoolstream/libhwcaps.a + $(top_builddir)/lib/hardware/coolstream/libhwcaps.a neutrino_LDADD += -lcoolstream-mt -lca-sc if ENABLE_TMSDK else diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 3262a0a95..b85592897 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(); @@ -322,9 +334,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 @@ -336,6 +349,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, @@ -364,8 +398,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; @@ -424,7 +456,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); } } @@ -441,12 +477,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) @@ -466,8 +507,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 24fbdc672..379acea4c 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -67,12 +67,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; @@ -1911,8 +1919,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; @@ -1929,7 +1942,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); @@ -2158,12 +2175,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; @@ -2173,10 +2195,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; } @@ -2200,16 +2231,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 8af0fb449..f69dcea08 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -60,6 +60,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 @@ -756,8 +760,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; @@ -840,21 +849,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; } @@ -899,15 +922,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/movieinfo.cpp b/src/gui/movieinfo.cpp index 12398f9f8..26f910e45 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/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index c16f0388e..29e927f48 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1355,12 +1355,12 @@ void CMoviePlayerGui::PlayFileLoop(void) } #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; } @@ -2501,8 +2501,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); @@ -2511,9 +2514,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); diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 837f46eb2..48921105b 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; 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); 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;; } } diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 7f4e10ae7..acb7df7fa 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -523,7 +523,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; }