12-14-2012 07:10 AM
Hello,
I am getting the video frame in the size 352*288 resolution, when i draw that frame using the libscreen, how to maintain the aspect ratio.. My code is
int ret = screen_get_buffer_property_pv(m_screen_pixel_buffe
int len = width*height*1.5;
memcpy(ptr, data, len);
screen_buffer_t screen_buffer;
screen_get_window_property_pv(m_screen_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void**) &screen_buffer);
int attribs[] = { SCREEN_BLIT_SOURCE_WIDTH, width, SCREEN_BLIT_SOURCE_HEIGHT, height, SCREEN_BLIT_END };
screen_blit(m_screen_context, screen_buffer, m_screen_pixel_buffer, attribs);
int dirty_rects[] = { 0, 0, width, height };// full screen display(not working)
screen_post_window(m_screen_window, screen_buffer, 1, dirty_rects, 0);
Can anyone help in this!!!!!!!!!!
Solved! Go to Solution.
12-14-2012 01:10 PM
have you considered specifying the destination blit parameters? x, y, width, height?
12-19-2012 06:59 AM
Hello,
Actually I am new to this screen functions. I have used code which i attached previously. I dont know whether attrib are set for destination blit parameters... In the attribs[], thw width and heigth i have specified is the width and height of the frame.
What to do for maintaining the aspect ratio, now my video is displaying in fullscreen of the BB device..
Thanks
12-19-2012 07:15 AM
Hello,
It may be usefull if you say what to set in my code or any sample apps maintaining the video with aspect ratio...
Thanks..
12-19-2012 10:19 AM - edited 12-19-2012 10:41 AM
it's basic math. you're asking for a source image of a certain size: W1 x H1 to be drawn in a destination area of a certain size: W2 x H2.
If W1/H1 is differnt from W2/H2 then your image will be distorted. So just make sure that you set the appropriate destination width and height so that your image is not distorted.
It is a simple matter to read the documentation at the link I provided*:
If SCREEN_BLIT_DESTINATION_WIDTH is not specified, the destination buffer width will be used.
If SCREEN_BLIT_DESTINATION_HEIGHT is not specified, the destination buffer height will be used.
If you are still stuck, I will write you some example code, but you should aim to either set SCREEN_BLIT_DESTINATION_WIDTH equal to the window width and then calculate an appropriate value for SCREEN_BLIT_DESTINATION_HEIGHT based on your aspect ratio, or vice versa.
You will first need to read back the width and height of your destination window using screen_get_window_property_iv() and retrieving SCREEN_PROPERTY_BUFFER_SIZE.
Cheers,
Sean
*I just noticed that I cut & pasted this from the playbook docs, but the BB10 docs describe this similarly.
12-20-2012 05:56 AM
Thanks for your reply... I got my code working!!!!!!!!!!!!
12-20-2012 04:22 PM
cool.. good to hear!