Updated qcma to build with newer ffmpeg.

Disabled appindicator support (too unstable).
This commit is contained in:
codestation
2016-03-18 20:00:16 -04:30
parent 7886238975
commit 65b04093eb
7 changed files with 40 additions and 39 deletions

View File

@@ -141,7 +141,11 @@ AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_
if(packet.stream_index == frame_stream_index) { if(packet.stream_index == frame_stream_index) {
avcodec_decode_video2(codec_ctx, pFrame, &frame_finished, &packet); 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); av_free_packet(&packet);
#endif
} }
if(frame_finished) { 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) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrame); av_frame_free(&pFrame);
#else #else
av_free(pFrame); avcodec_free_frame(&pFrame);
#endif #endif
return NULL; return NULL;
} }
@@ -211,11 +215,10 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height)
width, height); width, height);
data = WriteJPEG(pCodecCtx, pFrame, width, height); data = WriteJPEG(pCodecCtx, pFrame, width, height);
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrame); av_frame_free(&pFrame);
#else #else
av_free(pFrame); avcodec_free_frame(&pFrame);
#endif #endif
} }
@@ -239,7 +242,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
pCodecCtx->width, pCodecCtx->height, pCodecCtx->width, pCodecCtx->height,
pCodecCtx->pix_fmt, pCodecCtx->pix_fmt,
width, height, width, height,
PIX_FMT_YUVJ420P, SWS_BICUBIC, AV_PIX_FMT_YUV420P, SWS_BICUBIC,
NULL, NULL, NULL); NULL, NULL, NULL);
if(!sws_ctx) { if(!sws_ctx) {
@@ -257,7 +260,13 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
return data; 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); int numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, width, height);
#endif
uint8_t *buffer = (uint8_t *)av_malloc(numBytes); 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) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrameRGB); av_frame_free(&pFrameRGB);
#else #else
av_free(pFrameRGB); avcodec_free_frame(&pFrameRGB);
#endif #endif
sws_freeContext(sws_ctx); sws_freeContext(sws_ctx);
return data; 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); avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_YUVJ420P, width, height);
#endif
sws_scale( sws_scale(
sws_ctx, sws_ctx,
@@ -296,7 +311,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrameRGB); av_frame_free(&pFrameRGB);
#else #else
av_free(&pFrameRGB); avcodec_free_frame(&pFrameRGB);
#endif #endif
sws_freeContext(sws_ctx); sws_freeContext(sws_ctx);
return 0; return 0;
@@ -306,6 +321,7 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
pOCodecCtx->width = width; pOCodecCtx->width = width;
pOCodecCtx->height = height; pOCodecCtx->height = height;
pOCodecCtx->pix_fmt = AV_PIX_FMT_YUVJ420P; pOCodecCtx->pix_fmt = AV_PIX_FMT_YUVJ420P;
pOCodecCtx->color_range = AVCOL_RANGE_JPEG;
pOCodecCtx->codec_id = AV_CODEC_ID_MJPEG; pOCodecCtx->codec_id = AV_CODEC_ID_MJPEG;
pOCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO; pOCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
pOCodecCtx->time_base.num = pCodecCtx->time_base.num; 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) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrameRGB); av_frame_free(&pFrameRGB);
#else #else
av_free(&pFrameRGB); avcodec_free_frame(&pFrameRGB);
#endif #endif
sws_freeContext(sws_ctx); sws_freeContext(sws_ctx);
return 0; return 0;
} }
pOCodecCtx->mb_lmin = pOCodecCtx->lmin = pOCodecCtx->qmin * FF_QP2LAMBDA; av_opt_set_int(pOCodecCtx, "lmin", pOCodecCtx->qmin * FF_QP2LAMBDA, 0);
pOCodecCtx->mb_lmax = pOCodecCtx->lmax = pOCodecCtx->qmax * FF_QP2LAMBDA; 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->flags = CODEC_FLAG_QSCALE;
pOCodecCtx->global_quality = pOCodecCtx->qmin * FF_QP2LAMBDA; 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) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free(&pFrameRGB); av_frame_free(&pFrameRGB);
#else #else
av_free(&pFrameRGB); avcodec_free_frame(&pFrameRGB);
#endif #endif
avcodec_close(pOCodecCtx); avcodec_close(pOCodecCtx);
sws_freeContext(sws_ctx); sws_freeContext(sws_ctx);

View File

@@ -26,7 +26,9 @@ extern "C" {
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
#include <libavutil/mathematics.h> #include <libavutil/mathematics.h>
#include <libavutil/opt.h>
} }
#include <vitamtp.h> #include <vitamtp.h>

7
debian/changelog vendored
View File

@@ -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 <codestation404@gmail.com> Sun, 18 Mar 2016 00:00:00 -0000
qcma (0.3.10) unstable; urgency=low qcma (0.3.10) unstable; urgency=low
* debian: switch to libvitamtp* * debian: switch to libvitamtp*

9
debian/control vendored
View File

@@ -13,14 +13,12 @@ Build-Depends:
qttools5-dev-tools, qttools5-dev-tools,
libnotify-dev, libnotify-dev,
libgtk2.0-dev, libgtk2.0-dev,
libappindicator-dev,
pkg-config, pkg-config,
libvitamtp-dev (>= 2.5.5) libvitamtp-dev (>= 2.5.5)
Package: qcma Package: qcma
Architecture: any Architecture: any
Depends: libvitamtp5 (>= 2.5.5), ${shlibs:Depends}, ${misc:Depends} Depends: libvitamtp5 (>= 2.5.5), ${shlibs:Depends}, ${misc:Depends}
Recommends: qcma-appindicator
Description: Content Manager Assistant for the PS Vita Description: Content Manager Assistant for the PS Vita
QCMA will allow you to backup your PS Vita games & manage QCMA will allow you to backup your PS Vita games & manage
your songs, videos & photos. 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 Command-line client to backup your PS Vita games & manage
your songs, videos & photos. your songs, videos & photos.
You can connect your Vita wirelessly or via USB. 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

View File

@@ -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

2
debian/rules vendored
View File

@@ -11,6 +11,6 @@ export QT_SELECT=qt5
override_dh_auto_configure: override_dh_auto_configure:
lrelease common/resources/translations/qcma_*.ts lrelease common/resources/translations/qcma_*.ts
dh_auto_configure -- qcma.pro CONFIG+="ENABLE_APPINDICATOR" dh_auto_configure -- qcma.pro
.PHONY: override_dh_auto_configure .PHONY: override_dh_auto_configure

View File

@@ -18,7 +18,6 @@
%define _qt5basedevel qt5-qtbase-devel %define _qt5basedevel qt5-qtbase-devel
%define _knotifications kf5-knotifications %define _knotifications kf5-knotifications
%define _knotifications_devel kf5-knotifications-devel %define _knotifications_devel kf5-knotifications-devel
%define _appindicator libappindicator
%else %else
%define _qt5base libqt5-qtbase %define _qt5base libqt5-qtbase
%define _qt5imageformats libqt5-qtimageformats %define _qt5imageformats libqt5-qtimageformats
@@ -27,7 +26,6 @@
%define _qt5basedevel libqt5-qtbase-devel %define _qt5basedevel libqt5-qtbase-devel
%define _knotifications libKF5Notifications5 %define _knotifications libKF5Notifications5
%define _knotifications_devel knotifications-devel %define _knotifications_devel knotifications-devel
%define _appindicator libappindicator1
%endif %endif
Name: qcma Name: qcma
@@ -47,7 +45,6 @@ BuildRequires: gcc-c++
BuildRequires: %{_pkgconfig} BuildRequires: %{_pkgconfig}
BuildRequires: libnotify-devel BuildRequires: libnotify-devel
BuildRequires: %{_knotifications_devel} BuildRequires: %{_knotifications_devel}
BuildRequires: libappindicator-devel
BuildRequires: ffmpeg-devel BuildRequires: ffmpeg-devel
BuildRequires: libvitamtp-devel BuildRequires: libvitamtp-devel
BuildRequires: %{_qt5linguist} BuildRequires: %{_qt5linguist}
@@ -63,7 +60,7 @@ is meant to be compatible with Linux, Windows and MAC OS X.
%build %build
lrelease-qt5 common/resources/translations/*.ts 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} make %{?_smp_mflags}
%install %install
@@ -86,18 +83,6 @@ Headless version of Qcma
%{_bindir}/qcma_cli %{_bindir}/qcma_cli
%{_prefix}/share/man/man1/qcma_cli.1.gz %{_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 %package kdenotifier
Summary: Content Manager Assistant for the PS Vita (kdenotifier support) Summary: Content Manager Assistant for the PS Vita (kdenotifier support)
Requires: %{_knotifications} Requires: %{_knotifications}