Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Oct 5, 2013
1 parent 7edfed5 commit 59f71e0
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 19 deletions.
5 changes: 2 additions & 3 deletions examples/filters/SimpleFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@

namespace QtAV {

SimpleFilter::SimpleFilter(QObject *parent):
QObject(parent)
SimpleFilter::SimpleFilter():
Filter()
, mCanRot(true)
, mWave(true)
, Filter()
{
srand(QTime::currentTime().msec());
mStartValue = (qreal)(rand()%1000)/qreal(1000.0);
Expand Down
5 changes: 2 additions & 3 deletions examples/filters/SimpleFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@

namespace QtAV {

class SimpleFilter : public QObject, public Filter
class SimpleFilter : public Filter
{
Q_OBJECT
public:
SimpleFilter(QObject* parent = 0);
SimpleFilter();
virtual ~SimpleFilter();
void enableRotate(bool r);
void enableWaveEffect(bool w);
Expand Down
2 changes: 2 additions & 0 deletions examples/filters/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ int main(int argc, char *argv[])
filter->setText("Filter on Renderer");
VideoFilterContext *ctx = static_cast<VideoFilterContext*>(filter->context());
ctx->rect = QRect(200, 150, 400, 60);
ctx->opacity = 0.7;
filter->enableRotate(false);
filter->prepare();
filter->start();
Expand All @@ -107,6 +108,7 @@ int main(int argc, char *argv[])
filter->setImage(QImage(":/images/qt-logo.png"));
ctx = static_cast<VideoFilterContext*>(filter->context());
ctx->rect = QRect(400, 80, 200, 200);
ctx->opacity = 0.618;
filter->enableRotate(true);
filter->enableWaveEffect(false);
filter->prepare();
Expand Down
7 changes: 3 additions & 4 deletions src/AVPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <QtAV/AVClock.h>
#include <QtAV/QtAV_Compat.h>
#include <QtAV/VideoCapture.h>
#include <QtAV/VideoDecoder.h>
#include <QtAV/VideoDecoderTypes.h>
#include <QtAV/WidgetRenderer.h>
#include <QtAV/VideoThread.h>
#include <QtAV/AVDemuxThread.h>
Expand Down Expand Up @@ -301,10 +301,9 @@ void AVPlayer::setPlayerEventFilter(QObject *obj)
if (event_filter) {
qApp->removeEventFilter(event_filter);
delete event_filter;
event_filter = 0; //the default event filter's parent is this, so AVPlayer will try to delete event_filter
}
event_filter = obj; //the default event filter's parent is this, so AVPlayer will try to delete event_filter
if (obj) {
event_filter = obj;
qApp->installEventFilter(event_filter);
}
}
Expand Down Expand Up @@ -779,7 +778,7 @@ void AVPlayer::setupVideoThread()
{
if (vCodecCtx) {
if (!video_dec) {
video_dec = new VideoDecoder();
video_dec = VideoDecoderFactory::create(VideoDecoderId_FFmpeg);
}
video_dec->setCodecContext(vCodecCtx);
video_dec->prepare();
Expand Down
8 changes: 6 additions & 2 deletions src/QtAV/AVPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ class Q_EXPORT AVPlayer : public QObject
*/
void setSpeed(qreal speed);
qreal speed() const;
/*only 1 event filter is available. the previous one will be removed. setPlayerEventFilter(0) will remove the event filter*/
Q_DECL_DEPRECATED void setPlayerEventFilter(QObject *obj);
/*
* only 1 event filter is available. the previous one will be removed.
* setPlayerEventFilter(0) will remove the event filter.
* qApp->installEventFilter will be called
*/
void setPlayerEventFilter(QObject *obj);

Statistics& statistics();
const Statistics& statistics() const;
Expand Down
4 changes: 2 additions & 2 deletions src/QtAV/AudioResamplerTypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#ifndef QTAV_AUDIORESAMPLERTYPES_H
#define QTAV_AUDIORESAMPLERTYPES_H
/******************************************************************************
VideoRendererTypes: type id and manually id register function
Copyright (C) 2013 Wang Bin <[email protected]>
Expand All @@ -20,6 +18,8 @@
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_AUDIORESAMPLERTYPES_H
#define QTAV_AUDIORESAMPLERTYPES_H

#include <QtAV/AudioResampler.h>

Expand Down
1 change: 1 addition & 0 deletions src/QtAV/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Q_EXPORT Filter
* 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!
*/
// filter on output. e.g. subtitle
bool installTo(AVOutput *output);
Expand Down
2 changes: 1 addition & 1 deletion src/QtAV/VideoDecoderTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
namespace QtAV {

extern Q_EXPORT VideoDecoderId VideoDecoderId_FFmpeg;
extern Q_EXPORT VideoDecoderId VideoDecoderId_CUDA;
extern Q_EXPORT VideoDecoderId VideoDecoderId_FFmpeg_DXVA;
extern Q_EXPORT VideoDecoderId VideoDecoderId_FFmpeg_VAAPI;
extern Q_EXPORT VideoDecoderId VideoDecoderId_FFmpeg_VDPAU;
extern Q_EXPORT VideoDecoderId VideoDecoderId_FFmpeg_VDA;
extern Q_EXPORT VideoDecoderId VideoDecoderId_CUDA;


Q_EXPORT void VideoDecoder_RegisterAll();
Expand Down
3 changes: 2 additions & 1 deletion src/VideoDecoderTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace QtAV {

VideoDecoderId VideoDecoderId_FFmpeg = 0;
VideoDecoderId VideoDecoderId_FFmpeg_DXVA = 1;
VideoDecoderId VideoDecoderId_CUDA = 1;
VideoDecoderId VideoDecoderId_FFmpeg_DXVA = 2;

} //namespace QtAV
4 changes: 1 addition & 3 deletions templates/final.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ namespace QtAV {
class %CLASS%Private : public �SE%Private
{
public:
%CLASS%Private()
{
}
%CLASS%Private() {}
virtual ~%CLASS%Private() {}
};

Expand Down

0 comments on commit 59f71e0

Please sign in to comment.