# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <math.h>
* Module descriptor
*****************************************************************************/
vlc_module_begin();
- set_description( _("Magnify/Zoom interactive video filter") );
- set_shortname( _( "Magnify" ));
+ set_description( N_("Magnify/Zoom interactive video filter") );
+ set_shortname( N_( "Magnify" ));
set_capability( "video filter", 0 );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VFILTER );
int i_zoom; /* zoom level in percent */
int i_x, i_y; /* top left corner coordinates in original image */
- vlc_bool_t b_visible; /* is "interface" visible ? */
+ bool b_visible; /* is "interface" visible ? */
};
/*****************************************************************************
/* 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->p_sys->p_image = image_HandlerCreate( p_vout );
p_vout->p_sys->i_y = 0;
#define ZOOM_FACTOR 8
p_vout->p_sys->i_zoom = 2*ZOOM_FACTOR;
- p_vout->p_sys->b_visible = VLC_TRUE;
+ p_vout->p_sys->b_visible = true;
var_AddCallback( p_vout->p_sys->p_vout, "mouse-x", MouseEvent, p_vout );
var_AddCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout );
{
int i_index;
+ DEL_PARENT_CALLBACKS( SendEventsToChild );
+
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
/* Free the fake output buffers we allocated */
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
var_DelCallback( p_vout->p_sys->p_vout, "mouse-x", MouseEvent, p_vout);
var_DelCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout);
var_DelCallback( p_vout->p_sys->p_vout, "mouse-clicked", MouseEvent, p_vout);
+
+ vout_CloseAndRelease( p_vout->p_sys->p_vout );
}
/*****************************************************************************
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- 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 );
- }
-
image_HandlerDelete( p_vout->p_sys->p_image );
- DEL_PARENT_CALLBACKS( SendEventsToChild );
free( p_vout->p_sys );
}
while( ( p_outpic = vout_CreatePicture( 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 )
{
return;
}
{
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
- p_vout->p_libvlc->
- pf_memcpy( p_outpic->p[i_plane].p_pixels, p_pic->p[i_plane].p_pixels,
+ vlc_memcpy( p_outpic->p[i_plane].p_pixels, p_pic->p[i_plane].p_pixels,
p_outpic->p[i_plane].i_lines * p_outpic->p[i_plane].i_pitch );
}
}
{
for( y=0; y<p_converted->p[i_plane].i_visible_lines; y++)
{
- p_vout->p_libvlc->pf_memcpy(
+ vlc_memcpy(
p_outpic->p[i_plane].p_pixels+y*p_outpic->p[i_plane].i_pitch,
p_converted->p[i_plane].p_pixels+y*p_converted->p[i_plane].i_pitch,
p_converted->p[i_plane].i_visible_pitch );
}
}
- p_converted->pf_release( p_converted );
+ picture_Release( p_converted );
/* white rectangle on visualization */
v_w = p_oyp->i_pitch*ZOOM_FACTOR/(VIS_ZOOM*o_zoom);
v_h = (o_y+p_oyp->i_lines*ZOOM_FACTOR/o_zoom)/VIS_ZOOM;
/* top line */
- p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ vlc_memset( p_oyp->p_pixels
+ o_y/VIS_ZOOM*p_oyp->i_pitch
+ o_x/VIS_ZOOM, 0xff, v_w+1 );
] = 0xff;
}
/* bottom line */
- p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ vlc_memset( p_oyp->p_pixels
+ v_h*p_oyp->i_pitch
+ o_x/VIS_ZOOM, 0xff, v_w+1 );
if( p_vout->p_sys->b_visible )
{
/* zoom gauge */
- p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
- + (v_h+9)*p_oyp->i_pitch,
- 0xff, 41 );
+ vlc_memset( p_oyp->p_pixels + (v_h+9)*p_oyp->i_pitch, 0xff, 41 );
for( y = v_h + 10; y < v_h + 90; y++ )
{
int width = v_h + 90 - y;
width = (width*width)/160;
- if( (80 - y + v_h)*10 < o_zoom )
+ if( (80 - y + v_h)*ZOOM_FACTOR/10 < o_zoom )
{
- p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
- + y*p_oyp->i_pitch,
- 0xff, width );
+ vlc_memset( p_oyp->p_pixels + y*p_oyp->i_pitch, 0xff, width );
}
else
{
}
}
}
-
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
&& mouse&MOUSE_CLICKED )
{
/* mouse is over the "VLC ZOOM HIDE" text */
- p_vout->p_sys->b_visible = VLC_FALSE;
+ p_vout->p_sys->b_visible = false;
}
else if( (int)p_vout->output.i_height/VIS_ZOOM + 9 <= valy.i_int
&& valy.i_int <= (int)p_vout->output.i_height/VIS_ZOOM + 90
&& valy.i_int <= 10 && mouse&MOUSE_CLICKED )
{
/* mouse is over the "VLC ZOOM SHOW" text */
- p_vout->p_sys->b_visible = VLC_TRUE;
+ p_vout->p_sys->b_visible = true;
}
else if( mouse&MOUSE_MOVE_X && !(mouse&MOUSE_CLICKED) )
{