return result;
}
-void CICache::dump()
+void CICache::dump(FILE *fp)
{
CICacheItem *current;
total_lock->lock("CICache::dump");
- printf("CICache::dump total size %jd\n", get_memory_usage(0));
+ fprintf(fp, "CICache::dump total size %jd\n", get_memory_usage(0));
for(current = first; current; current = NEXT)
{
- printf("cache item %p asset %p %s age=%d\n",
- current, current->asset,
- current->asset->path, current->age);
+ fprintf(fp, "cache item %p asset %p %s age=%d checked_out=%p\n",
+ current, current->asset, current->asset->path,
+ current->age, (void*)current->checked_out);
}
total_lock->unlock();
}
// deletes oldest assets until under the memory limit
int age();
-
- void dump();
-
-
+ void dump(FILE *fp);
private:
// for deleting items
}
if( !ret )
group = new_edl;
+ else
+ new_edl->remove_user();
return ret;
}
avctx->thread_count = ffmpeg->ff_cpus();
ret = avcodec_open2(avctx, decoder, &copts);
}
+ AVFrame *hw_frame = 0;
if( ret >= 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
- AVFrame *frame = av_frame_alloc();
- if( !frame ) {
+ if( !(hw_frame=av_frame_alloc()) ) {
fprintf(stderr, "FFStream::decode_activate: av_frame_alloc failed\n");
ret = AVERROR(ENOMEM);
}
if( ret >= 0 )
- ret = decode(frame);
+ ret = decode(hw_frame);
}
if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n",
avcodec_free_context(&avctx);
av_buffer_unref(&hw_device_ctx);
hw_device_ctx = 0;
- av_frame_free(&frame);
+ av_frame_free(&hw_frame);
hw_type = AV_HWDEVICE_TYPE_NONE;
int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
int idx = st->index;
ret = 0;
continue;
}
- probe_frame = frame;
+ probe_frame = hw_frame;
if( ret >= 0 )
reading = 1;
else
fprintf(fp, "\n");
}
+void MWindow::dump_caches(FILE *fp)
+{
+ fprintf(fp, "audio cache: ");
+ audio_cache->dump(fp);
+ fprintf(fp, "video cache: ");
+ video_cache->dump(fp);
+}
+
void MWindow::trap_hook(FILE *fp, void *vp)
{
MWindow *mwindow = (MWindow *)vp;
mwindow->dump_undo(fp);
fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp);
mwindow->dump_exe(fp);
+ fprintf(fp, "\nCACHES:\n");
+ mwindow->dump_caches(fp);
}
void dump_edl(FILE *fp=stdout);
void dump_undo(FILE *fp=stdout);
void dump_exe(FILE *fp=stdout);
+ void dump_caches(FILE *fp=stdout);
static void trap_hook(FILE *fp, void *vp);
void reset_android_remote();
PreferencesWindow *pwindow;
};
+class PrefsUseHWDevItems : public ArrayList<BC_ListBoxItem *>
+{
+public:
+ PrefsUseHWDevItems() {}
+ ~PrefsUseHWDevItems() { remove_all_objects(); }
+};
+
class PrefsUseHWDev : public BC_PopupTextBox
{
public:
int handle_event();
PreferencesWindow *pwindow;
- ArrayList<BC_ListBoxItem *> hw_dev_names;
+ PrefsUseHWDevItems hw_dev_names;
};
schedule.schedule_work = lv2_worker_schedule;
worker_iface = 0; worker_done = -1;
pthread_mutex_init(&worker_lock, 0);
+ pthread_mutex_init(&startup_lock, 0);
+ pthread_mutex_lock(&startup_lock);
pthread_cond_init(&worker_ready, 0);
work_avail = 0; work_input = 0;
work_output = 0; work_tail = &work_output;
void *PluginLV2::worker_func()
{
pthread_mutex_lock(&worker_lock);
+ pthread_mutex_unlock(&startup_lock);
for(;;) {
while( !worker_done && !work_input )
pthread_cond_wait(&worker_ready, &worker_lock);
void PluginLV2::worker_start()
{
pthread_create(&worker_thread, 0, worker_func, this);
+ pthread_mutex_lock(&startup_lock);
}
void PluginLV2::worker_stop()
LV2_Worker_Schedule schedule;
PluginLV2Work *work_avail, *work_input;
PluginLV2Work *work_output, **work_tail;
- pthread_mutex_t worker_lock;
+ pthread_mutex_t startup_lock, worker_lock;
pthread_cond_t worker_ready;
int worker_done;
};
{
if(BC_Resources::locale_utf8) return;
char lbuf[buflen];
- encode(encoding, 0, buffer, buflen, lbuf, buflen);
+ encode(encoding, 0, buffer, -1, lbuf, buflen);
strcpy(buffer, lbuf);
}