2 // Copyright (C) 2011 The Android Open Source Project
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 // Imports ---------------------------------------------------
18 @import android.filterpacks.videosrc;
19 @import android.filterpacks.videosink;
20 @import android.filterpacks.ui;
21 @import android.filterpacks.base;
22 @import android.filterpacks.imageproc;
24 @import com.google.android.filterpacks.facedetect;
26 @setting autoBranch = "synced";
28 // Externals -------------------------------------------------
30 @external textureSourceCallback;
31 @external recordingWidth;
32 @external recordingHeight;
33 @external recordingProfile;
34 @external recordingDoneListener;
36 @external previewSurfaceTexture;
37 @external previewWidth;
38 @external previewHeight;
40 // Not used by this graph, but simplifies higher-level
41 // graph initialization code.
42 @external orientation;
44 // Filters ---------------------------------------------------
47 @filter SurfaceTextureSource source {
48 sourceListener = $textureSourceCallback;
49 width = $recordingWidth;
50 height = $recordingHeight;
51 closeOnTimeout = true;
55 @filter ToPackedGrayFilter toPackedGray {
58 keepAspectRatio = true;
61 @filter MultiFaceTrackerFilter faceTracker {
62 numChannelsDetector = 3;
69 mouthOnlySmoothing = 0;
70 useAffineCorrection = 1;
75 @filter GoofyFastRenderFilter goofyrenderer {
76 distortionAmount = 1.0;
80 @filter SurfaceTextureTarget display {
81 surfaceTexture = $previewSurfaceTexture;
82 width = $previewWidth;
83 height = $previewHeight;
84 renderMode = "stretch";
87 // Orientation rotation filter
88 @filter FixedRotationFilter rotate {
92 // Orientation rotation filter for facemeta data
93 @filter FaceMetaFixedRotationFilter metarotate {
99 @filter MediaEncoderFilter recorder {
100 recordingProfile = $recordingProfile;
101 recordingDoneListener = $recordingDoneListener;
103 width = $recordingWidth;
104 height = $recordingHeight;
105 // outputFile, orientationHint, inputRegion,
106 // audioSource, listeners, captureRate
107 // will be set when recording starts
110 // Connections -----------------------------------------------
111 // camera -> faceTracker
112 @connect source[video] => rotate[image];
113 @connect rotate[image] => toPackedGray[image];
114 @connect toPackedGray[image] => faceTracker[image];
116 @connect source[video] => goofyrenderer[image];
117 // faceTracker -> metarotate -> goofy
118 @connect faceTracker[faces] => metarotate[faces];
119 @connect metarotate[faces] => goofyrenderer[faces];
120 // goofy -> display out
121 @connect goofyrenderer[outimage] => display[frame];
123 @connect goofyrenderer[outimage] => recorder[videoframe];