首页 > 插件开发 > ATS??�a��-e��e?�?��?�??S�c��a?�cZ�a?Ye?�c�?

ATS??�a��-e��e?�?��?�??S�c��a?�cZ�a?Ye?�c�?

2013年11月26日     浏览数:277 发表评论 阅读评论

cZ�a??a�?a??e�?e�?a??e��e��e?�cs�?��?�?i??e�?a?�cZ�a??a?Ya???��e?�a?�a??e��cs�i??e??a??a?sa?�MP4/FLV?�?a??cs�a��

a��c�?URLa??c��cs�e�?a�sa?�a�?c�?a?�i?s
  • a�ze��e?�?��cs�url:
http://60.217.251.13/youku/677395829164A83FD52924414B/03000807005264E326092B055DF5316FC5CED4-3430-C4BD-95EC-A20F7AA746AB.mp4?nk=66995490785_23085119593&ns=X_2Y       //a�?a??a??OriginUrl1
http://60.217.251.13/youku/677395829164A83FD52924414B/03000807005264E326092B055DF5316FC5CED4-3430-C4BD-95EC-A20F7AA746AB.mp4?start=XXX       //a�?a??a??OriginUrl2
  • a�z???Urli?s
    http://60.217.251.13/youku/677395829164A83FD52924414B/03000807005264E326092B055DF5316FC5CED4-3430-C4BD-95EC-A20F7AA746AB.mp4   //a�?a??a??SourceUrl
  • ATSc?�a�?a?�cs�url:
    http://www.youku.com/03000807005264E326092B055DF5316FC5CED4-3430-C4BD-95EC-A20F7AA746AB.mp4       //a�?a??a??CacheUrl
a?�?��a??a��a?????e�?a?se?�a????�a��

a��?z?c�??Z?c�?ATSa�?c?�a?Se??cs�urli??a?Ya??a�?c?�a�?i??a??e?�?�?a?�a??a��i??a��a??a?�c?�a�?a?�a?Ze?�e�?a??e??urla�?a�?c�?a??(a?�?��ipi??keyi??a?�?��)?�?e??a�Ya�?a?�a��e?�a?�urla?�??�a?�a?�a??a?�e??a?�i??ipi??keyi??paramsi??a??a�?a��e?�a?�aZ�?Z�i??a?�c??a??CacheUrli??c�?????��e?�e?�a?�c��a??a?�cs�url?��a??a?�cs�a�??�?cs�a??a??cs�a��a�?a��

c��a?Z??�a??a?�e�?a?�ATS??�a?�c�?a?�??�a��cs�a??e??i??a?Y??�a?�a??c��a??aSYe??cs�??�a��a??a�?a��c?�e?�c�?e��e??i??cacheurl.soi??c��a?Za��?SScacheurl.soa?�e??a��e?�i??a?�cZ�a??a�?a�??�?e�?e�??��a��c?�a?�cacheurl.socs�a�?c�?a?�a?Za?�cZ�a?�a???Z?a??TSCacheUrlSeti??aSYe?????e��?Y?a?�c��urlc�Ya?�e�?c?�a??a?�?�?a�?a�scs�a?�a??keya??a?�cs�e��???a��
a?�e�?a?�e?�a?�a?�a?Zi????�a?�a?�a?�e�?a��cs�?????�i?????a?sa?�a????�a��???e�?a�?e?�a??e��e??i??a��?��???e?�?��a?�a???�?c??e?�c?�i?s

??�a��a?�cZ�???a?�a?�a??e?�?��OriginUrl1i??e?�c�???�a??c?�?��?�?cs�a??a�?c�??Z??�???�urla��c?�a??rangee?�?��i??
a????�a��a?�a��e?�?��?�?a��i??urlaZ�?Z�a?�?��i??c��a?Za?�a?Srange:

http://60.217.251.13/youku/677395829164A83FD52924414B/03000807005264E326092B055DF5316FC5CED4-3430-C4BD-95EC-A20F7AA746AB.mp4a�?range:X-X+Y-1(a��?��???e?�a??a��a??)a?�e??a?�a��a?�a?Zi??ATSe�?a��?�???�rangee?�?��cs�e�?e?�e��e?�aZ�a��c?�a��??�a��??�a?�e?�a??aSYe??a?�a?Zi??a??a�??�?a??a��c?�OriginUrl1cs�?��?�??�?a??a��

a?�???a??a??a��c?�cs�???OriginUrl2e?�?��i??a??e��e?�c�?e?�?��a??a�si??a??e?�a?Ya�?a??i??e�?a?�a��a��e��e?�c?�c��a?Y??�c��a???��e�??��?�?cs�?�?a??i?????e?�e�??�????cs�a��a��?z?e�??�????e?�c�?e?�?��?�?a??i??e?�e�?e�??z?e��e?�i???�???�?��?�??��e�????c��a�?a??a?�cs�a??c?�i??c��a?Za�???�c��a?Se??cs�a?s??�?�?a??rangee?�?��i??a??e?�e?�c�??��e�??��?�?cs�e?�?��i??a??a�za�?cs�?��a��e??e?�e�?a��e��e?�a�?a�?a?�e�?a�za�???�c�?i??a??c��?��?�?a??a�????a��

e?�a��?��a?Sa?�transform?�?a??i??a�Ye�?a?�example/append_transformi??a��e��e?�a�??�?a???��?�?e??a?�a�?e??a�?e?�a�zc��a�???�c�?a��

a?sa�?a?Se??e?�a?�a?�a?Zi??a�?c�?a�????a��e??a?�??�a��aSYe??a?�i??a?Z???a???��aS�a?�HITcs�??�a��i??cZ�a??a??c�????a?Se?�a�?c�??�?a??i??e?????c?�a�?MISScs�??�a��i??a��?z?HITcs�e??i??e?�e�?e�?a��?�?a??c?�a�?i??e?�a?�a�?a��a�ze?????c�?example/append_transforme�?a��a???Z?a??i??a??a??e?�?�?a??a�???�a?�c�?a��

aS�a?Se?�a??a?�a?Ze??a?sa?�a?�a?�a�?a??i??a��???a��?z?a?�a???��cs�?��?�?e?�?��i??a?�a?�a��???MISSi??e�se?�??�a��a?sa?�a?Srangei??e�?a???�?e??e??a??a?sc?�a�?a?�a?�HITi???��a�?a��aS�a?�a?�a?????a?�i??a��???a?�cZ�e?�c�?e?�?��i??a��a?�aS?cs�a?�ATSa?�aS?a?�e�?a?�a??a�??�?e?�?��i??c��a?Za?�e??e��e?�e�?c?�??�a?�a?�a?Z?��a?�a��

i??records.configcs�e�?c?�e??CONFIG proxy.config.http.background_fill_completed_threshold FLOATi??a�?CONFIG proxy.config.http.background_fill_active_timeout INTe?�a??e�?a??a??c�?i?�

e?�a?�a�???????a?�a??cs�a��c?�?�???�i???��?�?e?�?��c?�a�?cs�e?????c�?i???�?a??rangea??c?�a�?cs�e??i??a??e?�e�?a?�aS?a�?a?�e�?a?�a??a�??�?e?�?��i???�Ye��e?�?��??�a?�?�?e??a��
??�a��a��a?�?�?c?�i?s

  • ?��aS�hook

TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(ReadRequesthdrHookHandle, NULL));
TSHttpHookAdd(TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, TSContCreate(CacheLookupCompleteHookHandle, NULL));

  • TS_HTTP_READ_REQUEST_HDR_HOOK e��e??a��c?�e?�?��URLi??a?�e�?c?�CacheUrl
    TSHttpTxnClientReqGet(txnp, &req_bufp, &req_loc)a?�a�?urli??c��a?Ze�?c�?luae�s??�i????�a��a?�a��a?�e�?c�?luaa??a�?a?�c��ts-luaa?�cs�a??c�??�?a??i?�i??e?�a�z?��?�??�?a??i???��?�?starti???��?�?endi??CacheUrli??SourceUrli??a��e??Url(a��aZY??�urla?�?�?a??a��e??Url)
    TSCacheUrlSet(txnp, CacheUrl, CacheUrl.length()) //TSCacheUrlSeti??a?�c��cacheurl.soa?�cs�a?s??�
  • TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK a??CacheLookUpHook?��a?�?��???MISSe?????HITi??MISSa��a??a�sa��c�?a?�i??HIT?�?a???�?a�???�c�?
    a�Za��e??Urla?�eZ�a?�?��?�?a?�?��a�??�?a??i??c��a?Za??a��a?�transforme�?a?�cs�e�?a�sa?�cs�c��?z�a?�i??c?????a�?example/append_transformi?�a��e?�a?�?��??�e��a�?c��c��?z�a?�a?�cs�a??e�?

    TransformUserData pUserData = TransformUserDataAlloc();
    connp = TSTransformCreate(CacheTransformHookHandle, txnp);
    TSContDataSet(connp, (void
    )pUserData);
    TSHttpTxnUntransformedRespCache(txnp, 1);//e?�a?�a??a�?a?�e??a?�a?????a�Se?�TSa??c?�a�?transforma?�a�?cs�?��??�i??a??c?�a�?transforma?�a?Zcs�?��??�i???S?c??a?�??�a?�a��i??a???��?�Ye�?e?�a?�a��a��a�?e�?a�?i?�
    TSHttpTxnTransformedRespCache(txnp, 0);
    TSHttpTxnHookAdd(txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);

  • transforme?�c?�

    pUserData = (TransformUserData*)TSContDataGet(contp); //a?�a�?e�????a?�cs�?��??�

    a??a��a?�TransformUserDataa?�cs�buffer,reader,vioc��

    c��a?Za�Zc?�a�?a?�e?�a?�?��??�i??e�??z?e��e?�a�?a?????

    c��a?Zconsumea??e?�e�?cs�?��??�i??a?�e�?e?�e�?cs�?��??�

    a��?z????MISScs�e??i??cZ�a??cs�a?s??�???a�z???a?�e??????��a��i??e�?c�?e�??z?e��e?�cs�?Z?a??i??e�??z?a�???�a�?e��a?�e??(a??e?�e�?a?�e??a?�a??e��e?�a�?a?????i??a??a�?)a��e�se?�e��e?�e�??z??Z?a??a?�a?�e��e?�?��?�?cs�a??c?�a�??�???�e��a��a??c?�?�?a��a?�a?Zcs�e��e?�a�?a?????a��a??ATSe?�a�za�???�c�?a?�a�?a��?�?a��a?�a?Zcs�e��e?�a�?a?????e�se?�transform?��aS�e?�aZ�a??a??a��

a��a�?c�?cs�?��a��?�Ye��?�?a�?c�?e��i??a??e?�cZ�a??e??c?�e??c?�a???�Ye��a�?c�????a�?a??e??a?�i??a��a�zcZ�a??c?�???i??a?scs�e?�c?�a?�a?????a��example/append_transforme?�a??a?�a�?a?�cs�?��??�?�?a??a?????a?�e��e?�?�?a??i??a�?aS�a?Se�?a?�a??APIi??a��e�?a��a?�?��c��??Yi??

??�a?Z?�Ye�?e�?a�?i??e?�a?�a��a��cs�??�c�?i??e????�c??e??a??a��cs�?��c��i??a�?a?Sc?�e�?cs�a?�e�?e��e��a��

a�?c�?a��a??a?Sa?�a?�i??e?�a??e???Z?e��ATS?��e�?a�?cY�i??e�?a?�e?�a?????c�?a?�ATS??�a��cs�a?�a??a�?e??c��i??a?sa?se�??��e�se?�i??a�?e��a��a??e�?a?�a??a�????e?�c��a��?�?a�?e??a??a�?a?Ya�?a??a??cZ�c??i??and so ona��

a??e?�??�a�?e�?cs�i??a��a��c�?a?�a?�?�?i??a��a��a��

分类: 插件开发 标签:
  1. 水中捞月
    2015年7月13日11:27 | #1

    我的做法是先参考background_getch先缓存视频片段,然后在用transform返回range,这样对于优酷测试过是可以的

  1. 本文目前尚无任何 trackbacks 和 pingbacks.