1// 2// Copyright (C) 2011 The Android Open Source Project 3// 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 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 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. 15// 16 17// Imports --------------------------------------------------- 18@import android.filterpacks.base; 19@import android.filterpacks.ui; 20@import android.filterpacks.videosrc; 21@import android.filterpacks.videoproc; 22@import android.filterpacks.videosink; 23 24@setting autoBranch = "synced"; 25 26// Externals ------------------------------------------------- 27 28@external textureSourceCallback; 29@external recordingWidth; 30@external recordingHeight; 31@external recordingProfile; 32@external recordingDoneListener; 33 34@external previewSurfaceTexture; 35@external previewWidth; 36@external previewHeight; 37 38@external orientation; 39 40@external learningDoneListener; 41 42// Filters --------------------------------------------------- 43 44// Camera input 45@filter SurfaceTextureSource source { 46 sourceListener = $textureSourceCallback; 47 width = $recordingWidth; 48 height = $recordingHeight; 49 closeOnTimeout = true; 50} 51 52// Background video input 53@filter MediaSource background { 54 sourceUrl = "no_file_specified"; 55 waitForNewFrame = false; 56 sourceIsUrl = true; 57 orientation = $orientation; 58} 59 60// Background replacer 61@filter BackDropperFilter replacer { 62 autowbToggle = 1; 63 learningDoneListener = $learningDoneListener; 64 orientation = $orientation; 65} 66 67// Display output 68@filter SurfaceTextureTarget display { 69 surfaceTexture = $previewSurfaceTexture; 70 width = $previewWidth; 71 height = $previewHeight; 72} 73 74// Recording output 75@filter MediaEncoderFilter recorder { 76 recordingProfile = $recordingProfile; 77 recordingDoneListener = $recordingDoneListener; 78 recording = false; 79 width = $recordingWidth; 80 height = $recordingHeight; 81 // outputFile, orientationHint, inputRegion, 82 // audioSource, listeners, captureRate 83 // will be set when recording starts 84} 85 86// Connections ----------------------------------------------- 87@connect source[video] => replacer[video]; 88@connect background[video] => replacer[background]; 89@connect replacer[video] => display[frame]; 90@connect replacer[video] => recorder[videoframe]; 91 92