当前位置: 首页>>代码示例>>C++>>正文


C++ FilterContext::raw方法代码示例

本文整理汇总了C++中FilterContext::raw方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterContext::raw方法的具体用法?C++ FilterContext::raw怎么用?C++ FilterContext::raw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilterContext的用法示例。


在下文中一共展示了FilterContext::raw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: link

void FilterContext::link(unsigned srcPad, FilterContext &dstFilter, unsigned dstPad, error_code &ec)
{
    clear_if(ec);
    if (!m_raw || !dstFilter) {
        throws_if(ec, Errors::Unallocated);
        return;
    }

    int sts = avfilter_link(m_raw, srcPad, dstFilter.raw(), dstPad);
    if (sts < 0) {
        throws_if(ec, sts, ffmpeg_category());
        return;
    }
}
开发者ID:Adenilson,项目名称:avcpp,代码行数:14,代码来源:filtercontext.cpp

示例2: parse

void FilterGraph::parse(const string &graphDescription,
                       FilterContext &srcFilterCtx,
                       FilterContext &sinkFilterCtx,
                       error_code &ec)
{
    clear_if(ec);

    if (!m_raw || !srcFilterCtx || !sinkFilterCtx) {
        throws_if(ec, Errors::Unallocated);
        return;
    }

    auto srcf  = srcFilterCtx.raw();
    auto sinkf = sinkFilterCtx.raw();
    bool srcfFound = false;
    bool sinkfFound = false;

    for (size_t i = 0; i < (size_t)filtersCount(); ++i) {
        if (m_raw->filters[i] == srcf)
            srcfFound = true;
        if (m_raw->filters[i] == sinkf)
            sinkfFound = true;
        if (srcfFound && sinkfFound) // search completed
            break;
    }

    if (!srcfFound) {
        fflog(AV_LOG_ERROR, "Source filter does not present in filter graph");
        throws_if(ec, Errors::FilterNotInFilterGraph);
        return;
    }

    if (!sinkfFound) {
        fflog(AV_LOG_ERROR, "Sink filter does not present in filter graph");
        throws_if(ec, Errors::FilterNotInFilterGraph);
        return;
    }

    struct FilterInOutDeleter
    {
        void operator()(AVFilterInOut *&ptr)
        {
            avfilter_inout_free(&ptr);
        }
    };
    using FilterInOutPtr = std::unique_ptr<AVFilterInOut, FilterInOutDeleter>;

    FilterInOutPtr inputs;
    FilterInOutPtr outputs;

    if (graphDescription.empty()) {
        fflog(AV_LOG_ERROR, "Empty graph description");
        throws_if(ec, Errors::FilterGraphDescriptionEmpty);
        return;
    } else {
        outputs.reset(avfilter_inout_alloc());
        inputs.reset(avfilter_inout_alloc());

        if (!outputs || !inputs) {
            throws_if(ec, errc::not_enough_memory);
            return;
        }

        outputs->name       = av_strdup("in");
        outputs->filter_ctx = srcFilterCtx.raw();
        outputs->pad_idx    = 0;
        outputs->next       = 0;

        inputs->name        = av_strdup("out");
        inputs->filter_ctx  = sinkFilterCtx.raw();
        inputs->pad_idx     = 0;
        inputs->next        = 0;

        int sts = avfilter_graph_parse(m_raw, graphDescription.c_str(), inputs.get(), outputs.get(), nullptr);
        if (sts < 0) {
            throws_if(ec, sts, ffmpeg_category());
            return;
        }
    }
}
开发者ID:brucechase,项目名称:avcpp,代码行数:80,代码来源:filtergraph.cpp


注:本文中的FilterContext::raw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。