1 /* 2 * Copyright (C) 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 FRAMEWORKS_INNERKITSIMPL_STREAM_INCLUDE_SOURCE_STREAM_H 17 #define FRAMEWORKS_INNERKITSIMPL_STREAM_INCLUDE_SOURCE_STREAM_H 18 19 #include <cinttypes> 20 #include <string> 21 #include "image/input_data_stream.h" 22 #include "media_errors.h" 23 24 namespace OHOS { 25 namespace Media { 26 constexpr int SOURCE_STREAM_INVALID_FD = -1; 27 const std::string SOURCE_STREAM_INVALID_PATH = ""; 28 29 class SourceStream : public ImagePlugin::InputDataStream { 30 public: UpdateData(const uint8_t * data,uint32_t size,bool isCompleted)31 virtual uint32_t UpdateData(const uint8_t *data, uint32_t size, bool isCompleted) 32 { 33 return ERR_IMAGE_DATA_UNSUPPORT; 34 } 35 GetOriginalFd()36 virtual int GetOriginalFd() 37 { 38 return originalFd_; 39 } 40 GetOriginalPath()41 virtual std::string GetOriginalPath() 42 { 43 return originalPath_; 44 } 45 46 protected: 47 int originalFd_ = SOURCE_STREAM_INVALID_FD; 48 std::string originalPath_ = SOURCE_STREAM_INVALID_PATH; 49 }; 50 } // namespace Media 51 } // namespace OHOS 52 53 #endif // FRAMEWORKS_INNERKITSIMPL_STREAM_INCLUDE_SOURCE_STREAM_H 54