ffmpeg AVIOContext結(jié)構(gòu)體主要變量

AVIOContext是FFMPEG管理輸入輸出數(shù)據(jù)的結(jié)構(gòu)體。
參考結(jié)構(gòu)體理解:http://www.itdecent.cn/p/d109e7ef9749

unsigned char *buffer

:緩存開始位置
在解碼的情況下,buffer用于存儲(chǔ)ffmpeg讀入的數(shù)據(jù)。例如打開一個(gè)視頻文件的時(shí)候,先把數(shù)據(jù)從硬盤讀入buffer,然后在送給解碼器用于解碼。

int buffer_size

:緩存大?。J(rèn)32768)

unsigned char *buf_ptr

:當(dāng)前指針讀取到的位置

unsigned char *buf_end

:緩存結(jié)束的位置

void *opaque :URLContext結(jié)構(gòu)體
typedef struct URLContext {  
    const AVClass *av_class; ///< information for av_log(). Set by url_open().  
    struct URLProtocol *prot;  
    int flags;  
    int is_streamed;  /**< true if streamed (no seek possible), default = false */  
    int max_packet_size;  /**< if non zero, the stream is packetized with this max packet size */  
    void *priv_data;  
    char *filename; /**< specified URL */  
    int is_connected;  
    AVIOInterruptCB interrupt_callback;  
} URLContext;

URLContext結(jié)構(gòu)體中還有一個(gè)結(jié)構(gòu)體URLProtocol。注:每種協(xié)議(rtp,rtmp,file等)對(duì)應(yīng)一個(gè)URLProtocol。這個(gè)結(jié)構(gòu)體也不在FFMPEG提供的頭文件中。從FFMPEG源代碼中翻出其的定義:
typedef struct URLProtocol {  
    const char *name;  
    int (*url_open)(URLContext *h, const char *url, int flags);  
    int (*url_read)(URLContext *h, unsigned char *buf, int size);  
    int (*url_write)(URLContext *h, const unsigned char *buf, int size);  
    int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);  
    int (*url_close)(URLContext *h);  
    struct URLProtocol *next;  
    int (*url_read_pause)(URLContext *h, int pause);  
    int64_t (*url_read_seek)(URLContext *h, int stream_index,  
        int64_t timestamp, int flags);  
    int (*url_get_file_handle)(URLContext *h);  
    int priv_data_size;  
    const AVClass *priv_data_class;  
    int flags;  
    int (*url_check)(URLContext *h, int mask);  
} URLProtocol;

在這個(gè)結(jié)構(gòu)體中,除了一些回調(diào)函數(shù)接口之外,有一個(gè)變量const char *name,該變量存儲(chǔ)了協(xié)議的名稱。每一種輸入?yún)f(xié)議都對(duì)應(yīng)這樣一個(gè)結(jié)構(gòu)體。

URLProtocol ff_rtmp_protocol = {  
    .name                = "rtmp",  
    .url_open            = rtmp_open,  
    .url_read            = rtmp_read,  
    .url_write           = rtmp_write,  
    .url_close           = rtmp_close,  
    .url_read_pause      = rtmp_read_pause,  
    .url_read_seek       = rtmp_read_seek,  
    .url_get_file_handle = rtmp_get_file_handle,  
    .priv_data_size      = sizeof(RTMP),  
    .flags               = URL_PROTOCOL_FLAG_NETWORK,  
};  
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 本篇博客在雷神的結(jié)構(gòu)體介紹基礎(chǔ)上按自己的喜好整理的 后面根據(jù)自己工作中所需有所增改 AVStream 存儲(chǔ)每一個(gè)視...
    石丘閱讀 2,611評(píng)論 1 10
  • 教程一:視頻截圖(Tutorial 01: Making Screencaps) 首先我們需要了解視頻文件的一些基...
    90后的思維閱讀 4,980評(píng)論 0 3
  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,893評(píng)論 25 709
  • stream TARS 框架的編解碼工具 結(jié)構(gòu)體的使用示例我們演示結(jié)構(gòu)體在三個(gè)典型場(chǎng)景的使用方法:第一種場(chǎng)景:當(dāng)結(jié)...
    宮若石閱讀 1,738評(píng)論 0 1
  • *面試心聲:其實(shí)這些題本人都沒怎么背,但是在上海 兩周半 面了大約10家 收到差不多3個(gè)offer,總結(jié)起來就是把...
    Dove_iOS閱讀 27,603評(píng)論 30 472

友情鏈接更多精彩內(nèi)容