4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "edlsession.h"
28 #include "mainsession.h"
30 #include "mwindowgui.h"
31 #include "menuveffects.h"
35 #include "vpluginarray.h"
38 MenuVEffects::MenuVEffects(MWindow *mwindow)
39 : MenuEffects(mwindow)
41 thread = new MenuVEffectThread(mwindow, this);
44 MenuVEffects::~MenuVEffects()
49 MenuVEffectThread::MenuVEffectThread(MWindow *mwindow, MenuVEffects *menu_item)
50 : MenuEffectThread(mwindow, menu_item)
54 MenuVEffectThread::~MenuVEffectThread()
58 int MenuVEffectThread::get_recordable_tracks(Asset *asset)
60 asset->layers = mwindow->edl->tracks->recordable_video_tracks();
64 int MenuVEffectThread::get_derived_attributes(Asset *asset, BC_Hash *defaults)
67 asset->load_defaults(defaults, "VEFFECT_", 1, 1, 1, 0, 0);
69 // Fix asset for video only
70 if(!File::renders_video(asset)) {
71 asset->format = FILE_FFMPEG;
72 strcpy(asset->vcodec, "mp4");
75 asset->audio_data = 0;
76 asset->video_data = 1;
81 int MenuVEffectThread::save_derived_attributes(Asset *asset, BC_Hash *defaults)
83 asset->save_defaults(defaults, "VEFFECT_", 1, 1, 1, 0, 0);
87 PluginArray* MenuVEffectThread::create_plugin_array()
89 return new VPluginArray();
92 int64_t MenuVEffectThread::to_units(double position, int round)
95 return Units::round(position * mwindow->edl->session->frame_rate);
97 return (int64_t)(position * mwindow->edl->session->frame_rate);
102 int MenuVEffectThread::fix_menu(char *title)
104 mwindow->gui->mainmenu->add_veffect(title);
108 MenuVEffectItem::MenuVEffectItem(MenuVEffects *menueffect, const char *string)
109 : MenuEffectItem(menueffect, string)