From: Antoine Cellerier Date: Sun, 29 Jan 2006 11:01:37 +0000 (+0000) Subject: add boolean option "snapshot-preview" to enable/disable the snapshot's X-Git-Tag: 0.9.0-test0~12590 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ec98101502505c1fefbf82416a0e9e54e0519351;p=vlc add boolean option "snapshot-preview" to enable/disable the snapshot's preview display in the top left corner of the screen. --- diff --git a/src/libvlc.h b/src/libvlc.h index d7b6e56ebc..0878e4fde7 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -297,6 +297,11 @@ static char *ppsz_align_descriptions[] = "Allows you to specify the image format in which the video snapshots will " \ "be stored.") +#define SNAP_PREVIEW_TEXT N_("Display video snapshot preview") +#define SNAP_PREVIEW_LONGTEXT N_( \ + "Enable / disable displaying the snapshot preview in the screen's to " \ + " left corner.") + #define CROP_TEXT N_("Video cropping") #define CROP_LONGTEXT N_( \ "This will force the cropping of the source video. " \ @@ -1106,6 +1111,8 @@ vlc_module_begin(); add_string( "snapshot-format", "png", NULL, SNAP_FORMAT_TEXT, SNAP_FORMAT_LONGTEXT, VLC_FALSE ); change_string_list( ppsz_snap_formats, NULL, 0 ); + add_bool( "snapshot-preview", VLC_TRUE, NULL, SNAP_PREVIEW_TEXT, + SNAP_PREVIEW_LONGTEXT, VLC_FALSE ); set_section( N_("Window properties" ), NULL ); add_integer( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE ); diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c index 3e4f3c6b83..1af5d8f23a 100644 --- a/src/video_output/vout_intf.c +++ b/src/video_output/vout_intf.c @@ -185,6 +185,7 @@ void vout_IntfInit( vout_thread_t *p_vout ) /* Create a few object variables we'll need later on */ var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); + var_Create( p_vout, "snapshot-preview", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); @@ -568,33 +569,41 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename ); free( psz_filename ); - /* Inject a subpicture with the snapshot */ - memset( &fmt_out, 0, sizeof(fmt_out) ); - fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); - p_pif = image_Convert( p_image, p_pic, &fmt_in, &fmt_out ); - image_HandlerDelete( p_image ); - if( !p_pif ) return VLC_EGENERIC; - - p_subpic = spu_CreateSubpicture( p_vout->p_spu ); - if( p_subpic == NULL ) + if( var_GetBool( p_vout, "snapshot-preview" ) ) { - p_pif->pf_release( p_pif ); - return VLC_EGENERIC; - } + /* Inject a subpicture with the snapshot */ + memset( &fmt_out, 0, sizeof(fmt_out) ); + fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); + p_pif = image_Convert( p_image, p_pic, &fmt_in, &fmt_out ); + image_HandlerDelete( p_image ); + if( !p_pif ) return VLC_EGENERIC; + + p_subpic = spu_CreateSubpicture( p_vout->p_spu ); + if( p_subpic == NULL ) + { + p_pif->pf_release( p_pif ); + return VLC_EGENERIC; + } - p_subpic->i_channel = 0; - p_subpic->i_start = mdate(); - p_subpic->i_stop = mdate() + 4000000; - p_subpic->b_ephemer = VLC_TRUE; - p_subpic->b_fade = VLC_TRUE; - p_subpic->i_original_picture_width = p_vout->render.i_width * 4; - p_subpic->i_original_picture_height = p_vout->render.i_height * 4; + p_subpic->i_channel = 0; + p_subpic->i_start = mdate(); + p_subpic->i_stop = mdate() + 4000000; + p_subpic->b_ephemer = VLC_TRUE; + p_subpic->b_fade = VLC_TRUE; + p_subpic->i_original_picture_width = p_vout->render.i_width * 4; + p_subpic->i_original_picture_height = p_vout->render.i_height * 4; - p_subpic->p_region = spu_CreateRegion( p_vout->p_spu, &fmt_out ); - vout_CopyPicture( p_image->p_parent, &p_subpic->p_region->picture, p_pif ); - p_pif->pf_release( p_pif ); + p_subpic->p_region = spu_CreateRegion( p_vout->p_spu, &fmt_out ); + vout_CopyPicture( p_image->p_parent, &p_subpic->p_region->picture, + p_pif ); + p_pif->pf_release( p_pif ); - spu_DisplaySubpicture( p_vout->p_spu, p_subpic ); + spu_DisplaySubpicture( p_vout->p_spu, p_subpic ); + } + else + { + image_HandlerDelete( p_image ); + } return VLC_SUCCESS; }