cp -a $(OBJDIR)/bdwrite $(BINDIR)/.
tags:
- ctags -R -h default --langmap=c:+.inc . ../guicast/ ../libzmpeg3 ../plugins
+ ctags -R -h default --langmap=c:+.inc . ../guicast/ ../libzmpeg3 ../plugins ../thirdparty/ffmpeg-*
$(OBJDIR)/%.o: %.C
{
// try bc_xfer methods
int imodel = pix_fmt_to_color_model(ifmt);
+ // if not compatible with xfer
+ switch( imodel ) {
+ case BC_YUV420P:
+ case BC_YUV420PI:
+ case BC_YUV422P:
+ if( ip->linesize[0] != ip->linesize[1]*2 ||
+ ip->linesize[0] != ip->linesize[2]*2 )
+ imodel = -1;
+ break;
+ case BC_YUV410P:
+ case BC_YUV411P:
+ if( ip->linesize[0] != ip->linesize[1]*4 ||
+ ip->linesize[0] != ip->linesize[2]*4 )
+ imodel = -1;
+ break;
+ case BC_YUV444P:
+ if( ip->linesize[0] != ip->linesize[1] ||
+ ip->linesize[0] != ip->linesize[2] )
+ imodel = -1;
+ break;
+ }
if( imodel >= 0 ) {
long y_ofs = 0, u_ofs = 0, v_ofs = 0;
uint8_t *data = ip->data[0];
printf("FFMPEG::open_decoder: some stream times estimated\n");
ff_lock("FFMPEG::open_decoder");
- int bad_time = 0;
- for( int i=0; i<(int)fmt_ctx->nb_streams; ++i ) {
+ int ret = 0, bad_time = 0;
+ for( int i=0; !ret && i<(int)fmt_ctx->nb_streams; ++i ) {
AVStream *st = fmt_ctx->streams[i];
if( st->duration == AV_NOPTS_VALUE ) bad_time = 1;
AVCodecContext *avctx = st->codec;
vid->nudge = st->start_time;
vid->reading = -1;
if( opt_video_filter )
- vid->create_filter(opt_video_filter, avctx,avctx);
+ ret = vid->create_filter(opt_video_filter, avctx,avctx);
}
else if( avctx->codec_type == AVMEDIA_TYPE_AUDIO ) {
if( avctx->channels < 1 ) continue;
aud->nudge = st->start_time;
aud->reading = -1;
if( opt_audio_filter )
- aud->create_filter(opt_audio_filter, avctx,avctx);
+ ret = aud->create_filter(opt_audio_filter, avctx,avctx);
}
}
if( bad_time )
printf("FFMPEG::open_decoder: some stream have bad times\n");
ff_unlock();
- return 0;
+ return ret < 0 ? -1 : 0;
}
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
- AVFilter *filter = avfilter_get_by_name(filter_spec);
+ const char *sp = filter_spec;
+ char filter_name[BCSTRLEN], *np = filter_name;
+ int i = sizeof(filter_name);
+ while( --i>=0 && *sp!=0 && !strchr(" \t:=",*sp) ) *np++ = *sp++;
+ *np = 0;
+ AVFilter *filter = !filter_name[0] ? 0 : avfilter_get_by_name(filter_name);
if( !filter || avfilter_pad_get_type(filter->inputs,0) != AVMEDIA_TYPE_VIDEO ) {
ff_err(AVERROR(EINVAL), "FFVideoStream::create_filter: %s\n", filter_spec);
return -1;
ff_err(ret, "FFVideoStream::create_filter");
else
ret = FFStream::create_filter(filter_spec);
- return ret >= 0 ? 0 : 1;
+ return ret >= 0 ? 0 : -1;
}
int FFAudioStream::create_filter(const char *filter_spec,
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
- AVFilter *filter = avfilter_get_by_name(filter_spec);
+ const char *sp = filter_spec;
+ char filter_name[BCSTRLEN], *np = filter_name;
+ int i = sizeof(filter_name);
+ while( --i>=0 && *sp!=0 && !strchr(" \t:=",*sp) ) *np++ = *sp++;
+ *np = 0;
+ AVFilter *filter = !filter_name[0] ? 0 : avfilter_get_by_name(filter_name);
if( !filter || avfilter_pad_get_type(filter->inputs,0) != AVMEDIA_TYPE_AUDIO ) {
ff_err(AVERROR(EINVAL), "FFAudioStream::create_filter: %s\n", filter_spec);
return -1;
ff_err(ret, "FFAudioStream::create_filter");
else
ret = FFStream::create_filter(filter_spec);
- return ret >= 0 ? 0 : 1;
+ return ret >= 0 ? 0 : -1;
}
int FFStream::create_filter(const char *filter_spec)
if( ret >= 0 )
ret = avfilter_graph_config(filter_graph, NULL);
- if( ret < 0 )
+ if( ret < 0 ) {
ff_err(ret, "FFStream::create_filter");
+ avfilter_graph_free(&filter_graph);
+ filter_graph = 0;
+ }
avfilter_inout_free(&inputs);
avfilter_inout_free(&outputs);
return ret;
#include "pluginserver.h"
MotionCVWindow::MotionCVWindow(MotionCVMain *plugin)
- : PluginClientWindow(plugin, 815, 660, 815, 660, 0)
+ : PluginClientWindow(plugin, 815, 575, 815, 575, 0)
{
this->plugin = plugin;
}
this, x + title->get_w() + 10, y));
mode3->create_objects();
- y += 40;
+ add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
+ add_subwindow(tracking_file = new MotionCVTrackingFile(plugin,
+ plugin->config. tracking_file, this,
+ x2 + title->get_w() + 20, y));
+
+ y += 40; int y1 = y;
add_subwindow(title = new BC_Title(x, y + 10, _("Block X:")));
add_subwindow(block_x = new MotionCVBlockX(plugin, this,
x + title->get_w() + 10, y));
add_subwindow(block_y_text = new MotionCVBlockYText(plugin, this,
x + title->get_w() + 10 + block_y->get_w() + 10, y + 10));
- y += 50;
- add_subwindow(title = new BC_Title(x, y + 10, _("Maximum absolute offset:")));
+ add_subwindow(title = new BC_Title(x2, y1 + 10, _("Maximum absolute offset:")));
add_subwindow(magnitude = new MotionCVMagnitude(plugin,
- x + title->get_w() + 10, y));
+ x2 + title->get_w() + 10, y1));
- y += 40;
- add_subwindow(title = new BC_Title(x, y + 10, _("Settling speed:")));
+ y1 += 40;
+ add_subwindow(title = new BC_Title(x2, y1 + 10, _("Settling speed:")));
add_subwindow(return_speed = new MotionCVReturnSpeed(plugin,
- x + title->get_w() + 10, y));
+ x2 + title->get_w() + 10, y1));
- y += 40;
- add_subwindow(vectors = new MotionCVDrawVectors(plugin, this, x, y));
-
- add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
- add_subwindow(tracking_file = new MotionCVTrackingFile(plugin,
- plugin->config. tracking_file, this,
- x2 + title->get_w() + 20, y));
+ y1 += 40;
+ add_subwindow(vectors = new MotionCVDrawVectors(plugin, this, x2, y1));
+ y = y1 + vectors->get_h() + 10;
- y += 40;
- x1 = x; int y1 = y;
+ x1 = x; y1 = y;
add_subwindow(track_single =
new TrackSingleFrame(plugin, this, x1, y1));
+ y += 20;
+ add_subwindow(track_previous = new TrackPreviousFrame(plugin, this, x, y));
+ y += 20;
+ add_subwindow(previous_same = new PreviousFrameSameBlock(plugin, this, x, y));
+
+ y += 40;
+ add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
+ add_subwindow(master_layer = new MasterLayer(plugin, this,
+ x + title->get_w() + 10, y));
+ master_layer->create_objects();
add_subwindow(title =
- new BC_Title(x1=x2, y1, _("Frame number:")));
+ new BC_Title(x1=x2, y1=y, _("Frame number:")));
add_subwindow(track_frame_number =
new TrackFrameNumber(plugin, this, x1 += title->get_w(), y1));
add_subwindow(addtrackedframeoffset =
_("Currently using: Play every frame"), MEDIUMFONT,
!pef ? RED : GREEN));
- y += 20;
- add_subwindow(track_previous = new TrackPreviousFrame(plugin, this, x, y));
- y += 20;
- add_subwindow(previous_same = new PreviousFrameSameBlock(plugin, this, x, y));
-
- y += 40;
- //int y1 = y;
- add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
- add_subwindow(master_layer = new MasterLayer(plugin, this,
- x + title->get_w() + 10, y));
- master_layer->create_objects();
y += 30;
-
add_subwindow(title = new BC_Title(x, y, _("Action:")));
add_subwindow(mode1 = new Mode1(plugin, this,
x + title->get_w() + 10, y));
mode1->create_objects();
- y += 30;
+ y += 30;
add_subwindow(title = new BC_Title(x, y, _("Calculation:")));
add_subwindow(mode2 = new Mode2(plugin, this,
x + title->get_w() + 10, y));
y));
track_direction->create_objects();
+ add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
+ add_subwindow(tracking_file = new MotionTrackingFile(plugin,
+ plugin->config.tracking_file, this, x2+title->get_w() + 20, y));
+
y += 40;
add_subwindow(title = new BC_Title(x, y + 10, _("Block X:")));
add_subwindow(block_x =
add_subwindow(title = new BC_Title(x2, y + 10, _("Rotation settling speed:")));
add_subwindow(rotate_return_speed =
new MotionRReturnSpeed(plugin, x2 + title->get_w() + 10, y));
-
- y = y1;
y += 40;
+ add_subwindow(vectors = new MotionDrawVectors(plugin, this, x2, y));
+
+ y = y1 + 60;
add_subwindow(title = new BC_Title(x, y + 10, _("Block Y:")));
add_subwindow(block_y =
new MotionBlockY(plugin, this, x + title->get_w() + 10, y));
new MotionReturnSpeed(plugin, x + title->get_w() + 10, y));
y += 40;
- add_subwindow(vectors = new MotionDrawVectors(plugin, this, x, y));
-
- add_subwindow(title = new BC_Title(x2, y, _("Tracking file:")));
- add_subwindow(tracking_file = new MotionTrackingFile(plugin,
- plugin->config.tracking_file, this, x2+title->get_w() + 20, y));
+ add_subwindow(track_single =
+ new TrackSingleFrame(plugin, this, x, y));
+ y += 20;
+ add_subwindow(track_previous =
+ new TrackPreviousFrame(plugin, this, x, y));
+ y += 20;
+ add_subwindow(previous_same =
+ new PreviousFrameSameBlock(plugin, this, x, y));
y += 40;
x1 = x; y1 = y;
- add_subwindow(track_single =
- new TrackSingleFrame(plugin, this, x1, y1));
add_subwindow(title =
new BC_Title(x1=x2, y1, _("Frame number:")));
add_subwindow(track_frame_number =
_("Currently using: Play every frame"), MEDIUMFONT,
!pef ? RED : GREEN));
- y += 20;
- add_subwindow(track_previous =
- new TrackPreviousFrame(plugin, this, x, y));
-
- y += 20;
- add_subwindow(previous_same =
- new PreviousFrameSameBlock(plugin, this, x, y));
-
- y += 40;
- y1 = y;
add_subwindow(title = new BC_Title(x, y, _("Master layer:")));
add_subwindow(master_layer = new MasterLayer(plugin,
this, x + title->get_w() + 10, y));