LiVES 1.4.9

src/main.h

Go to the documentation of this file.
00001 // main.h
00002 // LiVES
00003 // (c) G. Finch (salsaman@xs4all.nl,salsaman@gmail.com) 2003 - 2011
00004 // see file ../COPYING for full licensing details
00005 
00006 /*  This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License version 3 or higher as 
00008     published by the Free Software Foundation.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     agint64 with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018 */
00019 
00020 
00021 // begin legal warning
00022 /*
00023     NO WARRANTY
00024 
00025     BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
00026       FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
00027 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
00028       PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
00029       OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00030 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
00031 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
00032       PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
00033 REPAIR OR CORRECTION.
00034 
00035       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
00036       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
00037       REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
00038       INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
00039       OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
00040 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
00041 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
00042       PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
00043 POSSIBILITY OF SUCH DAMAGES.
00044 */
00045 // end legal warning
00046 
00047 
00048 // Have fun, and let's fight for Free Speech, Open Media and True Creativity !
00049 // - Salsaman
00050 
00051 
00052 #ifndef HAS_MAIN_H
00053 #define HAS_MAIN_H
00054 
00055 #include <gtk/gtk.h>
00056 #include <gdk/gdkx.h>
00057 #include <gdk/gdkkeysyms.h>
00058 
00059 #include <stdlib.h>
00060 #include <stdio.h>
00061 #include <unistd.h>
00062 #include <string.h>
00063 #include <signal.h>
00064 #include <assert.h>
00065 
00066 #define QUOTEME(x) #x
00067 
00070 #define BOOTSTRAP_NAME "/tmp/.smogrify"
00071 
00073 #define MAX_FILES 65535
00074 
00077 #ifndef PREFIX_DEFAULT
00078 #define PREFIX_DEFAULT "/usr"
00079 #endif
00080 
00082 #ifndef PREFIX
00083 #define PREFIX PREFIX_DEFAULT
00084 #endif
00085 
00086 #define DOC_DIR "/share/doc/lives-"
00087 
00088 #define THEME_DIR "/share/lives/themes/"
00089 #define PLUGIN_SCRIPTS_DIR "/share/lives/plugins/"
00090 #define PLUGIN_EXEC_DIR "/lives/plugins/"
00091 #define ICON_DIR "/share/lives/icons/"
00092 #define DATA_DIR "/share/lives/"
00093 #define LIVES_CONFIG_DIR ".lives-dir/"
00094 
00095 #define LIVES_DEVICE_DIR "/dev/"
00096 
00097 
00098 #define LIVES_MANUAL_URL "http://lives.sourceforge.net/manual/"
00099 #define LIVES_MANUAL_FILENAME "LiVES_manual.html"
00100 #define LIVES_AUTHOR_EMAIL "mailto:salsaman@xs4all.nl,salsaman@gmail.com"
00101 #define LIVES_DONATE_URL "https://sourceforge.net/donate/index.php?group_id=64341"
00102 #define LIVES_BUG_URL "http://sourceforge.net/tracker/?group_id=64341&atid=507139"
00103 #define LIVES_FEATURE_URL "http://sourceforge.net/tracker/?group_id=64341&atid=507142"
00104 #define LIVES_TRANSLATE_URL "https://translations.launchpad.net/lives/trunk"
00105 
00106 #ifdef IS_DARWIN
00107 #ifndef off64_t
00108 #define off64_t off_t
00109 #endif
00110 #ifndef lseek64
00111 #define lseek64 lseek
00112 #endif
00113 #endif
00114 
00117 #define WARN_FILE_SIZE 500
00118 
00121 #define FPS_MAX 200.
00122 
00123 #define ENABLE_DVD_GRAB
00124 
00125 #define FP_BITS 16 /// max fp bits [apparently 16 is faster]
00126 
00127 #ifdef HAVE_MJPEGTOOLS
00128 #define HAVE_YUV4MPEG
00129 #endif
00130 
00131 #ifdef ENABLE_OIL
00132 #include <liboil/liboil.h>
00133 #endif
00134 
00135 #ifndef IS_SOLARIS
00136 #define LIVES_INLINE inline
00137 #else
00138 #define LIVES_INLINE
00139 #endif
00140 
00141 #include <limits.h>
00142 
00143 #ifndef PATH_MAX
00144 #define PATH_MAX 4096
00145 #endif
00146 
00147 #ifdef __GNUC__
00148 #  define WARN_UNUSED  __attribute__((warn_unused_result))
00149 #else
00150 #  define WARN_UNUSED
00151 #endif
00152 
00153 #ifdef PRODUCE_LOG
00154 #define LIVES_LOG "lives.log"
00155 #endif
00156 
00159 typedef struct {
00160   gint value;
00161   gint64 reltime;
00162 } event;
00163 
00164 typedef struct {
00165   GtkWidget *processing;
00166   GtkWidget *progressbar;
00167   GtkWidget *label;
00168   GtkWidget *label2;
00169   GtkWidget *label3;
00170   GtkWidget *stop_button;
00171   GtkWidget *pause_button;
00172   GtkWidget *preview_button;
00173   GtkWidget *cancel_button;
00174   GtkWidget *scrolledwindow;
00175   guint frames_done;
00176 } process;
00177 
00178 
00179 
00180 
00181 typedef struct {
00182   int afile;
00183   double seek;
00184   double vel;
00185 } lives_audio_track_state_t;
00186 
00187 
00188 #include "../libweed/weed.h"
00189 #include "../libweed/weed-events.h"
00190 
00191 // see weed event spec. for more info
00192 
00194 #include "events.h"
00195 
00196 
00197 typedef enum {
00198   UNDO_NONE=0,
00199   UNDO_EFFECT,
00200   UNDO_RESIZABLE,
00201   UNDO_MERGE,
00202   UNDO_RESAMPLE,
00203   UNDO_TRIM_AUDIO,
00204   UNDO_CHANGE_SPEED,
00205   UNDO_AUDIO_RESAMPLE,
00206   UNDO_APPEND_AUDIO,
00207   UNDO_INSERT,
00208   UNDO_CUT,
00209   UNDO_DELETE,
00210   UNDO_DELETE_AUDIO,
00211   UNDO_INSERT_SILENCE,
00212   UNDO_NEW_AUDIO,
00213 
00215   UNDO_ATOMIC_RESAMPLE_RESIZE,
00216 
00218   UNDO_RENDER,
00219 
00220   UNDO_FADE_AUDIO,
00221 
00223   UNDO_REC_AUDIO,
00224 
00225   UNDO_INSERT_WITH_AUDIO
00226 } lives_undo_t;
00227 
00228 
00230 typedef enum {
00231   NEVER_STOP=0,
00232   STOP_ON_VID_END,
00233   STOP_ON_AUD_END
00234 } lives_whentostop_t;
00235 
00236 
00238 typedef enum {
00240   CANCEL_NONE=0,
00241 
00243   CANCEL_USER=1,
00244 
00246   CANCEL_NO_PROPOGATE=2,
00247 
00249   CANCEL_PREVIEW_FINISHED=3,
00250 
00252   CANCEL_APP_QUIT=4,
00253 
00255   CANCEL_NO_MORE_PREVIEW=5,
00256 
00258   CANCEL_CAPTURE_ERROR=6,
00259 
00261   CANCEL_EVENT_LIST_END=7,
00262 
00264   CANCEL_VID_END=8,
00265 
00267   CANCEL_GENERATOR_END=9,
00268 
00270   CANCEL_KEEP=10,
00271 
00273   CANCEL_AUD_END=11,
00274 
00276   CANCEL_ERROR=12,
00277 
00279   CANCEL_USER_PAUSED=13,
00280 
00282   CANCEL_KEEP_LOOPING=100
00283 
00284 } lives_cancel_t;
00285 
00286 
00287 typedef enum {
00288   CANCEL_KILL=0,  
00289   CANCEL_SOFT     
00290 } lives_cancel_type_t;
00291 
00292 
00293 
00294 
00295 typedef enum {
00296   CLIP_TYPE_DISK, 
00297   CLIP_TYPE_YUV4MPEG, 
00298   CLIP_TYPE_GENERATOR, 
00299   CLIP_TYPE_FILE, 
00300   CLIP_TYPE_LIVES2LIVES, 
00301   CLIP_TYPE_VIDEODEV  
00302 } lives_clip_type_t;
00303 
00304 
00305 typedef enum {
00306   IMG_TYPE_UNKNOWN=(1<<0),
00307   IMG_TYPE_JPEG=(1<<1),
00308   IMG_TYPE_PNG=(1<<2)
00309 } lives_image_type_t;
00310 
00311 
00312 
00313 #define AFORM_SIGNED 0
00314 #define AFORM_LITTLE_ENDIAN 0
00315 
00316 #define AFORM_UNSIGNED 1
00317 #define AFORM_BIG_ENDIAN (1<<1)
00318 #define AFORM_UNKNOWN 65536
00319 
00320 
00321 typedef struct {
00322   gshort red;
00323   gshort green;
00324   gshort blue;
00325 } lives_colRGB24_t;
00326 
00327 typedef struct {
00328   gshort red;
00329   gshort green;
00330   gshort blue;
00331   gshort alpha;
00332 } lives_colRGBA32_t;
00333 
00334 
00335 typedef enum {
00336   LIVES_INTERLACE_NONE=0,
00337   LIVES_INTERLACE_BOTTOM_FIRST=1,
00338   LIVES_INTERLACE_TOP_FIRST=2
00339 } lives_interlace_t;
00340 
00341 
00342 #include "pangotext.h"
00343 
00345 typedef struct {
00346   // basic info (saved during backup)
00347   gint bpp;
00348   gdouble fps;
00349   gint hsize; 
00350   gint vsize;
00351   gint arps; 
00352   guint signed_endian; 
00353 
00354   gint arate; 
00355   gint64 unique_id;    
00356   gint achans;
00357   gint asampsize;
00358 
00360   gint frames;
00361   gchar title[256];
00362   gchar author[256];
00363   gchar comment[256];
00364   gchar keywords[256];
00366 
00367   lives_interlace_t interlace; 
00368 
00369   // extended info (not saved)
00370   gint header_version;
00371 
00372 #define LIVES_CLIP_HEADER_VERSION 100
00373 
00374   gint rowstride;
00375 
00377   process *proc_ptr;
00378 
00379   gchar handle[256];
00380   gint ohsize;
00381   gint ovsize;
00382   glong f_size;
00383   glong afilesize;
00384   gint old_frames; 
00385   gchar file_name[256]; 
00386   gchar info_file[256];
00387   gchar name[256];  
00388   gchar save_file_name[256];
00389   gchar type[40];
00390   gint start;
00391   gint end;
00392   gint insert_start;
00393   gint insert_end;
00394   gint progress_start;
00395   gint progress_end;
00396   gboolean changed;
00397   GtkWidget *menuentry;
00398   gboolean orig_file_name;
00399   gboolean was_renamed;
00400   gboolean is_untitled;
00401   gdouble pb_fps;
00402   gdouble freeze_fps;
00403   gboolean play_paused;
00404   
00405   //opening/restoring status
00406   gboolean opening;
00407   gboolean opening_audio;
00408   gboolean opening_only_audio;
00409   gboolean opening_loc;
00410   gboolean restoring;
00411   gboolean is_loaded;  
00412 
00414   gboolean nopreview;
00415 
00417   gboolean nokeep;
00418 
00419   // various times; total time is calculated as the gint64est of video, laudio and raudio
00420   gdouble total_time;
00421   gdouble video_time;
00422   gdouble laudio_time;
00423   gdouble raudio_time;
00424   gdouble pointer_time;
00425 
00426   // current and last played index frames for internal player
00427   gint frameno;
00428   gint last_frameno;
00429 
00430 
00431 
00433   // see resample.c for new events system
00434 
00435 
00436   // events 
00437   event *events[1];  
00438 
00439   weed_plant_t *event_list;
00440   weed_plant_t *event_list_back;
00441   weed_plant_t *next_event;
00442 
00443   GList *layout_map;
00445 
00447   lives_undo_t undo_action;
00448 
00449   gint undo_start;
00450   gint undo_end;
00451   gchar undo_text[32];
00452   gchar redo_text[32];
00453   gboolean undoable;
00454   gboolean redoable;
00455 
00456   // used for storing undo values
00457   gint undo1_int;
00458   gint undo2_int;
00459   gint undo3_int;
00460   gint undo4_int;
00461   guint undo1_uint;
00462   gdouble undo1_dbl;
00463   gdouble undo2_dbl;
00464   gboolean undo1_boolean;
00465   gboolean undo2_boolean;
00466   gboolean undo3_boolean;
00467 
00468   gint undo_arate; 
00469   guint undo_signed_endian;
00470   gint undo_achans;
00471   gint undo_asampsize;
00472   gint undo_arps; 
00473 
00474   lives_clip_type_t clip_type;
00475 
00476   void *ext_src; 
00477 
00482   int *frame_index;
00483 
00484   int *frame_index_back; 
00485 
00486   gint fx_frame_pump; 
00487 
00488 #define FX_FRAME_PUMP_VAL 100 ///< how many frames at a time to pump to rfx
00489 
00490 #define IMG_BUFF_SIZE 4096 ///< chunk size for reading images
00491 
00492   gboolean ratio_fps; 
00493 
00494   glong aseek_pos; 
00495 
00496   // decoder data
00497 
00498   gchar mime_type[256];
00499 
00500 
00501   gboolean deinterlace; 
00502 
00503   lives_image_type_t img_type;
00504 
00506   gint stored_layout_frame;
00507   gint stored_layout_idx;
00508   gdouble stored_layout_audio;
00509   gdouble stored_layout_fps;
00510 
00511   lives_subtitles_t *subt;
00512 
00513   // TODO - change to lives_clip_t
00514 } file;
00515 
00516 
00517 typedef struct {
00518   // the following can be assumed TRUE, they are checked on startup
00519   gboolean has_smogrify;
00520   gboolean smog_version_correct;
00521   gboolean can_read_from_config;
00522   gboolean can_write_to_config;
00523   gboolean can_write_to_tmp;
00524   gboolean can_write_to_tempdir;
00525 
00526   // the following may need checking before use
00527   gboolean has_xmms;
00528   gboolean has_dvgrab;
00529   gboolean has_sox;
00530   gboolean has_mplayer;
00531   gboolean has_convert;
00532   gboolean has_composite;
00533   gboolean has_cdda2wav;
00534   gboolean has_midistartstop;
00535   gboolean has_jackd;
00536   gboolean has_pulse_audio;
00537   gboolean has_xwininfo;
00538   gboolean has_gdb;
00539 
00541   gchar home_dir[256];
00542 
00544   gchar startup_msg[256];
00545 
00546   // plugins
00547   gboolean has_encoder_plugins;
00548 
00549   gboolean has_python;
00550 
00551   gshort cpu_bits;
00552 
00553   gchar *myname_full;
00554   gchar *myname;
00555 
00556   gboolean has_stderr;
00557 
00558   gint nmonitors;
00559 
00560   gint ncpus;
00561 
00562 } capability;
00563 
00564 
00566 extern capability *capable;
00567 
00568 #ifdef HAVE_JACK_JACK_H
00569 #include "jack.h"
00570 #endif
00571 
00572 #include <inttypes.h>
00573 
00574 // common defs for mainwindow
00575 #include "plugins.h"
00576 #include "colourspace.h"
00577 #include "paramspecial.h"
00578 #include "multitrack.h"
00579 #include "mainwindow.h"
00580 #include "keyboard.h"
00581 #include "preferences.h"
00582 
00583 extern mainwindow *mainw;
00584 
00585 
00586 // internal player clock
00587 #include <sys/time.h>
00588 struct timeval tv;
00589 
00590 
00592 extern size_t sizint, sizdbl, sizshrt;
00593 
00594 
00595 
00596 typedef enum {
00597   CLIP_DETAILS_BPP,
00598   CLIP_DETAILS_FPS,
00599   CLIP_DETAILS_PB_FPS,
00600   CLIP_DETAILS_WIDTH,
00601   CLIP_DETAILS_HEIGHT,
00602   CLIP_DETAILS_UNIQUE_ID,
00603   CLIP_DETAILS_ARATE,
00604   CLIP_DETAILS_PB_ARATE,
00605   CLIP_DETAILS_ACHANS,
00606   CLIP_DETAILS_ASIGNED,
00607   CLIP_DETAILS_AENDIAN,
00608   CLIP_DETAILS_ASAMPS,
00609   CLIP_DETAILS_FRAMES,
00610   CLIP_DETAILS_TITLE,
00611   CLIP_DETAILS_AUTHOR,
00612   CLIP_DETAILS_COMMENT,
00613   CLIP_DETAILS_PB_FRAMENO,
00614   CLIP_DETAILS_FILENAME,
00615   CLIP_DETAILS_CLIPNAME,
00616   CLIP_DETAILS_HEADER_VERSION,
00617   CLIP_DETAILS_KEYWORDS,
00618   CLIP_DETAILS_INTERLACE
00619 } lives_clip_details_t;
00620 
00621 
00622 typedef enum {
00623   LIVES_CURSOR_NORMAL=0,  
00624   LIVES_CURSOR_BLOCK,
00625   LIVES_CURSOR_AUDIO_BLOCK,
00626   LIVES_CURSOR_BUSY,
00627   LIVES_CURSOR_FX_BLOCK
00628 } lives_cursor_t;
00629 
00630 
00631 
00632 
00633 // some useful functions
00634 
00635 // interface.c
00636 process* create_processing (const gchar *text);
00637 void add_to_winmenu(void);
00638 void remove_from_winmenu(void);
00639 void make_play_window(void);
00640 void resize_play_window (void);
00641 void kill_play_window (void);
00642 void make_preview_box (void);
00643 void add_to_playframe (void);
00644 GtkWidget* create_cdtrack_dialog (gint type, gpointer user_data);
00645 GtkTextView *create_output_textview(void);
00646 gchar *choose_file(gchar *dir, gchar *fname, gchar **filt, GtkFileChooserAction act, const char *title, GtkWidget *extra);
00647 void add_suffix_check(GtkBox *box, const gchar *ext);
00648 
00649 
00650 // dialogs.c
00651 gboolean do_progress_dialog(gboolean visible, gboolean cancellable, const gchar *text);
00652 gboolean do_warning_dialog(const gchar *text);
00653 gboolean do_warning_dialog_with_check(const gchar *text, gint warn_mask_number);
00654 gboolean do_warning_dialog_with_check_transient(const gchar *text, gint warn_mask_number, GtkWindow *transient);
00655 gboolean do_yesno_dialog(const gchar *text);
00656 void do_error_dialog(const gchar *text);
00657 void do_error_dialog_with_check(const gchar *text, gint warn_mask_number);
00658 void do_blocking_error_dialog(const gchar *text);
00659 void do_error_dialog_with_check_transient(const gchar *text, gboolean is_blocking,gint warn_mask_number, 
00660                                           GtkWindow *transient);
00661 void add_warn_check (GtkBox *box, gint warn_mask_number);
00662 void do_memory_error_dialog (void);
00663 void too_many_files(void);
00664 void tempdir_warning (void);
00665 void do_audio_import_error(void);
00666 void do_mt_backup_space_error(lives_mt *, gint memreq_mb);
00667 
00668 gboolean do_clipboard_fps_warning(void);
00669 void perf_mem_warning(void);
00670 void do_dvgrab_error(void);
00671 gboolean do_comments_dialog (file *sfile, gchar *filename);
00672 void do_auto_dialog(const gchar *text, gint type);
00673 void do_encoder_acodec_error (void);
00674 void do_encoder_sox_error(void);
00675 gboolean rdet_suggest_values (gint width, gint height, gdouble fps, gint fps_num, gint fps_denom, gint arate, 
00676                               gint asigned, gboolean swap_endian, gboolean anr, gboolean ignore_fps);
00677 gboolean do_encoder_restrict_dialog (gint width, gint height, gdouble fps, gint fps_num, gint fps_denom, 
00678                                      gint arate, gint asigned, gboolean swap_endian, gboolean anr, gboolean save_all);
00679 void do_keys_window (void);
00680 void do_mt_keys_window (void);
00681 void do_messages_window (void);
00682 void do_firstever_dialog (void);
00683 void do_upgrade_error_dialog(void);
00684 void do_no_mplayer_sox_error(void);
00685 void do_aud_during_play_error(void);
00686 void do_rendered_fx_dialog(void);
00687 void do_layout_scrap_file_error(void);
00688 void do_set_load_lmap_error(void);
00689 gboolean do_set_duplicate_warning (const gchar *new_set);
00690 gboolean do_set_rename_old_layouts_warning(const gchar *new_set);
00691 gboolean do_layout_alter_frames_warning(void);
00692 gboolean do_layout_alter_audio_warning(void);
00693 gboolean do_yuv4m_open_warning(void);
00694 void do_mt_undo_mem_error(void);
00695 void do_mt_undo_buf_error(void);
00696 void do_mt_set_mem_error(gboolean has_mt, gboolean trans);
00697 void do_mt_audchan_error(gint warn_mask);
00698 void do_mt_no_audchan_error(void);
00699 void do_mt_no_jack_error(gint warn_mask);
00700 gboolean do_mt_rect_prompt(void);
00701 void do_audrate_error_dialog(void);
00702 gboolean do_event_list_warning(void);
00703 void do_nojack_rec_error(void);
00704 void do_vpp_palette_error (void);
00705 void do_vpp_fps_error (void);
00706 void do_decoder_palette_error (void);
00707 void do_rmem_max_error (gint size);
00708 gboolean do_original_lost_warning(const gchar *fname);
00709 void do_no_decoder_error(const gchar *fname);
00710 void do_jack_noopen_warn(void);
00711 void do_jack_noopen_warn2(void);
00712 void do_jack_noopen_warn3(void);
00713 void do_jack_noopen_warn4(void);
00714 void do_file_perm_error(const gchar *file_name);
00715 void do_dir_perm_error(const gchar *dir_name);
00716 void do_encoder_img_ftm_error(render_details *rdet);
00717 void do_after_crash_warning (void);
00718 void do_bad_layout_error(void);
00719 void do_card_in_use_error(void);
00720 void do_dev_busy_error(const gchar *devstr);
00721 gboolean do_existing_subs_warning(void);
00722 void do_invalid_subs_error(void);
00723 gboolean do_erase_subs_warning(void);
00724 gboolean do_sub_type_warning(const gchar *ext, const gchar *type_ext);
00725 gboolean do_move_tmpdir_dialog(void);
00726 void do_set_locked_warning (const gchar *setname);
00727 void do_no_in_vdevs_error(void);
00728 void do_locked_in_vdevs_error(void);
00729 void do_do_not_close_d (void);
00730 void do_set_noclips_error(const char *setname);
00731 
00732 
00733 gboolean process_one (gboolean visible);
00734 void do_threaded_dialog(gchar *translated_text, gboolean has_cancel);
00735 void end_threaded_dialog(void);
00736 void threaded_dialog_spin (void);
00737 void response_ok (GtkButton *button, gpointer user_data);
00738 void response_cancel (GtkButton *button, gpointer user_data);
00739 void pump_io_chan(GIOChannel *iochan);
00740 
00741 void do_splash_progress(void);
00742 
00743 
00744 // d_print shortcuts
00745 void d_print_cancelled(void);
00746 void d_print_failed(void);
00747 void d_print_done(void);
00748 void d_print_file_error_failed(void);
00749 
00750 // general
00751 void do_text_window (const gchar *title, const gchar *text);
00752 
00753 // saveplay.c
00754 gboolean add_file_info(const gchar *check_handle, gboolean aud_only);
00755 void save_file_comments (int fileno);
00756 void reget_afilesize (int fileno);
00757 void deduce_file(const gchar *filename, gdouble start_time, gint end);
00758 void open_file (const gchar *filename);
00759 void open_file_sel(const gchar *file_name,gdouble start_time, gint frames);
00760 void open_fw_device (void);
00761 gboolean get_new_handle(gint index, const gchar *name);
00762 gboolean get_temp_handle(gint index, gboolean create);
00763 void get_handle_from_info_file(gint index);
00764 void create_cfile(void);
00765 void save_file (int clip, int start, int end, const char *filename);
00766 void play_file (void);
00767 void save_frame (GtkMenuItem *menuitem, gpointer user_data);
00768 gboolean save_frame_inner(gint clip, gint frame, const gchar *file_name, gint width, gint height, gboolean auto_overwrite);
00769 void wait_for_stop (const gchar *stop_command);
00770 void save_clip_values(gint which_file);
00771 void add_to_recovery_file (const gchar *handle);
00772 void rewrite_recovery_file(void);
00773 gboolean check_for_recovery_files (gboolean auto_recover);
00774 void recover_layout_map(gint numclips);
00775 const gchar *get_deinterlace_string(void);
00776 
00777 // saveplay.c backup
00778 void backup_file(int clip, int start, int end, const gchar *filename);
00779 gint save_event_frames(void);
00780 void write_headers (file *file);
00781 
00782 // saveplay.c restore
00783 void restore_file(const gchar *filename);
00784 gboolean read_headers(const gchar *file_name);
00785 
00786 // saveplay.c sets
00787 void open_set_file (const gchar *set_name, gint clipnum);
00788 
00789 
00790 // saveplay.c scrap file
00791 gboolean open_scrap_file (void);
00792 gint save_to_scrap_file (weed_plant_t *layer);
00793 gboolean load_from_scrap_file(weed_plant_t *layer, int frame);
00794 void close_scrap_file (void);
00795 
00796 
00797 // main.c
00798 void catch_sigint(int signum);
00799 gboolean startup_message_fatal(const gchar *msg);
00800 gboolean startup_message_nonfatal(const gchar *msg);
00801 gboolean startup_message_nonfatal_dismissable(const gchar *msg, gint warning_mask);
00802 capability *get_capabilities(void);
00803 void get_monitors(void);
00804 void load_start_image(gint frame);
00805 void load_end_image(gint frame);
00806 void load_preview_image(gboolean update_always);
00807 
00808 gboolean pull_frame(weed_plant_t *layer, const gchar *image_ext, weed_timecode_t tc);
00809 gboolean pull_frame_at_size (weed_plant_t *layer, const gchar *image_ext, weed_timecode_t tc, 
00810                              int width, int height, int target_palette);
00811 GdkPixbuf *pull_gdk_pixbuf_at_size(gint clip, gint frame, const gchar *image_ext, weed_timecode_t tc, 
00812                                    gint width, gint height, GdkInterpType interp);
00813 GError * lives_pixbuf_save(GdkPixbuf *pixbuf, gchar *fname, lives_image_type_t imgtype, 
00814                            int quality, GError **gerrorptr);
00815 
00816 void load_frame_image(gint frame);
00817 void sensitize(void);
00818 void desensitize(void);
00819 void procw_desensitize(void);
00820 void close_current_file (gint file_to_switch_to);  
00821 void get_next_free_file(void);
00822 void switch_to_file(gint old_file, gint new_file);
00823 void do_quick_switch (gint new_file);
00824 void resize (gdouble scale);
00825 gboolean read_file_details(const gchar *file_name, gboolean only_check_for_audio);
00826 void do_start_messages(void);
00827 void set_palette_colours (void);
00828 void set_main_title(const gchar *filename, gint or_untitled_number);
00829 void set_record (void);
00830 
00831 //gui.c
00832 //gui.c
00833 void  create_LiVES (void);
00834 void enable_record (void);
00835 void toggle_record (void);
00836 void disable_record (void);
00837 void make_custom_submenus(void);
00838 void fade_background(void);
00839 void unfade_background(void);
00840 void block_expose (void);
00841 void unblock_expose (void);
00842 void frame_size_update(void);
00843 void splash_init(void);
00844 void splash_end(void);
00845 void splash_msg(const gchar *msg, gdouble pct);
00846 void add_message_scroller(GtkWidget *conter);
00847 
00848 // utils.c
00849 #ifdef IS_IRIX
00850 void setenv(const char *name, const char *val, int _xx);
00851 #endif
00852 
00853 LIVES_INLINE float LEFloat_to_BEFloat(float f);
00854 int lives_10pow(int pow);
00855 int get_approx_ln(guint val);
00856 void lives_free(gpointer ptr);
00857 void lives_free_with_check(gpointer ptr);
00858 LIVES_INLINE gint myround(gdouble n);
00859 void get_dirname(gchar *filename);
00860 void get_basename(gchar *filename);
00861 void get_filename(gchar *filename, gboolean strip_dir);
00862 gchar *get_extension(const gchar *filename);
00863 void d_print(const gchar *text);
00864 void init_clipboard(void);
00865 void cache_file_contents(const gchar *filename);
00866 gchar *get_val_from_cached_list(const gchar *key, size_t maxlen);
00867 void get_pref(const gchar *key, gchar *val, gint maxlen);
00868 void get_pref_utf8(const gchar *key, gchar *val, gint maxlen);
00869 void get_pref_default(const gchar *key, gchar *val, gint maxlen);
00870 gboolean get_boolean_pref(const gchar *key);
00871 gdouble get_double_pref(const gchar *key);
00872 gint get_int_pref(const gchar *key);
00873 GList *get_list_pref(const gchar *key);
00874 void get_location(const gchar *exe, gchar *val, gint maxlen);
00875 void set_pref (const gchar *key, const gchar *value);
00876 void delete_pref (const gchar *key);
00877 void set_boolean_pref(const gchar *key, gboolean value);
00878 void set_double_pref(const gchar *key, gdouble value);
00879 void set_int_pref(const gchar *key, gboolean value);
00880 void set_list_pref(const char *key, GList *values);
00881 gboolean apply_prefs(gboolean skip_warnings);
00882 void save_future_prefs(void);
00883 void set_menu_text(GtkWidget *menu, const gchar *text, gboolean use_mnemonic);
00884 void get_menu_text(GtkWidget *menu, gchar *text);
00885 void get_menu_text_long(GtkWidget *menuitem, gchar *text);
00886 gint get_box_child_index (GtkBox *box, GtkWidget *tchild);
00887 void reset_clip_menu (void);
00888 void get_play_times(void);
00889 void get_total_time (file *file);
00890 guint get_signed_endian (gboolean is_signed, gboolean little_endian);
00891 void fullscreen_internal(void);
00892 void unhide_cursor(GdkWindow *window);
00893 void hide_cursor(GdkWindow *window);
00894 void set_alwaysontop(GtkWidget *window, gboolean ontop); 
00895 void colour_equal(GdkColor *c1, const GdkColor *c2);
00896 void switch_to_int_player(void);
00897 void switch_to_mplayer(void);
00898 void switch_aud_to_sox(gboolean set_pref);
00899 gboolean switch_aud_to_jack(void);
00900 gboolean switch_aud_to_pulse(void);
00901 void switch_aud_to_mplayer(gboolean set_pref);
00902 void prepare_to_play_foreign(void);
00903 gboolean after_foreign_play(void);
00904 gboolean check_file(const gchar *file_name, gboolean check_exists);  
00905 gboolean check_dir_access (const gchar *dir);
00906 gulong get_file_size(int fd);
00907 gulong sget_file_size(const gchar *name);
00908 gulong get_fs_free(const gchar *dir);
00909 gboolean ensure_isdir(gchar *fname);
00910 gchar *ensure_extension(const gchar *fname, const gchar *ext) WARN_UNUSED;
00911 gboolean check_dev_busy(gchar *devstr);
00912 void activate_url_inner(const gchar *link);
00913 void activate_url (GtkAboutDialog *about, const gchar *link, gpointer data);
00914 void show_manual_section (const gchar *lang, const gchar *section);
00915 
00916 LIVES_INLINE gdouble calc_time_from_frame (gint clip, gint frame);
00917 LIVES_INLINE gint calc_frame_from_time (gint filenum, gdouble time);  
00918 LIVES_INLINE gint calc_frame_from_time2 (gint filenum, gdouble time); 
00919 LIVES_INLINE gint calc_frame_from_time3 (gint filenum, gdouble time); 
00920 
00921 gboolean check_for_ratio_fps (gdouble fps);
00922 gdouble get_ratio_fps(const gchar *string);
00923 void calc_maxspect(gint rwidth, gint rheight, gint *cwidth, gint *cheight);
00924 
00925 gchar *remove_trailing_zeroes(gdouble val);
00926 void toggle_button_toggle (GtkToggleButton *tbutton);
00927 void remove_layout_files(GList *lmap);
00928 gboolean add_lmap_error(lives_lmap_error_t lerror, const gchar *name, gpointer user_data, 
00929                         gint clipno, gint frameno, gdouble atime, gboolean affects_current);
00930 void clear_lmap_errors(void);
00931 gboolean prompt_remove_layout_files(void);
00932 gboolean is_legal_set_name(const gchar *set_name, gboolean allow_dupes);
00933 gchar *repl_tmpdir(const gchar *entry, gboolean fwd);
00934 gboolean get_clip_value(int which, lives_clip_details_t, void *retval, size_t maxlen);
00935 void save_clip_value(int which, lives_clip_details_t, void *val);
00936 gboolean check_frame_count(gint idx);
00937 void get_frame_count(gint idx);
00938 gint count_resampled_frames (gint in_frames, gdouble orig_fps, gdouble resampled_fps);
00939 gboolean int_array_contains_value(int *array, int num_elems, int value);
00940 gboolean check_for_lock_file(const gchar *set_name, gint type);
00941 void g_list_free_strings(GList *list);
00942 void gtk_tooltips_copy(GtkWidget *dest, GtkWidget *source);
00943 void adjustment_configure(GtkAdjustment *adjustment, gdouble value, gdouble lower, gdouble upper, 
00944                           gdouble step_increment, gdouble page_increment, gdouble page_size);
00945 gboolean create_event_space(gint length_in_eventsb);
00946 void add_to_recent(const gchar *filename, gdouble start, gint frames, const gchar *file_open_params);
00947 gint verhash (gchar *version);
00948 void set_undoable (const gchar *what, gboolean sensitive);
00949 void set_redoable (const gchar *what, gboolean sensitive);
00950 void zero_spinbuttons (void);
00951 void draw_little_bars (gdouble ptrtime);
00952 void set_sel_label (GtkWidget *label);
00953 void clear_mainw_msg (void);
00954 gint get_token_count (const gchar *string, int delim);
00955 GdkPixmap* gdk_pixmap_copy (GdkPixmap *pixmap);
00956 GdkPixbuf *gdk_pixbuf_new_blank(gint width, gint height, int palette);
00957 void get_border_size (GtkWidget *win, gint *bx, gint *by);
00958 gchar *g_strappend (gchar *string, gint len, const gchar *new);
00959 GList *g_list_append_unique(GList *xlist, const gchar *add);
00960 void find_when_to_stop (void);
00961 gint calc_new_playback_position(gint fileno, gint64 otc, gint64 *ntc);
00962 void minimise_aspect_delta (gdouble allowed_aspect,gint hblock,gint vblock,gint hsize,gint vsize,gint *width,gint *height);
00963 LIVES_INLINE gint get_interp_value(gshort quality);
00964 LIVES_INLINE GList *g_list_move_to_first(GList *list, GList *item) WARN_UNUSED;
00965 GList *g_list_delete_string(GList *, char *string) WARN_UNUSED;
00966 GList *g_list_copy_strings(GList *list);
00967 gboolean string_lists_differ(GList *, GList *);
00968 
00969 
00970 GList *get_set_list(const gchar *dir);
00971 void combo_set_popdown_strings (GtkCombo *combo, GList *list);
00972 
00973 gchar *subst (const gchar *string, const gchar *from, const gchar *to);
00974 
00975 gint hextodec (const gchar *string);
00976 gint get_hex_digit (const gchar *c);
00977 
00978 guint32 fastrand(void);
00979 void fastsrand(guint32 seed);
00980 
00981 gint lives_list_index (GList *list, const gchar *data);
00982 
00983 void set_fg_colour(gint red, gint green, gint blue);
00984 gboolean label_act_toggle (GtkWidget *, GdkEventButton *, GtkToggleButton *);
00985 gboolean widget_act_toggle (GtkWidget *, GtkToggleButton *);
00986 
00987 void lives_set_cursor_style(lives_cursor_t cstyle, GdkWindow *window);
00988 
00989 
00990 gchar *text_view_get_text(GtkTextView *textview);
00991 void text_view_set_text(GtkTextView *textview, const gchar *text);
00992 
00993 // plugins.c
00994 GList *get_external_window_hints(lives_rfx_t *rfx);
00995 gboolean check_encoder_restrictions (gboolean get_extension, gboolean user_audio, gboolean save_all);
00996 
00997 //callbacks.c
00998 void lives_exit (void);
00999 void on_check_clicked(void);
01000 void on_fileread_clicked (GtkFileChooser *fch, gpointer widget);
01001 gboolean dirchange_callback (GtkAccelGroup *, GObject *, guint, GdkModifierType, gpointer user_data);
01002 
01003 // paramspecial.c
01004 gboolean mt_framedraw(lives_mt *, GdkPixbuf *);
01005 
01006 // paramwindow.c
01007 void add_fill_to_box (GtkBox *);
01008 
01009 // rte_window.c
01010 void refresh_rte_window (void);
01011 
01012 // effects-weed.c
01013 void *w_memcpy  (void *dest, const void *src, size_t n);
01014 
01015 // pangotext.c
01016 gboolean subtitles_init(file *sfile, char * fname, lives_subtitle_type_t);
01017 void subtitles_free(file *sfile);
01018 gboolean get_srt_text(file *sfile, double xtime);
01019 gboolean get_sub_text(file *sfile, double xtime);
01020 gboolean save_sub_subtitles(file *sfile, double start_time, double end_time, double offset_time, const char *filename);
01021 gboolean save_srt_subtitles(file *sfile, double start_time, double end_time, double offset_time, const char *filename);
01022 
01023 // osc.c
01024 #ifdef ENABLE_OSC
01025 gboolean lives_osc_init(guint osc_udp_port);
01026 gint lives_osc_poll(gpointer data);
01027 void lives_osc_end(void);
01028 gboolean lives_osc_notify(int msgtype, const char *msgstring);
01029 void lives_osc_notify_success (const gchar *msg);
01030 void lives_osc_notify_failure (void);
01031 void lives_osc_notify_cancel (void);
01032 #include "osc_notify.h"
01033 #endif
01034 
01035 // ldvgrab.c
01036 #ifdef HAVE_LDVGRAB
01037 void on_open_fw_activate (GtkMenuItem *menuitem, gpointer format);
01038 
01039 #define CAM_FORMAT_DV 0
01040 #define CAM_FORMAT_HDV 1
01041 
01042 #endif
01043 
01044 int dummyvar;
01045 char *dummychar;
01046 
01047 // inlines
01048 #define cfile mainw->files[mainw->current_file]
01049 #define clipboard mainw->files[0]
01050 
01051 #define U82L(String) ( g_locale_from_utf8 (String,-1,NULL,NULL,NULL) ) 
01052 #define L2U8(String) ( g_locale_to_utf8 (String,-1,NULL,NULL,NULL) ) 
01053 
01054 
01055 #define PREFS_TIMEOUT 10000000 ///< 10 seconds // TODO !
01056 
01057 #define LIVES_TV_CHANNEL1 "http://www.serverwillprovide.com/sorteal/livestvclips/livestv.ogm"
01058 
01059 
01060 // round up to next multiple of b
01061 #define CEIL(a,b) ((int)(((double)a+(double)b-.000000001)/((double)b))*b)
01062 
01063 
01064 #endif // #ifndef HAS_MAIN_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines