From b741a8ddd564e00f35e53a91cae2b407bf10769d Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 10 Oct 2018 22:40:31 +1100 Subject: [PATCH] started work on a bunch of small features --- io/media.h | 5 +++++ playback/cacher.cpp | 22 +++++++++++++++++----- ui/timelinewidget.cpp | 14 +++++++++++--- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/io/media.h b/io/media.h index 92b678aba..678a1da55 100644 --- a/io/media.h +++ b/io/media.h @@ -14,6 +14,10 @@ #define MEDIA_TYPE_SOLID 3 #define MEDIA_TYPE_TONE 4 +#define VIDEO_PROGRESSIVE 0 +#define VIDEO_TOP_FIELD_FIRST 1 +#define VIDEO_BOTTOM_FIELD_FIRST 2 + struct Sequence; struct Clip; @@ -23,6 +27,7 @@ struct MediaStream { int video_height; bool infinite_length; double video_frame_rate; + int video_interlacing; int audio_channels; int audio_layout; int audio_frequency; diff --git a/playback/cacher.cpp b/playback/cacher.cpp index dd1ede353..a1d2549ca 100644 --- a/playback/cacher.cpp +++ b/playback/cacher.cpp @@ -541,12 +541,24 @@ void open_clip_worker(Clip* clip) { avfilter_graph_create_filter(&clip->buffersrc_ctx, avfilter_get_by_name("buffer"), "in", filter_args, NULL, clip->filter_graph); avfilter_graph_create_filter(&clip->buffersink_ctx, avfilter_get_by_name("buffersink"), "out", NULL, NULL, clip->filter_graph); - enum AVPixelFormat pix_fmts[] = { static_cast(dest_format), AV_PIX_FMT_NONE }; - if (av_opt_set_int_list(clip->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN) < 0) { - qDebug() << "[ERROR] Could not set output pixel format"; - } + enum AVPixelFormat pix_fmts[] = { static_cast(dest_format), AV_PIX_FMT_NONE }; + if (av_opt_set_int_list(clip->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN) < 0) { + qDebug() << "[ERROR] Could not set output pixel format"; + } - avfilter_link(clip->buffersrc_ctx, 0, clip->buffersink_ctx, 0); + bool interlaced = false; + if (interlaced) { + // TODO make better + AVFilterContext* yadif_filter; + avfilter_graph_create_filter(&yadif_filter, avfilter_get_by_name("yadif"), "yadif", "mode=3", NULL, clip->filter_graph); + + clip->speed *= 2; + + avfilter_link(clip->buffersrc_ctx, 0, yadif_filter, 0); + avfilter_link(yadif_filter, 0, clip->buffersink_ctx, 0); + } else { + avfilter_link(clip->buffersrc_ctx, 0, clip->buffersink_ctx, 0); + } avfilter_graph_config(clip->filter_graph, NULL); } else if (clip->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 1bc04e1d5..f762f4cf6 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -341,10 +341,18 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) { g.old_track = g.track; } panel_timeline->importing = true; - }/* else if (config.enable_drag_files_to_timeline && event->mimeData()->hasUrls()) { - event->accept(); + } else if (config.enable_drag_files_to_timeline && event->mimeData()->hasUrls()) { + // TODO for this to work, we need a way to abort PreviewGenerator - }*/ + event->accept(); + qDebug() << "TODO get data for:"; + QList urls = event->mimeData()->urls(); + if (!urls.isEmpty()) { + for (int i=0;i