ffmpeg 1.0 filter模块AVFilterPad结构的权限属性min_perms/rej_perms分析


2014 10 19
ffmpeg 1.0 filter模块AVFilterPad结构的权限属性min_perms/rej_perms分析:
1.注释翻译
    输入pad:
    输入buffer最小权限要求.
    如果buffer权限不够,则filter系统自动将其copy到一个能提供相应权限的新buffer
    输出pad:
    将要输出的buffer的保护权限.
    任何想要在link上输出的buffer必须具备这些权限.
    这些使用assert来检查的。这可以优化buffer分配。
    /**
     * Input pads:
     * Minimum required permissions on incoming buffers. Any buffer with
     * insufficient permissions will be automatically copied by the filter
     * system to a new buffer which provides the needed access permissions.
     *
     * Output pads:
     * Guaranteed permissions on outgoing buffers. Any buffer pushed on the
     * link must have at least these permissions; this fact is checked by
     * asserts. It can be used to optimize buffer allocation.
     */
    int min_perms;


    输入pad:如果输入buffer有这些权限,则输入pad拒绝。如果buffer有这些拒绝权限,
    则filter系统自动将其copy到一个没有这些权限的新buffer。  
    输出pad:输出buffer自动删除这些拒绝权限。这可以用来优化buffer分配。  
     /**
     * Input pads:
     * Permissions which are not accepted on incoming buffers. Any buffer
     * which has any of these permissions set will be automatically copied
     * by the filter system to a new buffer which does not have those
     * permissions. This can be used to easily disallow buffers with
     * AV_PERM_REUSE.
     *
     * Output pads:
     * Permissions which are automatically removed on outgoing buffers. It
     * can be used to optimize buffer allocation.
     */
    int rej_perms;

2.实现
在video.c文件ff_start_frame函数里实现:

  min_perms[输出]://任何想要在link上输出的buffer必须具备这些权限
    av_assert1((picref->perms & src->min_perms) == src->min_perms);
  rej_perms[输出]://输出buffer自动删除这些拒绝权限
    picref->perms &= ~ src->rej_perms;

 

 

  min_perms[输入]/rej_perms[输入]:

    //min_perms:输入buffer最小权限要求.  如果buffer权限不够,则filter系统自动将其copy到一个能提供相应权限的新buffer

    //min_perms:如果输入buffer有这些权限,则输入pad拒绝。如果buffer有这些拒绝权限,则filter系统自动将其copy到一个没有这些权限的新buffer
    if ((dst->min_perms & perms) != dst->min_perms || dst->rej_perms & perms) {

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章