forked from Igalia/aura
-
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.
Horizontal flip front camera view finder
We would rather show the viewfinder as a mirror by default. The recording would be normal, though. Fixes: Igalia#5.
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 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,4 +1,5 @@ | ||
* Miguel Gómez <[email protected]> | ||
* Xabier Rodriguez Calvar <[email protected]> | ||
* Víctor Jáquez <[email protected]> | ||
* Andrés Gómez <[email protected]> | ||
* Based on the original idea of Jens Wilke <[email 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,11 +1,12 @@ | ||
/* | ||
* This file is part of aura | ||
* | ||
* Copyright (C) 2012 Igalia S.L. | ||
* Copyright (C) 2012, 2013 Igalia S.L. | ||
* | ||
* Contact: Miguel Gómez <[email protected]> | ||
* Xabier Rodriguez Calvar <[email protected]> | ||
* Víctor Jáquez <[email protected]> | ||
* Andrés Gómez <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License | ||
|
@@ -86,6 +87,7 @@ Pipeline::Pipeline(QObject *parent) | |
camerabin(0), | ||
videoSrc(0), | ||
viewfinder(0), | ||
viewfinderFlip(0), | ||
effectBin(0), | ||
effectValve(0), | ||
effect(0), | ||
|
@@ -138,6 +140,9 @@ Pipeline::Pipeline(QObject *parent) | |
g_object_set(camerabin, "audio-encoder", audioEncBin, NULL); | ||
|
||
// viewfinder | ||
viewfinderFlip = gst_element_factory_make("videoflip", NULL); | ||
g_object_set (G_OBJECT (camerabin), "viewfinder-filter", viewfinderFlip, NULL); | ||
|
||
viewfinder = gst_element_factory_make("omapxvsink", NULL); | ||
g_object_set(viewfinder, "autopaint-colorkey", FALSE, NULL); | ||
g_object_set (G_OBJECT (camerabin), "viewfinder-sink", viewfinder, NULL); | ||
|
@@ -338,7 +343,23 @@ void Pipeline::setVideoEffect(const QString &value) | |
void Pipeline::setDevice(ControllerSettings::Device value) | ||
{ | ||
stop(); | ||
g_object_set(videoSrc, "camera-device", value, NULL); | ||
switch (value) { | ||
case ControllerSettings::Primary: | ||
g_object_set(videoSrc, "camera-device", 0, NULL); | ||
// GST_VIDEO_FLIP_METHOD_IDENTITY | ||
g_object_set(viewfinderFlip, "method", 0, NULL); | ||
break; | ||
case ControllerSettings::Secondary: | ||
// When we use the secondary (front) camera, we expect to work | ||
// as a mirror by default *only* in the viewfinder. The | ||
// recording would be normal. | ||
g_object_set(videoSrc, "camera-device", 1, NULL); | ||
// GST_VIDEO_FLIP_METHOD_HORIZ | ||
g_object_set(viewfinderFlip, "method", 4, NULL); | ||
break; | ||
default: | ||
Q_ASSERT(0 != instancePointer); | ||
} | ||
start(); | ||
} | ||
|
||
|
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,11 +1,12 @@ | ||
/* | ||
* This file is part of aura | ||
* | ||
* Copyright (C) 2012 Igalia S.L. | ||
* Copyright (C) 2012, 2013 Igalia S.L. | ||
* | ||
* Contact: Miguel Gómez <[email protected]> | ||
* Xabier Rodriguez Calvar <[email protected]> | ||
* Víctor Jáquez <[email protected]> | ||
* Andrés Gómez <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License | ||
|
@@ -88,6 +89,7 @@ class Pipeline : public QObject | |
GstElement *camerabin; | ||
GstElement *videoSrc; | ||
GstElement *viewfinder; | ||
GstElement *viewfinderFlip; | ||
|
||
GstElement *effectBin; | ||
GstElement *effectValve; | ||
|