AVPacketList結構體和AVPacketQueue結構體

1 AVPacketList結構 程序員


typedef struct AVPacketList { 
    AVPacket pkt;             
    struct AVPacketList *next;
} AVPacketList;



這個結構體就是AVPacket結構的一個鏈表的節點,叫作AVPacket的隊列。


2 AVPacketQueue結構 學習

位於源碼的libavdevice/cklink_common.h中的結構體,這個不是給程序員用的(僅僅給開發這個開源項目的人員使用),因此只存在於源碼的頭文件中,並無在install的include目錄下。 spa


typedef struct AVPacketQueue {
    AVPacketList *first_pkt, *last_pkt;   
    int nb_packets;
    unsigned long long size;
    int abort_request;
    pthread_mutex_t mutex;
    pthread_cond_t cond;
    AVFormatContext *avctx;
} AVPacketQueue;
可是,在咱們學習ffmpge官網的那個SDL的tutorial的時候,在其中提到了PacketQueue結構,這個是應用程序員本身定義的,結構體以下,很顯然是參考了上面的這個AVPacketQueue。
typedef struct PacketQueue {
  AVPacketList *first_pkt, *last_pkt;  //有點像鏈表的表頭和表尾指針
  int nb_packets;
  int size;
  SDL_mutex *mutex;
  SDL_cond *cond; //兩把鎖用來實現這個全局結構體的訪問控制
} PacketQueue;
相關文章
相關標籤/搜索