Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

export.h

Go to the documentation of this file.
00001 /*
00002 * export.h Export Mode Base Object
00003 * Copyright (C) 2002 Mads Bondo Dydensborg <madsdyd@challenge.dk>
00004 * Copyright (C) 2001-2007 Dan Dennedy <dan@dennedy.org>
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 as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU General Public License
00017 * along with this program; if not, write to the Free Software Foundation,
00018 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef _EXPORT_H
00022 #define _EXPORT_H
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027 #include <sys/time.h>
00028 
00029 #include <gtk/gtk.h>
00030 #include "page_export.h"
00031 #include "kino_common.h"
00032 
00033 extern "C"
00034 {
00035 #include "support.h"
00036 }
00037 
00043 typedef enum export_mode {
00044     EXPORT_MODE_1394,
00045     EXPORT_MODE_AVI,
00046     EXPORT_MODE_STILLS,
00047     EXPORT_MODE_AUDIO,
00048     EXPORT_MODE_MJPEG,
00049     EXPORT_MODE_PIPE
00050 };
00051 
00057 typedef enum export_result {
00058     EXPORT_RESULT_FAILURE,
00059     EXPORT_RESULT_SUCCESS,
00060     EXPORT_RESULT_ABORT
00061 };
00062 
00065 typedef enum export_component_enum {
00066     EXPORT_SCENE_LIST = 2,
00067     /* I guess the compiler will barf if we choose SCENE_LIST again */
00068     EXPORT_PREVIEW = 0x01000000,
00069     EXPORT_EXPORT = 0x02000000,
00070     EXPORT_PAUSE = 0x04000000
00071                    /* Note, stop is supported by all - no need to
00072                       have it in here... */
00073 };
00074 
00080 class Export
00081 {
00082 protected:
00083     /* What we support. This is updated on each activate */
00084     gulong actions;
00085 
00086     /* Perhaps the following variables should be made static,
00087        as they really need not be allocated by each page. 
00088        OTOH: KISS */
00089     /* Pointers to the page and KinoCommon */
00090     PageExport *exportPage;
00091     KinoCommon *common;
00092 
00093     /* Pointers to range control elements */
00094     GtkOptionMenu   *menuRange;
00095     GtkSpinButton   *startSpin;
00096     GtkEntry        *startEntry;
00097     GtkSpinButton   *endSpin;
00098     GtkEntry        *endEntry;
00099     GtkSpinButton   *everySpin;
00100 
00101     /* The common buttons - all export pages
00102        should support these buttons */
00103     GtkToggleButton *previewButton;
00104     GtkToggleButton *exportButton;
00105     GtkToggleButton *stopButton;
00106     GtkToggleButton *pauseButton;
00107 
00109     double startTime;
00110     double pauseTime;
00111     double nextUpdateTime;
00112 
00129     void innerLoopUpdate( int progress, int begin, int end, int every,
00130         int currentFrame = -1, const char* activity = _("Exporting") );
00131 
00142     double calculateAdjustedRate( PlayList* playlist, double outputRate, int begin,
00143         int end, int every );
00144 
00145     /* Override this, if you need behaviour different from sleeping
00146        and checking the "isPausing" flag (every 20 millisecond). 
00147        Please remember to also maintain the time used in pause.
00148     */
00149     virtual void doPause();
00150 
00166     virtual enum export_result
00167     doExport( PlayList * playlist, int begin, int end, int every, bool preview ) = 0;
00168 
00169     /* Override these to indicate what to support, what not */
00170     virtual gulong onActivate();
00171     virtual gulong onDeactivate();
00172 
00173 public:
00174     /* Format a number of seconds into HH:MM:SS notation
00175        \param buf buffer to format into
00176        \param size max size of buffer
00177        \param seconds passed as double
00178        \return pointer to buf 
00179     */
00180     static char * formatSecs( char * buf, int size, double seconds );
00181 
00182 public:
00183     Export( PageExport *_exportPage, KinoCommon *_common );
00184     virtual ~Export( ) { }
00185 
00186     /* Children should return a bitfield for the actions supported,
00187        when activate is called.
00188        Note, these methods are not declared virtual, as childrens should
00189        override "onActivate" and "onDeactivate" instead.
00190        This is because we maintain our on set of commands in here... */
00191     gulong activate();
00192     gulong deactivate();
00193     virtual void start();
00194     virtual void clean();
00195     /* Called when the start button is toggled
00196        A wrapper for doExport - does some setup, then runs
00197        doExport and finally tears down some stuff again 
00198        \param preview optional, is passed to doExport
00199     */
00200 
00201     void startExport( bool preview = false ); // { }
00202     /* Called when the stop button is toggled
00203        All children should honor the "isExporting" flag, and 
00204        stop exporting when this flag is set to false. */
00205     virtual void stopExport();
00206     /* Called when the pause button is toggled
00207        All children should call "checkPause" in their mainloop. 
00208        checkPause will call doPause if needed.
00209        default doPause just sleeps - if you need to do something else,
00210        then overwrite doPause.
00211     */
00212     virtual void pauseExport();
00213 
00214     virtual void selectScene( int );
00215 
00216     virtual void selectSection( int );
00217 
00219     void onRangeChange( GtkSpinButton *widget );
00220 };
00221 
00222 #endif

Generated on Sun Mar 11 22:11:45 2007 for Kino by  doxygen 1.4.2