Commit 9029b521 authored by Olivier Aubert's avatar Olivier Aubert

Embedded snapshot: properly initialize snapshot-width/-height if they were not specified

parent bddca171
......@@ -484,9 +484,30 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
/* Save the snapshot to a memory zone */
fmt_in = p_vout->fmt_in;
fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
fmt_out.i_chroma = VLC_FOURCC( 'p','n','g',' ' );
fmt_out.i_width = var_GetInteger( p_vout, "snapshot-width" );
fmt_out.i_height = var_GetInteger( p_vout, "snapshot-height" );
fmt_out.i_chroma = VLC_FOURCC( 'p','n','g',' ' );
/* If snapshot-width and/or snapshot height were not specified,
use a default snapshot width of 320 */
if( fmt_out.i_width == 0 && fmt_out.i_height == 0 )
{
fmt_out.i_width = 320;
}
if( fmt_out.i_width == 0 && fmt_out.i_height > 0 )
{
fmt_out.i_width = (fmt_in.i_width * fmt_out.i_height) / fmt_in.i_height;
}
else if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
{
fmt_out.i_height = (fmt_in.i_height * fmt_out.i_width) / fmt_in.i_width;
}
else
{
fmt_out.i_width = fmt_in.i_width;
fmt_out.i_height = fmt_in.i_height;
}
p_block = ( block_t* ) image_Write( p_image, p_pic, &fmt_in, &fmt_out );
if( !p_block )
......
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