rtsp url播放的時(shí)候,會(huì)根據(jù)url中是否有rtsp來(lái)判斷是否調(diào)用ff_rtsp_demuxer進(jìn)行網(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,
};
碼流格式探測(cè)分析
>?ffplayd.exe!rtp_read(URLContext * h, unsigned char * buf, int size) 行 377?C
(調(diào)用recvfrom讀取RTP傳輸數(shù)據(jù),transfer_func指向了rtp_read的實(shí)現(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?
重點(diǎn)分析函數(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單元的視頻流,對(duì)于FU-A分包的數(shù)據(jù),仍然需要對(duì)多個(gè)AVPacket進(jìn)行重新組裝
>?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
(對(duì)FU-A分包的RTP格式數(shù)據(jù),會(huì)根據(jù)是否是第一個(gè)包添加起始碼,關(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
??[外部代碼]?
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)站欄目:FFmpegrtsp播放代碼剖析-創(chuàng)新互聯(lián)
分享鏈接:http://chinadenli.net/article6/decjig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、微信公眾號(hào)、動(dòng)態(tài)網(wǎng)站、面包屑導(dǎo)航、建站公司、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容