1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 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 16 #ifndef OHOS_DECODE_SURFACE_LISTENER_H 17 #define OHOS_DECODE_SURFACE_LISTENER_H 18 19 #include "surface.h" 20 #include "ibuffer_consumer_listener.h" 21 22 #include "decode_data_process.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 class DecodeDataProcess; 27 28 class DecodeSurfaceListener : public IBufferConsumerListener { 29 public: DecodeSurfaceListener(sptr<IConsumerSurface> surface,std::weak_ptr<DecodeDataProcess> decodeVideoNode)30 DecodeSurfaceListener(sptr<IConsumerSurface> surface, std::weak_ptr<DecodeDataProcess> decodeVideoNode) 31 : surface_(surface), decodeVideoNode_(decodeVideoNode) {} 32 ~DecodeSurfaceListener() override; 33 34 void OnBufferAvailable() override; 35 void SetSurface(const sptr<IConsumerSurface>& surface); 36 void SetDecodeVideoNode(const std::weak_ptr<DecodeDataProcess>& decodeVideoNode); 37 sptr<IConsumerSurface> GetSurface() const; 38 std::shared_ptr<DecodeDataProcess> GetDecodeVideoNode() const; 39 40 private: 41 sptr<IConsumerSurface> surface_; 42 std::weak_ptr<DecodeDataProcess> decodeVideoNode_; 43 }; 44 } // namespace DistributedHardware 45 } // namespace OHOS 46 #endif // OHOS_DECODE_SURFACE_LISTENER_H 47