The CameraEffect API, by design, is a hook for inserting code. So it doesn't support chaining by nature.
However, it's not difficult to create a CameraEffect that composites multiple CameraEffect implementations. Pseudo code:
SurfaceProsessor {
val wrappedProcessor1
val wrappedProcessor2
onInputSurface(surfaceRequest) {
// 1. send surfaceRequest to wrapperProcessor1
// 2. create a SurfaceOutput that mimic the surfaceRequest and send to wrapperProcessor1
// 3. create a second surfaceRequest and send to wrappedProcessor2
}
onOutpuSurface(surfaceOutput) {
// send surfaceOutput to wrappedProcessor2
}
}
The challenging part is calculating the transformation needed in step2. This might be a useful feature for the CameraX team to build in
camera-effects. Adding Scott to triage.