Home | History | Annotate | Download | only in device3
      1 /*
      2  * Copyright (C) 2017 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 #ifndef ANDROID_SERVERS_CAMERA3_STREAMBUFFERFREEDLISTENER_H
     18 #define ANDROID_SERVERS_CAMERA3_STREAMBUFFERFREEDLISTENER_H
     19 
     20 #include <gui/Surface.h>
     21 #include <utils/RefBase.h>
     22 
     23 namespace android {
     24 
     25 namespace camera3 {
     26 
     27 class Camera3StreamBufferFreedListener : public virtual RefBase {
     28 public:
     29     // onBufferFreed is called when a buffer is no longer being managed
     30     // by this stream. This will not be called in events when all
     31     // buffers are freed due to stream disconnection.
     32     //
     33     // The input handle may be deleted after this callback ends, so attempting
     34     // to dereference handle post this callback is illegal and might lead to
     35     // crash.
     36     //
     37     // This callback will be called while holding Camera3Stream's lock, so
     38     // calling into other Camera3Stream APIs within this callback will
     39     // lead to deadlock.
     40     virtual void onBufferFreed(int streamId, const native_handle_t* handle) = 0;
     41 
     42     virtual ~Camera3StreamBufferFreedListener() {}
     43 };
     44 
     45 }; //namespace camera3
     46 }; //namespace android
     47 
     48 #endif
     49