X-Git-Url: https://cinelerra-gg.org/git/?a=blobdiff_plain;ds=sidebyside;f=cinelerra-5.1%2Fcinelerra%2Fconvert.h;fp=cinelerra-5.1%2Fcinelerra%2Fconvert.h;h=a1de04b8bb28c41b7389ddf63fb69cb1c16b25be;hb=03fa86e6dc495f9444ae14dad401b1ad6de793fe;hp=0000000000000000000000000000000000000000;hpb=0e16112661802284c0d2c9eb8d1df84141125e91;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/convert.h b/cinelerra-5.1/cinelerra/convert.h new file mode 100644 index 00000000..a1de04b8 --- /dev/null +++ b/cinelerra-5.1/cinelerra/convert.h @@ -0,0 +1,223 @@ +#ifndef __CONVERT_H__ +#define __CONVERT_H__ + +/* + * CINELERRA + * Copyright (C) 2015 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "arraylist.h" +#include "audiodevice.inc" +#include "asset.h" +#include "bcdialog.h" +#include "bctimer.inc" +#include "convert.inc" +#include "file.inc" +#include "formattools.h" +#include "guicast.h" +#include "mainprogress.inc" +#include "mutex.inc" +#include "mwindow.inc" +#include "packagerenderer.h" +#include "render.inc" + +class ConvertRender : public Thread +{ +public: + ConvertRender(MWindow *mwindow, const char *suffix); + ~ConvertRender(); + void reset(); + void to_convert_path(char *new_path, Indexable *idxbl); + int from_convert_path(char *new_path, Indexable *idxbl); + + ArrayList orig_idxbls; // originals which match the convert assets + ArrayList orig_copies; // convert assets + ArrayList needed_idxbls; // originals which match the needed_assets + ArrayList needed_copies; // assets which must be created + + EDL *convert_edl(EDL *edl, Indexable *idxbl); // create render edl for this indexable + int add_original(EDL *edl, Indexable *idxbl); + void add_needed(Indexable *idxbl, Asset *convert); + int find_convertable_assets(EDL *edl); + +// if user canceled progress bar + int is_canceled(); + void set_format(Asset *asset); + void start_convert(float beep, int remove_originals); + void run(); + void create_copy(int i); + void start_progress(); + void stop_progress(const char *msg); + + MWindow *mwindow; + const char *suffix; + Asset *format_asset; + MainProgressBar *progress; + ConvertProgress *convert_progress; + Timer *progress_timer; + + Mutex *counter_lock; + int total_rendered, remove_originals; + int failed, canceled, result; + float beep; +}; + +class ConvertMenuItem : public BC_MenuItem +{ +public: + ConvertMenuItem(MWindow *mwindow); + ~ConvertMenuItem(); + + int handle_event(); + void create_objects(); + + MWindow *mwindow; + ConvertDialog *dialog; +}; + +class ConvertFormatTools : public FormatTools +{ +public: + ConvertFormatTools(MWindow *mwindow, ConvertWindow *gui, Asset *asset); + + void update_format(); + ConvertWindow *gui; +}; + +class ConvertSuffixText : public BC_TextBox +{ +public: + ConvertSuffixText(ConvertWindow *gui, ConvertDialog *dialog, int x, int y); + ~ConvertSuffixText(); + int handle_event(); + + ConvertWindow *gui; + ConvertDialog *dialog; +}; + +class ConvertRemoveOriginals : public BC_CheckBox +{ +public: + ConvertRemoveOriginals(ConvertWindow *gui, int x, int y); + ~ConvertRemoveOriginals(); + + int handle_event(); + + ConvertWindow *gui; +}; + +class ConvertBeepOnDone : public BC_FPot +{ +public: + ConvertBeepOnDone(ConvertWindow *gui, int x, int y); + void update(); + int handle_event(); + + ConvertWindow *gui; +}; + +class ConvertPackageRenderer : public PackageRenderer +{ +public: + ConvertPackageRenderer(ConvertRender *render); + ~ConvertPackageRenderer(); + + int get_master(); + int get_result(); + void set_result(int value); + void set_progress(int64_t value); + int progress_cancelled(); + + ConvertRender *render; +}; + +class ConvertProgress : public Thread +{ +public: + ConvertProgress(MWindow *mwindow, ConvertRender *render); + ~ConvertProgress(); + + void run(); + + MWindow *mwindow; + ConvertRender *render; + int64_t last_value; +}; + +class ConvertWindow : public BC_Window +{ +public: + ConvertWindow(MWindow *mwindow, ConvertDialog *dialog, + int x, int y); + ~ConvertWindow(); + + void create_objects(); + + MWindow *mwindow; + ConvertDialog *dialog; + + ConvertSuffixText *suffix_text; + ConvertFormatTools *format_tools; + ConvertRemoveOriginals *remove_originals; + ConvertBeepOnDone *beep_on_done; +}; + +class ConvertDialog : public BC_DialogThread +{ +public: + ConvertDialog(MWindow *mwindow); + ~ConvertDialog(); + BC_Window* new_gui(); + + void handle_close_event(int result); + void convert(); + + MWindow *mwindow; + ConvertWindow *gui; + Asset *asset; + char suffix[BCTEXTLEN]; + ConvertRender *convert_render; + + int orig_scale, new_scale; + int use_scaler, auto_scale; + int orig_w, orig_h; + int remove_originals; + float beep; +}; + +class ConvertBeep : public Thread +{ +public: + enum { BEEP_SAMPLE_RATE=48000 }; + typedef int16_t audio_data_t; + ConvertBeep(MWindow *mwindow); + ~ConvertBeep(); + + void run(); + void start(); + void stop(int wait); + void tone(double freq, double secs, double gain); + + MWindow *mwindow; + double freq, secs, gain; + AudioDevice *audio; + int playing_audio, interrupted; + int audio_pos; +}; + +#endif