Files
fmviewer3/project/fm_viewer/fav/widget/VideoPreviewWidget.h
2026-02-21 17:11:31 +09:00

72 lines
2.2 KiB
C++

/******************************************************************************
VideoRendererTypes: type id and manually id register function
Copyright (C) 2015 Wang Bin <wbsecg1@gmail.com>
* This file is part of QtAV
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
#ifndef QTAV_VIDEOPREVIEWWIDGET_H
#define QTAV_VIDEOPREVIEWWIDGET_H
#include "global.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/QWidget>
#else
#include <QtGui/QWidget>
#endif
#define REMOVE_VIDEO_PREVIEW_WIDGET 1
#if !(REMOVE_VIDEO_PREVIEW_WIDGET)
namespace FAV {
class VideoFrame;
class VideoOutput;
class VideoFrameExtractor;
class Q_AVWIDGETS_EXPORT VideoPreviewWidget : public QWidget
{
Q_OBJECT
public:
explicit VideoPreviewWidget(QWidget *parent = 0);
void setTimestamp(qint64 msec);
qint64 timestamp() const;
void preview();
void setFile(const QString& file);
QString file() const;
// default is false
void setKeepAspectRatio(bool value = true);
bool isKeepAspectRatio() const;
Q_SIGNALS:
void timestampChanged();
void fileChanged();
protected:
virtual void resizeEvent(QResizeEvent *);
private Q_SLOTS:
void displayFrame(const FAV::VideoFrame& frame); //parameter VideoFrame
void displayNoFrame();
private:
bool m_keep_ar;
QString m_file;
VideoFrameExtractor *m_extractor;
VideoOutput *m_out;
};
} //namespace FAV
#endif // QTAV_VIDEOPREVIEWWIDGET_H
#endif #if !(REMOVE_VIDEO_PREVIEW_WIDGET)