LiVES 1.3.11-svn
src/main.h
Go to the documentation of this file.
00001 // main.h
00002 // LiVES
00003 // (c) G. Finch (salsaman@xs4all.nl) 2003 - 2010
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 
00068 #define BOOTSTRAP_NAME "/tmp/.smogrify"
00069 
00071 #define MAX_FILES 65535
00072 
00075 #ifndef PREFIX_DEFAULT
00076 #define PREFIX_DEFAULT "/usr"
00077 #endif
00078 
00080 #ifndef PREFIX
00081 #define PREFIX PREFIX_DEFAULT
00082 #endif
00083 
00084 //#define HAVE_UNICAP 1
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"
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 
00154 
00157 typedef struct {
00158   gint value;
00159   gint64 reltime;
00160 } event;
00161 
00162 typedef struct {
00163   GtkWidget *processing;
00164   GtkWidget *progressbar;
00165   GtkWidget *label;
00166   GtkWidget *label2;
00167   GtkWidget *label3;
00168   GtkWidget *stop_button;
00169   GtkWidget *pause_button;
00170   GtkWidget *preview_button;
00171   GtkWidget *cancel_button;
00172   GtkWidget *scrolledwindow;
00173   guint frames_done;
00174 } process;
00175 
00176 
00177 
00178 
00179 typedef struct {
00180   int afile;
00181   double seek;
00182   double vel;
00183 } lives_audio_track_state_t;
00184 
00185 
00186 #include "../libweed/weed.h"
00187 #include "../libweed/weed-events.h"
00188 
00189 // see weed event spec. for more info
00190 
00191 
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 //gui.c
00636 void  create_LiVES (void);
00637 void enable_record (void);
00638 void toggle_record (void);
00639 void disable_record (void);
00640 
00641 // interface.c
00642 process* create_processing (const gchar *text);
00643 void add_to_winmenu(void);
00644 void remove_from_winmenu(void);
00645 void make_play_window(void);
00646 void resize_play_window (void);
00647 void kill_play_window (void);
00648 void make_preview_box (void);
00649 void add_to_playframe (void);
00650 GtkWidget* create_cdtrack_dialog (gint type, gpointer user_data);
00651 GtkTextView *create_output_textview(void);
00652 gchar *choose_file(gchar *dir, gchar *fname, gchar **filt, GtkFileChooserAction act, GtkWidget *extra);
00653 
00654 
00655 // dialogs.c
00656 gboolean do_progress_dialog(gboolean visible, gboolean cancellable, const gchar *text);
00657 gboolean do_warning_dialog(const gchar *text);
00658 gboolean do_warning_dialog_with_check(const gchar *text, gint warn_mask_number);
00659 gboolean do_warning_dialog_with_check_transient(const gchar *text, gint warn_mask_number, GtkWindow *transient);
00660 gboolean do_yesno_dialog(const gchar *text);
00661 void do_error_dialog(const gchar *text);
00662 void do_error_dialog_with_check(const gchar *text, gint warn_mask_number);
00663 void do_blocking_error_dialog(const gchar *text);
00664 void do_error_dialog_with_check_transient(const gchar *text, gboolean is_blocking,gint warn_mask_number, GtkWindow *transient);
00665 void add_warn_check (GtkBox *box, gint warn_mask_number);
00666 void do_memory_error_dialog (void);
00667 void too_many_files(void);
00668 void tempdir_warning (void);
00669 void do_audio_import_error(void);
00670 void do_mt_backup_space_error(lives_mt *, gint memreq_mb);
00671 
00672 gboolean do_clipboard_fps_warning(void);
00673 void perf_mem_warning(void);
00674 void do_dvgrab_error(void);
00675 gboolean do_comments_dialog (file *sfile, gchar *filename);
00676 void do_auto_dialog(const gchar *text, gint type);
00677 void do_encoder_acodec_error (void);
00678 void do_encoder_sox_error(void);
00679 gboolean rdet_suggest_values (gint width, gint height, gdouble fps, gint fps_num, gint fps_denom, gint arate, gint asigned, gboolean anr, gboolean ignore_fps);
00680 gboolean do_encoder_restrict_dialog (gint width, gint height, gdouble fps, gint fps_num, gint fps_denom, gint arate, gint asigned, gboolean anr);
00681 void do_keys_window (void);
00682 void do_mt_keys_window (void);
00683 void do_messages_window (void);
00684 void do_firstever_dialog (void);
00685 void do_upgrade_error_dialog(void);
00686 void do_no_mplayer_sox_error(void);
00687 void do_aud_during_play_error(void);
00688 void do_rendered_fx_dialog(void);
00689 void do_layout_scrap_file_error(void);
00690 void do_set_load_lmap_error(void);
00691 gboolean do_set_duplicate_warning (const gchar *new_set);
00692 gboolean do_set_rename_old_layouts_warning(const gchar *new_set);
00693 gboolean do_layout_alter_frames_warning(void);
00694 gboolean do_layout_alter_audio_warning(void);
00695 gboolean do_yuv4m_open_warning(void);
00696 void do_mt_undo_mem_error(void);
00697 void do_mt_undo_buf_error(void);
00698 void do_mt_set_mem_error(gboolean has_mt, gboolean trans);
00699 void do_mt_audchan_error(gint warn_mask);
00700 void do_mt_no_audchan_error(void);
00701 void do_mt_no_jack_error(gint warn_mask);
00702 gboolean do_mt_rect_prompt(void);
00703 void do_audrate_error_dialog(void);
00704 gboolean do_event_list_warning(void);
00705 void do_nojack_rec_error(void);
00706 void do_vpp_palette_error (void);
00707 void do_vpp_fps_error (void);
00708 void do_decoder_palette_error (void);
00709 void do_rmem_max_error (gint size);
00710 gboolean do_original_lost_warning(const gchar *fname);
00711 void do_no_decoder_error(const gchar *fname);
00712 void do_jack_noopen_warn(void);
00713 void do_jack_noopen_warn2(void);
00714 void do_jack_noopen_warn3(void);
00715 void do_jack_noopen_warn4(void);
00716 void do_file_perm_error(const gchar *file_name);
00717 void do_dir_perm_error(const gchar *dir_name);
00718 void do_encoder_img_ftm_error(render_details *rdet);
00719 void do_after_crash_warning (void);
00720 void do_bad_layout_error(void);
00721 void do_card_in_use_error(void);
00722 void do_dev_busy_error(const gchar *devstr);
00723 gboolean do_existing_subs_warning(void);
00724 void do_invalid_subs_error(void);
00725 gboolean do_erase_subs_warning(void);
00726 gboolean do_sub_type_warning(const gchar *ext, const gchar *type_ext);
00727 gboolean do_move_tmpdir_dialog(void);
00728 void do_set_locked_warning (const gchar *setname);
00729 void do_no_in_vdevs_error(void);
00730 void do_locked_in_vdevs_error(void);
00731 void do_do_not_close_d (void);
00732 
00733 gboolean process_one (gboolean visible);
00734 void do_threaded_dialog(const gchar *text, gboolean has_cancel);
00735 void end_threaded_dialog(void);
00736 void response_ok (GtkButton *button, gpointer user_data);
00737 void response_cancel (GtkButton *button, gpointer user_data);
00738 void pump_io_chan(GIOChannel *iochan);
00739 
00740 void do_splash_progress(void);
00741 
00742 
00743 // d_print shortcuts
00744 void d_print_cancelled(void);
00745 void d_print_failed(void);
00746 void d_print_done(void);
00747 void d_print_file_error_failed(void);
00748 
00749 // general
00750 void do_text_window (const gchar *title, const gchar *text);
00751 
00752 // saveplay.c
00753 gboolean add_file_info(const gchar *check_handle, gboolean aud_only);
00754 void save_file_comments (int fileno);
00755 void reget_afilesize (int fileno);
00756 void deduce_file(const gchar *filename, gdouble start_time, gint end);
00757 void open_file (const gchar *filename);
00758 void open_file_sel(const gchar *file_name,gdouble start_time, gint frames);
00759 void open_fw_device (void);
00760 gboolean get_new_handle(gint index, const gchar *name);
00761 gboolean get_temp_handle(gint index, gboolean create);
00762 void get_handle_from_info_file(gint index);
00763 void create_cfile(void);
00764 void save_file (gboolean existing, gchar *n_file_name);
00765 void play_file (void);
00766 gboolean save_frame(gint clip, gint frame, const gchar *file_name, gint width, gint height);
00767 void wait_for_stop (const gchar *stop_command);
00768 void save_clip_values(gint which_file);
00769 void add_to_recovery_file (const gchar *handle);
00770 void rewrite_recovery_file(void);
00771 gboolean check_for_recovery_files (gboolean auto_recover);
00772 void recover_layout_map(gint numclips);
00773 const gchar *get_deinterlace_string(void);
00774 
00775 // saveplay.c backup
00776 void backup_file(const gchar *filename);
00777 gint save_event_frames(void);
00778 void write_headers (file *file);
00779 
00780 // saveplay.c restore
00781 void restore_file(const gchar *filename);
00782 gboolean read_headers(const gchar *file_name);
00783 
00784 // saveplay.c sets
00785 void open_set_file (const gchar *set_name, gint clipnum);
00786 
00787 
00788 // saveplay.c scrap file
00789 gboolean open_scrap_file (void);
00790 gint save_to_scrap_file (weed_plant_t *layer);
00791 gboolean load_from_scrap_file(weed_plant_t *layer, int frame);
00792 void close_scrap_file (void);
00793 
00794 
00795 // main.c
00796 void catch_sigint(int signum);
00797 gboolean startup_message_fatal(const gchar *msg);
00798 gboolean startup_message_nonfatal(const gchar *msg);
00799 gboolean startup_message_nonfatal_dismissable(const gchar *msg, gint warning_mask);
00800 capability *get_capabilities(void);
00801 void get_monitors(void);
00802 void load_start_image(gint frame);
00803 void load_end_image(gint frame);
00804 void load_preview_image(gboolean update_always);
00805 
00806 gboolean pull_frame(weed_plant_t *layer, const gchar *image_ext, weed_timecode_t tc);
00807 gboolean pull_frame_at_size (weed_plant_t *layer, const gchar *image_ext, weed_timecode_t tc, int width, int height, int target_palette);
00808 GdkPixbuf *pull_gdk_pixbuf_at_size(gint clip, gint frame, const gchar *image_ext, weed_timecode_t tc, gint width, gint height, GdkInterpType interp);
00809 
00810 void load_frame_image(gint frame);
00811 void sensitize(void);
00812 void desensitize(void);
00813 void procw_desensitize(void);
00814 void close_current_file (gint file_to_switch_to);  
00815 void get_next_free_file(void);
00816 void switch_to_file(gint old_file, gint new_file);
00817 void do_quick_switch (gint new_file);
00818 void resize (gdouble scale);
00819 GdkPixbuf *lives_scale_simple (GdkPixbuf *, gint width, gint height);
00820 gboolean read_file_details(const gchar *file_name, gboolean only_check_for_audio);
00821 void do_start_messages(void);
00822 void set_palette_colours (void);
00823 void set_main_title(const gchar *filename, gint or_untitled_number);
00824 void set_record (void);
00825 
00826 // main.c - in progress
00827 weed_plant_t *weed_layer_new_from_video(gint fnum, gint frame);
00828 
00829 //gui.c
00830 void fade_background(void);
00831 void unfade_background(void);
00832 void block_expose (void);
00833 void unblock_expose (void);
00834 void frame_size_update(void);
00835 void splash_init(void);
00836 void splash_end(void);
00837 void splash_msg(const gchar *msg, gdouble pct);
00838 
00839 // utils.c
00840 #ifdef IS_IRIX
00841 void setenv(const char *name, const char *val, int _xx);
00842 #endif
00843 
00844 LIVES_INLINE float LEFloat_to_BEFloat(float f);
00845 int lives_10pow(int pow);
00846 int get_approx_ln(guint val);
00847 void lives_free(gpointer ptr);
00848 void lives_free_with_check(gpointer ptr);
00849 LIVES_INLINE gint myround(gdouble n);
00850 void get_dirname(gchar *filename);
00851 void get_basename(gchar *filename);
00852 void get_filename(gchar *filename, gboolean strip_dir);
00853 gchar *get_extension(const gchar *filename);
00854 void d_print(const gchar *text);
00855 void init_clipboard(void);
00856 void cache_file_contents(const gchar *filename);
00857 gchar *get_val_from_cached_list(const gchar *key, size_t maxlen);
00858 void get_pref(const gchar *key, gchar *val, gint maxlen);
00859 void get_pref_utf8(const gchar *key, gchar *val, gint maxlen);
00860 void get_pref_default(const gchar *key, gchar *val, gint maxlen);
00861 gboolean get_boolean_pref(const gchar *key);
00862 gdouble get_double_pref(const gchar *key);
00863 gint get_int_pref(const gchar *key);
00864 void get_location(const gchar *exe, gchar *val, gint maxlen);
00865 void set_pref (const gchar *key, const gchar *value);
00866 void set_boolean_pref(const gchar *key, gboolean value);
00867 void set_double_pref(const gchar *key, gdouble value);
00868 void set_int_pref(const gchar *key, gboolean value);
00869 gboolean apply_prefs(gboolean skip_warnings);
00870 void save_future_prefs(void);
00871 void set_menu_text(GtkWidget *menu, const gchar *text, gboolean use_mnemonic);
00872 void get_menu_text(GtkWidget *menu, gchar *text);
00873 void get_menu_text_long(GtkWidget *menuitem, gchar *text);
00874 gint get_box_child_index (GtkBox *box, GtkWidget *tchild);
00875 void reset_clip_menu (void);
00876 void get_play_times(void);
00877 void get_total_time (file *file);
00878 guint get_signed_endian (gboolean is_signed, gboolean little_endian);
00879 void fullscreen_internal(void);
00880 void unhide_cursor(GdkWindow *window);
00881 void hide_cursor(GdkWindow *window);
00882 void set_alwaysontop(GtkWidget *window, gboolean ontop); 
00883 void colour_equal(GdkColor *c1, const GdkColor *c2);
00884 void switch_to_int_player(void);
00885 void switch_to_mplayer(void);
00886 void switch_aud_to_sox(void);
00887 gboolean switch_aud_to_jack(void);
00888 gboolean switch_aud_to_pulse(void);
00889 void switch_aud_to_mplayer(void);
00890 void prepare_to_play_foreign(void);
00891 gboolean after_foreign_play(void);
00892 gboolean check_file(const gchar *file_name, gboolean check_exists);  
00893 gboolean check_dir_access (const gchar *dir);
00894 gulong get_file_size(int fd);
00895 gulong sget_file_size(const gchar *name);
00896 gulong get_fs_free(const gchar *dir);
00897 gboolean ensure_isdir(gchar *fname);
00898 gchar *ensure_extension(const gchar *fname, const gchar *ext) WARN_UNUSED;
00899 gboolean check_dev_busy(gchar *devstr);
00900 void activate_url_inner(const gchar *link);
00901 void activate_url (GtkAboutDialog *about, const gchar *link, gpointer data);
00902 void show_manual_section (const gchar *lang, const gchar *section);
00903 
00904 LIVES_INLINE gdouble calc_time_from_frame (gint clip, gint frame);
00905 LIVES_INLINE gint calc_frame_from_time (gint filenum, gdouble time);  
00906 LIVES_INLINE gint calc_frame_from_time2 (gint filenum, gdouble time); 
00907 LIVES_INLINE gint calc_frame_from_time3 (gint filenum, gdouble time); 
00908 
00909 gboolean check_for_ratio_fps (gdouble fps);
00910 gdouble get_ratio_fps(const gchar *string);
00911 void calc_maxspect(gint rwidth, gint rheight, gint *cwidth, gint *cheight);
00912 
00913 gchar *remove_trailing_zeroes(gdouble val);
00914 void toggle_button_toggle (GtkToggleButton *tbutton);
00915 void remove_layout_files(GList *lmap);
00916 gboolean add_lmap_error(lives_lmap_error_t lerror, const gchar *name, gpointer user_data, gint clipno, gint frameno, gdouble atime, gboolean affects_current);
00917 void clear_lmap_errors(void);
00918 gboolean prompt_remove_layout_files(void);
00919 gboolean is_legal_set_name(const gchar *set_name, gboolean allow_dupes);
00920 gchar *repl_tmpdir(const gchar *entry, gboolean fwd);
00921 gboolean get_clip_value(int which, lives_clip_details_t, void *retval, size_t maxlen);
00922 void save_clip_value(int which, lives_clip_details_t, void *val);
00923 gboolean check_frame_count(gint idx);
00924 void get_frame_count(gint idx);
00925 gint count_resampled_frames (gint in_frames, gdouble orig_fps, gdouble resampled_fps);
00926 gboolean int_array_contains_value(int *array, int num_elems, int value);
00927 gboolean check_for_lock_file(const gchar *set_name, gint type);
00928 void g_list_free_strings(GList *list);
00929 void gtk_tooltips_copy(GtkWidget *dest, GtkWidget *source);
00930 void adjustment_configure(GtkAdjustment *adjustment, gdouble value, gdouble lower, gdouble upper, gdouble step_increment, gdouble page_increment, gdouble page_size);
00931 gboolean create_event_space(gint length_in_eventsb);
00932 void add_to_recent(const gchar *filename, gdouble start, gint frames, const gchar *file_open_params);
00933 gint verhash (gchar *version);
00934 void set_undoable (const gchar *what, gboolean sensitive);
00935 void set_redoable (const gchar *what, gboolean sensitive);
00936 void zero_spinbuttons (void);
00937 void draw_little_bars (gdouble ptrtime);
00938 void set_sel_label (GtkWidget *label);
00939 void clear_mainw_msg (void);
00940 gint get_token_count (const gchar *string, int delim);
00941 GdkPixmap* gdk_pixmap_copy (GdkPixmap *pixmap);
00942 GdkPixbuf *gdk_pixbuf_new_blank(gint width, gint height, int palette);
00943 void get_border_size (GtkWidget *win, gint *bx, gint *by);
00944 gchar *g_strappend (gchar *string, gint len, const gchar *new);
00945 GList *g_list_append_unique(GList *xlist, const gchar *add);
00946 void find_when_to_stop (void);
00947 gint calc_new_playback_position(gint fileno, gint64 otc, gint64 *ntc);
00948 void minimise_aspect_delta (gdouble allowed_aspect,gint hblock,gint vblock,gint hsize,gint vsize,gint *width,gint *height);
00949 LIVES_INLINE gint get_interp_value(gshort quality);
00950 LIVES_INLINE GList *g_list_move_to_first(GList *list, GList *item) WARN_UNUSED;
00951 
00952 
00953 GList *get_set_list(const gchar *dir);
00954 void combo_set_popdown_strings (GtkCombo *combo, GList *list);
00955 
00956 gchar *subst (const gchar *string, const gchar *from, const gchar *to);
00957 
00958 gint hextodec (const gchar *string);
00959 gint get_hex_digit (const gchar *c);
00960 
00961 guint32 fastrand(void);
00962 void fastsrand(guint32 seed);
00963 
00964 gint lives_list_index (GList *list, const gchar *data);
00965 
00966 void set_fg_colour(gint red, gint green, gint blue);
00967 gboolean label_act_toggle (GtkWidget *, GdkEventButton *, GtkToggleButton *);
00968 gboolean widget_act_toggle (GtkWidget *, GtkToggleButton *);
00969 
00970 void lives_set_cursor_style(lives_cursor_t cstyle, GdkWindow *window);
00971 
00972 
00973 gchar *text_view_get_text(GtkTextView *textview);
00974 void text_view_set_text(GtkTextView *textview, const gchar *text);
00975 
00976 // plugins.c
00977 GList *get_external_window_hints(lives_rfx_t *rfx);
00978 gboolean check_encoder_restrictions (gboolean get_extension, gboolean user_audio);
00979 
00980 //callbacks.c
00981 void lives_exit (void);
00982 void on_check_clicked(void);
00983 void on_fileread_clicked (GtkFileChooser *fch, gpointer widget);
00984 gboolean dirchange_callback (GtkAccelGroup *, GObject *, guint, GdkModifierType, gpointer user_data);
00985 
00986 // paramspecial.c
00987 gboolean mt_framedraw(lives_mt *, GdkPixbuf *);
00988 
00989 // paramwindow.c
00990 void add_fill_to_box (GtkBox *);
00991 
00992 // rte_window.c
00993 void refresh_rte_window (void);
00994 
00995 // effects-weed.c
00996 void *w_memcpy  (void *dest, const void *src, size_t n);
00997 
00998 // pangotext.c
00999 gboolean subtitles_init(file *sfile, char * fname, lives_subtitle_type_t);
01000 void subtitles_free(file *sfile);
01001 gboolean get_srt_text(file *sfile, double xtime);
01002 gboolean get_sub_text(file *sfile, double xtime);
01003 gboolean save_sub_subtitles(file *sfile, double start_time, double end_time, double offset_time, const char *filename);
01004 gboolean save_srt_subtitles(file *sfile, double start_time, double end_time, double offset_time, const char *filename);
01005 
01006 // osc.c
01007 #ifdef ENABLE_OSC
01008 gboolean lives_osc_init(guint osc_udp_port);
01009 gint lives_osc_poll(gpointer data);
01010 void lives_osc_end(void);
01011 gboolean lives_osc_notify(int msgtype, const char *msgstring);
01012 void lives_osc_notify_success (const gchar *msg);
01013 void lives_osc_notify_failure (void);
01014 void lives_osc_notify_cancel (void);
01015 #include "osc_notify.h"
01016 #endif
01017 
01018 // ldvgrab.c
01019 #ifdef HAVE_LDVGRAB
01020 void on_open_fw_activate (GtkMenuItem *menuitem, gpointer format);
01021 
01022 #define CAM_FORMAT_DV 0
01023 #define CAM_FORMAT_HDV 1
01024 
01025 #endif
01026 
01027 int dummyvar;
01028 char *dummychar;
01029 
01030 // inlines
01031 #define cfile mainw->files[mainw->current_file]
01032 #define clipboard mainw->files[0]
01033 
01034 #define U82L(String) ( g_locale_from_utf8 (String,-1,NULL,NULL,NULL) ) 
01035 #define L2U8(String) ( g_locale_to_utf8 (String,-1,NULL,NULL,NULL) ) 
01036 
01037 
01038 #define PREFS_TIMEOUT 10000000 ///< 10 seconds // TODO !
01039 
01040 #define LIVES_TV_CHANNEL1 "http://www.serverwillprovide.com/sorteal/livestvclips/livestv.ogm"
01041 
01042 
01043 #endif // #ifndef HAS_MAIN_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines