Commit 65868602 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Merge commit 'origin/1.0-bugfix'

parents 13a41fa0 aeb955d8
......@@ -5,7 +5,7 @@ Mac OS X Interface:
* Completely reworked user interface (based upon works from GSoC 2008)
Changes between 0.9.9a and 1.0.0-rc1:
Changes between 0.9.9a and 1.0.0-rc2:
------------------------------------
Important notes:
......
......@@ -26,10 +26,10 @@
* keep a cache of low-res snapshots.
* The snapshot structure is defined in include/snapshot.h
* In order to access the current snapshot cache, object variables are used:
* snapshot-list-pointer : the pointer on the first element in the list
* snapshot-datasize : size of a snapshot
* vout-snapshot-list-pointer : the pointer on the first element in the list
* vout-snapshot-datasize : size of a snapshot
* (also available in snapshot_t->i_datasize)
* snapshot-cache-size : size of the cache list
* vout-snapshot-cache-size : size of the cache list
*
* It is used for the moment by the CORBA module and a specialized
* python-vlc binding.
......@@ -84,10 +84,12 @@ vlc_module_begin ()
set_subcategory( SUBCAT_VIDEO_VOUT )
set_capability( "video output", 1 )
add_integer( "snapshot-width", 320, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, false )
add_integer( "snapshot-height", 200, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
add_string( "snapshot-chroma", "RV32", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
add_integer( "snapshot-cache-size", 50, NULL, CACHE_TEXT, CACHE_LONGTEXT, true )
add_integer( "vout-snapshot-width", 320, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, false )
add_integer( "vout-snapshot-height", 200, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
add_string( "vout-snapshot-chroma", "RV32", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
add_deprecated_alias( "snapshot-chroma" )
add_integer( "vout-snapshot-cache-size", 50, NULL, CACHE_TEXT, CACHE_LONGTEXT, true )
add_deprecated_alias( "snapshot-cache-size" )
set_callbacks( Create, Destroy )
vlc_module_end ()
......@@ -128,11 +130,11 @@ static int Create( vlc_object_t *p_this )
if( ! p_vout->p_sys )
return VLC_ENOMEM;
var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER );
var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER );
var_Create( p_vout, "snapshot-datasize", VLC_VAR_INTEGER );
var_Create( p_vout, "snapshot-cache-size", VLC_VAR_INTEGER );
var_Create( p_vout, "snapshot-list-pointer", VLC_VAR_ADDRESS );
var_Create( p_vout, "vout-snapshot-width", VLC_VAR_INTEGER );
var_Create( p_vout, "vout-snapshot-height", VLC_VAR_INTEGER );
var_Create( p_vout, "vout-snapshot-datasize", VLC_VAR_INTEGER );
var_Create( p_vout, "vout-snapshot-cache-size", VLC_VAR_INTEGER );
var_Create( p_vout, "vout-snapshot-list-pointer", VLC_VAR_ADDRESS );
p_vout->pf_init = Init;
p_vout->pf_end = End;
......@@ -157,14 +159,20 @@ static int Init( vout_thread_t *p_vout )
int i_height;
int i_datasize;
i_width = config_GetInt( p_vout, "snapshot-width" );
i_height = config_GetInt( p_vout, "snapshot-height" );
i_width = config_GetInt( p_vout, "vout-snapshot-width" );
i_height = config_GetInt( p_vout, "vout-snapshot-height" );
psz_chroma = config_GetPsz( p_vout, "snapshot-chroma" );
if( !psz_chroma )
psz_chroma = config_GetPsz( p_vout, "vout-snapshot-chroma" );
if( psz_chroma )
{
msg_Err( p_vout, "Cannot find chroma information." );
return VLC_EGENERIC;
if( strlen( psz_chroma ) < 4 )
{
msg_Err( p_vout, "vout-snapshot-chroma should be 4 characters long" );
return VLC_EGENERIC;
}
i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
psz_chroma[2], psz_chroma[3] );
free( psz_chroma );
}
i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
......@@ -256,11 +264,11 @@ static int Init( vout_thread_t *p_vout )
p_vout->p_sys->i_datasize = i_datasize;
p_vout->p_sys->i_index = 0;
p_vout->p_sys->i_size = config_GetInt( p_vout, "snapshot-cache-size" );
p_vout->p_sys->i_size = config_GetInt( p_vout, "vout-snapshot-cache-size" );
if( p_vout->p_sys->i_size < 2 )
{
msg_Err( p_vout, "snapshot-cache-size must be at least 1." );
msg_Err( p_vout, "vout-snapshot-cache-size must be at least 1." );
return VLC_EGENERIC;
}
......@@ -291,17 +299,17 @@ static int Init( vout_thread_t *p_vout )
}
val.i_int = i_width;
var_Set( p_vout, "snapshot-width", val );
var_Set( p_vout, "vout-snapshot-width", val );
val.i_int = i_height;
var_Set( p_vout, "snapshot-height", val );
var_Set( p_vout, "vout-snapshot-height", val );
val.i_int = i_datasize;
var_Set( p_vout, "snapshot-datasize", val );
var_Set( p_vout, "vout-snapshot-datasize", val );
val.i_int = p_vout->p_sys->i_size;
var_Set( p_vout, "snapshot-cache-size", val );
var_Set( p_vout, "vout-snapshot-cache-size", val );
val.p_address = p_vout->p_sys->p_list;
var_Set( p_vout, "snapshot-list-pointer", val );
var_Set( p_vout, "vout-snapshot-list-pointer", val );
/* Get the p_input pointer (to access video times) */
p_vout->p_sys->p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
......@@ -310,9 +318,9 @@ static int Init( vout_thread_t *p_vout )
if( !p_vout->p_sys->p_input )
return VLC_ENOOBJ;
if( var_Create( p_vout->p_sys->p_input, "snapshot-id", VLC_VAR_INTEGER ) )
if( var_Create( p_vout->p_sys->p_input, "vout-snapshot-id", VLC_VAR_INTEGER ) )
{
msg_Err( p_vout, "Cannot create snapshot-id variable in p_input(%p).",
msg_Err( p_vout, "Cannot create vout-snapshot-id variable in p_input(%p).",
p_vout->p_sys->p_input );
return VLC_EGENERIC;
}
......@@ -320,9 +328,9 @@ static int Init( vout_thread_t *p_vout )
/* Register the snapshot vout module at the input level */
val.p_address = p_vout;
if( var_Set( p_vout->p_sys->p_input, "snapshot-id", val ) )
if( var_Set( p_vout->p_sys->p_input, "vout-snapshot-id", val ) )
{
msg_Err( p_vout, "Cannot register snapshot-id in p_input(%p).",
msg_Err( p_vout, "Cannot register vout-snapshot-id in p_input(%p).",
p_vout->p_sys->p_input );
return VLC_EGENERIC;
}
......@@ -348,12 +356,12 @@ static void Destroy( vlc_object_t *p_this )
vout_thread_t *p_vout = ( vout_thread_t * )p_this;
int i_index;
var_Destroy( p_vout->p_sys->p_input, "snapshot-id" );
var_Destroy( p_vout->p_sys->p_input, "vout-snapshot-id" );
vlc_object_release( p_vout->p_sys->p_input );
var_Destroy( p_this, "snapshot-width" );
var_Destroy( p_this, "snapshot-height" );
var_Destroy( p_this, "snapshot-datasize" );
var_Destroy( p_this, "vout-snapshot-width" );
var_Destroy( p_this, "vout-snapshot-height" );
var_Destroy( p_this, "vout-snapshot-datasize" );
for( i_index = 0 ; i_index < p_vout->p_sys->i_size ; i_index++ )
{
......
......@@ -1202,6 +1202,9 @@ static void* RunThread( void *p_this )
picture_Copy( p_pic, p_directbuffer );
p_pic->format.i_sar_num = p_vout->fmt_out.i_sar_num;
p_pic->format.i_sar_den = p_vout->fmt_out.i_sar_den;
p_pic->p_next = p_vout->p->snapshot.p_picture;
p_vout->p->snapshot.p_picture = p_pic;
p_vout->p->snapshot.i_request--;
......
......@@ -1001,30 +1001,37 @@ int picture_Export( vlc_object_t *p_obj,
fmt_out.i_sar_num =
fmt_out.i_sar_den = 1;
fmt_out.i_chroma = i_format;
fmt_out.i_width = i_override_width;
fmt_out.i_height = i_override_height;
if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
/* compute original width/height */
unsigned int i_original_width;
unsigned int i_original_height;
if( fmt_in.i_sar_num >= fmt_in.i_sar_den )
{
fmt_out.i_height = fmt_in.i_height * fmt_out.i_width / fmt_in.i_width;
const int i_height = fmt_out.i_height * fmt_in.i_sar_den / fmt_in.i_sar_num;
if( i_height > 0 )
fmt_out.i_height = i_height;
i_original_width = fmt_in.i_width * fmt_in.i_sar_num / fmt_in.i_sar_den;
i_original_height = fmt_in.i_height;
}
else
{
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
{
fmt_out.i_width = fmt_in.i_width;
fmt_out.i_height = fmt_in.i_height;
}
const int i_width = fmt_out.i_width * fmt_in.i_sar_num / fmt_in.i_sar_den;
if( i_width > 0 )
fmt_out.i_width = i_width;
i_original_width = fmt_in.i_width;
i_original_height = fmt_in.i_height * fmt_in.i_sar_den / fmt_in.i_sar_num;
}
/* */
fmt_out.i_width = ( i_override_width < 0 ) ?
i_original_width : i_override_width;
fmt_out.i_height = ( i_override_height < 0 ) ?
i_original_height : i_override_height;
/* scale if only one direction is provided */
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_sar_den / fmt_in.i_width / fmt_in.i_sar_num;
}
else 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_sar_num / fmt_in.i_height / fmt_in.i_sar_den;
}
image_handler_t *p_image = image_HandlerCreate( p_obj );
......
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