1 /*
2 * Copyright (c) 2021-2021 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 "plugin/core/muxer.h"
17 #include "plugin/core/plugin_wrapper.h"
18 #include "plugin/interface/muxer_plugin.h"
19
20 namespace OHOS {
21 namespace Media {
22 namespace Plugin {
Muxer(uint32_t pkgVer,uint32_t apiVer,std::shared_ptr<MuxerPlugin> plugin)23 Muxer::Muxer (uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<MuxerPlugin> plugin)
24 : Base(pkgVer, apiVer, plugin), muxer_(std::move(plugin)) {}
25
SetTrackParameter(uint32_t trackId,Plugin::Tag tag,const Plugin::ValueType & value)26 Status Muxer::SetTrackParameter(uint32_t trackId, Plugin::Tag tag, const Plugin::ValueType& value)
27 {
28 return muxer_->SetTrackParameter(trackId, tag, value);
29 }
GetTrackParameter(uint32_t trackId,Plugin::Tag tag,Plugin::ValueType & value)30 Status Muxer::GetTrackParameter(uint32_t trackId, Plugin::Tag tag, Plugin::ValueType& value)
31 {
32 return muxer_->GetTrackParameter(trackId, tag, value);
33 }
AddTrack(uint32_t & trackId)34 Status Muxer::AddTrack(uint32_t& trackId)
35 {
36 return muxer_->AddTrack(trackId);
37 }
SetDataSink(const std::shared_ptr<DataSinkHelper> & dataSink)38 Status Muxer::SetDataSink(const std::shared_ptr<DataSinkHelper>& dataSink)
39 {
40 return muxer_->SetDataSink(std::make_shared<DataSinkWrapper>(pkgVersion_, dataSink));
41 }
WriteHeader()42 Status Muxer::WriteHeader()
43 {
44 return muxer_->WriteHeader();
45 }
WriteFrame(const std::shared_ptr<Buffer> & buffer)46 Status Muxer::WriteFrame(const std::shared_ptr<Buffer>& buffer)
47 {
48 return muxer_->WriteFrame(buffer);
49 }
WriteTrailer()50 Status Muxer::WriteTrailer()
51 {
52 return muxer_->WriteTrailer();
53 }
54 } // namespace Plugin
55 } // namespace Media
56 } // namespace OHOS