h += 210;
if( indexable->is_asset ) {
Asset *asset = (Asset *)indexable;
- if( asset->format == FILE_MPEG ||
- asset->format == FILE_FFMPEG ) h += 42;
+ if( File::can_scale_input(asset) )
+ h += 42;
}
}
return h;
add_subwindow(win_height);
y += win_height->get_h() + 5;
- if( asset && (asset->format == FILE_MPEG || asset->format == FILE_FFMPEG ) ) {
+ if( asset && File::can_scale_input(asset) ) {
y += 5;
x = x1;
add_subwindow(new BC_Title(x, y, _("Actual width:")));
return 0;
}
-
-
-
-
-
-
-
+int File::can_scale_input(Asset *asset)
+{
+ switch( asset->format ) {
+ case FILE_MPEG:
+ case FILE_FFMPEG:
+ return 1;
+ case FILE_EXR:
+ case FILE_JPEG:
+ case FILE_PNG:
+ case FILE_PPM:
+ case FILE_TGA:
+ case FILE_TIFF:
+ if( asset->video_length < 0 )
+ return 1;
+ }
+ return 0;
+}
int File::set_processors(int cpus) // Set the number of cpus for certain codecs
// Get best colormodel for hardware accelerated recording.
// Called by VideoDevice.
static int get_best_colormodel(Asset *asset, int driver);
+// asset scaling on read_frame
+ static int can_scale_input(Asset *asset);
// Get nearest colormodel that can be decoded without a temporary frame.
// Used by read_frame.
int colormodel_supported(int colormodel);
//printf("FileList::open_file 2\n", asset->use_header);
//printf("FileList::open_file %d\n", __LINE__);
asset->format = frame_type;
+ int width = asset->width;
+ int height = asset->height;
result = read_frame_header(asset->path);
+ asset->actual_width = asset->width;
+ if( width ) asset->width = width;
+ asset->actual_height = asset->height;
+ if( height ) asset->height = height;
asset->layers = 1;
- if(!asset->frame_rate)
+ if( !asset->frame_rate )
asset->frame_rate = 1;
asset->video_length = -1;
}
data->allocate_compressed_data(ostat.st_size);
data->set_compressed_size(ostat.st_size);
(void)fread(data->get_data(), ostat.st_size, 1, fd);
- temp = new VFrame(asset->width, asset->height,
+ temp = new VFrame(asset->actual_width, asset->actual_height,
frame->get_color_model(), 0);
read_frame(temp, data);
break;
}
else
{
- temp = new VFrame(asset->width, asset->height, frame->get_color_model(), 0);
+ temp = new VFrame(asset->actual_width, asset->actual_height,
+ frame->get_color_model(), 0);
read_frame(temp, asset->path);
}
}
if( edl->session->frame_rate > 0 )
end += 1./edl->session->frame_rate;
}
- undo->update_undo_before();
+ undo->update_undo_before(_("silence"), this);
edl->paste_silence(start, end,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
int MWindow::speed_after(int done)
{
int result = 0;
- if( speed_edl && done >= 0 )
- result = normalize_speed(speed_edl, edl);
- if( done ) {
- speed_edl->remove_user();
- speed_edl = 0;
+ if( speed_edl ) {
+ if( done >= 0 )
+ result = normalize_speed(speed_edl, edl);
+ if( done != 0 ) {
+ speed_edl->remove_user();
+ speed_edl = 0;
+ }
}
return result;
}
if( !proxy ) {
proxy = new Asset(new_path);
// new compression parameters
- int64_t video_length = idxbl->get_video_frames();
- if( video_length < 0 ) {
+ if( idxbl->get_video_frames() < 0 ) {
proxy->format = FILE_PNG;
proxy->png_use_alpha = 1;
- proxy->video_length = 1;
+ proxy->video_length = -1;
}
else {
proxy->copy_format(format_asset, 0);
- proxy->video_length = video_length;
}
proxy->awindow_folder = AW_PROXY_FOLDER;
proxy->audio_data = 0;
int ProxyUseScaler::handle_event()
{
+ pwindow->dialog->new_scale = 1;
pwindow->dialog->use_scaler = get_value();
pwindow->scale_factor->update_sizes();
pwindow->update();
start_lock = new Condition(1, "RenderEngine::start_lock");
output_lock = new Condition(1, "RenderEngine::output_lock");
render_active = new Condition(1,"RenderEngine::render_active");
- interrupt_lock = new Mutex("RenderEngine::interrupt_lock");
+ interrupt_lock = new Condition(1, "RenderEngine::interrupt_lock");
first_frame_lock = new Condition(1, "RenderEngine::first_frame_lock");
}
render_active->lock("RenderEngine::run");
start_render_threads();
start_lock->unlock();
- interrupt_lock->reset();
+ interrupt_lock->unlock();
wait_render_threads();
// Lock out audio and synchronization timers until first frame is done
Condition *first_frame_lock;
// Lock out interrupts before and after renderengine is active
- Mutex *interrupt_lock;
+ Condition *interrupt_lock;
int done;
int is_nested;
const char *title;
};
+#if 0
+#include <stdio.h>
+
+class TCondition : public Condition
+{
+public:
+ TCondition(int init_value = 0, const char *title = 0, int is_binary = 0)
+ : Condition(init_value, title, is_binary) {
+ printf("new TCondition(%s) = %p\n", title, this);
+ }
+ ~TCondition() {
+ printf("del TCondition(%s) = %p\n", title, this);
+ }
+ void lock(const char *location = 0) {
+ printf("Locking %p: %s\n", this, title); Condition::lock(location);
+ printf("Locked %p: %s\n", this, title);
+ }
+ void unlock() {
+ printf("Unlocking %p: %s\n", this, title); Condition::unlock();
+ }
+ int timed_lock(int microseconds, const char *location = 0) {
+ printf("timed locking %p: %s\n", this, title);
+ int ret = Condition::timed_lock(microseconds, location);
+ printf("timed locked %p:%d %s\n", this, ret, title); return ret;
+ }
+ void reset() {
+ printf("Reset %p: %s\n", this, title);
+ Condition::reset();
+ }
+ int get_value() {
+ int ret = Condition::get_value();
+ printf("get_value %p:%d %s\n", this, ret, title);
+ return ret;
+ }
+};
+
+#endif
#endif
*/
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include "bcsignals.h"
UNSET_LOCK(this);
- if(pthread_mutex_unlock(&mutex)) perror("Mutex::unlock");
+ int ret = pthread_mutex_unlock(&mutex);
+ if( ret ) fprintf(stderr, "Mutex::unlock: %s\n",strerror(ret));
return 0;
}
const char *title;
};
+#if 0
+#include <stdio.h>
+
+class TMutex : public Mutex
+{ // logged
+public:
+ TMutex(const char *title = 0, int recursive = 0)
+ : Mutex(title, recursive) {
+ printf("new TMutex(%s) = %p\n", title, this);
+ }
+ ~TMutex() {
+ printf("del TMutex(%s) = %p\n", title, this);
+ }
+ int lock(const char *location = 0) {
+ printf("locking %p: %s\n", this, title); int ret = Mutex::lock(location);
+ printf("locked %p:%d %s\n", this, ret, title); return ret;
+ }
+ int unlock() {
+ printf("unlocking %p: %s\n", this, title); return Mutex::unlock();
+ }
+ int trylock(const char *location = 0) {
+ printf("try locking %p: %s\n", this, title); int ret = Mutex::trylock(location);
+ printf("try locked %p:%d %s\n", this, ret, title); return ret;
+ }
+ int reset() {
+ printf("reset %p: %s\n", this, title);
+ return Mutex::reset();
+ }
+ int is_locked() {
+ int ret = Mutex::is_locked();
+ printf("is_locked %p:%d %s\n", this, ret, title);
+ return ret;
+ }
+};
+
+#endif
#endif