• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {
Demuxer(uint32_t pkgVer,uint32_t apiVer,std::shared_ptr<DemuxerPlugin> plugin)23 Demuxer::Demuxer(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<DemuxerPlugin> plugin)
24     : pkgVersion_(pkgVer), apiVersion_(apiVer), demuxer_(std::move(plugin)) {}
25 
SelectTrackByID(uint32_t trackIndex)26 int32_t Demuxer::SelectTrackByID(uint32_t trackIndex)
27 {
28     return demuxer_->SelectTrackByID(trackIndex);
29 }
30 
UnselectTrackByID(uint32_t trackIndex)31 int32_t Demuxer::UnselectTrackByID(uint32_t trackIndex)
32 {
33     return demuxer_->UnselectTrackByID(trackIndex);
34 }
35 
ReadSample(uint32_t trackIndex,std::shared_ptr<AVSharedMemory> sample,AVCodecBufferInfo & info,AVCodecBufferFlag & flag)36 int32_t Demuxer::ReadSample(uint32_t trackIndex, std::shared_ptr<AVSharedMemory> sample,
37     AVCodecBufferInfo &info, AVCodecBufferFlag &flag)
38 {
39     return demuxer_->ReadSample(trackIndex, sample, info, flag);
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