| 344 | }; |
| 345 | |
| 346 | static 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); |
| 376 | end: |
| 377 | for (i = 0; i < num; i++) |
| 378 | av_free(components[i]); |
| 379 | av_free(components); |
| 380 | return ret; |
| 381 | } |
| 382 | |
| 383 | static av_cold int wait_for_state(OMXCodecContext *s, OMX_STATETYPE state) |
| 384 | { |
no test coverage detected