mplayer中http流媒体协议分析(4)

2018-12-29 18:57

Connection: close

5.2 Seek过程:需要关闭socket重新建立连接。

1. 发送GET请求,需要包含Range域信息,如Range: bytes=(int64_t)pos \,表示数据从pos开始。 2. 得到响应信息并解析

http_seek( stream_t *stream, off_t pos ) { HTTP_header_t *http_hdr = NULL; int fd; if( stream==NULL ) return 0; if( stream->fd>0 ) closesocket(stream->fd); // need to reconnect to seek in http-stream fd = http_send_request( stream->streaming_ctrl->url, pos ); if( fd<0 ) return 0; http_hdr = http_read_response( fd ); if( http_hdr==NULL ) return 0; if( mp_msg_test(MSGT_NETWORK,MSGL_V) ) http_debug_hdr( http_hdr ); switch( http_hdr->status_code ) { case 200: case 206: // OK mp_msg(MSGT_NETWORK,MSGL_V,\[%s]\\n\http_get_field(http_hdr, \ mp_msg(MSGT_NETWORK,MSGL_V,\[%s]\\n\http_get_field(http_hdr, \ if( http_hdr->body_size>0 ) { if( streaming_bufferize( stream->streaming_ctrl, http_hdr->body, http_hdr->body_size )<0 ) { http_free( http_hdr ); return -1; } } break;

default: mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrServerReturned, http_hdr->status_code, http_hdr->reason_phrase ); closesocket( fd ); fd = -1; } stream->fd = fd; if( http_hdr ) { http_free( http_hdr ); stream->streaming_ctrl->data = NULL; } stream->pos=pos; return 1; }

HTTP seek交互过程: C ? S GET请求 GET

http://wbads-89.vo.llnwd.net/e1/wbol/us/whv/med/matrix/collection/ultimate_matrix_collection_sizzle_tlr_100.rm HTTP/1.0 Host: wbads-89.vo.llnwd.net

User-Agent: MPlayer/SVN-r31525-4.4.3 Icy-MetaData: 1

Range: bytes=3704832- Connection: close S -> C 响应过程

HTTP/1.0 206 Partial Content Server: Apache

Accept-Ranges: bytes

Cache-Control: max-age=300

Content-Type: application/vnd.rn-realmedia

Content-Range: bytes 3704832-6798222/6798223 Content-Length: 3093391 Age: 188

Date: Fri, 03 Sep 2010 07:21:54 GMT

Last-Modified: Sat, 02 Jul 2005 03:01:55 GMT Expires: Fri, 03 Sep 2010 07:23:46 GMT Connection: close


mplayer中http流媒体协议分析(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2018-2019年初中历史鲁教版《九年级上》《第七单元 垄断资本主义

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: