Commit 773363e0 authored by Laurent Aimar's avatar Laurent Aimar

Added a vout_GetSnapshot to retreive snapshot from vout.

It will allows to remove libvlc hack.
parent 44de9534
......@@ -683,6 +683,23 @@ static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
vlc_object_release( p_vout );
}
/**
* This function will handle a snapshot request.
*
* pp_image, pp_picture and p_fmt can be NULL otherwise they will be
* set with returned value in case of success.
*
* pp_image will hold an encoded picture in psz_format format.
*
* i_timeout specifies the time the function will wait for a snapshot to be
* available.
*
*/
VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
block_t **pp_image, picture_t **pp_picture,
video_format_t *p_fmt,
const char *psz_format, mtime_t i_timeout ) );
/* */
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
......
......@@ -513,6 +513,7 @@ vout_CreatePicture
vout_DestroyPicture
vout_DisplayPicture
vout_EnableFilter
vout_GetSnapshot
vout_InitFormat
__vout_InitPicture
vout_LinkPicture
......
......@@ -745,10 +745,9 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char
msg_Warn( p_vout, "Failed to display snapshot" );
}
}
/**
* This function will retreive a snapshot from vout
*/
static int VoutGetSnapshot( vout_thread_t *p_vout,
/* */
int vout_GetSnapshot( vout_thread_t *p_vout,
block_t **pp_image, picture_t **pp_picture,
video_format_t *p_fmt,
const char *psz_format, mtime_t i_timeout )
......@@ -779,6 +778,8 @@ static int VoutGetSnapshot( vout_thread_t *p_vout,
return VLC_EGENERIC;
}
if( pp_image )
{
vlc_fourcc_t i_format = VLC_FOURCC('p','n','g',' ');
if( psz_format && image_Ext2Fourcc( psz_format ) )
i_format = image_Ext2Fourcc( psz_format );
......@@ -793,8 +794,11 @@ static int VoutGetSnapshot( vout_thread_t *p_vout,
picture_Release( p_picture );
return VLC_EGENERIC;
}
}
if( pp_picture )
*pp_picture = p_picture;
else
picture_Release( p_picture );
return VLC_SUCCESS;
}
......@@ -817,7 +821,7 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
/* 500ms timeout
* XXX it will cause trouble with low fps video (< 2fps) */
if( VoutGetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
if( vout_GetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
{
if( b_embedded )
VoutMemorySnapshot( p_vout, p_obj, NULL, NULL );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment