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