3 * Copyright (C) 2011 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "scenegraph.inc"
30 // Simple text to movie converter.
31 // Initially we're trying to render the entire movie in the file handler.
32 // Ideally the file handler would just translate the script into scene graphs &
33 // audio with the 3D pipeline integrated into Cinelerra.
51 SceneChar(SceneTokens *script);
54 // called by renderer to keep track of cameras
55 void increment_camera();
58 int get_memory_usage();
60 // Name of character in script
62 // Festival voice for character
63 char voice[BCTEXTLEN];
65 char model[BCTEXTLEN];
73 ArrayList<SceneNode *> mouths;
74 ArrayList<SceneNode *> eyes;
76 // the model faces left instead of right
79 // automated camera when this character is speaking
80 // increments for each chunk
90 // Volume for mouth image
93 // Extents are all floating point for 3D
94 // Dimensions of model
100 // Dialog from a single character
104 SceneChunk(SceneTokens *script);
108 void append_text(char *new_chunk);
111 int get_memory_usage();
114 unsigned char *audio;
115 // Nonzero if it has been rendered
116 // Units are bytes since we have WAV headers
119 // Number of samples to advance dialog playback.
120 // May be shorter than the audio to get characters to talk simultaneously.
122 // If it was used in the last buffer read
124 // Loudest audio segment
137 // Pointer to character
138 SceneChar *character;
146 SceneTokens(FileScene *file, int cpus);
149 int read_script(char *path);
150 // Get character or create new one if it doesn't exist
151 SceneChar* get_character(char *name);
152 SceneChar* get_character(int number);
153 int get_char_number(SceneChar *ptr);
154 // Create a new text token & return it
155 SceneChunk* new_chunk();
156 SceneChunk* get_chunk(int number);
157 int get_memory_usage();
158 // Number of text objects
160 // Number of characters
161 int total_characters();
163 // Convert asset path to path relatiive to script
164 void convert_path(char *dst, char *src);
165 // Load image with path completion
166 VFrame* load_image(char *path);
167 void render_background(SceneGraph *scene);
169 ArrayList<SceneChunk*> chunks;
170 ArrayList<SceneChar*> characters;
171 char background[BCTEXTLEN];
172 // Path the script was read from
173 char path[BCTEXTLEN];
174 // Decompressed assets
175 VFrame *background_image;
176 // OverlayFrame *overlayer;
183 class FileScene : public FileBase
186 FileScene(Asset *asset, File *file);
189 int open_file(int rd, int wr);
191 static int check_sig(Asset *asset, char *test);
193 int set_video_position(int64_t x);
194 int set_audio_position(int64_t x);
195 int read_frame(VFrame *frame);
196 int read_samples(double *buffer, int64_t len);
197 int64_t get_memory_usage();
198 // Direct copy routines
199 static int get_best_colormodel(Asset *asset, int driver);
200 int colormodel_supported(int colormodel);
201 int can_copy_from(Asset *asset, int64_t position); // This file can copy frames directly from the asset
202 int reset_parameters_derived();
204 // Path to all prepackaged assets
205 char exec_path[BCTEXTLEN];
210 void render_chunks(int64_t start_position, int64_t len, int all_channels);
212 // Temporary buffer for speech output
219 // OverlayFrame *overlayer;
220 // AffineEngine *affine;