r105: This commit was manufactured by cvs2svn to create tag
[cinelerra_cv/mob.git] / hvirtual / cinelerra / menuveffects.C
blob92591bfccda564349bd4545f870f94979ef9bffc
1 #include "assets.h"
2 #include "defaults.h"
3 #include "edl.h"
4 #include "edlsession.h"
5 #include "file.h"
6 #include "mainmenu.h"
7 #include "mainsession.h"
8 #include "mwindow.h"
9 #include "mwindowgui.h"
10 #include "menuveffects.h"
11 #include "patchbay.h"
12 #include "quicktime.h"
13 #include "tracks.h"
14 #include "units.h"
15 #include "vpluginarray.h"
18 MenuVEffects::MenuVEffects(MWindow *mwindow)
19  : MenuEffects(mwindow)
21         thread = new MenuVEffectThread(mwindow);
24 MenuVEffects::~MenuVEffects()
26         delete thread;
29 MenuVEffectThread::MenuVEffectThread(MWindow *mwindow)
30  : MenuEffectThread(mwindow)
34 MenuVEffectThread::~MenuVEffectThread()
38 int MenuVEffectThread::get_recordable_tracks(Asset *asset)
40         asset->layers = mwindow->edl->tracks->recordable_video_tracks();
41         return asset->layers;
44 int MenuVEffectThread::get_derived_attributes(Asset *asset, Defaults *defaults)
46         char string[1024];
47         File file;
48         defaults->get("VEFFECTPATH", asset->path);
49         sprintf(string, MOV_NAME);
50         defaults->get("VEFFECTFORMAT", string);
51         if(!file.supports_video(mwindow->plugindb, string)) sprintf(string, MOV_NAME);
52         asset->format = file.strtoformat(mwindow->plugindb, string);
53         sprintf(asset->vcodec, QUICKTIME_YUV2);
54         asset->video_data = 1;
58         asset->load_defaults(defaults);
59         defaults->get("EFFECT_VIDEO_CODEC", asset->vcodec);
60         return 0;
63 int MenuVEffectThread::save_derived_attributes(Asset *asset, Defaults *defaults)
65         File file;
66         defaults->update("VEFFECTPATH", asset->path);
67         defaults->update("VEFFECTFORMAT", file.formattostr(mwindow->plugindb, asset->format));
68         defaults->update("VEFFECTCOMPRESSION", asset->vcodec);
71         asset->save_defaults(defaults);
72         defaults->update("EFFECT_VIDEO_CODEC", asset->vcodec);
73         return 0;
76 PluginArray* MenuVEffectThread::create_plugin_array()
78         return new VPluginArray();
81 int64_t MenuVEffectThread::to_units(double position, int round)
83         if(round)
84                 return Units::round(position * mwindow->edl->session->frame_rate);
85         else
86                 return (int64_t)(position * mwindow->edl->session->frame_rate);
87                 
88         return 0;
91 int MenuVEffectThread::fix_menu(char *title)
93         mwindow->gui->mainmenu->add_veffect(title); 
96 MenuVEffectItem::MenuVEffectItem(MenuVEffects *menueffect, char *string)
97  : MenuEffectItem(menueffect, string)