* clone.c : Clone video plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: clone.c,v 1.2 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: clone.c,v 1.8 2002/07/20 18:01:42 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
-#include <videolan/vlc.h>
-
-#include "video.h"
-#include "video_output.h"
+#include <vlc/vlc.h>
+#include <vlc/vout.h>
#include "filter_common.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
+#define COUNT_TEXT N_("Number of clones")
+#define COUNT_LONGTEXT N_("Select the number of video windows in which to "\
+ "clone the video")
+
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_INTEGER ( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( _("image clone 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_CAPABILITY( VOUT_FILTER, 0 )
ADD_SHORTCUT( "clone" )
MODULE_INIT_STOP
* This structure is part of the video output thread descriptor.
* It describes the Clone specific properties of an output thread.
*****************************************************************************/
-typedef struct vout_sys_s
+struct vout_sys_t
{
int i_clones;
vout_thread_t **pp_vout;
-
-} vout_sys_t;
+};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
- char *psz_method, *psz_method_orig;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
- intf_ErrMsg( "vout error: out of memory" );
+ msg_Err( p_vout, "out of memory" );
return( 1 );
}
/* Look what method was requested */
- if( !(psz_method = psz_method_orig = config_GetPszVariable( "filter" )) )
- {
- intf_ErrMsg( "vout error: configuration variable %s empty", "filter" );
- return( 1 );
- }
-
- while( *psz_method && *psz_method != ':' )
- {
- psz_method++;
- }
-
- if( *psz_method )
- {
- p_vout->p_sys->i_clones = atoi( psz_method + 1 );
- }
- else
- {
- intf_ErrMsg( "vout error: "
- "no valid clone count provided, using clone:2" );
- p_vout->p_sys->i_clones = 2;
- }
+ p_vout->p_sys->i_clones = config_GetInt( p_vout, "clone-count" );
p_vout->p_sys->i_clones = __MAX( 1, __MIN( 99, p_vout->p_sys->i_clones ) );
- intf_WarnMsg( 3, "vout info: spawning %i clone(s)",
- p_vout->p_sys->i_clones );
+ msg_Dbg( p_vout, "spawning %i clone(s)", p_vout->p_sys->i_clones );
p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_clones *
sizeof(vout_thread_t *) );
if( p_vout->p_sys->pp_vout == NULL )
{
- intf_ErrMsg( "vout error: out of memory" );
- free( psz_method_orig );
+ msg_Err( p_vout, "out of memory" );
free( p_vout->p_sys );
return( 1 );
}
- free( psz_method_orig );
-
return( 0 );
}
static int vout_Init( vout_thread_t *p_vout )
{
int i_index, i_vout;
- char *psz_filter;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Try to open the real video output */
- psz_filter = config_GetPszVariable( "filter" );
- config_PutPszVariable( "filter", NULL );
-
- intf_WarnMsg( 3, "vout info: spawning the real video outputs" );
+ msg_Dbg( p_vout, "spawning the real video outputs" );
for( i_vout = 0; i_vout < p_vout->p_sys->i_clones; i_vout++ )
{
p_vout->p_sys->pp_vout[ i_vout ] =
- vout_CreateThread( NULL,
+ vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
if( p_vout->p_sys->pp_vout[ i_vout ] == NULL )
{
- intf_ErrMsg( "vout error: failed to clone %i vout threads",
- p_vout->p_sys->i_clones );
+ msg_Err( p_vout, "failed to clone %i vout threads",
+ p_vout->p_sys->i_clones );
p_vout->p_sys->i_clones = i_vout;
RemoveAllVout( p_vout );
- config_PutPszVariable( "filter", psz_filter );
- if( psz_filter ) free( psz_filter );
return 0;
}
}
- config_PutPszVariable( "filter", psz_filter );
- if( psz_filter ) free( psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
while( p_in < p_in_end )
{
- FAST_MEMCPY( p_out, p_in, i_out_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
while( p_vout->p_sys->i_clones )
{
--p_vout->p_sys->i_clones;
- vout_DestroyThread(
- p_vout->p_sys->pp_vout[ p_vout->p_sys->i_clones ], NULL );
+ vout_DestroyThread( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
}
}