On Tue, Sep 29, 2020 at 12:14 PM Mark Thompson <s...@jkqxz.net> wrote:
> On 29/09/2020 18:14, Pavel Koshevoy wrote: > > On Tue, Sep 29, 2020 at 10:09 AM Mark Thompson <s...@jkqxz.net> wrote: > > > > <snip> > > >> - Mark > >> > >> > > It's pretty much this use case, except I'm not using ffmpeg cli but the > > avfilter api to configure the filter chain, and I'm working with > > AV_PIX_FMT_CUDA frames. > > Perhaps I am mis-using the api, but my patch was sufficient for my needs: > > > > ``` > > bool > > VideoFilterChain::setup_filter_links(int num_threads) > > { > > graph_ = avfilter_graph_alloc(); > > graph_->nb_threads = num_threads; > > int err = avfilter_graph_parse2(graph_, filters_.c_str(), &in_, > > &out_); > > UL_FAIL_IF_AVERROR(err); > > > > if (hw_frames_.ref_) > > { > > AVHWFramesContext * hw_frames_ctx = > > hw_frames_.get<AVHWFramesContext>(); > > AVBufferRef * device_ref = hw_frames_ctx->device_ref; > > > > for (int i = 0; i < graph_->nb_filters; i++) > > { > > AVFilterContext * filter_ctx = graph_->filters[i]; > > UL_ASSERT(!filter_ctx->hw_device_ctx); > > filter_ctx->hw_device_ctx = av_buffer_ref(device_ref); > > > > bool found_hwdownload = strcmp(filter_ctx->filter->name, > > "hwdownload") == 0; > > if (found_hwdownload) > > { > > break; > > } > > > > for (int j = 0; j < filter_ctx->nb_outputs; j++) > > { > > AVFilterLink * link = filter_ctx->outputs[j]; > > UL_ASSERT(!link->hw_frames_ctx); > > link->hw_frames_ctx = > av_buffer_ref(hw_frames_.ref_); > > > < > http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavfilter/avfilter.h;h=99297ae798aa325ac37836a3a90d9a3f8e1e7a95;hb=HEAD#l497 > > > > Don't write to internal fields. > > I'm not sure exactly what you're trying to do by writing the internal > context fields in this section, but I suspect that if you just remove it > entirely then the expected context propagation will happen and it will work. > > Okay, if I fix my API mis-use and context propagation happens automagically (idk where it would get the context in the 1st place, yet)... won't that still leave me with setparams that is not FF_FILTER_FLAG_HWFRAME_AWARE and avfilter_config_links would still fail? Thank you, Pavel. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".