X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Fhd1000v.cpp;h=e5cbf29df0671c8dba2650435e6449c1f3831705;hb=5ebacd11d10f9acc39afc0b3d41beb280eaac293;hp=05a874f56ee35d9e5496a72c0f8c9ae2cdfc70eb;hpb=5f50f228482186d0a68b2f6583d6df5ffea8a6d9;p=vlc diff --git a/modules/video_output/hd1000v.cpp b/modules/video_output/hd1000v.cpp index 05a874f56e..e5cbf29df0 100644 --- a/modules/video_output/hd1000v.cpp +++ b/modules/video_output/hd1000v.cpp @@ -1,10 +1,10 @@ /***************************************************************************** * hd1000v.cpp: HD1000 video output display method ***************************************************************************** - * Copyright (C) 2004 VideoLAN - * $Id: hd1000v.cpp 6961 2004-03-05 17:34:23Z jpsaman $ + * Copyright (C) 2004 the VideoLAN team + * $Id$ * - * Authors: Jean-Paul Saman + * Authors: Jean-Paul Saman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -26,12 +26,15 @@ *****************************************************************************/ extern "C" { #include /* ENOMEM */ -#include /* free() */ -#include /* strerror() */ -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include } #include @@ -54,8 +57,8 @@ static void FreePicture( vout_thread_t *, picture_t * ); * Module descriptor *****************************************************************************/ vlc_module_begin(); - set_description( _("HD1000 video output") ); - set_capability( "video output", 10 ); + set_description( N_("HD1000 video output") ); + set_capability( "video output", 100 ); add_shortcut( "hd1000v" ); set_callbacks( Create, Destroy ); vlc_module_end(); @@ -71,8 +74,8 @@ struct vout_sys_t uint32_t i_width; /* width of main window */ uint32_t i_height; /* height of main window */ uint32_t i_screen_depth; - vlc_bool_t b_double_buffered; - + bool b_double_buffered; + uint32_t u_current; /* Current output resolution. */ CascadeScreen *p_screen; }; @@ -91,13 +94,10 @@ static int Create( vlc_object_t *p_this ) { vout_thread_t *p_vout = (vout_thread_t *)p_this; bool b_double_buffered = false; - + p_vout->p_sys = (struct vout_sys_t*) malloc( sizeof(struct vout_sys_t) ); if( p_vout->p_sys == NULL ) - { - msg_Err( p_vout, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; /* Allocate a screen for VLC vout. */ p_vout->p_sys->p_screen = new CascadeScreen(); @@ -115,23 +115,41 @@ static int Create( vlc_object_t *p_this ) p_vout->pf_display = Display; /* Get current screen resolution */ - msg_Dbg( p_vout, "Number of screen resolutions supported %u", + msg_Dbg( p_vout, "number of screen resolutions supported %u", p_vout->p_sys->p_screen->GetNumScreenResolutionsSupported() ); - - p_vout->p_sys->p_screen->GetCurrentOutputResolution( (u32) p_vout->p_sys->u_current ); + + p_vout->p_sys->p_screen->GetCurrentScreenResolution( (u32) p_vout->p_sys->u_current ); + p_vout->p_sys->p_screen->SetScreenResolution( (u32) p_vout->p_sys->u_current ); + +#if 1 + msg_Dbg( p_vout, "available screen resolutions:" ); + for (u32 i=0; ip_sys->p_screen->GetNumScreenResolutionsSupported(); i++) + { + u32 i_width=0; + u32 i_height=0; + u8 i_screen_depth=0; + bool b_buffered; + + p_vout->p_sys->p_screen->GetSupportedScreenResolutionAt( i, + i_width, i_height, i_screen_depth, b_buffered); + msg_Dbg( p_vout, " screen index = %u, width = %u, height = %u, depth = %u, double buffered = %s", + i, i_width, i_height, i_screen_depth, (b_buffered ? "yes" : "no") ); + } +#endif + p_vout->p_sys->p_screen->GetSupportedScreenResolutionAt( (u32) p_vout->p_sys->u_current, (u32) p_vout->p_sys->i_width, (u32) p_vout->p_sys->i_height, (u8) p_vout->p_sys->i_screen_depth, - b_double_buffered); - p_vout->p_sys->b_double_buffered = (vlc_bool_t) b_double_buffered; - msg_Dbg( p_vout, "index = %u, width = %u, height = %u, depth = %u, double buffered = %d", - p_vout->p_sys->u_current, + b_double_buffered ); + p_vout->p_sys->b_double_buffered = (bool) b_double_buffered; + msg_Dbg( p_vout, "using screen index = %u, width = %u, height = %u, depth = %u, double buffered = %d", + p_vout->p_sys->u_current, /* Current screen. */ p_vout->p_sys->i_width, p_vout->p_sys->i_height, p_vout->p_sys->i_screen_depth, p_vout->p_sys->b_double_buffered ); - + return VLC_SUCCESS; } @@ -195,6 +213,7 @@ static int Init( vout_thread_t *p_vout ) /* Allocate the picture */ p_pic->p->i_lines = p_vout->p_sys->i_height; + p_pic->p->i_visible_lines = p_vout->p_sys->i_height; p_pic->p->i_pitch = p_vout->p_sys->i_width; p_pic->p->i_pixel_pitch = 1; p_pic->p->i_visible_pitch = p_vout->p_sys->i_width; @@ -257,14 +276,15 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) free( p_pic->p_sys ); return -1; } - + p_pic->p->i_lines = p_vout->output.i_height; + p_pic->p->i_visible_lines = p_vout->output.i_height; p_pic->p->p_pixels = (uint8_t*) p_pic->p_sys->p_image->MapLock(); p_pic->p->i_pitch = p_vout->p_sys->i_screen_depth; p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch * p_vout->output.i_width; - return VLC_SUCCESS; + return VLC_SUCCESS; } /***************************************************************************** @@ -280,13 +300,13 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic ) { /* Just a test to see the effect described above. REMOVE THIS */ msg_Err( p_vout, "unlocking shared memory failed, already unlocked" ); } - + if( p_pic->p_sys->p_image->Close() ) { msg_Err( p_vout, "closing shared memory failed. Leaking memory of %ul", p_pic->p_sys->p_image->GetSize() ); } - + delete p_pic->p_sys->p_image; free( p_pic->p_sys ); } @@ -298,7 +318,7 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { uint32_t i_width, i_height, i_x, i_y; uint32_t i_offset = 0; - + vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height, &i_x, &i_y, &i_width, &i_height ); @@ -307,13 +327,13 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) /* Currently the only pixel format supported is 32bpp RGBA.*/ p_vout->p_sys->p_screen->LockScreen(); - + /* Unlock the shared memory region first. */ - if( p_pic->p_sys->p_image->Unlock() ) + if( p_pic->p_sys->p_image->Unlock() ) { msg_Err( p_vout, "unlocking shared memory failed. Expect threading problems." ); } - + p_vout->p_sys->p_screen->Blit( CascadePoint( (u32) i_x, (u32) i_y ), /* Place bitmap at */ (*p_pic->p_sys->p_image) , /* Image data */ (u32) i_offset, /* Offset in SharedMemoryZone */ @@ -321,6 +341,6 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) (u32) i_height, /* Source bitmap height */ (u32) p_vout->p_sys->i_screen_depth, /* Source pixel depth */ CascadeRect( (u32) i_x, (u32) i_y, (u32) i_width, (u32) i_height ) ); - + p_vout->p_sys->p_screen->UnlockScreen(); }