* invert.c : Invert video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: invert.c,v 1.2 2001/12/19 03:50:22 sam Exp $
+ * $Id: invert.c,v 1.8 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-#define MODULE_NAME filter_invert
-#include "modules_inner.h"
-
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "defs.h"
-
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
-#include "common.h" /* boolean_t, byte_t */
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
+#include <videolan/vlc.h>
#include "video.h"
#include "video_output.h"
#include "filter_common.h"
-#include "modules.h"
-#include "modules_export.h"
-
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for Invert module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
- p_module->i_capabilities = MODULE_CAPABILITY_NULL
- | MODULE_CAPABILITY_VOUT;
- p_module->psz_longname = "invert video module";
+ SET_DESCRIPTION( "invert 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( "invert" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int vout_Probe ( probedata_t *p_data );
static int vout_Create ( struct vout_thread_s * );
static int vout_Init ( struct vout_thread_s * );
static void vout_End ( struct vout_thread_s * );
static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * );
+static void vout_Render ( struct vout_thread_s *, struct picture_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * );
/*****************************************************************************
*****************************************************************************/
static void vout_getfunctions( function_list_t * p_function_list )
{
- p_function_list->pf_probe = vout_Probe;
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;
- p_function_list->functions.vout.pf_setpalette = NULL;
-}
-
-/*****************************************************************************
- * intf_Probe: return a score
- *****************************************************************************/
-static int vout_Probe( probedata_t *p_data )
-{
- if( TestMethod( VOUT_FILTER_VAR, "invert" ) )
- {
- return( 999 );
- }
-
- /* If we weren't asked to filter, don't filter. */
- return( 0 );
}
/*****************************************************************************
int i_index;
char *psz_filter;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
- switch( p_vout->render.i_chroma )
- {
- case YUV_420_PICTURE:
- 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;
- break;
-
- default:
- return( 0 ); /* unknown chroma */
- break;
- }
+ 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;
/* Try to open the real video output */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video output" );
-
+
p_vout->p_sys->p_vout =
vout_CreateThread( NULL,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
return( 0 );
}
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
i_index--;
- free( PP_OUTPUTPICTURE[ i_index ]->planes[ 0 ].p_data );
+ free( PP_OUTPUTPICTURE[ i_index ]->p_data );
}
}
}
/*****************************************************************************
- * vout_Display: displays previously rendered output
+ * vout_Render: 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 vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
{
picture_t *p_outpic;
int i_index;
msleep( VOUT_OUTMEM_SLEEP );
}
- vout_DatePicture( p_vout->p_sys->p_vout, p_outpic, mdate() + 50000 );
+ 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_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{
- pixel_data_t *p_in, *p_in_end, *p_out;
+ u8 *p_in, *p_in_end, *p_out;
- p_in = p_pic->planes[ i_index ].p_data;
- p_in_end = p_in + p_pic->planes[ i_index ].i_bytes - 64;
+ p_in = p_pic->p[i_index].p_pixels;
+ p_in_end = p_in - 64 + p_pic->p[i_index].i_lines
+ * p_pic->p[i_index].i_pitch;
- p_out = p_outpic->planes[ i_index ].p_data;
+ p_out = p_outpic->p[i_index].p_pixels;
for( ; p_in < p_in_end ; )
{
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
+/*****************************************************************************
+ * 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 )
+{
+ ;
+}
+