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 #ifndef AVMUXER_IMPL_H
16 #define AVMUXER_IMPL_H
17 
18 #include "avmuxer.h"
19 #include "media_muxer.h"
20 #include "nocopyable.h"
21 
22 namespace OHOS {
23 namespace MediaAVCodec {
24 class AVMuxerImpl : public AVMuxer, public NoCopyable {
25 public:
26     AVMuxerImpl();
27     ~AVMuxerImpl() override;
28     int32_t Init(int32_t fd, Plugins::OutputFormat format);
29     int32_t SetParameter(const std::shared_ptr<Meta> &param) override;
30     int32_t SetUserMeta(const std::shared_ptr<Meta> &userMeta) override;
31     int32_t AddTrack(int32_t &trackIndex, const std::shared_ptr<Meta> &trackDesc) override;
32     sptr<AVBufferQueueProducer> GetInputBufferQueue(uint32_t trackIndex) override;
33     int32_t Start() override;
34     int32_t WriteSample(uint32_t trackIndex, const std::shared_ptr<AVBuffer> &sample) override;
35     int32_t Stop() override;
36 
37 private:
38     int32_t StatusConvert(Status status);
39 
40 private:
41     std::shared_ptr<Media::MediaMuxer> muxerEngine_ = nullptr;
42 };
43 } // namespace MediaAVCodec
44 } // namespace OHOS
45 #endif // AVMUXER_IMPL_H