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

Function find_component

libavcodec/omx.c:346–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344};
345
346static av_cold int find_component(OMXContext *omx_context, void *logctx,
347 const char *role, char *str, int str_size)
348{
349 OMX_U32 i, num = 0;
350 char **components;
351 int ret = 0;
352
353#if CONFIG_OMX_RPI
354 if (av_strstart(role, "video_encoder.", NULL)) {
355 av_strlcpy(str, "OMX.broadcom.video_encode", str_size);
356 return 0;
357 }
358#endif
359 omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL);
360 if (!num) {
361 av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role);
362 return AVERROR_ENCODER_NOT_FOUND;
363 }
364 components = av_calloc(num, sizeof(*components));
365 if (!components)
366 return AVERROR(ENOMEM);
367 for (i = 0; i < num; i++) {
368 components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE);
369 if (!components[i]) {
370 ret = AVERROR(ENOMEM);
371 goto end;
372 }
373 }
374 omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) components);
375 av_strlcpy(str, components[0], str_size);
376end:
377 for (i = 0; i < num; i++)
378 av_free(components[i]);
379 av_free(components);
380 return ret;
381}
382
383static av_cold int wait_for_state(OMXCodecContext *s, OMX_STATETYPE state)
384{

Callers 1

omx_encode_initFunction · 0.85

Calls 6

av_strstartFunction · 0.85
av_strlcpyFunction · 0.85
av_logFunction · 0.85
av_callocFunction · 0.85
av_malloczFunction · 0.50
av_freeFunction · 0.50

Tested by

no test coverage detected