1 /* 2 * Copyright (C) 2022 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 AVMUXER_DEMO_H 17 #define AVMUXER_DEMO_H 18 19 #include "avmuxer.h" 20 21 namespace OHOS { 22 namespace Media { 23 class AVMuxerDemo : public NoCopyable { 24 public: 25 AVMuxerDemo() = default; 26 ~AVMuxerDemo() = default; 27 void RunCase(); 28 private: 29 bool PushBuffer(std::shared_ptr<std::ifstream> File, const int32_t frameSize, 30 int32_t i, int32_t trackId, int64_t stamp); 31 void WriteTrackSample(); 32 void SetParameter(const std::string &type); 33 bool AddTrackVideo(std::string &videoType); 34 bool AddTrackAudio(std::string &audioType); 35 void DoNext(); 36 void SetMode(int32_t mode); 37 std::shared_ptr<AVMuxer> avmuxer_; 38 int32_t videoTrackId_ = 0; 39 int32_t audioTrackId_ = 0; 40 uint32_t videoTimeDuration_ = 0; 41 uint32_t audioTimeDuration_ = 0; 42 uint32_t videoFrameNum_ = 0; 43 uint32_t audioFrameNum_ = 0; 44 const int32_t *videoFrameArray_ = nullptr; 45 const int32_t *audioFrameArray_ = nullptr; 46 std::shared_ptr<std::ifstream> videoFile_ = nullptr; 47 std::shared_ptr<std::ifstream> audioFile_ = nullptr; 48 std::string videoType_ = std::string(""); 49 std::string audioType_ = std::string(""); 50 std::string path_ = std::string(""); 51 std::string format_ = std::string(""); 52 }; 53 } // namespace Media 54 } // namespace OHOS 55 #endif // AVMUXER_DEMO_H