diff --git a/common/avdecoder.cpp b/common/avdecoder.cpp index d4ff140..6e4306d 100644 --- a/common/avdecoder.cpp +++ b/common/avdecoder.cpp @@ -141,7 +141,11 @@ AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_ if(packet.stream_index == frame_stream_index) { avcodec_decode_video2(codec_ctx, pFrame, &frame_finished, &packet); } +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,7,0) + av_packet_unref(&packet); +#else av_free_packet(&packet); +#endif } if(frame_finished) { @@ -150,7 +154,7 @@ AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_ #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrame); #else - av_free(pFrame); + avcodec_free_frame(&pFrame); #endif return NULL; } @@ -211,11 +215,10 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height) width, height); data = WriteJPEG(pCodecCtx, pFrame, width, height); - #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrame); #else - av_free(pFrame); + avcodec_free_frame(&pFrame); #endif } @@ -239,7 +242,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, width, height, - PIX_FMT_YUVJ420P, SWS_BICUBIC, + AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); if(!sws_ctx) { @@ -257,7 +260,13 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int return data; } + // detect ffmpeg (>= 100) or libav (< 100) +#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,63,100)) || \ + (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54,6,0)) + int numBytes = av_image_get_buffer_size(AV_PIX_FMT_YUV420P, width, height, 16); +#else int numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, width, height); +#endif uint8_t *buffer = (uint8_t *)av_malloc(numBytes); @@ -265,13 +274,19 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrameRGB); #else - av_free(pFrameRGB); + avcodec_free_frame(&pFrameRGB); #endif sws_freeContext(sws_ctx); return data; } + // detect ffmpeg (>= 100) or libav (< 100) +#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,63,100)) || \ + (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54,6,0)) + av_image_fill_arrays(pFrameRGB->data, pFrameRGB->linesize, buffer, AV_PIX_FMT_YUV420P, width, height, 1); +#else avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_YUVJ420P, width, height); +#endif sws_scale( sws_ctx, @@ -296,7 +311,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrameRGB); #else - av_free(&pFrameRGB); + avcodec_free_frame(&pFrameRGB); #endif sws_freeContext(sws_ctx); return 0; @@ -306,6 +321,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int pOCodecCtx->width = width; pOCodecCtx->height = height; pOCodecCtx->pix_fmt = AV_PIX_FMT_YUVJ420P; + pOCodecCtx->color_range = AVCOL_RANGE_JPEG; pOCodecCtx->codec_id = AV_CODEC_ID_MJPEG; pOCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO; pOCodecCtx->time_base.num = pCodecCtx->time_base.num; @@ -323,14 +339,17 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrameRGB); #else - av_free(&pFrameRGB); + avcodec_free_frame(&pFrameRGB); #endif sws_freeContext(sws_ctx); return 0; } - pOCodecCtx->mb_lmin = pOCodecCtx->lmin = pOCodecCtx->qmin * FF_QP2LAMBDA; - pOCodecCtx->mb_lmax = pOCodecCtx->lmax = pOCodecCtx->qmax * FF_QP2LAMBDA; + av_opt_set_int(pOCodecCtx, "lmin", pOCodecCtx->qmin * FF_QP2LAMBDA, 0); + av_opt_set_int(pOCodecCtx, "lmax", pOCodecCtx->qmax * FF_QP2LAMBDA, 0); + + pOCodecCtx->mb_lmin = pOCodecCtx->qmin * FF_QP2LAMBDA; + pOCodecCtx->mb_lmax = pOCodecCtx->qmax * FF_QP2LAMBDA; pOCodecCtx->flags = CODEC_FLAG_QSCALE; pOCodecCtx->global_quality = pOCodecCtx->qmin * FF_QP2LAMBDA; @@ -358,7 +377,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) av_frame_free(&pFrameRGB); #else - av_free(&pFrameRGB); + avcodec_free_frame(&pFrameRGB); #endif avcodec_close(pOCodecCtx); sws_freeContext(sws_ctx); diff --git a/common/avdecoder.h b/common/avdecoder.h index fca0c81..4f4de6b 100644 --- a/common/avdecoder.h +++ b/common/avdecoder.h @@ -26,7 +26,9 @@ extern "C" { #include #include #include +#include #include +#include } #include diff --git a/debian/changelog b/debian/changelog index 8129073..ad5ef65 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +qcma (0.3.11) unstable; urgency=low + + * fixed compilation with newer ffmpeg. + * removed appindicator compilation build on debs, too unstable. + + -- codestation Sun, 18 Mar 2016 00:00:00 -0000 + qcma (0.3.10) unstable; urgency=low * debian: switch to libvitamtp* diff --git a/debian/control b/debian/control index 8a0d353..daa5ebd 100644 --- a/debian/control +++ b/debian/control @@ -13,14 +13,12 @@ Build-Depends: qttools5-dev-tools, libnotify-dev, libgtk2.0-dev, - libappindicator-dev, pkg-config, libvitamtp-dev (>= 2.5.5) Package: qcma Architecture: any Depends: libvitamtp5 (>= 2.5.5), ${shlibs:Depends}, ${misc:Depends} -Recommends: qcma-appindicator Description: Content Manager Assistant for the PS Vita QCMA will allow you to backup your PS Vita games & manage your songs, videos & photos. @@ -33,10 +31,3 @@ Description: Content Manager Assistant for the PS Vita (headless version) Command-line client to backup your PS Vita games & manage your songs, videos & photos. You can connect your Vita wirelessly or via USB. - -Package: qcma-appindicator -Architecture: any -Depends: qcma (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: Content Manager Assistant for the PS Vita (appindicator support) - This desktop tray indicator will let you known if you PS Vita - is currently recognized by QCMA diff --git a/debian/qcma-appindicator.install b/debian/qcma-appindicator.install deleted file mode 100644 index 33c4ed7..0000000 --- a/debian/qcma-appindicator.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/qcma/libqcma_appindicator.so -gui/resources/images/qcma_on.png usr/share/icons/hicolor/64x64/actions -gui/resources/images/qcma_off.png usr/share/icons/hicolor/64x64/actions diff --git a/debian/rules b/debian/rules index bc2bf30..156df0b 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,6 @@ export QT_SELECT=qt5 override_dh_auto_configure: lrelease common/resources/translations/qcma_*.ts - dh_auto_configure -- qcma.pro CONFIG+="ENABLE_APPINDICATOR" + dh_auto_configure -- qcma.pro .PHONY: override_dh_auto_configure diff --git a/rpmbuild/qcma.spec b/rpmbuild/qcma.spec index 9852241..7fbea78 100644 --- a/rpmbuild/qcma.spec +++ b/rpmbuild/qcma.spec @@ -18,7 +18,6 @@ %define _qt5basedevel qt5-qtbase-devel %define _knotifications kf5-knotifications %define _knotifications_devel kf5-knotifications-devel -%define _appindicator libappindicator %else %define _qt5base libqt5-qtbase %define _qt5imageformats libqt5-qtimageformats @@ -27,7 +26,6 @@ %define _qt5basedevel libqt5-qtbase-devel %define _knotifications libKF5Notifications5 %define _knotifications_devel knotifications-devel -%define _appindicator libappindicator1 %endif Name: qcma @@ -47,7 +45,6 @@ BuildRequires: gcc-c++ BuildRequires: %{_pkgconfig} BuildRequires: libnotify-devel BuildRequires: %{_knotifications_devel} -BuildRequires: libappindicator-devel BuildRequires: ffmpeg-devel BuildRequires: libvitamtp-devel BuildRequires: %{_qt5linguist} @@ -63,7 +60,7 @@ is meant to be compatible with Linux, Windows and MAC OS X. %build lrelease-qt5 common/resources/translations/*.ts -qmake-qt5 PREFIX=/usr qcma.pro CONFIG+="QT5_SUFFIX ENABLE_KNOTIFICATIONS ENABLE_APPINDICATOR ENABLE_KDENOTIFIER" +qmake-qt5 PREFIX=/usr qcma.pro CONFIG+="QT5_SUFFIX ENABLE_KNOTIFICATIONS ENABLE_KDENOTIFIER" make %{?_smp_mflags} %install @@ -86,18 +83,6 @@ Headless version of Qcma %{_bindir}/qcma_cli %{_prefix}/share/man/man1/qcma_cli.1.gz -%package appindicator -Summary: Content Manager Assistant for the PS Vita (appindicator support) -Requires: %{_appindicator} - -%description appindicator -Appindicator plugin for Qcma - -%files appindicator -%{_prefix}/lib/qcma/libqcma_appindicator.so -%{_prefix}/share/icons/hicolor/64x64/actions/qcma_on.png -%{_prefix}/share/icons/hicolor/64x64/actions/qcma_off.png - %package kdenotifier Summary: Content Manager Assistant for the PS Vita (kdenotifier support) Requires: %{_knotifications}