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 "demuxer.h"
17 #include "avcodec_errors.h"
18 #include "demuxer_plugin.h"
19
20 namespace OHOS {
21 namespace MediaAVCodec {
22 namespace Plugin {
23 using namespace Media;
Demuxer(uint32_t pkgVer,uint32_t apiVer,std::shared_ptr<DemuxerPlugin> plugin)24 Demuxer::Demuxer(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<DemuxerPlugin> plugin)
25 : pkgVersion_(pkgVer), apiVersion_(apiVer), demuxer_(std::move(plugin)) {}
26
SelectTrackByID(uint32_t trackIndex)27 int32_t Demuxer::SelectTrackByID(uint32_t trackIndex)
28 {
29 return demuxer_->SelectTrackByID(trackIndex);
30 }
31
UnselectTrackByID(uint32_t trackIndex)32 int32_t Demuxer::UnselectTrackByID(uint32_t trackIndex)
33 {
34 return demuxer_->UnselectTrackByID(trackIndex);
35 }
36
ReadSample(uint32_t trackIndex,std::shared_ptr<AVBuffer> sample)37 int32_t Demuxer::ReadSample(uint32_t trackIndex, std::shared_ptr<AVBuffer> sample)
38 {
39 return demuxer_->ReadSample(trackIndex, sample);
40 }
41
SeekToTime(int64_t millisecond,AVSeekMode mode)42 int32_t Demuxer::SeekToTime(int64_t millisecond, AVSeekMode mode)
43 {
44 int32_t ret = demuxer_->SeekToTime(millisecond, mode);
45 return ret;
46 }
47 } // namespace Plugin
48 } // namespace MediaAVCodec
49 } // namespace OHOS