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) {

 

 

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