forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -27,42 +27,41 @@ | |
#include <QtAV/FilterContext.h> | ||
|
||
namespace QtAV { | ||
|
||
class AudioFormat; | ||
class AVOutput; | ||
class AVPlayer; | ||
class FilterPrivate; | ||
class Statistics; | ||
class Frame; | ||
// TODO: QObject? | ||
class Q_AV_EXPORT Filter : public QObject | ||
{ | ||
Q_OBJECT | ||
DPTR_DECLARE_PRIVATE(Filter) | ||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) | ||
public: | ||
virtual ~Filter(); | ||
//isEnabled() then setContext | ||
//TODO: parameter FrameContext | ||
void setEnabled(bool enabled = true); //AVComponent.enabled | ||
bool isEnabled() const; | ||
|
||
/*! | ||
* \brief setOwnedByTarget | ||
* If a filter is owned by target, it's not safe to access the filter after it's installed to a target. | ||
* QtAV will delete the installed filter internally if filter is owned by target AND it's parent (QObject) is null. | ||
* \param value | ||
*/ | ||
void setOwnedByTarget(bool value = true); | ||
// default is false | ||
bool isOwnedByTarget() const; | ||
// setInput/Output: no need to call installTo | ||
// bool setInput(Filter*); | ||
// bool setOutput(Filter*); | ||
// install to audio/video as an on frame filter. append to the filter chain | ||
/*! | ||
* \brief installTo | ||
* Install filter to player can process every frame before rendering. | ||
* Equals to player->installFilter(this) | ||
*/ | ||
virtual bool installTo(AVPlayer *player) = 0; | ||
// called in destructor automatically | ||
bool uninstall(); | ||
public Q_SLOTS: | ||
void setEnabled(bool enabled = true); | ||
signals: | ||
void enabledChanged(bool); | ||
protected: | ||
|
@@ -85,13 +84,13 @@ class Q_AV_EXPORT VideoFilter : public Filter | |
VideoFilterContext* context(); | ||
virtual bool isSupported(VideoFilterContext::Type ct) const; | ||
bool installTo(AVPlayer *player); | ||
/* | ||
* filter.installTo(target,...) calls target.installFilter(filter) | ||
* If filter is already registered in FilterManager, then return false | ||
* Otherwise, call FilterManager.register(filter) and target.filters.push_back(filter), return true | ||
* NOTE: the installed filter will be deleted by the target if filter is owned by target AND it's parent (QObject) is null. | ||
/*! | ||
* \brief installTo | ||
* The process() function is in rendering thread. Used by | ||
* 1. GPU filters | ||
* 2. QPainter rendering on widget based renderers. Changing the frame has no effect | ||
* \return false if already installed | ||
*/ | ||
// install to an output and do not modify frames. e.g. OSD | ||
bool installTo(AVOutput *output); //only for video. move to video filter installToRenderer | ||
void apply(Statistics* statistics, VideoFrame *frame = 0); | ||
|
||
|
@@ -117,5 +116,4 @@ class Q_AV_EXPORT AudioFilter : public Filter | |
}; | ||
|
||
} //namespace QtAV | ||
|
||
#endif // QTAV_FILTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -43,7 +43,7 @@ class Q_AV_EXPORT VideoFilterContext | |
public: | ||
enum Type { ////audio and video... | ||
QtPainter, | ||
OpenGL, //Not implemented | ||
OpenGL, | ||
Direct2D, //Not implemeted | ||
GdiPlus, //Not implemented | ||
X11, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -130,6 +130,12 @@ bool VideoFilter::installTo(AVPlayer *player) | |
} | ||
|
||
/*TODO: move to AVOutput.cpp to reduce dependency?*/ | ||
/* | ||
* filter.installTo(target,...) calls target.installFilter(filter) | ||
* If filter is already registered in FilterManager, then return false | ||
* Otherwise, call FilterManager.register(filter) and target.filters.push_back(filter), return true | ||
* NOTE: the installed filter will be deleted by the target if filter is owned by target AND it's parent (QObject) is null. | ||
*/ | ||
bool VideoFilter::installTo(AVOutput *output) | ||
{ | ||
return output->installFilter(this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -155,6 +155,7 @@ QPainterFilterContext::~QPainterFilterContext() | |
} | ||
} | ||
|
||
// TODO: use drawPixmap? | ||
void QPainterFilterContext::drawImage(const QPointF &pos, const QImage &image, const QRectF& source, Qt::ImageConversionFlags flags) | ||
{ | ||
if (!prepare()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013-2015 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2013) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|