1 // Copyright 2020 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include "screen-recorder.h" 18 19 #include <stdbool.h> 20 21 typedef struct QAndroidRecordScreenAgent { 22 // Start recording. Returns false if already recording. 23 // |recordingInfo| is the recording information the encoder should use. At 24 // the minimum, the filename cannot be null. For the other parameters, if 25 // the value is invalid, default values will be used in place of them. 26 bool (*startRecording)(const RecordingInfo* recordingInfo); 27 // Async version of startRecording(). Use |recordingInfo->cb| to get the 28 // recording state. 29 bool (*startRecordingAsync)(const RecordingInfo* recordingInfo); 30 31 // Stop recording. 32 bool (*stopRecording)(void); 33 // Async version of stopRecording(). Use |recordingInfo->cb| to get the 34 // recording state. 35 bool (*stopRecordingAsync)(void); 36 // Get the state of the recorder. 37 RecorderStates (*getRecorderState)(void); 38 // Take a screenshot. 39 bool (*doSnap)(const char* dirname, uint32_t displayId); 40 41 // Setup a shared memory region. The framerate should ideally be fps 42 // Returns the name of the memory handle, or null if initialization failed. 43 const char* (*startSharedMemoryModule)(int desiredFps); 44 45 bool (*stopSharedMemoryModule)(); 46 } QAndroidRecordScreenAgent; 47