Home | History | Annotate | Download | only in raw
      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 previewSurface;
     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 SurfaceTargetFilter display {
     69   surface = $previewSurface;
     70   owidth = $previewWidth;
     71   oheight = $previewHeight;
     72 }
     73 
     74 // Recording output
     75 @filter MediaEncoderFilter recorder {
     76   recordingProfile = $recordingProfile;
     77   recordingDoneListener = $recordingDoneListener;
     78   recording = false;
     79   // outputFile, orientationHint, inputRegion,
     80   // audioSource, listeners, captureRate
     81   // will be set when recording starts
     82 }
     83 
     84 // Connections -----------------------------------------------
     85 @connect source[video] => replacer[video];
     86 @connect background[video] => replacer[background];
     87 @connect replacer[video] => display[frame];
     88 @connect replacer[video] => recorder[videoframe];
     89 
     90