int omx_component_library_Setup(stLoaderComponentType **stComponents)
{
OMX_ERRORTYPE r;
+ unsigned i = 0;
if (stComponents == NULL)
return 2;
/* component 0 - video decoder */
- r = vid_dec_LoaderComponent(stComponents[0]);
- if (r != OMX_ErrorNone)
- return r;
+ r = vid_dec_LoaderComponent(stComponents[i]);
+ if (r == OMX_ErrorNone)
+ ++i;
/* component 1 - video encoder */
- r = vid_enc_LoaderComponent(stComponents[1]);
- if (r != OMX_ErrorNone)
- return r;
+ r = vid_enc_LoaderComponent(stComponents[i]);
+ if (r == OMX_ErrorNone)
+ ++i;
- return 2;
+ return i;
}
struct vl_screen *omx_get_screen(void)
OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp)
{
- struct vl_screen *vscreen = omx_get_screen();
- struct pipe_screen *screen = vscreen ? vscreen->pscreen : NULL;
-
- if (!screen)
- return OMX_ErrorInsufficientResources;
-
comp->componentVersion.s.nVersionMajor = 0;
comp->componentVersion.s.nVersionMinor = 0;
comp->componentVersion.s.nRevision = 0;
comp->componentVersion.s.nStep = 1;
+ comp->name_specific_length = 1;
comp->constructor = vid_enc_Constructor;
- if (screen->get_video_param(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
- PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
- comp->name_specific_length = 1;
- else
- comp->name_specific_length = 0;
-
- omx_put_screen();
-
comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
if (!comp->name)
return OMX_ErrorInsufficientResources;
vid_enc_name(comp->name);
- comp->name_specific = CALLOC(comp->name_specific_length, sizeof(char *));
+ comp->name_specific = CALLOC(1, sizeof(char *));
if (!comp->name_specific)
goto error_arrays;
- comp->role_specific = CALLOC(comp->name_specific_length, sizeof(char *));
+ comp->role_specific = CALLOC(1, sizeof(char *));
if (!comp->role_specific)
goto error_arrays;
- if (comp->name_specific_length) {
- comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
- if (!comp->name_specific[0])
- goto error_specific;
+ comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
+ if (!comp->name_specific[0])
+ goto error_specific;
- vid_enc_name_avc(comp->name_specific[0]);
+ vid_enc_name_avc(comp->name_specific[0]);
- comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
- if (!comp->role_specific[0])
- goto error_specific;
+ comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
+ if (!comp->role_specific[0])
+ goto error_specific;
- strcpy(comp->role_specific[0], OMX_VID_ENC_AVC_ROLE);
- }
+ strcpy(comp->role_specific[0], OMX_VID_ENC_AVC_ROLE);
return OMX_ErrorNone;
return OMX_ErrorInsufficientResources;
screen = priv->screen->pscreen;
+ if (!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
+ PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
+ return OMX_ErrorBadParameter;
+
priv->s_pipe = screen->context_create(screen, priv->screen);
if (!priv->s_pipe)
return OMX_ErrorInsufficientResources;