AIDL BufferPool implementation (HIDL -> AIDL)
Bug: 254050250
Test: m
Change-Id: I0d7bae2c01bd480d1e99f4b39c4a9013a2828897
diff --git a/media/bufferpool/aidl/default/BufferPoolClient.h b/media/bufferpool/aidl/default/BufferPoolClient.h
index e8d9ae6..80fd43e 100644
--- a/media/bufferpool/aidl/default/BufferPoolClient.h
+++ b/media/bufferpool/aidl/default/BufferPoolClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,29 +14,19 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H
-#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H
+#pragma once
#include <memory>
-#include <android/hardware/media/bufferpool/2.0/IAccessor.h>
-#include <android/hardware/media/bufferpool/2.0/IConnection.h>
-#include <android/hardware/media/bufferpool/2.0/IObserver.h>
-#include <bufferpool/BufferPoolTypes.h>
-#include <cutils/native_handle.h>
-#include "Accessor.h"
+#include <aidl/android/hardware/media/bufferpool2/IAccessor.h>
+#include <aidl/android/hardware/media/bufferpool2/IObserver.h>
+#include <bufferpool2/BufferPoolTypes.h>
-namespace android {
-namespace hardware {
-namespace media {
-namespace bufferpool {
-namespace V2_0 {
-namespace implementation {
+namespace aidl::android::hardware::media::bufferpool2::implementation {
-using ::android::hardware::media::bufferpool::V2_0::IAccessor;
-using ::android::hardware::media::bufferpool::V2_0::IConnection;
-using ::android::hardware::media::bufferpool::V2_0::IObserver;
-using ::android::hardware::media::bufferpool::V2_0::ResultStatus;
-using ::android::sp;
+using aidl::android::hardware::media::bufferpool2::IAccessor;
+using aidl::android::hardware::media::bufferpool2::IObserver;
+
+struct Accessor;
/**
* A buffer pool client for a buffer pool. For a specific buffer pool, at most
@@ -49,8 +39,8 @@
* Creates a buffer pool client from a local buffer pool
* (via ClientManager#create).
*/
- explicit BufferPoolClient(const sp<Accessor> &accessor,
- const sp<IObserver> &observer);
+ explicit BufferPoolClient(const std::shared_ptr<Accessor> &accessor,
+ const std::shared_ptr<IObserver> &observer);
/**
* Creates a buffer pool client from a remote buffer pool
@@ -58,8 +48,8 @@
* Note: A buffer pool client created with remote buffer pool cannot
* allocate a buffer.
*/
- explicit BufferPoolClient(const sp<IAccessor> &accessor,
- const sp<IObserver> &observer);
+ explicit BufferPoolClient(const std::shared_ptr<IAccessor> &accessor,
+ const std::shared_ptr<IObserver> &observer);
/** Destructs a buffer pool client. */
~BufferPoolClient();
@@ -69,30 +59,30 @@
bool isLocal();
- bool isActive(int64_t *lastTransactionUs, bool clearCache);
+ bool isActive(int64_t *lastTransactionMs, bool clearCache);
ConnectionId getConnectionId();
- ResultStatus getAccessor(sp<IAccessor> *accessor);
+ BufferPoolStatus getAccessor(std::shared_ptr<IAccessor> *accessor);
void receiveInvalidation(uint32_t msgId);
- ResultStatus flush();
+ BufferPoolStatus flush();
- ResultStatus allocate(const std::vector<uint8_t> ¶ms,
+ BufferPoolStatus allocate(const std::vector<uint8_t> ¶ms,
native_handle_t **handle,
std::shared_ptr<BufferPoolData> *buffer);
- ResultStatus receive(TransactionId transactionId,
+ BufferPoolStatus receive(TransactionId transactionId,
BufferId bufferId,
- int64_t timestampUs,
+ int64_t timestampMs,
native_handle_t **handle,
std::shared_ptr<BufferPoolData> *buffer);
- ResultStatus postSend(ConnectionId receiver,
+ BufferPoolStatus postSend(ConnectionId receiver,
const std::shared_ptr<BufferPoolData> &buffer,
TransactionId *transactionId,
- int64_t *timestampUs);
+ int64_t *timestampMs);
class Impl;
std::shared_ptr<Impl> mImpl;
@@ -101,11 +91,4 @@
friend struct Observer;
};
-} // namespace implementation
-} // namespace V2_0
-} // namespace bufferpool
-} // namespace media
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H
+} // namespace aidl::android::hardware::bufferpool2::implementation