X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fscreen%2Fscreen.c;h=12fb132d2c7cb885ce451d379ba0e1fd972044bd;hb=b50c7652c71962d64df75ec60a901131e577fdc7;hp=2886d8f926208e50c7b2fe87167805de5a6ce557;hpb=4a422c22c0be601fdc303ef19a7980246784d9ff;p=vlc diff --git a/modules/access/screen/screen.c b/modules/access/screen/screen.c index 2886d8f926..12fb132d2c 100644 --- a/modules/access/screen/screen.c +++ b/modules/access/screen/screen.c @@ -1,23 +1,23 @@ /***************************************************************************** * screen.c: Screen capture module. ***************************************************************************** - * Copyright (C) 2004-2008 the VideoLAN team + * Copyright (C) 2004-2008 VLC authors and VideoLAN * $Id$ * * Authors: Gildas Bazin * Antoine Cellerier * - * 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 - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ @@ -38,15 +38,11 @@ /***************************************************************************** * Module descriptor *****************************************************************************/ -#define CACHING_TEXT N_("Caching value in ms") -#define CACHING_LONGTEXT N_( \ - "Caching value for screen capture. "\ - "This value should be set in milliseconds." ) #define FPS_TEXT N_("Frame rate") #define FPS_LONGTEXT N_( \ "Desired frame rate for the capture." ) -#ifdef WIN32 +#ifdef _WIN32 #define FRAGS_TEXT N_("Capture fragment size") #define FRAGS_LONGTEXT N_( \ "Optimize the capture by fragmenting the screen in chunks " \ @@ -63,12 +59,8 @@ "Left coordinate of the subscreen top left corner." ) #define WIDTH_TEXT N_( "Subscreen width" ) -#define WIDTH_LONGTEXT N_( \ - "Subscreen width" ) #define HEIGHT_TEXT N_( "Subscreen height" ) -#define HEIGHT_LONGTEXT N_( \ - "Subscreen height" ) #define FOLLOW_MOUSE_TEXT N_( "Follow the mouse" ) #define FOLLOW_MOUSE_LONGTEXT N_( \ @@ -82,10 +74,19 @@ "capture." ) #endif +#ifdef SCREEN_DISPLAY_ID +#define DISPLAY_ID_TEXT N_( "Display ID" ) +#define DISPLAY_ID_LONGTEXT N_( \ + "Display ID. If not specified, main display ID is used. " ) +#define INDEX_TEXT N_( "Screen index" ) +#define INDEX_LONGTEXT N_( \ + "Index of screen (1, 2, 3, ...). Alternative to Display ID." ) +#endif + static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); -#ifdef WIN32 +#ifdef _WIN32 # define SCREEN_FPS 1 #else # define SCREEN_FPS 5 @@ -97,27 +98,29 @@ vlc_module_begin () set_category( CAT_INPUT ) set_subcategory( SUBCAT_INPUT_ACCESS ) - add_integer( "screen-caching", DEFAULT_PTS_DELAY / 1000, - CACHING_TEXT, CACHING_LONGTEXT, true ) - add_float( "screen-fps", SCREEN_FPS, FPS_TEXT, FPS_LONGTEXT, true ) + add_float( "screen-fps", SCREEN_FPS, FPS_TEXT, FPS_LONGTEXT, false ) #ifdef SCREEN_SUBSCREEN add_integer( "screen-top", 0, TOP_TEXT, TOP_LONGTEXT, true ) add_integer( "screen-left", 0, LEFT_TEXT, LEFT_LONGTEXT, true ) - add_integer( "screen-width", 0, WIDTH_TEXT, WIDTH_LONGTEXT, true ) - add_integer( "screen-height", 0, HEIGHT_TEXT, HEIGHT_LONGTEXT, true ) + add_integer( "screen-width", 0, WIDTH_TEXT, WIDTH_TEXT, true ) + add_integer( "screen-height", 0, HEIGHT_TEXT, HEIGHT_TEXT, true ) + add_bool( "screen-follow-mouse", false, FOLLOW_MOUSE_TEXT, - FOLLOW_MOUSE_LONGTEXT, true ) + FOLLOW_MOUSE_LONGTEXT, false ) #endif #ifdef SCREEN_MOUSE - add_loadfile( "screen-mouse-image", "", MOUSE_TEXT, MOUSE_LONGTEXT, - true ) + add_loadfile( "screen-mouse-image", "", MOUSE_TEXT, MOUSE_LONGTEXT, true ) +#endif + +#ifdef _WIN32 + add_integer( "screen-fragment-size", 0, FRAGS_TEXT, FRAGS_LONGTEXT, true ) #endif -#ifdef WIN32 - add_integer( "screen-fragment-size", 0, FRAGS_TEXT, - FRAGS_LONGTEXT, true ) +#ifdef SCREEN_DISPLAY_ID + add_integer( "screen-display-id", 0, DISPLAY_ID_TEXT, DISPLAY_ID_LONGTEXT, true ) + add_integer( "screen-index", 0, INDEX_TEXT, INDEX_LONGTEXT, true ) #endif set_capability( "access_demux", 0 ) @@ -146,9 +149,6 @@ static int Open( vlc_object_t *p_this ) if( !p_sys ) return VLC_ENOMEM; - /* Update default_pts to a suitable value for screen access */ - var_Create( p_demux, "screen-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); - p_sys->f_fps = var_CreateGetFloat( p_demux, "screen-fps" ); p_sys->i_incr = 1000000 / p_sys->f_fps;; p_sys->i_next_date = 0; @@ -167,6 +167,11 @@ static int Open( vlc_object_t *p_this ) p_sys->i_height ); #endif +#ifdef SCREEN_DISPLAY_ID + p_sys->i_display_id = var_CreateGetInteger( p_demux, "screen-display-id" ); + p_sys->i_screen_index = var_CreateGetInteger( p_demux, "screen-index" ); +#endif + if( screen_InitCapture( p_demux ) != VLC_SUCCESS ) { free( p_sys ); @@ -195,7 +200,7 @@ static int Open( vlc_object_t *p_this ) p_sys->fmt.video.i_width = p_sys->i_width; p_sys->fmt.video.i_visible_height = p_sys->fmt.video.i_height = p_sys->i_height; - p_sys->b_follow_mouse = var_CreateGetInteger( p_demux, + p_sys->b_follow_mouse = var_CreateGetBool( p_demux, "screen-follow-mouse" ); if( p_sys->b_follow_mouse ) msg_Dbg( p_demux, "mouse following enabled" ); @@ -230,6 +235,8 @@ static int Open( vlc_object_t *p_this ) p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt ); + p_sys->i_start = mdate(); + return VLC_SUCCESS; } @@ -288,6 +295,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) { bool *pb; int64_t *pi64; + demux_sys_t *p_sys = p_demux->p_sys; switch( i_query ) { @@ -302,12 +310,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_PTS_DELAY: pi64 = (int64_t*)va_arg( args, int64_t * ); - *pi64 = var_GetInteger( p_demux, "screen-caching" ) *1000; + *pi64 = INT64_C(1000) + * var_InheritInteger( p_demux, "live-caching" ); return VLC_SUCCESS; case DEMUX_GET_TIME: pi64 = (int64_t*)va_arg( args, int64_t * ); - *pi64 = mdate(); + *pi64 = mdate() - p_sys->i_start; return VLC_SUCCESS; /* TODO implement others */