1 /* 2 * Copyright (c) 2024 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 MEDIA_SOURCE_FFI_H 17 #define MEDIA_SOURCE_FFI_H 18 19 #include "cj_common_ffi.h" 20 #include "ffi_remote_data.h" 21 #include "player.h" 22 23 namespace OHOS { 24 namespace Media { 25 26 struct Header { 27 char *key; 28 char *value; 29 }; 30 31 struct ArrHeaders { 32 Header *headers; 33 int64_t size; 34 }; 35 36 class CJMediaSource : public OHOS::FFI::FFIData { 37 DECL_TYPE(CJMediaSource, OHOS::FFI::FFIData) 38 public: 39 CJMediaSource(std::string sourceUrl, std::map<std::string, std::string> sourceHeader); 40 ~CJMediaSource() = default; 41 42 std::shared_ptr<AVMediaSource> mediaSource{nullptr}; 43 }; 44 extern "C" { 45 // MediaSource 46 FFI_EXPORT int64_t FfiMediaCreateMediaSourceWithUrl(char *url, ArrHeaders headers, int32_t *errCode); 47 } // extern "C" 48 } // namespace Media 49 } // namespace OHOS 50 #endif