MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / oh_encode_create

Function oh_encode_create

libavcodec/ohenc.c:76–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74};
75
76static int oh_encode_create(OHCodecEncContext *s, AVCodecContext *avctx)
77{
78 const char *name = s->name;
79
80 if (!name) {
81 const char *mime = ff_oh_mime(avctx->codec_id, avctx);
82 if (!mime)
83 return AVERROR_BUG;
84 OH_AVCapability *cap = OH_AVCodec_GetCapabilityByCategory(mime, true, HARDWARE);
85 if (!cap) {
86 if (!s->allow_sw) {
87 av_log(avctx, AV_LOG_ERROR, "Failed to get hardware codec %s\n", mime);
88 return AVERROR_EXTERNAL;
89 }
90 av_log(avctx, AV_LOG_WARNING,
91 "Failed to get hardware codec %s, try software backend\n", mime);
92 cap = OH_AVCodec_GetCapabilityByCategory(mime, true, SOFTWARE);
93 if (!cap) {
94 av_log(avctx, AV_LOG_ERROR, "Failed to get software codec %s\n", mime);
95 return AVERROR_EXTERNAL;
96 }
97 }
98 name = OH_AVCapability_GetName(cap);
99 if (!name)
100 return AVERROR_EXTERNAL;
101 }
102
103 s->enc = OH_VideoEncoder_CreateByName(name);
104 if (!s->enc) {
105 av_log(avctx, AV_LOG_ERROR, "Create encoder with name %s failed\n", name);
106 return AVERROR_EXTERNAL;
107 }
108 av_log(avctx, AV_LOG_DEBUG, "Create encoder %s success\n", name);
109
110 return 0;
111}
112
113static int oh_encode_set_format(OHCodecEncContext *s, AVCodecContext *avctx)
114{

Callers 1

oh_encode_initFunction · 0.85

Calls 2

ff_oh_mimeFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected