layers = 0;
actual_width = width = 0;
actual_height = height = 0;
+ proxy_scale = 0; // not a proxy
video_length = 0;
single_frame = 0;
vmpeg_cmodel = BC_YUV420P;
height = asset->height;
actual_width = asset->actual_width;
actual_height = asset->actual_height;
+ proxy_scale = asset->proxy_scale;
strcpy(vcodec, asset->vcodec);
strcpy(acodec, asset->acodec);
actual_width = file->tag.get_property("ACTUAL_WIDTH", actual_width);
height = file->tag.get_property("HEIGHT", height);
width = file->tag.get_property("WIDTH", width);
+ proxy_scale = file->tag.get_property("PROXY_SCALE", 0);
layers = file->tag.get_property("LAYERS", layers);
program = file->tag.get_property("PROGRAM", program);
// This is loaded from the index file after the EDL but this
file->tag.set_property("ACTUAL_WIDTH", actual_width);
file->tag.set_property("HEIGHT", height);
file->tag.set_property("WIDTH", width);
+ file->tag.set_property("PROXY_SCALE", proxy_scale);
file->tag.set_property("LAYERS", layers);
file->tag.set_property("PROGRAM", program);
file->tag.set_property("FRAMERATE", frame_rate);
width = GET_DEFAULT("WIDTH", width);
actual_height = GET_DEFAULT("ACTUAL_HEIGHT", actual_height);
actual_width = GET_DEFAULT("ACTUAL_WIDTH", actual_width);
+ proxy_scale = GET_DEFAULT("PROXY_SCALE", proxy_scale);
program = GET_DEFAULT("PROGRAM", program);
layers = GET_DEFAULT("LAYERS", layers);
if(EQUIV(frame_rate, 0)) frame_rate = GET_DEFAULT("FRAMERATE", frame_rate);
UPDATE_DEFAULT("WIDTH", width);
UPDATE_DEFAULT("ACTUAL_HEIGHT", actual_height);
UPDATE_DEFAULT("ACTUAL_WIDTH", actual_width);
+ UPDATE_DEFAULT("PROXY_SCALE", proxy_scale);
UPDATE_DEFAULT("PROGRAM", program);
UPDATE_DEFAULT("LAYERS", layers);
UPDATE_DEFAULT("FRAMERATE", frame_rate);
char string[BCTEXTLEN];
ilacemode_to_xmltext(string, interlace_mode);
fprintf(fp," video_data %d program %d layers %d framerate %f width %d"
- " height %d vcodec %4.4s aspect_ratio %f ilace_mode %s\n",
+ " height %d vcodec %s aspect_ratio %f ilace_mode %s\n",
video_data, layers, program, frame_rate, width, height,
vcodec, aspect_ratio,string);
+ fprintf(fp," actual_width %d actual_height %d proxy_scale %d"
+ " video_length %jd repeat %d\n",
+ actual_width, actual_height, proxy_scale, video_length,
+ single_frame);
fprintf(fp," video_length %jd repeat %d\n", video_length, single_frame);
fprintf(fp," mov_sphere=%d jpeg_sphere=%d\n", mov_sphere, jpeg_sphere);
return 0;
int actual_width, actual_height;
int width, height;
+// scale factor or 0 if not proxy
+ int proxy_scale;
// String or FourCC describing compression
char vcodec[BCTEXTLEN];
}
CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, int value)
- : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 70, 3)
+ : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 70)
{
this->gui = gui;
}
}
}
-void EDL::set_proxy(int new_scale, int use_scaler,
+void EDL::set_proxy(int new_scale, int new_use_scaler,
ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
{
int orig_scale = session->proxy_scale;
- int orig_use_scaler = session->proxy_use_scaler;
-
-// rescale to full size asset in read_frame
session->proxy_scale = new_scale;
- session->proxy_use_scaler = use_scaler;
-
- if( use_scaler ) {
- for( int i=0; i<proxy_assets->size(); ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
- new_scale = 1;
- }
-
- if( !orig_use_scaler )
- rescale_proxy(orig_scale, new_scale);
-
+ int orig_use_scaler = session->proxy_use_scaler;
+ session->proxy_use_scaler = new_use_scaler;
+ if( orig_use_scaler ) orig_scale = 1;
+ int scale = new_use_scaler ? new_scale : 1;
+ int asset_scale = new_scale == 1 && !new_use_scaler ? 0 : scale;
// change original assets to proxy assets
- int folder_no = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
+ int folder_no = new_use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
Indexable *proxy_idxbl = proxy_assets->get(i);
proxy_idxbl->folder_no = folder_no;
if( !proxy_idxbl->is_asset ) continue;
Asset *proxy_asset = assets->update((Asset *)proxy_idxbl);
- if( proxy_asset == (Asset *)proxy_idxbl ) continue;
- proxy_asset->width = proxy_idxbl->get_w();
- proxy_asset->height = proxy_idxbl->get_h();
+ proxy_asset->width = proxy_asset->actual_width * scale;
+ proxy_asset->height = proxy_asset->actual_height * scale;
+ proxy_asset->proxy_scale = asset_scale;
}
+// rescale to full size asset in read_frame
+ if( new_use_scaler ) new_scale = 1;
+ rescale_proxy(orig_scale, new_scale);
+
// replace track contents
for( Track *track=tracks->first; track; track=track->next ) {
if( track->data_type != TRACK_VIDEO ) continue;
}
}
-void EDL::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+void EDL::add_proxy(ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
{
- if( use_scaler ) {
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
+ int asset_scale = session->proxy_scale;
+ if( asset_scale == 1 ) asset_scale = 0;
+ int scale = !asset_scale ? 1 : asset_scale;
+// update proxy geom using scale
+ for( int i=0; i<proxy_assets->size(); ++i ) {
+ Asset *proxy_asset = (Asset *)proxy_assets->get(i);
+ proxy_asset->proxy_scale = asset_scale;
+ proxy_asset->width = proxy_asset->actual_width * scale;
+ proxy_asset->height = proxy_asset->actual_height * scale;
}
// change original assets to proxy assets
void rescale_proxy(int orig_scale, int new_scale);
void set_proxy(int new_scale, int use_scaler,
ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets);
- void add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets);
+ void add_proxy(ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets);
Asset *get_proxy_asset();
Track *add_new_track(int data_type);
else
result = 1;
if( !result ) {
- int width = asset->width;
- int height = asset->height;
asset->actual_width = asset->width;
- if( width ) asset->width = width;
asset->actual_height = asset->height;
- if( height ) asset->height = height;
+ int scale = asset->proxy_scale;
+ if( !scale ) scale = 1;
+ asset->width = asset->actual_width * scale;
+ asset->height = asset->actual_height * scale;
asset->layers = 1;
if( !asset->frame_rate )
asset->frame_rate = 10;
FileSystem fs;
asset->index_state->index_bytes = fs.get_size(asset->path);
source_length = source->get_audio_length();
+ int proxy_scale = asset->proxy_scale;
+ if( proxy_scale > 0 ) {
+ asset->width = asset->actual_width * proxy_scale;
+ asset->height = asset->actual_height * proxy_scale;
+ }
}
}
else
Asset *format_asset = new Asset;
format_asset->format = FILE_FFMPEG;
format_asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
- ProxyRender proxy_render(this, format_asset);
int new_scale = edl->session->proxy_scale;
- int use_scaler = edl->session->proxy_use_scaler;
+ ProxyRender proxy_render(this, format_asset, new_scale);
for( int i=0; i<new_idxbls.size(); ++i ) {
Indexable *orig = new_idxbls.get(i);
// render needed proxies
int result = proxy_render.create_needed_proxies(new_scale);
if( !result ) {
- add_proxy(use_scaler,
- &proxy_render.orig_idxbls, &proxy_render.orig_proxies);
+ add_proxy(&proxy_render.orig_idxbls, &proxy_render.orig_proxies);
}
format_asset->remove_user();
return !result ? proxy_render.needed_proxies.size() : -1;
edl->Garbage::add_user();
save_backup();
undo_before(_("proxy"), this);
- ProxyRender proxy_render(this, asset);
+ int asset_scale = new_scale == 1 ? 0 :
+ !new_use_scaler ? 1 : new_scale;
+ ProxyRender proxy_render(this, asset, asset_scale);
// revert project to original size from current size
// remove all session proxy assets at the at the current proxy_scale
int modify_pluginhandles();
void finish_modify_handles();
void rescale_proxy(EDL *clip, int orig_scale, int new_scale);
- void add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets,
- ArrayList<Indexable*> *proxy_assets);
+ void add_proxy(ArrayList<Indexable*> *orig_assets,
+ ArrayList<Indexable*> *proxy_assets);
int render_proxy(ArrayList<Indexable *> &new_idxbls);
void beep(double freq, double secs, double gain);
int enable_proxy();
edl->rescale_proxy(orig_scale, new_scale);
}
-void MWindow::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+void MWindow::add_proxy(ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
{
- edl->add_proxy(use_scaler, orig_assets, proxy_assets);
+ edl->add_proxy(orig_assets, proxy_assets);
}
void MWindow::cut_commercials()
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);
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;
void ProxyFormatTools::update_format()
{
+ asset->save_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0);
FormatTools::update_format();
pwindow->use_scaler->update();
}
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();
}
class ProxyRender
{
public:
- ProxyRender(MWindow *mwindow, Asset *format_asset);
+ ProxyRender(MWindow *mwindow, Asset *format_asset, int asset_scale);
~ProxyRender();
void to_proxy_path(char *new_path, Indexable *indexable, int scale);
static int from_proxy_path(char *new_path, Indexable *indexable, int scale);
Mutex *counter_lock;
int total_rendered;
int failed, canceled;
+ int asset_scale;
};
class ProxyDialog : public BC_DialogThread