Skip to content

Commit

Permalink
qml: video eq support in VideoOutput2/Video
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 26, 2016
1 parent de60f8f commit 6f900b3
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qml/QmlAV/QuickFBORenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class QuickFBORenderer : public QQuickFramebufferObject, public VideoRenderer
Q_PROPERTY(QSize frameSize READ videoFrameSize NOTIFY videoFrameSizeChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QQmlListProperty<QuickVideoFilter> filters READ filters)
Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY hueChanged)
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
Q_ENUMS(FillMode)
public:
enum FillMode {
Expand Down Expand Up @@ -95,6 +99,10 @@ class QuickFBORenderer : public QQuickFramebufferObject, public VideoRenderer
void sourceAspectRatioChanged(qreal value) Q_DECL_OVERRIDE;
void videoFrameSizeChanged() Q_DECL_OVERRIDE;
void backgroundColorChanged() Q_DECL_OVERRIDE;
void brightnessChanged(qreal value) Q_DECL_OVERRIDE;
void contrastChanged(qreal) Q_DECL_OVERRIDE;
void hueChanged(qreal) Q_DECL_OVERRIDE;
void saturationChanged(qreal) Q_DECL_OVERRIDE;
protected:
bool event(QEvent *e) Q_DECL_OVERRIDE;
bool receiveFrame(const VideoFrame &frame) Q_DECL_OVERRIDE;
Expand All @@ -104,6 +112,10 @@ class QuickFBORenderer : public QQuickFramebufferObject, public VideoRenderer
bool onSetOrientation(int value) Q_DECL_OVERRIDE;
void onSetOutAspectRatio(qreal ratio) Q_DECL_OVERRIDE;
void onSetOutAspectRatioMode(OutAspectRatioMode mode) Q_DECL_OVERRIDE;
bool onSetBrightness(qreal b) Q_DECL_OVERRIDE;
bool onSetContrast(qreal c) Q_DECL_OVERRIDE;
bool onSetHue(qreal h) Q_DECL_OVERRIDE;
bool onSetSaturation(qreal s) Q_DECL_OVERRIDE;
void updateRenderRect();

static void vf_append(QQmlListProperty<QuickVideoFilter> *property, QuickVideoFilter *value);
Expand Down
24 changes: 24 additions & 0 deletions qml/QuickFBORenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,30 @@ void QuickFBORenderer::onSetOutAspectRatioMode(OutAspectRatioMode mode)
d.setupAspectRatio();
}

bool QuickFBORenderer::onSetBrightness(qreal b)
{
d_func().glv.setBrightness(b);
return true;
}

bool QuickFBORenderer::onSetContrast(qreal c)
{
d_func().glv.setContrast(c);
return true;
}

bool QuickFBORenderer::onSetHue(qreal h)
{
d_func().glv.setHue(h);
return true;
}

bool QuickFBORenderer::onSetSaturation(qreal s)
{
d_func().glv.setSaturation(s);
return true;
}

void QuickFBORenderer::updateRenderRect()
{
DPTR_D(QuickFBORenderer);
Expand Down
4 changes: 4 additions & 0 deletions qml/Video.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Item {
property alias audioBackends: player.audioBackends
property alias supportedAudioBackends: player.supportedAudioBackends
property alias backgroundColor: videoOut.backgroundColor
property alias brightness: videoOut.brightness
property alias contrast: videoOut.contrast
property alias hue: videoOut.hue
property alias saturation: videoOut.saturation
property alias frameSize: videoOut.frameSize
property alias sourceAspectRatio: videoOut.sourceAspectRatio
property alias opengl: videoOut.opengl
Expand Down
20 changes: 20 additions & 0 deletions qml/plugins.qmltypes
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ Module {
Property { name: "frameSize"; type: "QSize"; isReadonly: true }
Property { name: "backgroundColor"; type: "QColor" }
Property { name: "filters"; type: "QuickVideoFilter"; isList: true; isReadonly: true }
Property { name: "brightness"; type: "double" }
Property { name: "contrast"; type: "double" }
Property { name: "hue"; type: "double" }
Property { name: "saturation"; type: "double" }
Signal {
name: "fillModeChanged"
Parameter { type: "QuickFBORenderer::FillMode" }
Expand All @@ -391,6 +395,22 @@ Module {
name: "sourceAspectRatioChanged"
Parameter { name: "value"; type: "double" }
}
Signal {
name: "brightnessChanged"
Parameter { name: "value"; type: "double" }
}
Signal {
name: "contrastChanged"
Parameter { type: "double" }
}
Signal {
name: "hueChanged"
Parameter { type: "double" }
}
Signal {
name: "saturationChanged"
Parameter { type: "double" }
}
Method {
name: "mapPointToItem"
type: "QPointF"
Expand Down

0 comments on commit 6f900b3

Please sign in to comment.