# HG changeset patch # User Igor Sysoev # Date 1316012704 0 # Node ID 9d3403f5204dddd4e5046f7728195632fe08a4cd # Parent a6e1763d5590e8a807f5f19f4aca80b19aa0e5ec nginx-1.1.3, ngx_http_mp4_module diff -r a6e1763d5590 -r 9d3403f5204d GNUmakefile --- 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 \ diff -r a6e1763d5590 -r 9d3403f5204d dtd/module.dtd --- /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 @@ + + + + + + + %content; diff -r a6e1763d5590 -r 9d3403f5204d text/en/CHANGES --- 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 diff -r a6e1763d5590 -r 9d3403f5204d text/ru/CHANGES.ru --- 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 *) Изменение: теперь, если суммарный размер всех диапазонов больше diff -r a6e1763d5590 -r 9d3403f5204d xml/en/GNUmakefile --- 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 \ diff -r a6e1763d5590 -r 9d3403f5204d xml/en/docs/http/ngx_http_mp4_module.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 @@ + + + + + + +
+ + +The module ngx_http_mp4_module provides pseudo-streaming +server-side support for H.264/AAC files typically having filename extensions +.mp4, .m4v, +and .m4a. + + + +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 +start +and specified in seconds), and the server responds with a stream +so that its start position corresponds to the requested time, +for example: + +http://example.com/elephants_dream.mp4?start=238.88 + +This allows for a random seeking at any time, or starting playback +in the middle of a timeline. + + + +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. + + + +To start playback, a player first needs to read metadata. +This is done by sending a special request with the +start=0 +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 + +prepare an original file for pseudo-streaming, +rather than having nginx do this on every such request. + + + +For a matching request with a non-zero +start +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. + + + +If a matching request does not include the +start +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. + + + +This module is not built by default, it should be enabled with the +--with-http_mp4_module +configuration parameter. + +If you were using the third-party mp4 module, be sure to disable it. + + + + + +
+ + +
+ + + +location /video/ { + mp4; + mp4_buffer_size 1m; + mp4_max_buffer_size 5m; +} + + + +
+ + +
+ + +mp4 + +location + + +Turns on module processing in a surrounding location. + + + + + + +mp4_buffer_size size +mp4_buffer_size 512K +http +server +location + + +Sets the initial size of a memory buffer used to process MP4 files. + + + + + + +mp4_max_buffer_size size +mp4_max_buffer_size 10M +http +server +location + + +During metadata processing, a larger buffer may become necessary. +Its size cannot exceed the specified size, +or else nginx will return +, +and log the following: + +"/some/movie/file.mp4" mp4 moov atom is too large: +12583268, you may want to increase mp4_max_buffer_size + + + + + +
+ +
diff -r a6e1763d5590 -r 9d3403f5204d xml/en/docs/index.xml --- 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 @@ +
+ + + + + + + + + + + +
+ diff -r a6e1763d5590 -r 9d3403f5204d xml/en/download.xml --- 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 @@ + diff -r a6e1763d5590 -r 9d3403f5204d xml/index.xml --- 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 @@ + + +nginx-1.1.3 +development version has been released.
+New . + + + nginx-1.1.2 diff -r a6e1763d5590 -r 9d3403f5204d xml/ru/download.xml --- 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 @@ + diff -r a6e1763d5590 -r 9d3403f5204d xml/versions.xml --- 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 @@ - 1.1.2 + 1.1.3 1.0.6 0.8.55 diff -r a6e1763d5590 -r 9d3403f5204d xsls/content.xsls --- 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]" { -

!{@title}

- !!; -} + X:template = "section[@name and @title]" { +

!{@title}

+ !!; + } -X:template = "section[not(@name) and @title]" { -

!{@title}

- !!; -} + X:template = "section[not(@name) and @title]" { +

!{@title}

+ !!; + } -X:template = "section[not(@name) and not(@title)]" { !!; } + X:template = "section[not(@name) and not(@title)]" { !!; } -X:template = "para" {

!!;

} + X:template = "para" {

!!;

} -X:template = "item/para" {

!!;

} + X:template = "item/para" {

!!;

} -X:template = "para[@align]" {

!!;

} + X:template = "para[@align]" {

!!;

} -X:template = "para[child::initial]" {

!!;

} + X:template = "para[child::initial]" {

!!;

} -X:template = "initial" { !!; } + X:template = "initial" { !!; } -X:template = "programlisting" {
 !!; 
} + X:template = "programlisting" {
 !!; 
} -X:template = "para/programlisting" { - X:text disable-output-escaping="yes" {</p> } -
 !!; 
- X:text disable-output-escaping="yes" {<p class="noindent"> } -} + X:template = "para/programlisting" { + X:text disable-output-escaping="yes" {</p> } +
 !!; 
+ X:text disable-output-escaping="yes" {<p class="noindent"> } + } -X:template = "note" {
!!;
} + X:template = "note" {
!!;
} -X:template = "para/note" { - X:text disable-output-escaping="yes" {</p> } -
!!;
- X:text disable-output-escaping="yes" {<p class="noindent"> } -} + X:template = "para/note" { + X:text disable-output-escaping="yes" {</p> } +
!!;
+ X:text disable-output-escaping="yes" {<p class="noindent"> } + } + + + X:template = "list" {
    !!;
} + X:template = "item" {
  • !!;
  • } -X:template = "list" {
      !!;
    } -X:template = "item" {
  • !!;
  • } - - -X:template = "orderedlist" {
      !!;
    } -X:template = "item" {
  • !!;
  • } + X:template = "orderedlist" {
      !!;
    } + X:template = "item" {
  • !!;
  • } -X:template = "table[@note and @width]" { -
    !!;
    -} -X:template = "table[@note and not(@width)]" { -
    !!;
    -} -X:template = "table[not(@note) and @width]" { - !!;
    -} -X:template = "table" { !!;
    } -X:template = "tr" { !!; } -X:template = "td[@width]" { !!; } -X:template = "td" { !!; } + X:template = "table[@note and @width]" { +
    !!;
    + } + X:template = "table[@note and not(@width)]" { +
    !!;
    + } + X:template = "table[not(@note) and @width]" { + !!;
    + } + X:template = "table" { !!;
    } + X:template = "tr" { !!; } + X:template = "td[@width]" { !!; } + X:template = "td" { !!; } + + X:template = "command" { !!; } + + X:template = "example" {
     !!; 
    } + + X:template = "pathname" { !!; } + + X:template = "argument" { !!; } + X:template = "parameter" { !!; } -X:template = "header" { - X:text {“} !!; X:text {”} -} + X:template = "header" { + X:text {“} !!; X:text {”} + } -X:template = "dirname[/*[@lang='he']]" { - - X:text {“} !!; X:text {”} - -} + X:template = "http-error" { + X:text { error code } !{@code} X:text { (} !{@text} X:text{)} + } -X:template = "dirname" { X:text {“} !!; X:text {”} } + X:template = "dirname[/*[@lang='he']]" { + + X:text {“} !!; X:text {”} + + } -X:template = "url[/*[@lang='he']]" { - !!; -} + X:template = "dirname" { + X:text {“} !!; X:text {”} + } -X:template = "url" { !!; } + X:template = "url[/*[@lang='he']]" { + !!; + } -X:template = "path" { X:text {“} !!; X:text {”} } -X:template = "code" { !!; } -X:template = "i" { !!; } -X:template = "b" { !!; } -X:template = "nobr" { !!; } -X:template = "mdash" { X:text { — } } -X:template = "space" { X:text { } } -X:template = "br" {
    } + X:template = "url" { !!; } + + X:template = "path" { X:text {“} !!; X:text {”} } + X:template = "code" { !!; } + X:template = "i" { !!; } + X:template = "b" { !!; } + X:template = "nobr" { !!; } + X:template = "mdash" { X:text { — } } + X:template = "space" { X:text { } } + X:template = "br" {
    } } diff -r a6e1763d5590 -r 9d3403f5204d xsls/directive.xsls --- /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" { +
    + +
    + !! "syntax"; + !! "default"; + !! "context"; + X:if "(@appeared-in)" { + appeared in version: !{@appeared-in} + } +
    + !! "para"; + } + + X:template = "syntax" { + X:if "position() = 1" { + syntax: + } else { +         + } + !!;
    + } + + X:template = "default" { + default: + X:if "count(text()) = 0" { + none + } else { + !!; + } +
    + } + + X:template = "context" { + X:if "position() = 1" { + context: + } + X:if "count(text()) = 0" { + any + } else { + !!; + } + X:if "position() != last()" { + X:text{, } + } else { +
    + } + } + +} diff -r a6e1763d5590 -r 9d3403f5204d xsls/link.xsls --- 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 @@ - !{ 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) } } } - !{ document(concat($XML, @href))/article/@title } + !{ document(concat($XML, @href))/article/@title + |document(concat($XML, @href))/module/@title }
    } @@ -43,10 +46,12 @@ 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) } } } !!; diff -r a6e1763d5590 -r 9d3403f5204d xsls/module.xsls --- /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 = "*"; + + +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" { + + + !{@title} + + !style (lang="/module/@lang") + + + + !body (lang="/module/@lang") + + +} + + +X:template = "/module[@lang='he']" { + + + !{@title} + + !style (lang="/module/@lang") + + + + !body (lang="/module/@lang") + + +} + + +} diff -r a6e1763d5590 -r 9d3403f5204d xsls/style.xsls --- 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) {