/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include <vlc/vlc.h>
-#include <vlc_plugin.h>
-#include <vlc_vout.h>
-#include <vlc_sout.h>
-#include "vlc_filter.h"
+#include <errno.h>
#ifdef HAVE_ALTIVEC_H
# include <altivec.h>
#endif
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_vout.h>
+#include <vlc_sout.h>
+#include "vlc_filter.h"
+
#ifdef CAN_COMPILE_MMXEXT
# include "mmx.h"
#endif
#define FILTER_CFG_PREFIX "sout-deinterlace-"
-static const char *mode_list[] = { "discard", "blend", "mean", "bob", "linear", "x" };
-static const char *mode_list_text[] = { N_("Discard"), N_("Blend"), N_("Mean"),
- N_("Bob"), N_("Linear"), "X" };
+static const char *const mode_list[] = {
+ "discard", "blend", "mean", "bob", "linear", "x" };
+static const char *const mode_list_text[] = {
+ N_("Discard"), N_("Blend"), N_("Mean"), N_("Bob"), N_("Linear"), "X" };
vlc_module_begin();
set_description( N_("Deinterlacing video filter") );
set_callbacks( OpenFilter, CloseFilter );
vlc_module_end();
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
"mode", NULL
};
/* 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 VLC_ENOMEM;
- }
p_vout->pf_init = Init;
p_vout->pf_end = End;
{
int i_index;
+ DEL_PARENT_CALLBACKS( SendEventsToChild );
+
+ if( p_vout->p_sys->p_vout )
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
/* Free the fake output buffers we allocated */
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
}
if( p_vout->p_sys->p_vout )
- {
- DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
- vlc_object_detach( p_vout->p_sys->p_vout );
- vout_Destroy( p_vout->p_sys->p_vout );
- }
-
- DEL_PARENT_CALLBACKS( SendEventsToChild );
+ vout_CloseAndRelease( p_vout->p_sys->p_vout );
}
/*****************************************************************************
0, 0, 0 ) )
== NULL )
{
- if( p_vout->b_die || p_vout->b_error )
+ if( !vlc_object_alive (p_vout) || p_vout->b_error )
{
vlc_mutex_unlock( &p_vout->p_sys->filter_lock );
return;
0, 0, 0 ) )
== NULL )
{
- if( p_vout->b_die || p_vout->b_error )
+ if( !vlc_object_alive (p_vout) || p_vout->b_error )
{
vout_DestroyPicture( p_vout->p_sys->p_vout, pp_outpic[0] );
vlc_mutex_unlock( &p_vout->p_sys->filter_lock );
}
/* We need to kill the old vout */
-
- DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
-
- vlc_object_detach( p_vout->p_sys->p_vout );
- vout_Destroy( p_vout->p_sys->p_vout );
+ if( p_vout->p_sys->p_vout )
+ {
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ vout_CloseAndRelease( p_vout->p_sys->p_vout );
+ }
/* Try to open a new video output */
p_vout->p_sys->p_vout = SpawnRealVout( p_vout );
picture_t *p_pic_dst;
/* Request output picture */
- p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+ p_pic_dst = filter_NewPicture( p_filter );
if( p_pic_dst == NULL )
- {
- msg_Warn( p_filter, "can't get output picture" );
- return NULL;
- }
+ return p_pic;
switch( p_vout->p_sys->i_mode )
{
RenderDiscard( p_vout, p_pic_dst, p_pic, 0 );
#endif
msg_Err( p_vout, "discarding lines is not supported yet" );
- p_pic_dst->pf_release( p_pic_dst );
+ picture_Release( p_pic_dst );
return p_pic;
break;
RenderLinear( p_vout, pp_outpic[1], p_pic, 1 );
#endif
msg_Err( p_vout, "doubling the frame rate is not supported yet" );
- p_pic_dst->pf_release( p_pic_dst );
+ picture_Release( p_pic_dst );
return p_pic;
break;
break;
}
- p_pic_dst->date = p_pic->date;
- p_pic_dst->b_force = p_pic->b_force;
- p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
+ picture_CopyProperties( p_pic_dst, p_pic );
p_pic_dst->b_progressive = true;
- p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
return p_pic_dst;
}