• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 LOADING_REQUEST_IMPL_H
17 #define LOADING_REQUEST_IMPL_H
18 
19 #include "loading_request.h"
20 #include "media_source.h"
21 #include "nocopyable.h"
22 
23 namespace OHOS {
24 namespace Media {
25 using namespace OHOS::Media::Plugins;
26 class LoadingRequestImpl : public LoadingRequest, public NoCopyable {
27 public:
28     explicit LoadingRequestImpl(const std::shared_ptr<IMediaSourceLoadingRequest> &loadingRequest,
29         std::string url, std::map<std::string, std::string> header);
30     ~LoadingRequestImpl();
31     int32_t RespondData(int64_t uuid, int64_t offset, const std::shared_ptr<AVSharedMemory> &mem) override;
32     int32_t RespondHeader(int64_t uuid, std::map<std::string, std::string> header, std::string redirectUrl) override;
33     int32_t FinishLoading(int64_t uuid, int32_t requestedError) override;
34     uint64_t GetUniqueId() override;
35     std::string GetUrl() override;
36     std::map<std::string, std::string> GetHeader() override;
37 
38 private:
39     std::shared_ptr<IMediaSourceLoadingRequest> loadingRequestCallback_ = nullptr;
40     uint64_t uniqueId_ = 0;
41     std::string url_ {};
42     std::map<std::string, std::string> header_ {};
43 };
44 } // namespace Media
45 } // namespace OHOS
46 #endif // LOADING_REQUEST_IMPL_H