• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 #ifndef AVCODECLIST_ENGINE_GST_IMPL_H
17 #define AVCODECLIST_ENGINE_GST_IMPL_H
18 
19 #include <mutex>
20 #include "nocopyable.h"
21 #include "i_avcodeclist_engine.h"
22 
23 namespace OHOS {
24 namespace Media {
25 class __attribute__((visibility("default"))) AVCodecListEngineGstImpl : public IAVCodecListEngine, public NoCopyable {
26 public:
27     AVCodecListEngineGstImpl();
28     ~AVCodecListEngineGstImpl();
29     std::string FindVideoDecoder(const Format &format) override;
30     std::string FindVideoEncoder(const Format &format) override;
31     std::string FindAudioDecoder(const Format &format) override;
32     std::string FindAudioEncoder(const Format &format) override;
33     std::vector<CapabilityData> GetCodecCapabilityInfos() override;
34 
35 private:
36     std::string FindTargetCodec(const Format &format,
37     const std::vector<CapabilityData> &capabilityDataArray, const AVCodecType &codecType);
38     bool IsSupportMimeType(const Format &format, const CapabilityData &data);
39     bool IsSupportBitrate(const Format &format, const CapabilityData &data);
40     bool IsSupportSize(const Format &format, const CapabilityData &data);
41     bool IsSupportPixelFormat(const Format &format, const CapabilityData &data);
42     bool IsSupportFrameRate(const Format &format, const CapabilityData &data);
43     bool IsSupportSampleRate(const Format &format, const CapabilityData &data);
44     bool IsSupportChannel(const Format &format, const CapabilityData &data);
45     std::mutex mutex_;
46 };
47 } // namespace Media
48 } // namespace OHOS
49 #endif // AVCODECLIST_ENGINE_GST_IMPL_H
50