}
if( ret >= 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
ret = decode_hw_format(decoder, hw_type);
- if( !ret ) hw_type = AV_HWDEVICE_TYPE_NONE;
}
if( ret >= 0 ) {
avcodec_parameters_to_context(avctx, st->codecpar);
}
if( ret >= 0 )
ret = decode(frame);
- if( ret < 0 || hw_pix_fmt == AV_PIX_FMT_NONE ) {
- ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n",
- ffmpeg->fmt_ctx->url);
- avcodec_close(avctx);
- avcodec_free_context(&avctx);
- av_buffer_unref(&hw_device_ctx);
- hw_device_ctx = 0;
- av_frame_free(&frame);
- hw_type = AV_HWDEVICE_TYPE_NONE;
- int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
- int idx = st->index;
- av_seek_frame(fmt_ctx, idx, INT64_MIN, flags);
- need_packet = 1; flushed = 0;
- seeked = 1; st_eof(0);
- ret = 0;
- continue;
- }
- probe_frame = frame;
}
- if( ret >= 0 ) {
- reading = 1;
+ if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) {
+ ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n",
+ ffmpeg->fmt_ctx->url);
+ avcodec_close(avctx);
+ avcodec_free_context(&avctx);
+ av_buffer_unref(&hw_device_ctx);
+ hw_device_ctx = 0;
+ av_frame_free(&frame);
+ hw_type = AV_HWDEVICE_TYPE_NONE;
+ int flags = AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY;
+ int idx = st->index;
+ av_seek_frame(fmt_ctx, idx, INT64_MIN, flags);
+ need_packet = 1; flushed = 0;
+ seeked = 1; st_eof(0);
+ ret = 0;
+ continue;
}
+ probe_frame = frame;
+ if( ret >= 0 )
+ reading = 1;
else
eprintf(_("open decoder failed\n"));
}
avctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
ret = 1;
}
- else
+ else {
ff_err(ret, "Failed HW device create.\ndev:%s\n",
av_hwdevice_get_type_name(type));
+ ret = -1;
+ }
}
return ret;
}
vect_slider = 0;
grad_image = 0;
grad_pixmap = 0;
- vector_gradical = 0;
grad_idx = 0;
vect_grads = 0;
use_vector = 1;
use_hist_parade = 0;
use_wave_parade = 0;
+ use_graticule = 0;
waveform = 0;
vectorscope = 0;
histogram = 0;
if( use_wave && use_wave_parade )
use_wave = 0;
if( !engine ) engine = new ScopeEngine(this, cpus);
+ grad_idx = use_graticule; // last graticule
+ use_graticule = 0;
lock_window("ScopeGUI::create_objects");
- int x = theme->widget_border;
- int y = theme->widget_border;
+ int margin = theme->widget_border;
+ int x = margin;
+ int y = margin;
add_subwindow(smooth = new ScopeSmooth(this, x, y));
- y += smooth->get_h() + theme->widget_border;
+ y += smooth->get_h() + margin;
add_subwindow(scope_menu = new ScopeMenu(this, x, y));
scope_menu->create_objects();
- x += scope_menu->get_w() + theme->widget_border;
+ x += scope_menu->get_w() + margin;
add_subwindow(value_text = new BC_Title(x, y, ""));
- y += scope_menu->get_h() + theme->widget_border;
+ y += scope_menu->get_h() + margin;
create_panels();
update_toggles();
{
calculate_sizes(get_w(), get_h());
int slider_w = xS(100);
+ int margin = theme->widget_border;
if( (use_wave || use_wave_parade) ) {
int px = wave_x + wave_w - slider_w - xS(5);
int py = wave_y - ScopeGain::calculate_h() - yS(5);
vect_slider = new ScopeVectSlider(this, vx, vy, slider_w);
vect_slider->create_objects();
if( use_vector < 0 ) {
- add_subwindow(vect_grads = new ScopeVectGrads(this, vector_x, vy));
+ vect_grads = new ScopeVectGrads(this, vector_x, 2*margin);
+ add_subwindow(vect_grads);
vect_grads->create_objects();
}
}
delete vect_grads; vect_grads = 0;
}
else if( !vect_grads ) {
- add_subwindow(vect_grads = new ScopeVectGrads(this, vector_x, vy));
+ vect_grads = new ScopeVectGrads(this, vector_x, 2*margin);
+ add_subwindow(vect_grads);
vect_grads->create_objects();
}
else
- vect_grads->reposition_window(vector_x, vy);
+ vect_grads->reposition_window(vector_x, 2*margin);
}
}
else if( !use_vector && vectorscope ) {
if( vector_w > vector_h ) {
vector_w = vector_h;
- vector_x = w - theme->widget_border - vector_w;
+ vector_x = w - margin - vector_w;
}
--total_panels;
if(total_panels > 0)
int vy = vector_y - vect_slider->get_h() - margin;
vect_slider->reposition_window(vx, vy);
if( vect_grads )
- vect_grads->reposition_window(vector_x, vy);
+ vect_grads->reposition_window(vector_x, 2*margin);
}
allocate_vframes();
void ScopeGUI::draw_overlays(int overlays, int borders, int flush)
{
+ int margin = theme->widget_border;
if( overlays && borders ) {
clear_box(0, 0, get_w(), get_h());
}
char string[BCTEXTLEN];
sprintf(string, "%d", (int)lround((FLOAT_MAX -
i * (FLOAT_MAX - FLOAT_MIN) / WAVEFORM_DIVISIONS) * 100));
- int text_x = wave_x - get_text_width(SMALLFONT, string) - theme->widget_border;
+ int text_x = wave_x - get_text_width(SMALLFONT, string) - margin;
set_color(text_color);
draw_text(text_x, text_y, string);
CLAMP(y, 0, waveform->get_h() - 1);
}
// Vectorscope overlay
if( vectorscope && use_vector ) {
- draw_gradical();
+ draw_graticule();
set_color(text_color);
vectorscope->draw_point();
vectorscope->flash(0);
if(flush) this->flush();
}
-void ScopeGUI::draw_gradical()
+void ScopeGUI::draw_graticule()
{
if( use_vector > 0 ) {
int margin = theme->widget_border;
vectorscope->draw_radient(th, 0.1f, .75f, dark_color);
}
else if( use_vector < 0 ) {
- if( grad_image && grad_idx != vector_gradical ) {
+ if( grad_image && grad_idx != use_graticule ) {
delete grad_image; grad_image = 0;
- vector_gradical = 0;
+ use_graticule = 0;
}
if( !grad_image && grad_idx > 0 ) {
grad_image = VFramePng::vframe_png(grad_paths[grad_idx]);
}
int rr = 2*radius;
- if( grad_pixmap && (!vector_gradical ||
+ if( grad_pixmap && (!use_graticule ||
rr != grad_pixmap->get_w() || rr != grad_pixmap->get_h()) ) {
delete grad_pixmap; grad_pixmap = 0;
- vector_gradical = 0;
+ use_graticule = 0;
}
if( !grad_pixmap && grad_image ) {
VFrame grad(rr, rr, BC_RGBA8888);
grad.transfer_from(grad_image);
grad_pixmap = new BC_Pixmap(this, &grad, PIXMAP_ALPHA);
- vector_gradical = grad_idx;
+ use_graticule = grad_idx;
}
if( grad_pixmap ) {
int px = vector_cx - radius, py = vector_cy - radius;
}
-void ScopeGUI::update_gradical(int idx)
+void ScopeGUI::update_graticule(int idx)
{
grad_idx = idx;
update_scope();
+ toggle_event();
}
void ScopeGUI::draw_colorwheel(VFrame *dst, int bg_color)
{
- float cx = vector_cx, cy = vector_cy, rad = radius;
+// downfactor radius to prevent extreme edge from showing behind graticule
+ float cx = vector_cx, cy = vector_cy, rad = radius * 0.99;
int color_model = dst->get_color_model();
int bpp = BC_CModels::calculate_pixelsize(color_model);
int bg_r = (bg_color>>16) & 0xff;
ScopeVectGrads::ScopeVectGrads(ScopeGUI *gui, int x, int y)
- : BC_PopupMenu(x, y, xS(40), "", 1, 0, 0)
+ : BC_PopupMenu(x, y, _("Overlay"))
{
this->gui = gui;
}
gui->grad_paths.remove_all_objects();
ScopeGradItem *item;
add_item(item = new ScopeGradItem(this, _("none"), 0));
- if( item->idx == gui->vector_gradical ) item->set_checked(1);
+ if( item->idx == gui->grad_idx ) item->set_checked(1);
gui->grad_paths.append(0);
FileSystem fs;
- fs.set_filter("[*.png][*.jpg]");
+ fs.set_filter("[*.png]");
char scope_path[BCTEXTLEN];
sprintf(scope_path, "%s%s", File::get_plugin_path(), SCOPE_SEARCHPATH);
fs.update(scope_path);
char *cp = strrchr(scope_path, '.');
if( cp ) *cp = 0;
add_item(item = new ScopeGradItem(this, scope_path, gui->grad_paths.size()));
- if( item->idx == gui->vector_gradical ) item->set_checked(1);
+ if( item->idx == gui->grad_idx ) item->set_checked(1);
gui->grad_paths.append(cstrdup(file_item->get_path()));
}
}
{
for( int i=0,n=vect_grads->total_items(); i<n; ++i ) {
ScopeGradItem *item = (ScopeGradItem *)vect_grads->get_item(i);
- item->set_checked(item == this);
+ item->set_checked(item->idx == idx);
}
- vect_grads->gui->update_gradical(idx);
+ vect_grads->gui->update_graticule(idx);
return 1;
}
int use_hist, use_wave, use_vector;
int use_hist_parade, use_wave_parade;
- int use_wave_gain, use_vect_gain, use_smooth;
+ int use_wave_gain, use_vect_gain;
+ int use_smooth, use_graticule;
int w, h;
VFrame *input;
use_wave_gain = plugin->use_wave_gain;
use_vect_gain = plugin->use_vect_gain;
use_smooth = plugin->use_smooth;
+ use_graticule = plugin->use_graticule;
ScopeGUI::create_objects();
}
plugin->use_wave_gain = use_wave_gain;
plugin->use_vect_gain = use_vect_gain;
plugin->use_smooth = use_smooth;
+ plugin->use_graticule = use_graticule;
// Make it reprocess
plugin->send_configure_change();
}
use_wave_gain = 5;
use_vect_gain = 5;
use_smooth = 1;
+ use_graticule = 0;
}
VideoScopeEffect::~VideoScopeEffect()
output.tag.set_property("USE_WAVE_GAIN", use_wave_gain);
output.tag.set_property("USE_VECT_GAIN", use_vect_gain);
output.tag.set_property("USE_SMOOTH", use_smooth);
+ output.tag.set_property("USE_GRATICULE", use_graticule);
}
output.append_tag();
use_wave_gain = input.tag.get_property("USE_WAVE_GAIN", use_wave_gain);
use_vect_gain = input.tag.get_property("USE_VECT_GAIN", use_vect_gain);
use_smooth = input.tag.get_property("USE_SMOOTH", use_smooth);
+ use_graticule = input.tag.get_property("USE_GRATICULE", use_graticule);
}
}
}