• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "av_codec_proxy.h"
16 #include "camera_log.h"
17 
18 namespace OHOS {
19 namespace CameraStandard {
20 typedef AVCodecIntf* (*CreateAVCodecIntf)();
21 
AVCodecProxy(std::shared_ptr<Dynamiclib> avcodecLib,std::shared_ptr<AVCodecIntf> avcodecIntf)22 AVCodecProxy::AVCodecProxy(std::shared_ptr<Dynamiclib> avcodecLib, std::shared_ptr<AVCodecIntf> avcodecIntf)
23     : avcodecLib_(avcodecLib), avcodecIntf_(avcodecIntf)
24 {
25     MEDIA_DEBUG_LOG("AVCodecProxy constructor");
26     CHECK_RETURN_ELOG(avcodecLib_ == nullptr, "avcodecLib is nullptr");
27     CHECK_RETURN_ELOG(avcodecIntf_ == nullptr, "avcodecIntf is nullptr");
28 }
29 
~AVCodecProxy()30 AVCodecProxy::~AVCodecProxy()
31 {
32     MEDIA_DEBUG_LOG("AVCodecProxy destructor");
33 }
34 
CreateAVCodecProxy()35 std::shared_ptr<AVCodecProxy> AVCodecProxy::CreateAVCodecProxy()
36 {
37     std::shared_ptr<Dynamiclib> dynamiclib = CameraDynamicLoader::GetDynamiclib(AV_CODEC_SO);
38     CHECK_RETURN_RET_ELOG(dynamiclib == nullptr, nullptr, "Failed to load media library");
39     CreateAVCodecIntf createAVCodecIntf =
40         (CreateAVCodecIntf)dynamiclib->GetFunction("createAVCodecIntf");
41     CHECK_RETURN_RET_ELOG(
42         createAVCodecIntf == nullptr, nullptr, "Failed to get createAVCodecInf function");
43     AVCodecIntf* avcodecIntf = createAVCodecIntf();
44     CHECK_RETURN_RET_ELOG(
45         avcodecIntf == nullptr, nullptr, "Failed to create AVCodecIntf instance");
46     std::shared_ptr<AVCodecProxy> avcodecProxy =
47         std::make_shared<AVCodecProxy>(dynamiclib, std::shared_ptr<AVCodecIntf>(avcodecIntf));
48     return avcodecProxy;
49 }
50 
CreateAVMuxer(int32_t fd,OutputFormat format)51 int32_t AVCodecProxy::CreateAVMuxer(int32_t fd, OutputFormat format)
52 {
53     MEDIA_DEBUG_LOG("CreateAVMuxer start");
54     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is nullptr");
55     auto ret = avcodecIntf_->CreateAVMuxer(fd, format);
56     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "CreateAVMuxer failed, ret: %{public}d", ret);
57     MEDIA_DEBUG_LOG("CreateAVMuxer success");
58     return ret;
59 }
60 
CreateAVCodecVideoEncoder(const std::string & codecMime)61 int32_t AVCodecProxy::CreateAVCodecVideoEncoder(const std::string& codecMime)
62 {
63     MEDIA_DEBUG_LOG("CreateAVCodecVideoEncoder start");
64     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is nullptr");
65     int32_t ret = avcodecIntf_->CreateAVCodecVideoEncoder(codecMime);
66     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED,
67         "CreateAVCodecVideoEncoder failed, ret: %{public}d", ret);
68     MEDIA_DEBUG_LOG("CreateAVCodecVideoEncoder success");
69     return ret;
70 }
71 
AVMuxerSetParameter(const std::shared_ptr<Meta> & param)72 int32_t AVCodecProxy::AVMuxerSetParameter(const std::shared_ptr<Meta>& param)
73 {
74     MEDIA_DEBUG_LOG("AVMuxerSetParameter start");
75     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
76     CHECK_RETURN_RET_ELOG(param == nullptr, AV_ERR_INVALID_VAL, "input param is nullptr!");
77     int32_t ret = avcodecIntf_->AVMuxerSetParameter(param);
78     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerSetParameter failed, ret: %{public}d", ret);
79     MEDIA_DEBUG_LOG("AVMuxerSetParameter end");
80     return ret;
81 }
82 
AVMuxerSetUserMeta(const std::shared_ptr<Meta> & userMeta)83 int32_t AVCodecProxy::AVMuxerSetUserMeta(const std::shared_ptr<Meta>& userMeta)
84 {
85     MEDIA_DEBUG_LOG("AVMuxerSetUserMeta start");
86     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
87     CHECK_RETURN_RET_ELOG(userMeta == nullptr, AV_ERR_INVALID_VAL, "input userMeta is nullptr!");
88     int32_t ret = avcodecIntf_->AVMuxerSetUserMeta(userMeta);
89     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerSetUserMeta failed, ret: %{public}d", ret);
90     MEDIA_DEBUG_LOG("AVMuxerSetUserMeta end");
91     return ret;
92 }
93 
AVMuxerAddTrack(int32_t & trackIndex,const std::shared_ptr<Meta> & trackDesc)94 int32_t AVCodecProxy::AVMuxerAddTrack(int32_t& trackIndex, const std::shared_ptr<Meta>& trackDesc)
95 {
96     MEDIA_DEBUG_LOG("AVMuxerAddTrack start");
97     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
98     CHECK_RETURN_RET_ELOG(trackDesc == nullptr, AV_ERR_INVALID_VAL, "input trackDesc is nullptr!");
99     int32_t ret = avcodecIntf_->AVMuxerAddTrack(trackIndex, trackDesc);
100     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerAddTrack failed, ret: %{public}d", ret);
101     MEDIA_DEBUG_LOG("AVMuxerAddTrack end");
102     return ret;
103 }
104 
AVMuxerStart()105 int32_t AVCodecProxy::AVMuxerStart()
106 {
107     MEDIA_DEBUG_LOG("AVMuxerStart start");
108     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
109     int32_t ret = avcodecIntf_->AVMuxerStart();
110     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerStart failed, ret: %{public}d", ret);
111     MEDIA_DEBUG_LOG("AVMuxerStart end");
112     return ret;
113 }
114 
AVMuxerWriteSample(uint32_t trackIndex,const std::shared_ptr<AVBuffer> & sample)115 int32_t AVCodecProxy::AVMuxerWriteSample(uint32_t trackIndex, const std::shared_ptr<AVBuffer>& sample)
116 {
117     MEDIA_DEBUG_LOG("AVMuxerWriteSampleBuffer start");
118     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
119     CHECK_RETURN_RET_ELOG(sample == nullptr, AV_ERR_INVALID_VAL, "input sample is nullptr!");
120     int32_t ret = avcodecIntf_->AVMuxerWriteSample(trackIndex, sample);
121     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerWriteSample failed, ret: %{public}d", ret);
122     MEDIA_DEBUG_LOG("AVMuxerWriteSampleBuffer end");
123     return ret;
124 }
125 
AVMuxerStop()126 int32_t AVCodecProxy::AVMuxerStop()
127 {
128     MEDIA_DEBUG_LOG("AVMuxerStop start");
129     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
130     int32_t ret = avcodecIntf_->AVMuxerStop();
131     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVMuxerStop failed, ret: %{public}d", ret);
132     MEDIA_DEBUG_LOG("AVMuxerStop end");
133     return ret;
134 }
135 
AVCodecVideoEncoderPrepare()136 int32_t AVCodecProxy::AVCodecVideoEncoderPrepare()
137 {
138     MEDIA_DEBUG_LOG("AVCodecVideoEncoderPrepare start");
139     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
140     int32_t ret = avcodecIntf_->AVCodecVideoEncoderPrepare();
141     CHECK_RETURN_RET_ELOG(
142         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderPrepare failed, ret: %{public}d", ret);
143     MEDIA_DEBUG_LOG("AVCodecVideoEncoderPrepare end");
144     return ret;
145 }
146 
AVCodecVideoEncoderStart()147 int32_t AVCodecProxy::AVCodecVideoEncoderStart()
148 {
149     MEDIA_DEBUG_LOG("AVCodecVideoEncoderStart start");
150     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
151     int32_t ret = avcodecIntf_->AVCodecVideoEncoderStart();
152     CHECK_RETURN_RET_ELOG(
153         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderStart failed, ret: %{public}d", ret);
154     MEDIA_DEBUG_LOG("AVCodecVideoEncoderStart end");
155     return ret;
156 }
157 
AVCodecVideoEncoderStop()158 int32_t AVCodecProxy::AVCodecVideoEncoderStop()
159 {
160     MEDIA_DEBUG_LOG("AVCodecVideoEncoderStop start");
161     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
162     int32_t ret = avcodecIntf_->AVCodecVideoEncoderStop();
163     CHECK_RETURN_RET_ELOG(
164         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderStop failed, ret: %{public}d", ret);
165     MEDIA_DEBUG_LOG("AVCodecVideoEncoderStop end");
166     return ret;
167 }
168 
AVCodecVideoEncoderRelease()169 int32_t AVCodecProxy::AVCodecVideoEncoderRelease()
170 {
171     MEDIA_DEBUG_LOG("AVCodecVideoEncoderRelease start");
172     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
173     int32_t ret = avcodecIntf_->AVCodecVideoEncoderRelease();
174     CHECK_RETURN_RET_ELOG(
175         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderRelease failed, ret: %{public}d", ret);
176     MEDIA_DEBUG_LOG("AVCodecVideoEncoderRelease end");
177     return ret;
178 }
179 
IsVideoEncoderExisted()180 bool AVCodecProxy::IsVideoEncoderExisted()
181 {
182     MEDIA_DEBUG_LOG("IsVideoEncoderExisted start");
183     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, false, "avcodecIntf_ is not created");
184     bool isExisted = avcodecIntf_->IsVideoEncoderExisted();
185     MEDIA_DEBUG_LOG("IsVideoEncoderExisted end");
186     return isExisted;
187 }
188 
CreateInputSurface()189 sptr<Surface> AVCodecProxy::CreateInputSurface()
190 {
191     MEDIA_DEBUG_LOG("CreateInputSurface start");
192     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, nullptr, "avcodecIntf_ is not created");
193     sptr<Surface> surface = avcodecIntf_->CreateInputSurface();
194     CHECK_RETURN_RET_ELOG(surface == nullptr, nullptr, "CreateInputSurface failed");
195     MEDIA_DEBUG_LOG("CreateInputSurface end");
196     return surface;
197 }
198 
QueueInputBuffer(uint32_t index)199 int32_t AVCodecProxy::QueueInputBuffer(uint32_t index)
200 {
201     MEDIA_DEBUG_LOG("QueueInputBuffer start");
202     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
203     int32_t ret = avcodecIntf_->QueueInputBuffer(index);
204     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "QueueInputBuffer failed, ret: %{public}d", ret);
205     MEDIA_DEBUG_LOG("QueueInputBuffer end");
206     return ret;
207 }
208 
AVCodecVideoEncoderNotifyEos()209 int32_t AVCodecProxy::AVCodecVideoEncoderNotifyEos()
210 {
211     MEDIA_DEBUG_LOG("AVCodecVideoEncoderNotifyEos start");
212     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
213     int32_t ret = avcodecIntf_->AVCodecVideoEncoderNotifyEos();
214     CHECK_RETURN_RET_ELOG(
215         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderNotifyEos failed, ret: %{public}d", ret);
216     MEDIA_DEBUG_LOG("AVCodecVideoEncoderNotifyEos end");
217     return ret;
218 }
219 
ReleaseOutputBuffer(uint32_t index)220 int32_t AVCodecProxy::ReleaseOutputBuffer(uint32_t index)
221 {
222     MEDIA_DEBUG_LOG("ReleaseOutputBuffer start");
223     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
224     int32_t ret = avcodecIntf_->ReleaseOutputBuffer(index);
225     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "ReleaseOutputBuffer failed, ret: %{public}d", ret);
226     MEDIA_DEBUG_LOG("ReleaseOutputBuffer end");
227     return ret;
228 }
229 
AVCodecVideoEncoderSetParameter(const Format & format)230 int32_t AVCodecProxy::AVCodecVideoEncoderSetParameter(const Format& format)
231 {
232     MEDIA_DEBUG_LOG("AVCodecVideoEncoderSetParameter start");
233     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
234     int32_t ret = avcodecIntf_->AVCodecVideoEncoderSetParameter(format);
235     CHECK_RETURN_RET_ELOG(
236         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderSetParameter failed, ret: %{public}d", ret);
237     MEDIA_DEBUG_LOG("AVCodecVideoEncoderSetParameter end");
238     return ret;
239 }
240 
AVCodecVideoEncoderSetCallback(const std::shared_ptr<MediaCodecCallback> & callback)241 int32_t AVCodecProxy::AVCodecVideoEncoderSetCallback(const std::shared_ptr<MediaCodecCallback>& callback)
242 {
243     MEDIA_DEBUG_LOG("AVCodecVideoEncoderSetCallback start");
244     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
245     CHECK_RETURN_RET_ELOG(callback == nullptr, AV_ERR_INVALID_VAL, "input callback is nullptr!");
246     int32_t ret = avcodecIntf_->AVCodecVideoEncoderSetCallback(callback);
247     CHECK_RETURN_RET_ELOG(
248         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderSetCallback failed, ret: %{public}d", ret);
249     MEDIA_DEBUG_LOG("AVCodecVideoEncoderSetCallback end");
250     return ret;
251 }
AVCodecVideoEncoderConfigure(const Format & format)252 int32_t AVCodecProxy::AVCodecVideoEncoderConfigure(const Format& format)
253 {
254     MEDIA_DEBUG_LOG("AVCodecVideoEncoderConfigure start");
255     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
256     int32_t ret = avcodecIntf_->AVCodecVideoEncoderConfigure(format);
257     CHECK_RETURN_RET_ELOG(
258         ret != AV_ERR_OK, AV_ERR_FAILED, "AVCodecVideoEncoderConfigure failed, ret: %{public}d", ret);
259     MEDIA_DEBUG_LOG("AVCodecVideoEncoderConfigure end");
260     return ret;
261 }
262 
CreateAVSource(int32_t fd,int64_t offset,int64_t size)263 void AVCodecProxy::CreateAVSource(int32_t fd, int64_t offset, int64_t size)
264 {
265     MEDIA_DEBUG_LOG("CreateAVSource start");
266     CHECK_RETURN_ELOG(avcodecIntf_ == nullptr, "avcodecIntf_ is nullptr");
267     avcodecIntf_->CreateAVSource(fd, offset, size);
268     MEDIA_DEBUG_LOG("CreateAVSource end");
269 }
270 
AVSourceGetSourceFormat(Format & format)271 int32_t AVCodecProxy::AVSourceGetSourceFormat(Format& format)
272 {
273     MEDIA_DEBUG_LOG("AVSourceGetSourceFormat start");
274     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
275     int32_t ret = avcodecIntf_->AVSourceGetSourceFormat(format);
276     CHECK_RETURN_RET_ELOG(
277         ret != AV_ERR_OK, AV_ERR_FAILED, "AVSourceGetSourceFormat failed, ret: %{public}d", ret);
278     MEDIA_DEBUG_LOG("AVSourceGetSourceFormat end");
279     return ret;
280 }
281 
AVSourceGetUserMeta(Format & format)282 int32_t AVCodecProxy::AVSourceGetUserMeta(Format& format)
283 {
284     MEDIA_DEBUG_LOG("AVSourceGetUserMeta start");
285     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
286     int32_t ret = avcodecIntf_->AVSourceGetUserMeta(format);
287     CHECK_RETURN_RET_ELOG(
288         ret != AV_ERR_OK, AV_ERR_FAILED, "AVSourceGetUserMeta failed, ret: %{public}d", ret);
289     MEDIA_DEBUG_LOG("AVSourceGetUserMeta end");
290     return ret;
291 }
292 
AVSourceGetTrackFormat(Format & format,uint32_t trackIndex)293 int32_t AVCodecProxy::AVSourceGetTrackFormat(Format& format, uint32_t trackIndex)
294 {
295     MEDIA_DEBUG_LOG("AVSourceGetTrackFormat start");
296     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
297     int32_t ret = avcodecIntf_->AVSourceGetTrackFormat(format, trackIndex);
298     CHECK_RETURN_RET_ELOG(
299         ret != AV_ERR_OK, AV_ERR_FAILED, "AVSourceGetTrackFormat failed, ret: %{public}d", ret);
300     MEDIA_DEBUG_LOG("AVSourceGetTrackFormat end");
301     return ret;
302 }
303 
CreateAVDemuxer(std::shared_ptr<AVSource> source)304 void AVCodecProxy::CreateAVDemuxer(std::shared_ptr<AVSource> source)
305 {
306     MEDIA_DEBUG_LOG("CreateAVDemuxer start");
307     CHECK_RETURN_ELOG(avcodecIntf_ == nullptr, "avcodecIntf_ is nullptr");
308     avcodecIntf_->CreateAVDemuxer(source);
309     MEDIA_DEBUG_LOG("CreateAVDemuxer end");
310 }
311 
ReadSampleBuffer(uint32_t trackIndex,std::shared_ptr<AVBuffer> sample)312 int32_t AVCodecProxy::ReadSampleBuffer(uint32_t trackIndex, std::shared_ptr<AVBuffer> sample)
313 {
314     MEDIA_DEBUG_LOG("ReadSampleBuffer start");
315     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
316     CHECK_RETURN_RET_ELOG(sample == nullptr, AV_ERR_INVALID_VAL, "input sample is nullptr!");
317     int32_t ret = avcodecIntf_->ReadSampleBuffer(trackIndex, sample);
318     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "ReadSampleBuffer failed, ret: %{public}d", ret);
319     MEDIA_DEBUG_LOG("ReadSampleBuffer end");
320     return ret;
321 }
322 
AVDemuxerSeekToTime(int64_t millisecond,SeekMode mode)323 int32_t AVCodecProxy::AVDemuxerSeekToTime(int64_t millisecond, SeekMode mode)
324 {
325     MEDIA_DEBUG_LOG("AVDemuxerSeekToTime start");
326     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
327     int32_t ret = avcodecIntf_->AVDemuxerSeekToTime(millisecond, mode);
328     CHECK_RETURN_RET_ELOG(ret != AV_ERR_OK, AV_ERR_FAILED, "AVDemuxerSeekToTime failed, ret: %{public}d", ret);
329     MEDIA_DEBUG_LOG("AVDemuxerSeekToTime end");
330     return ret;
331 }
332 
AVDemuxerSelectTrackByID(uint32_t trackIndex)333 int32_t AVCodecProxy::AVDemuxerSelectTrackByID(uint32_t trackIndex)
334 {
335     MEDIA_DEBUG_LOG("AVDemuxerSelectTrackByID start");
336     CHECK_RETURN_RET_ELOG(avcodecIntf_ == nullptr, AV_ERR_INVALID_VAL, "avcodecIntf_ is not created");
337     int32_t ret = avcodecIntf_->AVDemuxerSelectTrackByID(trackIndex);
338     CHECK_RETURN_RET_ELOG(
339         ret != AV_ERR_OK, AV_ERR_FAILED, "AVDemuxerSelectTrackByID failed, ret: %{public}d", ret);
340     MEDIA_DEBUG_LOG("AVDemuxerSelectTrackByID end");
341     return ret;
342 }
343 } // namespace CameraStandard
344 } // namespace OHOS