add new av-opts files from andrew, fix copy/paste segv for clip folder, fix deinterla...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / proxy.C
index fd1ba562cb725aaebee1b41fce341f0710483d87..94b51270a48150f11566af8c8126e5bd93535010 100644 (file)
@@ -47,8 +47,8 @@
 #include "transportque.h"
 #include "vrender.h"
 
-#define WIDTH 400
-#define HEIGHT 330
+#define WIDTH xS(400)
+#define HEIGHT yS(330)
 #define MAX_SCALE 16
 
 ProxyMenuItem::ProxyMenuItem(MWindow *mwindow)
@@ -88,6 +88,7 @@ ProxyDialog::ProxyDialog(MWindow *mwindow)
        strcpy(asset->fformat, "mpeg");
        strcpy(asset->vcodec, "mpeg.mpeg");
        asset->ff_video_bitrate = 2000000;
+       asset->video_data = 1;
 
        bzero(size_text, sizeof(char*) * MAX_SIZES);
        bzero(size_factors, sizeof(int) * MAX_SIZES);
@@ -230,10 +231,11 @@ int ProxyRender::from_proxy_path(char *new_path, Indexable *indexable, int scale
        return 0;
 }
 
-ProxyRender::ProxyRender(MWindow *mwindow, Asset *format_asset)
+ProxyRender::ProxyRender(MWindow *mwindow, Asset *format_asset, int asset_scale)
 {
        this->mwindow = mwindow;
        this->format_asset = format_asset;
+       this->asset_scale = asset_scale;
        progress = 0;
        counter_lock = new Mutex("ProxyDialog::counter_lock");
        total_rendered = 0;
@@ -386,7 +388,7 @@ void ProxyWindow::create_objects()
        }
 
        int x = margin;
-       int y = margin+10;
+       int y = margin+yS(10);
        add_subwindow(use_scaler = new ProxyUseScaler(this, x, y));
        y += use_scaler->get_h() + margin;
 
@@ -394,7 +396,7 @@ void ProxyWindow::create_objects()
        add_subwindow(text = new BC_Title(x, y, _("Scale factor:")));
        x += text->get_w() + margin;
 
-       int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, dialog->size_text[0])+15);
+       int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, dialog->size_text[0])+xS(15));
        add_subwindow(scale_factor = new ProxyMenu(mwindow, this, x, y, popupmenu_w, ""));
        scale_factor->update_sizes();
        x += scale_factor->get_w() + margin;
@@ -415,7 +417,7 @@ void ProxyWindow::create_objects()
        add_subwindow(active_scale = new BC_Title(x, y, ""));
        y += active_scale->get_h() + margin;
 
-       x = margin;  y += 25;
+       x = margin;  y += yS(25);
        format_tools = new ProxyFormatTools(mwindow, this, dialog->asset);
        format_tools->create_objects(x, y, 0, 1, 0, 0, 0, 1, 0, 1, // skip the path
                0, 0);
@@ -442,6 +444,7 @@ ProxyFormatTools::ProxyFormatTools(MWindow *mwindow, ProxyWindow *pwindow, Asset
 
 void ProxyFormatTools::update_format()
 {
+       asset->save_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0);
         FormatTools::update_format();
        pwindow->use_scaler->update();
 }
@@ -722,7 +725,12 @@ void ProxyClient::process_package(LoadPackage *ptr)
                proxy_render->update_progress();
        }
        if( !proxy_render->failed && !proxy_render->is_canceled() ) {
-               Asset *asset = mwindow->edl->assets->update(proxy);
+               Asset *asset = edl->assets->update(proxy);
+               asset->proxy_scale = proxy_render->asset_scale;
+               int scale = asset->proxy_scale;
+               if( !scale ) scale = 1;
+               asset->width = asset->actual_width * scale;
+               asset->height = asset->actual_height * scale;
                mwindow->mainindexes->add_next_asset(0, asset);
                mwindow->mainindexes->start_build();
        }