+
+
+/*****************************************************************************
+ * video filter2 functions
+ *****************************************************************************/
+static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_filter->p_sys;
+ picture_t *p_pic_dst;
+
+ /* Request output picture */
+ p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+ if( p_pic_dst == NULL )
+ {
+ msg_Warn( p_filter, "can't get output picture" );
+ return NULL;
+ }
+
+ switch( p_vout->p_sys->i_mode )
+ {
+ case DEINTERLACE_DISCARD:
+#if 0
+ 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 );
+ return p_pic;
+ break;
+
+ case DEINTERLACE_BOB:
+#if 0
+ RenderBob( p_vout, pp_outpic[0], p_pic, 0 );
+ RenderBob( p_vout, pp_outpic[1], p_pic, 1 );
+ break;
+#endif
+
+ case DEINTERLACE_LINEAR:
+#if 0
+ RenderLinear( p_vout, pp_outpic[0], p_pic, 0 );
+ 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 );
+ return p_pic;
+ break;
+
+ case DEINTERLACE_MEAN:
+ RenderMean( p_vout, p_pic_dst, p_pic );
+ break;
+
+ case DEINTERLACE_BLEND:
+ RenderBlend( p_vout, p_pic_dst, p_pic );
+ break;
+
+ case DEINTERLACE_X:
+ RenderX( p_vout, p_pic_dst, p_pic );
+ 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;
+ p_pic_dst->b_progressive = VLC_TRUE;
+ p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
+
+ p_pic->pf_release( p_pic );
+ return p_pic_dst;
+}
+
+/*****************************************************************************
+ * OpenFilter:
+ *****************************************************************************/
+static int OpenFilter( vlc_object_t *p_this )
+{
+ filter_t *p_filter = (filter_t*)p_this;
+ vout_thread_t *p_vout;
+ vlc_value_t val;
+
+ if( ( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','0') &&
+ p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','Y','U','V') &&
+ p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','V','1','2') ) ||
+ p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
+ {
+ return VLC_EGENERIC;
+ }
+
+ /* Impossible to use VLC_OBJECT_VOUT here because it would be used
+ * by spu filters */
+ p_vout = vlc_object_create( p_filter, sizeof(vout_thread_t) );
+ vlc_object_attach( p_vout, p_filter );
+ p_filter->p_sys = (filter_sys_t *)p_vout;
+ p_vout->render.i_chroma = p_filter->fmt_in.video.i_chroma;
+
+ sout_CfgParse( p_filter, FILTER_CFG_PREFIX, ppsz_filter_options,
+ p_filter->p_cfg );
+ var_Get( p_filter, FILTER_CFG_PREFIX "mode", &val );
+ var_Create( p_filter, "deinterlace-mode", VLC_VAR_STRING );
+ var_Set( p_filter, "deinterlace-mode", val );
+
+ if ( Create( VLC_OBJECT(p_vout) ) != VLC_SUCCESS )
+ {
+ vlc_object_detach( p_vout );
+ vlc_object_release( p_vout );
+ return VLC_EGENERIC;
+ }
+
+ p_filter->pf_video_filter = Deinterlace;
+
+ msg_Dbg( p_filter, "deinterlacing" );
+
+ return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * CloseFilter: clean up the filter
+ *****************************************************************************/
+static void CloseFilter( vlc_object_t *p_this )
+{
+ filter_t *p_filter = (filter_t*)p_this;
+ vout_thread_t *p_vout = (vout_thread_t *)p_filter->p_sys;
+
+ Destroy( VLC_OBJECT(p_vout) );
+ vlc_object_detach( p_vout );
+ vlc_object_release( p_vout );
+}
+