xref: /aosp_15_r20/frameworks/av/media/libstagefright/tests/writer/WriterListener.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2020 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 WRITER_LISTENER_H_
18 #define WRITER_LISTENER_H_
19 
20 #include <mutex>
21 
22 #include <media/IMediaRecorderClient.h>
23 #include <media/mediarecorder.h>
24 
25 using namespace android;
26 using namespace std;
27 
28 class WriterListener : public BnMediaRecorderClient {
29   public:
WriterListener()30     WriterListener() : mSignaledSize(false), mSignaledDuration(false) {}
31 
notify(int32_t msg,int32_t ext1,int32_t ext2)32     virtual void notify(int32_t msg, int32_t ext1, int32_t ext2) {
33         ALOGV("msg : %d, ext1 : %d, ext2 : %d", msg, ext1, ext2);
34         if (ext1 == MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED) {
35             mSignaledSize = true;
36         } else if (ext1 == MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) {
37             mSignaledDuration = true;
38         }
39     }
40 
41     volatile bool mSignaledSize;
42     volatile bool mSignaledDuration;
43 };
44 
45 #endif  // WRITER_LISTENER_H_
46