您好,登錄后才能下訂單哦!
rtsp url播放的時候,會根據(jù)url中是否有rtsp來判斷是否調(diào)用ff_rtsp_demuxer進行網(wǎng)絡(luò)數(shù)據(jù)的讀取
AVInputFormatff_rtsp_demuxer = {
??? .name?????????? = "rtsp",
??? .long_name????? = NULL_IF_CONFIG_SMALL("RTSP input"),
??? .priv_data_size = sizeof(RTSPState),
??? .read_probe???? = rtsp_probe,
??? .read_header??? = rtsp_read_header,
??? .read_packet??? = rtsp_read_packet,
??? .read_close???? = rtsp_read_close,
??? .read_seek????? = rtsp_read_seek,
??? .flags????????? = AVFMT_NOFILE,
??? .read_play????? = rtsp_read_play,
??? .read_pause???? = rtsp_read_pause,
??? .priv_class???? = &rtsp_demuxer_class,
};
碼流格式探測分析
>?ffplayd.exe!rtp_read(URLContext * h, unsigned char * buf, int size) 行 377?C
????(調(diào)用recvfrom讀取RTP傳輸數(shù)據(jù),transfer_func指向了rtp_read的實現(xiàn))
? ffplayd.exe!retry_transfer_wrapper(URLContext * h, unsigned char * buf, int size, int size_min, int (URLContext *, unsigned char *, int) * transfer_func) 行 376?C
??ffplayd.exe!ffurl_read(URLContext * h, unsigned char * buf, int size) 行 412?C
??ffplayd.exe!udp_read_packet(AVFormatContext * s, RTSPStream * * prtsp_st, unsigned char * buf, int buf_size, __int64 wait_end) 行 2033?C
??ffplayd.exe!read_packet(AVFormatContext * s, RTSPStream * * rtsp_st, RTSPStream * first_queue_st, __int64 wait_end) 行 2116?C
??ffplayd.exe!ff_rtsp_fetch_packet(AVFormatContext * s, AVPacket * pkt) 行 2202?C
??ffplayd.exe!rtsp_read_packet(AVFormatContext * s, AVPacket * pkt) 行 879?C
??ffplayd.exe!ff_read_packet(AVFormatContext * s, AVPacket * pkt) 行 856?C
??ffplayd.exe!read_frame_internal(AVFormatContext * s, AVPacket * pkt) 行 1582?C
??ffplayd.exe!avformat_find_stream_info(AVFormatContext * ic, AVDictionary * * options) 行 3772?C
??ffplayd.exe!read_thread(void * arg) 行 2805?C
??ffplayd.exe!SDL_RunThread(void * data) 行 283?C
??ffplayd.exe!RunThread(void * data) 行 91?C
??ffplayd.exe!RunThreadViaBeginThreadEx(void * data) 行 106?
重點分析函數(shù)ff_rtsp_fetch_packet,該函數(shù)調(diào)用read_packet獲取到RTP數(shù)據(jù),調(diào)用ff_rtp_parse_packet分析RTP數(shù)據(jù),去掉RTP包頭,添加起始碼,然后封裝成AVPacket,但是封裝的AVPacket并不是完整的NAL單元的視頻流,對于FU-A分包的數(shù)據(jù),仍然需要對多個AVPacket進行重新組裝
>?ffplayd.exe!h364_handle_packet_fu_a(AVFormatContext * ctx, PayloadContext * data, AVPacket * pkt, const unsigned char * buf, int len, int * nal_counters, int nal_mask) 行 291?C
(對FU-A分包的RTP格式數(shù)據(jù),會根據(jù)是否是第一個包添加起始碼,關(guān)鍵是start_bit??? = fu_header >> 7;)
??ffplayd.exe!h364_handle_packet(AVFormatContext * ctx, PayloadContext * data, AVStream * st, AVPacket * pkt, unsigned int * timestamp, const unsigned char * buf, int len, unsigned short seq, int flags) 行 359?C
??ffplayd.exe!rtp_parse_packet_internal(RTPDemuxContext * s, AVPacket * pkt, const unsigned char * buf, int len) 行 692?C
??ffplayd.exe!rtp_parse_one_packet(RTPDemuxContext * s, AVPacket * pkt, unsigned char * * bufptr, int len) 行 841?C
??ffplayd.exe!ff_rtp_parse_packet(RTPDemuxContext * s, AVPacket * pkt, unsigned char * * bufptr, int len) 行 875?C
??ffplayd.exe!ff_rtsp_fetch_packet(AVFormatContext * s, AVPacket * pkt) 行 2217?C
??ffplayd.exe!rtsp_read_packet(AVFormatContext * s, AVPacket * pkt) 行 879?C
??ffplayd.exe!ff_read_packet(AVFormatContext * s, AVPacket * pkt) 行 856?C
??ffplayd.exe!read_frame_internal(AVFormatContext * s, AVPacket * pkt) 行 1582?C
??ffplayd.exe!av_read_frame(AVFormatContext * s, AVPacket * pkt) 行 1776?C
??ffplayd.exe!read_thread(void * arg) 行 3008?C
??ffplayd.exe!SDL_RunThread(void * data) 行 283?C
??ffplayd.exe!RunThread(void * data) 行 91?C
??ffplayd.exe!RunThreadViaBeginThreadEx(void * data) 行 106?C
av_read_frame分包代碼剖析
??ffplayd.exe!ff_combine_frame(ParseContext * pc, int next, const unsigned char * * buf, int * buf_size) 行 265?C
>?ffplayd.exe!h364_parse(AVCodecParserContext * s, AVCodecContext * avctx, const unsigned char * * poutbuf, int * poutbuf_size, const unsigned char * buf, int buf_size) 行 595?C
??ffplayd.exe!av_parser_parse2(AVCodecParserContext * s, AVCodecContext * avctx, unsigned char * * poutbuf, int * poutbuf_size, const unsigned char * buf, int buf_size, __int64 pts, __int64 dts, __int64 pos) 行 166?C
??ffplayd.exe!parse_packet(AVFormatContext * s, AVPacket * pkt, int stream_index) 行 1461?C
??ffplayd.exe!read_frame_internal(AVFormatContext * s, AVPacket * pkt) 行 1675?C
??ffplayd.exe!av_read_frame(AVFormatContext * s, AVPacket * pkt) 行 1776?C
??ffplayd.exe!read_thread(void * arg) 行 3008?C
??ffplayd.exe!SDL_RunThread(void * data) 行 283?C
??ffplayd.exe!RunThread(void * data) 行 91?C
??ffplayd.exe!RunThreadViaBeginThreadEx(void * data) 行 106?C
??[外部代碼]?
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。