return AV_HWDEVICE_TYPE_NONE;
}
-void FFStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
+int FFStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
{
+ return 0;
}
int FFStream::decode_activate()
eprintf(_("cant allocate codec context\n"));
ret = AVERROR(ENOMEM);
}
- if( ret >= 0 && hw_type != AV_HWDEVICE_TYPE_NONE )
- decode_hw_format(decoder, hw_type);
-
+ 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( !av_dict_get(copts, "threads", NULL, 0) )
return type;
}
-void FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
+int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
{
+ int ret = 0;
hw_pix_fmt = AV_PIX_FMT_NONE;
for( int i=0; ; ++i ) {
const AVCodecHWConfig *config = avcodec_get_hw_config(decoder, i);
if( hw_pix_fmt >= 0 ) {
hw_pixfmt = hw_pix_fmt;
avctx->get_format = get_hw_format;
- int ret = av_hwdevice_ctx_create(&hw_device_ctx, type, 0, 0, 0);
- if( ret >= 0 )
+ ret = av_hwdevice_ctx_create(&hw_device_ctx, type, 0, 0, 0);
+ if( ret >= 0 ) {
avctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+ ret = 1;
+ }
else
ff_err(ret, "Failed HW device create.\ndev:%s\n",
av_hwdevice_get_type_name(type));
}
+ return ret;
}
AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
-
Color3WayWindow::Color3WayWindow(Color3WayMain *plugin)
: PluginClientWindow(plugin,
plugin->w,
plugin->h,
- 500,
+ 680,
370,
1)
{
_("Midtones"),
_("Highlights")
};
+ int w1 = w - (CLEAR_BTN_WIDTH + margin * 2);
-
- gui->add_tool(title = new BC_Title(x + w / 2 -
+ gui->add_tool(title = new BC_Title(x + w1 / 2 -
gui->get_text_width(MEDIUMFONT, titles[section]) / 2,
y,
titles[section]));
&plugin->config.hue_y[section],
x,
y,
- w / 2,
+ w1 / 2,
section));
+ gui->add_tool(pointClr = new Color3WaySliderClrSection(plugin, gui,
+ x + w1 + margin, y, CLEAR_BTN_WIDTH, RESET_POINT, section));
y += point->get_h() + margin;
gui->add_tool(value_title = new BC_Title(x, y, _("Value:")));
&plugin->config.value[section],
x,
y,
- w,
+ w1,
section));
+ gui->add_tool(valueClr = new Color3WaySliderClrSection(plugin, gui,
+ x + w1 + margin, y, CLEAR_BTN_WIDTH, RESET_VALUE, section));
y += value->get_h() + margin;
gui->add_tool(sat_title = new BC_Title(x, y, _("Saturation:")));
&plugin->config.saturation[section],
x,
y,
- w,
+ w1,
section));
+ gui->add_tool(saturationClr = new Color3WaySliderClrSection(plugin, gui,
+ x + w1 + margin, y, CLEAR_BTN_WIDTH, RESET_SATURATION, section));
y += saturation->get_h() + margin;
gui->add_tool(reset = new Color3WayResetSection(plugin,
this->y = y;
this->w = w;
this->h = h;
+ int w1 = w - (CLEAR_BTN_WIDTH + margin * 2);
- title->reposition_window(x + w / 2 -
+ title->reposition_window(x + w1 / 2 -
title->get_w() / 2,
title->get_y());
- point->reposition_window(x, point->get_y(), w / 2);
+ point->reposition_window(x, point->get_y(), w1 / 2);
+ pointClr->reposition_window(x + w1 + margin, point->get_y());
y = point->get_y() + point->get_h() + margin;
+
value_title->reposition_window(x, y);
y += value_title->get_h() + margin;
- value->reposition_window(x, y, w, value->get_h());
- value->set_pointer_motion_range(w);
+ value->reposition_window(x, y, w1, value->get_h());
+ value->set_pointer_motion_range(w1);
+ valueClr->reposition_window(x + w1 + margin, y);
y += value->get_h() + margin;
sat_title->reposition_window(x, y);
y += sat_title->get_h() + margin;
- saturation->reposition_window(x, y, w, saturation->get_h());
- saturation->set_pointer_motion_range(w);
+ saturation->reposition_window(x, y, w1, saturation->get_h());
+ saturation->set_pointer_motion_range(w1);
+ saturationClr->reposition_window(x + w1 + margin, y);
y += saturation->get_h() + margin;
+
reset->reposition_window(x, y);
y += reset->get_h() + margin;
balance->reposition_window(x, y);
// set_color(BLACK);
// draw_arc(0, 0, radius * 2, radius * 2, 45, 180);
-//
+//
// set_color(MEGREY);
// draw_arc(0, 0, radius * 2, radius * 2, 45, -180);
+Color3WaySliderClrSection::Color3WaySliderClrSection(Color3WayMain *plugin,
+ Color3WayWindow *gui,
+ int x,
+ int y,
+ int w,
+ int clear,
+ int section)
+ : BC_GenericButton(x, y, w, _("⌂"))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+ this->clear = clear;
+ this->section = section;
+}
+Color3WaySliderClrSection::~Color3WaySliderClrSection()
+{
+}
+int Color3WaySliderClrSection::handle_event()
+{
+ switch(clear) {
+ case RESET_POINT :
+ plugin->config.hue_x[section] = 0;
+ plugin->config.hue_y[section] = 0;
+ break;
+ case RESET_VALUE : plugin->config.value[section] = 0;
+ break;
+ case RESET_SATURATION : plugin->config.saturation[section] = 0;
+ break;
+ }
+ if(plugin->copy_to_all[section]) plugin->config.copy_to_all(section);
+ plugin->send_configure_change();
+ gui->update();
+ return 1;
+}
+
+
+
+
+
Color3WayCopySection::Color3WayCopySection(Color3WayMain *plugin,
Color3WayWindow *gui,
int x,