美文网首页
FFmpeg结构体:URLProtocol

FFmpeg结构体:URLProtocol

作者: YellowLayne | 来源:发表于2017-03-15 14:17 被阅读0次

    1.描述

    URLProtocol是FFmepg操作文件的结构(包括文件,网络数据流等等),包括open、close、read、write、seek等操作,位于url.h文件中。
    URLProtocol为协议操作对象,针对每种协议,会有一个这样的对象,每个协议操作对象和一个协议对象关联,比如,文件操作对象为ff_file_protocol,它关联的结构体是FileContext。

    2.结构体定义

    
    typedef struct URLProtocol {
        const char *name;
        int     (*url_open)( URLContext *h, const char *url, int flags);
        /**
         * This callback is to be used by protocols which open further nested
         * protocols. options are then to be passed to ffurl_open()/ffurl_connect()
         * for those nested protocols.
         */
        int     (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
        int     (*url_accept)(URLContext *s, URLContext **c);
        int     (*url_handshake)(URLContext *c);
    
        /**
         * Read data from the protocol.
         * If data is immediately available (even less than size), EOF is
         * reached or an error occurs (including EINTR), return immediately.
         * Otherwise:
         * In non-blocking mode, return AVERROR(EAGAIN) immediately.
         * In blocking mode, wait for data/EOF/error with a short timeout (0.1s),
         * and return AVERROR(EAGAIN) on timeout.
         * Checking interrupt_callback, looping on EINTR and EAGAIN and until
         * enough data has been read is left to the calling function; see
         * retry_transfer_wrapper in avio.c.
         */
        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);
        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 (*url_get_multi_file_handle)(URLContext *h, int **handles,
                                         int *numhandles);
        int (*url_shutdown)(URLContext *h, int flags);
        int priv_data_size;
        const AVClass *priv_data_class;
        int flags;
        int (*url_check)(URLContext *h, int mask);
        int (*url_open_dir)(URLContext *h);
        int (*url_read_dir)(URLContext *h, AVIODirEntry **next);
        int (*url_close_dir)(URLContext *h);
        int (*url_delete)(URLContext *h);
        int (*url_move)(URLContext *h_src, URLContext *h_dst);
        const char *default_whitelist;
    } URLProtocol;
    
    

    相关文章

      网友评论

          本文标题:FFmpeg结构体:URLProtocol

          本文链接:https://www.haomeiwen.com/subject/nzrlnttx.html