* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.5 2002/02/15 13:32:53 sam Exp $
+ * $Id: deinterlace.c,v 1.14 2002/06/01 18:04:48 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.
*****************************************************************************/
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_STRING ( "deinterlace-mode", "bob", NULL, N_("Deinterlace mode"),
+ N_("one of 'bob' and 'blend'") )
MODULE_CONFIG_STOP
MODULE_INIT_START
- SET_DESCRIPTION( "deinterlacing module" )
+ SET_DESCRIPTION( _("deinterlacing 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 )
* This structure is part of the video output thread descriptor.
* It describes the Deinterlace specific properties of an output thread.
*****************************************************************************/
-typedef struct vout_sys_s
+struct vout_sys_s
{
int i_mode;
- struct vout_thread_s *p_vout;
+ vout_thread_t *p_vout;
mtime_t last_date;
-
-} vout_sys_t;
+};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-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 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 * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
- intf_ErrMsg("error: %s", strerror(ENOMEM) );
+ msg_Err( p_vout, "out of memory" );
return( 1 );
}
/* Look what method was requested */
- psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-
- while( *psz_method && *psz_method != ':' )
- {
- psz_method++;
- }
+ psz_method = config_GetPsz( p_vout, "deinterlace-mode" );
- if( !strcmp( psz_method, ":bob" ) )
+ if( psz_method == NULL )
{
+ msg_Err( p_vout, "configuration variable %s empty",
+ "deinterlace-mode" );
+ msg_Err( p_vout, "no valid deinterlace mode provided, using 'bob'" );
p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
}
- else if( !strcmp( psz_method, ":blend" ) )
- {
- p_vout->p_sys->i_mode = DEINTERLACE_MODE_BLEND;
- }
else
{
- intf_ErrMsg( "filter error: no valid deinterlace mode provided, "
- "using deinterlace:bob" );
- p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
+ if( !strcmp( psz_method, "bob" ) )
+ {
+ p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
+ }
+ else if( !strcmp( psz_method, "blend" ) )
+ {
+ p_vout->p_sys->i_mode = DEINTERLACE_MODE_BLEND;
+ }
+ else
+ {
+ msg_Err( p_vout, "no valid deinterlace mode provided, "
+ "using 'bob'" );
+ p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
+ }
}
+ free( psz_method );
+
return( 0 );
}
}
/* Try to open the real video output, with half the height our images */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPsz( p_vout, "filter" );
+ config_PutPsz( p_vout, "filter", NULL );
- intf_WarnMsg( 1, "filter: spawning the real video output" );
+ msg_Dbg( p_vout, "spawning the real video output" );
switch( p_vout->render.i_chroma )
{
{
case DEINTERLACE_MODE_BOB:
p_vout->p_sys->p_vout =
- vout_CreateThread( NULL,
+ vout_CreateThread( p_vout,
p_vout->output.i_width, p_vout->output.i_height / 2,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break;
case DEINTERLACE_MODE_BLEND:
p_vout->p_sys->p_vout =
- vout_CreateThread( NULL,
+ vout_CreateThread( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break;
case FOURCC_I422:
p_vout->p_sys->p_vout =
- vout_CreateThread( NULL,
+ vout_CreateThread( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
FOURCC_I420, p_vout->output.i_aspect );
break;
break;
}
+ config_PutPsz( p_vout, "filter", psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
- intf_ErrMsg( "filter error: can't open vout, aborting" );
+ msg_Err( p_vout, "cannot open vout, aborting" );
return( 0 );
}
p_vout->p_sys->last_date = 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 ]->p_data );
+ free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
}
}
*****************************************************************************/
static void vout_Destroy( vout_thread_t *p_vout )
{
- vout_DestroyThread( p_vout->p_sys->p_vout, NULL );
+ vout_DestroyThread( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
}
case DEINTERLACE_MODE_BOB:
for( ; p_out < p_out_end ; )
{
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_out += p_pic->p[i_plane].i_pitch;
p_in += 2 * p_pic->p[i_plane].i_pitch;
break;
case DEINTERLACE_MODE_BLEND:
- if( i_plane != Y_PLANE )
- {
- for( ; p_out < p_out_end ; )
- {
- FAST_MEMCPY( p_out, p_in,
- p_pic->p[i_plane].i_pitch );
-
- p_out += p_pic->p[i_plane].i_pitch;
-
- FAST_MEMCPY( p_out, p_in,
- p_pic->p[i_plane].i_pitch );
-
- p_out += p_pic->p[i_plane].i_pitch;
- p_in += 2 * p_pic->p[i_plane].i_pitch;
- }
- break;
- }
-
if( i_field == 0 )
{
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_pic->p[i_plane].i_pitch;
}
+ p_out_end -= p_outpic->p[i_plane].i_pitch;
+
for( ; p_out < p_out_end ; )
{
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_out += p_pic->p[i_plane].i_pitch;
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_pic->p[i_plane].i_pitch;
}
+
+#if 0
+ if( i_field == 0 )
+ {
+ p_in -= 2 * p_pic->p[i_plane].i_pitch;
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
+ }
+#endif
+
break;
}
break;
{
for( ; p_out < p_out_end ; )
{
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_out += p_pic->p[i_plane].i_pitch;
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_out += p_pic->p[i_plane].i_pitch;
p_in += i_increment;
}
{
for( ; p_out < p_out_end ; )
{
- FAST_MEMCPY( p_out, p_in, p_pic->p[i_plane].i_pitch );
+ p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_pic->p[i_plane].i_pitch );
p_out += p_pic->p[i_plane].i_pitch;
p_in += i_increment;
}