From 2114e1be62832a96dbe588b4102f0ff302903ec7 Mon Sep 17 00:00:00 2001 From: q5sys Date: Mon, 4 Sep 2017 18:38:53 -0400 Subject: protyping class to make video thumbnails --- src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-fm-dev') diff --git a/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro index 6c340e14..ddf27353 100644 --- a/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro +++ b/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro @@ -28,7 +28,8 @@ SOURCES += main.cpp \ Browser.cpp \ BrowserWidget.cpp \ TrayUI.cpp \ - OPWidget.cpp + OPWidget.cpp \ + widgets/vidnail.cpp HEADERS += MainUI.h \ FODialog.h \ @@ -44,7 +45,8 @@ HEADERS += MainUI.h \ Browser.h \ BrowserWidget.h \ TrayUI.h \ - OPWidget.h + OPWidget.h \ + widgets/vidnail.h FORMS += MainUI.ui \ FODialog.ui \ -- cgit From 9efa09b44942acce68956d5bf0e729fe082749a4 Mon Sep 17 00:00:00 2001 From: q5sys Date: Mon, 4 Sep 2017 18:40:18 -0400 Subject: add files for video thumbnails --- .../lumina-fm-dev/widgets/vidnail.cpp | 13 +++++ .../desktop-utils/lumina-fm-dev/widgets/vidnail.h | 60 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.cpp create mode 100644 src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.h (limited to 'src-qt5/desktop-utils/lumina-fm-dev') diff --git a/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.cpp b/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.cpp new file mode 100644 index 00000000..e13894e1 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.cpp @@ -0,0 +1,13 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2017, q5sys +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "vidnail.h" + +VidNail::VidNail(QObject *parent) : QObject(parent){ +} + +VidNail::~VidNail(){ +} diff --git a/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.h b/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.h new file mode 100644 index 00000000..45b6ca58 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm-dev/widgets/vidnail.h @@ -0,0 +1,60 @@ +#ifndef VIDNAIL_H +#define VIDNAIL_H + +extern "C" { +#include +#include +} + +class VidNail; + +struct vFrame { + vFrame() : *width(0), *height(0) {} + vFrame(int *width, int *height : width(width), height(height) {} + int *width; + int *height; +}; + +public: + + QString getCodec(); + void goto(int timeInSeconds); + void readVideoFrame(); + void getScaledVideoFrame(int scaledSize, vFrame& vFrame); + + int getWidth(); + int getHeight(); + int getLength(); + + void makeThumbnail(const QString& videoFile, QImage &image); + void setThumbnailSize(int size); + void setPercentage(int percent); + void setTime(const QString& Time); + + void writeVidNail(vFrame& frame, QImage& image); + + + private: + + bool readVideoPacket(); + bool getVideoPacket(); + void scaleVideo(int scaledSize, int& scaledWidth, int& scaledHeight); + void createVFrame(AVFrame *vFrame, quint8 *frameBuffer, int width, int height); + void calculateDimensions(int size); + void generateThumbnail(const QString& videoFile, ImageWriter& imageWriter, QImage& image); + QString getMimeType(const QString& videoFile); + QString getExtension(const QString& videoFilename); + + + private: + int videoStream; + AVFormatContext *inputVideoFormatContext; + AVCodecContext *inputvideoCodecContext; + AVCodec *inputVideoCodec; + AVStream *inputVideoStream; + AVFrame *inputVideoFrame; + quint8 *inputFrameBuffer; + AVPacket *videoPacket; + + +#endif // VIDNAIL_H -- cgit From a7283dfda9bc1f2bfa340e43db86675622e27022 Mon Sep 17 00:00:00 2001 From: q5sys Date: Mon, 4 Sep 2017 18:43:02 -0400 Subject: remove vidnail sources from active project file --- src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-fm-dev') diff --git a/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro index ddf27353..6c340e14 100644 --- a/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro +++ b/src-qt5/desktop-utils/lumina-fm-dev/lumina-fm.pro @@ -28,8 +28,7 @@ SOURCES += main.cpp \ Browser.cpp \ BrowserWidget.cpp \ TrayUI.cpp \ - OPWidget.cpp \ - widgets/vidnail.cpp + OPWidget.cpp HEADERS += MainUI.h \ FODialog.h \ @@ -45,8 +44,7 @@ HEADERS += MainUI.h \ Browser.h \ BrowserWidget.h \ TrayUI.h \ - OPWidget.h \ - widgets/vidnail.h + OPWidget.h FORMS += MainUI.ui \ FODialog.ui \ -- cgit