shaka-packager/html/library.html

213 lines
19 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Shaka Packager Library &#8212; Shaka Packager documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/sphinxdoc_new.css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="_static/table_styling.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Build Instructions" href="build_instructions.html" />
<link rel="prev" title="Design" href="design.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="build_instructions.html" title="Build Instructions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="design.html" title="Design"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Shaka Packager documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Shaka Packager Library</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="shaka-packager-library">
<h1>Shaka Packager Library<a class="headerlink" href="#shaka-packager-library" title="Permalink to this headline"></a></h1>
<p>Documentation for the top level Shaka packager library. See
<a class="reference external" href="https://google.github.io/shaka-packager/docs/annotated.html">Internal API</a>
for documentation on internal APIs.</p>
<dl class="cpp class">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8PackagerE">
<span id="_CPPv3N5shaka8PackagerE"></span><span id="_CPPv2N5shaka8PackagerE"></span><span id="shaka::Packager"></span><span class="target" id="db/dd0/classshaka_1_1Packager"></span><span class="k"><span class="pre">class</span></span><span class="w"> </span><span class="sig-prename descclassname"><span class="n"><span class="pre">shaka</span></span><span class="p"><span class="pre">::</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">Packager</span></span></span><a class="headerlink" href="#_CPPv4N5shaka8PackagerE" title="Permalink to this definition"></a><br /></dt>
<dd><div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-functions">Public Functions</p>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE">
<span id="_CPPv3N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE"></span><span id="_CPPv2N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE"></span><span id="shaka::Packager::Initialize__PackagingParamsCR.std::vector:StreamDescriptor:CR"></span><span class="target" id="db/dd0/classshaka_1_1Packager_1ae40969a98da3a27a0b1633927afb3ce2"></span><a class="reference internal" href="library_details.html#_CPPv4N5shaka6StatusE" title="shaka::Status"><span class="n"><span class="pre">Status</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">Initialize</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><a class="reference internal" href="library_details.html#_CPPv4N5shaka15PackagingParamsE" title="shaka::PackagingParams"><span class="n"><span class="pre">PackagingParams</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">packaging_params</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><a class="reference internal" href="library_details.html#_CPPv4N5shaka16StreamDescriptorE" title="shaka::StreamDescriptor"><span class="n"><span class="pre">StreamDescriptor</span></span></a><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">stream_descriptors</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5shaka8Packager10InitializeERK15PackagingParamsRKNSt6vectorI16StreamDescriptorEE" title="Permalink to this definition"></a><br /></dt>
<dd><p>Initialize packaging pipeline. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>packaging_params</strong> contains the packaging parameters. </p></li>
<li><p><strong>stream_descriptors</strong> a list of stream descriptors. </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>OK on success, an appropriate error code on failure. </p>
</dd>
</dl>
</dd></dl>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager3RunEv">
<span id="_CPPv3N5shaka8Packager3RunEv"></span><span id="_CPPv2N5shaka8Packager3RunEv"></span><span id="shaka::Packager::Run"></span><span class="target" id="db/dd0/classshaka_1_1Packager_1a48275206bc7032eb69607081ac0ada08"></span><a class="reference internal" href="library_details.html#_CPPv4N5shaka6StatusE" title="shaka::Status"><span class="n"><span class="pre">Status</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">Run</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5shaka8Packager3RunEv" title="Permalink to this definition"></a><br /></dt>
<dd><p>Run the pipeline to completion (or failed / been cancelled). Note that it blocks until completion. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>OK on success, an appropriate error code on failure. </p>
</dd>
</dl>
</dd></dl>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager6CancelEv">
<span id="_CPPv3N5shaka8Packager6CancelEv"></span><span id="_CPPv2N5shaka8Packager6CancelEv"></span><span id="shaka::Packager::Cancel"></span><span class="target" id="db/dd0/classshaka_1_1Packager_1a5323e6dc242b1cdd6208cd6ea77dd0c7"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">Cancel</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5shaka8Packager6CancelEv" title="Permalink to this definition"></a><br /></dt>
<dd><p>Cancel packaging. Note that it has to be called from another thread. </p>
</dd></dl>
</div>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-static-functions">Public Static Functions</p>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager17GetLibraryVersionEv">
<span id="_CPPv3N5shaka8Packager17GetLibraryVersionEv"></span><span id="_CPPv2N5shaka8Packager17GetLibraryVersionEv"></span><span id="shaka::Packager::GetLibraryVersion"></span><span class="target" id="db/dd0/classshaka_1_1Packager_1a7bae5b5c202a716f5d890e70afae51b2"></span><span class="k"><span class="pre">static</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">string</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">GetLibraryVersion</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5shaka8Packager17GetLibraryVersionEv" title="Permalink to this definition"></a><br /></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The version of the library. </p>
</dd>
</dl>
</dd></dl>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE">
<span id="_CPPv3N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE"></span><span id="_CPPv2N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE"></span><span id="shaka::Packager::DefaultStreamLabelFunction__i.i.i.EncryptionParams::EncryptedStreamAttributesCR"></span><span class="target" id="db/dd0/classshaka_1_1Packager_1a59fec4e3f33138081e5222d3553ab948"></span><span class="k"><span class="pre">static</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">string</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DefaultStreamLabelFunction</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_sd_pixels</span></span>, <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_hd_pixels</span></span>, <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_uhd1_pixels</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><a class="reference internal" href="library_details.html#_CPPv4N5shaka16EncryptionParamsE" title="shaka::EncryptionParams"><span class="n"><span class="pre">EncryptionParams</span></span></a><span class="p"><span class="pre">::</span></span><a class="reference internal" href="library_details.html#_CPPv4N5shaka16EncryptionParams25EncryptedStreamAttributesE" title="shaka::EncryptionParams::EncryptedStreamAttributes"><span class="n"><span class="pre">EncryptedStreamAttributes</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">stream_attributes</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N5shaka8Packager26DefaultStreamLabelFunctionEiiiRKN16EncryptionParams25EncryptedStreamAttributesE" title="Permalink to this definition"></a><br /></dt>
<dd><p>Default stream label function implementation. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>max_sd_pixels</strong> The threshold to determine whether a video track should be considered as SD. If the max pixels per frame is no higher than max_sd_pixels, i.e. [0, max_sd_pixels], it is SD. </p></li>
<li><p><strong>max_hd_pixels</strong> The threshold to determine whether a video track should be considered as HD. If the max pixels per frame is higher than max_sd_pixels, but no higher than max_hd_pixels, i.e. (max_sd_pixels, max_hd_pixels], it is HD. </p></li>
<li><p><strong>max_uhd1_pixels</strong> The threshold to determine whether a video track should be considered as UHD1. If the max pixels per frame is higher than max_hd_pixels, but no higher than max_uhd1_pixels, i.e. (max_hd_pixels, max_uhd1_pixels], it is UHD1. Otherwise it is UHD2. </p></li>
<li><p><strong>stream_info</strong> Encrypted stream info. </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>the stream label associated with <code class="docutils literal notranslate"><span class="pre">stream_info</span></code>. Can be “AUDIO”, “SD”, “HD”, “UHD1” or “UHD2”. </p>
</dd>
</dl>
</dd></dl>
</div>
<dl class="cpp struct">
<dt class="sig sig-object cpp" id="_CPPv4N5shaka8Packager16PackagerInternalE">
<span id="_CPPv3N5shaka8Packager16PackagerInternalE"></span><span id="_CPPv2N5shaka8Packager16PackagerInternalE"></span><span id="shaka::Packager::PackagerInternal"></span><span class="target" id="dc/d33/structshaka_1_1Packager_1_1PackagerInternal"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PackagerInternal</span></span></span><a class="headerlink" href="#_CPPv4N5shaka8Packager16PackagerInternalE" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</dd></dl>
<p>Sample code:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">shaka</span><span class="o">::</span><span class="n">Packager</span> <span class="n">packager</span><span class="p">;</span>
<span class="c1">// Setup packaging parameters.</span>
<span class="n">shaka</span><span class="o">::</span><span class="n">PackagingParams</span> <span class="n">packaging_params</span><span class="p">;</span>
<span class="c1">// Use default parameters here.</span>
<span class="c1">// Setup stream descriptors.</span>
<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">shaka</span><span class="o">::</span><span class="n">StreamDescriptor</span><span class="o">&gt;</span> <span class="n">stream_descriptors</span><span class="p">;</span>
<span class="n">shaka</span><span class="o">::</span><span class="n">StreamDescriptor</span> <span class="n">stream_descriptor</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">input</span> <span class="o">=</span> <span class="s">&quot;input.mp4&quot;</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">stream_selector</span> <span class="o">=</span> <span class="s">&quot;video&quot;</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">output</span> <span class="o">=</span> <span class="s">&quot;output_video.mp4&quot;</span><span class="p">;</span>
<span class="n">stream_descriptors</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">stream_descriptor</span><span class="p">);</span>
<span class="n">shaka</span><span class="o">::</span><span class="n">StreamDescriptor</span> <span class="n">stream_descriptor</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">input</span> <span class="o">=</span> <span class="s">&quot;input.mp4&quot;</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">stream_selector</span> <span class="o">=</span> <span class="s">&quot;audio&quot;</span><span class="p">;</span>
<span class="n">stream_descriptor</span><span class="p">.</span><span class="n">output</span> <span class="o">=</span> <span class="s">&quot;output_audio.mp4&quot;</span><span class="p">;</span>
<span class="n">stream_descriptors</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">stream_descriptor</span><span class="p">);</span>
<span class="n">shaka</span><span class="o">::</span><span class="n">Status</span> <span class="n">status</span> <span class="o">=</span> <span class="n">packager</span><span class="p">.</span><span class="n">Initialize</span><span class="p">(</span><span class="n">packaging_params</span><span class="p">,</span>
<span class="n">stream_descriptors</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">status</span><span class="p">.</span><span class="n">ok</span><span class="p">())</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">packager</span><span class="p">.</span><span class="n">Run</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">status</span><span class="p">.</span><span class="n">ok</span><span class="p">())</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="design.html"
title="previous chapter">Design</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="build_instructions.html"
title="next chapter">Build Instructions</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/library.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="build_instructions.html" title="Build Instructions"
>next</a> |</li>
<li class="right" >
<a href="design.html" title="Design"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Shaka Packager documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Shaka Packager Library</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Google.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.0.2.
</div>
</body>
</html>