0

我尝试使用 read_media 组件来硬件读取媒体文件http://home.nouwen.name/RaspberryPi/doc ... media.html 首先我创建组件:

   // 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;

接下来我创建参数:

OMX_PARAM_CONTENTURITYPE *in_file_uri;

然后我分配内存并将uri设置为文件:

   //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);

最后我将参数设置为 read_media 组件:

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;}

但是设置组件文件的参数,有什么问题吗?有什么可以帮助我的吗?

4

1 回答 1

0

在 Raspberry read_media 组件上无权访问文件系统!

于 2013-02-05T18:57:48.640 回答