From 1f54a473b6b3b38ebbdb9194f5b5c576b53f2204 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Mon, 21 Feb 2005 13:13:52 +0000 Subject: [PATCH] Basic mosaic, video blending modules * picture.c picture.h : vout that copies the rendered image in a libvlc object. * mosaic.c : sub filter that takes all the images created by the picture module and blends them over the current video I think i still have loads of things to fix (like memleaks) Simple vlm configuration file to see this work : <<<< new chan1 broadcast enabled setup chan1 input somevideo1.avi setup chan1 option vout=picture new chan2 broadcast enabled setup chan2 input somevideo2.avi setup chan2 option vout=picture new bg broadcast enabled setup bg input somevideo0.avi setup bg option sub-filter=mosaic control bg play control chan1 play control chan2 play >>>> You just have to launch : ./vlc -I telnet --vlm-conf vlm.conf --- configure.ac | 1 + modules/video_filter/Modules.am | 1 + modules/video_filter/mosaic.c | 331 ++++++++++++++++++++++++++++++++ modules/video_output/Modules.am | 1 + modules/video_output/picture.c | 301 +++++++++++++++++++++++++++++ modules/video_output/picture.h | 17 ++ 6 files changed, 652 insertions(+) create mode 100644 modules/video_filter/mosaic.c create mode 100644 modules/video_output/picture.c create mode 100644 modules/video_output/picture.h diff --git a/configure.ac b/configure.ac index baa21e2f0b..7cf321c7ea 100644 --- a/configure.ac +++ b/configure.ac @@ -986,6 +986,7 @@ VLC_ADD_PLUGINS([aout_file equalizer]) VLC_ADD_PLUGINS([i420_rgb i420_yuy2 i422_yuy2 i420_ymga]) VLC_ADD_PLUGINS([id3 playlist export sgimb m3u xtag]) VLC_ADD_PLUGINS([rawvideo blend scale image logo]) +VLC_ADD_PLUGINS([picture mosaic]) VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au]) VLC_ADD_PLUGINS([access_file access_udp access_tcp access_http access_mms]) VLC_ADD_PLUGINS([access_ftp ipv4]) diff --git a/modules/video_filter/Modules.am b/modules/video_filter/Modules.am index 0596d2a20f..453a4aef6b 100644 --- a/modules/video_filter/Modules.am +++ b/modules/video_filter/Modules.am @@ -1,3 +1,4 @@ +SOURCES_mosaic = mosaic.c SOURCES_transform = transform.c SOURCES_invert = invert.c SOURCES_adjust = adjust.c diff --git a/modules/video_filter/mosaic.c b/modules/video_filter/mosaic.c new file mode 100644 index 0000000000..bfd21013fb --- /dev/null +++ b/modules/video_filter/mosaic.c @@ -0,0 +1,331 @@ +/***************************************************************************** +* mosaic.c : Mosaic video plugin for vlc +***************************************************************************** +* Copyright (C) 2004 VideoLAN +* $Id: $ +* +* Authors: Antoine Cellerier +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. +*****************************************************************************/ + +/***************************************************************************** +* Preamble +*****************************************************************************/ +#include /* malloc(), free() */ +#include +#include + +#include +#include + +#include "vlc_filter.h" +#include "vlc_input.h" + +#include "vlc_image.h" + +/***************************************************************************** +* Local prototypes +*****************************************************************************/ + +static int CreateFilter ( vlc_object_t * ); +static void DestroyFilter ( vlc_object_t * ); + +static subpicture_t *Filter( filter_t *, mtime_t ); + +/***************************************************************************** +* filter_sys_t : filter desriptor +*****************************************************************************/ + +#include "../video_output/picture.h" + +struct filter_sys_t +{ + + image_handler_t *p_image; + image_handler_t *p_image2; + picture_t *p_pic; + + int i_pos; /* mosaic positioning method */ + int i_width, i_height; /* mosaic height and width */ + int i_cols, i_rows; /* mosaic rows and cols */ + int i_xoffset, i_yoffset; /* top left corner offset */ + int i_vborder, i_hborder; /* border width/height between miniatures */ + int i_alpha; /* subfilter alpha blending */ + +}; + +/***************************************************************************** +* Module descriptor +*****************************************************************************/ + +#define ALPHA_TEXT N_("Mosaic alpha blending (0 -> 255)") +#define ALPHA_LONGTEXT N_("Mosaic alpha blending (0 -> 255). default is 255") + +#define HEIGHT_TEXT N_("Mosaic height in pixels") +#define WIDTH_TEXT N_("Mosaic width in pixels") +#define XOFFSET_TEXT N_("Mosaic top left corner x coordinate") +#define YOFFSET_TEXT N_("Mosaic top left corner y coordinate") +#define VBORDER_TEXT N_("Mosaic vertical border width in pixels") +#define HBORDER_TEXT N_("Mosaic horizontal border width in pixels") + +#define POS_TEXT N_("Mosaic positioning method") +#define ROWS_TEXT N_("Mosaic number of rows") +#define COLS_TEXT N_("Mosaic number of columns") + +static int pi_pos_values[] = { 0, 1 }; +static char * ppsz_pos_descriptions[] = +{ N_("auto"), N_("fixed") }; + + +vlc_module_begin(); + set_description( _("Mosaic video sub filter") ); + set_shortname( N_("Mosaic") ); + set_capability( "sub filter", 0 ); + set_category( CAT_VIDEO ); + set_subcategory( SUBCAT_VIDEO_SUBPIC ); + set_callbacks( CreateFilter, DestroyFilter ); + + add_integer( "mosaic-alpha", 255, NULL, ALPHA_TEXT, ALPHA_LONGTEXT, VLC_FALSE ); + add_integer( "mosaic-height", 100, NULL, HEIGHT_TEXT, HEIGHT_TEXT, VLC_FALSE ); + add_integer( "mosaic-width", 100, NULL, WIDTH_TEXT, WIDTH_TEXT, VLC_FALSE ); + add_integer( "mosaic-xoffset", 0, NULL, XOFFSET_TEXT, XOFFSET_TEXT, VLC_FALSE ); + add_integer( "mosaic-yoffset", 0, NULL, YOFFSET_TEXT, YOFFSET_TEXT, VLC_FALSE ); + add_integer( "mosaic-vborder", 0, NULL, VBORDER_TEXT, VBORDER_TEXT, VLC_FALSE ); + add_integer( "mosaic-hborder", 0, NULL, HBORDER_TEXT, HBORDER_TEXT, VLC_FALSE ); + + add_integer( "mosaic-position", 0, NULL, POS_TEXT, POS_TEXT, VLC_TRUE ); + change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 ); + add_integer( "mosaic-rows", 2, NULL, ROWS_TEXT, ROWS_TEXT, VLC_FALSE ); + add_integer( "mosaic-cols", 2, NULL, COLS_TEXT, COLS_TEXT, VLC_FALSE ); +vlc_module_end(); + + +/***************************************************************************** +* CreateFiler: allocates mosaic video filter +*****************************************************************************/ + +static int CreateFilter( vlc_object_t *p_this ) +{ + filter_t *p_filter = (filter_t *)p_this; + filter_sys_t *p_sys; + + /* Allocate structure */ + p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); + if( p_sys == NULL ) + { + msg_Err( p_filter, "out of memory" ); + return VLC_ENOMEM; + } + p_sys->p_image = image_HandlerCreate( p_filter ); + p_sys->p_image2 = image_HandlerCreate( p_filter ); + + p_filter->pf_sub_filter = Filter; + p_sys->p_pic = NULL; + + p_sys->i_width = __MAX( 0, config_GetInt( p_filter, "mosaic-width" ) ); + p_sys->i_height = __MAX( 0, config_GetInt( p_filter, "mosaic-height" ) ); + + p_sys->i_xoffset = __MAX( 0, config_GetInt( p_filter, "mosaic-xoffset" ) ); + p_sys->i_yoffset = __MAX( 0, config_GetInt( p_filter, "mosaic-yoffset" ) ); + + p_sys->i_vborder = __MAX( 0, config_GetInt( p_filter, "mosaic-vborder" ) ); + p_sys->i_hborder = __MAX( 0, config_GetInt( p_filter, "mosaic-hborder" ) ); + + p_sys->i_rows = __MAX( 1, config_GetInt( p_filter, "mosaic-rows") ); + p_sys->i_cols = __MAX( 1, config_GetInt( p_filter, "mosaic-cols") ); + + p_sys->i_alpha = config_GetInt( p_filter, "mosaic-alpha" ); + p_sys->i_alpha = __MIN( 255, __MAX( 0, p_sys->i_alpha ) ); + + p_sys->i_pos = config_GetInt( p_filter, "mosaic-position" ); + if( p_sys->i_pos > 1 || p_sys->i_pos < 0 ) p_sys->i_pos = 0; + + return VLC_SUCCESS; +} + +/***************************************************************************** +* DestroyFilter: destroy mosaic video filter +*****************************************************************************/ + +static void DestroyFilter( vlc_object_t *p_this ) +{ + filter_t *p_filter = (filter_t*)p_this; + filter_sys_t *p_sys = p_filter->p_sys; + + image_HandlerDelete( p_sys->p_image ); + image_HandlerDelete( p_sys->p_image2 ); + + if( p_sys->p_pic ) p_sys->p_pic->pf_release( p_sys->p_pic ); + free( p_sys ); +} + +/***************************************************************************** +* Filter +*****************************************************************************/ + +static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) +{ + + filter_sys_t *p_sys = p_filter->p_sys; + subpicture_t *p_spu; + + libvlc_t *p_libvlc = p_filter->p_libvlc; + vlc_value_t val; + int i_index; + + subpicture_region_t *p_region; + subpicture_region_t *p_region_prev = NULL; + + struct picture_vout_t *p_picture_vout; + + if( var_Get( p_libvlc, "p_picture_vout", &val ) ) + { + return NULL; + } + + /* Allocate the subpicture internal data. */ + p_spu = p_filter->pf_sub_buffer_new( p_filter ); + if( !p_spu ) + { + return NULL; + } + + p_picture_vout = val.p_address; + + vlc_mutex_lock( &p_picture_vout->lock ); + + if( p_sys->i_pos == 0 ) /* use automatic positioning */ + { + int i_numpics = 0; + for( i_index = 0 ; + i_index < p_picture_vout->i_picture_num ; + i_index ++ ) + { + if( p_picture_vout->p_pic[i_index].i_status + == PICTURE_VOUT_E_OCCUPIED ) { + i_numpics ++; + } + } + p_sys->i_rows = ((int)ceil(sqrt( (float)i_numpics ))); + p_sys->i_cols = ( i_numpics%p_sys->i_rows == 0 ? + i_numpics/p_sys->i_rows : + i_numpics/p_sys->i_rows + 1 ); + } + + for( i_index = 0 ; i_index < p_picture_vout->i_picture_num ; i_index ++ ) + { + + video_format_t fmt_in = {0}, fmt_middle = {0}, fmt_out = {0}; + + picture_t *p_converted, *p_middle; + + if( p_picture_vout->p_pic[i_index].p_picture == NULL ) + { + break; + } + + if( p_picture_vout->p_pic[i_index].i_status + == PICTURE_VOUT_E_AVAILABLE ) + { + msg_Dbg( p_filter, "Picture Vout Element is empty"); + break; + } + + + /* Convert the images */ +/* fprintf (stderr, "Input image %ix%i %4.4s\n", + p_picture_vout->p_pic[i_index].p_picture->format.i_width, + p_picture_vout->p_pic[i_index].p_picture->format.i_height, + (char *)&p_picture_vout->p_pic[i_index].p_picture->format.i_chroma );*/ + + fmt_in.i_chroma = p_picture_vout->p_pic[i_index]. + p_picture->format.i_chroma; + fmt_in.i_height = p_picture_vout->p_pic[i_index]. + p_picture->format.i_height; + fmt_in.i_width = p_picture_vout->p_pic[i_index]. + p_picture->format.i_width; + + + fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); + fmt_out.i_width = fmt_in.i_width *( p_sys->i_width / p_sys->i_cols ) / fmt_in.i_width; + fmt_out.i_height = fmt_in.i_height*( p_sys->i_height / p_sys->i_rows ) / fmt_in.i_height; + fmt_out.i_visible_width = fmt_out.i_width; + fmt_out.i_visible_height = fmt_out.i_height; + + fmt_middle.i_chroma = fmt_in.i_chroma; + fmt_middle.i_visible_width = fmt_middle.i_width = fmt_out.i_width; + fmt_middle.i_visible_height = fmt_middle.i_height = fmt_out.i_height; + + p_middle = image_Convert( p_sys->p_image, + p_picture_vout->p_pic[i_index].p_picture, &fmt_in, &fmt_middle ); + if( !p_middle ) + { + vlc_mutex_unlock( &p_picture_vout->lock ); + return NULL; + } + + p_converted = image_Convert( p_sys->p_image2, + p_middle, &fmt_middle, &fmt_out ); + if( !p_converted ) + { + vlc_mutex_unlock( &p_picture_vout->lock ); + return NULL; + } + +/* fprintf( stderr, "Converted %ix%i %4.4s\n", p_converted->format.i_width, p_converted->format.i_height, (char *)&p_converted->format.i_chroma);*/ + + + p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt_out); + if( !p_region ) + { + msg_Err( p_filter, "cannot allocate SPU region" ); + p_filter->pf_sub_buffer_del( p_filter, p_spu ); + vlc_mutex_unlock( &p_picture_vout->lock ); + return NULL; + } + + p_region->i_x = p_sys->i_xoffset + ( i_index % p_sys->i_cols ) + * ( p_sys->i_width / p_sys->i_cols + p_sys->i_vborder ); + p_region->i_y = p_sys->i_yoffset + + ( ( i_index / p_sys->i_cols ) % p_sys->i_rows ) + * ( p_sys->i_height / p_sys->i_rows + p_sys->i_hborder ); + + + if( p_region_prev == NULL ){ + p_spu->p_region = p_region; + } else { + p_region_prev->p_next = p_region; + } + + p_region_prev = p_region; + + vout_CopyPicture( p_filter, &p_region->picture, p_converted ); + + p_middle->pf_release( p_middle ); + p_converted->pf_release( p_converted ); + } + + vlc_mutex_unlock( &p_picture_vout->lock ); + + /* Initialize subpicture */ + p_spu->i_channel = 0; + p_spu->i_start = date; + p_spu->i_stop = 0; + p_spu->b_ephemer = VLC_TRUE; + p_spu->i_alpha = p_sys->i_alpha; + + return p_spu; +} diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am index 08964b8715..8b0ea83369 100644 --- a/modules/video_output/Modules.am +++ b/modules/video_output/Modules.am @@ -12,3 +12,4 @@ SOURCES_hd1000v = hd1000v.cpp SOURCES_snapshot = snapshot.c SOURCES_opengl = opengl.c SOURCES_image = image.c +SOURCES_picture = picture.c diff --git a/modules/video_output/picture.c b/modules/video_output/picture.c new file mode 100644 index 0000000000..51028ba9a3 --- /dev/null +++ b/modules/video_output/picture.c @@ -0,0 +1,301 @@ +/***************************************************************************** + * picture.c: + ***************************************************************************** + * Copyright (C) 1998-2001 VideoLAN + * $Id: $ + * + * Authors: Antoine Cellerier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include /* ENOMEM */ +#include /* free() */ +#include /* strerror() */ + +#include +#include +#include +#include + +#include +#ifndef WIN32 +# include /* BSD: struct in_addr */ +#endif + +/*********************************************************************** +* +***********************************************************************/ +struct vout_sys_t +{ + int i_picture_pos; /* picture position in p_picture_vout */ +}; + +#include "picture.h" + +/*********************************************************************** +* Local prototypes +***********************************************************************/ + +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); + +/*********************************************************************** +* Module descriptor +***********************************************************************/ +vlc_module_begin(); + set_description(_("VLC Internal Picture video output") ); + set_capability( "video output", 70 ); + set_callbacks( Open, Close ); +vlc_module_end(); + +/*********************************************************************** +* Open : allocate video thread output method +***********************************************************************/ +static int Open ( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + libvlc_t *p_libvlc = p_vout->p_libvlc; + struct picture_vout_t *p_picture_vout = NULL; + vlc_value_t val; + + 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; + } + + if( var_Get( p_libvlc, "p_picture_vout", &val ) != VLC_SUCCESS ){ + msg_Err( p_vout, "p_picture_vout not found" ); + p_picture_vout = malloc( sizeof( struct picture_vout_t ) ); + if( p_vout->p_sys == NULL ) + { + msg_Err( p_vout, "out of memory" ); + return VLC_ENOMEM; + } + + vlc_mutex_init( p_libvlc, &p_picture_vout->lock ); + vlc_mutex_lock( &p_picture_vout->lock ); + var_Create( p_libvlc, "p_picture_vout", VLC_VAR_ADDRESS ); + val.p_address = p_picture_vout; + var_Set( p_libvlc, "p_picture_vout", val ); + + p_picture_vout->i_picture_num = 0; + p_picture_vout->p_pic = NULL; + } else { + p_picture_vout = val.p_address; + msg_Err( p_vout, "p_picture_vout found" ); + vlc_mutex_lock( &p_picture_vout->lock ); + } + + p_vout->p_sys->i_picture_pos = p_picture_vout->i_picture_num; + + p_picture_vout->p_pic = realloc( p_picture_vout->p_pic, + (p_picture_vout->i_picture_num+1) * sizeof( struct picture_vout_e_t ) ); + + p_picture_vout->p_pic[p_picture_vout->i_picture_num].p_picture = NULL; + p_picture_vout->p_pic[p_picture_vout->i_picture_num].i_status + = PICTURE_VOUT_E_OCCUPIED; + p_picture_vout->i_picture_num++; + + vlc_mutex_unlock( &p_picture_vout->lock ); + + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + + return VLC_SUCCESS; +} + + +/*********************************************************************** +* Init +***********************************************************************/ +static int Init( vout_thread_t *p_vout ) +{ + + picture_t *p_pic; + int i_index; + + I_OUTPUTPICTURES = 0; + + p_vout->output.i_chroma = p_vout->render.i_chroma; + p_vout->output.i_width = p_vout->render.i_width; + p_vout->output.i_height = p_vout->render.i_height; + p_vout->output.i_aspect = p_vout->render.i_aspect; + + while( VLC_TRUE ) + { + p_pic = NULL; + + for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) + { + if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE ) + { + p_pic = p_vout->p_picture + i_index; + break; + } + } + + if( p_pic == NULL ) + { + return VLC_SUCCESS; + } + + vout_AllocatePicture( VLC_OBJECT(p_vout), p_pic, + p_vout->output.i_chroma, + p_vout->output.i_width, p_vout->output.i_height, + p_vout->output.i_aspect ); + + if( p_pic->i_planes == 0 ) + { + return VLC_EGENERIC; + } + + p_pic->i_status = DESTROYED_PICTURE; + p_pic->i_type = DIRECT_PICTURE; + + PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; + + I_OUTPUTPICTURES++; + + //return VLC_SUCCESS; + } + +} + +/*********************************************************************** +* End +***********************************************************************/ +static void End( vout_thread_t *p_vout ) +{ + return; +} + +/*********************************************************************** +* Close +***********************************************************************/ +static void Close ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; + + libvlc_t *p_libvlc = p_vout->p_libvlc; + struct picture_vout_t *p_picture_vout = NULL; + vlc_value_t val; + int i_flag=0, i; + + msg_Dbg( p_vout, "Closing Picture Vout ..."); + var_Get( p_libvlc, "p_picture_vout", &val ); + p_picture_vout = val.p_address; + + vlc_mutex_lock( &p_picture_vout->lock ); + + if( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture ) + { + /* FIXME */ + free( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture ); + } + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].i_status + = PICTURE_VOUT_E_AVAILABLE; + + for( i = 0; i < p_picture_vout->i_picture_num; i ++) + { + if( p_picture_vout->p_pic[i].i_status == PICTURE_VOUT_E_OCCUPIED ) { + i_flag = 1; + break; + } + } + + if( i_flag == 1 ){ + vlc_mutex_unlock( &p_picture_vout->lock ); + fprintf( stderr, "this wasn't the last picture\n"); + } else { + free( p_picture_vout->p_pic ); + vlc_mutex_unlock( &p_picture_vout->lock ); + vlc_mutex_destroy( &p_picture_vout->lock ); + var_Destroy( p_libvlc, "p_picture_vout" ); + fprintf( stderr, "this was the last picture\n"); + } + + free( p_vout->p_sys ); +} + +/*********************************************************************** +* Manage +***********************************************************************/ +static int Manage( vout_thread_t *p_vout ) +{ + return VLC_SUCCESS; +} + +/*********************************************************************** +* Display +***********************************************************************/ +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) +{ + libvlc_t *p_libvlc = p_vout->p_libvlc; + vlc_value_t val; + struct picture_vout_t *p_picture_vout; + + var_Get( p_libvlc, "p_picture_vout", &val ); + p_picture_vout = val.p_address; + + /* + src : p_pic + dest : p_picture_pout->p_pic[p_vout->p_sys.i_picture_pos]->p_picture + */ + + + vlc_mutex_lock( &p_picture_vout->lock ); + if( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture ) + { + // FIXME !!! + //nfprintf( stderr, "i_type : %i ( MEMORY_PICTURE == %i)\n", p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture->i_type, MEMORY_PICTURE ); + if( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture->i_type == 200 /* MEMORY_PICTURE*/) + { + free( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos] + .p_picture->p_data_orig ); + } + free( p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture ); + } + + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture + = (picture_t*)malloc( sizeof( picture_t )) ; + vout_AllocatePicture( p_vout, + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture, + p_pic->format.i_chroma, + p_pic->format.i_width, + p_pic->format.i_height, + VOUT_ASPECT_FACTOR * p_pic->format.i_height / p_pic->format.i_width ); + + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture->i_status = DESTROYED_PICTURE; + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture->i_type = DIRECT_PICTURE; + + vout_CopyPicture( p_vout, + p_picture_vout->p_pic[p_vout->p_sys->i_picture_pos].p_picture, + p_pic); + + vlc_mutex_unlock( &p_picture_vout->lock ); +} diff --git a/modules/video_output/picture.h b/modules/video_output/picture.h new file mode 100644 index 0000000000..712553e353 --- /dev/null +++ b/modules/video_output/picture.h @@ -0,0 +1,17 @@ +#ifndef _PICTURE_VOUT_H +#define _PICTURE_VOUT_H 1 + +#define PICTURE_VOUT_E_AVAILABLE 0 +#define PICTURE_VOUT_E_OCCUPIED 1 +struct picture_vout_e_t { + picture_t *p_picture; + int i_status; +}; +struct picture_vout_t +{ + vlc_mutex_t lock; + int i_picture_num; + struct picture_vout_e_t *p_pic; +}; + +#endif -- 2.39.2