Skip to content

Commit

Permalink
[giow] (0) Captions - Stage 21.1: rendering: the beginning.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@5147 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 9, 2010
1 parent f14be69 commit 269a8a2
Show file tree
Hide file tree
Showing 3 changed files with 376 additions and 167 deletions.
177 changes: 120 additions & 57 deletions complete.html
Expand Up @@ -23132,6 +23132,14 @@ <h4 id=video><span class=secno>4.8.6 </span>The <dfn><code>video</code></dfn> el
particular playback position is defined by the video stream's
format.</p>

<!--TT-->
<p>The <code><a href=#video>video</a></code> element also <a href=#represents>represents</a> any
<a href=#timed-track-cue title="timed track cue">timed track cues</a> whose
<a href=#timed-track-cue-active-flag>timed track cue active flag</a> is set and whose
<a href=#timed-track>timed track</a> is in the <a href=#timed-track-showing title="timed track
showing">showing</a> mode.</p>
<!--TT-->

<p>In addition to the above, the user agent may provide messages to
the user (such as "buffering", "no video loaded", "error", or more
detailed information) by overlaying text or icons on the video or
Expand Down Expand Up @@ -25691,12 +25699,15 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
agent must run the following steps. If the <a href=#current-playback-position>current playback
position</a> changes while the steps are running, then the user
agent must wait for the steps to complete, and then must immediately
rerun the steps. (These steps are thus run as often as possible or
needed &mdash; if one iteration takes a long time, this can cause
certain <a href=#timed-track-cue title="timed track cue">cues</a> to be skipped over
as the user agent rushes ahead to "catch up".)</p>
rerun the steps.
<!--TT-->
(These steps are thus run as often as possible or needed &mdash; if
one iteration takes a long time, this can cause certain <a href=#timed-track-cue title="timed track cue">cues</a> to be skipped over as the user
agent rushes ahead to "catch up".)
<!--TT-->
</p>

<ol><li><p>Let <var title="">current cues</var> be an ordered list of
<ol><!--TT--><li><p>Let <var title="">current cues</var> be an ordered list of
<a href=#timed-track-cue title="timed track cue">cues</a>, initialized to contain
all the <a href=#timed-track-cue title="timed track cue">cues</a> of all the <a href=#timed-track-hidden title="timed track hidden">hidden</a> or <a href=#timed-track-showing title="timed
track showing">showing</a> <a href=#timed-track title="timed track">timed
Expand All @@ -25713,6 +25724,7 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
tracks</a> of the <a href=#media-element>media element</a> that are not
present in <var title="">current cues</var>, also in <a href=#timed-track-cue-order>timed
track cue order</a>.</li>
<!--TT-->

<li><p>If the time was reached through the usual monotonic increase
of the current playback position during normal playback, and if the
Expand All @@ -25732,6 +25744,7 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
not any more frequent than the user agent can comfortably handle
while decoding the video.</li>

<!--TT-->
<li><p>If all of the <a href=#timed-track-cue title="timed track cue">cues</a> in
<var title="">current cues</var> have their <a href=#timed-track-cue-active-flag>timed track cue
active flag</a> set, and none of the <a href=#timed-track-cue title="timed track
Expand Down Expand Up @@ -25789,13 +25802,20 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
active flag</a> of all the <a href=#timed-track-cue title="timed track
cue">cues</a> in the <var title="">other cues</var>.</li>

<li><p>Run the rules for rendering the cues of each of the <a href=#timed-track title="timed track">timed tracks</a> in <var title="">affected
tracks</var> that are <a href=#timed-track-showing title="timed track
showing">showing</a> (e.g., for <a href=#timed-track title="timed track">timed
tracks</a> based on <a href=#websrt>WebSRT</a>, the <a href=#rules-for-updating-the-display-of-websrt-timed-tracks>rules for
updating the display of WebSRT timed tracks</a>).</li>
<li><p>Run the <a href=#rules-for-updating-the-timed-track-rendering>rules for updating the timed track
rendering</a> of each of the <a href=#timed-track title="timed track">timed
tracks</a> in <var title="">affected tracks</var> that are <a href=#timed-track-showing title="timed track showing">showing</a> (e.g., for <a href=#timed-track title="timed track">timed tracks</a> based on
<a href=#websrt>WebSRT</a>, the <a href=#rules-for-updating-the-display-of-websrt-timed-tracks>rules for updating the display of
WebSRT timed tracks</a>).</li>
<!--TT-->

</ol><!--TT--><p>For the purposes of the algorithm above, a <a href=#timed-track-cue>timed track
cue</a> is considered to of a <a href=#timed-track>timed track</a> only if it
is listed in the <a href=#timed-track-list-of-cues>timed track list of cues</a>, not merely
if it is associated with the <a href=#timed-track>timed track</a>.</p>
<!--TT-->

</ol><p>When a <a href=#media-element>media element</a> is <a href=#remove-an-element-from-a-document title="remove an
<p>When a <a href=#media-element>media element</a> is <a href=#remove-an-element-from-a-document title="remove an
element from a document">removed from a
<code>Document</code></a>, if the <a href=#media-element>media element</a>'s
<code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
Expand Down Expand Up @@ -26296,9 +26316,28 @@ <h6 id=timed-track-model><span class=secno>4.8.10.10.1 </span>Timed track model<

<dl><dt>The <dfn id=timed-track-cue-active-flag title="timed track cue active flag">active flag</dfn>
<dd>
<p>This flag must be initially unset. It is used to ensure events
are fired appropriately when the cue becomes active or
inactive.</p>

<p>This flag must be initially unset. The flag is used to ensure
events are fired appropriately when the cue becomes active or
inactive, and to make sure the right cues are rendered.</p>

<p>The user agent must synchronously unset this flag whenever the
<a href=#timed-track-cue>timed track cue</a> is removed from its <a href=#timed-track>timed
track</a>'s <a href=#timed-track-list-of-cues>timed track list of cues</a>; whenever the
<a href=#timed-track>timed track</a> itself is removed from its <a href=#media-element>media
element</a>'s <a href=#list-of-timed-tracks>list of timed tracks</a> or has its
<a href=#timed-track-mode>timed track mode</a> changed to <a href=#timed-track-disabled title="timed track
disabled">disabled</a>; and whenever the <a href=#media-element>media
element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is changed back to
<code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>. When the
flag is unset in this way for one or more cues in <a href=#timed-track title="timed track">timed tracks</a> that were <a href=#timed-track-showing title="timed track showing">showing</a> prior to the relevant
incident, the user agent must, after having unset the flag for all
the affected cues, apply the <a href=#rules-for-updating-the-timed-track-rendering>rules for updating the timed
track rendering</a> of those <a href=#timed-track title="timed track">timed
tracks</a> (e.g., for <a href=#timed-track title="timed track">timed
tracks</a> based on <a href=#websrt>WebSRT</a>, the <a href=#rules-for-updating-the-display-of-websrt-timed-tracks>rules for
updating the display of WebSRT timed tracks</a>).</p>

</dd>

<dt>The <dfn id=timed-track-cue-display-state title="timed track cue display state">display state</dfn>
Expand Down Expand Up @@ -26888,11 +26927,6 @@ <h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
track</a> that the <code><a href=#timedtrack>TimedTrack</a></code> object represents to
the <a href=#timed-track-disabled>timed track disabled</a> mode.</p>

<p>If the <a href=#timed-track-mode>timed track mode</a> was previously the
<a href=#timed-track-showing>timed track showing</a> mode, then apply the rules for
updating the timed track rendering of the <a href=#media-element>media
element</a> appropriate for the <a href=#timed-track>timed track</a>.</p>

</dd>

<dt>If the new value is 1</dt>
Expand All @@ -26903,11 +26937,6 @@ <h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
track</a> that the <code><a href=#timedtrack>TimedTrack</a></code> object represents to
the <a href=#timed-track-hidden>timed track hidden</a> mode.</p>

<p>If the <a href=#timed-track-mode>timed track mode</a> was previously the
<a href=#timed-track-showing>timed track showing</a> mode, then apply the rules for
updating the timed track rendering of the <a href=#media-element>media
element</a> appropriate for the <a href=#timed-track>timed track</a>.</p>

</dd>

<dt>If the new value is 2</dt>
Expand All @@ -26918,10 +26947,6 @@ <h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
track</a> that the <code><a href=#timedtrack>TimedTrack</a></code> object represents to
the <a href=#timed-track-showing>timed track showing</a> mode.</p>

<p>Apply the rules for updating the timed track rendering of the
<a href=#media-element>media element</a> appropriate for the <a href=#timed-track>timed
track</a>.</p>

</dd>

</dl><p>If the <a href=#timed-track-mode>timed track mode</a> of the <a href=#timed-track>timed
Expand All @@ -26948,17 +26973,15 @@ <h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
<code><a href=#timedtrackcuelist>TimedTrackCueList</a></code> object that represents the subset of
the <a href=#timed-track-list-of-cues>timed track list of cues</a> of the <a href=#timed-track>timed
track</a> that the <code><a href=#timedtrack>TimedTrack</a></code> object represents
whose <a href=#timed-track-cue-start-time title="timed track cue start time">start times</a>
occur before the <a href=#current-playback-position-when-the-script-started>current playback position when the script
started</a> and whose <a href=#timed-track-cue-end-time title="timed track cue end time">end
times</a> occur after the <a href=#current-playback-position-when-the-script-started>current playback position when
the script started</a>, in <a href=#timed-track-cue-order>timed track cue
order</a>. Otherwise, it must return null. When an object is
returned, the same object must be returned each time.</p>

<p>The <dfn id=current-playback-position-when-the-script-started>current playback position when the script started</dfn>
is whatever the <a href=#current-playback-position>current playback position</a> was the last
time the <a href=#event-loop>event loop</a> reached step 1.</p>
whose <a href=#active-flag-was-set-when-the-script-started>active flag was set when the script started</a>, in
<a href=#timed-track-cue-order>timed track cue order</a>. Otherwise, it must return
null. When an object is returned, the same object must be returned
each time.</p>

<p>A <a href=#timed-track-cue>timed track cue</a>'s <dfn id=active-flag-was-set-when-the-script-started>active flag was set when
the script started</dfn> if its <a href=#timed-track-cue-active-flag>timed track cue active
flag</a> was set the last time the <a href=#event-loop>event loop</a>
reached step 1.</p>

</div>

Expand Down Expand Up @@ -28797,11 +28820,7 @@ <h5 id=user-interface><span class=secno>4.8.10.12 </span>User interface</h5>
user interface to the user</dfn>. This user interface should include
features to begin playback, pause playback, seek to an arbitrary
position in the content (if the content supports arbitrary seeking),
change the volume, change the display of closed captions

<!-- XXX update this to mention timed tracks -->

or embedded
change the volume, change the display of closed captions or embedded
sign-language tracks, select different audio tracks or turn on audio
descriptions, and show the media content in manners more suitable to
the user (e.g. full-screen video or in an independent resizable
Expand Down Expand Up @@ -86339,22 +86358,68 @@ <h4 id=timed-tracks-0><span class=secno>14.3.2 </span>Timed tracks</h4>

<h5 id=websrt-cue-text-rendering-rules><span class=secno>14.3.2.1 </span><dfn>WebSRT cue text rendering rules</dfn></h5>

<p class=XXX>The <dfn id=rules-for-updating-the-display-of-websrt-timed-tracks>rules for updating the display of WebSRT timed tracks</dfn>
<p>The <dfn id=rules-for-updating-the-display-of-websrt-timed-tracks>rules for updating the display of WebSRT timed
tracks</dfn> render the <a href=#timed-track title="timed track">timed
tracks</a> of a <a href=#media-element>media element</a> (specifically, a
<code><a href=#video>video</a></code> element) by applying the steps below. All the
<a href=#timed-track title="timed track">timed tracks</a> that use these rules
for a given <a href=#media-element>media element</a> are rendered together, to
avoid overlapping subtitles from multiple tracks.</p>

<!--
<p>The output of the steps below is a set of CSS boxes that covers
the rendering area of the <code><a href=#video>video</a></code> element.</p>

<p>The rules are as follows:</p>

<ol><li><p>If the <a href=#media-element>media element</a> is an <code><a href=#audio>audio</a></code>
element, abort these steps. There is nothing to render.</li>

<li><p>Let <var title="">output</var> be an empty list of
absolutely positioned CSS block boxes.</li>

<li><p>Let <var title="">tracks</var> be the subset of the
<a href=#media-element>media element</a>'s <a href=#list-of-timed-tracks>list of timed tracks</a> that
have as their <a href=#rules-for-updating-the-timed-track-rendering>rules for updating the timed track
rendering</a> these <a href=#rules-for-updating-the-display-of-websrt-timed-tracks>rules for updating the display of
WebSRT timed tracks</a>, and whose <a href=#timed-track-mode>timed track mode</a>
is <a href=#timed-track-showing title="timed track showing">showing</a>.</li>

<li><p>Let <var title="">cues</var> be an empty list of <a href=#timed-track-cue title="timed track cue">timed track cues</a>.</li>

list of active WebSRT or WebSRT-compatible cues and their positions
(different than a track's list of active cues)
<li><p>For each track <var title="">track</var> in <var title="">tracks</var>, append to <var title="">cues</var> all the
<a href=#timed-track-cue title="timed track cue">cues</a> from <var title="">track</var>'s <a href=#timed-track-list-of-cues title="timed track list of cues">list
of cues</a> that have their <a href=#timed-track-cue-active-flag>timed track cue active
flag</a> set.</li>

steps to run each time the current playback position changes, for
positioning:
- determine what cues are to be removed now
- remove them
- determine what cues are to be added now
- for each one:
<li>

<p>Sort <var title="">cues</var> in <a href=#timed-track-cue-order>timed track cue
order</a>.</p>

<p class=note>If the tracks and cues in the previous steps were
added to the lists in the same order as the lists from which they
were sourced, the <var title="">cues</var> list will already be in
<a href=#timed-track-cue-order>timed track cue order</a>.</p>

</li>

<li><p>For each <a href=#timed-track-cue>timed track cue</a> <var title="">cue</var> in <var title="">cues</var>: if <var title="">cue</var>'s <a href=#timed-track-cue-display-state>timed track cue display state</a> has
a set of CSS boxes, then add those boxes to <var title="">output</var>, and remove <var title="">cue</var> from <var title="">cues</var>.</li>

<li>

<p class=XXX>...</p>

<!--XXX
for each cue in cues:
- find default position per http://damowmow.com/temp/srtspec
- shunt it around to fit the current active ones
- add it to the list
-->

</li>

</ol><!-- XXX

rules for rendering the list of active cues:
- for each segment, decide if it's before or after the current
Expand All @@ -86368,9 +86433,7 @@ <h5 id=websrt-cue-text-rendering-rules><span class=secno>14.3.2.1 </span><dfn>We
propagate towards the end of the segment so that it reaches the end
of the segment when the next segment becomes "before".

-->

<h5 id=css-extensions><span class=secno>14.3.2.2 </span>CSS extensions</h5>
--><h5 id=css-extensions><span class=secno>14.3.2.2 </span>CSS extensions</h5>

<p class=note>This section is intended to be moved to a CSS
specification once an editor is found to run with it.</p>
Expand Down

0 comments on commit 269a8a2

Please sign in to comment.