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.
virtual VideoRenderer.widget()/graphicsItem() is reasonable
- Loading branch information
Showing
17 changed files
with
32 additions
and
44 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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -29,7 +29,6 @@ Direct2DRenderer::Direct2DRenderer(QWidget *parent, Qt::WindowFlags f): | |
QWidget(parent, f),VideoRenderer(*new Direct2DRendererPrivate()) | ||
{ | ||
DPTR_INIT_PRIVATE(Direct2DRenderer); | ||
d_func().widget_holder = this; | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
/* To rapidly update custom widgets that constantly paint over their entire areas with | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -33,7 +33,6 @@ GDIRenderer::GDIRenderer(QWidget *parent, Qt::WindowFlags f): | |
QWidget(parent, f),VideoRenderer(*new GDIRendererPrivate()) | ||
{ | ||
DPTR_INIT_PRIVATE(GDIRenderer); | ||
d_func().widget_holder = this; | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
/* To rapidly update custom widgets that constantly paint over their entire areas with | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -158,7 +158,6 @@ GLWidgetRenderer::GLWidgetRenderer(QWidget *parent, const QGLWidget* shareWidget | |
{ | ||
DPTR_INIT_PRIVATE(GLWidgetRenderer); | ||
DPTR_D(GLWidgetRenderer); | ||
d_func().widget_holder = this; | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
/* To rapidly update custom widgets that constantly paint over their entire areas with | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -33,7 +33,6 @@ namespace QtAV { | |
GraphicsItemRenderer::GraphicsItemRenderer(QGraphicsItem * parent) | ||
:GraphicsWidget(parent),QPainterRenderer(*new GraphicsItemRendererPrivate()) | ||
{ | ||
d_func().item_holder = this; | ||
setFlag(ItemIsFocusable); //receive key events | ||
//setAcceptHoverEvents(true); | ||
#if CONFIG_GRAPHICSWIDGET | ||
|
@@ -44,7 +43,6 @@ GraphicsItemRenderer::GraphicsItemRenderer(QGraphicsItem * parent) | |
GraphicsItemRenderer::GraphicsItemRenderer(GraphicsItemRendererPrivate &d, QGraphicsItem *parent) | ||
:GraphicsWidget(parent),QPainterRenderer(d) | ||
{ | ||
d_func().item_holder = this; | ||
setFlag(ItemIsFocusable); //receive key events | ||
//setAcceptHoverEvents(true); | ||
#if CONFIG_GRAPHICSWIDGET | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -45,6 +45,7 @@ class Q_AV_EXPORT Direct2DRenderer : public QWidget, public VideoRenderer | |
* return 0 and set this flag | ||
*/ | ||
virtual QPaintEngine* paintEngine() const; | ||
virtual QWidget* widget() { return this; } | ||
protected: | ||
virtual bool receiveFrame(const VideoFrame& frame); | ||
virtual bool needUpdateBackground() const; | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -45,6 +45,7 @@ class Q_AV_EXPORT GDIRenderer : public QWidget, public VideoRenderer | |
* true: paintEngine.getDC(), double buffer is enabled by defalut. | ||
* false: GetDC(winId()), no double buffer, should reimplement paintEngine() | ||
*/ | ||
virtual QWidget* widget() { return this; } | ||
protected: | ||
virtual bool receiveFrame(const VideoFrame& frame); | ||
virtual bool needUpdateBackground() const; | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -36,6 +36,7 @@ class Q_AV_EXPORT GLWidgetRenderer : public QGLWidget, public VideoRenderer, pub | |
public: | ||
GLWidgetRenderer(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); | ||
virtual VideoRendererId id() const; | ||
virtual QWidget* widget() { return this; } | ||
|
||
protected: | ||
virtual bool receiveFrame(const VideoFrame& frame); | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -45,6 +45,7 @@ class Q_AV_EXPORT GraphicsItemRenderer : public GraphicsWidget, public QPainterR | |
|
||
QRectF boundingRect() const; | ||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||
virtual QGraphicsItem* graphicsItem() { return this; } | ||
|
||
protected: | ||
GraphicsItemRenderer(GraphicsItemRendererPrivate& d, QGraphicsItem *parent); | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -140,8 +140,16 @@ class Q_AV_EXPORT VideoRenderer : public AVOutput | |
*/ | ||
QPointF mapFromFrame(const QPointF& p) const; | ||
|
||
QWidget* widget(); | ||
QGraphicsItem* graphicsItem(); | ||
/*! | ||
* \brief widget | ||
* \return default is 0. A QWidget subclass can return \a this | ||
*/ | ||
virtual QWidget* widget() { return 0; } | ||
/*! | ||
* \brief graphicsItem | ||
* \return default is 0. A QGraphicsItem subclass can return \a this | ||
*/ | ||
virtual QGraphicsItem* graphicsItem() { return 0; } | ||
|
||
//TODO: enable/disable = new a default for this vo engine or push back/remove from list | ||
//filter: null means disable | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -35,6 +35,7 @@ class Q_AV_EXPORT WidgetRenderer : public QWidget, public QPainterRenderer | |
public: | ||
explicit WidgetRenderer(QWidget *parent = 0, Qt::WindowFlags f = 0); | ||
virtual VideoRendererId id() const; | ||
virtual QWidget* widget() { return this; } | ||
signals: | ||
void imageReady(); | ||
protected: | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -47,6 +47,7 @@ class Q_AV_EXPORT XVRenderer : public QWidget, public VideoRenderer | |
* true: paintEngine is QPainter. Painting with QPainter support double buffer | ||
* false: no double buffer, should reimplement paintEngine() to return 0 to avoid flicker | ||
*/ | ||
virtual QWidget* widget() { return this; } | ||
protected: | ||
virtual bool receiveFrame(const VideoFrame& frame); | ||
virtual bool needUpdateBackground() const; | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -54,8 +54,6 @@ class Q_AV_EXPORT VideoRendererPrivate : public AVOutputPrivate | |
, out_aspect_ratio_mode(VideoRenderer::VideoAspectRatio) | ||
, out_aspect_ratio(0) | ||
, quality(VideoRenderer::QualityBest) | ||
, widget_holder(0) | ||
, item_holder(0) | ||
, osd_filter(0) | ||
, subtitle_filter(0) | ||
, default_event_filter(true) | ||
|
@@ -64,7 +62,6 @@ class Q_AV_EXPORT VideoRendererPrivate : public AVOutputPrivate | |
//conv.setOutFormat(PIX_FMT_BGR32); //TODO: why not RGB32? | ||
} | ||
virtual ~VideoRendererPrivate(){ | ||
widget_holder = 0; | ||
} | ||
void computeOutParameters(qreal outAspectRatio) { | ||
qreal rendererAspectRatio = qreal(renderer_width)/qreal(renderer_height); | ||
|
@@ -109,11 +106,6 @@ class Q_AV_EXPORT VideoRendererPrivate : public AVOutputPrivate | |
//out_rect: the displayed video frame out_rect in the renderer | ||
QRect out_rect; //TODO: out_out_rect | ||
QRectF roi; | ||
/* Stores but not own the ptr if renderer is a subclass of QWidget. | ||
* Some operations are based on QWidget | ||
*/ | ||
QWidget *widget_holder; | ||
QGraphicsItem *item_holder; | ||
|
||
Filter *osd_filter, *subtitle_filter; //should be at the end of list and draw top level | ||
bool default_event_filter; | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -253,16 +253,6 @@ QPointF VideoRenderer::mapFromFrame(const QPointF &p) const | |
return QPointF(rendererWidth()/2, rendererHeight()/2) + delta / zoom; | ||
} | ||
|
||
QWidget* VideoRenderer::widget() | ||
{ | ||
return d_func().widget_holder; | ||
} | ||
|
||
QGraphicsItem* VideoRenderer::graphicsItem() | ||
{ | ||
return d_func().item_holder; | ||
} | ||
|
||
OSDFilter *VideoRenderer::setOSDFilter(OSDFilter *filter) | ||
{ | ||
DPTR_D(VideoRenderer); | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -32,7 +32,6 @@ WidgetRenderer::WidgetRenderer(QWidget *parent, Qt::WindowFlags f) : | |
QWidget(parent, f),QPainterRenderer(*new WidgetRendererPrivate()) | ||
{ | ||
DPTR_D(WidgetRenderer); | ||
d.widget_holder = this; | ||
d.painter = new QPainter(); | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
|
@@ -55,7 +54,6 @@ WidgetRenderer::WidgetRenderer(QWidget *parent, Qt::WindowFlags f) : | |
WidgetRenderer::WidgetRenderer(WidgetRendererPrivate &d, QWidget *parent, Qt::WindowFlags f) | ||
:QWidget(parent, f),QPainterRenderer(d) | ||
{ | ||
d.widget_holder = this; | ||
d.painter = new QPainter(); | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
|
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,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -32,7 +32,6 @@ XVRenderer::XVRenderer(QWidget *parent, Qt::WindowFlags f): | |
, VideoRenderer(*new XVRendererPrivate()) | ||
{ | ||
DPTR_INIT_PRIVATE(XVRenderer); | ||
d_func().widget_holder = this; | ||
setAcceptDrops(true); | ||
setFocusPolicy(Qt::StrongFocus); | ||
/* To rapidly update custom widgets that constantly paint over their entire areas with | ||
|
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
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