Commit fed3ab9a authored by Sam Hocevar's avatar Sam Hocevar

* ./src/video_output/video_output.c: added a --aspect-ratio option to force

    the aspect ratio of the stream. Two different usages are possible, either
    int:int ("16:9") to specify a real aspect ratio, or float ("1.25") to
    specify pixel squareness.

    Note that it does not work properly yet; it will need an API change in
    the video output layer that I'm working on.
parent 81ddbebd
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.21 2002/11/07 19:31:08 gbazin Exp $
* $Id: libvlc.h,v 1.22 2002/11/28 14:34:39 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -164,6 +164,25 @@
"picture quality, for instance deinterlacing, or to clone or distort " \
"the video window.")
#define ASPECT_RATIO_TEXT N_("source aspect ratio")
#define ASPECT_RATIO_LONGTEXT N_( \
"This will force the source aspect ratio. For instance, some DVDs claim " \
"to be 16:9 while they are actually 4:3. This can also be used as a " \
"hint for VLC when a movie does not have aspect ratio information. " \
"Accepted formats are x:y (4:3, 16:9, etc.) expressing the global image " \
"aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \
"squareness.")
#if 0
#define PIXEL_RATIO_TEXT N_("destination aspect ratio")
#define PIXEL_RATIO_LONGTEXT N_( \
"This will force the destination pixel size. By default VLC assumes " \
"your pixels are square, unless your hardware has a way to tell it " \
"otherwise. This may be used when you output VLC's signal to another " \
"device such as a TV set. Accepted format is a float value (1, 1.25, " \
"1.3333, etc.) expressing pixel squareness.")
#endif
#define SERVER_PORT_TEXT N_("server port")
#define SERVER_PORT_LONGTEXT N_( \
"This is the port used for UDP streams. By default, we chose 1234.")
......@@ -194,7 +213,7 @@
#define IFACE_ADDR_LONGTEXT N_( \
"If you have several interfaces on your machine and use the " \
"multicast solution, you will probably have to indicate the IP address " \
"of your multicasting interface here.")
"of your multicasting interface here.")
#define INPUT_PROGRAM_TEXT N_("choose program (SID)")
#define INPUT_PROGRAM_LONGTEXT N_( \
......@@ -392,6 +411,11 @@ vlc_module_begin();
add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT, SPUMARGIN_LONGTEXT );
add_module( "filter", "video filter", NULL, NULL,
FILTER_TEXT, FILTER_LONGTEXT );
add_string( "aspect-ratio", "1", NULL,
ASPECT_RATIO_TEXT, ASPECT_RATIO_TEXT );
#if 0
add_string( "pixel-ratio", "1", NULL, PIXEL_RATIO_TEXT, PIXEL_RATIO_TEXT );
#endif
/* Input options */
add_category_hint( N_("Input"), NULL );
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.200 2002/11/20 13:37:36 sam Exp $
* $Id: video_output.c,v 1.201 2002/11/28 14:34:39 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -84,7 +84,41 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
* the video output pipe */
if( p_parent->i_object_type != VLC_OBJECT_VOUT )
{
/* look for the default filter configuration */
char *psz_aspect = config_GetPsz( p_parent, "aspect-ratio" );
/* Check whether the user tried to override aspect ratio */
if( psz_aspect )
{
unsigned int i_new_aspect = i_aspect;
char *psz_parser = strchr( psz_aspect, ':' );
if( psz_parser )
{
*psz_parser++ = '\0';
i_new_aspect = atoi( psz_aspect ) * VOUT_ASPECT_FACTOR
/ atoi( psz_parser );
}
else
{
i_new_aspect = i_width * VOUT_ASPECT_FACTOR
* atof( psz_aspect )
/ i_height;
}
free( psz_aspect );
if( i_new_aspect && i_new_aspect != i_aspect )
{
int i_pgcd = ReduceHeight( i_new_aspect );
msg_Dbg( p_vout, "overriding source aspect ratio to %i:%i",
i_new_aspect / i_pgcd, VOUT_ASPECT_FACTOR / i_pgcd );
i_aspect = i_new_aspect;
}
}
/* Look for the default filter configuration */
p_vout->psz_filter_chain = config_GetPsz( p_parent, "filter" );
}
else
......@@ -280,6 +314,27 @@ static int InitThread( vout_thread_t *p_vout )
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
if( !p_vout->psz_filter_chain )
{
char *psz_aspect = config_GetPsz( p_vout, "pixel-ratio" );
if( psz_aspect )
{
int i_new_aspect = p_vout->output.i_width * VOUT_ASPECT_FACTOR
* atof( psz_aspect )
/ p_vout->output.i_height;
free( psz_aspect );
if( i_new_aspect && i_new_aspect != p_vout->output.i_aspect )
{
int i_pgcd = ReduceHeight( i_new_aspect );
msg_Dbg( p_vout, "output ratio forced to %i:%i\n",
i_new_aspect / i_pgcd, VOUT_ASPECT_FACTOR / i_pgcd );
p_vout->output.i_aspect = i_new_aspect;
}
}
}
i_pgcd = ReduceHeight( p_vout->render.i_aspect );
msg_Dbg( p_vout,
"picture in %ix%i, chroma 0x%.8x (%4.4s), aspect ratio %i:%i",
......@@ -303,11 +358,10 @@ static int InitThread( vout_thread_t *p_vout )
p_vout->output.i_bmask );
/* Check whether we managed to create direct buffers similar to
* the render buffers, ie same size, chroma and aspect ratio */
* the render buffers, ie same size and chroma */
if( ( p_vout->output.i_width == p_vout->render.i_width )
&& ( p_vout->output.i_height == p_vout->render.i_height )
&& ( vout_ChromaCmp( p_vout->output.i_chroma, p_vout->render.i_chroma ) )
&& ( p_vout->output.i_aspect == p_vout->render.i_aspect ) )
&& ( vout_ChromaCmp( p_vout->output.i_chroma, p_vout->render.i_chroma ) ) )
{
/* Cool ! We have direct buffers, we can ask the decoder to
* directly decode into them ! Map the first render buffers to
......
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