Commit 211d6bad authored by Sam Hocevar's avatar Sam Hocevar

* ./src/video_output/video_output.c: fixed the "picture has invalid status"

    bug which might have been the cause of crashes.
  * ./plugins/filter/crop.c: attempt at an automatic border cropping filter,
    using "--filter crop --autocrop".
  * ./vlc.spec: added missing filters to the RPM generation.
  * ./src/misc/objects.c: commented all functions.
  * ./src/misc/objects.c: implemented vlc_object_find( , , FIND_ANYWHERE).
  * ./src/misc/objects.c: renamed vlc_object_unlink to vlc_object_detach.
parent 91eb944b
......@@ -4,6 +4,10 @@
HEAD
* ./src/misc/objects.c: commented all functions.
* ./src/misc/objects.c: implemented vlc_object_find( , , FIND_ANYWHERE).
* ./src/misc/objects.c: renamed vlc_object_unlink to vlc_object_detach.
* ALL: got rid of p_object->p_this which is now useless.
* ./include/main.h, ./plugins/beos/intf_beos.cpp: BeOS compilation fixes.
* ./bootstrap.sh, ./src/libvlc.h, ./po/*: fixed bootstrap.sh so that it does
not include CVS Id lines in automatically created files.
......@@ -27,6 +31,19 @@ HEAD
0.4.1
* ./src/video_output/video_output.c: fixed the "picture has invalid status"
bug which might have been the cause of crashes.
* ./plugins/filter/crop.c: attempt at an automatic border cropping filter,
using "--filter crop --autocrop".
* ./vlc.spec: added missing filters to the RPM generation.
* ./plugins/macosx/*: channel change support on Mac OS X.
* ./extras/MacOSX/Resources/vlc.icns: new OS X icon, courtesy of Benjamin
Mironer <bmironer@noos.fr>.
* ./plugins/filter/crop.c: crop filter. Usage examples:
--filter crop --crop-geometry 640x480
--filter crop --crop-geometry 320x200+10+10
* ./plugins/macosx/intf_vlc_wrapper.m: fixed a bug in the chapter handling.
* ./plugins/macosx/vout_vlc_wrapper.m: more keystrokes.
* ./plugins/chroma/i420_yuy2.h: simplified the chroma code. Please test
under BeOS and QNX.
* ./plugins/macosx/intf_vlc_wrapper.m: fix for non-ASCII filenames in the
......
......@@ -97,6 +97,7 @@ PLUGINS_TARGETS := a52/a52 \
fb/fb \
ffmpeg/ffmpeg \
filter/filter_clone \
filter/filter_crop \
filter/filter_deinterlace \
filter/filter_distort \
filter/filter_invert \
......
......@@ -5472,7 +5472,7 @@ case x"${target_cpu}" in
esac
BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix mpeg_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga"
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga"
MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
......
......@@ -413,7 +413,7 @@ dnl
dnl default modules
dnl
BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix mpeg_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga"
PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga"
dnl
dnl Accelerated modules
......
......@@ -267,3 +267,6 @@
/* Maximal size of the message queue - in case of overflow, all messages in the
* queue are printed, but not sent to the threads */
#define VLC_MSG_QSIZE 256
/* Maximal depth of the object tree output by vlc_dumpstructure */
#define MAX_DUMPSTRUCTURE_DEPTH 100
......@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.1 2002/06/01 12:31:58 sam Exp $
* $Id: vlc_objects.h,v 1.2 2002/06/02 09:03:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -47,8 +47,8 @@ VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_unlink, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_unlink_all, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach_all, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
#if 0
//VLC_EXPORT( void, __vlc_object_setchild, ( vlc_object_t *, vlc_object_t * ) );
......@@ -71,11 +71,11 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
#define vlc_object_release(a) \
__vlc_object_release( CAST_TO_VLC_OBJECT(a) )
#define vlc_object_unlink(a,b) \
__vlc_object_unlink( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) )
#define vlc_object_detach(a,b) \
__vlc_object_detach( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) )
#define vlc_object_unlink_all(a) \
__vlc_object_unlink_all( CAST_TO_VLC_OBJECT(a) )
#define vlc_object_detach_all(a) \
__vlc_object_detach_all( CAST_TO_VLC_OBJECT(a) )
#define vlc_object_attach(a,b) \
__vlc_object_attach( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) )
......
......@@ -129,8 +129,8 @@ struct module_symbols_s
void * (* __vlc_object_find_inner) ( vlc_object_t *, int, int ) ;
void (* __vlc_object_yield_inner) ( vlc_object_t * ) ;
void (* __vlc_object_release_inner) ( vlc_object_t * ) ;
void (* __vlc_object_unlink_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_unlink_all_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_detach_all_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
};
......@@ -263,8 +263,8 @@ struct module_symbols_s
# define __vlc_object_find p_symbols->__vlc_object_find_inner
# define __vlc_object_yield p_symbols->__vlc_object_yield_inner
# define __vlc_object_release p_symbols->__vlc_object_release_inner
# define __vlc_object_unlink p_symbols->__vlc_object_unlink_inner
# define __vlc_object_unlink_all p_symbols->__vlc_object_unlink_all_inner
# define __vlc_object_detach p_symbols->__vlc_object_detach_inner
# define __vlc_object_detach_all p_symbols->__vlc_object_detach_all_inner
# define __vlc_object_attach p_symbols->__vlc_object_attach_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
#endif /* __PLUGIN__ */
......
......@@ -2,7 +2,7 @@
* vout_aa.c: Aa video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aa.c,v 1.5 2002/06/01 12:31:58 sam Exp $
* $Id: aa.c,v 1.6 2002/06/02 09:03:53 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -220,8 +220,7 @@ static int vout_Manage( vout_thread_t *p_vout )
if ( b & AA_BUTTON3 )
{
intf_thread_t *p_intf;
p_intf = vlc_object_find( p_vout->p_vlc, VLC_OBJECT_INTF,
FIND_CHILD );
p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF, FIND_ANYWHERE );
if( p_intf )
{
p_intf->b_menu_change = 1;
......
......@@ -2,7 +2,7 @@
* aout_directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_directx.c,v 1.23 2002/06/01 16:45:34 sam Exp $
* $Id: aout_directx.c,v 1.24 2002/06/02 09:03:54 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -435,7 +435,7 @@ static void aout_Close( aout_thread_t *p_aout )
msg_Dbg( p_aout, "aout_Close" );
/* kill the position notification thread, if any */
vlc_object_unlink_all( p_aout->p_sys->p_notif );
vlc_object_detach_all( p_aout->p_sys->p_notif );
if( p_aout->p_sys->p_notif->b_thread )
{
p_aout->p_sys->p_notif->b_die = 1;
......
......@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.38 2002/06/01 16:45:34 sam Exp $
* $Id: vout_directx.c,v 1.39 2002/06/02 09:03:54 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -245,7 +245,7 @@ static void vout_Destroy( vout_thread_t *p_vout )
DirectXCloseDisplay( p_vout );
DirectXCloseDDraw( p_vout );
vlc_object_unlink_all( p_vout->p_sys->p_event );
vlc_object_detach_all( p_vout->p_sys->p_event );
/* Kill DirectXEventThread */
p_vout->p_sys->p_event->b_die = 1;
......
......@@ -2,7 +2,7 @@
* vout_events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_events.c,v 1.21 2002/06/01 18:04:48 sam Exp $
* $Id: vout_events.c,v 1.22 2002/06/02 09:03:54 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -116,8 +116,8 @@ void DirectXEventThread( event_thread_t *p_event )
case WM_RBUTTONUP:
{
intf_thread_t *p_intf;
p_intf = vlc_object_find( p_event->p_vlc, VLC_OBJECT_INTF,
FIND_CHILD );
p_intf = vlc_object_find( p_event, VLC_OBJECT_INTF,
FIND_ANYWHERE );
if( p_intf )
{
p_intf->b_menu_change = 1;
......
......@@ -4,3 +4,4 @@ filter_invert_SOURCES = invert.c
filter_distort_SOURCES = distort.c
filter_wall_SOURCES = wall.c
filter_clone_SOURCES = clone.c
filter_crop_SOURCES = crop.c
/*****************************************************************************
* crop.c : Crop video plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: crop.c,v 1.2 2002/06/02 09:03:54 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "filter_common.h"
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
static void vout_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_STRING ( "crop-geometry", NULL, NULL, N_("Crop geometry"), N_("Set the geometry of the zone to crop") )
ADD_BOOL ( "autocrop", 0, NULL, N_("Automatic cropping"), N_("Activate automatic black border cropping") )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( _("image crop video module") )
/* Capability score set to 0 because we don't want to be spawned
* as a video output unless explicitly requested to */
ADD_CAPABILITY( VOUT, 0 )
ADD_SHORTCUT( "crop" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
vout_getfunctions( &p_module->p_functions->vout );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* vout_sys_t: Crop video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the Crop specific properties of an output thread.
*****************************************************************************/
struct vout_sys_s
{
vout_thread_t *p_vout;
unsigned int i_x, i_y;
unsigned int i_width, i_height, i_aspect;
vlc_bool_t b_autocrop;
/* Autocrop specific variables */
unsigned int i_lastchange;
vlc_bool_t b_changed;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int vout_Create ( vout_thread_t * );
static int vout_Init ( vout_thread_t * );
static void vout_End ( vout_thread_t * );
static void vout_Destroy ( vout_thread_t * );
static int vout_Manage ( vout_thread_t * );
static void vout_Render ( vout_thread_t *, picture_t * );
static void vout_Display ( vout_thread_t *, picture_t * );
static void UpdateStats ( vout_thread_t *, picture_t * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void vout_getfunctions( function_list_t * p_function_list )
{
p_function_list->functions.vout.pf_create = vout_Create;
p_function_list->functions.vout.pf_init = vout_Init;
p_function_list->functions.vout.pf_end = vout_End;
p_function_list->functions.vout.pf_destroy = vout_Destroy;
p_function_list->functions.vout.pf_manage = vout_Manage;
p_function_list->functions.vout.pf_render = vout_Render;
p_function_list->functions.vout.pf_display = vout_Display;
}
/*****************************************************************************
* vout_Create: allocates Crop video thread output method
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return 1;
}
return 0;
}
/*****************************************************************************
* vout_Init: initialize Crop video thread output method
*****************************************************************************/
static int vout_Init( vout_thread_t *p_vout )
{
int i_index;
char *psz_var;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
p_vout->p_sys->i_lastchange = 0;
p_vout->p_sys->b_changed = 0;
/* Initialize the output structure */
p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Shall we use autocrop ? */
p_vout->p_sys->b_autocrop = config_GetInt( p_vout, "autocrop" );
/* Get geometry value from the user */
psz_var = config_GetPsz( p_vout, "crop-geometry" );
if( psz_var )
{
char *psz_parser, *psz_tmp;
psz_parser = psz_tmp = psz_var;
while( *psz_tmp && *psz_tmp != 'x' ) psz_tmp++;
if( *psz_tmp )
{
psz_tmp[0] = '\0';
p_vout->p_sys->i_width = atoi( psz_parser );
psz_parser = ++psz_tmp;
while( *psz_tmp && *psz_tmp != '+' ) psz_tmp++;
if( *psz_tmp )
{
psz_tmp[0] = '\0';
p_vout->p_sys->i_height = atoi( psz_parser );
psz_parser = ++psz_tmp;
while( *psz_tmp && *psz_tmp != '+' ) psz_tmp++;
if( *psz_tmp )
{
psz_tmp[0] = '\0';
p_vout->p_sys->i_x = atoi( psz_parser );
p_vout->p_sys->i_y = atoi( ++psz_tmp );
}
else
{
p_vout->p_sys->i_x = atoi( psz_parser );
p_vout->p_sys->i_y =
( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2;
}
}
else
{
p_vout->p_sys->i_height = atoi( psz_parser );
p_vout->p_sys->i_x =
( p_vout->output.i_width - p_vout->p_sys->i_width ) / 2;
p_vout->p_sys->i_y =
( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2;
}
}
else
{
p_vout->p_sys->i_width = atoi( psz_parser );
p_vout->p_sys->i_height = p_vout->output.i_height;
p_vout->p_sys->i_x =
( p_vout->output.i_width - p_vout->p_sys->i_width ) / 2;
p_vout->p_sys->i_y =
( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2;
}
/* Check for validity */
if( p_vout->p_sys->i_x + p_vout->p_sys->i_width
> p_vout->output.i_width )
{
p_vout->p_sys->i_x = 0;
if( p_vout->p_sys->i_width > p_vout->output.i_width )
{
p_vout->p_sys->i_width = p_vout->output.i_width;
}
}
if( p_vout->p_sys->i_y + p_vout->p_sys->i_height
> p_vout->output.i_height )
{
p_vout->p_sys->i_y = 0;
if( p_vout->p_sys->i_height > p_vout->output.i_height )
{
p_vout->p_sys->i_height = p_vout->output.i_height;
}
}
free( psz_var );
}
else
{
p_vout->p_sys->i_width = p_vout->output.i_width;
p_vout->p_sys->i_height = p_vout->output.i_height;
p_vout->p_sys->i_x = p_vout->p_sys->i_y = 0;
}
/* Pheeew. Parsing done. */
msg_Dbg( p_vout, "cropping at %ix%i+%i+%i, %sautocropping",
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->p_sys->i_x, p_vout->p_sys->i_y,
p_vout->p_sys->b_autocrop ? "" : "not " );
/* Set current output image properties */
p_vout->p_sys->i_aspect = p_vout->output.i_aspect
* p_vout->output.i_height / p_vout->p_sys->i_height
* p_vout->p_sys->i_width / p_vout->output.i_width;
/* Try to open the real video output */
psz_var = config_GetPsz( p_vout, "filter" );
config_PutPsz( p_vout, "filter", NULL );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
config_PutPsz( p_vout, "filter", psz_var );
if( psz_var ) free( psz_var );
return 0;
}
config_PutPsz( p_vout, "filter", psz_var );
if( psz_var ) free( psz_var );
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return 0;
}
/*****************************************************************************
* vout_End: terminate Crop video thread output method
*****************************************************************************/
static void vout_End( vout_thread_t *p_vout )
{
int i_index;
/* Free the fake output buffers we allocated */
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
i_index--;
free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
}
}
/*****************************************************************************
* vout_Destroy: destroy Crop video thread output method
*****************************************************************************
* Terminate an output method created by CropCreateOutputMethod
*****************************************************************************/
static void vout_Destroy( vout_thread_t *p_vout )
{
vout_DestroyThread( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_Manage: handle Crop events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
static int vout_Manage( vout_thread_t *p_vout )
{
if( !p_vout->p_sys->b_changed )
{
return 0;
}
vout_DestroyThread( p_vout->p_sys->p_vout );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
return 1;
}
p_vout->p_sys->b_changed = 0;
p_vout->p_sys->i_lastchange = 0;
return 0;
}
/*****************************************************************************
* vout_Render: display previously rendered output
*****************************************************************************
* This function sends the currently rendered image to Crop image, waits
* until it is displayed and switches the two rendering buffers, preparing next
* frame.
*****************************************************************************/
static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
{
picture_t *p_outpic = NULL;
int i_plane;
if( p_vout->p_sys->b_changed )
{
return;
}
while( ( p_outpic =
vout_CreatePicture( p_vout->p_sys->p_vout, 0, 0, 0 )
) == NULL )
{
if( p_vout->b_die || p_vout->b_error )
{
vout_DestroyPicture( p_vout->p_sys->p_vout, p_outpic );
return;
}
msleep( VOUT_OUTMEM_SLEEP );
}
vout_DatePicture( p_vout->p_sys->p_vout, p_outpic, p_pic->date );
vout_LinkPicture( p_vout->p_sys->p_vout, p_outpic );
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
u8 *p_in, *p_out, *p_out_end;
int i_in_pitch = p_pic->p[i_plane].i_pitch;
const int i_out_pitch = p_outpic->p[i_plane].i_pitch;
p_in = p_pic->p[i_plane].p_pixels
/* Skip the right amount of lines */
+ i_in_pitch * ( p_pic->p[i_plane].i_lines * p_vout->p_sys->i_y
/ p_vout->output.i_height )
/* Skip the right amount of columns */
+ i_in_pitch * p_vout->p_sys->i_x / p_vout->output.i_width;
p_out = p_outpic->p[i_plane].p_pixels;
p_out_end = p_out + i_out_pitch * p_outpic->p[i_plane].i_lines;
while( p_out < p_out_end )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
}
vout_UnlinkPicture( p_vout->p_sys->p_vout, p_outpic );
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
/* The source image may still be in the cache ... parse it! */
if( !p_vout->p_sys->b_autocrop )
{
return;
}
UpdateStats( p_vout, p_pic );
}
/*****************************************************************************
* vout_Display: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to Invert image, waits
* until it is displayed and switch the two rendering buffers, preparing next
* frame.
*****************************************************************************/
static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
{
;
}
static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
{
u8 *p_in = p_pic->p[0].p_pixels;
int i_pitch = p_pic->p[0].i_pitch;
int i_lines = p_pic->p[0].i_lines;
int i_firstwhite = -1, i_lastwhite = -1, i;
/* Determine where black borders are */
switch( p_vout->output.i_chroma )
{
case FOURCC_I420:
/* XXX: Do not laugh ! I know this is very naive. But it's just a
* proof of concept code snippet... */
for( i = i_lines ; i-- ; )
{
const int i_col = i * i_pitch / i_lines;
if( p_in[i_col/2] > 40