IConsumerListener.h (399184a4cd728ea1421fb0bc1722274a29e38f4a) IConsumerListener.h (8dc55396fc9bc425b5e2c82e76a38080f2a655ff)
1/*
2 * Copyright (C) 2013 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

--- 14 unchanged lines hidden (view full) ---

23#include <utils/Errors.h>
24#include <utils/RefBase.h>
25
26#include <binder/IInterface.h>
27
28namespace android {
29// ----------------------------------------------------------------------------
30
1/*
2 * Copyright (C) 2013 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

--- 14 unchanged lines hidden (view full) ---

23#include <utils/Errors.h>
24#include <utils/RefBase.h>
25
26#include <binder/IInterface.h>
27
28namespace android {
29// ----------------------------------------------------------------------------
30
31class BufferItem;
32
31// ConsumerListener is the interface through which the BufferQueue notifies
32// the consumer of events that the consumer may wish to react to. Because
33// the consumer will generally have a mutex that is locked during calls from
34// the consumer to the BufferQueue, these calls from the BufferQueue to the
35// consumer *MUST* be called only when the BufferQueue mutex is NOT locked.
36
37class ConsumerListener : public virtual RefBase {
38public:
39 ConsumerListener() { }
40 virtual ~ConsumerListener() { }
41
42 // onFrameAvailable is called from queueBuffer each time an additional
43 // frame becomes available for consumption. This means that frames that
44 // are queued while in asynchronous mode only trigger the callback if no
45 // previous frames are pending. Frames queued while in synchronous mode
33// ConsumerListener is the interface through which the BufferQueue notifies
34// the consumer of events that the consumer may wish to react to. Because
35// the consumer will generally have a mutex that is locked during calls from
36// the consumer to the BufferQueue, these calls from the BufferQueue to the
37// consumer *MUST* be called only when the BufferQueue mutex is NOT locked.
38
39class ConsumerListener : public virtual RefBase {
40public:
41 ConsumerListener() { }
42 virtual ~ConsumerListener() { }
43
44 // onFrameAvailable is called from queueBuffer each time an additional
45 // frame becomes available for consumption. This means that frames that
46 // are queued while in asynchronous mode only trigger the callback if no
47 // previous frames are pending. Frames queued while in synchronous mode
46 // always trigger the callback.
48 // always trigger the callback. The item passed to the callback will contain
49 // all of the information about the queued frame except for its
50 // GraphicBuffer pointer, which will always be null.
47 //
48 // This is called without any lock held and can be called concurrently
49 // by multiple threads.
51 //
52 // This is called without any lock held and can be called concurrently
53 // by multiple threads.
50 virtual void onFrameAvailable() = 0; /* Asynchronous */
54 virtual void onFrameAvailable(const BufferItem& item) = 0; /* Asynchronous */
51
55
56 // onFrameReplaced is called from queueBuffer if the frame being queued is
57 // replacing an existing slot in the queue. Any call to queueBuffer that
58 // doesn't call onFrameAvailable will call this callback instead. The item
59 // passed to the callback will contain all of the information about the
60 // queued frame except for its GraphicBuffer pointer, which will always be
61 // null.
62 //
63 // This is called without any lock held and can be called concurrently
64 // by multiple threads.
65 virtual void onFrameReplaced(const BufferItem& item) {} /* Asynchronous */
66
52 // onBuffersReleased is called to notify the buffer consumer that the
53 // BufferQueue has released its references to one or more GraphicBuffers
54 // contained in its slots. The buffer consumer should then call
55 // BufferQueue::getReleasedBuffers to retrieve the list of buffers
56 //
57 // This is called without any lock held and can be called concurrently
58 // by multiple threads.
59 virtual void onBuffersReleased() = 0; /* Asynchronous */

--- 30 unchanged lines hidden ---
67 // onBuffersReleased is called to notify the buffer consumer that the
68 // BufferQueue has released its references to one or more GraphicBuffers
69 // contained in its slots. The buffer consumer should then call
70 // BufferQueue::getReleasedBuffers to retrieve the list of buffers
71 //
72 // This is called without any lock held and can be called concurrently
73 // by multiple threads.
74 virtual void onBuffersReleased() = 0; /* Asynchronous */

--- 30 unchanged lines hidden ---