PsycoMEn
Posts: 25
Joined: Mon Aug 06, 2012 11:11 am

Hello_video with video position parameters

Tue Jul 09, 2013 3:05 pm

Hi there,

i'm trying to change hello_video so it supports as input argument the windows position, like omxplayer ( --win "x1 y1 x2 y2" Set position of video window )

I tried to read the code from omxplayer and include it on hello_video without success :(

can any one help me!!!

Thanks.

PsycoMEn
Posts: 25
Joined: Mon Aug 06, 2012 11:11 am

Re: Hello_video with video position parameters

Tue Jul 09, 2013 9:02 pm

I'm still trying without any luck

The code that i think does the trick in omxplayer is:

Code: Select all

#include <IL/OMX_Video.h>
#include <IL/OMX_Broadcom.h>

   OMX_CONFIG_DISPLAYREGIONTYPE configDisplay;
   memset(&configDisplay, 0, sizeof(OMX_CONFIG_DISPLAYREGIONTYPE));
   configDisplay.nVersion.nVersion = OMX_VERSION;
   configDisplay.nPortIndex = 130;
   configDisplay.set = OMX_DISPLAY_SET_DEST_RECT;
   configDisplay.dest_rect.x_offset  = 100;
   configDisplay.dest_rect.y_offset  = 100;
   configDisplay.dest_rect.width     = 640;
   configDisplay.dest_rect.height    = 480;


   OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexConfigDisplayRegion, &configDisplay);

but i tried to add it to line 117 after format.eCompressionFormat = OMX_VIDEO_CodingAVC; but the image still goes fullscreen.

help!!!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17880
Joined: Sat Jul 30, 2011 7:41 pm

Re: Hello_video with video position parameters

Wed Jul 10, 2013 11:27 am

Does the set parameter call return any sort of error? That might help track down any issues.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

PsycoMEn
Posts: 25
Joined: Mon Aug 06, 2012 11:11 am

Re: Hello_video with video position parameters

Wed Jul 10, 2013 1:22 pm

Hi,

I get -2147479526 as output to the command.
Don't know what mean...

Am I missing out any parameter to set?? I thinks that's the right function to setup a specific area for the output.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5099
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Hello_video with video position parameters

Wed Jul 10, 2013 1:47 pm

PsycoMEn wrote: I get -2147479526 as output to the command.
Don't know what mean...
-2147479526 = 0x8000101A

Which OMX_Core.h shows is:

Code: Select all

  /** The parameter or config indicated by the given index is not supported. */
  OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
and the reason:
OMX_IndexConfigDisplayRegion is a rendering option. It should go to video_render component, not video_decode.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17880
Joined: Sat Jul 30, 2011 7:41 pm

Re: Hello_video with video position parameters

Wed Jul 10, 2013 2:39 pm

I was just about to say that... ;)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

PsycoMEn
Posts: 25
Joined: Mon Aug 06, 2012 11:11 am

Re: Hello_video with video position parameters

Wed Jul 10, 2013 7:22 pm

Sucess :D

After many makes and runs here's my code:

Put it after line 115

Code: Select all

   ilclient_change_component_state(video_render, OMX_StateIdle);

   OMX_CONFIG_DISPLAYREGIONTYPE configDisplay;
   memset(&configDisplay, 0, sizeof(OMX_CONFIG_DISPLAYREGIONTYPE));
   configDisplay.nSize = sizeof(OMX_CONFIG_DISPLAYREGIONTYPE);
   configDisplay.nVersion.nVersion = OMX_VERSION;
   configDisplay.nPortIndex = 90;
   configDisplay.fullscreen = OMX_FALSE;
   configDisplay.noaspect   = OMX_TRUE;
   configDisplay.set = (OMX_DISPLAYSETTYPE)(OMX_DISPLAY_SET_DEST_RECT|OMX_DISPLAY_SET_SRC_RECT|OMX_DISPLAY_SET_FULLSCREEN|OMX_DISPLAY_SET_NOASPECT);
   configDisplay.dest_rect.x_offset  = 50;
   configDisplay.dest_rect.y_offset  = 50;
   configDisplay.dest_rect.width     = 1280;
   configDisplay.dest_rect.height    = 720;
   configDisplay.src_rect.x_offset   = 0;
   configDisplay.src_rect.y_offset   = 0;
   configDisplay.src_rect.width      = 1280;
   configDisplay.src_rect.height     = 720;

   int stat = 0;
   stat =  OMX_SetParameter(ILC_GET_HANDLE(video_render), OMX_IndexConfigDisplayRegion, &configDisplay);

   printf ("stat= %#x\n", stat);
Now o get 0 in stat :P ,needs a little polish but it does the job.


Thank you very much for the help. The sugestion were real eyes opener.

Thanks to both.

Return to “General discussion”

Who is online

Users browsing this forum: Bing [Bot], F1TRN and 36 guests