1 /* 2 * Copyright (C) 2023 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 IMUXER_ENGINE_H 17 #define IMUXER_ENGINE_H 18 19 #include <cstdint> 20 #include "avsharedmemory.h" 21 #include "media_description.h" 22 #include "av_common.h" 23 #include "avcodec_common.h" 24 25 namespace OHOS { 26 namespace MediaAVCodec { 27 class IMuxerEngine { 28 public: 29 virtual ~IMuxerEngine() = default; 30 virtual int32_t SetRotation(int32_t rotation) = 0; 31 virtual int32_t AddTrack(int32_t &trackIndex, const MediaDescription &trackDesc) = 0; 32 virtual int32_t Start() = 0; 33 virtual int32_t WriteSample(uint32_t trackIndex, std::shared_ptr<AVSharedMemory> sample, 34 AVCodecBufferInfo info, AVCodecBufferFlag flag) = 0; 35 virtual int32_t Stop() = 0; 36 virtual int32_t DumpInfo(int32_t fd) = 0; 37 }; 38 39 class __attribute__((visibility("default"))) IMuxerEngineFactory { 40 public: 41 static std::shared_ptr<IMuxerEngine> CreateMuxerEngine( 42 int32_t appUid, int32_t appPid, int32_t fd, OutputFormat format); 43 private: 44 IMuxerEngineFactory() = default; 45 ~IMuxerEngineFactory() = default; 46 }; 47 } // namespace MediaAVCodec 48 } // namespace OHOS 49 #endif // IMUXER_ENGINE_H