1 /* 2 * Copyright (c) 2021-2021 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 HISTREAMER_PLUGIN_CORE_WRAPPER_H 17 #define HISTREAMER_PLUGIN_CORE_WRAPPER_H 18 19 #include "foundation/pre_defines.h" 20 #include "plugin/core/demuxer.h" 21 #include "plugin/core/muxer.h" 22 #include "plugin/interface/demuxer_plugin.h" 23 #include "plugin/interface/muxer_plugin.h" 24 25 namespace OHOS { 26 namespace Media { 27 namespace Plugin { 28 struct DataSourceWrapper : DataSource { 29 DataSourceWrapper(uint32_t pkgVersion, std::shared_ptr<DataSourceHelper> dataSource); 30 ~DataSourceWrapper() override = default; 31 32 Status ReadAt(int64_t offset, std::shared_ptr<Buffer>& buffer, size_t expectedLen) override; 33 Status GetSize(uint64_t& size) override; 34 Seekable GetSeekable() override; 35 private: 36 MEDIA_UNUSED uint32_t version; 37 std::shared_ptr<DataSourceHelper> helper; 38 }; 39 40 struct DataSinkWrapper : DataSink { 41 DataSinkWrapper(uint32_t pkgVersion, std::shared_ptr<DataSinkHelper> dataSink); 42 ~DataSinkWrapper() override = default; 43 Status WriteAt(int64_t offset, const std::shared_ptr<Buffer>& buffer) override; 44 private: 45 MEDIA_UNUSED uint32_t version; 46 std::shared_ptr<DataSinkHelper> helper; 47 }; 48 void ConvertToMediaInfoHelper(uint32_t pkgVersion, const MediaInfo& src, MediaInfoHelper& dest); 49 } // namespace Plugin 50 } // namespace Media 51 } // namespace OHOS 52 #endif // HISTREAMER_PLUGIN_CORE_WRAPPER_H 53