/*
 * Copyright (C) 2019 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_
#define ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_

#include <android/hardware/cas/native/1.0/IDescrambler.h>
#include <media/stagefright/foundation/ABase.h>

namespace android {
struct DescramblerPlugin;
using namespace hardware::cas::native::V1_0;

namespace hardware {
namespace cas {
namespace V1_1 {
namespace implementation {

using ::android::hardware::cas::V1_0::HidlCasSessionId;
using ::android::hardware::cas::V1_0::Status;

class SharedLibrary;

class DescramblerImpl : public IDescrambler {
   public:
    DescramblerImpl(const sp<SharedLibrary>& library, DescramblerPlugin* plugin);
    virtual ~DescramblerImpl();

    virtual Return<Status> setMediaCasSession(const HidlCasSessionId& sessionId) override;

    virtual Return<bool> requiresSecureDecoderComponent(const hidl_string& mime) override;

    virtual Return<void> descramble(ScramblingControl scramblingControl,
                                    const hidl_vec<SubSample>& subSamples,
                                    const SharedBuffer& srcBuffer, uint64_t srcOffset,
                                    const DestinationBuffer& dstBuffer, uint64_t dstOffset,
                                    descramble_cb _hidl_cb) override;

    virtual Return<Status> release() override;

   private:
    sp<SharedLibrary> mLibrary;
    std::shared_ptr<DescramblerPlugin> mPluginHolder;

    DISALLOW_EVIL_CONSTRUCTORS(DescramblerImpl);
};

}  // namespace implementation
}  // namespace V1_1
}  // namespace cas
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_CAS_V1_1_DESCRAMBLER_IMPL_H_
