1 /* 2 * Copyright (C) 2015 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 package com.android.camera.one.v2.camera2proxy; 18 19 import android.os.Handler; 20 import android.view.Surface; 21 22 import javax.annotation.Nonnull; 23 import javax.annotation.Nullable; 24 25 public abstract class ForwardingImageReader implements ImageReaderProxy { 26 private final ImageReaderProxy mDelegate; 27 28 public ForwardingImageReader(ImageReaderProxy delegate) { 29 mDelegate = delegate; 30 } 31 32 @Override 33 public int getWidth() { 34 return mDelegate.getWidth(); 35 } 36 37 @Override 38 public int getHeight() { 39 return mDelegate.getHeight(); 40 } 41 42 @Override 43 public int getImageFormat() { 44 return mDelegate.getImageFormat(); 45 } 46 47 @Override 48 public int getMaxImages() { 49 return mDelegate.getMaxImages(); 50 } 51 52 @Override 53 @Nonnull 54 public Surface getSurface() { 55 return mDelegate.getSurface(); 56 } 57 58 @Override 59 @Nullable 60 public ImageProxy acquireLatestImage() { 61 return mDelegate.acquireLatestImage(); 62 } 63 64 @Override 65 @Nullable 66 public ImageProxy acquireNextImage() { 67 return mDelegate.acquireNextImage(); 68 } 69 70 @Override 71 public void setOnImageAvailableListener(@Nonnull 72 final OnImageAvailableListener listener, 73 @Nullable Handler handler) { 74 mDelegate.setOnImageAvailableListener(listener, handler); 75 } 76 77 @Override 78 public void close() { 79 mDelegate.close(); 80 } 81 82 @Override 83 public String toString() { 84 return mDelegate.toString(); 85 } 86 } 87