vlc_video_splitter.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_video_splitter.h: "video splitter" related structures and functions
00003  *****************************************************************************
00004  * Copyright (C) 2009 Laurent Aimar
00005  * $Id: 891d77027adb757466004b589c2830588fc0d085 $
00006  *
00007  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef VLC_VIDEO_SPLITTER_H
00025 #define VLC_VIDEO_SPLITTER_H 1
00026 
00027 #include <vlc_es.h>
00028 #include <vlc_picture.h>
00029 #include <vlc_mouse.h>
00030 
00031 /**
00032  * \file
00033  * This file defines the structure and types used by video splitter filters.
00034  */
00035 
00036 typedef struct video_splitter_t video_splitter_t;
00037 typedef struct video_splitter_sys_t video_splitter_sys_t;
00038 typedef struct video_splitter_owner_t video_splitter_owner_t;
00039 
00040 /** Structure describing a video splitter output properties
00041  */
00042 typedef struct
00043 {
00044     /* Video format of the output */
00045     video_format_t fmt;
00046 
00047     /* Window hints */
00048     struct
00049     {
00050         /* Relative position.
00051          * (0,0) is equal to the default position.
00052          */
00053         int i_x;
00054         int i_y;
00055 
00056         /* Alignment inside the window
00057          */
00058         int i_align;
00059     } window;
00060 
00061     /* Video output module
00062      * Use NULL for default
00063      */
00064     char *psz_module;
00065 
00066 } video_splitter_output_t;
00067 
00068 /** Structure describing a video splitter
00069  */
00070 struct video_splitter_t
00071 {
00072     VLC_COMMON_MEMBERS
00073 
00074     /* Module properties */
00075     module_t        *p_module;
00076 
00077     /* configuration */
00078     config_chain_t  *p_cfg;
00079 
00080     /* Input format
00081      * It is filled by the creator and cannot be modified.
00082      */
00083     video_format_t  fmt;
00084 
00085     /* Output formats
00086      *
00087      * It can only be set in the open() function and must remain
00088      * constant.
00089      * The module is responsible for the allocation and deallocation.
00090      */
00091     int                     i_output;
00092     video_splitter_output_t *p_output;
00093 
00094     int             (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
00095                                   picture_t *p_src );
00096     int             (*pf_mouse) ( video_splitter_t *, vlc_mouse_t *,
00097                                   int i_index,
00098                                   const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
00099 
00100     video_splitter_sys_t *p_sys;
00101 
00102     /* Buffer allocation */
00103     int  (*pf_picture_new) ( video_splitter_t *, picture_t *pp_picture[] );
00104     void (*pf_picture_del) ( video_splitter_t *, picture_t *pp_picture[] );
00105     video_splitter_owner_t *p_owner;
00106 };
00107 
00108 /**
00109  * It will create an array of pictures suitable as output.
00110  *
00111  * You must either returned them through pf_filter or by calling
00112  * video_splitter_DeletePicture.
00113  *
00114  * If VLC_SUCCESS is not returned, pp_picture values are undefined.
00115  */
00116 static inline int video_splitter_NewPicture( video_splitter_t *p_splitter,
00117                                              picture_t *pp_picture[] )
00118 {
00119     int i_ret = p_splitter->pf_picture_new( p_splitter, pp_picture );
00120     if( i_ret )
00121         msg_Warn( p_splitter, "can't get output pictures" );
00122     return i_ret;
00123 }
00124 
00125 /**
00126  * It will release an array of pictures created by video_splitter_NewPicture.
00127  * Provided for convenience.
00128  */
00129 static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
00130                                                  picture_t *pp_picture[] )
00131 {
00132     p_splitter->pf_picture_del( p_splitter, pp_picture );
00133 }
00134 
00135 /* */
00136 VLC_EXPORT( video_splitter_t *, video_splitter_New, ( vlc_object_t *, const char *psz_name, const video_format_t * ) );
00137 VLC_EXPORT( void, video_splitter_Delete, ( video_splitter_t * ) );
00138 
00139 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
00140                                          picture_t *pp_dst[], picture_t *p_src )
00141 {
00142     return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
00143 }
00144 static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
00145                                         vlc_mouse_t *p_mouse,
00146                                         int i_index,
00147                                         const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
00148 {
00149     if( !p_splitter->pf_mouse )
00150     {
00151         *p_mouse = *p_new;
00152         return VLC_SUCCESS;
00153     }
00154     return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_old, p_new );
00155 }
00156 
00157 #endif /* VLC_VIDEO_SPLITTER_H */
00158 

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6