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 PLUGIN_CORE_MUXER_H 17 #define PLUGIN_CORE_MUXER_H 18 19 #include "muxer_plugin.h" 20 21 namespace OHOS { 22 namespace MediaAVCodec { 23 namespace Plugin { 24 class Muxer { 25 public: 26 Muxer(const Muxer &) = delete; 27 Muxer operator=(const Muxer &) = delete; 28 ~Muxer() = default; 29 30 Status SetDataSink(const std::shared_ptr<DataSink>& dataSink); 31 Status SetRotation(int32_t rotation); 32 Status AddTrack(int32_t &trackIndex, const MediaDescription &trackDesc); 33 Status Start(); 34 Status WriteSample(uint32_t trackIndex, const uint8_t *sample, AVCodecBufferInfo info, AVCodecBufferFlag flag); 35 Status Stop(); 36 37 private: 38 friend class MuxerFactory; 39 40 Muxer(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<MuxerPlugin> plugin); 41 42 private: 43 const uint32_t pkgVersion_; 44 const uint32_t apiVersion_; 45 std::shared_ptr<MuxerPlugin> muxer_; 46 }; 47 } // namespace Plugin 48 } // namespace MediaAVCodec 49 } // namespace OHOS 50 #endif // PLUGIN_CORE_MUXER_H 51