PDA

View Full Version : OMX read_media



AlexQt
02-04-2013, 06:50 AM
Hi, I try, on Raspberry, hardware read media file with read_media component http://home.nouwen.name/RaspberryPi/doc ... media.html (http://home.nouwen.name/RaspberryPi/documentation/ilcomponents/read_media.html)
First I create component:

// create read_media
if(status == 0 && ilclient_create_component(client, &read_media, "read_media",ILCLIENT_DISABLE_ALL_PORTS) != 0){status = -14; printf("=> ilclient_create_component() for read_media failed!!\n");exit(1);}
list[0] = read_media;

Next I create param:

OMX_PARAM_CONTENTURITYPE *in_file_uri;

Then I allocate memory and set up uri to file:

//read_media
OMX_U8 *file_name="/home/pi/git_video/firmware/opt/vc/src/hello_pi/hello_video/test.h264";
size_t lenght=strlen(file_name)+1;
size_t param_size=sizeof(OMX_PARAM_CONTENTURITYPE)+lenght-1;
//memset(&in_file_uri, 0,param_size);
in_file_uri=malloc(param_size);
in_file_uri->nSize = param_size;
in_file_uri->nVersion.nVersion = OMX_VERSION;
memcpy(in_file_uri->contentURI,file_name,lenght);

printf("==>URI: SIZE %d, %s \n",in_file_uri->nSize,in_file_uri->contentURI);

And finaly I setup param to read_media component:

OMX_ERRORTYPE r=OMX_SetParameter(ILC_GET_HANDLE(read_media), OMX_IndexParamContentURI,in_file_uri);
if(r!=OMX_ErrorNone){printf("=> Failed set port params (read_media),error %f \n",r);status=-1;}

But set params of component filed, what wrong? Can any help me?