Mercurial > hg > nginx-site
changeset 22:9d3403f5204d
nginx-1.1.3, ngx_http_mp4_module
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 14 Sep 2011 15:05:04 +0000 |
parents | a6e1763d5590 |
children | b26e486dbd3c |
files | GNUmakefile dtd/module.dtd text/en/CHANGES text/ru/CHANGES.ru xml/en/GNUmakefile xml/en/docs/http/ngx_http_mp4_module.xml xml/en/docs/index.xml xml/en/download.xml xml/index.xml xml/ru/download.xml xml/versions.xml xsls/content.xsls xsls/directive.xsls xsls/link.xsls xsls/module.xsls xsls/style.xsls |
diffstat | 16 files changed, 452 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/GNUmakefile Mon Sep 05 13:17:07 2011 +0000 +++ b/GNUmakefile Wed Sep 14 15:05:04 2011 +0000 @@ -46,6 +46,13 @@ dtd/article.dtd \ dtd/content.dtd \ +MODULE_XSLT = xml/menu.xml \ + xml/versions.xml \ + xslt/module.xslt \ + xslt/directive.xslt \ + dtd/module.dtd \ + dtd/content.dtd \ + include xml/en/GNUmakefile include xml/ja/GNUmakefile include xml/he/GNUmakefile @@ -90,6 +97,11 @@ $(call XSLT, xslt/error.xslt, $<, $@) +$(OUT)/%_module.html: xml/%_module.xml \ + $(MODULE_XSLT) + $(call XSLT, xslt/module.xslt, $<, $@) + + $(OUT)/%.html: xml/%.xml \ $(ARTICLE_XSLT) $(call XSLT, xslt/article.xslt, $<, $@) @@ -113,6 +125,16 @@ xslt/content.xslt \ xslt/versions.xslt +xslt/module.xslt: xsls/module.xsls \ + xslt/dirname.xslt \ + xslt/link.xslt \ + xslt/style.xslt \ + xslt/body.xslt \ + xslt/menu.xslt \ + xslt/donate.xslt \ + xslt/content.xslt \ + xslt/versions.xslt + xslt/download.xslt: xsls/download.xsls \ xslt/dirname.xslt \ xslt/link.xslt \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dtd/module.dtd Wed Sep 14 15:05:04 2011 +0000 @@ -0,0 +1,7 @@ +<!ELEMENT digest (title, article+) > + +<!ELEMENT module (para+) > +<!ATTLIST module date CDATA #REQUIRED > + +<!ENTITY % content SYSTEM "content.dtd" > + %content;
--- a/text/en/CHANGES Mon Sep 05 13:17:07 2011 +0000 +++ b/text/en/CHANGES Wed Sep 14 15:05:04 2011 +0000 @@ -1,4 +1,16 @@ +Changes with nginx 1.1.3 14 Sep 2011 + + *) Feature: the module ngx_http_mp4_module. + + *) Bugfix: in Linux AIO combined with open_file_cache. + + *) Bugfix: open_file_cache did not update file info on retest if file + was not atomically changed. + + *) Bugfix: nginx could not be built on MacOSX 10.7. + + Changes with nginx 1.1.2 05 Sep 2011 *) Change: now if total size of all ranges is greater than source
--- a/text/ru/CHANGES.ru Mon Sep 05 13:17:07 2011 +0000 +++ b/text/ru/CHANGES.ru Wed Sep 14 15:05:04 2011 +0000 @@ -1,4 +1,16 @@ +Изменения в nginx 1.1.3 14.09.2011 + + *) Добавление: модуль ngx_http_mp4_module. + + *) Исправление: в Linux AIO, используемым совместно с open_file_cache. + + *) Исправление: open_file_cache не обновлял информацию о файле, если + файл был изменён не атомарно. + + *) Исправление: nginx не собирался на MacOSX 10.7. + + Изменения в nginx 1.1.2 05.09.2011 *) Изменение: теперь, если суммарный размер всех диапазонов больше
--- a/xml/en/GNUmakefile Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/en/GNUmakefile Wed Sep 14 15:05:04 2011 +0000 @@ -18,6 +18,11 @@ en/docs/http/converting_rewrite_rules \ en/docs/freebsd_tuning \ +REFS_EN_XML = $(foreach name, $(REFS_EN), xml/$(name).xml) +REFS_EN_HTML = $(foreach name, $(REFS_EN), $(OUT)/$(name).html) + +REFS_EN = en/docs/http/ngx_http_mp4_module \ + HOWTO_EN_XML = $(foreach name, $(HOWTO_EN), xml/$(name).xml) HOWTO_EN_HTML = $(foreach name, $(HOWTO_EN), $(OUT)/$(name).html) @@ -38,12 +43,14 @@ $(OUT)/en/docs/index.html \ $(DOCS_EN_HTML) \ $(INTRO_EN_HTML) \ + $(REFS_EN_HTML) \ $(HOWTO_EN_HTML) \ $(FAQ_EN_HTML) \ $(OUT)/en/docs/index.html: xml/en/docs/index.xml \ $(ARTICLE_XSLT) \ - $(DOCS_EN_XML) + $(DOCS_EN_XML) \ + $(REFS_EN_XML) $(call XSLT, xslt/article.xslt, $<, $@) $(OUT)/en/download.html: xml/en/download.xml \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_mp4_module.xml Wed Sep 14 15:05:04 2011 +0000 @@ -0,0 +1,160 @@ +<?xml version="1.0"?> + +<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> + +<module title="HTTP MP4 module" + link="/en/docs/http/ngx_http_mp4_module.html" + lang="en"> + +<section title="Summary"> + +<para> +The module <code>ngx_http_mp4_module</code> provides pseudo-streaming +server-side support for H.264/AAC files typically having filename extensions +<pathname>.mp4</pathname>, <pathname>.m4v</pathname>, +and <pathname>.m4a</pathname>. +</para> + +<para> +Pseudo-streaming works in alliance with conformant Flash players. +A player sends an HTTP request to the server with a start time +argument in the request URI’s query string (named simply +<parameter>start</parameter> +and specified in seconds), and the server responds with a stream +so that its start position corresponds to the requested time, +for example: +<example> +http://example.com/elephants_dream.mp4?start=238.88 +</example> +This allows for a random seeking at any time, or starting playback +in the middle of a timeline. +</para> + +<para> +To support seeking, H.264-based formats store the metadata +in the so-called “moov atom.” +It is a part of the file that holds the index information for the +whole file. +</para> + +<para> +To start playback, a player first needs to read metadata. +This is done by sending a special request with the +<parameter>start=0</parameter> +argument. Many encoding software will insert the metadata at +the end of the file. This is bad for pseudo-streaming: +the metadata needs to be located at the beginning of the file, +or else the entire file will have to be downloaded before it +starts playing. If a file is well-formed (with metadata at the +beginning of a file), nginx just sends back the contents of a file. +Otherwise, it has to read the file and prepare a new stream so that +metadata comes before media data. +This involves some CPU, memory, and disk I/O overhead, +so it is a good idea to +<a href="http://flowplayer.org/plugins/streaming/pseudostreaming.html#prepare"> +prepare an original file for pseudo-streaming</a>, +rather than having nginx do this on every such request. +</para> + +<para> +For a matching request with a non-zero +<parameter>start</parameter> +argument, nginx will read metadata from the file, prepare the +stream starting from the requested offset, and send it to a client. +This has the same overhead as described above. +</para> + +<para> +If a matching request does not include the +<parameter>start</parameter> +argument, there is no overhead, and the file is just sent as a static resource. +Some players also support byte-range requests, and thus do not require +this module at all. +</para> + +<para> +This module is not built by default, it should be enabled with the +<command>--with-http_mp4_module</command> +configuration parameter. +<note> +If you were using the third-party mp4 module, be sure to disable it. +</note> +</para> + +<!-- +<para> +A similar pseudo-streaming support for FLV files is provided by the module +<a href="/en/docs/http/ngx_http_flv_module.xml">ngx_http_flv_module</a>. +</para> +--> + +</section> + + +<section name="example" title="Usage example"> + +<para> +<example> +location /video/ { + mp4; + mp4_buffer_size 1m; + mp4_max_buffer_size 5m; +} +</example> +</para> + +</section> + + +<section name="directives" title="Directives"> + +<directive name="mp4"> +<syntax>mp4</syntax> +<default/> +<context>location</context> + +<para> +Turns on module processing in a surrounding location. +</para> + +</directive> + + +<directive name="mp4_buffer_size"> +<syntax>mp4_buffer_size <argument>size</argument></syntax> +<default>mp4_buffer_size 512K</default> +<context>http</context> +<context>server</context> +<context>location</context> + +<para> +Sets the initial size of a memory buffer used to process MP4 files. +</para> + +</directive> + + +<directive name="mp4_max_buffer_size"> +<syntax>mp4_max_buffer_size <argument>size</argument></syntax> +<default>mp4_max_buffer_size 10M</default> +<context>http</context> +<context>server</context> +<context>location</context> + +<para> +During metadata processing, a larger buffer may become necessary. +Its size cannot exceed the specified <argument>size</argument>, +or else nginx will return +<http-error code="500" text="Internal Server Error"/>, +and log the following: +<example> +"/some/movie/file.mp4" mp4 moov atom is too large: +12583268, you may want to increase mp4_max_buffer_size +</example> +</para> + +</directive> + +</section> + +</module>
--- a/xml/en/docs/index.xml Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/en/docs/index.xml Wed Sep 14 15:05:04 2011 +0000 @@ -37,4 +37,18 @@ </section> +<section title="Modules reference"> + +<para> +<list> + +<item> +<a href="/en/docs/http/ngx_http_mp4_module.xml" /> +</item> + +</list> +</para> + +</section> + </article>
--- a/xml/en/download.xml Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/en/download.xml Wed Sep 14 15:05:04 2011 +0000 @@ -9,6 +9,7 @@ <download last="5" changes="CHANGES"> +<item ver="1.1.3" pgp="yes" win="yes" /> <item ver="1.1.2" pgp="yes" win="yes" /> <item ver="1.1.1" pgp="yes" win="yes" /> <item ver="1.1.0" pgp="yes" win="yes" />
--- a/xml/index.xml Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/index.xml Wed Sep 14 15:05:04 2011 +0000 @@ -2,6 +2,14 @@ <news title="nginx news" link="/" lang="en"> +<event date="2011-09-14"> +<para> +<a href="/en/download.xml">nginx-1.1.3</a> +development version has been released.<br/> +New <a href="/en/docs/http/ngx_http_mp4_module.xml"/>. +</para> +</event> + <event date="2011-09-05"> <para> <a href="/en/download.xml">nginx-1.1.2</a>
--- a/xml/ru/download.xml Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/ru/download.xml Wed Sep 14 15:05:04 2011 +0000 @@ -8,6 +8,7 @@ <download last="5" changes="CHANGES.ru"> +<item ver="1.1.3" pgp="yes" win="yes" /> <item ver="1.1.2" pgp="yes" win="yes" /> <item ver="1.1.1" pgp="yes" win="yes" /> <item ver="1.1.0" pgp="yes" win="yes" />
--- a/xml/versions.xml Mon Sep 05 13:17:07 2011 +0000 +++ b/xml/versions.xml Wed Sep 14 15:05:04 2011 +0000 @@ -1,5 +1,5 @@ <versions> -<development> 1.1.2 </development> +<development> 1.1.3 </development> <stable> 1.0.6 </stable> <legacy_stable> 0.8.55 </legacy_stable> </versions>
--- a/xsls/content.xsls Mon Sep 05 13:17:07 2011 +0000 +++ b/xsls/content.xsls Wed Sep 14 15:05:04 2011 +0000 @@ -1,93 +1,108 @@ X:stylesheet { -X:template = "section[@name and @title]" { - <a name="{@name}" /> <center><h4> !{@title} </h4></center> - !!; -} + X:template = "section[@name and @title]" { + <a name="{@name}" /> <center><h4> !{@title} </h4></center> + !!; + } -X:template = "section[not(@name) and @title]" { - <center><h4> !{@title} </h4></center> - !!; -} + X:template = "section[not(@name) and @title]" { + <center><h4> !{@title} </h4></center> + !!; + } -X:template = "section[not(@name) and not(@title)]" { !!; } + X:template = "section[not(@name) and not(@title)]" { !!; } -X:template = "para" { <p> !!; </p> } + X:template = "para" { <p> !!; </p> } -X:template = "item/para" { <p class="noindent"> !!; </p> } + X:template = "item/para" { <p class="noindent"> !!; </p> } -X:template = "para[@align]" { <p align="{@align}"> !!; </p> } + X:template = "para[@align]" { <p align="{@align}"> !!; </p> } -X:template = "para[child::initial]" { <p class="noindent"> !!; </p> } + X:template = "para[child::initial]" { <p class="noindent"> !!; </p> } -X:template = "initial" { <span class="initial"><b> !!; </b></span> } + X:template = "initial" { <span class="initial"><b> !!; </b></span> } -X:template = "programlisting" { <blockquote><pre> !!; </pre></blockquote> } + X:template = "programlisting" { <blockquote><pre> !!; </pre></blockquote> } -X:template = "para/programlisting" { - X:text disable-output-escaping="yes" {</p> } - <blockquote><pre> !!; </pre></blockquote> - X:text disable-output-escaping="yes" {<p class="noindent"> } -} + X:template = "para/programlisting" { + X:text disable-output-escaping="yes" {</p> } + <blockquote><pre> !!; </pre></blockquote> + X:text disable-output-escaping="yes" {<p class="noindent"> } + } -X:template = "note" { <blockquote class="note"> !!; </blockquote> } + X:template = "note" { <blockquote class="note"> !!; </blockquote> } -X:template = "para/note" { - X:text disable-output-escaping="yes" {</p> } - <blockquote class="note"> !!; </blockquote> - X:text disable-output-escaping="yes" {<p class="noindent"> } -} + X:template = "para/note" { + X:text disable-output-escaping="yes" {</p> } + <blockquote class="note"> !!; </blockquote> + X:text disable-output-escaping="yes" {<p class="noindent"> } + } + + + X:template = "list" { <ul> !!; </ul> } + X:template = "item" { <li> !!; </li> } -X:template = "list" { <ul> !!; </ul> } -X:template = "item" { <li> !!; </li> } - - -X:template = "orderedlist" { <ol> !!; </ol> } -X:template = "item" { <li> !!; </li> } + X:template = "orderedlist" { <ol> !!; </ol> } + X:template = "item" { <li> !!; </li> } -X:template = "table[@note and @width]" { - <blockquote><table width="{@width}"> !!; </table></blockquote> -} -X:template = "table[@note and not(@width)]" { - <blockquote><table width="100%"> !!; </table></blockquote> -} -X:template = "table[not(@note) and @width]" { - <table width="{@width}"> !!; </table> -} -X:template = "table" { <table width="100%"> !!; </table> } -X:template = "tr" { <tr> !!; </tr> } -X:template = "td[@width]" { <td width="{@width}"> !!; </td> } -X:template = "td" { <td> !!; </td> } + X:template = "table[@note and @width]" { + <blockquote><table width="{@width}"> !!; </table></blockquote> + } + X:template = "table[@note and not(@width)]" { + <blockquote><table width="100%"> !!; </table></blockquote> + } + X:template = "table[not(@note) and @width]" { + <table width="{@width}"> !!; </table> + } + X:template = "table" { <table width="100%"> !!; </table> } + X:template = "tr" { <tr> !!; </tr> } + X:template = "td[@width]" { <td width="{@width}"> !!; </td> } + X:template = "td" { <td> !!; </td> } + + X:template = "command" { <code> !!; </code> } + + X:template = "example" { <blockquote><pre> !!; </pre></blockquote> } + + X:template = "pathname" { <code> !!; </code> } + + X:template = "argument" { <code><i> !!; </i></code> } + X:template = "parameter" { <code> !!; </code> } -X:template = "header" { - X:text {“} !!; X:text {”} -} + X:template = "header" { + X:text {“} !!; X:text {”} + } -X:template = "dirname[/*[@lang='he']]" { - <nobr><span class="ltr"> - X:text {“} !!; X:text {”} - </span></nobr> -} + X:template = "http-error" { + X:text { error code } !{@code} X:text { (} !{@text} X:text{)} + } -X:template = "dirname" { <nobr> X:text {“} !!; X:text {”} </nobr> } + X:template = "dirname[/*[@lang='he']]" { + <nobr><span class="ltr"> + X:text {“} !!; X:text {”} + </span></nobr> + } -X:template = "url[/*[@lang='he']]" { - <i><span class="ltr"> !!; </span></i> -} + X:template = "dirname" { + <nobr> X:text {“} !!; X:text {”} </nobr> + } -X:template = "url" { <i> !!;</i> } + X:template = "url[/*[@lang='he']]" { + <i><span class="ltr"> !!; </span></i> + } -X:template = "path" { X:text {“} <code> !!; </code> X:text {”} } -X:template = "code" { <code> !!; </code> } -X:template = "i" { <i> !!; </i> } -X:template = "b" { <b> !!; </b> } -X:template = "nobr" { <nobr> !!; </nobr> } -X:template = "mdash" { X:text { — } } -X:template = "space" { X:text { } } -X:template = "br" { <br/> } + X:template = "url" { <i> !!;</i> } + + X:template = "path" { X:text {“} <code> !!; </code> X:text {”} } + X:template = "code" { <code> !!; </code> } + X:template = "i" { <i> !!; </i> } + X:template = "b" { <b> !!; </b> } + X:template = "nobr" { <nobr> !!; </nobr> } + X:template = "mdash" { X:text { — } } + X:template = "space" { X:text { } } + X:template = "br" { <br/> } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xsls/directive.xsls Wed Sep 14 15:05:04 2011 +0000 @@ -0,0 +1,52 @@ +X:stylesheet { + + X:template = "directive" { + <a name="{@name}"/> + <!-- <center><h4> !{@name} </h4></center> --> + <div class="directive"> + !! "syntax"; + !! "default"; + !! "context"; + X:if "(@appeared-in)" { + <strong>appeared in version</strong>: !{@appeared-in} + } + </div> + !! "para"; + } + + X:template = "syntax" { + X:if "position() = 1" { + <strong>syntax</strong>: + } else { + <code>       </code> + } + <code> !!; </code> <br/> + } + + X:template = "default" { + <strong>default</strong>: + X:if "count(text()) = 0" { + <strong>none</strong> + } else { + <code> !!; </code> + } + <br/> + } + + X:template = "context" { + X:if "position() = 1" { + <strong>context</strong>: + } + X:if "count(text()) = 0" { + <strong>any</strong> + } else { + <code> !!; </code> + } + X:if "position() != last()" { + X:text{, } + } else { + <br/> + } + } + +}
--- a/xsls/link.xsls Mon Sep 05 13:17:07 2011 +0000 +++ b/xsls/link.xsls Wed Sep 14 15:05:04 2011 +0000 @@ -20,16 +20,19 @@ <!-- convert to a link "docs/page.html" --> - !{ substring-after(document(concat($XML, @href))/article/@link, + !{ substring-after(document(concat($XML, @href))/article/@link + |document(concat($XML, @href))/module/@link, $DIRNAME) } } else { <!-- convert to a link "../../../en/docs/page.html" --> - !{ concat($ROOT, document(concat($XML, @href))/article/@link) } + !{ concat($ROOT, document(concat($XML, @href))/article/@link + |document(concat($XML, @href))/module/@link) } } } - !{ document(concat($XML, @href))/article/@title } + !{ document(concat($XML, @href))/article/@title + |document(concat($XML, @href))/module/@title } </a> } @@ -43,10 +46,12 @@ <a> X:attribute "href" { X:if "starts-with(@href, $DIRNAME)" { - !{ substring-after(document(concat($XML, @href))/article/@link, + !{ substring-after(document(concat($XML, @href))/article/@link + |document(concat($XML, @href))/module/@link, $DIRNAME) } } else { - !{ concat($ROOT, document(concat($XML, @href))/article/@link) } + !{ concat($ROOT, document(concat($XML, @href))/article/@link + |document(concat($XML, @href))/module/@link) } } } !!;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xsls/module.xsls Wed Sep 14 15:05:04 2011 +0000 @@ -0,0 +1,57 @@ +X:stylesheet { + +X:output method="html" indent="no" encoding="utf-8"; + +X:strip-space elements = "*"; + +<!-- + -- a current directory of a XSLT script is where the script is stored, + -- but not where XSLT processor has been started to run the script + --> +X:param XML = "'../xml'"; +X:param YEAR; + +X:var SITE = "'http://nginx.org'"; +X:var LINK = "/module/@link"; + +X:include href = "dirname.xslt"; +X:include href = "link.xslt"; +X:include href = "style.xslt"; +X:include href = "body.xslt"; +X:include href = "menu.xslt"; +X:include href = "directive.xslt"; +X:include href = "content.xslt"; +X:include href = "versions.xslt"; + + +X:template = "/module" { + <html><head> + + <title> !{@title} </title> + + !style (lang="/module/@lang") + + </head> + + !body (lang="/module/@lang") + + </html> +} + + +X:template = "/module[@lang='he']" { + <html dir="rtl"><head> + + <title> !{@title} </title> + + !style (lang="/module/@lang") + + </head> + + !body (lang="/module/@lang") + + </html> +} + + +}
--- a/xsls/style.xsls Mon Sep 05 13:17:07 2011 +0000 +++ b/xsls/style.xsls Wed Sep 14 15:05:04 2011 +0000 @@ -3,18 +3,20 @@ X:template style (lang) { <style>!{ normalize-space(' - html {-webkit-text-size-adjust:none} + html {-webkit-text-size-adjust: none} body { font-family: Georgia, serif; } p { text-align: justify; } p { text-indent: 20pt; } p.noindent { text-indent: 0pt; } + div.directive { background: #EEEEEE; + padding: 10pt 10pt 10pt 20pt; } span.initial { font-size: 200%; float: left; padding-right: 10pt;} li { text-align: justify; } td.list { background: #EEEEEE; } - blockquote.note { text-align: justify; } - blockquote.note { background: #EEEEEE; border: none; } - blockquote.note { padding: 10pt 10pt 10pt 10pt; } + blockquote.note { text-align: justify; + background: #EEEEEE; border: none; + padding: 10pt 10pt 10pt 10pt; } ') } X:if "$lang = 'he'" {