1 /* Libvisual - The audio visualisation framework. 2 * 3 * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org> 4 * 5 * Authors: Dennis Smit <ds@nerds-incorporated.org> 6 * 7 * $Id: 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation; either version 2.1 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #ifndef _LV_MORPH_H 25 #define _LV_MORPH_H 26 27 #include <libvisual/lv_palette.h> 28 #include <libvisual/lv_plugin.h> 29 #include <libvisual/lv_list.h> 30 #include <libvisual/lv_video.h> 31 #include <libvisual/lv_time.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif /* __cplusplus */ 36 37 #define VISUAL_MORPH(obj) (VISUAL_CHECK_CAST ((obj), 0, VisMorph)) 38 39 /** 40 * Morph morphing methods. 41 */ 42 typedef enum { 43 VISUAL_MORPH_MODE_SET, /**< Morphing is done by a rate set, 44 * nothing is automated here. */ 45 VISUAL_MORPH_MODE_STEPS, /**< Morphing is done by setting a number of steps, 46 * the morph will be automated. */ 47 VISUAL_MORPH_MODE_TIME /**< Morphing is done by setting a target time when the morph should be done, 48 * This is as well automated. */ 49 } VisMorphMode; 50 51 typedef struct _VisMorph VisMorph; 52 53 /** 54 * The VisMorph structure encapsulates the morph plugin and provides 55 * abstract interfaces for morphing between actors, or rather between 56 * two video sources. 57 * 58 * Members in the structure shouldn't be accessed directly but instead 59 * it's adviced to use the methods provided. 60 * 61 * @see visual_morph_new 62 */ 63 struct _VisMorph { 64 VisObject object; /**< The VisObject data. */ 65 VisPluginData *plugin; /**< Pointer to the plugin itself. */ 66 VisVideo *dest; /**< Destination video, this is where 67 * the result of the morph gets drawn. */ 68 float rate; /**< The rate of morph, 0 draws the first video source 69 * 1 the second video source, 0.5 is a 50/50, final 70 * content depends on the plugin being used. */ 71 VisPalette morphpal; /**< Morph plugins can also set a palette for indexed 72 * color depths. */ 73 VisTime morphtime; /**< Amount of time which the morphing should take. */ 74 VisTimer timer; /**< Private entry that holds the time elapsed from 75 * the beginning of the switch. */ 76 int steps; /**< Private entry that contains the number of steps 77 * a morph suppose to take. */ 78 int stepsdone; /**< Private entry that contains the number of steps done. */ 79 80 VisMorphMode mode; /**< Private entry that holds the mode of morphing. */ 81 }; 82 83 VisPluginData *visual_morph_get_plugin (VisMorph *morph); 84 85 VisList *visual_morph_get_list (void); 86 const char *visual_morph_get_next_by_name (const char *name); 87 const char *visual_morph_get_prev_by_name (const char *name); 88 int visual_morph_valid_by_name (const char *name); 89 90 VisMorph *visual_morph_new (const char *morphname); 91 92 int visual_morph_realize (VisMorph *morph); 93 94 int visual_morph_get_supported_depth (VisMorph *morph); 95 96 int visual_morph_set_video (VisMorph *morph, VisVideo *video); 97 int visual_morph_set_time (VisMorph *morph, VisTime *time); 98 int visual_morph_set_rate (VisMorph *morph, float rate); 99 int visual_morph_set_steps (VisMorph *morph, int steps); 100 int visual_morph_set_mode (VisMorph *morph, VisMorphMode mode); 101 102 VisPalette *visual_morph_get_palette (VisMorph *morph); 103 104 int visual_morph_is_done (VisMorph *morph); 105 106 int visual_morph_requests_audio (VisMorph *morph); 107 108 int visual_morph_run (VisMorph *morph, VisAudio *audio, VisVideo *src1, VisVideo *src2); 109 110 #ifdef __cplusplus 111 } 112 #endif /* __cplusplus */ 113 114 #endif /* _LV_MORPH_H */ 115